@arcgis/coding-components 4.29.0-beta.63 → 4.29.0-beta.64
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/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +5 -0
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +5 -0
- package/dist/arcgis-coding-components/index.esm.js +1 -1
- package/dist/arcgis-coding-components/{p-989439a0.js → p-21871ede.js} +1 -1
- package/dist/arcgis-coding-components/{p-7d5fcf2e.js → p-3b2457f7.js} +7 -7
- package/dist/arcgis-coding-components/{p-2a665136.js → p-45b5bca3.js} +1 -1
- package/dist/arcgis-coding-components/{p-7b6af57c.js → p-59247049.js} +1 -1
- package/dist/arcgis-coding-components/{p-3ba4deea.js → p-6e1f1ee0.js} +1 -1
- package/dist/arcgis-coding-components/{p-595d9a06.js → p-8010edc0.js} +1 -1
- package/dist/arcgis-coding-components/{p-9b4a0643.js → p-9301388a.js} +1 -1
- package/dist/arcgis-coding-components/{p-e4efcbd0.entry.js → p-be5ec0c4.entry.js} +1 -1
- package/dist/arcgis-coding-components/{p-d7ca1083.js → p-c0bf49ad.js} +1 -1
- package/dist/arcgis-coding-components/{p-fcdd0366.js → p-ec3e9c42.js} +1 -1
- package/dist/cjs/{arcade-defaults-5c2ff166.js → arcade-defaults-82737060.js} +7 -7
- package/dist/cjs/{arcade-mode-23925c8d.js → arcade-mode-b21b24cc.js} +1 -1
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +2 -2
- package/dist/cjs/{cssMode-2e878b70.js → cssMode-bc43621f.js} +1 -1
- package/dist/cjs/{html-847c7e39.js → html-4a747b36.js} +1 -1
- package/dist/cjs/{htmlMode-7a36db6d.js → htmlMode-c11513d8.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{javascript-f5ca9a1a.js → javascript-51f1b49d.js} +2 -2
- package/dist/cjs/{jsonMode-0d326a6e.js → jsonMode-3985bbe9.js} +1 -1
- package/dist/cjs/{tsMode-e4abe99d.js → tsMode-b2b3fb82.js} +1 -1
- package/dist/cjs/{typescript-c43b7258.js → typescript-795a538e.js} +1 -1
- package/dist/esm/{arcade-defaults-7525fe7a.js → arcade-defaults-375c8393.js} +7 -7
- package/dist/esm/{arcade-mode-312bbd22.js → arcade-mode-2b1c4c38.js} +1 -1
- package/dist/esm/arcgis-arcade-api_6.entry.js +2 -2
- package/dist/esm/{cssMode-71ce0374.js → cssMode-2d3bbf6d.js} +1 -1
- package/dist/esm/{html-37ae4460.js → html-ba801b93.js} +1 -1
- package/dist/esm/{htmlMode-ae5b0f39.js → htmlMode-790fcdc3.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{javascript-ad435a4b.js → javascript-10081345.js} +2 -2
- package/dist/esm/{jsonMode-b8bb4df0.js → jsonMode-d6de3d90.js} +1 -1
- package/dist/esm/{tsMode-b967128d.js → tsMode-2efadb1a.js} +1 -1
- package/dist/esm/{typescript-a9a22ab3.js → typescript-534a4558.js} +1 -1
- package/package.json +6 -6
|
@@ -19,45 +19,45 @@ const{entries:gc,setPrototypeOf:pc,isFrozen:mc,getPrototypeOf:wc,getOwnPropertyD
|
|
|
19
19
|
* Released under the MIT license
|
|
20
20
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
21
21
|
*-----------------------------------------------------------------------------*/
|
|
22
|
-
Gq({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>import("./p-
|
|
22
|
+
Gq({id:"html",extensions:[".html",".htm",".shtml",".xhtml",".mdoc",".jsp",".asp",".aspx",".jshtm"],aliases:["HTML","htm","html","xhtml"],mimetypes:["text/html","text/x-jshtm","text/template","text/ng-template"],loader:()=>import("./p-45b5bca3.js")}),
|
|
23
23
|
/*!-----------------------------------------------------------------------------
|
|
24
24
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
25
25
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
26
26
|
* Released under the MIT license
|
|
27
27
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
28
28
|
*-----------------------------------------------------------------------------*/
|
|
29
|
-
Gq({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-
|
|
29
|
+
Gq({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-c0bf49ad.js")}),
|
|
30
30
|
/*!-----------------------------------------------------------------------------
|
|
31
31
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
32
32
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
33
33
|
* Released under the MIT license
|
|
34
34
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
35
35
|
*-----------------------------------------------------------------------------*/
|
|
36
|
-
Gq({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-
|
|
36
|
+
Gq({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-59247049.js")});
|
|
37
37
|
/*!-----------------------------------------------------------------------------
|
|
38
38
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
39
39
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
40
40
|
* Released under the MIT license
|
|
41
41
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
42
42
|
*-----------------------------------------------------------------------------*/
|
|
43
|
-
var Zq=Object.defineProperty,Jq=Object.getOwnPropertyDescriptor,Qq=Object.getOwnPropertyNames,Yq=Object.prototype.hasOwnProperty,Xq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Qq(i))Yq.call(t,n)||n===e||Zq(t,n,{get:()=>i[n],enumerable:!(s=Jq(i,n))||s.enumerable});return t},tG={};((t,i)=>{Xq(tG,i,"default")})(0,Bq);var iG=class{_onDidChange=new tG.Emitter;_options;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(t){this._options=t||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(t){this.setOptions(t)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}},eG={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},sG={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},nG=new iG("css",eG,sG),rG=new iG("scss",eG,sG),oG=new iG("less",eG,sG);function hG(){return import("./p-
|
|
43
|
+
var Zq=Object.defineProperty,Jq=Object.getOwnPropertyDescriptor,Qq=Object.getOwnPropertyNames,Yq=Object.prototype.hasOwnProperty,Xq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Qq(i))Yq.call(t,n)||n===e||Zq(t,n,{get:()=>i[n],enumerable:!(s=Jq(i,n))||s.enumerable});return t},tG={};((t,i)=>{Xq(tG,i,"default")})(0,Bq);var iG=class{_onDidChange=new tG.Emitter;_options;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this.options}get options(){return this._options}setOptions(t){this._options=t||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(t){this.setOptions(t)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}},eG={validate:!0,lint:{compatibleVendorPrefixes:"ignore",vendorPrefix:"warning",duplicateProperties:"warning",emptyRules:"warning",importStatement:"ignore",boxModel:"ignore",universalSelector:"ignore",zeroUnits:"ignore",fontFaceProperties:"warning",hexColorLength:"error",argumentsInColorFunction:"error",unknownProperties:"warning",ieHack:"ignore",unknownVendorSpecificProperties:"ignore",propertyIgnoredDueToDisplay:"warning",important:"ignore",float:"ignore",idSelector:"ignore"},data:{useDefaultDataProvider:!0},format:{newlineBetweenSelectors:!0,newlineBetweenRules:!0,spaceAroundSelectorSeparator:!1,braceStyle:"collapse",maxPreserveNewLines:void 0,preserveNewLines:!0}},sG={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0,documentFormattingEdits:!0,documentRangeFormattingEdits:!0},nG=new iG("css",eG,sG),rG=new iG("scss",eG,sG),oG=new iG("less",eG,sG);function hG(){return import("./p-8010edc0.js")}tG.languages.css={cssDefaults:nG,lessDefaults:oG,scssDefaults:rG},tG.languages.onLanguage("less",(()=>{hG().then((t=>t.setupMode(oG)))})),tG.languages.onLanguage("scss",(()=>{hG().then((t=>t.setupMode(rG)))})),tG.languages.onLanguage("css",(()=>{hG().then((t=>t.setupMode(nG)))}));
|
|
44
44
|
/*!-----------------------------------------------------------------------------
|
|
45
45
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
46
46
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
47
47
|
* Released under the MIT license
|
|
48
48
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
49
49
|
*-----------------------------------------------------------------------------*/
|
|
50
|
-
var cG=Object.defineProperty,lG=Object.getOwnPropertyDescriptor,aG=Object.getOwnPropertyNames,uG=Object.prototype.hasOwnProperty,dG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of aG(i))uG.call(t,n)||n===e||cG(t,n,{get:()=>i[n],enumerable:!(s=lG(i,n))||s.enumerable});return t},fG={};((t,i)=>{dG(fG,i,"default")})(0,Bq);var gG=class{_onDidChange=new fG.Emitter;_options;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(t){this._options=t||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}},pG={format:{tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{},data:{useDefaultDataProvider:!0}};function mG(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===wG,documentFormattingEdits:t===wG,documentRangeFormattingEdits:t===wG}}var wG="html",vG="handlebars",bG="razor",yG=DG(wG,pG,mG(wG)),kG=yG.defaults,CG=DG(vG,pG,mG(vG)),SG=CG.defaults,xG=DG(bG,pG,mG(bG));function DG(t,i=pG,e=mG(t)){const s=new gG(t,i,e);let n;const r=fG.languages.onLanguage(t,(async()=>{n=(await import("./p-
|
|
50
|
+
var cG=Object.defineProperty,lG=Object.getOwnPropertyDescriptor,aG=Object.getOwnPropertyNames,uG=Object.prototype.hasOwnProperty,dG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of aG(i))uG.call(t,n)||n===e||cG(t,n,{get:()=>i[n],enumerable:!(s=lG(i,n))||s.enumerable});return t},fG={};((t,i)=>{dG(fG,i,"default")})(0,Bq);var gG=class{_onDidChange=new fG.Emitter;_options;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(t){this._options=t||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}},pG={format:{tabSize:4,insertSpaces:!1,wrapLineLength:120,unformatted:'default": "a, abbr, acronym, b, bdo, big, br, button, cite, code, dfn, em, i, img, input, kbd, label, map, object, q, samp, select, small, span, strong, sub, sup, textarea, tt, var',contentUnformatted:"pre",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:void 0,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{},data:{useDefaultDataProvider:!0}};function mG(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===wG,documentFormattingEdits:t===wG,documentRangeFormattingEdits:t===wG}}var wG="html",vG="handlebars",bG="razor",yG=DG(wG,pG,mG(wG)),kG=yG.defaults,CG=DG(vG,pG,mG(vG)),SG=CG.defaults,xG=DG(bG,pG,mG(bG));function DG(t,i=pG,e=mG(t)){const s=new gG(t,i,e);let n;const r=fG.languages.onLanguage(t,(async()=>{n=(await import("./p-9301388a.js")).setupMode(s)}));return{defaults:s,dispose(){r.dispose(),n?.dispose(),n=void 0}}}
|
|
51
51
|
/*!-----------------------------------------------------------------------------
|
|
52
52
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
53
53
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
54
54
|
* Released under the MIT license
|
|
55
55
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
56
|
-
*-----------------------------------------------------------------------------*/fG.languages.html={htmlDefaults:kG,razorDefaults:xG.defaults,handlebarDefaults:SG,htmlLanguageService:yG,handlebarLanguageService:CG,razorLanguageService:xG,registerHTMLLanguageService:DG};var EG=Object.defineProperty,AG=Object.getOwnPropertyDescriptor,MG=Object.getOwnPropertyNames,LG=Object.prototype.hasOwnProperty,FG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of MG(i))LG.call(t,n)||n===e||EG(t,n,{get:()=>i[n],enumerable:!(s=AG(i,n))||s.enumerable});return t},TG={};((t,i)=>{FG(TG,i,"default")})(0,Bq);var RG=new class{_onDidChange=new TG.Emitter;_diagnosticsOptions;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setDiagnosticsOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(t){this._diagnosticsOptions=t||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}}("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});TG.languages.json={jsonDefaults:RG},TG.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),TG.languages.onLanguage("json",(()=>{import("./p-
|
|
56
|
+
*-----------------------------------------------------------------------------*/fG.languages.html={htmlDefaults:kG,razorDefaults:xG.defaults,handlebarDefaults:SG,htmlLanguageService:yG,handlebarLanguageService:CG,razorLanguageService:xG,registerHTMLLanguageService:DG};var EG=Object.defineProperty,AG=Object.getOwnPropertyDescriptor,MG=Object.getOwnPropertyNames,LG=Object.prototype.hasOwnProperty,FG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of MG(i))LG.call(t,n)||n===e||EG(t,n,{get:()=>i[n],enumerable:!(s=AG(i,n))||s.enumerable});return t},TG={};((t,i)=>{FG(TG,i,"default")})(0,Bq);var RG=new class{_onDidChange=new TG.Emitter;_diagnosticsOptions;_modeConfiguration;_languageId;constructor(t,i,e){this._languageId=t,this.setDiagnosticsOptions(i),this.setModeConfiguration(e)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(t){this._diagnosticsOptions=t||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(this)}}("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:"warning",schemaValidation:"warning",comments:"error",trailingCommas:"error"},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});TG.languages.json={jsonDefaults:RG},TG.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),TG.languages.onLanguage("json",(()=>{import("./p-21871ede.js").then((t=>t.setupMode(RG)))}));
|
|
57
57
|
/*!-----------------------------------------------------------------------------
|
|
58
58
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
59
59
|
* Version: 0.45.0(5e5af013f8d295555a7210df0d5f2cea0bf5dd56)
|
|
60
60
|
* Released under the MIT license
|
|
61
61
|
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
|
|
62
62
|
*-----------------------------------------------------------------------------*/
|
|
63
|
-
var OG=Object.defineProperty,_G=Object.getOwnPropertyDescriptor,IG=Object.getOwnPropertyNames,PG=Object.prototype.hasOwnProperty,NG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of IG(i))PG.call(t,n)||n===e||OG(t,n,{get:()=>i[n],enumerable:!(s=_G(i,n))||s.enumerable});return t},BG={};((t,i)=>{NG(BG,i,"default")})(0,Bq);var $G=(t=>(t[t.None=0]="None",t[t.CommonJS=1]="CommonJS",t[t.AMD=2]="AMD",t[t.UMD=3]="UMD",t[t.System=4]="System",t[t.ES2015=5]="ES2015",t[t.ESNext=99]="ESNext",t))($G||{}),WG=(t=>(t[t.None=0]="None",t[t.Preserve=1]="Preserve",t[t.React=2]="React",t[t.ReactNative=3]="ReactNative",t[t.ReactJSX=4]="ReactJSX",t[t.ReactJSXDev=5]="ReactJSXDev",t))(WG||{}),jG=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(jG||{}),VG=(t=>(t[t.ES3=0]="ES3",t[t.ES5=1]="ES5",t[t.ES2015=2]="ES2015",t[t.ES2016=3]="ES2016",t[t.ES2017=4]="ES2017",t[t.ES2018=5]="ES2018",t[t.ES2019=6]="ES2019",t[t.ES2020=7]="ES2020",t[t.ESNext=99]="ESNext",t[t.JSON=100]="JSON",t[t.Latest=99]="Latest",t))(VG||{}),HG=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(HG||{}),zG=class{_onDidChange=new BG.Emitter;_onDidExtraLibsChange=new BG.Emitter;_extraLibs;_removedExtraLibs;_eagerModelSync;_compilerOptions;_diagnosticsOptions;_workerOptions;_onDidExtraLibsChangeTimeout;_inlayHintsOptions;_modeConfiguration;constructor(t,i,e,s,n){this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(t),this.setDiagnosticsOptions(i),this.setWorkerOptions(e),this.setInlayHintsOptions(s),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(t,i){let e;if(e=void 0===i?`ts:extralib-${Math.random().toString(36).substring(2,15)}`:i,this._extraLibs[e]&&this._extraLibs[e].content===t)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[e]&&(s=this._removedExtraLibs[e]+1),this._extraLibs[e]&&(s=this._extraLibs[e].version+1),this._extraLibs[e]={content:t,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let t=this._extraLibs[e];t&&t.version===s&&(delete this._extraLibs[e],this._removedExtraLibs[e]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(t){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),t&&t.length>0)for(const i of t){const t=i.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`;let e=1;this._removedExtraLibs[t]&&(e=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i.content,version:e}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){-1===this._onDidExtraLibsChangeTimeout&&(this._onDidExtraLibsChangeTimeout=window.setTimeout((()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)}),0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(t){this._compilerOptions=t||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(t){this._diagnosticsOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(t){this._workerOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(t){this._inlayHintsOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(t){}setEagerModelSync(t){this._eagerModelSync=t}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(void 0)}},UG={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},KG=new zG({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},UG),qG=new zG({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},UG);function GG(){return import("./p-fcdd0366.js")}BG.languages.typescript={ModuleKind:$G,JsxEmit:WG,NewLineKind:jG,ScriptTarget:VG,ModuleResolutionKind:HG,typescriptVersion:"5.0.2",typescriptDefaults:KG,javascriptDefaults:qG,getTypeScriptWorker:()=>GG().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>GG().then((t=>t.getJavaScriptWorker()))},BG.languages.onLanguage("typescript",(()=>GG().then((t=>t.setupTypeScript(KG))))),BG.languages.onLanguage("javascript",(()=>GG().then((t=>t.setupJavaScript(qG))))),Fh(class extends Lh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:Q(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:xs.map,toggled:Oo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Oo.has("isInDiffEditor"),menu:{when:Oo.has("isInDiffEditor"),id:Sh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class ZG extends Lh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:Q(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Oo.has("isInDiffEditor")})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Fh(ZG);class JG extends Lh{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:Q(0,"Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:Oo.has("isInDiffEditor")})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Fh(JG),Eh.appendMenuItem(Sh.EditorTitle,{command:{id:(new JG).desc.id,title:Q(0,"Use Inline View When Space Is Limited"),toggled:Oo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Oo.has("isInDiffEditor")},order:11,group:"1_diff",when:Oo.and(PS.diffEditorRenderSideBySideInlineBreakpointReached,Oo.has("isInDiffEditor"))}),Eh.appendMenuItem(Sh.EditorTitle,{command:{id:(new ZG).desc.id,title:Q(0,"Show Moved Code Blocks"),icon:xs.move,toggled:Bo.create("config.diffEditor.experimental.showMoves",!0),precondition:Oo.has("isInDiffEditor")},order:10,group:"1_diff",when:Oo.has("isInDiffEditor")});const QG={value:Q(0,"Diff Editor"),original:"Diff Editor"};Fh(class extends Ja{constructor(){super({id:"diffEditor.switchSide",title:{value:Q(0,"Switch Side"),original:"Switch Side"},icon:xs.arrowSwap,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,e){const s=iZ(t);if(s instanceof vK){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:Q(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:xs.close,precondition:PS.comparingMovedCode,f1:!1,category:QG,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.exitCompareMove()}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:Q(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:xs.fold,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.collapseAllUnchangedRegions()}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:Q(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:xs.unfold,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.showAllUnchangedRegions()}});const YG={value:Q(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class XG extends Lh{constructor(){super({id:XG.id,title:{value:Q(0,"Go to Next Difference"),original:"Go to Next Difference"},category:YG,precondition:Oo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=iZ(t);null==i||i.accessibleDiffViewerNext()}}XG.id="editor.action.accessibleDiffViewer.next",Eh.appendMenuItem(Sh.EditorTitle,{command:{id:XG.id,title:Q(0,"Open Accessible Diff Viewer"),precondition:Oo.has("isInDiffEditor")},order:10,group:"2_diff",when:Oo.and(PS.accessibleDiffViewerVisible.negate(),Oo.has("isInDiffEditor"))});class tZ extends Lh{constructor(){super({id:tZ.id,title:{value:Q(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:YG,precondition:Oo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=iZ(t);null==i||i.accessibleDiffViewerPrev()}}function iZ(t){var i;const e=t.get(so),s=e.listDiffEditors(),n=null!==(i=e.getFocusedCodeEditor())&&void 0!==i?i:e.getActiveCodeEditor();if(!n)return null;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i.getModifiedEditor().getId()===n.getId()||i.getOriginalEditor().getId()===n.getId())return i}const r=ra();if(r)for(const t of s)if(eZ(t.getContainerDomNode(),r))return t;return null}function eZ(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}tZ.id="editor.action.accessibleDiffViewer.prev",mo.registerCommandAlias("editor.action.diffReview.next",XG.id),Fh(XG),mo.registerCommandAlias("editor.action.diffReview.prev",tZ.id),Fh(tZ);var sZ;const nZ=new Xo("selectionAnchorSet",!1);let rZ=sZ=class{static get(t){return t.getContribution(sZ.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=nZ.bindTo(i),this.modelChangeListener=t.onDidChangeModel((()=>this.selectionAnchorSetContextKey.reset()))}setSelectionAnchor(){if(this.editor.hasModel()){const t=this.editor.getPosition();this.editor.changeDecorations((i=>{this.decorationId&&i.removeDecoration(this.decorationId),this.decorationId=i.addDecoration(ys.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new bI).appendText(Q(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),Cm(Q(0,"Anchor set at {0}:{1}",t.lineNumber,t.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const t=this.editor.getModel().getDecorationRange(this.decorationId);t&&this.editor.setPosition(t.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const t=this.editor.getModel().getDecorationRange(this.decorationId);if(t){const i=this.editor.getPosition();this.editor.setSelection(ys.fromPositions(t.getStartPosition(),i)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const t=this.decorationId;this.editor.changeDecorations((i=>{i.removeDecoration(t),this.decorationId=void 0})),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};rZ.ID="editor.contrib.selectionAnchorController",rZ=sZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],rZ),iu(rZ.ID,rZ,4),Xa(class extends Ga{constructor(){super({id:"editor.action.setSelectionAnchor",label:Q(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2080),weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.setSelectionAnchor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToSelectionAnchor",label:Q(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:nZ})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.goToSelectionAnchor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:Q(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:nZ,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2089),weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.selectFromAnchorToCursor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:Q(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:nZ,kbOpts:{kbExpr:PS.editorTextFocus,primary:9,weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.cancelSelectionAnchor()}});const oZ=Jm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},Q(0,"Overview ruler marker color for matching brackets."));class hZ{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class cZ extends Ki{static get(t){return t.getContribution(cZ.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new rc((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(t.onDidChangeCursorPosition((()=>{"never"!==this._matchBrackets&&this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelContent((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModel((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelLanguageConfiguration((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())}))),this._register(t.onDidBlurEditorWidget((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidFocusEditorWidget((()=>{this._updateBracketsSoon.schedule()})))}jumpToBracket(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._editor.getSelections().map((i=>{const e=i.getStartPosition(),s=t.bracketPairs.matchBracket(e);let n=null;if(s)s[0].containsPosition(e)&&!s[1].containsPosition(e)?n=s[1].getStartPosition():s[1].containsPosition(e)&&(n=s[0].getStartPosition());else{const i=t.bracketPairs.findEnclosingBrackets(e);if(i)n=i[1].getStartPosition();else{const i=t.bracketPairs.findNextBracket(e);i&&i.range&&(n=i.range.getStartPosition())}}return n?new ys(n.lineNumber,n.column,n.lineNumber,n.column):new ys(e.lineNumber,e.column,e.lineNumber,e.column)}));this._editor.setSelections(i),this._editor.revealRange(i[0])}selectToBracket(t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),e=[];this._editor.getSelections().forEach((s=>{const n=s.getStartPosition();let r=i.bracketPairs.matchBracket(n);if(!r&&(r=i.bracketPairs.findEnclosingBrackets(n),!r)){const t=i.bracketPairs.findNextBracket(n);t&&t.range&&(r=i.bracketPairs.matchBracket(t.range.getStartPosition()))}let o=null,h=null;if(r){r.sort(bs.compareRangesUsingStarts);const[i,e]=r;if(o=t?i.getStartPosition():i.getEndPosition(),h=t?e.getEndPosition():e.getStartPosition(),e.containsPosition(n)){const t=o;o=h,h=t}}o&&h&&e.push(new ys(o.lineNumber,o.column,h.lineNumber,h.column))})),e.length>0&&(this._editor.setSelections(e),this._editor.revealRange(e[0]))}removeBrackets(t){if(!this._editor.hasModel())return;const i=this._editor.getModel();this._editor.getSelections().forEach((e=>{const s=e.getPosition();let n=i.bracketPairs.matchBracket(s);n||(n=i.bracketPairs.findEnclosingBrackets(s)),n&&(this._editor.pushUndoStop(),this._editor.executeEdits(t,[{range:n[0],text:""},{range:n[1],text:""}]),this._editor.pushUndoStop())}))}_updateBrackets(){if("never"===this._matchBrackets)return;this._recomputeBrackets();const t=[];let i=0;for(const e of this._lastBracketsData){const s=e.brackets;s&&(t[i++]={range:s[0],options:e.options},t[i++]={range:s[1],options:e.options})}this._decorations.set(t)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return this._lastBracketsData=[],void(this._lastVersionId=0);const t=this._editor.getSelections();if(t.length>100)return this._lastBracketsData=[],void(this._lastVersionId=0);const i=this._editor.getModel(),e=i.getVersionId();let s=[];this._lastVersionId===e&&(s=this._lastBracketsData);const n=[];let r=0;for(let i=0,e=t.length;i<e;i++){const e=t[i];e.isEmpty()&&(n[r++]=e.getStartPosition())}n.length>1&&n.sort(vs.compare);const o=[];let h=0,c=0;const l=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<l&&s[c].position.isBefore(e);)c++;if(c<l&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=cZ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=cZ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new hZ(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}cZ.ID="editor.contrib.bracketMatchingController",cZ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=aL.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Bk(oZ),position:bf.Center}}),cZ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=aL.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),iu(cZ.ID,cZ,1),Xa(class extends Ga{constructor(){super({id:"editor.action.selectToBracket",label:Q(0,"Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Y(0,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(t,i,e){var s;let n=!0;e&&!1===e.selectBrackets&&(n=!1),null===(s=cZ.get(i))||void 0===s||s.selectToBracket(n)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.jumpToBracket",label:Q(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=cZ.get(i))||void 0===e||e.jumpToBracket()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.removeBrackets",label:Q(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=cZ.get(i))||void 0===e||e.removeBrackets(this.id)}}),Eh.appendMenuItem(Sh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:Q(0,"Go to &&Bracket")},order:2});class lZ{constructor(t,i){this._selection=t,this._isMovingLeft=i}getEditOperations(t,i){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const e=this._selection.startLineNumber,s=this._selection.startColumn,n=this._selection.endColumn;if((!this._isMovingLeft||1!==s)&&(this._isMovingLeft||n!==t.getLineMaxColumn(e)))if(this._isMovingLeft){const r=new bs(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new bs(e,n,e,n),o)}else{const r=new bs(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new bs(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new ys(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ys(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class aZ extends Ga{constructor(t,i){super(i),this.left=t}run(t,i){if(!i.hasModel())return;const e=[],s=i.getSelections();for(const t of s)e.push(new lZ(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}Xa(class extends aZ{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:Q(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:PS.writable})}}),Xa(class extends aZ{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:Q(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:PS.writable})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.transposeLetters",label:Q(0,"Transpose Letters"),alias:"Transpose Letters",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(t,i){if(!i.hasModel())return;const e=i.getModel(),s=[],n=i.getSelections();for(const t of n){if(!t.isEmpty())continue;const i=t.startLineNumber,n=t.startColumn,r=e.getLineMaxColumn(i);if(1===i&&(1===n||2===n&&2===r))continue;const o=n===r?t.getPosition():dS.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=dS.leftPosition(e,o),c=dS.leftPosition(e,h),l=e.getValueInRange(bs.fromPositions(c,h)),a=e.getValueInRange(bs.fromPositions(h,o)),u=bs.fromPositions(c,o);s.push(new oS(u,a+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const uZ="9_cutcopypaste",dZ=wt||document.queryCommandSupported("cut"),fZ=wt||document.queryCommandSupported("copy"),gZ=void 0!==navigator.clipboard&&!Ir||document.queryCommandSupported("paste");function pZ(t){return t.register(),t}const mZ=dZ?pZ(new Ua({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:wt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"Cu&&t"),order:1},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Cut"),when:PS.writable,order:1},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Cut"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Cut"),when:PS.writable,order:1}]})):void 0,wZ=fZ?pZ(new Ua({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:wt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"&&Copy"),order:2},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Copy"),order:2},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Copy"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Copy"),order:2}]})):void 0;Eh.appendMenuItem(Sh.MenubarEditMenu,{submenu:Sh.MenubarCopy,title:{value:Q(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextCopy,title:{value:Q(0,"Copy As"),original:"Copy As"},group:uZ,order:3}),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Oo.and(Oo.notEquals("resourceScheme","output"),PS.editorTextFocus)}),Eh.appendMenuItem(Sh.EditorTitleContext,{submenu:Sh.EditorTitleContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1}),Eh.appendMenuItem(Sh.ExplorerContext,{submenu:Sh.ExplorerContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1});const vZ=gZ?pZ(new Ua({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:wt?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"&&Paste"),order:4},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Paste"),when:PS.writable,order:4},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Paste"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Paste"),when:PS.writable,order:4}]})):void 0;function bZ(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(so).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(37),s=e.getSelection();return s&&s.isEmpty()&&!t||e.getContainerDomNode().ownerDocument.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(ha().execCommand(i),!0))))}bZ(mZ,"cut"),bZ(wZ,"copy"),vZ&&(vZ.addImplementation(1e4,"code-editor",(t=>{const i=t.get(so),e=t.get(nH),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!s.getContainerDomNode().ownerDocument.execCommand("paste")&&vt)||(async()=>{const t=await e.readText();if(""!==t){const i=Mk.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(37)&&!!i.isFromEmptySelection,n=void 0!==i.multicursorText?i.multicursorText:null,r=i.mode),s.trigger("keyboard","paste",{text:t,pasteOnNewLine:e,multicursorText:n,mode:r})}})())})),vZ.addImplementation(0,"generic-dom",(()=>(ha().execCommand("paste"),!0)))),fZ&&Xa(class extends Ga{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:Q(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(Ak.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),Ak.forceCopyWithSyntaxHighlighting=!1))}});class yZ{constructor(t){this.value=t}equals(t){return this.value===t.value}contains(t){return this.equals(t)||""===this.value||t.value.startsWith(this.value+yZ.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new yZ(this.value+yZ.sep+t)}}var kZ;function CZ(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}yZ.sep=".",yZ.None=new yZ("@@none@@"),yZ.Empty=new yZ(""),yZ.QuickFix=new yZ("quickfix"),yZ.Refactor=new yZ("refactor"),yZ.RefactorExtract=yZ.Refactor.append("extract"),yZ.RefactorInline=yZ.Refactor.append("inline"),yZ.RefactorMove=yZ.Refactor.append("move"),yZ.RefactorRewrite=yZ.Refactor.append("rewrite"),yZ.Notebook=new yZ("notebook"),yZ.Source=new yZ("source"),yZ.SourceOrganizeImports=yZ.Source.append("organizeImports"),yZ.SourceFixAll=yZ.Source.append("fixAll"),yZ.SurroundWith=yZ.Refactor.append("surround"),function(t){t.Refactor="refactor",t.RefactorPreview="refactor preview",t.Lightbulb="lightbulb",t.Default="other (default)",t.SourceAction="source action",t.QuickFix="quick fix action",t.FixAll="fix all",t.OrganizeImports="organize imports",t.AutoFix="auto fix",t.QuickFixHover="quick fix hover window",t.OnSave="save participants",t.ProblemsView="problems view"}(kZ||(kZ={}));class SZ{static fromUser(t,i){return t&&"object"==typeof t?new SZ(SZ.getKindFromUser(t,i.kind),SZ.getApplyFromUser(t,i.apply),SZ.getPreferredUser(t)):new SZ(i.kind,i.apply,!1)}static getApplyFromUser(t,i){switch("string"==typeof t.apply?t.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return i}}static getKindFromUser(t,i){return"string"==typeof t.kind?new yZ(t.kind):i}static getPreferredUser(t){return"boolean"==typeof t.preferred&&t.preferred}constructor(t,i,e){this.kind=t,this.apply=i,this.preferred=e}}class xZ{constructor(t,i,e){this.action=t,this.provider=i,this.highlightRange=e}async resolve(t){var i;if((null===(i=this.provider)||void 0===i?void 0:i.resolveCodeAction)&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,t)}catch(t){Fi(t)}i&&(this.action.edit=i.edit)}return this}}const DZ="editor.action.codeAction",EZ="editor.action.quickFix",AZ="editor.action.autoFix",MZ="editor.action.refactor",LZ="editor.action.sourceAction",FZ="editor.action.organizeImports",TZ="editor.action.fixAll";class RZ extends Ki{static codeActionsPreferredComparator(t,i){return t.isPreferred&&!i.isPreferred?-1:!t.isPreferred&&i.isPreferred?1:0}static codeActionsComparator({action:t},{action:i}){return t.isAI&&!i.isAI?1:!t.isAI&&i.isAI?-1:u(t.diagnostics)?u(i.diagnostics)?RZ.codeActionsPreferredComparator(t,i):-1:u(i.diagnostics)?1:RZ.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(RZ.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&yZ.QuickFix.contains(new yZ(t.kind))&&!!t.isPreferred))}get hasAIFix(){return this.validActions.some((({action:t})=>!!t.isAI))}get allAIFixes(){return this.validActions.every((({action:t})=>!!t.isAI))}}const OZ={actions:[],documentation:void 0};async function _Z(t,i,s,n,r,o){var h;const l=n.filter||{},a={...l,excludes:[...l.excludes||[],yZ.Notebook]},u={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new cq(i,o),f=function(t,i,e){return t.all(i).filter((t=>!t.providedCodeActionKinds||t.providedCodeActionKinds.some((t=>function(t,i){return!(t.include&&!t.include.intersects(i)||t.excludes&&t.excludes.some((e=>CZ(i,e,t.include)))||!t.includeSourceActions&&yZ.Source.contains(i))}(e,new yZ(t))))))}(t,i,2===n.type?a:l),g=new Ui,p=f.map((async t=>{try{r.report(t);const e=await t.provideCodeActions(i,s,u,d.token);if(e&&g.add(e),d.token.isCancellationRequested)return OZ;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new yZ(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>CZ(e,i,t.include)))||!t.includeSourceActions&&e&&yZ.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(l,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new yZ(t.kind),command:t.command})));if(e){let t;for(const i of s)i.kind.contains(e)&&(t?t.kind.contains(i.kind)&&(t=i):t=i);if(t)return null==t?void 0:t.command}for(const t of i)if(t.kind)for(const i of s)if(i.kind.contains(new yZ(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new xZ(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Fi(t),OZ}})),m=t.onDidChange((()=>{e(t.all(i),f)||d.cancel()}));try{const e=await Promise.all(p),s=e.map((t=>t.actions)).flat(),r=[...c(e.map((t=>t.documentation))),...IZ(t,i,n,s)];return new RZ(s,r,g)}finally{m.dispose(),d.dispose()}}function*IZ(t,i,e,s){var n,r,o;if(i&&s.length)for(const h of t.all(i))h._getAdditionalMenuItems&&(yield*null===(n=h._getAdditionalMenuItems)||void 0===n?void 0:n.call(h,{trigger:e.type,only:null===(o=null===(r=e.filter)||void 0===r?void 0:r.include)||void 0===o?void 0:o.value},s.map((t=>t.action))))}var PZ;async function NZ(t,i,e,s,n=fe.None){var r;const o=t.get(jR),h=t.get(po),c=t.get(Th),l=t.get(VF);if(c.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),await i.resolve(n),!n.isCancellationRequested){if((null===(r=i.action.edit)||void 0===r?void 0:r.edits.length)&&!(await o.apply(i.action.edit,{editor:null==s?void 0:s.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!==PZ.OnSave,showPreview:null==s?void 0:s.preview})).isApplied)return;if(i.action.command)try{await h.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(t){const i=function(t){return"string"==typeof t?t:t instanceof Error&&"string"==typeof t.message?t.message:void 0}(t);l.error("string"==typeof i?i:Q(0,"An unknown error occurred while applying the code action"))}}}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(PZ||(PZ={})),mo.registerCommand("_executeCodeActionProvider",(async function(t,i,e,s,n){if(!(i instanceof hs))throw Ii();const{codeActionProvider:r}=t.get(op),o=t.get(no).getModel(i);if(!o)throw Ii();const h=ys.isISelection(e)?ys.liftSelection(e):bs.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ii();const c="string"==typeof s?new yZ(s):void 0,l=await _Z(r,o,h,{type:1,triggerAction:kZ.Default,filter:{includeSourceActions:!0,include:c}},xO.None,fe.None),a=[],u=Math.min(l.validActions.length,"number"==typeof n?n:0);for(let t=0;t<u;t++)a.push(l.validActions[t].resolve(fe.None));try{return await Promise.all(a),l.validActions.map((t=>t.action))}finally{setTimeout((()=>l.dispose()),100)}}));var BZ;let $Z=BZ=class{constructor(t){this.keybindingService=t}getResolver(){const t=new On((()=>this.keybindingService.getKeybindings().filter((t=>BZ.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===FZ?i={kind:yZ.SourceOrganizeImports.value}:t.command===TZ&&(i={kind:yZ.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...SZ.fromUser(i,{kind:yZ.None,apply:"never"})}}))));return i=>{if(i.kind){const e=this.bestKeybindingForCodeAction(i,t.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new yZ(t.kind);return i.filter((t=>t.kind.contains(e))).filter((i=>!i.preferred||t.isPreferred)).reduceRight(((t,i)=>t?t.kind.contains(i.kind)?i:t:i),void 0)}};$Z.codeActionCommands=[MZ,DZ,LZ,FZ,TZ],$Z=BZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,HC)],$Z),Jm("symbolIcon.arrayForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.booleanForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.colorForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.constantForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.fileForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.folderForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.keyForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.keywordForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.moduleForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.namespaceForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.nullForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.numberForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.objectForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.operatorForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.packageForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.propertyForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.referenceForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.snippetForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.stringForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.structForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.textForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.typeParameterForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.unitForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const WZ=Object.freeze({kind:yZ.Empty,title:Q(0,"More Actions...")}),jZ=Object.freeze([{kind:yZ.QuickFix,title:Q(0,"Quick Fix")},{kind:yZ.RefactorExtract,title:Q(0,"Extract"),icon:xs.wrench},{kind:yZ.RefactorInline,title:Q(0,"Inline"),icon:xs.wrench},{kind:yZ.RefactorRewrite,title:Q(0,"Rewrite"),icon:xs.wrench},{kind:yZ.RefactorMove,title:Q(0,"Move"),icon:xs.wrench},{kind:yZ.SurroundWith,title:Q(0,"Surround With"),icon:xs.symbolSnippet},{kind:yZ.Source,title:Q(0,"Source Action"),icon:xs.symbolFile},WZ]);var VZ,HZ,zZ=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t.Hidden={type:0},t.Showing=class{constructor(t,i,e,s){this.actions=t,this.trigger=i,this.editorPosition=e,this.widgetPosition=s,this.type=1}}}(HZ||(HZ={}));let UZ=VZ=class extends Ki{constructor(t,i,e){var s,n,r;super(),this._editor=t,this._keybindingService=i,this._onClick=this._register(new ne),this.onClick=this._onClick.event,this._state=HZ.Hidden,this._iconClasses=[],this._domNode=Fa("div.lightBulbWidget"),this._register(zm.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent((()=>{const t=this._editor.getModel();(1!==this.state.type||!t||this.state.editorPosition.lineNumber>=t.getLineCount())&&this.hide()}))),this._register((n=t=>{var i;if(1!==this.state.type)return;const s=this._editor.getOption(64).experimental.showAiIcon;if((s===ci.On||s===ci.OnCode)&&this.state.actions.allAIFixes&&1===this.state.actions.validActions.length){const s=this.state.actions.validActions[0].action;if(null===(i=s.command)||void 0===i?void 0:i.id)return e.executeCommand(s.command.id,...s.command.arguments||[]),void t.preventDefault()}this._editor.focus(),t.preventDefault();const{top:n,height:r}=Zl(this._domNode),o=this._editor.getOption(66);let h=Math.floor(o/3);null!==this.state.widgetPosition.position&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(h+=o),this._onClick.fire({x:t.posx,y:n+r+h,actions:this.state.actions,trigger:this.state.trigger})},function(t,i,e){return Il(t,yt&&Bh?ya.POINTER_DOWN:ya.MOUSE_DOWN,i,e)}(s=this._domNode,Pl(Al(s),n),r))),this._register(Il(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(64)&&(this._editor.getOption(64).enabled||this.hide(),this._updateLightBulbTitleAndIcon())}))),this._register(Xi.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,(()=>{var t,i,e,s;this._preferredKbLabel=null!==(i=null===(t=this._keybindingService.lookupKeybinding(AZ))||void 0===t?void 0:t.getLabel())&&void 0!==i?i:void 0,this._quickFixKbLabel=null!==(s=null===(e=this._keybindingService.lookupKeybinding(EZ))||void 0===e?void 0:e.getLabel())&&void 0!==s?s:void 0,this._updateLightBulbTitleAndIcon()})))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return 1===this._state.type?this._state.widgetPosition:null}update(t,i,e){if(t.validActions.length<=0)return this.hide();const s=this._editor.getOptions();if(!s.get(64).enabled)return this.hide();const n=this._editor.getModel();if(!n)return this.hide();const{lineNumber:r,column:o}=n.validatePosition(e),h=n.getOptions().tabSize,c=s.get(50),l=mx(n.getLineContent(r),h),a=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let u=r;if(!(c.spaceWidth*l>22))if(r>1&&!a(r-1))u-=1;else if(a(r+1)){if(o*c.spaceWidth<22)return this.hide()}else u+=1;this.state=new HZ.Showing(t,i,e,{position:{lineNumber:u,column:n.getLineContent(u).match(/^\S\s*$/)?2:1},preference:VZ._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==HZ.Hidden&&(this.state=HZ.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(t){this._state=t,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){var t,i,e;if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],1!==this.state.type)return;const s=()=>{this._preferredKbLabel&&(this.title=Q(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel))},n=()=>{this.title=this._quickFixKbLabel?Q(0,"Show Code Actions ({0})",this._quickFixKbLabel):Q(0,"Show Code Actions")};let r;const o=this._editor.getOption(64).experimental.showAiIcon;if(o===ci.On||o===ci.OnCode)if(o===ci.On&&this.state.actions.allAIFixes)if(r=xs.sparkleFilled,this.state.actions.allAIFixes&&1===this.state.actions.validActions.length)if("inlineChat.start"===(null===(t=this.state.actions.validActions[0].action.command)||void 0===t?void 0:t.id)){const t=null!==(e=null===(i=this._keybindingService.lookupKeybinding("inlineChat.start"))||void 0===i?void 0:i.getLabel())&&void 0!==e?e:void 0;this.title=t?Q(0,"Start Inline Chat ({0})",t):Q(0,"Start Inline Chat")}else this.title=Q(0,"Trigger AI Action");else n();else this.state.actions.hasAutoFix?(r=this.state.actions.hasAIFix?xs.lightbulbSparkleAutofix:xs.lightbulbAutofix,s()):this.state.actions.hasAIFix?(r=xs.lightbulbSparkle,n()):(r=xs.lightBulb,n());else this.state.actions.hasAutoFix?(r=xs.lightbulbAutofix,s()):(r=xs.lightBulb,n());this._iconClasses=go.asClassNameArray(r),this._domNode.classList.add(...this._iconClasses)}set title(t){this._domNode.title=t}};UZ.ID="editor.contrib.lightbulbWidget",UZ._posPref=[0],UZ=VZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([zZ(1,HC),zZ(2,po)],UZ);var KZ,qZ=function(t,i){return function(e,s){i(e,s,t)}};let GZ=KZ=class{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ne,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(t,i,e){if(!t)return{element:document.createElement("span"),dispose:()=>{}};const s=new Ui,n=s.add(VI(t,{...this._getRenderOptions(t,s),...i},e));return n.element.classList.add("rendered-markdown"),{element:n.element,dispose:()=>s.dispose()}}_getRenderOptions(t,i){return{codeBlockRenderer:async(t,i)=>{var e,s,n;let r;t?r=this._languageService.getLanguageIdByLanguageName(t):this._options.editor&&(r=null===(e=this._options.editor.getModel())||void 0===e?void 0:e.getLanguageId()),r||(r=Ld);const o=await async function(t,i,e){if(!e)return hF(i,t.languageIdCodec,rF);const s=await Ws.getOrCreate(e);return hF(i,t.languageIdCodec,s||rF)}(this._languageService,i,r),h=document.createElement("span");return h.innerHTML=null!==(n=null===(s=KZ._ttpTokenizer)||void 0===s?void 0:s.createHTML(o))&&void 0!==n?n:o,this._options.editor?Ur(h,this._options.editor.getOption(50)):this._options.codeBlockFontFamily&&(h.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(h.style.fontSize=this._options.codeBlockFontSize),h},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>ZZ(this._openerService,i,t.isTrusted),disposables:i}}}};async function ZZ(t,i,e){try{return await t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:JZ(e)})}catch(t){return Li(t),!1}}function JZ(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}GZ._ttpTokenizer=bu("tokenizeToString",{createHTML:t=>t}),GZ=KZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([qZ(1,ud),qZ(2,ZN)],GZ);var QZ,YZ=function(t,i){return function(e,s){i(e,s,t)}};let XZ=QZ=class{static get(t){return t.getContribution(QZ.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new qi,this._messageListeners=new Ui,this._mouseOverMessage=!1,this._editor=t,this._visible=QZ.MESSAGE_VISIBLE.bindTo(i)}dispose(){var t;null===(t=this._message)||void 0===t||t.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;Cm(kI(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=kI(t)?VI(t,{actionHandler:{callback:i=>ZZ(this._openerService,i,kI(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new tJ(this._editor,i,"string"==typeof t?t:this._message.element),this._messageListeners.add(Xi.debounce(this._editor.onDidBlurEditorText,((t,i)=>i),0)((()=>{this._mouseOverMessage||this._messageWidget.value&&ta(ra(),this._messageWidget.value.getDomNode())||this.closeMessage()}))),this._messageListeners.add(this._editor.onDidChangeCursorPosition((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidDispose((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidChangeModel((()=>this.closeMessage()))),this._messageListeners.add(Il(this._messageWidget.value.getDomNode(),ya.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Il(this._messageWidget.value.getDomNode(),ya.MOUSE_LEAVE,(()=>this._mouseOverMessage=!1),!0)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new bs(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(tJ.fadeOut(this._messageWidget.value))}};XZ.ID="editor.contrib.messageController",XZ.MESSAGE_VISIBLE=new Xo("messageVisible",!1,Q(0,"Whether the editor is currently showing an inline message")),XZ=QZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([YZ(1,th),YZ(2,ZN)],XZ),Ya(new(qa.bindToContribution(XZ.get))({id:"leaveEditorMessage",precondition:XZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class tJ{static fadeOut(t){const i=()=>{t.dispose(),clearTimeout(e),t.getDomNode().removeEventListener("animationend",i)},e=setTimeout(i,110);return t.getDomNode().addEventListener("animationend",i),t.getDomNode().classList.add("fadeOut"),{dispose:i}}constructor(t,{lineNumber:i,column:e},s){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=t,this._editor.revealLinesInCenterIfOutsideViewport(i,i,0),this._position={lineNumber:i,column:e},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);const r=document.createElement("div");"string"==typeof s?(r.classList.add("message"),r.textContent=s):(s.classList.add("message"),r.appendChild(s)),this._domNode.appendChild(r);const o=document.createElement("div");o.classList.add("anchor","below"),this._domNode.appendChild(o),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(t){this._domNode.classList.toggle("below",2===t)}}iu(XZ.ID,XZ,4);var iJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},eJ=function(t,i){return function(e,s){i(e,s,t)}};const sJ="acceptSelectedCodeAction",nJ="previewSelectedCodeAction";class rJ{get templateId(){return"header"}renderTemplate(t){t.classList.add("group-header");const i=document.createElement("span");return t.append(i),{container:t,text:i}}renderElement(t,i,e){var s,n;e.text.textContent=null!==(n=null===(s=t.group)||void 0===s?void 0:s.title)&&void 0!==n?n:""}disposeTemplate(t){}}let oJ=class{get templateId(){return"action"}constructor(t,i){this._supportsPreview=t,this._keybindingService=i}renderTemplate(t){t.classList.add(this.templateId);const i=document.createElement("div");i.className="icon",t.append(i);const e=document.createElement("span");return e.className="title",t.append(e),{container:t,icon:i,text:e,keybinding:new Pj(t,Et)}}renderElement(t,i,e){var s,n,r;if((null===(s=t.group)||void 0===s?void 0:s.icon)?(e.icon.className=go.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=qm(t.group.icon.color.id))):(e.icon.className=go.asClassName(xs.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=uJ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Ta(...i):Ra(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(sJ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(nJ))||void 0===r?void 0:r.getLabel();e.container.classList.toggle("option-disabled",t.disabled),e.container.title=t.disabled?t.label:o&&h?this._supportsPreview&&t.canPreview?Q(0,"{0} to apply, {1} to preview",o,h):Q(0,"{0} to apply",o):""}disposeTemplate(t){}};oJ=iJ([eJ(1,HC)],oJ);class hJ extends UIEvent{constructor(){super("acceptSelectedAction")}}class cJ extends UIEvent{constructor(){super("previewSelectedAction")}}function lJ(t){if("action"===t.kind)return t.label}let aJ=class extends Ki{constructor(t,i,e,s,n,r){super(),this._delegate=s,this._contextViewService=n,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new pe),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new KP(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new oJ(i,this._keybindingService),new rJ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:lJ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?uJ(null==t?void 0:t.label):"";return t.disabled&&(i=Q(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>Q(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(yN),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this.onFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=e,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(t){return!t.disabled&&"action"===t.kind}hide(t){this._delegate.onHide(t),this.cts.cancel(),this._contextViewService.hideContextView()}layout(t){const i=this._allMenuItems.filter((t=>"header"===t.kind)).length,e=this._allMenuItems.length*this._actionLineHeight+i*this._headerLineHeight-i*this._actionLineHeight;this._list.layout(e);let s=t;if(this._allMenuItems.length>=50)s=380;else{const i=this._allMenuItems.map(((t,i)=>{const e=this.domNode.ownerDocument.getElementById(this._list.getElementID(i));if(e){e.style.width="auto";const t=e.getBoundingClientRect().width;return e.style.width="",t}return 0}));s=Math.max(...i,t)}const n=Math.min(e,.7*this.domNode.ownerDocument.body.clientHeight);return this._list.layout(n,s),this.domNode.style.height=`${n}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(t){const i=this._list.getFocus();if(0===i.length)return;const e=i[0],s=this._list.element(e);if(!this.focusCondition(s))return;const n=t?new cJ:new hJ;this._list.setSelection([e],n)}onListSelection(t){if(!t.elements.length)return;const i=t.elements[0];i.item&&this.focusCondition(i)?this._delegate.onSelect(i.item,t.browserEvent instanceof cJ):this._list.setSelection([])}onFocus(){var t,i;this._list.domFocus();const e=this._list.getFocus();if(0===e.length)return;const s=this._list.element(e[0]);null===(i=(t=this._delegate).onFocus)||void 0===i||i.call(t,s.item)}async onListHover(t){const i=t.element;if(i&&i.item&&this.focusCondition(i)){if(this._delegate.onHover&&!i.disabled&&"action"===i.kind){const t=await this._delegate.onHover(i.item,this.cts.token);i.canPreview=t?t.canPreview:void 0}t.index&&this._list.splice(t.index,1,[i])}this._list.setFocus("number"==typeof t.index?[t.index]:[])}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function uJ(t){return t.replace(/\r\n|\r|\n/g," ")}aJ=iJ([eJ(4,KO),eJ(5,HC)],aJ);var dJ=function(t,i){return function(e,s){i(e,s,t)}};Jm("actionBar.toggledBackground",{dark:aw,light:aw,hcDark:aw,hcLight:aw},Q(0,"Background color for toggled action items in action bar."));const fJ={Visible:new Xo("codeActionMenuVisible",!1,Q(0,"Whether the action widget list is visible"))},gJ=eo("actionWidgetService");let pJ=class extends Ki{get isVisible(){return fJ.Visible.getValue(this._contextKeyService)||!1}constructor(t,i,e){super(),this._contextViewService=t,this._contextKeyService=i,this._instantiationService=e,this._list=this._register(new qi)}show(t,i,e,s,n,r,o){const h=fJ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(aJ,t,i,e,s);this._contextViewService.showContextView({getAnchor:()=>n,render:t=>(h.set(!0),this._renderWidget(t,c,null!=o?o:[])),onHide:t=>{h.reset(),this._onWidgetClosed(t)}},r,!1)}acceptSelected(t){var i;null===(i=this._list.value)||void 0===i||i.acceptSelected(t)}focusPrevious(){var t,i;null===(i=null===(t=this._list)||void 0===t?void 0:t.value)||void 0===i||i.focusPrevious()}focusNext(){var t,i;null===(i=null===(t=this._list)||void 0===t?void 0:t.value)||void 0===i||i.focusNext()}hide(){var t;null===(t=this._list.value)||void 0===t||t.hide(),this._list.clear()}_renderWidget(t,i,e){var s;const n=document.createElement("div");if(n.classList.add("action-widget"),t.appendChild(n),this._list.value=i,!this._list.value)throw new Error("List has no value");n.appendChild(this._list.value.domNode);const r=new Ui,o=document.createElement("div"),h=t.appendChild(o);h.classList.add("context-view-block"),r.add(Il(h,ya.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Il(l,ya.POINTER_MOVE,(()=>l.remove()))),r.add(Il(l,ya.MOUSE_DOWN,(()=>l.remove())));let a=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),a=t.getContainer().offsetWidth)}const u=null===(s=this._list.value)||void 0===s?void 0:s.layout(a);n.style.width=`${u}px`;const d=r.add(Sa(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Fa(t),s=new IN(e);return s.push(i,{icon:!1,label:!0}),s}_onWidgetClosed(t){var i;null===(i=this._list.value)||void 0===i||i.hide(t)}};pJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([dJ(0,KO),dJ(1,th),dJ(2,io)],pJ),gd(gJ,pJ,1);const mJ=1100;Fh(class extends Lh{constructor(){super({id:"hideCodeActionWidget",title:{value:Q(0,"Hide action widget"),original:"Hide action widget"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:9,secondary:[1033]}})}run(t){t.get(gJ).hide()}}),Fh(class extends Lh{constructor(){super({id:"selectPrevCodeAction",title:{value:Q(0,"Select previous action"),original:"Select previous action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.focusPrevious()}}),Fh(class extends Lh{constructor(){super({id:"selectNextCodeAction",title:{value:Q(0,"Select next action"),original:"Select next action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.focusNext()}}),Fh(class extends Lh{constructor(){super({id:sJ,title:{value:Q(0,"Accept selected action"),original:"Accept selected action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:3,secondary:[2137]}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.acceptSelected()}}),Fh(class extends Lh{constructor(){super({id:nJ,title:{value:Q(0,"Preview selected action"),original:"Preview selected action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:2051}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.acceptSelected(!0)}});const wJ=new Xo("supportedCodeAction","");class vJ extends Ki{constructor(t,i,e,s=250){super(),this._editor=t,this._markerService=i,this._signalChange=e,this._delay=s,this._autoTriggerTimer=this._register(new sc),this._register(this._markerService.onMarkerChanged((t=>this._onMarkerChanges(t)))),this._register(this._editor.onDidChangeCursorPosition((()=>this._tryAutoTrigger())))}trigger(t){const i=this._getRangeOfSelectionUnlessWhitespaceEnclosed(t);this._signalChange(i?{trigger:t,selection:i}:void 0)}_onMarkerChanges(t){const i=this._editor.getModel();i&&t.some((t=>tA(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:kZ.Default})}),this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(t){var i;if(!this._editor.hasModel())return;const e=this._editor.getModel(),s=this._editor.getSelection();if(s.isEmpty()&&2===t.type){const{lineNumber:t,column:n}=s.getPosition(),r=e.getLineContent(t);if(0===r.length){if((null===(i=this._editor.getOption(64).experimental)||void 0===i?void 0:i.showAiIcon)!==ci.On)return}else if(1===n){if(/\s/.test(r[0]))return}else if(n===e.getLineMaxColumn(t)){if(/\s/.test(r[r.length-1]))return}else if(/\s/.test(r[n-2])&&/\s/.test(r[n-1]))return}return s}}var bJ;!function(t){t.Empty={type:0},t.Triggered=class{constructor(t,i,e){this.trigger=t,this.position=i,this._cancellablePromise=e,this.type=1,this.actions=e.catch((t=>{if(Oi(t))return yJ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(bJ||(bJ={}));const yJ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class kJ extends Ki{constructor(t,i,e,s,n,r){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._configurationService=r,this._codeActionOracle=this._register(new qi),this._state=bJ.Empty,this._onDidChangeState=this._register(new ne),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=wJ.bindTo(s),this._register(this._editor.onDidChangeModel((()=>this._update()))),this._register(this._editor.onDidChangeModelLanguage((()=>this._update()))),this._register(this._registry.onDidChange((()=>this._update()))),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(bJ.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return!!this._configurationService&&this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:null==i?void 0:i.uri})}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(bJ.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(90)){const i=this._registry.all(t).flatMap((t=>{var i;return null!==(i=t.providedCodeActionKinds)&&void 0!==i?i:[]}));this._supportedCodeActions.set(i.join(" ")),this._codeActionOracle.value=new vJ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(bJ.Empty);const s=i.selection.getStartPosition(),n=Zh((async e=>{var s,n,r,o,h,c;if(this._settingEnabledNearbyQuickfixes()&&1===i.trigger.type&&(i.trigger.triggerAction===kZ.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(yZ.QuickFix)))){const s=await _Z(this._registry,t,i.selection,i.trigger,xO.None,e),n=[...s.allActions];if(e.isCancellationRequested)return yJ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&yZ.QuickFix.contains(new yZ(t.action.kind)))))){const r=this._markerService.read({resource:t.uri});if(r.length>0){const l=i.selection.getPosition();let a=l,u=Number.MAX_VALUE;const d=[...s.validActions];for(const f of r){const r=f.endColumn,g=f.endLineNumber;if(g===l.lineNumber||f.startLineNumber===l.lineNumber){a=new vs(g,r);const f={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(null===(o=i.trigger.filter)||void 0===o?void 0:o.include)?null===(h=i.trigger.filter)||void 0===h?void 0:h.include:yZ.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:(null===(c=i.trigger.context)||void 0===c?void 0:c.notAvailableMessage)||"",position:a}},p=new ys(a.lineNumber,a.column,a.lineNumber,a.column),m=await _Z(this._registry,t,p,f,xO.None,e);if(0!==m.validActions.length){for(const t of m.validActions)t.highlightRange=t.action.isPreferred;0===s.allActions.length&&n.push(...m.allActions),Math.abs(l.column-r)<u?d.unshift(...m.validActions):d.push(...m.validActions)}u=Math.abs(l.column-r)}}const f=d.filter(((t,i,e)=>e.findIndex((i=>i.action.title===t.action.title))===i));return f.sort(((t,i)=>t.action.isPreferred&&!i.action.isPreferred?-1:!t.action.isPreferred&&i.action.isPreferred||t.action.isAI&&!i.action.isAI?1:!t.action.isAI&&i.action.isAI?-1:0)),{validActions:f,allActions:n,documentation:s.documentation,hasAutoFix:s.hasAutoFix,hasAIFix:s.hasAIFix,allAIFixes:s.allAIFixes,dispose:()=>{s.dispose()}}}}}return _Z(this._registry,t,i.selection,i.trigger,xO.None,e)}));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new bJ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:kZ.Default})}else this._supportedCodeActions.reset()}trigger(t){var i;null===(i=this._codeActionOracle.value)||void 0===i||i.trigger(t)}setState(t,i){t!==this._state&&(1===this._state.type&&this._state.cancel(),this._state=t,i||this._disposed||this._onDidChangeState.fire(t))}}var CJ,SJ=function(t,i){return function(e,s){i(e,s,t)}};let xJ=CJ=class extends Ki{static get(t){return t.getContribution(CJ.ID)}constructor(t,i,e,s,n,r,o,h,c,l){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=l,this._activeCodeActions=this._register(new qi),this._showDisabled=!1,this._disposed=!1,this._editor=t,this._model=this._register(new kJ(this._editor,n.codeActionProvider,i,e,r,h)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new On((()=>{const t=this._editor.getContribution(UZ.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance($Z),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(t,i,e){return this.showCodeActionList(i,e,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(t,i,e,s){var n;if(!this._editor.hasModel())return;null===(n=XZ.get(this._editor))||void 0===n||n.closeMessage();const r=this._editor.getPosition();this._trigger({type:1,triggerAction:i,filter:e,autoApply:s,context:{notAvailableMessage:t,position:r}})}_trigger(t){return this._model.trigger(t)}async _applyCodeAction(t,i,e){try{await this._instantiationService.invokeFunction(NZ,t,PZ.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:kZ.QuickFix,filter:{}})}}async update(t){var i,e,s,n,r,o,h;if(1!==t.type)return void(null===(i=this._lightBulbWidget.rawValue)||void 0===i||i.hide());let c;try{c=await t.actions}catch(t){return void Li(t)}if(!this._disposed)if(null===(e=this._lightBulbWidget.value)||void 0===e||e.update(c,t.trigger,t.position),1===t.trigger.type){if(null===(s=t.trigger.filter)||void 0===s?void 0:s.include){const i=this.tryGetValidActionToApply(t.trigger,c);if(i){try{null===(n=this._lightBulbWidget.value)||void 0===n||n.hide(),await this._applyCodeAction(i,!1,!1)}finally{c.dispose()}return}if(t.trigger.context){const i=this.getInvalidActionThatWouldHaveBeenApplied(t.trigger,c);if(i&&i.action.disabled)return null===(r=XZ.get(this._editor))||void 0===r||r.showMessage(i.action.disabled,t.trigger.context.position),void c.dispose()}}const i=!!(null===(o=t.trigger.filter)||void 0===o?void 0:o.include);if(t.trigger.context&&(!c.allActions.length||!i&&!c.validActions.length))return null===(h=XZ.get(this._editor))||void 0===h||h.showMessage(t.trigger.context.notAvailableMessage,t.trigger.context.position),this._activeCodeActions.value=c,void c.dispose();this._activeCodeActions.value=c,this.showCodeActionList(c,this.toCoords(t.position),{includeDisabledActions:i,fromLightbulb:!1})}else this._actionWidgetService.isVisible?c.dispose():this._activeCodeActions.value=c}getInvalidActionThatWouldHaveBeenApplied(t,i){if(i.allActions.length)return"first"===t.autoApply&&0===i.validActions.length||"ifSingle"===t.autoApply&&1===i.allActions.length?i.allActions.find((({action:t})=>t.disabled)):void 0}tryGetValidActionToApply(t,i){if(i.validActions.length)return"first"===t.autoApply&&i.validActions.length>0||"ifSingle"===t.autoApply&&1===i.validActions.length?i.validActions[0]:void 0}async showCodeActionList(t,i,e){const s=this._editor.createDecorationsCollection(),n=this._editor.getDomNode();if(!n)return;const r=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!r.length)return;const o=vs.isIPosition(i)?this.toCoords(i):i,h={onSelect:async(t,i)=>{this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide(),s.clear()},onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus(),s.clear()},onHover:async(t,i)=>{var e;if(await t.resolve(i),!i.isCancellationRequested)return{canPreview:!!(null===(e=t.action.edit)||void 0===e?void 0:e.edits.length)}},onFocus:t=>{var i,e;if(t&&t.highlightRange&&t.action.diagnostics){s.set([{range:t.action.diagnostics[0],options:CJ.DECORATION}]);const n=t.action.diagnostics[0];Sm(Q(0,"Context: {0} at line {1} and column {2}.",null===(e=null===(i=this._editor.getModel())||void 0===i?void 0:i.getWordAtPosition({lineNumber:n.startLineNumber,column:n.startColumn}))||void 0===e?void 0:e.word,n.startLineNumber,n.startColumn))}else s.clear()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>{var i;return{kind:"action",item:t,group:WZ,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title,canPreview:!!(null===(i=t.action.edit)||void 0===i?void 0:i.edits.length)}}));const s=jZ.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new yZ(i.action.kind):yZ.None;for(const e of s)if(e.group.kind.contains(t)){e.actions.push(i);break}}const n=[];for(const t of s)if(t.actions.length){n.push({kind:"header",group:t.group});for(const i of t.actions){const s=t.group;n.push({kind:"action",item:i,group:i.action.isAI?{title:s.title,kind:s.kind,icon:xs.sparkle}:s,label:i.action.title,disabled:!!i.action.disabled,keybinding:e(i.action)})}}return n}(r,this._shouldShowHeaders(),this._resolver.getResolver()),h,o,n,this._getActionBarActions(t,i,e))}toCoords(t){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(t,1),this._editor.render();const i=this._editor.getScrolledVisiblePosition(t),e=Zl(this._editor.getDomNode());return{x:e.left+i.left,y:e.top+i.top+i.height}}_shouldShowHeaders(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:null==i?void 0:i.uri})}_getActionBarActions(t,i,e){if(e.fromLightbulb)return[];const s=t.documentation.map((t=>{var i;return{id:t.id,label:t.title,tooltip:null!==(i=t.tooltip)&&void 0!==i?i:"",class:void 0,enabled:!0,run:()=>{var i;return this._commandService.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}}}));return e.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&s.push(this._showDisabled?{id:"hideMoreActions",label:Q(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,e))}:{id:"showMoreActions",label:Q(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,e))}),s}};function DJ(t){return Oo.regex(wJ.keys()[0],new RegExp("(\\s|^)"+$n(t.value)+"\\b"))}xJ.ID="editor.contrib.codeActionController",xJ.DECORATION=aL.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),xJ=CJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([SJ(1,nB),SJ(2,th),SJ(3,io),SJ(4,op),SJ(5,DO),SJ(6,po),SJ(7,rd),SJ(8,gJ),SJ(9,io)],xJ),Vk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(fv));const e=t.getColor(mv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Ey(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const EJ={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:Q(0,"Kind of the code action to run.")},apply:{type:"string",description:Q(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[Q(0,"Always apply the first returned code action."),Q(0,"Apply the first returned code action if it is the only one."),Q(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:Q(0,"Controls if only preferred code actions should be returned.")}}};function AJ(t,i,e,s,n=kZ.Default){if(t.hasModel()){const r=xJ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}iu(xJ.ID,xJ,3),iu(UZ.ID,UZ,4),Xa(class extends Ga{constructor(){super({id:EZ,label:Q(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),kbOpts:{kbExpr:PS.textInputFocus,primary:2137,weight:100}})}run(t,i){return AJ(i,Q(0,"No code actions available"),void 0,void 0,kZ.QuickFix)}}),Xa(class extends Ga{constructor(){super({id:MZ,label:Q(0,"Refactor..."),alias:"Refactor...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),kbOpts:{kbExpr:PS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Oo.and(PS.writable,DJ(yZ.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:EJ}]}})}run(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Refactor,apply:"never"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",e.kind):Q(0,s.preferred?"No preferred refactorings available":"No refactorings available"),{include:yZ.Refactor.contains(s.kind)?s.kind:yZ.None,onlyIncludePreferredActions:s.preferred},s.apply,kZ.Refactor)}}),Xa(class extends Ga{constructor(){super({id:LZ,label:Q(0,"Source Action..."),alias:"Source Action...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Oo.and(PS.writable,DJ(yZ.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:EJ}]}})}run(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Source,apply:"never"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",e.kind):Q(0,s.preferred?"No preferred source actions available":"No source actions available"),{include:yZ.Source.contains(s.kind)?s.kind:yZ.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,kZ.SourceAction)}}),Xa(class extends Ga{constructor(){super({id:FZ,label:Q(0,"Organize Imports"),alias:"Organize Imports",precondition:Oo.and(PS.writable,DJ(yZ.SourceOrganizeImports)),kbOpts:{kbExpr:PS.textInputFocus,primary:1581,weight:100}})}run(t,i){return AJ(i,Q(0,"No organize imports action available"),{include:yZ.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",kZ.OrganizeImports)}}),Xa(class extends Ga{constructor(){super({id:AZ,label:Q(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Oo.and(PS.writable,DJ(yZ.QuickFix)),kbOpts:{kbExpr:PS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return AJ(i,Q(0,"No auto fixes available"),{include:yZ.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",kZ.AutoFix)}}),Xa(class extends Ga{constructor(){super({id:TZ,label:Q(0,"Fix All"),alias:"Fix All",precondition:Oo.and(PS.writable,DJ(yZ.SourceFixAll))})}run(t,i){return AJ(i,Q(0,"No fix all action available"),{include:yZ.SourceFixAll,includeSourceActions:!0},"ifSingle",kZ.FixAll)}}),Ya(new class extends qa{constructor(){super({id:DZ,precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:EJ}]}})}runEditorCommand(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Empty,apply:"ifSingle"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",e.kind):Q(0,s.preferred?"No preferred code actions available":"No code actions available"),{include:s.kind,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply)}}),mh.as(bd).registerConfiguration({...KR,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:Q(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}}),mh.as(bd).registerConfiguration({...KR,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:Q(0,"Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});class MJ{constructor(){this.lenses=[],this._disposables=new Ui}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(t,i){this._disposables.add(t);for(const e of t.lenses)this.lenses.push({symbol:e,provider:i})}}async function LJ(t,i,e){const s=t.ordered(i),n=new Map,r=new MJ,o=s.map((async(t,s)=>{n.set(t,s);try{const s=await Promise.resolve(t.provideCodeLenses(i,e));s&&r.add(s,t)}catch(t){Fi(t)}}));return await Promise.all(o),r.lenses=r.lenses.sort(((t,i)=>t.symbol.range.startLineNumber<i.symbol.range.startLineNumber?-1:t.symbol.range.startLineNumber>i.symbol.range.startLineNumber?1:n.get(t.provider)<n.get(i.provider)?-1:n.get(t.provider)>n.get(i.provider)?1:t.symbol.range.startColumn<i.symbol.range.startColumn?-1:t.symbol.range.startColumn>i.symbol.range.startColumn?1:0)),r}mo.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(hs.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get(op),r=t.get(no).getModel(e);if(!r)throw Ii();const o=[],h=new Ui;return LJ(n,r,fe.None).then((t=>{h.add(t);const i=[];for(const e of t.lenses)null==s||Boolean(e.symbol.command)?o.push(e.symbol):s-- >0&&e.provider.resolveCodeLens&&i.push(Promise.resolve(e.provider.resolveCodeLens(r,e.symbol,fe.None)).then((t=>o.push(t||e.symbol))));return Promise.all(i)})).then((()=>o)).finally((()=>{setTimeout((()=>h.dispose()),100)}))}));const FJ=eo("ICodeLensCache");class TJ{constructor(t,i){this.lineCount=t,this.data=i}}let RJ=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Mg(20,.75),Bl(Fn,(()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Xi.once(t.onWillSaveState)((e=>{e.reason===uN.SHUTDOWN&&t.store(i,this._serialize(),1,1)}))}put(t,i){const e=i.lenses.map((t=>{var i;return{range:t.symbol.range,command:t.symbol.command&&{id:"",title:null===(i=t.symbol.command)||void 0===i?void 0:i.title}}})),s=new MJ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new TJ(t.getLineCount(),s);this._cache.set(t.uri.toString(),n)}get(t){const i=this._cache.get(t.uri.toString());return i&&i.lineCount===t.getLineCount()?i.data:void 0}delete(t){this._cache.delete(t.uri.toString())}_serialize(){const t=Object.create(null);for(const[i,e]of this._cache){const s=new Set;for(const t of e.data.lenses)s.add(t.symbol.range.startLineNumber);t[i]={lineCount:e.lineCount,lines:[...s.values()]}}return JSON.stringify(t)}_deserialize(t){try{const i=JSON.parse(t);for(const t in i){const e=i[t],s=[];for(const t of e.lines)s.push({range:new bs(t,1,t,11)});const n=new MJ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new TJ(e.lineCount,n))}}catch(t){}}};RJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,aN)],RJ),gd(FJ,RJ,1);class OJ{constructor(t,i,e){this.afterColumn=1073741824,this.afterLineNumber=t,this.heightInPx=i,this._onHeight=e,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(t){void 0===this._lastHeight?this._lastHeight=t:this._lastHeight!==t&&(this._lastHeight=t,this._onHeight())}isVisible(){return 0!==this._lastHeight&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class _J{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+_J._idPool++,this.updatePosition(i),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(t,i){this._commands.clear();const e=[];let s=!1;for(let i=0;i<t.length;i++){const n=t[i];if(n&&(s=!0,n.command)){const s=RI(n.command.title.trim());n.command.id?(e.push(Fa("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Fa("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Fa("span",void 0," | "))}}s?(Ea(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Ea(this._domNode,Fa("span",void 0,"no commands"))}getCommand(t){return t.parentElement===this._domNode?this._commands.get(t.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(t){const i=this._editor.getModel().getLineFirstNonWhitespaceColumn(t);this._widgetPosition={position:{lineNumber:t,column:i},preference:[1]}}getPosition(){return this._widgetPosition||null}}_J._idPool=0;class IJ{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(t,i){this._addDecorations.push(t),this._addDecorationsCallbacks.push(i)}removeDecoration(t){this._removeDecorations.push(t)}commit(t){const i=t.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,e=i.length;t<e;t++)this._addDecorationsCallbacks[t](i[t])}}const PJ=aL.register({collapseOnReplaceEdit:!0,description:"codelens"});class NJ{constructor(t,i,e,s,n,r){let o;this._isDisposed=!1,this._editor=i,this._data=t,this._decorationIds=[];const h=[];this._data.forEach(((t,i)=>{t.symbol.command&&h.push(t.symbol),e.addDecoration({range:t.symbol.range,options:PJ},(t=>this._decorationIds[i]=t)),o=o?bs.plusRange(o,t.symbol.range):bs.lift(t.symbol.range)})),this._viewZone=new OJ(o.startLineNumber-1,n,r),this._viewZoneId=s.addZone(this._viewZone),h.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(h,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new _J(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(t,i){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],null==i||i.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some(((t,i)=>{const e=this._editor.getModel().getDecorationRange(t);return!(!e||bs.isEmpty(this._data[i].symbol.range)!==e.isEmpty())}))}updateCodeLensSymbols(t,i){this._decorationIds.forEach(i.removeDecoration,i),this._decorationIds=[],this._data=t,this._data.forEach(((t,e)=>{i.addDecoration({range:t.symbol.range,options:PJ},(t=>this._decorationIds[e]=t))}))}updateHeight(t,i){this._viewZone.heightInPx=t,i.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(t){if(!this._viewZone.isVisible())return null;for(let i=0;i<this._decorationIds.length;i++){const e=t.getDecorationRange(this._decorationIds[i]);e&&(this._data[i].symbol.range=e)}return this._data}updateCommands(t){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(t,!0);for(let i=0;i<this._data.length;i++){const e=t[i];if(e){const{symbol:t}=this._data[i];t.command=e.command||t.command}}}getCommand(t){var i;return null===(i=this._contentWidget)||void 0===i?void 0:i.getCommand(t)}getLineNumber(){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return t?t.startLineNumber:-1}update(t){if(this.isValid()){const i=this._editor.getModel().getDecorationRange(this._decorationIds[0]);i&&(this._viewZone.afterLineNumber=i.startLineNumber-1,t.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(i.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var BJ=function(t,i){return function(e,s){i(e,s,t)}};let $J=class{constructor(t,i,e,s,n,r){this._editor=t,this._languageFeaturesService=i,this._commandService=s,this._notificationService=n,this._codeLensCache=r,this._disposables=new Ui,this._localToDispose=new Ui,this._lenses=[],this._oldCodeLensModels=new Ui,this._provideCodeLensDebounce=e.for(i.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=e.for(i.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new rc((()=>this._resolveCodeLensesInViewport()),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(19)||t.hasChanged(18))&&this._updateLensStyle(),t.hasChanged(17)&&this._onModelChange()}))),this._disposables.add(i.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var t;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),null===(t=this._currentCodeLensModel)||void 0===t||t.dispose()}_getLayoutInfo(){const t=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let i=this._editor.getOption(19);return(!i||i<5)&&(i=.9*this._editor.getOption(52)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(18),s=this._editor.getOption(50),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${t}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",s.fontFeatureSettings),e&&(n.setProperty("--vscode-editorCodeLens-fontFamily",e),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",xi.fontFamily)),this._editor.changeViewZones((i=>{for(const e of this._lenses)e.updateHeight(t,i)}))}_localDispose(){var t,i,e;null===(t=this._getCodeLensModelPromise)||void 0===t||t.cancel(),this._getCodeLensModelPromise=void 0,null===(i=this._resolveCodeLensesPromise)||void 0===i||i.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),null===(e=this._currentCodeLensModel)||void 0===e||e.dispose()}_onModelChange(){this._localDispose();const t=this._editor.getModel();if(!t)return;if(!this._editor.getOption(17)||t.isTooLargeForTokenization())return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&ic((()=>{const e=this._codeLensCache.get(t);i===e&&(this._codeLensCache.delete(t),this._onModelChange())}),3e4,this._localToDispose));for(const i of this._languageFeaturesService.codeLensProvider.all(t))if("function"==typeof i.onDidChange){const t=i.onDidChange((()=>e.schedule()));this._localToDispose.add(t)}const e=new rc((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=Zh((i=>LJ(this._languageFeaturesService.codeLensProvider,t,i))),this._getCodeLensModelPromise.then((i=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=i,this._codeLensCache.put(t,i);const n=this._provideCodeLensDebounce.update(t,Date.now()-s);e.delay=n,this._renderCodeLensSymbols(i),this._resolveCodeLensesInViewportSoon()}),Li)}),this._provideCodeLensDebounce.get(t));this._localToDispose.add(e),this._localToDispose.add(zi((()=>this._resolveCodeLensesScheduler.cancel()))),this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{var t;this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const e=[];let s=-1;this._lenses.forEach((t=>{t.isValid()&&s!==t.getLineNumber()?(t.update(i),s=t.getLineNumber()):e.push(t)}));const n=new IJ;e.forEach((t=>{t.dispose(n,i),this._lenses.splice(this._lenses.indexOf(t),1)})),n.commit(t)}))})),e.schedule(),this._resolveCodeLensesScheduler.cancel(),null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0}))),this._localToDispose.add(this._editor.onDidFocusEditorWidget((()=>{e.schedule()}))),this._localToDispose.add(this._editor.onDidBlurEditorText((()=>{e.cancel()}))),this._localToDispose.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(zi((()=>{if(this._editor.getModel()){const t=$z.capture(this._editor);this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{this._disposeAllLenses(t,i)}))})),t.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)}))),this._localToDispose.add(this._editor.onMouseDown((t=>{if(9!==t.target.type)return;let i=t.target.element;if("SPAN"===(null==i?void 0:i.tagName)&&(i=i.parentElement),"A"===(null==i?void 0:i.tagName))for(const t of this._lenses){const e=t.getCommand(i);if(e){this._commandService.executeCommand(e.id,...e.arguments||[]).catch((t=>this._notificationService.error(t)));break}}}))),e.schedule()}_disposeAllLenses(t,i){const e=new IJ;for(const t of this._lenses)t.dispose(e,i);t&&e.commit(t),this._lenses.length=0}_renderCodeLensSymbols(t){if(!this._editor.hasModel())return;const i=this._editor.getModel().getLineCount(),e=[];let s;for(const n of t.lenses){const t=n.symbol.range.startLineNumber;t<1||t>i||(s&&s[s.length-1].symbol.range.startLineNumber===t?s.push(n):(s=[n],e.push(s)))}if(!e.length&&!this._lenses.length)return;const n=$z.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new IJ;let n=0,o=0;for(;o<e.length&&n<this._lenses.length;){const t=e[o][0].symbol.range.startLineNumber,h=this._lenses[n].getLineNumber();h<t?(this._lenses[n].dispose(s,i),this._lenses.splice(n,1)):h===t?(this._lenses[n].updateCodeLensSymbols(e[o],s),o++,n++):(this._lenses.splice(n,0,new NJ(e[o],this._editor,s,i,r.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),n++,o++)}for(;n<this._lenses.length;)this._lenses[n].dispose(s,i),this._lenses.splice(n,1);for(;o<e.length;)this._lenses.push(new NJ(e[o],this._editor,s,i,r.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),o++;s.commit(t)}))})),n.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var t;null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0;const i=this._editor.getModel();if(!i)return;const e=[],s=[];if(this._lenses.forEach((t=>{const n=t.computeIfNecessary(i);n&&(e.push(n),s.push(t))})),0===e.length)return;const n=Date.now(),r=Zh((t=>{const n=e.map(((e,n)=>{const r=new Array(e.length),o=e.map(((e,s)=>e.symbol.command||"function"!=typeof e.provider.resolveCodeLens?(r[s]=e.symbol,Promise.resolve(void 0)):Promise.resolve(e.provider.resolveCodeLens(i,e.symbol,t)).then((t=>{r[s]=t}),Fi)));return Promise.all(o).then((()=>{t.isCancellationRequested||s[n].isDisposed()||s[n].updateCommands(r)}))}));return Promise.all(n)}));this._resolveCodeLensesPromise=r,this._resolveCodeLensesPromise.then((()=>{const t=this._resolveCodeLensesDebounce.update(i,Date.now()-n);this._resolveCodeLensesScheduler.delay=t,this._currentCodeLensModel&&this._codeLensCache.put(i,this._currentCodeLensModel),this._oldCodeLensModels.clear(),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}),(t=>{Li(t),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}))}async getModel(){var t;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,(null===(t=this._currentCodeLensModel)||void 0===t?void 0:t.isDisposed)?void 0:this._currentCodeLensModel}};$J.ID="css.editor.codeLens",$J=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([BJ(1,op),BJ(2,YT),BJ(3,po),BJ(4,VF),BJ(5,FJ)],$J),iu($J.ID,$J,1),Xa(class extends Ga{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:PS.hasCodeLensProvider,label:Q(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(t,i){if(!i.hasModel())return;const e=t.get(mj),s=t.get(po),n=t.get(VF),r=i.getSelection().positionLineNumber,o=i.getContribution($J.ID);if(!o)return;const h=await o.getModel();if(!h)return;const c=[];for(const t of h.lenses)t.symbol.command&&t.symbol.range.startLineNumber===r&&c.push({label:t.symbol.command.title,command:t.symbol.command});if(0===c.length)return;const l=await e.pick(c,{canPickMany:!1,placeHolder:Q(0,"Select a command")});if(!l)return;let a=l.command;if(h.isDisposed){const t=await o.getModel(),i=null==t?void 0:t.lenses.find((t=>{var i;return t.symbol.range.startLineNumber===r&&(null===(i=t.symbol.command)||void 0===i?void 0:i.title)===a.title}));if(!i||!i.symbol.command)return;a=i.symbol.command}try{await s.executeCommand(a.id,...a.arguments||[])}catch(t){n.error(t)}}});var WJ=function(t,i){return function(e,s){i(e,s,t)}};class jJ{constructor(t,i){this._editorWorkerClient=new pp(t,!1,"editorWorkerService",i)}async provideDocumentColors(t,i){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new Gg(new Ug(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Gg.Format.CSS.formatRGB(o):Gg.Format.CSS.formatRGBA(o),c=r?Gg.Format.CSS.formatHSL(o):Gg.Format.CSS.formatHSLA(o),l=r?Gg.Format.CSS.formatHex(o):Gg.Format.CSS.formatHexA(o),a=[];return a.push({label:h,textEdit:{range:s,text:h}}),a.push({label:c,textEdit:{range:s,text:c}}),a.push({label:l,textEdit:{range:s,text:l}}),a}}let VJ=class extends Ki{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new jJ(t,i)))}};async function HJ(t,i,e,s=!0){return GJ(new UJ,t,i,e,s)}function zJ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}VJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([WJ(0,no),WJ(1,Nd),WJ(2,op)],VJ),RH(VJ);class UJ{constructor(){}async compute(t,i,e,s){const n=await t.provideDocumentColors(i,e);if(Array.isArray(n))for(const i of n)s.push({colorInfo:i,provider:t});return Array.isArray(n)}}class KJ{constructor(){}async compute(t,i,e,s){const n=await t.provideDocumentColors(i,e);if(Array.isArray(n))for(const t of n)s.push({range:t.range,color:[t.color.red,t.color.green,t.color.blue,t.color.alpha]});return Array.isArray(n)}}class qJ{constructor(t){this.colorInfo=t}async compute(t,i,e,s){const n=await t.provideColorPresentations(i,this.colorInfo,fe.None);return Array.isArray(n)&&s.push(...n),Array.isArray(n)}}async function GJ(t,i,e,s,n){let r,o=!1;const h=[],c=i.ordered(e);for(let i=c.length-1;i>=0;i--){const n=c[i];if(n instanceof jJ)r=n;else try{await t.compute(n,e,s,h)&&(o=!0)}catch(t){Fi(t)}}return o?h:r&&n?(await t.compute(r,e,s,h),h):[]}function ZJ(t,i){const{colorProvider:e}=t.get(op),s=t.get(no).getModel(i);if(!s)throw Ii();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(rd).getValue("editor.defaultColorDecorators",{resource:i})}}mo.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof hs))throw Ii();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=ZJ(t,e);return GJ(new KJ,n,s,fe.None,r)})),mo.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof hs&&Array.isArray(e)&&4===e.length&&bs.isIRange(r)))throw Ii();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=ZJ(t,n),[l,a,u,d]=e;return GJ(new qJ({range:r,color:{red:l,green:a,blue:u,alpha:d}}),h,o,fe.None,c)}));var JJ,QJ=function(t,i){return function(e,s){i(e,s,t)}};const YJ=Object.create({});let XJ=JJ=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._configurationService=i,this._languageFeaturesService=e,this._localToDispose=this._register(new Ui),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new uy(this._editor),this._decoratorLimitReporter=new tQ,this._colorDecorationClassRefs=this._register(new Ui),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:JJ.RECOMPUTE_TIME}),this._register(t.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(t.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(e.colorProvider.onDidChange((()=>this.updateColors()))),this._register(t.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(21),s=t.hasChanged(145);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const t=this._editor.getModel();if(!t)return!1;const i=t.getLanguageId(),e=this._configurationService.getValue(i);if(e&&"object"==typeof e){const t=e.colorDecorators;if(t&&void 0!==t.enable&&!t.enable)return t.enable}return this._editor.getOption(20)}static get(t){return t.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const t=this._editor.getModel();t&&this._languageFeaturesService.colorProvider.has(t)&&(this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._timeoutTimer||(this._timeoutTimer=new sc,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}async beginCompute(){this._computePromise=Zh((async t=>{const i=this._editor.getModel();if(!i)return[];const e=new Yi(!1),s=await HJ(this._languageFeaturesService.colorProvider,i,t,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(i,e.elapsed()),s}));try{const t=await this._computePromise;this.updateDecorations(t),this.updateColorDecorators(t),this._computePromise=null}catch(t){Li(t)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(t){const i=t.map((t=>({range:{startLineNumber:t.colorInfo.range.startLineNumber,startColumn:t.colorInfo.range.startColumn,endLineNumber:t.colorInfo.range.endLineNumber,endColumn:t.colorInfo.range.endColumn},options:aL.EMPTY})));this._editor.changeDecorations((e=>{this._decorationsIds=e.deltaDecorations(this._decorationsIds,i),this._colorDatas=new Map,this._decorationsIds.forEach(((i,e)=>this._colorDatas.set(i,t[e])))}))}updateColorDecorators(t){this._colorDecorationClassRefs.clear();const i=[],e=this._editor.getOption(21);for(let s=0;s<t.length&&i.length<e;s++){const{red:e,green:n,blue:r,alpha:o}=t[s].colorInfo.color,h=new Ug(Math.round(255*e),Math.round(255*n),Math.round(255*r),o),c=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:`rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`}));i.push({range:{startLineNumber:t[s].colorInfo.range.startLineNumber,startColumn:t[s].colorInfo.range.startColumn,endLineNumber:t[s].colorInfo.range.endLineNumber,endColumn:t[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:" ",inlineClassName:`${c.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:YJ}}})}this._decoratorLimitReporter.update(t.length,e<t.length&&e),this._colorDecoratorIds.set(i)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(t){const i=this._editor.getModel();if(!i)return null;const e=i.getDecorationsInRange(bs.fromPositions(t,t)).filter((t=>this._colorDatas.has(t.id)));return 0===e.length?null:this._colorDatas.get(e[0].id)}isColorDecoration(t){return this._colorDecoratorIds.has(t)}};XJ.ID="editor.contrib.colorDetector",XJ.RECOMPUTE_TIME=1e3,XJ=JJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([QJ(1,rd),QJ(2,op),QJ(3,YT)],XJ);class tQ{constructor(){this._onDidChange=new ne,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}iu(XJ.ID,XJ,1);class iQ{get color(){return this._color}set color(t){this._color.equals(t)||(this._color=t,this._onDidChangeColor.fire(t))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(t){this._colorPresentations=t,this.presentationIndex>t.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(t,i,e){this.presentationIndex=e,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ne,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ne,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=t,this._color=t,this._colorPresentations=i}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(t,i){let e=-1;for(let t=0;t<this.colorPresentations.length;t++)if(i.toLowerCase()===this.colorPresentations[t].label){e=t;break}if(-1===e){const t=i.split("(")[0].toLowerCase();for(let i=0;i<this.colorPresentations.length;i++)if(this.colorPresentations[i].label.toLowerCase().startsWith(t)){e=i;break}}-1!==e&&e!==this.presentationIndex&&(this.presentationIndex=e,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const eQ=Fa;class sQ extends Ki{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=eQ(".colorpicker-header"),xa(t,this._domNode),this._pickedColorNode=xa(this._domNode,eQ(".picked-color")),xa(this._pickedColorNode,eQ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=xa(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const n=Q(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",n),this._originalColorNode=xa(this._domNode,eQ(".original-color")),this._originalColorNode.style.backgroundColor=Gg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(vv)||Gg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(vv)||Gg.white}))),this._register(Il(this._pickedColorNode,ya.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Il(this._originalColorNode,ya.CLICK,(()=>{this.model.color=this.model.originalColor,this.model.flushColor()}))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this._register(i.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Gg.Format.CSS.format(i.color)||"",this._pickedColorNode.classList.toggle("light",i.color.rgba.a<.5?this.backgroundColor.isLighter():i.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new nQ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Gg.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class nQ extends Ki{constructor(t){super(),this._onClicked=this._register(new ne),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),xa(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),xa(this._button,i),xa(i,eQ(".button"+go.asCSSSelector(AV("color-picker-close",xs.close,Q(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class rQ extends Ki{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=eQ(".colorpicker-body"),xa(t,this._domNode),this._saturationBox=new oQ(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new cQ(this._domNode,this.model,s),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new lQ(this._domNode,this.model,s),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),s&&(this._insertButton=this._register(new aQ(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:t,v:i}){const e=this.model.color.hsva;this.model.color=new Gg(new qg(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Gg(new qg(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Gg(new qg(360===e?0:e,i.s,i.v,i.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class oQ extends Ki{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,this._domNode=eQ(".saturation-wrap"),xa(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",xa(this._domNode,this._canvas),this.selection=eQ(".saturation-selection"),xa(this._domNode,this.selection),this.layout(),this._register(Il(this._domNode,ya.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;this.monitor=this._register(new Um);const i=Zl(this._domNode);t.target!==this.selection&&this.onDidChangePosition(t.offsetX,t.offsetY),this.monitor.startMonitoring(t.target,t.pointerId,t.buttons,(t=>this.onDidChangePosition(t.pageX-i.left,t.pageY-i.top)),(()=>null));const e=Il(t.target.ownerDocument,ya.POINTER_UP,(()=>{this._onColorFlushed.fire(),e.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)}),!0)}onDidChangePosition(t,i){const e=Math.max(0,Math.min(1,t/this.width)),s=Math.max(0,Math.min(1,1-i/this.height));this.paintSelection(e,s),this._onDidChange.fire({s:e,v:s})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const t=this.model.color.hsva;this.paintSelection(t.s,t.v)}paint(){const t=new Gg(new qg(this.model.color.hsva.h,1,1,1)),i=this._canvas.getContext("2d"),e=i.createLinearGradient(0,0,this._canvas.width,0);e.addColorStop(0,"rgba(255, 255, 255, 1)"),e.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),e.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=Gg.Format.CSS.format(t),i.fill(),i.fillStyle=e,i.fill(),i.fillStyle=s,i.fill()}paintSelection(t,i){this.selection.style.left=t*this.width+"px",this.selection.style.top=this.height-i*this.height+"px"}onDidChangeColor(t){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const i=t.hsva;this.paintSelection(i.s,i.v)}}class hQ extends Ki{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=xa(t,eQ(".standalone-strip")),this.overlay=xa(this.domNode,eQ(".standalone-overlay"))):(this.domNode=xa(t,eQ(".strip")),this.overlay=xa(this.domNode,eQ(".overlay"))),this.slider=xa(this.domNode,eQ(".slider")),this.slider.style.top="0px",this._register(Il(this.domNode,ya.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onDidChangeColor(t){const i=this.getValue(t);this.updateSliderPosition(i)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new Um),e=Zl(this.domNode);this.domNode.classList.add("grabbing"),t.target!==this.slider&&this.onDidChangeTop(t.offsetY),i.startMonitoring(t.target,t.pointerId,t.buttons,(t=>this.onDidChangeTop(t.pageY-e.top)),(()=>null));const s=Il(t.target.ownerDocument,ya.POINTER_UP,(()=>{this._onColorFlushed.fire(),s.dispose(),i.stopMonitoring(!0),this.domNode.classList.remove("grabbing")}),!0)}onDidChangeTop(t){const i=Math.max(0,Math.min(1,1-t/this.height));this.updateSliderPosition(i),this._onDidChange.fire(i)}updateSliderPosition(t){this.slider.style.top=(1-t)*this.height+"px"}}class cQ extends hQ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){super.onDidChangeColor(t);const{r:i,g:e,b:s}=t.rgba,n=new Gg(new Ug(i,e,s,1)),r=new Gg(new Ug(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class lQ extends hQ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class aQ extends Ki{constructor(t){super(),this._onClicked=this._register(new ne),this.onClicked=this._onClicked.event,this._button=xa(t,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._button.onclick=()=>{this._onClicked.fire()}}get button(){return this._button}}class uQ extends Yy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Or.onDidChange((()=>this.layout())));const r=eQ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new sQ(r,this.model,s,n)),this.body=this._register(new rQ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var dQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},fQ=function(t,i){return function(e,s){i(e,s,t)}};class gQ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s,this.forceShowAtRange=!0}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let pQ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return dc.fromPromise(this._computeAsync(t,i,e))}async _computeAsync(t,i,e){if(!this._editor.hasModel())return[];const s=XJ.get(this._editor);if(!s)return[];for(const t of i){if(!s.isColorDecoration(t))continue;const i=s.getColorData(t.range.getStartPosition());if(i)return[await vQ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}renderHoverParts(t,i){return bQ(this,this._editor,this._themeService,i,t)}};pQ=dQ([fQ(1,Nk)],pQ);class mQ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let wQ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}async createColorHover(t,i,e){if(!this._editor.hasModel())return null;if(!XJ.get(this._editor))return null;const s=await HJ(e,this._editor.getModel(),fe.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;bs.containsRange(e.range,t.range)&&(n=e,r=i.provider)}const o=null!=n?n:t,h=null!=r?r:i,c=!!n;return{colorHover:await vQ(this,this._editor.getModel(),o,h),foundInEditor:c}}async updateEditorModel(t){if(!this._editor.hasModel())return;const i=t.model;let e=new bs(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(await kQ(this._editor.getModel(),i,this._color,e,t),e=yQ(this._editor,e,i))}renderHoverParts(t,i){return bQ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};async function vQ(t,i,e,s){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Ug(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),a=new Gg(l),u=await zJ(i,e,s,fe.None),d=new iQ(a,[],0);return d.colorPresentations=u||[],d.guessColorPresentation(a,n),t instanceof pQ?new gQ(t,bs.lift(e.range),d,s):new mQ(t,bs.lift(e.range),d,s)}function bQ(t,i,e,s,n){if(0===s.length||!i.hasModel())return Ki.None;if(n.setMinimumDimensions){const t=i.getOption(66)+8;n.setMinimumDimensions(new ql(302,t))}const r=new Ui,o=s[0],h=i.getModel(),c=o.model,l=r.add(new uQ(n.fragment,c,i.getOption(141),e,t instanceof wQ));n.setColorPicker(l);let a=!1,u=new bs(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof wQ){const i=s[0].model.color;t.color=i,kQ(h,c,i,u,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((async t=>{await kQ(h,c,t,u,o),a=!0,u=yQ(i,u,c,n)})));return r.add(c.onDidChangeColor((t=>{kQ(h,c,t,u,o)}))),r.add(i.onDidChangeModelContent((()=>{a?a=!1:(n.hide(),i.focus())}))),r}function yQ(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new bs(e.presentation.textEdit.range.startLineNumber,e.presentation.textEdit.range.startColumn,e.presentation.textEdit.range.endLineNumber,e.presentation.textEdit.range.endColumn);const i=t.getModel()._setTrackedRange(null,r,3);t.pushUndoStop(),t.executeEdits("colorpicker",n),r=t.getModel()._getTrackedRange(i)||r}else n=[{range:i,text:e.presentation.label,forceMoveMarkers:!1}],r=i.setEndPosition(i.endLineNumber,i.startColumn+e.presentation.label.length),t.pushUndoStop(),t.executeEdits("colorpicker",n);return e.presentation.additionalTextEdits&&(n=[...e.presentation.additionalTextEdits],t.executeEdits("colorpicker",n),s&&s.hide()),t.pushUndoStop(),r}async function kQ(t,i,e,s,n){const r=await zJ(t,{range:s,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},n.provider,fe.None);i.colorPresentations=r||[]}function CQ(t,i){return!!t[i]}wQ=dQ([fQ(1,Nk)],wQ);class SQ{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=CQ(t.event,i.triggerModifier),this.hasSideBySideModifier=CQ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class xQ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=CQ(t,i.triggerModifier)}}class DQ{constructor(t,i,e,s){this.triggerKey=t,this.triggerModifier=i,this.triggerSideBySideKey=e,this.triggerSideBySideModifier=s}equals(t){return this.triggerKey===t.triggerKey&&this.triggerModifier===t.triggerModifier&&this.triggerSideBySideKey===t.triggerSideBySideKey&&this.triggerSideBySideModifier===t.triggerSideBySideModifier}}function EQ(t){return"altKey"===t?pt?new DQ(57,"metaKey",6,"altKey"):new DQ(5,"ctrlKey",6,"altKey"):pt?new DQ(6,"altKey",57,"metaKey"):new DQ(6,"altKey",5,"ctrlKey")}class AQ extends Ki{constructor(t,i){var e;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ne),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ne),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ne),this.onCancel=this._onCancel.event,this._editor=t,this._extractLineNumberFromMouseEvent=null!==(e=null==i?void 0:i.extractLineNumberFromMouseEvent)&&void 0!==e?e:t=>t.target.position?t.target.position.lineNumber:0,this._opts=EQ(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(77)){const t=EQ(this._editor.getOption(77));if(this._opts.equals(t))return;this._opts=t,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}}))),this._register(this._editor.onMouseMove((t=>this._onEditorMouseMove(new SQ(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new SQ(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new SQ(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new xQ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new xQ(t,this._opts))))),this._register(this._editor.onMouseDrag((()=>this._resetHandler()))),this._register(this._editor.onDidChangeCursorSelection((t=>this._onDidChangeCursorSelection(t)))),this._register(this._editor.onDidChangeModel((()=>this._resetHandler()))),this._register(this._editor.onDidChangeModelContent((()=>this._resetHandler()))),this._register(this._editor.onDidScrollChange((t=>{(t.scrollTopChanged||t.scrollLeftChanged)&&this._resetHandler()})))}_onDidChangeCursorSelection(t){t.selection&&t.selection.startColumn!==t.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(t){this._lastMouseMoveEvent=t,this._onMouseMoveOrRelevantKeyDown.fire([t,null])}_onEditorMouseDown(t){this._hasTriggerKeyOnMouseDown=t.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(t)}_onEditorMouseUp(t){const i=this._extractLineNumberFromMouseEvent(t);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===i&&this._onExecute.fire(t)}_onEditorKeyDown(t){this._lastMouseMoveEvent&&(t.keyCodeIsTriggerKey||t.keyCodeIsSideBySideKey&&t.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,t]):t.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(t){t.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var MQ=function(t,i){return function(e,s){i(e,s,t)}};let LQ=class extends gT{constructor(t,i,e,s,n,r,o,h,c,l,a,u,d){super(t,{...s.getRawOptions(),overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()},e,n,r,o,h,c,l,a,u,d),this._parentEditor=s,this._overwriteOptions=i,super.updateOptions(this._overwriteOptions),this._register(s.onDidChangeConfiguration((t=>this._onParentConfigurationChanged(t))))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(t){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(t){K(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};LQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([MQ(4,io),MQ(5,so),MQ(6,po),MQ(7,th),MQ(8,Nk),MQ(9,VF),MQ(10,Om),MQ(11,Nd),MQ(12,op)],LQ);const FQ=new Gg(new Ug(0,122,204)),TQ={showArrow:!0,showFrame:!0,className:"",frameColor:FQ,arrowColor:FQ,keepEditorSelection:!1};class RQ{constructor(t,i,e,s,n,r,o,h){this.id="",this.domNode=t,this.afterLineNumber=i,this.afterColumn=e,this.heightInLines=s,this.showInHiddenAreas=o,this.ordinal=h,this._onDomNodeTop=n,this._onComputedHeight=r}onDomNodeTop(t){this._onDomNodeTop(t)}onComputedHeight(t){this._onComputedHeight(t)}}class OQ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class _Q{constructor(t){this._editor=t,this._ruleName=_Q._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),ma(this._ruleName)}set color(t){this._color!==t&&(this._color=t,this._updateStyle())}set height(t){this._height!==t&&(this._height=t,this._updateStyle())}_updateStyle(){ma(this._ruleName),pa(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `)}show(t){1===t.column&&(t={lineNumber:t.lineNumber,column:2}),this._decorations.set([{range:bs.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}_Q._IdGenerator=new _I(".arrow-decoration-");class IQ{constructor(t,i={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Ui,this.container=null,this._isShowing=!1,this.editor=t,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=V(i),K(this.options,TQ,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange((t=>{const i=this._getWidth(t);this.domNode.style.width=i+"px",this.domNode.style.left=this._getLeft(t)+"px",this._onWidth(i)})))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._viewZone=null})),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new _Q(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(t){t.frameColor&&(this.options.frameColor=t.frameColor),t.arrowColor&&(this.options.arrowColor=t.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const t=this.options.frameColor.toString();this.container.style.borderTopColor=t,this.container.style.borderBottomColor=t}if(this._arrow&&this.options.arrowColor){const t=this.options.arrowColor.toString();this._arrow.color=t}}_getWidth(t){return t.width-t.minimap.minimapWidth-t.verticalScrollbarWidth}_getLeft(t){return t.minimap.minimapWidth>0&&0===t.minimap.minimapLeft?t.minimap.minimapWidth:0}_onViewZoneTop(t){this.domNode.style.top=t+"px"}_onViewZoneHeight(t){var i;if(this.domNode.style.height=`${t}px`,this.container){const i=t-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const e=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(e))}null===(i=this._resizeSash)||void 0===i||i.layout()}get position(){const t=this._positionMarkerId.getRange(0);if(t)return t.getStartPosition()}show(t,i){const e=bs.isIRange(t)?bs.lift(t):bs.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:aL.EMPTY}])}hide(){var t;this._viewZone&&(this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id)})),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),null===(t=this._arrow)||void 0===t||t.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const t=this.editor.getOption(66);let i=0;return this.options.showArrow&&(i+=2*Math.round(t/3)),this.options.showFrame&&(i+=2*Math.round(t/9)),i}_showImpl(t,i){const e=t.getStartPosition(),s=this.editor.getLayoutInfo(),n=this._getWidth(s);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(s)+"px";const r=document.createElement("div");r.style.overflow="hidden";const o=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const t=Math.max(12,this.editor.getLayoutInfo().height/o*.8);i=Math.min(i,t)}let h=0,c=0;if(this._arrow&&this.options.showArrow&&(h=Math.round(o/3),this._arrow.height=h,this._arrow.show(e)),this.options.showFrame&&(c=Math.round(o/9)),this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new RQ(r,e.lineNumber,e.column,i,(t=>this._onViewZoneTop(t)),(t=>this._onViewZoneHeight(t)),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=t.addZone(this._viewZone),this._overlayWidget=new OQ("vs.editor.contrib.zoneWidget"+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)})),this.container&&this.options.showFrame){const t=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=t+"px",this.container.style.borderBottomWidth=t+"px"}const l=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=l+"px",this.container.style.overflow="hidden"),this._doLayout(l,n),this.options.keepEditorSelection||this.editor.setSelection(t);const a=this.editor.getModel();if(a){const i=a.validateRange(new bs(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===a.getLineCount())}}revealRange(t,i){i?this.editor.revealLineNearTop(t.endLineNumber,0):this.editor.revealRange(t,0)}setCssClass(t,i){this.container&&(i&&this.container.classList.remove(i),this.container.classList.add(t))}_onWidth(t){}_doLayout(t,i){}_relayout(t){this._viewZone&&this._viewZone.heightInLines!==t&&this.editor.changeViewZones((i=>{this._viewZone&&(this._viewZone.heightInLines=t,i.layoutZone(this._viewZone.id))}))}_initSash(){if(this._resizeSash)return;let t;this._resizeSash=this._disposables.add(new AB(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0),this._disposables.add(this._resizeSash.onDidStart((i=>{this._viewZone&&(t={startY:i.startY,heightInLines:this._viewZone.heightInLines})}))),this._disposables.add(this._resizeSash.onDidEnd((()=>{t=void 0}))),this._disposables.add(this._resizeSash.onDidChange((i=>{if(t){const e=(i.currentY-t.startY)/this.editor.getOption(66),s=e<0?Math.ceil(e):Math.floor(e),n=t.heightInLines+s;n>5&&n<35&&this._relayout(n)}})))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(null===this.domNode.style.height?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const t=this.editor.getLayoutInfo();return t.width-t.minimap.minimapWidth}}var PQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},NQ=function(t,i){return function(e,s){i(e,s,t)}};const BQ=eo("IPeekViewService");var $Q;gd(BQ,class{constructor(){this._widgets=new Map}addExclusiveWidget(t,i){const e=this._widgets.get(t);e&&(e.listener.dispose(),e.widget.dispose()),this._widgets.set(t,{widget:i,listener:i.onDidClose((()=>{const e=this._widgets.get(t);e&&e.widget===i&&(e.listener.dispose(),this._widgets.delete(t))}))})}},1),function(t){t.inPeekEditor=new Xo("inReferenceSearchEditor",!0,Q(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}($Q||($Q={}));let WQ=class{constructor(t,i){t instanceof LQ&&$Q.inPeekEditor.bindTo(i)}dispose(){}};WQ.ID="editor.contrib.referenceController",WQ=PQ([NQ(1,th)],WQ),iu(WQ.ID,WQ,0);const jQ={headerBackgroundColor:Gg.white,primaryHeadingColor:Gg.fromHex("#333333"),secondaryHeadingColor:Gg.fromHex("#6c6c6cb3")};let VQ=class extends IQ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ne,this.onDidClose=this._onDidClose.event,K(this.options,jQ,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(t){const i=this.options;t.headerBackgroundColor&&(i.headerBackgroundColor=t.headerBackgroundColor),t.primaryHeadingColor&&(i.primaryHeadingColor=t.primaryHeadingColor),t.secondaryHeadingColor&&(i.secondaryHeadingColor=t.secondaryHeadingColor),super.style(t)}_applyStyles(){super._applyStyles();const t=this.options;this._headElement&&t.headerBackgroundColor&&(this._headElement.style.backgroundColor=t.headerBackgroundColor.toString()),this._primaryHeading&&t.primaryHeadingColor&&(this._primaryHeading.style.color=t.primaryHeadingColor.toString()),this._secondaryHeading&&t.secondaryHeadingColor&&(this._secondaryHeading.style.color=t.secondaryHeadingColor.toString()),this._bodyElement&&t.frameColor&&(this._bodyElement.style.borderColor=t.frameColor.toString())}_fillContainer(t){this.setCssClass("peekview-widget"),this._headElement=Fa(".head"),this._bodyElement=Fa(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Fa(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Nl(this._titleElement,"click",(t=>this._onTitleClick(t)))),xa(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Fa("span.filename"),this._secondaryHeading=Fa("span.dirname"),this._metaHeading=Fa("span.meta"),xa(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=Fa(".peekview-actions");xa(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new IN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new oo("peekview.close",Q(0,"Close"),go.asClassName(xs.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:_N.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(t){}setTitle(t,i){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=t,this._primaryHeading.setAttribute("title",t),i?this._secondaryHeading.innerText=i:Ol(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Ta(this._metaHeading)):Ra(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(66)),s=Math.round(t-(e+2));this._doLayoutHead(e,i),this._doLayoutBody(s,i)}_doLayoutHead(t,i){this._headElement&&(this._headElement.style.height=`${t}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(t,i){this._bodyElement&&(this._bodyElement.style.height=`${t}px`)}};VQ=PQ([NQ(2,io)],VQ);const HQ=Jm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view title area.")),zQ=Jm("peekViewTitleLabel.foreground",{dark:Gg.white,light:Gg.black,hcDark:Gg.white,hcLight:Gw},Q(0,"Color of the peek view title.")),UQ=Jm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},Q(0,"Color of the peek view title info.")),KQ=Jm("peekView.border",{dark:zw,light:zw,hcDark:iw,hcLight:iw},Q(0,"Color of the peek view borders and arrow.")),qQ=Jm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view result list."));Jm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color for line nodes in the peek view result list.")),Jm("peekViewResult.fileForeground",{dark:Gg.white,light:"#1E1E1E",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color for file nodes in the peek view result list.")),Jm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},Q(0,"Background color of the selected entry in the peek view result list.")),Jm("peekViewResult.selectionForeground",{dark:Gg.white,light:"#6C6C6C",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color of the selected entry in the peek view result list."));const GQ=Jm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view editor."));Jm("peekViewEditorGutter.background",{dark:GQ,light:GQ,hcDark:GQ,hcLight:GQ},Q(0,"Background color of the gutter in the peek view editor.")),Jm("peekViewEditorStickyScroll.background",{dark:GQ,light:GQ,hcDark:GQ,hcLight:GQ},Q(0,"Background color of sticky scroll in the peek view editor.")),Jm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},Q(0,"Match highlight color in the peek view result list.")),Jm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},Q(0,"Match highlight color in the peek view editor.")),Jm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:ew,hcLight:ew},Q(0,"Match highlight border in the peek view editor."));class ZQ{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=II.nextId()}get uri(){return this.link.uri}get range(){var t,i;return null!==(i=null!==(t=this._range)&&void 0!==t?t:this.link.targetSelectionRange)&&void 0!==i?i:this.link.range}set range(t){this._range=t,this._rangeCallback(this)}get ariaMessage(){var t;const i=null===(t=this.parent.getPreview(this))||void 0===t?void 0:t.preview(this.range);return i?Q(0,"{0} in {1} on line {2} at column {3}",i.value,eA(this.uri),this.range.startLineNumber,this.range.startColumn):Q(0,"in {0} on line {1} at column {2}",eA(this.uri),this.range.startLineNumber,this.range.startColumn)}}class JQ{constructor(t){this._modelReference=t}dispose(){this._modelReference.dispose()}preview(t,i=8){const e=this._modelReference.object.textEditorModel;if(!e)return;const{startLineNumber:s,startColumn:n,endLineNumber:r,endColumn:o}=t,h=e.getWordUntilPosition({lineNumber:s,column:n-i}),c=new bs(s,h.startColumn,s,n),l=new bs(r,o,r,1073741824),a=e.getValueInRange(c).replace(/^\s+/,""),u=e.getValueInRange(t);return{value:a+u+e.getValueInRange(l).replace(/\s+$/,""),highlight:{start:a.length,end:a.length+u.length}}}}class QQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new Eg}dispose(){Vi(this._previews.values()),this._previews.clear()}getPreview(t){return this._previews.get(t.uri)}get ariaMessage(){const t=this.children.length;return 1===t?Q(0,"1 symbol in {0}, full path {1}",eA(this.uri),this.uri.fsPath):Q(0,"{0} symbols in {1}, full path {2}",t,eA(this.uri),this.uri.fsPath)}async resolve(t){if(0!==this._previews.size)return this;for(const i of this.children)if(!this._previews.has(i.uri))try{const e=await t.createModelReference(i.uri);this._previews.set(i.uri,new JQ(e))}catch(t){Li(t)}return this}}class YQ{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ne,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(YQ._compareReferences);for(const i of t)if(s&&XE.isEqual(s.uri,i.uri,!0)||(s=new QQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==YQ._compareReferences(i,s.children[s.children.length-1])){const t=new ZQ(e===i,s,i,(t=>this._onDidChangeReferenceRange.fire(t)));this.references.push(t),s.children.push(t)}}dispose(){Vi(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new YQ(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?Q(0,"No results found"):1===this.references.length?Q(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?Q(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):Q(0,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(t,i){const{parent:e}=t;let s=e.children.indexOf(t);const n=e.children.length,r=e.parent.groups.length;return 1===r||i&&s+1<n||!i&&s>0?(s=i?(s+1)%n:(s+n-1)%n,e.children[s]):(s=e.parent.groups.indexOf(e),i?(s=(s+1)%r,e.parent.groups[s].children[0]):(s=(s+r-1)%r,e.parent.groups[s].children[e.parent.groups[s].children.length-1]))}nearestReference(t,i){const e=this.references.map(((e,s)=>({idx:s,prefixLen:sr(e.uri.toString(),t.toString()),offsetDist:100*Math.abs(e.range.startLineNumber-i.lineNumber)+Math.abs(e.range.startColumn-i.column)}))).sort(((t,i)=>t.prefixLen>i.prefixLen?-1:t.prefixLen<i.prefixLen?1:t.offsetDist<i.offsetDist?-1:t.offsetDist>i.offsetDist?1:0))[0];if(e)return this.references[e.idx]}referenceAt(t,i){for(const e of this.references)if(e.uri.toString()===t.toString()&&bs.containsPosition(e.range,i))return e}firstReference(){for(const t of this.references)if(t.isProviderFirst)return t;return this.references[0]}static _compareReferences(t,i){return XE.compare(t.uri,i.uri)||bs.compareRangesUsingStarts(t.range,i.range)}}var XQ,tY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},iY=function(t,i){return function(e,s){i(e,s,t)}};let eY=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof YQ||t instanceof QQ}getChildren(t){if(t instanceof YQ)return t.groups;if(t instanceof QQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};eY=tY([iY(0,ro)],eY);class sY{getHeight(){return 23}getTemplateId(t){return t instanceof QQ?hY.id:lY.id}}let nY=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof ZQ){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return eA(t.uri)}};nY=tY([iY(0,HC)],nY);class rY{getId(t){return t instanceof ZQ?t.id:t.uri}}let oY=class extends Ki{constructor(t,i){super(),this._labelService=i;const e=document.createElement("div");e.classList.add("reference-file"),this.file=this._register(new Tj(e,{supportHighlights:!0})),this.badge=new yj(xa(e,Fa(".count")),{},bN),t.appendChild(e)}set(t,i){const e=nA(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(e,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const s=t.children.length;this.badge.setCount(s),this.badge.setTitleFormat(Q(0,s>1?"{0} references":"{0} reference",s))}};oY=tY([iY(1,CO)],oY);let hY=XQ=class{constructor(t){this._instantiationService=t,this.templateId=XQ.id}renderTemplate(t){return this._instantiationService.createInstance(oY,t)}renderElement(t,i,e){e.set(t.element,q_(t.filterData))}disposeTemplate(t){t.dispose()}};hY.id="FileReferencesRenderer",hY=XQ=tY([iY(0,io)],hY);class cY{constructor(t){this.label=new Lj(t)}set(t,i){var e;const s=null===(e=t.parent.getPreview(t))||void 0===e?void 0:e.preview(t.range);if(s&&s.value){const{value:t,highlight:e}=s;i&&!rI.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,q_(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${eA(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class lY{constructor(){this.templateId=lY.id}renderTemplate(t){return new cY(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}lY.id="OneReferenceRenderer";class aY{getWidgetAriaLabel(){return Q(0,"References")}getAriaLabel(t){return t.ariaMessage}}var uY=function(t,i){return function(e,s){i(e,s,t)}};class dY{constructor(t,i){this._editor=t,this._model=i,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Ui,this._callOnModelChange=new Ui,this._callOnDispose.add(this._editor.onDidChangeModel((()=>this._onModelChanged()))),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const t=this._editor.getModel();if(t)for(const i of this._model.references)if(i.uri.toString()===t.uri.toString())return void this._addDecorations(i.parent)}_addDecorations(t){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations((()=>this._onDecorationChanged())));const i=[],e=[];for(let s=0,n=t.children.length;s<n;s++){const n=t.children[s];this._decorationIgnoreSet.has(n.id)||n.uri.toString()===this._editor.getModel().uri.toString()&&(i.push({range:n.range,options:dY.DecorationOptions}),e.push(s))}this._editor.changeDecorations((s=>{const n=s.deltaDecorations([],i);for(let i=0;i<n.length;i++)this._decorations.set(n[i],t.children[e[i]])}))}_onDecorationChanged(){const t=[],i=this._editor.getModel();if(i){for(const[e,s]of this._decorations){const n=i.getDecorationRange(e);if(!n)continue;let r=!1;bs.equalsRange(n,s.range)||((bs.spansMultipleLines(n)||s.range.endColumn-s.range.startColumn!=n.endColumn-n.startColumn)&&(r=!0),r?(this._decorationIgnoreSet.add(s.id),t.push(e)):s.range=n)}for(let i=0,e=t.length;i<e;i++)this._decorations.delete(t[i]);this._editor.removeDecorations(t)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}}dY.DecorationOptions=aL.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class fY{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(t){let i,e;try{const s=JSON.parse(t);i=s.ratio,e=s.heightInLines}catch(t){}return{ratio:i||.7,heightInLines:e||18}}}class gY extends rj{}let pY=class extends VQ{constructor(t,i,e,s,n,r,o,h,c,l,a,u){super(t,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=i,this.layoutData=e,this._textModelResolverService=n,this._instantiationService=r,this._peekViewService=o,this._uriLabel=h,this._undoRedoService=c,this._keybindingService=l,this._languageService=a,this._languageConfigurationService=u,this._disposeOnNewModel=new Ui,this._callOnDispose=new Ui,this._onDidSelectReference=new ne,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ql(0,0),this._applyTheme(s.getColorTheme()),this._callOnDispose.add(s.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(t,this),this.create()}dispose(){this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Vi(this._preview),Vi(this._previewNotAvailableMessage),Vi(this._tree),Vi(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(t){const i=t.getColor(KQ)||Gg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(HQ)||Gg.transparent,primaryHeadingColor:t.getColor(zQ),secondaryHeadingColor:t.getColor(UQ)})}show(t){super.show(t,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(t){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"title"})}_fillBody(t){this.setCssClass("reference-zone-widget"),this._messageContainer=xa(t,Fa("div.messages")),Ra(this._messageContainer),this._splitView=new _B(t,{orientation:1}),this._previewContainer=xa(t,Fa("div.preview.inline")),this._preview=this._instantiationService.createInstance(LQ,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Ra(this._previewContainer),this._previewNotAvailableMessage=new tL(Q(0,"no preview available"),Ld,tL.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=xa(t,Fa("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new aY,keyboardNavigationLabelProvider:this._instantiationService.createInstance(nY),identityProvider:new rY,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:qQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Nl(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(gY,"ReferencesWidget",this._treeContainer,new sY,[this._instantiationService.createInstance(hY),this._instantiationService.createInstance(lY)],this._instantiationService.createInstance(eY),i),this._splitView.addView({onDidChange:Xi.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},OB.Distribute),this._splitView.addView({onDidChange:Xi.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:t=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${t}px`,this._tree.layout(this._dim.height,t)}},OB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const e=(t,i)=>{t instanceof ZQ&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{e(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Ra(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ql(i,t),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(i),this._splitView.resizeView(0,i*this.layoutData.ratio)}setSelection(t){return this._revealReference(t,!0).then((()=>{this._model&&(this._tree.setSelection([t]),this._tree.setFocus([t]))}))}setModel(t){return this._disposeOnNewModel.clear(),this._model=t,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=Q(0,"No results"),Ta(this._messageContainer),Promise.resolve(void 0)):(Ra(this._messageContainer),this._decorationsManager=new dY(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange((t=>this._tree.rerender(t)))),this._disposeOnNewModel.add(this._preview.onMouseDown((t=>{const{event:i,target:e}=t;if(2!==i.detail)return;const s=this._getFocusedReference();s&&this._onDidSelectReference.fire({element:{uri:s.uri,range:e.range},kind:i.ctrlKey||i.metaKey||i.altKey?"side":"open",source:"editor"})}))),this.container.classList.add("results-loaded"),Ta(this._treeContainer),Ta(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(1===this._model.groups.length?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[t]=this._tree.getFocus();return t instanceof ZQ?t:t instanceof QQ&&t.children.length>0?t.children[0]:void 0}async revealReference(t){await this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}async _revealReference(t,i){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==dl.inMemory?this.setTitle(iA(t.uri),this._uriLabel.getUriLabel(nA(t.uri))):this.setTitle(Q(0,"References"));const e=this._textModelResolverService.createModelReference(t.uri);this._tree.getInput()===t.parent||(i&&this._tree.reveal(t.parent),await this._tree.expand(t.parent)),this._tree.reveal(t);const s=await e;if(!this._model)return void s.dispose();Vi(this._previewModelReference);const n=s.object;if(n){const i=this._preview.getModel()===n.textEditorModel?0:1,e=bs.lift(t.range).collapseToStart();this._previewModelReference=s,this._preview.setModel(n.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),s.dispose()}};pY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([uY(3,Nk),uY(4,ro),uY(5,io),uY(6,BQ),uY(7,CO),uY(8,zM),uY(9,HC),uY(10,ud),uY(11,Nd)],pY);var mY,wY=function(t,i){return function(e,s){i(e,s,t)}};const vY=new Xo("referenceSearchVisible",!1,Q(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let bY=mY=class{static get(t){return t.getContribution(mY.ID)}constructor(t,i,e,s,n,r,o,h){this._defaultTreeKeyboardSupport=t,this._editor=i,this._editorService=s,this._notificationService=n,this._instantiationService=r,this._storageService=o,this._configurationService=h,this._disposables=new Ui,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=vY.bindTo(e)}dispose(){var t,i;this._referenceSearchVisible.reset(),this._disposables.dispose(),null===(t=this._widget)||void 0===t||t.dispose(),null===(i=this._model)||void 0===i||i.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(t,i,e){let s;if(this._widget&&(s=this._widget.position),this.closeWidget(),s&&t.containsPosition(s))return;this._peekMode=e,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const n="peekViewLayout",r=fY.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(pY,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(Q(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:s}=t;if(i)switch(s){case"open":"editor"===t.source&&this._configurationService.getValue("editor.stablePeek")||this.openReference(i,!1,!1);break;case"side":this.openReference(i,!0,!1);break;case"goto":e?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const o=++this._requestIdPool;i.then((i=>{var e;if(o===this._requestIdPool&&this._widget)return null===(e=this._model)||void 0===e||e.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":Q(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,e=new vs(t.startLineNumber,t.startColumn),s=this._model.nearestReference(i,e);if(s)return this._widget.setSelection(s).then((()=>{this._widget&&"editor"===this._editor.getOption(86)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(t){if(!this._editor.hasModel()||!this._model||!this._widget)return;const i=this._widget.position;if(!i)return;const e=this._model.nearestReference(this._editor.getModel().uri,i);if(!e)return;const s=this._model.nextOrPreviousReference(e,t),n=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(s),await this._gotoReference(s,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(t){this._editor.hasModel()&&this._model&&this._widget&&await this._widget.revealReference(t)}closeWidget(t=!0){var i,e;null===(i=this._widget)||void 0===i||i.dispose(),null===(e=this._model)||void 0===e||e.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,t&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(t,i){var e;null===(e=this._widget)||void 0===e||e.hide(),this._ignoreModelChangeEvent=!0;const s=bs.lift(t.range).collapseToStart();return this._editorService.openCodeEditor({resource:t.uri,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor).then((t=>{var i;if(this._ignoreModelChangeEvent=!1,t&&this._widget)if(this._editor===t)this._widget.show(s),this._widget.focusOnReferenceTree();else{const e=mY.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,Zh((()=>Promise.resolve(n))),null!==(i=this._peekMode)&&void 0!==i&&i)}else this.closeWidget()}),(t=>{this._ignoreModelChangeEvent=!1,Li(t)}))}openReference(t,i,e){i||this.closeWidget();const{uri:s,range:n}=t;this._editorService.openCodeEditor({resource:s,options:{selection:n,selectionSource:"code.jump",pinned:e}},this._editor,i)}};function yY(t,i){const e=function(t){const i=t.get(so).getFocusedCodeEditor();return i instanceof LQ?i.getParentEditor():i}(t);if(!e)return;const s=bY.get(e);s&&i(s)}bY.ID="editor.contrib.referencesController",bY=mY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([wY(2,th),wY(3,so),wY(4,VF),wY(5,io),wY(6,aN),wY(7,rd)],bY),vh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ae(2089,60),when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),vh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),vh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),mo.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),mo.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),mo.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),mo.registerCommand("closeReferenceSearch",(t=>yY(t,(t=>t.closeWidget())))),vh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Oo.and($Q.inPeekEditor,Oo.not("config.editor.stablePeek"))}),vh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Oo.and(vY,Oo.not("config.editor.stablePeek"))}),vh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Oo.and(vY,gW,yW.negate(),CW.negate()),handler(t){var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.revealReference(e[0])))}}),vh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Oo.and(vY,gW,yW.negate(),CW.negate()),handler(t){var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.openReference(e[0],!0,!0)))}}),mo.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.openReference(e[0],!1,!0)))}));var kY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},CY=function(t,i){return function(e,s){i(e,s,t)}};const SY=new Xo("hasSymbols",!1,Q(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),xY=eo("ISymbolNavigationService");let DY=class{constructor(t,i,e,s){this._editorService=i,this._notificationService=e,this._keybindingService=s,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=SY.bindTo(t)}reset(){var t,i;this._ctxHasSymbols.reset(),null===(t=this._currentState)||void 0===t||t.dispose(),null===(i=this._currentMessage)||void 0===i||i.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(t){const i=t.parent.parent;if(i.references.length<=1)return void this.reset();this._currentModel=i,this._currentIdx=i.references.indexOf(t),this._ctxHasSymbols.set(!0),this._showMessage();const e=new EY(this._editorService),s=e.onDidChange((()=>{if(this._ignoreEditorChange)return;const t=this._editorService.getActiveCodeEditor();if(!t)return;const e=t.getModel(),s=t.getPosition();if(!e||!s)return;let n=!1,r=!1;for(const t of i.references)if(tA(t.uri,e.uri))n=!0,r=r||bs.containsPosition(t.range,s);else if(n)break;n&&r||this.reset()}));this._currentState=Hi(e,s)}revealNext(t){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const i=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:i.uri,options:{selection:bs.collapseToStart(i.range),selectionRevealType:3}},t).finally((()=>{this._ignoreEditorChange=!1}))}_showMessage(){var t;null===(t=this._currentMessage)||void 0===t||t.dispose();const i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?Q(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):Q(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};DY=kY([CY(0,th),CY(1,so),CY(2,VF),CY(3,HC)],DY),gd(xY,DY,1),Ya(new class extends qa{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:SY,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(xY).revealNext(i)}}),vh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:SY,primary:9,handler(t){t.get(xY).reset()}});let EY=class{constructor(t){this._listener=new Map,this._disposables=new Ui,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._disposables.add(t.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(t.onCodeEditorAdd(this._onDidAddEditor,this)),t.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Vi(this._listener.values())}_onDidAddEditor(t){this._listener.set(t,Hi(t.onDidChangeCursorPosition((()=>this._onDidChange.fire({editor:t}))),t.onDidChangeModelContent((()=>this._onDidChange.fire({editor:t})))))}_onDidRemoveEditor(t){var i;null===(i=this._listener.get(t))||void 0===i||i.dispose(),this._listener.delete(t)}};async function AY(t,i,e,s){const n=e.ordered(t).map((e=>Promise.resolve(s(e,t,i)).then(void 0,(t=>{Fi(t)}))));return c((await Promise.all(n)).flat())}function MY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function LY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function FY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function TY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function RY(t,i,e,s,n){return AY(i,e,t,(async(t,i,e)=>{const r=await t.provideReferences(i,e,{includeDeclaration:!0},n);if(!s||!r||2!==r.length)return r;const o=await t.provideReferences(i,e,{includeDeclaration:!1},n);return o&&1===o.length?o:r}))}async function OY(t){const i=await t(),e=new YQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}var _Y,IY,PY,NY,BY,$Y,WY,jY;EY=kY([CY(0,so)],EY),Qa("_executeDefinitionProvider",((t,i,e)=>{const s=MY(t.get(op).definitionProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeTypeDefinitionProvider",((t,i,e)=>{const s=TY(t.get(op).typeDefinitionProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeDeclarationProvider",((t,i,e)=>{const s=LY(t.get(op).declarationProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeReferenceProvider",((t,i,e)=>{const s=RY(t.get(op).referenceProvider,i,e,!1,fe.None);return OY((()=>s))})),Qa("_executeImplementationProvider",((t,i,e)=>{const s=FY(t.get(op).implementationProvider,i,e,fe.None);return OY((()=>s))})),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextPeek,title:Q(0,"Peek"),group:"navigation",order:100});class VY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof VY||!(!vs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class HY extends Ja{static all(){return HY._allSymbolNavigationCommands.values()}static _patchConfig(t){const i={...t,f1:!0};if(i.menu)for(const e of It.wrap(i.menu))e.id!==Sh.EditorContext&&e.id!==Sh.EditorContextPeek||(e.when=Oo.and(t.precondition,e.when));return i}constructor(t,i){super(HY._patchConfig(i)),this.configuration=t,HY._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(VF),r=t.get(so),o=t.get(DO),h=t.get(xY),c=t.get(op),l=t.get(io),a=i.getModel(),u=i.getPosition(),d=VY.is(e)?e:new VY(a,u),f=new hq(i,5),g=Jh(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((async t=>{var n;if(!t||f.token.isCancellationRequested)return;let o;if(Cm(t.ariaMessage),t.referenceAt(a.uri,u)){const t=this._getAlternativeCommand(i);!HY._activeAlternativeCommands.has(t)&&HY._allSymbolNavigationCommands.has(t)&&(o=HY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=a.getWordAtPosition(u);null===(n=XZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),u)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);HY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{HY._activeAlternativeCommands.delete(this.desc.id)}))))}}),(t=>{n.error(t)})).finally((()=>{f.dispose()}));return o.showWhile(g,250),g}async _onResult(t,i,e,s,n){const r=this._getGoToPreference(e);if(e instanceof LQ||!(this.configuration.openInPeek||"peek"===r&&s.references.length>1)){const o=s.firstReference(),h=s.references.length>1&&"gotoAndPeek"===r,c=await this._openReference(e,t,o,this.configuration.openToSide,!h);h&&c?this._openInPeek(c,s,n):s.dispose(),"goto"===r&&i.put(o)}else this._openInPeek(e,s,n)}async _openReference(t,i,e,s,n){let r;var o;if((o=e)&&hs.isUri(o.uri)&&bs.isIRange(o.range)&&(bs.isIRange(o.originSelectionRange)||bs.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=await i.openCodeEditor({resource:e.uri,options:{selection:bs.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},t,s);if(h){if(n){const t=h.getModel(),i=h.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout((()=>{h.getModel()===t&&i.clear()}),350)}return h}}_openInPeek(t,i,e){const s=bY.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),Zh((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}HY._allSymbolNavigationCommands=new Map,HY._activeAlternativeCommands=new Set;class zY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await MY(t.definitionProvider,i,e,s),Q(0,"Definitions"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No definition found for '{0}'",t.word):Q(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleDefinitions}}Fh(((_Y=class extends zY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:_Y.id,title:{value:Q(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:Q(0,"Go to &&Definition")},precondition:Oo.and(PS.hasDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:PS.editorTextFocus,primary:70,weight:100},{when:Oo.and(PS.editorTextFocus,sW),primary:2118,weight:100}],menu:[{id:Sh.EditorContext,group:"navigation",order:1.1},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),mo.registerCommandAlias("editor.action.goToDeclaration",_Y.id)}}).id="editor.action.revealDefinition",_Y)),Fh(((IY=class extends zY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:IY.id,title:{value:Q(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Oo.and(PS.hasDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:PS.editorTextFocus,primary:Ae(2089,70),weight:100},{when:Oo.and(PS.editorTextFocus,sW),primary:Ae(2089,2118),weight:100}]}),mo.registerCommandAlias("editor.action.openDeclarationToTheSide",IY.id)}}).id="editor.action.revealDefinitionAside",IY)),Fh(((PY=class extends zY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:PY.id,title:{value:Q(0,"Peek Definition"),original:"Peek Definition"},precondition:Oo.and(PS.hasDefinitionProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:Sh.EditorContextPeek,group:"peek",order:2}}),mo.registerCommandAlias("editor.action.previewDeclaration",PY.id)}}).id="editor.action.peekDefinition",PY));class UY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await LY(t.declarationProvider,i,e,s),Q(0,"Declarations"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No declaration found for '{0}'",t.word):Q(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(58).multipleDeclarations}}Fh(((NY=class extends UY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:NY.id,title:{value:Q(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:Q(0,"Go to &&Declaration")},precondition:Oo.and(PS.hasDeclarationProvider,PS.isInWalkThroughSnippet.toNegated()),menu:[{id:Sh.EditorContext,group:"navigation",order:1.3},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No declaration found for '{0}'",t.word):Q(0,"No declaration found")}}).id="editor.action.revealDeclaration",NY)),Fh(class extends UY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:Q(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Oo.and(PS.hasDeclarationProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:3}})}});class KY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await TY(t.typeDefinitionProvider,i,e,s),Q(0,"Type Definitions"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No type definition found for '{0}'",t.word):Q(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleTypeDefinitions}}Fh(((BY=class extends KY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:BY.ID,title:{value:Q(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:Q(0,"Go to &&Type Definition")},precondition:Oo.and(PS.hasTypeDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:0,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.4},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",BY)),Fh((($Y=class extends KY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:$Y.ID,title:{value:Q(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Oo.and(PS.hasTypeDefinitionProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",$Y));class qY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await FY(t.implementationProvider,i,e,s),Q(0,"Implementations"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No implementation found for '{0}'",t.word):Q(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(58).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(58).multipleImplementations}}Fh(((WY=class extends qY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:WY.ID,title:{value:Q(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:Q(0,"Go to &&Implementations")},precondition:Oo.and(PS.hasImplementationProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:2118,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.45},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",WY)),Fh(((jY=class extends qY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:jY.ID,title:{value:Q(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Oo.and(PS.hasImplementationProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:3142,weight:100},menu:{id:Sh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",jY));class GY extends HY{_getNoResultFoundMessage(t){return t?Q(0,"No references found for '{0}'",t.word):Q(0,"No references found")}_getAlternativeCommand(t){return t.getOption(58).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(58).multipleReferences}}Fh(class extends GY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:Q(0,"Go to References"),original:"Go to References",mnemonicTitle:Q(0,"Go to &&References")},precondition:Oo.and(PS.hasReferenceProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:1094,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.45},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(t,i,e,s){return new YQ(await RY(t.referenceProvider,i,e,!0,s),Q(0,"References"))}}),Fh(class extends GY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:Q(0,"Peek References"),original:"Peek References"},precondition:Oo.and(PS.hasReferenceProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(t,i,e,s){return new YQ(await RY(t.referenceProvider,i,e,!1,s),Q(0,"References"))}});class ZY extends HY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:Q(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Oo.and($Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}async _getLocationModel(t,i,e,s){return new YQ(this._references,Q(0,"Locations"))}_getNoResultFoundMessage(t){return t&&Q(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}mo.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:hs},{name:"position",description:"The position at which to start",constraint:vs.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(t,i,e,s,n,r,o)=>{B(hs.isUri(i)),B(vs.isIPosition(e)),B(Array.isArray(s)),B(void 0===n||"string"==typeof n),B(void 0===o||"boolean"==typeof o);const h=t.get(so),c=await h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(lq(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends ZY{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(io).invokeFunction(i.run.bind(i),c)}))}}),mo.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:hs},{name:"position",description:"The position at which to start",constraint:vs.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"}]},handler:async(t,i,e,s,n)=>{t.get(po).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}}),mo.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(hs.isUri(i)),B(vs.isIPosition(e));const s=t.get(op),n=t.get(so);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!lq(t)||!t.hasModel())return;const i=bY.get(t);if(!i)return;const n=Zh((i=>RY(s.referenceProvider,t.getModel(),vs.lift(e),!1,i).then((t=>new YQ(t,Q(0,"References")))))),r=new bs(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),mo.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var JY,QY=function(t,i){return function(e,s){i(e,s,t)}};let YY=JY=class{constructor(t,i,e,s){this.textModelResolverService=i,this.languageService=e,this.languageFeaturesService=s,this.toUnhook=new Ui,this.toUnhookForKeyboard=new Ui,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=t,this.linkDecorations=this.editor.createDecorationsCollection();const n=new AQ(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,null!=i?i:void 0)}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Li(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(t){return t.getContribution(JY.ID)}async startFindDefinitionFromCursor(t){await this.startFindDefinition(t),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition((()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()}))),this.toUnhookForKeyboard.add(this.editor.onKeyDown((t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())})))}startFindDefinitionFromMouse(t,i){if(!(9===t.target.type&&this.linkDecorations.length>0))return this.editor.hasModel()&&this.isEnabled(t,i)?void this.startFindDefinition(t.target.position):(this.currentWordAtPosition=null,void this.removeLinkDecorations())}async startFindDefinition(t){var i;this.toUnhookForKeyboard.clear();const e=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!e)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;const s=new oq(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Zh((i=>this.findDefinition(t,i)));try{n=await this.previousPromise}catch(t){return void Li(t)}if(!n||!n.length||!s.validate(this.editor))return void this.removeLinkDecorations();const r=n[0].originSelectionRange?bs.lift(n[0].originSelectionRange):new bs(t.lineNumber,e.startColumn,t.lineNumber,e.endColumn);if(n.length>1){let t=r;for(const{originSelectionRange:i}of n)i&&(t=bs.plusRange(t,i));this.addDecoration(t,(new bI).appendText(Q(0,"Click to show {0} definitions.",n.length)))}else{const t=n[0];if(!t.uri)return;this.textModelResolverService.createModelReference(t.uri).then((i=>{if(!i.object||!i.object.textEditorModel)return void i.dispose();const{object:{textEditorModel:e}}=i,{startLineNumber:s}=t.range;if(s<1||s>e.getLineCount())return void i.dispose();const n=this.getPreviewValue(e,s,t),o=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(r,n?(new bI).appendCodeblock(o||"",n):void 0),i.dispose()}))}}getPreviewValue(t,i,e){let s=e.range;return s.endLineNumber-s.startLineNumber>=JY.MAX_SOURCE_PREVIEW_LINES&&(s=this.getPreviewRangeBasedOnIndentation(t,i)),this.stripIndentationFromPreviewRange(t,i,s)}stripIndentationFromPreviewRange(t,i,e){let s=t.getLineFirstNonWhitespaceColumn(i);for(let n=i+1;n<e.endLineNumber;n++){const i=t.getLineFirstNonWhitespaceColumn(n);s=Math.min(s,i)}return t.getValueInRange(e).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(t,i){const e=t.getLineFirstNonWhitespaceColumn(i),s=Math.min(t.getLineCount(),i+JY.MAX_SOURCE_PREVIEW_LINES);let n=i+1;for(;n<s&&e!==t.getLineFirstNonWhitespaceColumn(n);n++);return new bs(i,1,n+1,1)}addDecoration(t,i){this.linkDecorations.set([{range:t,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:i}}])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(t,i){var e;return this.editor.hasModel()&&t.isLeftClick&&t.isNoneOrSingleMouseDown&&6===t.target.type&&!((null===(e=t.target.detail.injectedText)||void 0===e?void 0:e.options)instanceof lL)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?MY(this.languageFeaturesService.definitionProvider,e,t,i):Promise.resolve(null)}gotoDefinition(t,i){return this.editor.setPosition(t),this.editor.invokeWithinContext((t=>{const e=!i&&this.editor.getOption(87)&&!this.isInPeekEditor(t);return new zY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(th);return $Q.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};YY.ID="editor.contrib.gotodefinitionatposition",YY.MAX_SOURCE_PREVIEW_LINES=8,YY=JY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([QY(1,ro),QY(2,ud),QY(3,op)],YY),iu(YY.ID,YY,2);const XY=Fa;class tX extends Ki{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new pk(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class iX extends Ki{static render(t,i,e){return new iX(t,i,e)}constructor(t,i,e){super(),this.actionContainer=xa(t,XY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=xa(this.actionContainer,XY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&xa(this.action,XY(`span.icon.${i.iconClass}`)),xa(this.action,XY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Il(this.actionContainer,ya.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Il(this.actionContainer,ya.KEY_DOWN,(t=>{const e=new jh(t);(e.equals(3)||e.equals(10))&&(t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer))}))),this.setEnabled(!0)}setEnabled(t){t?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}class eX{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class sX extends Ki{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ne),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new rc((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new rc((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new rc((()=>this._triggerLoadingMessage()),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(t,i=!0){this._state=t,i&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=function(t){const i=new pe,e=t(i.token);return new fc(i,(async t=>{const s=i.token.onCancellationRequested((()=>{s.dispose(),i.dispose(),t.reject(new _i)}));try{for await(const s of e){if(i.token.isCancellationRequested)return;t.emitOne(s)}s.dispose(),i.dispose()}catch(e){s.dispose(),i.dispose(),t.reject(e)}}))}((t=>this._computer.computeAsync(t))),(async()=>{try{for await(const t of this._asyncIterable)t&&(this._result.push(t),this._fireResult());this._asyncIterableDone=!0,3!==this._state&&4!==this._state||this._setState(0)}catch(t){Li(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){3===this._state&&this._setState(4)}_fireResult(){if(1===this._state||2===this._state)return;const t=0===this._state,i=4===this._state;this._onResult.fire(new eX(this._result.slice(0),t,i))}start(t){if(0===t)0===this._state&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation()}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class nX{constructor(t,i,e,s){this.priority=t,this.range=i,this.initialMousePosX=e,this.initialMousePosY=s,this.type=1}equals(t){return 1===t.type&&this.range.equalsRange(t.range)}canAdoptVisibleHover(t,i){return 1===t.type&&i.lineNumber===this.range.startLineNumber}}class rX{constructor(t,i,e,s,n,r){this.priority=t,this.owner=i,this.range=e,this.initialMousePosX=s,this.initialMousePosY=n,this.supportsMarkerHover=r,this.type=2}equals(t){return 2===t.type&&this.owner===t.owner}canAdoptVisibleHover(t,i){return 2===t.type&&this.owner===t.owner}}const oX=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class hX{constructor(){let t;this._onDidWillResize=new ne,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ne,this.onDidResize=this._onDidResize.event,this._sashListener=new Ui,this._size=new ql(0,0),this._minSize=new ql(0,0),this._maxSize=new ql(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new AB(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new AB(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new AB(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:bB.North}),this._southSash=new AB(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:bB.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let i=0,e=0;this._sashListener.add(Xi.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)((()=>{void 0===t&&(this._onDidWillResize.fire(),t=this._size,i=0,e=0)}))),this._sashListener.add(Xi.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)((()=>{void 0!==t&&(t=void 0,i=0,e=0,this._onDidResize.fire({dimension:this._size,done:!0}))}))),this._sashListener.add(this._eastSash.onDidChange((s=>{t&&(e=s.currentX-s.startX,this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))}))),this._sashListener.add(this._westSash.onDidChange((s=>{t&&(e=-(s.currentX-s.startX),this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))}))),this._sashListener.add(this._northSash.onDidChange((s=>{t&&(i=-(s.currentY-s.startY),this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))}))),this._sashListener.add(this._southSash.onDidChange((s=>{t&&(i=s.currentY-s.startY,this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))}))),this._sashListener.add(Xi.any(this._eastSash.onDidReset,this._westSash.onDidReset)((()=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))),this._sashListener.add(Xi.any(this._northSash.onDidReset,this._southSash.onDidReset)((()=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))})))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(t,i,e,s){this._northSash.state=t?3:0,this._eastSash.state=i?3:0,this._southSash.state=e?3:0,this._westSash.state=s?3:0}layout(t=this.size.height,i=this.size.width){const{height:e,width:s}=this._minSize,{height:n,width:r}=this._maxSize;t=Math.max(e,Math.min(n,t)),i=Math.max(s,Math.min(r,i));const o=new ql(i,t);ql.equals(o,this._size)||(this.domNode.style.height=t+"px",this.domNode.style.width=i+"px",this._size=o,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(t){this._maxSize=t}get maxSize(){return this._maxSize}set minSize(t){this._minSize=t}get minSize(){return this._minSize}set preferredSize(t){this._preferredSize=t}get preferredSize(){return this._preferredSize}}class cX extends Ki{constructor(t,i=new ql(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new hX),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ql.lift(i),this._resizableNode.layout(i.height,i.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize((t=>{this._resize(new ql(t.dimension.width,t.dimension.height)),t.done&&(this._isResizing=!1)}))),this._register(this._resizableNode.onDidWillResize((()=>{this._isResizing=!0})))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var t;return(null===(t=this._contentPosition)||void 0===t?void 0:t.position)?vs.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(i&&e)return Zl(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=Zl(i);return Ul(i.ownerDocument.body).height-(s.top+e.top+e.height)-24}_findPositionPreference(t,i){var e,s;const n=Math.min(null!==(e=this._availableVerticalSpaceBelow(i))&&void 0!==e?e:1/0,t),r=Math.min(null!==(s=this._availableVerticalSpaceAbove(i))&&void 0!==s?s:1/0,t),o=Math.min(Math.max(r,n),t),h=Math.min(t,o);let c;return c=this._editor.getOption(60).above?h<=r?1:2:h<=n?2:1,1===c?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),c}_resize(t){this._resizableNode.layout(t.height,t.width)}}var lX,aX,uX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},dX=function(t,i){return function(e,s){i(e,s,t)}};const fX=Fa;let gX=lX=class extends Ki{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(vX,this._editor)),this._participants=[];for(const t of oX.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new yX(this._editor,this._participants),this._hoverOperation=this._register(new sX(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new pX(this._computer.anchor,i,t.isComplete))}))),this._register(Nl(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register(Ws.onDidChange((()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})))}get widget(){return this._widget}maybeShowAt(t){if(this._widget.isResizing)return!0;const i=[];for(const e of this._participants)if(e.suggestHoverAnchor){const s=e.suggestHoverAnchor(t);s&&i.push(s)}const e=t.target;if(6===e.type&&i.push(new nX(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new nX(0,e.range,t.event.posx,t.event.posy))}return 0===i.length?this._startShowingOrUpdateHover(null,0,0,!1,t):(i.sort(((t,i)=>i.priority-t.priority)),this._startShowingOrUpdateHover(i[0],0,0,!1,t))}startShowingAtRange(t,i,e,s){this._startShowingOrUpdateHover(new nX(0,t,void 0,void 0),i,e,s,null)}_startShowingOrUpdateHover(t,i,e,s,n){return this._widget.position&&this._currentResult?this._editor.getOption(60).sticky&&n&&this._widget.isMouseGettingCloser(n.event.posx,n.event.posy)?(t&&this._startHoverOperationIfNecessary(t,i,e,s,!0),!0):t?!(!t||!this._currentResult.anchor.equals(t))||(t.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(t)),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)):(this._setCurrentResult(null),!1):!!t&&(this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)}_startHoverOperationIfNecessary(t,i,e,s,n){this._computer.anchor&&this._computer.anchor.equals(t)||(this._hoverOperation.cancel(),this._computer.anchor=t,this._computer.shouldFocus=s,this._computer.source=e,this._computer.insistOnKeepingHoverVisible=n,this._hoverOperation.start(i))}_setCurrentResult(t){this._currentResult!==t&&(t&&0===t.messages.length&&(t=null),this._currentResult=t,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(t){return!!t&&this._widget.getDomNode().contains(t)}_addLoadingMessage(t){if(this._computer.anchor)for(const i of this._participants)if(i.createLoadingMessage){const e=i.createLoadingMessage(this._computer.anchor);if(e)return t.slice(0).concat([e])}return t}_withResult(t){if(this._widget.position&&this._currentResult&&this._currentResult.isComplete){if(!t.isComplete)return;if(this._computer.insistOnKeepingHoverVisible&&0===t.messages.length)return}this._setCurrentResult(t)}_renderMessages(t,i){const{showAtPosition:e,showAtSecondaryPosition:s,highlightRange:n}=lX.computeHoverRanges(this._editor,t.range,i),r=new Ui,o=r.add(new bX(this._keybindingService)),h=document.createDocumentFragment();let c=null;const l={fragment:h,statusBar:o,setColorPicker:t=>c=t,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:t=>this._widget.setMinimumDimensions(t),hide:()=>this.hide()};for(const t of this._participants){const e=i.filter((i=>i.owner===t));e.length>0&&r.add(t.renderHoverParts(l,e))}const a=i.some((t=>t.isBeforeContent));if(o.hasContent&&h.appendChild(o.hoverElement),h.hasChildNodes()){if(n){const t=this._editor.createDecorationsCollection();t.set([{range:n,options:lX._DECORATION_OPTIONS}]),r.add(zi((()=>{t.clear()})))}this._widget.showAt(h,new wX(c,e,s,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,a,t.initialMousePosX,t.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(t,i,e){let s=1;if(t.hasModel()){const e=t._getViewModel(),n=e.coordinatesConverter,r=n.convertModelRangeToViewRange(i),o=new vs(r.startLineNumber,e.getLineMinColumn(r.startLineNumber));s=n.convertViewPositionToModelPosition(o).column}const n=i.startLineNumber;let r=i.startColumn,o=e[0].range,h=null;for(const t of e)o=bs.plusRange(o,t.range),t.range.startLineNumber===n&&t.range.endLineNumber===n&&(r=Math.max(Math.min(r,t.range.startColumn),s)),t.forceShowAtRange&&(h=t.range);return{showAtPosition:h?h.getStartPosition():new vs(n,i.startColumn),showAtSecondaryPosition:h?h.getStartPosition():new vs(n,r),highlightRange:o}}focus(){this._widget.focus()}scrollUp(){this._widget.scrollUp()}scrollDown(){this._widget.scrollDown()}scrollLeft(){this._widget.scrollLeft()}scrollRight(){this._widget.scrollRight()}pageUp(){this._widget.pageUp()}pageDown(){this._widget.pageDown()}goToTop(){this._widget.goToTop()}goToBottom(){this._widget.goToBottom()}};gX._DECORATION_OPTIONS=aL.register({description:"content-hover-highlight",className:"hoverHighlight"}),gX=lX=uX([dX(1,io),dX(2,HC)],gX);class pX{constructor(t,i,e){this.anchor=t,this.messages=i,this.isComplete=e}filter(t){const i=this.messages.filter((i=>i.isValidForHoverAnchor(t)));return i.length===this.messages.length?this:new mX(this,this.anchor,i,this.isComplete)}}class mX extends pX{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class wX{constructor(t,i,e,s,n,r,o,h,c,l){this.colorPicker=t,this.showAtPosition=i,this.showAtSecondaryPosition=e,this.preferAbove=s,this.stoleFocus=n,this.source=r,this.isBeforeContent=o,this.initialMousePosX=h,this.initialMousePosY=c,this.disposables=l,this.closestMouseDistance=void 0}}let vX=aX=class extends cX{get isColorPickerVisible(){var t;return Boolean(null===(t=this._visibleData)||void 0===t?void 0:t.colorPicker)}get isVisibleFromKeyboard(){var t;return 1===(null===(t=this._visibleData)||void 0===t?void 0:t.source)}get isVisible(){var t;return null!==(t=this._hoverVisibleKey.get())&&void 0!==t&&t}get isFocused(){var t;return null!==(t=this._hoverFocusedKey.get())&&void 0!==t&&t}constructor(t,i,e,s,n){const r=t.getOption(66)+8,o=new ql(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new tX),this._minimumSize=o,this._hoverVisibleKey=PS.hoverVisible.bindTo(i),this._hoverFocusedKey=PS.hoverFocused.bindTo(i),xa(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange((()=>{this.isVisible&&this._updateMaxDimensions()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()})));const h=this._register(Sa(this._resizableNode.domNode));this._register(h.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(h.onDidBlur((()=>{this._hoverFocusedKey.set(!1)}))),this._setHoverData(void 0),this._editor.addContentWidget(this)}dispose(){var t;super.dispose(),null===(t=this._visibleData)||void 0===t||t.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return aX.ID}static _applyDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.width="number"==typeof i?`${i}px`:i,t.style.height=s}_setContentsDomNodeDimensions(t,i){return aX._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return aX._applyDimensions(this._hover.containerDomNode,t,i)}_setHoverWidgetDimensions(t,i){this._setContentsDomNodeDimensions(t,i),this._setContainerDomNodeDimensions(t,i),this._layoutContentWidget()}static _applyMaxDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.maxWidth="number"==typeof i?`${i}px`:i,t.style.maxHeight=s}_setHoverWidgetMaxDimensions(t,i){aX._applyMaxDimensions(this._hover.contentsDomNode,t,i),aX._applyMaxDimensions(this._hover.containerDomNode,t,i),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth","number"==typeof t?`${t}px`:t),this._layoutContentWidget()}_hasHorizontalScrollbar(){const t=this._hover.scrollbar.getScrollDimensions();return t.scrollWidth>t.width}_adjustContentsBottomPadding(){const t=this._hover.contentsDomNode,i=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;t.style.paddingBottom!==i&&(t.style.paddingBottom=i)}_setAdjustedHoverWidgetDimensions(t){this._setHoverWidgetMaxDimensions("none","none");const i=t.width,e=t.height;this._setHoverWidgetDimensions(i,e),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(i,e-10))}_updateResizableNodeMaxDimensions(){var t,i;const e=null!==(t=this._findMaximumRenderingWidth())&&void 0!==t?t:1/0,s=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._resizableNode.maxSize=new ql(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;aX._lastDimensions=new ql(t.width,t.height),this._setAdjustedHoverWidgetDimensions(t),this._resizableNode.layout(t.height,t.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),null===(e=null===(i=this._visibleData)||void 0===i?void 0:i.colorPicker)||void 0===e||e.layout()}_findAvailableSpaceVertically(){var t;const i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition;if(i)return 1===this._positionPreference?this._availableVerticalSpaceAbove(i):this._availableVerticalSpaceBelow(i)}_findMaximumRenderingHeight(){const t=this._findAvailableSpaceVertically();if(!t)return;let i=6;return Array.from(this._hover.contentsDomNode.children).forEach((t=>{i+=t.clientHeight})),this._hasHorizontalScrollbar()&&(i+=10),Math.min(t,i)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const t=Array.from(this._hover.contentsDomNode.children).some((t=>t.scrollWidth>t.clientWidth));return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),t}_findMaximumRenderingWidth(){if(this._editor&&this._editor.hasModel())return this._isHoverTextOverflowing()||this._hover.containerDomNode.clientWidth<(void 0===this._contentWidth?0:this._contentWidth-2)?Ul(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(t,i){if(!this._visibleData)return!1;if(void 0===this._visibleData.initialMousePosX||void 0===this._visibleData.initialMousePosY)return this._visibleData.initialMousePosX=t,this._visibleData.initialMousePosY=i,!1;const e=Zl(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=kX(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=kX(t,i,e.left,e.top,e.width,e.height);return!(s>this._visibleData.closestMouseDistance+4||(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,s),0))}_setHoverData(t){var i;null===(i=this._visibleData)||void 0===i||i.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!t),this._hover.containerDomNode.classList.toggle("hidden",!t)}_updateFont(){const{fontSize:t,lineHeight:i}=this._editor.getOption(50),e=this._hover.contentsDomNode;e.style.fontSize=`${t}px`,e.style.lineHeight=""+i/t,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_updateContent(t){const i=this._hover.contentsDomNode;i.style.paddingBottom="",i.textContent="",i.appendChild(t)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const t=Math.max(this._editor.getLayoutInfo().height/4,250,aX._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,aX._lastDimensions.width);this._setHoverWidgetMaxDimensions(i,t)}_render(t,i){this._setHoverData(i),this._updateFont(),this._updateContent(t),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var t;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[null!==(t=this._positionPreference)&&void 0!==t?t:1]}:null}showAt(t,i){var e,s,n,r;if(!this._editor||!this._editor.hasModel())return;this._render(t,i);const o=Xl(this._hover.containerDomNode);this._positionPreference=null!==(e=this._findPositionPreference(o,i.showAtPosition))&&void 0!==e?e:1,this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(s=i.colorPicker)||void 0===s||s.layout();const h=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&(c=!0===this._configurationService.getValue("accessibility.verbosity.hover")&&this._accessibilityService.isScreenReaderOptimized(),l=null!==(r=null===(n=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))||void 0===n?void 0:n.getAriaLabel())&&void 0!==r?r:"",c&&l?Q(0,"Inspect this in the accessible view with {0}.",l):c?Q(0,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):"");var c,l;h&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+h)}hide(){if(!this._visibleData)return;const t=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new ql(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}_removeConstraintsRenderNormally(){const t=this._editor.getLayoutInfo();this._resizableNode.layout(t.height,t.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(t){var i;const e=this._hover.containerDomNode,s=this._hover.contentsDomNode,n=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._setContainerDomNodeDimensions(Jl(e),Math.min(n,t)),this._setContentsDomNodeDimensions(Jl(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new ql(Math.max(this._minimumSize.width,t.width),Math.max(this._minimumSize.height,t.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const t=void 0===this._contentWidth?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new ql(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=Xl(i),s=Jl(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=Xl(i),s=Jl(i),this._contentWidth=s,this._updateMinimumWidth(),this._resizableNode.layout(e,s),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(e)),null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition){const t=Xl(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(t,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-30})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+30})}pageUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t-i})}pageDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t+i})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};vX.ID="editor.contrib.resizableContentHoverWidget",vX._lastDimensions=new ql(0,0),vX=aX=uX([dX(1,th),dX(2,rd),dX(3,Om),dX(4,HC)],vX);let bX=class extends Ki{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=fX("div.hover-row.status-bar"),this.actionsElement=xa(this.hoverElement,fX("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(iX.render(this.actionsElement,t,e))}append(t){const i=xa(this.actionsElement,t);return this._hasContent=!0,i}};bX=uX([dX(0,HC)],bX);class yX{get anchor(){return this._anchor}set anchor(t){this._anchor=t}get shouldFocus(){return this._shouldFocus}set shouldFocus(t){this._shouldFocus=t}get source(){return this._source}set source(t){this._source=t}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(t){this._insistOnKeepingHoverVisible=t}constructor(t,i){this._editor=t,this._participants=i,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(t,i){if(1!==i.type&&!i.supportsMarkerHover)return[];const e=t.getModel(),s=i.range.startLineNumber;if(s>e.getLineCount())return[];const n=e.getLineMaxColumn(s);return t.getLineDecorations(s).filter((t=>{if(t.options.isWholeLine)return!0;const e=t.range.startLineNumber===s?t.range.startColumn:1,r=t.range.endLineNumber===s?t.range.endColumn:n;if(t.options.showIfCollapsed){if(e>i.range.startColumn+1||i.range.endColumn-1>r)return!1}else if(e>i.range.startColumn||i.range.endColumn>r)return!1;return!0}))}computeAsync(t){const i=this._anchor;if(!this._editor.hasModel()||!i)return dc.EMPTY;const e=yX._getLineDecorations(this._editor,i);return dc.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):dc.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=yX._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return c(i)}}function kX(t,i,e,s,n,r){const o=s+r/2,h=Math.max(Math.abs(t-(e+n/2))-n/2,0),c=Math.max(Math.abs(i-o)-r/2,0);return Math.sqrt(h*h+c*c)}const CX=Fa;class SX extends Ki{constructor(t,i,e){super(),this._renderDisposeables=this._register(new Ui),this._editor=t,this._isVisible=!1,this._messages=[],this._hover=this._register(new tX),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new GZ({editor:this._editor},i,e)),this._computer=new xX(this._editor),this._hoverOperation=this._register(new sX(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{this._withResult(t.value)}))),this._register(this._editor.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return SX.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}startShowingAt(t){this._computer.lineNumber!==t&&(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(t){this._messages=t,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(t,i){this._renderDisposeables.clear();const e=document.createDocumentFragment();for(const t of i){const i=CX("div.hover-row.markdown-hover"),s=xa(i,CX("div.hover-contents")),n=this._renderDisposeables.add(this._markdownRenderer.render(t.value));s.appendChild(n.element),e.appendChild(i)}this._updateContents(e),this._showAt(t)}_updateContents(t){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._updateFont()}_showAt(t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),e=this._editor.getTopForLineNumber(t),s=this._editor.getScrollTop(),n=this._editor.getOption(66),r=e-s-(this._hover.containerDomNode.clientHeight-n)/2;this._hover.containerDomNode.style.left=`${i.glyphMarginLeft+i.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(r),0)}px`}}SX.ID="editor.contrib.modesGlyphHoverWidget";class xX{get lineNumber(){return this._lineNumber}set lineNumber(t){this._lineNumber=t}constructor(t){this._editor=t,this._lineNumber=-1}computeSync(){const t=t=>({value:t}),i=this._editor.getLineDecorations(this._lineNumber),e=[];if(!i)return e;for(const s of i){if(!s.options.glyphMarginClassName)continue;const i=s.options.glyphMarginHoverMessage;i&&!yI(i)&&e.push(...b(i).map(t))}return e}}class DX{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function EX(t,i,e,s){const n=t.ordered(i).map(((t,n)=>async function(t,i,e,s,n){try{const r=await Promise.resolve(t.provideHover(e,s,n));if(r&&function(t){return void 0!==t.range&&void 0!==t.contents&&t.contents&&t.contents.length>0}(r))return new DX(t,r,i)}catch(t){Fi(t)}}(t,n,i,e,s)));return dc.fromPromises(n).coalesce()}Qa("_executeHoverProvider",((t,i,e)=>function(t,i,e){return EX(t,i,e,fe.None).map((t=>t.hover)).toPromise()}(t.get(op).hoverProvider,i,e)));var AX=function(t,i){return function(e,s){i(e,s,t)}};const MX=Fa;class LX{constructor(t,i,e,s,n){this.owner=t,this.range=i,this.contents=e,this.isBeforeContent=s,this.ordinal=n}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let FX=class{constructor(t,i,e,s,n){this._editor=t,this._languageService=i,this._openerService=e,this._configurationService=s,this._languageFeaturesService=n,this.hoverOrdinal=3}createLoadingMessage(t){return new LX(this,t.range,[(new bI).appendText(Q(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];let o=1e3;const h=e.getLineLength(s),c=e.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(116),a=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let u=!1;l>=0&&h>l&&t.range.startColumn>=l&&(u=!0,r.push(new LX(this,t.range,[{value:Q(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,o++))),!u&&"number"==typeof a&&h>=a&&r.push(new LX(this,t.range,[{value:Q(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,o++));let d=!1;for(const e of i){const i=e.range.startLineNumber===s?e.range.startColumn:1,h=e.range.endLineNumber===s?e.range.endColumn:n,c=e.options.hoverMessage;if(!c||yI(c))continue;e.options.beforeContentClassName&&(d=!0);const l=new bs(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new LX(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return dc.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return dc.EMPTY;const n=new vs(t.range.startLineNumber,t.range.startColumn);return EX(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!yI(t.hover.contents))).map((i=>{const e=i.hover.range?bs.lift(i.hover.range):t.range;return new LX(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return TX(t,i,this._editor,this._languageService,this._openerService)}};function TX(t,i,e,s,n){i.sort(((t,i)=>t.ordinal-i.ordinal));const r=new Ui;for(const o of i)for(const i of o.contents){if(yI(i))continue;const o=MX("div.hover-row.markdown-hover"),h=xa(o,MX("div.hover-contents")),c=r.add(new GZ({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const l=r.add(c.render(i));h.appendChild(l.element),t.fragment.appendChild(o)}return r}FX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([AX(1,ud),AX(2,ZN),AX(3,rd),AX(4,op)],FX);var RX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},OX=function(t,i){return function(e,s){i(e,s,t)}};class _X{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let IX=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._dispoables=new Ui,this._markers=[],this._nextIdx=-1,hs.isUri(t)?this._resourceFilter=i=>i.toString()===t.toString():t&&(this._resourceFilter=t);const s=this._configService.getValue("problems.sortOrder"),n=(t,i)=>{let e=Gn(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?bs.compareRangesUsingStarts(t,i)||eB.compare(t.severity,i.severity):eB.compare(t.severity,i.severity)||bs.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:hs.isUri(t)?t:void 0,severities:eB.Error|eB.Warning|eB.Info}),"function"==typeof t&&(this._markers=this._markers.filter((t=>this._resourceFilter(t.resource)))),this._markers.sort(n)};r(),this._dispoables.add(i.onMarkerChanged((t=>{this._resourceFilter&&!t.some((t=>this._resourceFilter(t)))||(r(),this._nextIdx=-1,this._onDidChange.fire())})))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(t){return!this._resourceFilter&&!t||!(!this._resourceFilter||!t)&&this._resourceFilter(t)}get selected(){const t=this._markers[this._nextIdx];return t&&new _X(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let n=!1,r=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));r<0&&(r=s(this._markers,{resource:t.uri},((t,i)=>Gn(t.resource.toString(),i.resource.toString()))),r<0&&(r=~r));for(let e=r;e<this._markers.length;e++){let s=bs.lift(this._markers[e]);if(s.isEmpty()){const i=t.getWordAtPosition(s.getStartPosition());i&&(s=new bs(s.startLineNumber,i.startColumn,s.startLineNumber,i.endColumn))}if(i&&(s.containsPosition(i)||i.isBeforeOrEqual(s.getStartPosition()))){this._nextIdx=e,n=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}n||(this._nextIdx=e?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(t,i,e){if(0===this._markers.length)return!1;const s=this._nextIdx;return-1===this._nextIdx?this._initIdx(i,e,t):t?this._nextIdx=(this._nextIdx+1)%this._markers.length:t||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),s!==this._nextIdx}find(t,i){let e=this._markers.findIndex((i=>i.resource.toString()===t.toString()));if(!(e<0))for(;e<this._markers.length;e++)if(bs.containsPosition(this._markers[e],i))return new _X(this._markers[e],e+1,this._markers.length)}};IX=RX([OX(1,nB),OX(2,rd)],IX);const PX=eo("IMarkerNavigationService");let NX=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new Nt}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new IX(t,this._markerService,this._configService)}};var BX;NX=RX([OX(0,nB),OX(1,rd)],NX),gd(PX,NX,1),function(t){t.className=function(t){switch(t){case WF.Ignore:return"severity-ignore "+go.asClassName(xs.info);case WF.Info:return go.asClassName(xs.info);case WF.Warning:return go.asClassName(xs.warning);case WF.Error:return go.asClassName(xs.error);default:return""}}}(BX||(BX={}));var $X,WX=function(t,i){return function(e,s){i(e,s,t)}};class jX{constructor(t,i,e,s,n){this._openerService=s,this._labelService=n,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new Ui,this._editor=i;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Nl(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new fk(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),t.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll((t=>{r.style.left=`-${t.scrollLeft}px`,r.style.top=`-${t.scrollTop}px`}))),this._disposables.add(this._scrollable)}dispose(){Vi(this._disposables)}update(t){const{source:i,message:e,relatedInformation:s,code:n}=t;let r=((null==i?void 0:i.length)||0)+2;n&&(r+="string"==typeof n?n.length:n.value.length);const o=zn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Ol(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(t)),this._editor.applyFontInfo(this._messageBlock);let h=this._messageBlock;for(const t of o)h=document.createElement("div"),h.innerText=t,""===t&&(h.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(h);if(i||n){const t=document.createElement("span");if(t.classList.add("details"),h.appendChild(t),i){const e=document.createElement("span");e.innerText=i,e.classList.add("source"),t.appendChild(e)}if(n)if("string"==typeof n){const i=document.createElement("span");i.innerText=`(${n})`,i.classList.add("code"),t.appendChild(i)}else this._codeLink=Fa("a.code-link"),this._codeLink.setAttribute("href",`${n.target.toString()}`),this._codeLink.onclick=t=>{this._openerService.open(n.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()},xa(this._codeLink,Fa("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Ol(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),u(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(66))}px`,this._lines+=1;for(const i of s){const e=document.createElement("div"),s=document.createElement("a");s.classList.add("filename"),s.innerText=`${this._labelService.getUriBasenameLabel(i.resource)}(${i.startLineNumber}, ${i.startColumn}): `,s.title=this._labelService.getUriLabel(i.resource),this._relatedDiagnostics.set(s,i);const n=document.createElement("span");n.innerText=i.message,e.appendChild(s),e.appendChild(n),this._lines+=1,t.appendChild(e)}}const c=this._editor.getOption(50),l=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:l,scrollHeight:c.lineHeight*this._lines})}layout(t,i){this._scrollable.getDomNode().style.height=`${t}px`,this._scrollable.getDomNode().style.width=`${i}px`,this._scrollable.setScrollDimensions({width:i,height:t})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(t){let i="";switch(t.severity){case eB.Error:i=Q(0,"Error");break;case eB.Warning:i=Q(0,"Warning");break;case eB.Info:i=Q(0,"Info");break;case eB.Hint:i=Q(0,"Hint")}let e=Q(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const s=this._editor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1&&(e=`${s.getLineContent(t.startLineNumber)}, ${e}`),e}}let VX=$X=class extends VQ{constructor(t,i,e,s,n,r,o){super(t,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},n),this._themeService=i,this._openerService=e,this._menuService=s,this._contextKeyService=r,this._labelService=o,this._callOnDispose=new Ui,this._onDidSelectRelatedInformation=new ne,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=eB.Warning,this._backgroundColor=Gg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(YX);let i=KX,e=qX;this._severity===eB.Warning?(i=GX,e=ZX):this._severity===eB.Info&&(i=JX,e=QX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(zQ),secondaryHeadingColor:t.getColor(UQ)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(t){super._fillHead(t),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const i=[],e=this._menuService.createMenu($X.TitleMenu,this._contextKeyService);MN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=xa(t,Fa(""))}_fillBody(t){this._parentContainer=t,t.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),t.appendChild(this._container),this._message=new jX(this._container,this.editor,(t=>this._onDidSelectRelatedInformation.fire(t)),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(t,i,e){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const s=bs.lift(t),n=this.editor.getPosition(),r=n&&s.containsPosition(n)?n:s.getStartPosition();super.show(r,this.computeRequiredHeight());const o=this.editor.getModel();if(o){const t=Q(0,e>1?"{0} of {1} problems":"{0} of {1} problem",i,e);this.setTitle(eA(o.uri),t)}this._icon.className=`codicon ${BX.className(eB.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(t){this._container.classList.remove("stale"),this._message.update(t)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._heightInPixel=t,this._message.layout(t,i),this._container.style.height=`${t}px`}_onWidth(t){this._message.layout(this._heightInPixel,t)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};VX.TitleMenu=new Sh("gotoErrorTitleMenu"),VX=$X=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([WX(1,Nk),WX(2,ZN),WX(3,xh),WX(4,io),WX(5,th),WX(6,CO)],VX);const HX=Zb(Ww,jw),zX=Zb(Vw,Hw),UX=Zb(zw,Uw),KX=Jm("editorMarkerNavigationError.background",{dark:HX,light:HX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget error color.")),qX=Jm("editorMarkerNavigationError.headerBackground",{dark:Gb(KX,.1),light:Gb(KX,.1),hcDark:null,hcLight:null},Q(0,"Editor marker navigation widget error heading background.")),GX=Jm("editorMarkerNavigationWarning.background",{dark:zX,light:zX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget warning color.")),ZX=Jm("editorMarkerNavigationWarning.headerBackground",{dark:Gb(GX,.1),light:Gb(GX,.1),hcDark:"#0C141F",hcLight:Gb(GX,.2)},Q(0,"Editor marker navigation widget warning heading background.")),JX=Jm("editorMarkerNavigationInfo.background",{dark:UX,light:UX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget info color.")),QX=Jm("editorMarkerNavigationInfo.headerBackground",{dark:Gb(JX,.1),light:Gb(JX,.1),hcDark:null,hcLight:null},Q(0,"Editor marker navigation widget info heading background.")),YX=Jm("editorMarkerNavigation.background",{dark:qw,light:qw,hcDark:qw,hcLight:qw},Q(0,"Editor marker navigation widget background."));var XX,t0=function(t,i){return function(e,s){i(e,s,t)}};let i0=XX=class{static get(t){return t.getContribution(XX.ID)}constructor(t,i,e,s,n){this._markerNavigationService=i,this._contextKeyService=e,this._editorService=s,this._instantiationService=n,this._sessionDispoables=new Ui,this._editor=t,this._widgetVisible=r0.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(t){if(this._model&&this._model.matches(t))return this._model;let i=!1;return this._model&&(i=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(t),i&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(VX,this._editor),this._widget.onDidClose((()=>this.close()),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition((t=>{var i,e,s;(null===(i=this._model)||void 0===i?void 0:i.selected)&&bs.containsPosition(null===(e=this._model)||void 0===e?void 0:e.selected.marker,t.position)||null===(s=this._model)||void 0===s||s.resetIndex()}))),this._sessionDispoables.add(this._model.onDidChange((()=>{if(!this._widget||!this._widget.position||!this._model)return;const t=this._model.find(this._editor.getModel().uri,this._widget.position);t?this._widget.updateMarker(t.marker):this._widget.showStale()}))),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation((t=>{this._editorService.openCodeEditor({resource:t.resource,options:{pinned:!0,revealIfOpened:!0,selection:bs.lift(t).collapseToStart()}},this._editor),this.close(!1)}))),this._sessionDispoables.add(this._editor.onDidChangeModel((()=>this._cleanUp()))),this._model}close(t=!0){this._cleanUp(),t&&this._editor.focus()}showAtMarker(t){if(this._editor.hasModel()){const i=this._getOrCreateModel(this._editor.getModel().uri);i.resetIndex(),i.move(!0,this._editor.getModel(),new vs(t.startLineNumber,t.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}async nagivate(t,i){var e,s;if(this._editor.hasModel()){const n=this._getOrCreateModel(i?void 0:this._editor.getModel().uri);if(n.move(t,this._editor.getModel(),this._editor.getPosition()),!n.selected)return;if(n.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:n.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:n.selected.marker}},this._editor);r&&(null===(e=XX.get(r))||void 0===e||e.close(),null===(s=XX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}};i0.ID="editor.contrib.markerController",i0=XX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t0(1,PX),t0(2,th),t0(3,so),t0(4,io)],i0);class e0 extends Ga{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}async run(t,i){var e;i.hasModel()&&(null===(e=i0.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}}class s0 extends e0{constructor(){super(!0,!1,{id:s0.ID,label:s0.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:578,weight:100},menuOpts:{menuId:VX.TitleMenu,title:s0.LABEL,icon:AV("marker-navigation-next",xs.arrowDown,Q(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}s0.ID="editor.action.marker.next",s0.LABEL=Q(0,"Go to Next Problem (Error, Warning, Info)");class n0 extends e0{constructor(){super(!1,!1,{id:n0.ID,label:n0.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:1602,weight:100},menuOpts:{menuId:VX.TitleMenu,title:n0.LABEL,icon:AV("marker-navigation-previous",xs.arrowUp,Q(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}n0.ID="editor.action.marker.prev",n0.LABEL=Q(0,"Go to Previous Problem (Error, Warning, Info)"),iu(i0.ID,i0,4),Xa(s0),Xa(n0),Xa(class extends e0{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:Q(0,"Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:66,weight:100},menuOpts:{menuId:Sh.MenubarGoMenu,title:Q(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),Xa(class extends e0{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:Q(0,"Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:1090,weight:100},menuOpts:{menuId:Sh.MenubarGoMenu,title:Q(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const r0=new Xo("markersNavigationVisible",!1);Ya(new(qa.bindToContribution(i0.get))({id:"closeMarkersNavigation",precondition:r0,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:PS.focus,primary:9,secondary:[1033]}}));var o0=function(t,i){return function(e,s){i(e,s,t)}};const h0=Fa;class c0{constructor(t,i,e){this.owner=t,this.range=i,this.marker=e}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}const l0={type:1,filter:{include:yZ.QuickFix},triggerAction:kZ.QuickFixHover};let a0=class{constructor(t,i,e,s){this._editor=t,this._markerDecorationsService=i,this._openerService=e,this._languageFeaturesService=s,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type&&!t.supportsMarkerHover)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];for(const o of i){const i=o.range.startLineNumber===s?o.range.startColumn:1,h=o.range.endLineNumber===s?o.range.endColumn:n,c=this._markerDecorationsService.getMarker(e.uri,o);if(!c)continue;const l=new bs(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new c0(this,l,c))}return r}renderHoverParts(t,i){if(!i.length)return Ki.None;const e=new Ui;i.forEach((i=>t.fragment.appendChild(this.renderMarkerHover(i,e))));const s=1===i.length?i[0]:i.sort(((t,i)=>eB.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=h0("div.hover-row"),s=xa(e,h0("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=xa(s,h0("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=h0("span");n&&(xa(t,h0("span")).innerText=n);const e=xa(t,h0("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Il(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),xa(e,h0("span")).innerText=o.value;const r=xa(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=xa(s,h0("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(u(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=xa(s,h0("div"));o.style.marginTop="8px";const h=xa(o,h0("a"));h.innerText=`${eA(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Il(h,"click",(t=>{t.stopPropagation(),t.preventDefault(),this._openerService&&this._openerService.open(e,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:n,startColumn:r}}}).catch(Li)})));const c=xa(o,h0("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,e){if(i.marker.severity!==eB.Error&&i.marker.severity!==eB.Warning&&i.marker.severity!==eB.Info||t.statusBar.addAction({label:Q(0,"View Problem"),commandId:s0.ID,run:()=>{var e;t.hide(),null===(e=i0.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(h0("div"));this.recentMarkerCodeActionsInfo&&(sB.makeKey(this.recentMarkerCodeActionsInfo.marker)===sB.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(s.textContent=Q(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Ki.None:e.add(ic((()=>s.textContent=Q(0,"Checking for quick fixes...")),200));s.textContent||(s.textContent=String.fromCharCode(160));const r=this.getCodeActions(i.marker);e.add(zi((()=>r.cancel()))),r.then((r=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:r.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return r.dispose(),void(s.textContent=Q(0,"No quick fixes available"));s.style.display="none";let o=!1;e.add(zi((()=>{o||r.dispose()}))),t.statusBar.addAction({label:Q(0,"Quick Fix..."),commandId:EZ,run:i=>{o=!0;const e=xJ.get(this._editor),s=Zl(i);t.hide(),null==e||e.showCodeActions(l0,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Li)}}getCodeActions(t){return Zh((i=>_Z(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new bs(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),l0,xO.None,i)))}};a0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([o0(1,Dm),o0(2,ZN),o0(3,op)],a0);const u0="editor.action.inlineSuggest.commit",d0="editor.action.inlineSuggest.showPrevious",f0="editor.action.inlineSuggest.showNext";var g0,p0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},m0=function(t,i){return function(e,s){i(e,s,t)}};let w0=class extends Ki{constructor(t,i,e){super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=Tz(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(62).showToolbar)),this.sessionPosition=void 0,this.position=bz(this,(t=>{var i,e,s;const n=null===(i=this.model.read(t))||void 0===i?void 0:i.ghostText.read(t);if(!this.alwaysShowToolbar.read(t)||!n||0===n.parts.length)return this.sessionPosition=void 0,null;const r=n.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==n.lineNumber&&(this.sessionPosition=void 0);const o=new vs(n.lineNumber,Math.min(r,null!==(s=null===(e=this.sessionPosition)||void 0===e?void 0:e.column)&&void 0!==s?s:Number.MAX_SAFE_INTEGER));return this.sessionPosition=o,o})),this._register(Az(((i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(y0,this.editor,!0,this.position,s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]}))));t.addContentWidget(n),e.add(zi((()=>t.removeContentWidget(n)))),e.add(xz((t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Fs.Explicit&&s.triggerExplicitly()})))})))}};w0=p0([m0(2,io)],w0);const v0=AV("inline-suggestion-hints-next",xs.chevronRight,Q(0,"Icon for show next parameter hint.")),b0=AV("inline-suggestion-hints-previous",xs.chevronLeft,Q(0,"Icon for show previous parameter hint."));let y0=g0=class extends Ki{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new oo(t,i,e,!0,(()=>this._commandService.executeCommand(t))),n=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let r=i;return n&&(r=Q(0,"{0} ({1})",i,n.getLabel())),s.tooltip=r,s}constructor(t,i,s,n,r,o,h,c,l,a,u){super(),this.editor=t,this.withBorder=i,this._position=s,this._currentSuggestionIdx=n,this._suggestionCount=r,this._extraCommands=o,this._commandService=h,this.keybindingService=l,this._contextKeyService=a,this._menuService=u,this.id="InlineSuggestionHintsContentWidget"+g0.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Va("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Va("div@toolBar")]),this.previousAction=this.createCommandAction(d0,Q(0,"Previous"),go.asClassName(b0)),this.availableSuggestionCountAction=new oo("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(f0,Q(0,"Next"),go.asClassName(v0)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Sh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new rc((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new rc((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(S0,this.nodes.toolBar,Sh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof Mh)return c.createInstance(C0,t,void 0);if(t===this.availableSuggestionCountAction){const i=new k0(void 0,t,{label:!0,icon:!1});return i.setClass("availableSuggestionCount"),i}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility((t=>{g0._dropDownVisible=t}))),this._register(xz((t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(xz((t=>{const i=this._suggestionCount.read(t),e=this._currentSuggestionIdx.read(t);void 0!==i?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${e+1}/${i}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),void 0!==i&&i>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()}))),this._register(xz((t=>{const i=this._extraCommands.read(t);if(e(this.lastCommands,i))return;this.lastCommands=i;const s=i.map((t=>({class:void 0,id:t.id,enabled:!0,tooltip:t.tooltip||"",label:t.title,run:()=>this._commandService.executeCommand(t.id)})));for(const[t,i]of this.inlineCompletionsActionsMenus.getActions())for(const t of i)t instanceof Mh&&s.push(t);s.length>0&&s.unshift(new co),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};y0._dropDownVisible=!1,y0.id=0,y0=g0=p0([m0(6,po),m0(7,io),m0(8,HC),m0(9,th),m0(10,xh)],y0);class k0 extends tN{constructor(){super(...arguments),this._className=void 0}setClass(t){this._className=t}render(t){super.render(t),this._className&&t.classList.add(this._className)}}class C0 extends FN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Va("div.keybinding").root;new Pj(i,Et,{disableTitle:!0,...Ij}).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let S0=class extends RK{constructor(t,i,e,s,n,r,o,h){super(t,{resetMenu:i,...e},s,n,r,o,h),this.menuId=i,this.options2=e,this.menuService=s,this.contextKeyService=n,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];MN(this.menu,null===(t=this.options2)||void 0===t?void 0:t.menuOptions,{primary:h,secondary:c},null===(e=null===(i=this.options2)||void 0===i?void 0:i.toolbarOptions)||void 0===e?void 0:e.primaryGroup,null===(n=null===(s=this.options2)||void 0===s?void 0:s.toolbarOptions)||void 0===n?void 0:n.shouldInlineSubmenu,null===(o=null===(r=this.options2)||void 0===r?void 0:r.toolbarOptions)||void 0===o?void 0:o.useSeparatorsInPrimaryActions),c.push(...this.additionalActions),h.unshift(...this.prependedPrimaryActions),this.setActions(h,c)}setPrependedPrimaryActions(t){e(this.prependedPrimaryActions,t,((t,i)=>t===i))||(this.prependedPrimaryActions=t,this.updateToolbar())}setAdditionalSecondaryActions(t){e(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};S0=p0([m0(3,xh),m0(4,th),m0(5,qO),m0(6,HC),m0(7,Th)],S0);var x0,D0=function(t,i){return function(e,s){i(e,s,t)}};let E0=x0=class extends Ki{static get(t){return t.getContribution(x0.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Ui,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new rc((()=>this._reactToEditorMouseMove(this._mouseMoveEvent)),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())})))}_hookEvents(){const t=this._editor.getOption(60);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,this._hidingDelay=t.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._toUnhook.add(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))):(this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))),this._toUnhook.add(this._editor.onMouseLeave((t=>this._onEditorMouseLeave(t)))),this._toUnhook.add(this._editor.onDidChangeModel((()=>{this._cancelScheduler(),this._hideWidgets()}))),this._toUnhook.add(this._editor.onDidChangeModelContent((()=>this._cancelScheduler()))),this._toUnhook.add(this._editor.onDidScrollChange((t=>this._onEditorScrollChanged(t))))}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(t){(t.scrollTopChanged||t.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(t){var i;this._isMouseDown=!0;const e=t.target;9!==e.type||e.detail!==vX.ID?12===e.type&&e.detail===SX.ID||(12!==e.type&&(this._hoverClicked=!1),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i,e;this._cancelScheduler(),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||(null===(e=this._contentWidget)||void 0===e?void 0:e.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_isMouseOverWidget(t){var i,e,s,n,r;const o=t.target;return!((!this._isHoverSticky||9!==o.type||o.detail!==vX.ID)&&(!this._isHoverSticky||!(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(null===(e=t.event.browserEvent.view)||void 0===e?void 0:e.document.activeElement))||(null===(n=null===(s=t.event.browserEvent.view)||void 0===s?void 0:s.getSelection())||void 0===n?void 0:n.isCollapsed))&&(this._isHoverSticky||9!==o.type||o.detail!==vX.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==SX.ID))}_onEditorMouseMove(t){var i,e,s,n;this._mouseMoveEvent=t,(null===(i=this._contentWidget)||void 0===i?void 0:i.isFocused)||(null===(e=this._contentWidget)||void 0===e?void 0:e.isResizing)||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(null===(s=this._contentWidget)||void 0===s?void 0:s.isVisibleFromKeyboard)||(this._isMouseOverWidget(t)?this._reactToEditorMouseMoveRunner.cancel():(null===(n=this._contentWidget)||void 0===n?void 0:n.isVisible)&&this._isHoverSticky&&this._hidingDelay>0?this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay):this._reactToEditorMouseMove(t))}_reactToEditorMouseMove(t){var i,e,s;if(!t)return;const n=t.target,r=null===(i=n.element)||void 0===i?void 0:i.classList.contains("colorpicker-color-decoration"),o=this._editor.getOption(146);if((!r||("click"!==o||this._hoverActivatedByColorDecoratorClick)&&("hover"!==o||this._isHoverEnabled)&&("clickAndHover"!==o||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))&&(r||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(e=this._glyphWidget)||void 0===e||e.hide()):2===n.type&&n.position?(null===(s=this._contentWidget)||void 0===s||s.hide(),this._glyphWidget||(this._glyphWidget=new SX(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(n.position.lineNumber)):void this._hideWidgets();this._hideWidgets()}_onKeyDown(t){var i;if(!this._editor.hasModel())return;const e=this._keybindingService.softDispatch(t,this._editor.getDomNode()),s=1===e.kind||2===e.kind&&"editor.action.showHover"===e.commandId&&(null===(i=this._contentWidget)||void 0===i?void 0:i.isVisible);5===t.keyCode||6===t.keyCode||57===t.keyCode||4===t.keyCode||s||this._hideWidgets()}_hideWidgets(){var t,i,e;this._isMouseDown&&this._hoverClicked&&(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible)||y0.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,null===(i=this._glyphWidget)||void 0===i||i.hide(),null===(e=this._contentWidget)||void 0===e||e.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(gX,this._editor)),this._contentWidget}showContentHover(t,i,e,s,n=!1){this._hoverActivatedByColorDecoratorClick=n,this._getOrCreateContentWidget().startShowingAtRange(t,i,e,s)}focus(){var t;null===(t=this._contentWidget)||void 0===t||t.focus()}scrollUp(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollUp()}scrollDown(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollDown()}scrollLeft(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollLeft()}scrollRight(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollRight()}pageUp(){var t;null===(t=this._contentWidget)||void 0===t||t.pageUp()}pageDown(){var t;null===(t=this._contentWidget)||void 0===t||t.pageDown()}goToTop(){var t;null===(t=this._contentWidget)||void 0===t||t.goToTop()}goToBottom(){var t;null===(t=this._contentWidget)||void 0===t||t.goToBottom()}get isColorPickerVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible}get isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible}dispose(){var t,i;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};var A0;E0.ID="editor.contrib.hover",E0=x0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D0(1,io),D0(2,ZN),D0(3,ud),D0(4,HC)],E0),function(t){t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately"}(A0||(A0={})),iu(E0.ID,E0,2),Xa(class extends Ga{constructor(){super({id:"editor.action.showHover",label:Q(0,"Show or Focus Hover"),metadata:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[A0.NoAutoFocus,A0.FocusIfVisible,A0.AutoFocusImmediately],enumDescriptions:[Q(0,"The hover will not automatically take focus."),Q(0,"The hover will take focus only if it is already visible."),Q(0,"The hover will automatically take focus when it appears.")],default:A0.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=E0.get(i);if(!s)return;const n=null==e?void 0:e.focus;let r=A0.FocusIfVisible;n in A0?r=n:"boolean"==typeof n&&n&&(r=A0.AutoFocusImmediately);const o=t=>{const e=i.getPosition(),n=new bs(e.lineNumber,e.column,e.lineNumber,e.column);s.showContentHover(n,1,1,t)},h=2===i.getOption(2);s.isHoverVisible?r!==A0.NoAutoFocus?s.focus():o(h):o(h||r===A0.AutoFocusImmediately)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:Q(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=E0.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new bs(s.lineNumber,s.column,s.lineNumber,s.column),r=YY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollUpHover",label:Q(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollUp()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollDownHover",label:Q(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollDown()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollLeftHover",label:Q(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollLeft()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollRightHover",label:Q(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollRight()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pageUpHover",label:Q(0,"Page Up Hover"),alias:"Page Up Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=E0.get(i);e&&e.pageUp()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pageDownHover",label:Q(0,"Page Down Hover"),alias:"Page Down Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=E0.get(i);e&&e.pageDown()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToTopHover",label:Q(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=E0.get(i);e&&e.goToTop()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToBottomHover",label:Q(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=E0.get(i);e&&e.goToBottom()}}),oX.register(FX),oX.register(a0),Vk(((t,i)=>{const e=t.getColor(bv);e&&(i.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${e.transparent(.5)}; }`))}));class M0 extends Ki{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=this._editor.getOption(146);if("click"!==i&&"clickAndHover"!==i)return;const e=t.target;if(6!==e.type)return;if(!e.detail.injectedText)return;if(e.detail.injectedText.options.attachedData!==YJ)return;if(!e.range)return;const s=this._editor.getContribution(E0.ID);if(s&&!s.isColorPickerVisible){const t=new bs(e.range.startLineNumber,e.range.startColumn+1,e.range.endLineNumber,e.range.endColumn+1);s.showContentHover(t,1,0,!1,!0)}}}M0.ID="editor.contrib.colorContribution",iu(M0.ID,M0,2),oX.register(pQ);var L0,F0,T0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},R0=function(t,i){return function(e,s){i(e,s,t)}};let O0=L0=class extends Ki{constructor(t,i,e,s,n,r,o){super(),this._editor=t,this._modelService=e,this._keybindingService=s,this._instantiationService=n,this._languageFeatureService=r,this._languageConfigurationService=o,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=PS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=PS.standaloneColorPickerFocused.bindTo(i)}showOrFocus(){var t;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||null===(t=this._standaloneColorPickerWidget)||void 0===t||t.focus():this._standaloneColorPickerWidget=new _0(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var t;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),null===(t=this._standaloneColorPickerWidget)||void 0===t||t.hide(),this._editor.focus()}insertColor(){var t;null===(t=this._standaloneColorPickerWidget)||void 0===t||t.updateEditor(),this.hide()}static get(t){return t.getContribution(L0.ID)}};O0.ID="editor.contrib.standaloneColorPickerController",O0=L0=T0([R0(1,th),R0(2,no),R0(3,HC),R0(4,io),R0(5,op),R0(6,Nd)],O0),iu(O0.ID,O0,1);let _0=F0=class extends Ki{constructor(t,i,e,s,n,r,o,h){var c;super(),this._editor=t,this._standaloneColorPickerVisible=i,this._standaloneColorPickerFocused=e,this._modelService=n,this._keybindingService=r,this._languageFeaturesService=o,this._languageConfigurationService=h,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ne),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(wQ,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),a=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Sa(this._body));this._register(u.onDidBlur((()=>{this.hide()}))),this._register(u.onDidFocus((()=>{this.focus()}))),this._register(this._editor.onDidChangeCursorPosition((()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()}))),this._register(this._editor.onMouseMove((t=>{var i;const e=null===(i=t.target.element)||void 0===i?void 0:i.classList;e&&e.contains("colorpicker-color-decoration")&&this.hide()}))),this._register(this.onResult((t=>{this._render(t.value,t.foundInEditor)}))),this._start(a),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return F0.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:t?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(t){const i=await this._computeAsync(t);i&&this._onResult.fire(new I0(i.result,i.foundInEditor))}async _computeAsync(t){if(!this._editor.hasModel())return null;const i={range:t,color:{red:0,green:0,blue:0,alpha:1}},e=await this._standaloneColorPickerParticipant.createColorHover(i,new jJ(this._modelService,this._languageConfigurationService),this._languageFeaturesService.colorProvider);return e?{result:e.colorHover,foundInEditor:e.foundInEditor}:null}_render(t,i){const e=document.createDocumentFragment();let s;const n={fragment:e,statusBar:this._register(new bX(this._keybindingService)),setColorPicker:t=>s=t,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=t,this._register(this._standaloneColorPickerParticipant.renderHoverParts(n,[t])),void 0===s)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(.66*this._editor.getLayoutInfo().width,500)+"px",this._body.tabIndex=0,this._body.appendChild(e),s.layout();const r=s.body,o=r.saturationBox.domNode.clientWidth,h=r.domNode.clientWidth-o-22-8,c=s.body.enterButton;null==c||c.onClicked((()=>{this.updateEditor(),this.hide()}));const l=s.header;l.pickedColorNode.style.width=o+8+"px",l.originalColorNode.style.width=h+"px";const a=s.header.closeButton;null==a||a.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};_0.ID="editor.contrib.standaloneColorPickerWidget",_0=F0=T0([R0(3,io),R0(4,no),R0(5,HC),R0(6,op),R0(7,Nd)],_0);class I0{constructor(t,i){this.value=t,this.foundInEditor=i}}Xa(class extends Ga{constructor(){super({id:"editor.action.hideColorPicker",label:Q(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:PS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=O0.get(i))||void 0===e||e.hide()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:Q(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:PS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=O0.get(i))||void 0===e||e.insertColor()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:Q(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:Q(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:Sh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=O0.get(i))||void 0===e||e.showOrFocus()}});class P0{constructor(t,i,e){this.languageConfigurationService=e,this._selection=t,this._insertSpace=i,this._usedEndToken=null}static _haystackHasNeedleAtOffset(t,i,e){if(e<0)return!1;const s=i.length;if(e+s>t.length)return!1;for(let n=0;n<s;n++){const s=t.charCodeAt(e+n),r=i.charCodeAt(n);if(s!==r&&!(s>=65&&s<=90&&s+32===r||r>=65&&r<=90&&r+32===s))return!1}return!0}_createOperationsForBlockComment(t,i,e,s,n,r){const o=t.startLineNumber,h=t.startColumn,c=t.endLineNumber,l=t.endColumn,a=n.getLineContent(o),u=n.getLineContent(c);let d,f=a.lastIndexOf(i,h-1+i.length),g=u.indexOf(e,l-1-e.length);if(-1!==f&&-1!==g)if(o===c)a.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=a.substring(f+i.length),s=u.substring(0,g);(t.indexOf(e)>=0||s.indexOf(e)>=0)&&(f=-1,g=-1)}-1!==f&&-1!==g?(s&&f+i.length<a.length&&32===a.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===u.charCodeAt(g-1)&&(e=" "+e,g-=1),d=P0._createRemoveBlockCommentOperations(new bs(o,f+i.length+1,c,g+1),i,e)):(d=P0._createAddBlockCommentOperations(t,i,e,this._insertSpace),this._usedEndToken=1===d.length?e:null);for(const t of d)r.addTrackedEditOperation(t.range,t.text)}static _createRemoveBlockCommentOperations(t,i,e){const s=[];return bs.isEmpty(t)?s.push(QR.delete(new bs(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(QR.delete(new bs(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(QR.delete(new bs(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return bs.isEmpty(t)?n.push(QR.replace(new bs(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(QR.insert(new vs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(QR.insert(new vs(t.endLineNumber,t.endColumn),(s?" ":"")+e))),n}getEditOperations(t,i){const e=this._selection.startLineNumber,s=this._selection.startColumn;t.tokenization.tokenizeIfCheap(e);const n=t.getLanguageIdAtPosition(e,s),r=this.languageConfigurationService.getLanguageConfiguration(n).comments;r&&r.blockCommentStartToken&&r.blockCommentEndToken&&this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,t,i)}computeCursorState(t,i){const e=i.getInverseEditOperations();if(2===e.length){const t=e[0],i=e[1];return new ys(t.range.endLineNumber,t.range.endColumn,i.range.startLineNumber,i.range.startColumn)}{const t=e[0].range,i=this._usedEndToken?-this._usedEndToken.length-1:0;return new ys(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class N0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,a=s.length;h<a;h++){const a=s[h],u=n+h;if(u===n&&o){a.ignore=!0;continue}const d=e.getLineContent(u),f=Un(d);if(-1!==f){if(l=!1,a.ignore=!1,a.commentStrOffset=f,c&&!P0._haystackHasNeedleAtOffset(d,a.commentStr,f)&&(0===t?c=!1:1===t||(a.ignore=!0)),c&&i){const t=f+a.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(a.commentStrLength+=1)}}else a.ignore=r,a.commentStrOffset=d.length}if(0===t&&l){c=!1;for(let t=0,i=s.length;t<i;t++)s[t].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:s}}static _gatherPreflightData(t,i,e,s,n,r,o,h){const c=N0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:N0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=N0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(N0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new vs(s.positionLineNumber,s.positionColumn);for(let e=0,s=n.length;e<s;e++)i.addEditOperation(n[e].range,n[e].text),bs.isEmpty(n[e].range)&&bs.getStartPosition(n[e].range).equals(r)&&t.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(n[e].text||"").length);this._selectionId=i.trackSelection(s)}_attemptRemoveBlockComment(t,i,e,s){let n=i.startLineNumber,r=i.endLineNumber;const o=s.length+Math.max(t.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.startColumn);let h=t.getLineContent(n).lastIndexOf(e,o-1),c=t.getLineContent(r).indexOf(s,i.endColumn-1-e.length);return-1!==h&&-1===c&&(c=t.getLineContent(n).indexOf(s,h+e.length),r=n),-1===h&&-1!==c&&(h=t.getLineContent(r).lastIndexOf(e,c),n=r),!i.isEmpty()||-1!==h&&-1!==c||(h=t.getLineContent(n).indexOf(e),-1!==h&&(c=t.getLineContent(n).indexOf(s,h+e.length))),-1!==h&&32===t.getLineContent(n).charCodeAt(h+e.length)&&(e+=" "),-1!==c&&32===t.getLineContent(r).charCodeAt(c-1)&&(s=" "+s,c-=1),-1!==h&&-1!==c?P0._createRemoveBlockCommentOperations(new bs(n,h+e.length+1,r,c+1),e,s):null}_executeBlockComment(t,i,e){t.tokenization.tokenizeIfCheap(e.startLineNumber);const s=t.getLanguageIdAtPosition(e.startLineNumber,1),n=this.languageConfigurationService.getLanguageConfiguration(s).comments;if(!n||!n.blockCommentStartToken||!n.blockCommentEndToken)return;const r=n.blockCommentStartToken,o=n.blockCommentEndToken;let h=this._attemptRemoveBlockComment(t,e,r,o);if(!h){if(e.isEmpty()){const i=t.getLineContent(e.startLineNumber);let s=Un(i);-1===s&&(s=i.length),h=P0._createAddBlockCommentOperations(new bs(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=P0._createAddBlockCommentOperations(new bs(e.startLineNumber,t.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.endLineNumber,t.getLineMaxColumn(e.endLineNumber)),r,o,this._insertSpace);1===h.length&&(this._deltaColumn=r.length+1)}this._selectionId=i.trackSelection(e);for(const t of h)i.addEditOperation(t.range,t.text)}getEditOperations(t,i){let e=this._selection;if(this._moveEndPositionDown=!1,e.startLineNumber===e.endLineNumber&&this._ignoreFirstLine)return i.addEditOperation(new bs(e.startLineNumber,t.getLineMaxColumn(e.startLineNumber),e.startLineNumber+1,1),e.startLineNumber===t.getLineCount()?"":"\n"),void(this._selectionId=i.trackSelection(e));e.startLineNumber<e.endLineNumber&&1===e.endColumn&&(this._moveEndPositionDown=!0,e=e.setEndPosition(e.endLineNumber-1,t.getLineMaxColumn(e.endLineNumber-1)));const s=N0._gatherPreflightData(this._type,this._insertSpace,t,e.startLineNumber,e.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return s.supported?this._executeLineComments(t,i,s,e):this._executeBlockComment(t,i,e)}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),new ys(e.selectionStartLineNumber,e.selectionStartColumn+this._deltaColumn,e.positionLineNumber,e.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(t,i){const e=[];for(let s=0,n=t.length;s<n;s++){const n=t[s];n.ignore||e.push(QR.delete(new bs(i+s,n.commentStrOffset+1,i+s,n.commentStrOffset+n.commentStrLength+1)))}return e}_createAddLineCommentsOperations(t,i){const e=[],s=this._insertSpace?" ":"";for(let n=0,r=t.length;n<r;n++){const r=t[n];r.ignore||e.push(QR.insert(new vs(i+n,r.commentStrOffset+1),r.commentStr+s))}return e}static nextVisibleColumn(t,i,e,s){return e?t+(i-t%i):t+s}static _normalizeInsertionPoint(t,i,e,s){let n,r,o=1073741824;for(let n=0,r=i.length;n<r;n++){if(i[n].ignore)continue;const r=t.getLineContent(e+n);let h=0;for(let t=0,e=i[n].commentStrOffset;h<o&&t<e;t++)h=N0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=N0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class B0 extends Ga{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(Nd);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(23),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));let h=o[0];for(let t=1;t<o.length;t++){const i=o[t];h.selection.endLineNumber===i.selection.startLineNumber&&(h.index<i.index?i.ignoreFirstLine=!0:(h.ignoreFirstLine=!0,h=i))}for(const t of o)s.push(new N0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}Xa(class extends B0{constructor(){super(0,{id:"editor.action.commentLine",label:Q(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"5_insert",title:Q(0,"&&Toggle Line Comment"),order:1}})}}),Xa(class extends B0{constructor(){super(1,{id:"editor.action.addCommentLine",label:Q(0,"Add Line Comment"),alias:"Add Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2081),weight:100}})}}),Xa(class extends B0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:Q(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2099),weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.blockComment",label:Q(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"5_insert",title:Q(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(Nd);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new P0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var $0,W0=function(t,i){return function(e,s){i(e,s,t)}};let j0=$0=class{static get(t){return t.getContribution($0.ID)}constructor(t,i,e,s,n,r,o,h){this._contextMenuService=i,this._contextViewService=e,this._contextKeyService=s,this._keybindingService=n,this._menuService=r,this._configurationService=o,this._workspaceContextService=h,this._toDispose=new Ui,this._contextMenuIsBeingShownCount=0,this._editor=t,this._toDispose.add(this._editor.onContextMenu((t=>this._onContextMenu(t)))),this._toDispose.add(this._editor.onMouseWheel((t=>{if(this._contextMenuIsBeingShownCount>0){const i=this._contextViewService.getContextViewElement(),e=t.srcElement;e.shadowRoot&&na(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(24)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(24))return this._editor.focus(),void(t.target.position&&!this._editor.getSelection().containsPosition(t.target.position)&&this._editor.setPosition(t.target.position));if(12===t.target.type)return;if(6===t.target.type&&t.target.detail.injectedText)return;if(t.event.preventDefault(),t.event.stopPropagation(),11===t.target.type)return this._showScrollbarContextMenu(t.event);if(6!==t.target.type&&7!==t.target.type&&1!==t.target.type)return;if(this._editor.focus(),t.target.position){let i=!1;for(const e of this._editor.getSelections())if(e.containsPosition(t.target.position)){i=!0;break}i||this._editor.setPosition(t.target.position)}let i=null;1!==t.target.type&&(i=t.event),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(24))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?Sh.SimpleEditorContext:Sh.EditorContext);i.length>0&&this._doShowContextMenu(i,t)}_getMenuActions(t,i){const e=[],s=this._menuService.createMenu(i,this._contextKeyService),n=s.getActions({arg:t.uri});s.dispose();for(const i of n){const[,s]=i;let n=0;for(const i of s)if(i instanceof Ah){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new lo(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new co)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let s=i;if(!s){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),i=Zl(this._editor.getDomNode());s={x:i.left+t.left,y:i.top+t.top+t.height}}const n=this._editor.getOption(126)&&!yt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getDomNode():void 0,getAnchor:()=>s,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new tN(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new tN(t,t,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:t=>this._keybindingFor(t),onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:e})}})}_showScrollbarContextMenu(t){if(!this._editor.hasModel())return;if(this._workspaceContextService.getWorkspace().id===PO)return;const i=this._editor.getOption(72);let e=0;const s=t=>({id:"menu-action-"+ ++e,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),n=(t,i,n,r,o)=>{if(!i)return s({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(n,t)},c=[];for(const t of o)c.push(s({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new lo("menu-action-"+ ++e,t,i,void 0))(t,c)},r=[];r.push(s({label:Q(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),r.push(new co),r.push(s({label:Q(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),r.push(n(Q(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:Q(0,"Proportional"),value:"proportional"},{label:Q(0,"Fill"),value:"fill"},{label:Q(0,"Fit"),value:"fit"}])),r.push(n(Q(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:Q(0,"Mouse Over"),value:"mouseover"},{label:Q(0,"Always"),value:"always"}]));const o=this._editor.getOption(126)&&!yt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>r,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};j0.ID="editor.contrib.contextmenu",j0=$0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([W0(1,qO),W0(2,KO),W0(3,th),W0(4,HC),W0(5,xh),W0(6,rd),W0(7,RO)],j0),iu(j0.ID,j0,2),Xa(class extends Ga{constructor(){super({id:"editor.action.showContextMenu",label:Q(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=j0.get(i))||void 0===e||e.showContextMenu()}});class V0{constructor(t){this.selections=t}equals(t){const i=this.selections.length;if(i!==t.selections.length)return!1;for(let e=0;e<i;e++)if(!this.selections[e].equalsSelection(t.selections[e]))return!1;return!0}}class H0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class z0 extends Ki{static get(t){return t.getContribution(z0.ID)}constructor(t){super(),this._editor=t,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(t.onDidChangeModel((()=>{this._undoStack=[],this._redoStack=[]}))),this._register(t.onDidChangeModelContent((()=>{this._undoStack=[],this._redoStack=[]}))),this._register(t.onDidChangeCursorSelection((i=>{if(this._isCursorUndoRedo)return;if(!i.oldSelections)return;if(i.oldModelVersionId!==i.modelVersionId)return;const e=new V0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new H0(e,t.getScrollTop(),t.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new H0(new V0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){this._editor.hasModel()&&0!==this._redoStack.length&&(this._undoStack.push(new H0(new V0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(t){this._isCursorUndoRedo=!0,this._editor.setSelections(t.cursorState.selections),this._editor.setScrollPosition({scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),this._isCursorUndoRedo=!1}}z0.ID="editor.contrib.cursorUndoRedoController",iu(z0.ID,z0,0),Xa(class extends Ga{constructor(){super({id:"cursorUndo",label:Q(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=z0.get(i))||void 0===s||s.cursorUndo()}}),Xa(class extends Ga{constructor(){super({id:"cursorRedo",label:Q(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=z0.get(i))||void 0===s||s.cursorRedo()}});class U0{constructor(t,i,e){this.selection=t,this.targetPosition=i,this.copy=e,this.targetSelection=null}getEditOperations(t,i){const e=t.getValueInRange(this.selection);this.copy||i.addEditOperation(this.selection,null),i.addEditOperation(new bs(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),e),this.targetSelection=!this.selection.containsPosition(this.targetPosition)||this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition))?this.copy?new ys(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.targetPosition.lineNumber>this.selection.endLineNumber?new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.targetPosition.lineNumber<this.selection.endLineNumber?new ys(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.selection.endColumn<=this.targetPosition.column?new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn):this.selection}computeCursorState(t,i){return this.targetSelection}}function K0(t){return pt?t.altKey:t.ctrlKey}class q0 extends Ki{constructor(t){super(),this._editor=t,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._register(this._editor.onMouseDrag((t=>this._onEditorMouseDrag(t)))),this._register(this._editor.onMouseDrop((t=>this._onEditorMouseDrop(t)))),this._register(this._editor.onMouseDropCanceled((()=>this._onEditorMouseDropCanceled()))),this._register(this._editor.onKeyDown((t=>this.onEditorKeyDown(t)))),this._register(this._editor.onKeyUp((t=>this.onEditorKeyUp(t)))),this._register(this._editor.onDidBlurEditorWidget((()=>this.onEditorBlur()))),this._register(this._editor.onDidBlurEditorText((()=>this.onEditorBlur()))),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(K0(t)&&(this._modifierPressed=!0),this._mouseDown&&K0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(K0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===q0.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(t){this._mouseDown=!0}_onEditorMouseUp(t){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(t){const i=t.target;if(null===this._dragSelection){const t=(this._editor.getSelections()||[]).filter((t=>i.position&&t.containsPosition(i.position)));if(1!==t.length)return;this._dragSelection=t[0]}K0(t.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),i.position&&(this._dragSelection.containsPosition(i.position)?this._removeDecoration():this.showAt(i.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(t){if(t.target&&(this._hitContent(t.target)||this._hitMargin(t.target))&&t.target.position){const i=new vs(t.target.position.lineNumber,t.target.position.column);if(null===this._dragSelection){let e=null;if(t.event.shiftKey){const t=this._editor.getSelection();if(t){const{selectionStartLineNumber:s,selectionStartColumn:n}=t;e=[new ys(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new ys(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(K0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(q0.ID,new U0(this._dragSelection,i,K0(t.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(t){this._dndDecorationIds.set([{range:new bs(t.lineNumber,t.column,t.lineNumber,t.column),options:q0._DECORATION_OPTIONS}]),this._editor.revealPosition(t,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(t){return 6===t.type||7===t.type}_hitMargin(t){return 2===t.type||3===t.type||4===t.type}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}q0.ID="editor.contrib.dragAndDrop",q0.TRIGGER_KEY_VALUE=pt?6:5,q0._DECORATION_OPTIONS=aL.register({description:"dnd-target",className:"dnd-target"}),iu(q0.ID,q0,2);const G0=function(){if("object"==typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID.bind(crypto);let t;t="object"==typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues.bind(crypto):function(t){for(let i=0;i<t.length;i++)t[i]=Math.floor(256*Math.random());return t};const i=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){t(i),i[6]=15&i[6]|64,i[8]=63&i[8]|128;let s=0,n="";return n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n}}();function Z0(t){return{asString:async()=>t,asFile:()=>{},value:"string"==typeof t?t:void 0}}class J0{constructor(){this._entries=new Map}get size(){let t=0;for(const i of this._entries)t++;return t}has(t){return this._entries.has(this.toKey(t))}matches(t){const i=[...this._entries.keys()];return It.some(this,(([t,i])=>i.asFile()))&&i.push("files"),X0(Q0(t),i)}get(t){var i;return null===(i=this._entries.get(this.toKey(t)))||void 0===i?void 0:i[0]}append(t,i){const e=this._entries.get(t);e?e.push(i):this._entries.set(this.toKey(t),[i])}replace(t,i){this._entries.set(this.toKey(t),[i])}delete(t){this._entries.delete(this.toKey(t))}*[Symbol.iterator](){for(const[t,i]of this._entries)for(const e of i)yield[t,e]}toKey(t){return Q0(t)}}function Q0(t){return t.toLowerCase()}function Y0(t,i){return X0(Q0(t),i.map(Q0))}function X0(t,i){if("*/*"===t)return i.length>0;if(i.includes(t))return!0;const e=t.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!e)return!1;const[s,n,r]=e;return"*"===r&&i.some((t=>t.startsWith(n+"/")))}const t1=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>t1.split(t).filter((t=>!t.startsWith("#")))});mh.add("workbench.contributions.dragAndDrop",new class{});class i1{constructor(){}static getInstance(){return i1.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}function e1(t){const i=new J0;for(const e of t.items){const t=e.type;if("string"===e.kind){const s=new Promise((t=>e.getAsString(t)));i.append(t,Z0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,s1(s))}}return i}function s1(t){const i=t.path?hs.parse(t.path):void 0;return function(t,i,e){const s={id:G0(),name:t,uri:i,data:e};return{asString:async()=>"",asFile:()=>s,value:void 0}}(t.name,i,(async()=>new Uint8Array(await t.arrayBuffer())))}i1.INSTANCE=new i1;const n1=Object.freeze(["CodeEditors","CodeFiles",u_.RESOURCES,u_.INTERNAL_URI_LIST]);function r1(t,i=!1){const e=e1(t),s=e.get(u_.INTERNAL_URI_LIST);if(s)e.replace(md.uriList,s);else if(i||!e.has(md.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?hs.file(e).toString():hs.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(md.uriList,Z0(t1.create(i)))}for(const t of n1)e.delete(t);return e}function o1(t){var i;function e(t,i){return"providerId"in t&&t.providerId===i.providerId||"mimeType"in t&&t.mimeType===i.handledMimeType}const s=new Map;for(const n of t)for(const r of null!==(i=n.yieldTo)&&void 0!==i?i:[])for(const i of t)if(i!==n&&e(r,i)){let t=s.get(n);t||(t=[],s.set(n,t)),t.push(i)}if(!s.size)return Array.from(t);const n=new Set,r=[];return function t(i){if(!i.length)return[];const e=i[0];if(r.includes(e))return console.warn(`Yield to cycle detected for ${e.providerId}`),i;if(n.has(e))return t(i.slice(1));let o=[];const h=s.get(e);return h&&(r.push(e),o=t(h),r.pop()),n.add(e),[...o,e,...t(i.slice(1))]}(Array.from(t))}const h1=aL.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class c1 extends Ki{constructor(t,i,e,s,n){super(),this.typeId=t,this.editor=i,this.range=e,this.delegate=n,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(s),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(t){this.domNode=Fa(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Fa("span.icon");this.domNode.append(i),i.classList.add(...go.asClassNameArray(xs.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(66);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(52)||t.hasChanged(66))&&e()}))),this._register(Il(this.domNode,ya.CLICK,(()=>{this.delegate.cancel()})))}getId(){return c1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}c1.baseId="editor.widget.inlineProgressWidget";let l1=class extends Ki{constructor(t,i,e){super(),this.id=t,this._editor=i,this._instantiationService=e,this._showDelay=500,this._showPromise=this._register(new qi),this._currentWidget=new qi,this._operationIdPool=0,this._currentDecorations=i.createDecorationsCollection()}async showWhile(t,i,e){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=ic((()=>{const s=bs.fromPositions(t);this._currentDecorations.set([{range:s,options:h1}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(c1,this.id,this._editor,s,i,e))}),this._showDelay);try{return await e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};l1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,io)],l1);var a1,u1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},d1=function(t,i){return function(e,s){i(e,s,t)}};let f1=a1=class extends Ki{constructor(t,i,e,s,n,r,o,h,c,l){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=l,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(zi((()=>this.visibleContext.reset()))),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(zi((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition((t=>{n.containsPosition(t.position)||this.dispose()}))),this._register(Xi.runAndSubscribe(l.onDidUpdateKeybindings,(()=>{this._updateButtonTitle()})))}_updateButtonTitle(){var t;const i=null===(t=this._keybindingService.lookupKeybinding(this.showCommand.id))||void 0===t?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(i?` (${i})`:"")}create(){this.domNode=Fa(".post-edit-widget"),this.button=this._register(new bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Il(this.domNode,ya.CLICK,(()=>this.showSelector())))}getId(){return a1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=Zl(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>uo({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};f1.baseId="editor.widget.postEditWidget",f1=a1=u1([d1(7,qO),d1(8,th),d1(9,HC)],f1);let g1=class extends Ki{constructor(t,i,e,s,n,r){super(),this._id=t,this._editor=i,this._visibleContext=e,this._showCommand=s,this._instantiationService=n,this._bulkEditService=r,this._currentWidget=this._register(new qi),this._register(Xi.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}async applyEditAndShowIfNeeded(t,i,e,s){var n,r;const o=this._editor.getModel();if(!o||!t.length)return;const h=i.allEdits[i.activeEditIndex];if(!h)return;let c=[];c=("string"==typeof h.insertText?""===h.insertText:""===h.insertText.snippet)?[]:t.map((t=>new HR(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0})));const l={edits:[...c,...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},a=t[0],u=o.deltaDecorations([],[{range:a,options:{description:"paste-line-suffix",stickiness:0}}]);let d,f;try{d=await this._bulkEditService.apply(l,{editor:this._editor,token:s}),f=o.getDecorationRange(u[0])}finally{o.deltaDecorations(u,[])}e&&d.isApplied&&i.allEdits.length>1&&this.show(null!=f?f:a,i,(async n=>{const r=this._editor.getModel();r&&(await r.undo(),this.applyEditAndShowIfNeeded(t,{activeEditIndex:n,allEdits:i.allEdits},e,s))}))}show(t,i,e){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(f1,this._id,this._editor,this._visibleContext,this._showCommand,t,i,e))}clear(){this._currentWidget.clear()}tryShowSelector(){var t;null===(t=this._currentWidget.value)||void 0===t||t.showSelector()}};g1=u1([d1(4,io),d1(5,jR)],g1);var p1,m1=function(t,i){return function(e,s){i(e,s,t)}};const w1="editor.changePasteType",v1=new Xo("pasteWidgetVisible",!1,Q(0,"Whether the paste widget is showing")),b1="application/vnd.code.copyMetadata";let y1=p1=class extends Ki{static get(t){return t.getContribution(p1.ID)}constructor(t,i,e,s,n,r,o){super(),this._bulkEditService=e,this._clipboardService=s,this._languageFeaturesService=n,this._quickInputService=r,this._progressService=o,this._editor=t;const h=t.getContainerDomNode();this._register(Il(h,"copy",(t=>this.handleCopy(t)))),this._register(Il(h,"cut",(t=>this.handleCopy(t)))),this._register(Il(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new l1("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(g1,"pasteIntoEditor",t,v1,{id:w1,label:Q(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},ha().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(84).enabled&&!this._editor.getOption(90)}handleCopy(t){var i,e;if(!this._editor.hasTextFocus())return;if(vt&&this._clipboardService.writeResources([]),!t.clipboardData||!this.isPasteAsEnabled())return;const s=this._editor.getModel(),n=this._editor.getSelections();if(!s||!(null==n?void 0:n.length))return;const r=this._editor.getOption(37);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new bs(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const l=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,gt),a={multicursorText:Array.isArray(l)?l:null,pasteOnNewLine:h,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!u.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:a});const d=e1(t.clipboardData),f=u.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=G0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:a});const p=Zh((async t=>{const i=c(await Promise.all(u.map((async i=>{try{return await i.prepareDocumentPaste(s,o,d,t)}catch(t){return void console.error(t)}}))));i.reverse();for(const t of i)for(const[i,e]of t)d.replace(i,e);return d}));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:g,dataTransferPromise:p}}async handlePaste(t){var i,e;if(!t.clipboardData||!this._editor.hasTextFocus())return;null===(i=this._currentPasteOperation)||void 0===i||i.cancel(),this._currentPasteOperation=void 0;const s=this._editor.getModel(),n=this._editor.getSelections();if(!(null==n?void 0:n.length)||!s)return;if(!this.isPasteAsEnabled())return;const r=this.fetchCopyMetadata(t),o=r1(t.clipboardData);o.delete(b1);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],md.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>Y0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}doPasteInline(t,i,e,s){const n=Zh((async r=>{const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new hq(o,3,void 0,r);try{if(await this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const n=t.filter((t=>k1(t,e)));if(!n.length||1===n.length&&"text"===n[0].id)return void await this.applyDefaultPasteHandler(e,s,c.token);const r=await this.getPasteEdits(n,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===r.length&&"text"===r[0].providerId)return void await this.applyDefaultPasteHandler(e,s,c.token);if(r.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:r},t,c.token)}await this.applyDefaultPasteHandler(e,s,c.token)}finally{c.dispose(),this._currentPasteOperation===n&&(this._currentPasteOperation=void 0)}}));this._pasteProgressManager.showWhile(i[0].getEndPosition(),Q(0,"Running paste handlers. Click to cancel"),n),this._currentPasteOperation=n}showPasteAsPick(t,i,e,s,n){const r=Zh((async o=>{const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new hq(h,3,void 0,o);try{if(await this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let r=i.filter((t=>k1(t,s)));t&&(r=r.filter((i=>i.id===t)));const o=await this.getPasteEdits(r,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!o.length)return;let h;if(t)h=o.at(0);else{const t=await this._quickInputService.pick(o.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:Q(0,"Select Paste Action")});h=null==t?void 0:t.edit}if(!h)return;const a=function(t,i,e){var s,n;return{edits:[...i.map((i=>new HR(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,h);await this._bulkEditService.apply(a,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}));this._progressService.withProgress({location:10,title:Q(0,"Running paste handlers")},(()=>r))}setCopyMetadata(t,i){t.setData(b1,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(b1);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=Tk.getTextData(t.clipboardData);return n?{defaultPastePayload:{mode:n.mode,multicursorText:null!==(i=n.multicursorText)&&void 0!==i?i:null,pasteOnNewLine:!!n.isFromEmptySelection}}:void 0}async mergeInDataFromCopy(t,i,e){var s;if((null==i?void 0:i.id)&&(null===(s=this._currentCopyOperation)||void 0===s?void 0:s.handle)===i.id){const i=await this._currentCopyOperation.dataTransferPromise;if(e.isCancellationRequested)return;for(const[e,s]of i)t.replace(e,s)}if(!t.has(md.uriList)){const i=await this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(md.uriList,Z0(t1.create(i)))}}async getPasteEdits(t,i,e,s,n){const r=await Jh(Promise.all(t.map((async t=>{var r;try{const o=await(null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n));if(o)return{...o,providerId:t.id}}catch(t){console.error(t)}}))),n);return o1(c(null!=r?r:[]))}async applyDefaultPasteHandler(t,i,e){var s,n,r;const o=null!==(s=t.get(md.text))&&void 0!==s?s:t.get("text");if(!o)return;const h=await o.asString();if(e.isCancellationRequested)return;const c={text:h,pasteOnNewLine:null!==(n=null==i?void 0:i.defaultPastePayload.pasteOnNewLine)&&void 0!==n&&n,multicursorText:null!==(r=null==i?void 0:i.defaultPastePayload.multicursorText)&&void 0!==r?r:null,mode:null};this._editor.trigger("keyboard","paste",c)}};function k1(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}y1.ID="editor.contrib.copyPasteActionController",y1=p1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([m1(1,io),m1(2,jR),m1(3,nH),m1(4,op),m1(5,mj),m1(6,SO)],y1);var C1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},S1=function(t,i){return function(e,s){i(e,s,t)}};const x1=Q(0,"Built-in");class D1{async provideDocumentPasteEdits(t,i,e,s){const n=await this.getEdit(e,s);return n?{insertText:n.insertText,label:n.label,detail:n.detail,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}:void 0}async provideDocumentOnDropEdits(t,i,e,s){const n=await this.getEdit(e,s);return n?{insertText:n.insertText,label:n.label,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}:void 0}}class E1 extends D1{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[md.text],this.pasteMimeTypes=[md.text]}async getEdit(t,i){const e=t.get(md.text);if(!e)return;if(t.has(md.uriList))return;const s=await e.asString();return{handledMimeType:md.text,label:Q(0,"Insert Plain Text"),detail:x1,insertText:s}}}class A1 extends D1{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[md.uriList],this.pasteMimeTypes=[md.uriList]}async getEdit(t,i){const e=await L1(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===dl.file?t.fsPath:(s++,i))).join(" ");let r;return r=Q(0,s>0?e.length>1?"Insert Uris":"Insert Uri":e.length>1?"Insert Paths":"Insert Path"),{handledMimeType:md.uriList,insertText:n,label:r,detail:x1}}}let M1=class extends D1{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[md.uriList],this.pasteMimeTypes=[md.uriList]}async getEdit(t,i){const e=await L1(t);if(!e.length||i.isCancellationRequested)return;const s=c(e.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?hA(i.uri,t):void 0})));return s.length?{handledMimeType:md.uriList,insertText:s.join(" "),label:Q(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:x1}:void 0}};async function L1(t){const i=t.get(md.uriList);if(!i)return[];const e=await i.asString(),s=[];for(const t of t1.parse(e))try{s.push({uri:hs.parse(t),originalText:t})}catch(t){}return s}M1=C1([S1(0,RO)],M1);let F1=class extends Ki{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new E1)),this._register(t.documentOnDropEditProvider.register("*",new A1)),this._register(t.documentOnDropEditProvider.register("*",new M1(i)))}};F1=C1([S1(0,op),S1(1,RO)],F1);let T1=class extends Ki{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new E1)),this._register(t.documentPasteEditProvider.register("*",new A1)),this._register(t.documentPasteEditProvider.register("*",new M1(i)))}};T1=C1([S1(0,op),S1(1,RO)],T1),iu(y1.ID,y1,0),RH(T1),Ya(new class extends qa{constructor(){super({id:w1,precondition:v1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=y1.get(i))||void 0===s?void 0:s.changePasteType()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pasteAs",label:Q(0,"Paste As..."),alias:"Paste As...",precondition:void 0,metadata:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:Q(0,"The id of the paste edit to try applying. If not provided, the editor will show a picker.")}}}}]}})}run(t,i,e){var s;const n="string"==typeof(null==e?void 0:e.id)?e.id:void 0;return null===(s=y1.get(i))||void 0===s?void 0:s.pasteAs(n)}});class R1{constructor(t){this.identifier=t}}const O1=eo("treeViewsDndService");gd(O1,class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(t){if(t&&this._dragOperations.has(t)){const i=this._dragOperations.get(t);return this._dragOperations.delete(t),i}}},1);var _1,I1=function(t,i){return function(e,s){i(e,s,t)}};const P1="editor.experimental.dropIntoEditor.defaultProvider",N1="editor.changeDropType",B1=new Xo("dropWidgetVisible",!1,Q(0,"Whether the drop widget is showing"));let $1=_1=class extends Ki{static get(t){return t.getContribution(_1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=i1.getInstance(),this._dropProgressManager=this._register(i.createInstance(l1,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(g1,"dropIntoEditor",t,B1,{id:N1,label:Q(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(t,i,e){var s;if(!e.dataTransfer||!t.hasModel())return;null===(s=this._currentOperation)||void 0===s||s.cancel(),t.focus(),t.setPosition(i);const n=Zh((async s=>{const r=new hq(t,1,void 0,s);try{const n=await this.extractDataTransferData(e);if(0===n.size||r.token.isCancellationRequested)return;const o=t.getModel();if(!o)return;const h=this._languageFeaturesService.documentOnDropEditProvider.ordered(o).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>n.matches(t))))),c=await this.getDropEdits(h,o,i,n,r);if(r.token.isCancellationRequested)return;if(c.length){const e=this.getInitialActiveEditIndex(o,c),n="afterDrop"===t.getOption(36).showDropSelector;await this._postDropWidgetManager.applyEditAndShowIfNeeded([bs.fromPositions(i)],{activeEditIndex:e,allEdits:c},n,s)}}finally{r.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}}));this._dropProgressManager.showWhile(i,Q(0,"Running drop handlers. Click to cancel"),n),this._currentOperation=n}async getDropEdits(t,i,e,s,n){const r=await Jh(Promise.all(t.map((async t=>{try{const r=await t.provideDocumentOnDropEdits(i,e,s,n.token);if(r)return{...r,providerId:t.id}}catch(t){console.error(t)}}))),n.token);return o1(c(null!=r?r:[]))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(P1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&Y0(t,[i.handledMimeType])));if(e>=0)return e}return 0}async extractDataTransferData(t){if(!t.dataTransfer)return new J0;const i=r1(t.dataTransfer);if(this.treeItemsTransfer.hasData(R1.prototype)){const t=this.treeItemsTransfer.getData(R1.prototype);if(Array.isArray(t))for(const e of t){const t=await this._treeViewsDragAndDropService.removeDragOperationTransfer(e.identifier);if(t)for(const[e,s]of t)i.replace(e,s)}}return i}};$1.ID="editor.contrib.dropIntoEditorController",$1=_1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([I1(1,io),I1(2,rd),I1(3,op),I1(4,O1)],$1),iu($1.ID,$1,2),Ya(new class extends qa{constructor(){super({id:N1,precondition:B1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=$1.get(i))||void 0===s||s.changeDropType()}}),RH(F1),mh.as(bd).registerConfiguration({...KR,properties:{[P1]:{type:"object",scope:5,description:Q(0,"Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class W1{constructor(t){this._editor=t,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const t=this._findScopeDecorationIds.map((t=>this._editor.getModel().getDecorationRange(t))).filter((t=>!!t));if(t.length)return t}return null}getStartPosition(){return this._startPosition}setStartPosition(t){this._startPosition=t,this.setCurrentFindMatch(null)}_getDecorationIndex(t){const i=this._decorations.indexOf(t);return i>=0?i+1:1}getDecorationRangeAt(t){const i=t<this._decorations.length?this._decorations[t]:null;return i?this._editor.getModel().getDecorationRange(i):null}getCurrentMatchesPosition(t){const i=this._editor.getModel().getDecorationsInRange(t);for(const t of i){const i=t.options;if(i===W1._FIND_MATCH_DECORATION||i===W1._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(t){let i=null,e=0;if(t)for(let s=0,n=this._decorations.length;s<n;s++){const n=this._editor.getModel().getDecorationRange(this._decorations[s]);if(t.equalsRange(n)){i=this._decorations[s],e=s+1;break}}return null===this._highlightedDecorationId&&null===i||this._editor.changeDecorations((t=>{if(null!==this._highlightedDecorationId&&(t.changeDecorationOptions(this._highlightedDecorationId,W1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,W1._CURRENT_FIND_MATCH_DECORATION)),null!==this._rangeHighlightDecorationId&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),null!==i){let e=this._editor.getModel().getDecorationRange(i);if(e.startLineNumber!==e.endLineNumber&&1===e.endColumn){const t=e.endLineNumber-1,i=this._editor.getModel().getLineMaxColumn(t);e=new bs(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,W1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=W1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=W1._FIND_MATCH_NO_OVERVIEW_DECORATION;const i=this._editor.getModel().getLineCount(),e=this._editor.getLayoutInfo().height,r=Math.max(2,Math.ceil(3/(e/i)));let o=t[0].range.startLineNumber,h=t[0].range.endLineNumber;for(let i=1,e=t.length;i<e;i++){const e=t[i].range;h+r>=e.startLineNumber?e.endLineNumber>h&&(h=e.endLineNumber):(n.push({range:new bs(o,1,h,1),options:W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new bs(o,1,h,1),options:W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(t.length);for(let i=0,e=t.length;i<e;i++)r[i]={range:t[i].range,options:s};this._decorations=e.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=e.deltaDecorations(this._overviewRulerApproximateDecorations,n),this._rangeHighlightDecorationId&&(e.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach((t=>e.removeDecoration(t))),this._findScopeDecorationIds=[]),(null==i?void 0:i.length)&&(this._findScopeDecorationIds=i.map((t=>e.addDecoration(t,W1._FIND_SCOPE_DECORATION))))}))}matchBeforePosition(t){if(0===this._decorations.length)return null;for(let i=this._decorations.length-1;i>=0;i--){const e=this._decorations[i],s=this._editor.getModel().getDecorationRange(e);if(s&&!(s.endLineNumber>t.lineNumber)){if(s.endLineNumber<t.lineNumber)return s;if(!(s.endColumn>t.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(t){if(0===this._decorations.length)return null;for(let i=0,e=this._decorations.length;i<e;i++){const e=this._decorations[i],s=this._editor.getModel().getDecorationRange(e);if(s&&!(s.startLineNumber<t.lineNumber)){if(s.startLineNumber>t.lineNumber)return s;if(!(s.startColumn<t.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let t=[];return t=t.concat(this._decorations),t=t.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&t.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&t.push(this._rangeHighlightDecorationId),t}}W1._CURRENT_FIND_MATCH_DECORATION=aL.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:Bk(Ob),position:bf.Center},minimap:{color:Bk(Ib),position:kf.Inline}}),W1._FIND_MATCH_DECORATION=aL.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:Bk(Ob),position:bf.Center},minimap:{color:Bk(Ib),position:kf.Inline}}),W1._FIND_MATCH_NO_OVERVIEW_DECORATION=aL.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=aL.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Bk(Ob),position:bf.Center}}),W1._RANGE_HIGHLIGHT_DECORATION=aL.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),W1._FIND_SCOPE_DECORATION=aL.register({description:"find-scope",className:"findScope",isWholeLine:!0});class j1{constructor(t,i,e){this._editorSelection=t,this._ranges=i,this._replaceStrings=e,this._trackedEditorSelectionId=null}getEditOperations(t,i){if(this._ranges.length>0){const t=[];for(let i=0;i<this._ranges.length;i++)t.push({range:this._ranges[i],text:this._replaceStrings[i]});t.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)));const e=[];let s=t[0];for(let i=1;i<t.length;i++)s.range.endLineNumber===t[i].range.startLineNumber&&s.range.endColumn===t[i].range.startColumn?(s.range=s.range.plusRange(t[i].range),s.text=s.text+t[i].text):(e.push(s),s=t[i]);e.push(s);for(const t of e)i.addEditOperation(t.range,t.text)}this._trackedEditorSelectionId=i.trackSelection(this._editorSelection)}computeCursorState(t,i){return i.getTrackedSelection(this._trackedEditorSelectionId)}}function V1(t,i){if(t&&""!==t[0]){const e=H1(t,i,"-"),s=H1(t,i,"_");return e&&!s?z1(t,i,"-"):!e&&s?z1(t,i,"_"):t[0].toUpperCase()===t[0]?i.toUpperCase():t[0].toLowerCase()===t[0]?i.toLowerCase():function(t,i=!1){return!!t&&(i&&(t=t.replace(/\\./g,"")),t.toLowerCase()!==t)}(t[0][0])&&i.length>0?i[0].toUpperCase()+i.substr(1):t[0][0].toUpperCase()!==t[0][0]&&i.length>0?i[0].toLowerCase()+i.substr(1):i}return i}function H1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function z1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=V1([n[i]],t)+e})),r.slice(0,-1)}class U1{constructor(t){this.staticValue=t,this.kind=0}}class K1{constructor(t){this.pieces=t,this.kind=1}}class q1{static fromStaticValue(t){return new q1([G1.staticValue(t)])}get hasReplacementPatterns(){return 1===this._state.kind}constructor(t){this._state=t&&0!==t.length?1===t.length&&null!==t[0].staticValue?new U1(t[0].staticValue):new K1(t):new U1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?V1(t,this._state.staticValue):this._state.staticValue;let e="";for(let i=0,s=this._state.pieces.length;i<s;i++){const s=this._state.pieces[i];if(null!==s.staticValue){e+=s.staticValue;continue}let n=q1._substitute(s.matchIndex,t);if(null!==s.caseOps&&s.caseOps.length>0){const t=[],i=s.caseOps.length;let e=0;for(let r=0,o=n.length;r<o;r++){if(e>=i){t.push(n.slice(r));break}switch(s.caseOps[e]){case"U":t.push(n[r].toUpperCase());break;case"u":t.push(n[r].toUpperCase()),e++;break;case"L":t.push(n[r].toLowerCase());break;case"l":t.push(n[r].toLowerCase()),e++;break;default:t.push(n[r])}}n=t.join("")}e+=n}return e}static _substitute(t,i){if(null===i)return"";if(0===t)return i[0];let e="";for(;t>0;){if(t<i.length)return(i[t]||"")+e;e=String(t%10)+e,t=Math.floor(t/10)}return"$"+e}}class G1{static staticValue(t){return new G1(t,-1,null)}static caseOps(t,i){return new G1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class Z1{constructor(t){this._source=t,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(t){this._emitStatic(this._source.substring(this._lastCharIndex,t)),this._lastCharIndex=t}emitStatic(t,i){this._emitStatic(t),this._lastCharIndex=i}_emitStatic(t){0!==t.length&&(this._currentStaticPiece+=t)}emitMatchIndex(t,i,e){0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=G1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=G1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=G1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new q1(this._result)}}const J1=new Xo("findWidgetVisible",!1);J1.toNegated();const Q1=new Xo("findInputFocussed",!1),Y1=new Xo("replaceInputFocussed",!1),X1={primary:545,mac:{primary:2593}},t2={primary:565,mac:{primary:2613}},i2={primary:560,mac:{primary:2608}},e2={primary:554,mac:{primary:2602}},s2={primary:558,mac:{primary:2606}},n2="editor.action.nextMatchFindAction",r2="editor.action.previousMatchFindAction",o2="closeFindWidget",h2="toggleFindCaseSensitive",c2="toggleFindWholeWord",l2="toggleFindRegex",a2="toggleFindInSelection",u2="togglePreserveCase",d2="editor.action.replaceOne",f2="editor.action.replaceAll",g2=19999;class p2{constructor(t,i){this._toDispose=new Ui,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new sc,this._decorations=new W1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new rc((()=>this.research(!1)),100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition((t=>{3!==t.reason&&5!==t.reason&&6!==t.reason||this._decorations.setStartPosition(this._editor.getPosition())}))),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent((t=>{this._ignoreModelContentChanged||(t.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())}))),this._toDispose.add(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Vi(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(t){!this._isDisposed&&this._editor.hasModel()&&(t.searchString||t.isReplaceRevealed||t.isRegex||t.wholeWord||t.matchCase||t.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet((()=>{t.searchScope?this.research(t.moveCursor,this._state.searchScope):this.research(t.moveCursor)}),240)):t.searchScope?this.research(t.moveCursor,this._state.searchScope):this.research(t.moveCursor))}static _getSearchRange(t,i){return i||t.getFullModelRange()}research(t,i){let e=null;void 0!==i?null!==i&&(e=Array.isArray(i)?i:[i]):e=this._decorations.getFindScopes(),null!==e&&(e=e.map((t=>{if(t.startLineNumber!==t.endLineNumber){let i=t.endLineNumber;return 1===t.endColumn&&(i-=1),new bs(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,g2);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=qf(s.map((t=>t.range)),(t=>bs.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const t=this._decorations.getFindScope();return t&&this._editor.revealRangeInCenterIfOutsideViewport(t,0),!0}return!1}_setCurrentFindMatch(t){const i=this._decorations.setCurrentFindMatch(t);this._state.changeMatchInfo(i,this._decorations.getCount(),t),this._editor.setSelection(t),this._editor.revealRangeInCenterIfOutsideViewport(t,0)}_prevSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||1===s?(1===e?e=n.getLineCount():e--,s=n.getLineMaxColumn(e)):s--,new vs(e,s)}_moveToPrevMatch(t,i=!1){if(!this._state.canNavigateBack()){const i=this._decorations.matchAfterPosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<g2){let i=this._decorations.matchBeforePosition(t);return i&&i.isEmpty()&&i.getStartPosition().equals(t)&&(t=this._prevSearchPosition(t),i=this._decorations.matchBeforePosition(t)),void(i&&this._setCurrentFindMatch(i))}if(this._cannotFind())return;const e=this._decorations.getFindScope(),s=p2._getSearchRange(this._editor.getModel(),e);s.getEndPosition().isBefore(t)&&(t=s.getEndPosition()),t.isBefore(s.getStartPosition())&&(t=s.getEndPosition());const{lineNumber:n,column:r}=t,o=this._editor.getModel();let h=new vs(n,r),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1);return c&&c.range.isEmpty()&&c.range.getStartPosition().equals(h)&&(h=this._prevSearchPosition(h),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1)),c?i||s.containsRange(c.range)?void this._setCurrentFindMatch(c.range):this._moveToPrevMatch(c.range.getStartPosition(),!0):void 0}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||s===n.getLineMaxColumn(e)?(e===n.getLineCount()?e=1:e++,s=1):s++,new vs(e,s)}_moveToNextMatch(t){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<g2){let i=this._decorations.matchAfterPosition(t);return i&&i.isEmpty()&&i.getStartPosition().equals(t)&&(t=this._nextSearchPosition(t),i=this._decorations.matchAfterPosition(t)),void(i&&this._setCurrentFindMatch(i))}const i=this._getNextMatch(t,!1,!0);i&&this._setCurrentFindMatch(i.range)}_getNextMatch(t,i,e,s=!1){if(this._cannotFind())return null;const n=this._decorations.getFindScope(),r=p2._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(t)&&(t=r.getStartPosition()),t.isBefore(r.getStartPosition())&&(t=r.getStartPosition());const{lineNumber:o,column:h}=t,c=this._editor.getModel();let l=new vs(o,h),a=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i);return e&&a&&a.range.isEmpty()&&a.range.getStartPosition().equals(l)&&(l=this._nextSearchPosition(l),a=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i)),a?s||r.containsRange(a.range)?a:this._getNextMatch(a.range.getEndPosition(),i,e,!0):null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(t){const i=this._decorations.getDecorationRangeAt(t);i&&this._setCurrentFindMatch(i)}moveToMatch(t){this._moveToMatch(t)}_getReplacePattern(){return this._state.isRegex?function(t){if(!t||0===t.length)return new q1(null);const i=[],e=new Z1(t);for(let s=0,n=t.length;s<n;s++){const r=t.charCodeAt(s);if(92!==r){if(36===r){if(s++,s>=n)break;const r=t.charCodeAt(s);if(36===r){e.emitUnchanged(s-1),e.emitStatic("$",s+1);continue}if(48===r||38===r){e.emitUnchanged(s-1),e.emitMatchIndex(0,s+1,i),i.length=0;continue}if(49<=r&&r<=57){let o=r-48;if(s+1<n){const n=t.charCodeAt(s+1);if(48<=n&&n<=57){s++,o=10*o+(n-48),e.emitUnchanged(s-2),e.emitMatchIndex(o,s+1,i),i.length=0;continue}}e.emitUnchanged(s-1),e.emitMatchIndex(o,s+1,i),i.length=0;continue}}}else{if(s++,s>=n)break;const r=t.charCodeAt(s);switch(r){case 92:e.emitUnchanged(s-1),e.emitStatic("\\",s+1);break;case 110:e.emitUnchanged(s-1),e.emitStatic("\n",s+1);break;case 116:e.emitUnchanged(s-1),e.emitStatic("\t",s+1);break;case 117:case 85:case 108:case 76:e.emitUnchanged(s-1),e.emitStatic("",s+1),i.push(String.fromCharCode(r))}}}return e.finalize()}(this._state.replaceString):q1.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const t=this._getReplacePattern(),i=this._editor.getSelection(),e=this._getNextMatch(i.getStartPosition(),!0,!1);if(e)if(i.equalsRange(e.range)){const s=t.buildReplaceString(e.matches,this._state.preserveCase),n=new oS(i,s);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new vs(i.startLineNumber,i.startColumn+s.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(e.range)}_findMatches(t,i,e){const s=(t||[null]).map((t=>p2._getSearchRange(this._editor.getModel(),t)));return this._editor.getModel().findMatches(this._state.searchString,s,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=g2?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new Tf(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let t="mu";i.ignoreCase&&(t+="i"),i.global&&(t+="g"),i=new RegExp(i.source,t)}const e=this._editor.getModel(),s=e.getValue(1),n=e.getFullModelRange(),r=this._getReplacePattern();let o;const h=this._state.preserveCase;o=s.replace(i,r.hasReplacementPatterns||h?function(){return r.buildReplaceString(arguments,h)}:r.buildReplaceString(null,h));const c=new aS(n,o,this._editor.getSelection());this._executeEditorCommand("replaceAll",c)}_regularReplaceAll(t){const i=this._getReplacePattern(),e=this._findMatches(t,i.hasReplacementPatterns||this._state.preserveCase,1073741824),s=[];for(let t=0,n=e.length;t<n;t++)s[t]=i.buildReplaceString(e[t].matches,this._state.preserveCase);const n=new j1(this._editor.getSelection(),e.map((t=>t.range)),s);this._executeEditorCommand("replaceAll",n)}selectAllMatches(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();let i=this._findMatches(t,!1,1073741824).map((t=>new ys(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn)));const e=this._editor.getSelection();for(let t=0,s=i.length;t<s;t++)if(i[t].equalsRange(e)){i=[e].concat(i.slice(0,t)).concat(i.slice(t+1));break}this._editor.setSelections(i)}_executeEditorCommand(t,i){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(t,i),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}class m2 extends Yy{constructor(t,i,e){super(),this._hideSoon=this._register(new rc((()=>this._hide()),2e3)),this._isVisible=!1,this._editor=t,this._state=i,this._keybindingService=e,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const s={inputActiveOptionBorder:qm(lw),inputActiveOptionForeground:qm(uw),inputActiveOptionBackground:qm(aw)};this.caseSensitive=this._register(new VB({appendTitle:this._keybindingLabelFor(h2),isChecked:this._state.matchCase,...s})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange((()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)}))),this.wholeWords=this._register(new HB({appendTitle:this._keybindingLabelFor(c2),isChecked:this._state.wholeWord,...s})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange((()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)}))),this.regex=this._register(new zB({appendTitle:this._keybindingLabelFor(l2),isChecked:this._state.isRegex,...s})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange((()=>{this._state.change({isRegex:this.regex.checked},!1)}))),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange((t=>{let i=!1;t.isRegex&&(this.regex.checked=this._state.isRegex,i=!0),t.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,i=!0),t.matchCase&&(this.caseSensitive.checked=this._state.matchCase,i=!0),!this._state.isRevealed&&i&&this._revealTemporarily()}))),this._register(Il(this._domNode,ya.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Il(this._domNode,"mouseover",(()=>this._onMouseOver())))}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return m2.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}}function w2(t,i){return 1===t||2!==t&&i}m2.ID="editor.contrib.findOptionsWidget";class v2 extends Ki{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return w2(this._isRegexOverride,this._isRegex)}get wholeWord(){return w2(this._wholeWordOverride,this._wholeWord)}get matchCase(){return w2(this._matchCaseOverride,this._matchCase)}get preserveCase(){return w2(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new ne),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(t,i,e){const s={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let n=!1;0===i&&(t=0),t>i&&(t=i),this._matchesPosition!==t&&(this._matchesPosition=t,s.matchesPosition=!0,n=!0),this._matchesCount!==i&&(this._matchesCount=i,s.matchesCount=!0,n=!0),void 0!==e&&(bs.equalsRange(this._currentMatch,e)||(this._currentMatch=e,s.currentMatch=!0,n=!0)),n&&this._onFindReplaceStateChange.fire(s)}change(t,i,e=!0){var s;const n={moveCursor:i,updateHistory:e,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let r=!1;const o=this.isRegex,h=this.wholeWord,c=this.matchCase,l=this.preserveCase;void 0!==t.searchString&&this._searchString!==t.searchString&&(this._searchString=t.searchString,n.searchString=!0,r=!0),void 0!==t.replaceString&&this._replaceString!==t.replaceString&&(this._replaceString=t.replaceString,n.replaceString=!0,r=!0),void 0!==t.isRevealed&&this._isRevealed!==t.isRevealed&&(this._isRevealed=t.isRevealed,n.isRevealed=!0,r=!0),void 0!==t.isReplaceRevealed&&this._isReplaceRevealed!==t.isReplaceRevealed&&(this._isReplaceRevealed=t.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),void 0!==t.isRegex&&(this._isRegex=t.isRegex),void 0!==t.wholeWord&&(this._wholeWord=t.wholeWord),void 0!==t.matchCase&&(this._matchCase=t.matchCase),void 0!==t.preserveCase&&(this._preserveCase=t.preserveCase),void 0!==t.searchScope&&((null===(s=t.searchScope)||void 0===s?void 0:s.every((t=>{var i;return null===(i=this._searchScope)||void 0===i?void 0:i.some((i=>!bs.equalsRange(i,t)))})))||(this._searchScope=t.searchScope,n.searchScope=!0,r=!0)),void 0!==t.loop&&this._loop!==t.loop&&(this._loop=t.loop,n.loop=!0,r=!0),void 0!==t.isSearching&&this._isSearching!==t.isSearching&&(this._isSearching=t.isSearching,n.isSearching=!0,r=!0),void 0!==t.filters&&(this._filters?this._filters.update(t.filters):this._filters=t.filters,n.filters=!0,r=!0),this._isRegexOverride=void 0!==t.isRegexOverride?t.isRegexOverride:0,this._wholeWordOverride=void 0!==t.wholeWordOverride?t.wholeWordOverride:0,this._matchCaseOverride=void 0!==t.matchCaseOverride?t.matchCaseOverride:0,this._preserveCaseOverride=void 0!==t.preserveCaseOverride?t.preserveCaseOverride:0,o!==this.isRegex&&(r=!0,n.isRegex=!0),h!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),l!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||1!==this.matchesPosition}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=g2}}const b2=Q(0,"input"),y2=Q(0,"Preserve Case");class k2 extends BB{constructor(t){super({icon:xs.preserveCase,title:y2+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class C2 extends Yy{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ne),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ne),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ne),this._onInput=this._register(new ne),this._onKeyUp=this._register(new ne),this._onPreserveCaseKeyDown=this._register(new ne),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||b2;const n=s.appendPreserveCaseLabel||"",r=s.history||[],o=!!s.flexibleHeight,h=!!s.flexibleWidth,c=s.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new ZB(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:s.showHistoryHint,flexibleHeight:o,flexibleWidth:h,flexibleMaxHeight:c,inputBoxStyles:s.inputBoxStyles})),this.preserveCase=this._register(new k2({appendTitle:n,isChecked:!1,...s.toggleStyles})),this._register(this.preserveCase.onChange((t=>{this._onDidOptionChange.fire(t),!t&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this._register(this.preserveCase.onKeyDown((t=>{this._onPreserveCaseKeyDown.fire(t)}))),this.cachedOptionsWidth=this._showOptionButtons?this.preserveCase.width():0;const l=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=l.indexOf(this.domNode.ownerDocument.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%l.length:t.equals(15)&&(e=0===i?l.length-1:i-1),t.equals(9)?(l[i].blur(),this.inputBox.focus()):e>=0&&l[e].focus(),ka(t,!0)}}}));const a=document.createElement("div");a.className="controls",a.style.display=this._showOptionButtons?"block":"none",a.appendChild(this.preserveCase.domNode),this.domNode.appendChild(a),null==t||t.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,(t=>this._onKeyDown.fire(t))),this.onkeyup(this.inputBox.inputElement,(t=>this._onKeyUp.fire(t))),this.oninput(this.inputBox.inputElement,(()=>this._onInput.fire())),this.onmousedown(this.inputBox.inputElement,(t=>this._onMouseDown.fire(t)))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(t){t?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(t){this.preserveCase.checked=t}focusOnPreserve(){this.preserveCase.focus()}validate(){var t;null===(t=this.inputBox)||void 0===t||t.validate()}set width(t){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=t+"px"}dispose(){super.dispose()}}var S2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},x2=function(t,i){return function(e,s){i(e,s,t)}};const D2=new Xo("suggestWidgetVisible",!1,Q(0,"Whether suggestion are visible")),E2="historyNavigationWidgetFocus",A2="historyNavigationForwardsEnabled",M2="historyNavigationBackwardsEnabled";let L2;const F2=[];function T2(t,i){if(F2.includes(i))throw new Error("Cannot register the same widget multiple times");F2.push(i);const e=new Ui,s=new Xo(E2,!1).bindTo(t),n=new Xo(A2,!0).bindTo(t),r=new Xo(M2,!0).bindTo(t),o=()=>{s.set(!0),L2=i},h=()=>{s.set(!1),L2===i&&(L2=void 0)};return oa(i.element)&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(zi((()=>{F2.splice(F2.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let R2=class extends QB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(T2(n,this.inputBox))}};R2=S2([x2(3,th)],R2);let O2=class extends C2{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(T2(r,this.inputBox))}};function _2(t){var i,e;return"Up"===(null===(i=t.lookupKeybinding("history.showPrevious"))||void 0===i?void 0:i.getElectronAccelerator())&&"Down"===(null===(e=t.lookupKeybinding("history.showNext"))||void 0===e?void 0:e.getElectronAccelerator())}O2=S2([x2(3,th)],O2),vh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Oo.and(Oo.has(E2),Oo.equals(M2,!0),Oo.not("isComposing"),D2.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==L2||L2.showPreviousValue()}}),vh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Oo.and(Oo.has(E2),Oo.equals(A2,!0),Oo.not("isComposing"),D2.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==L2||L2.showNextValue()}});const I2=AV("find-selection",xs.selection,Q(0,"Icon for 'Find in Selection' in the editor find widget.")),P2=AV("find-collapsed",xs.chevronRight,Q(0,"Icon to indicate that the editor find widget is collapsed.")),N2=AV("find-expanded",xs.chevronDown,Q(0,"Icon to indicate that the editor find widget is expanded.")),B2=AV("find-replace",xs.replace,Q(0,"Icon for 'Replace' in the editor find widget.")),$2=AV("find-replace-all",xs.replaceAll,Q(0,"Icon for 'Replace All' in the editor find widget.")),W2=AV("find-previous-match",xs.arrowUp,Q(0,"Icon for 'Find Previous' in the editor find widget.")),j2=AV("find-next-match",xs.arrowDown,Q(0,"Icon for 'Find Next' in the editor find widget.")),V2=Q(0,"Find / Replace"),H2=Q(0,"Find"),z2=Q(0,"Find"),U2=Q(0,"Previous Match"),K2=Q(0,"Next Match"),q2=Q(0,"Find in Selection"),G2=Q(0,"Close"),Z2=Q(0,"Replace"),J2=Q(0,"Replace"),Q2=Q(0,"Replace"),Y2=Q(0,"Replace All"),X2=Q(0,"Toggle Replace"),t4=Q(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",g2),i4=Q(0,"{0} of {1}"),e4=Q(0,"No results"),s4=419;let n4=69;const r4="ctrlEnterReplaceAll.windows.donotask",o4=pt?256:2048;class h4{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function c4(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function l4(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class a4 extends Yy{constructor(t,i,e,s,n,r,o,h,c){super(),this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=t,this._controller=i,this._state=e,this._contextViewProvider=s,this._keybindingService=n,this._contextKeyService=r,this._storageService=h,this._notificationService=c,this._ctrlEnterReplaceAllWarningPrompted=!!h.getBoolean(r4,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Yh(500),this._register(zi((()=>this._updateHistoryDelayer.cancel()))),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration((t=>{if(t.hasChanged(90)&&(this._codeEditor.getOption(90)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(143)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(41)){const t=this._codeEditor.getOption(41).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(41).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new h4(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((async()=>{if(this._isVisible){const t=await this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}}))),this._findInputFocused=Q1.bindTo(r),this._findFocusTracker=this._register(Sa(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus((()=>{this._findInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._findFocusTracker.onDidBlur((()=>{this._findInputFocused.set(!1)}))),this._replaceInputFocused=Y1.bindTo(r),this._replaceFocusTracker=this._register(Sa(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus((()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._replaceFocusTracker.onDidBlur((()=>{this._replaceInputFocused.set(!1)}))),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new h4(0)),this._register(this._codeEditor.onDidChangeModel((()=>{this._isVisible&&(this._viewZoneId=void 0)}))),this._register(this._codeEditor.onDidScrollChange((t=>{t.scrollTopChanged?this._layoutViewZone():setTimeout((()=>{this._layoutViewZone()}),0)})))}getId(){return a4.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(t){if(t.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}t.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),t.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),t.isReplaceRevealed&&(this._state.isReplaceRevealed?this._codeEditor.getOption(90)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=Jl(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(t.isRevealed||t.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),t.isRegex&&this._findInput.setRegex(this._state.isRegex),t.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),t.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),t.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),t.searchScope&&(this._toggleSelectionFind.checked=!!this._state.searchScope,this._updateToggleSelectionFindButton()),(t.searchString||t.matchesCount||t.matchesPosition)&&(this._domNode.classList.toggle("no-results",this._state.searchString.length>0&&0===this._state.matchesCount),this._updateMatchesCount(),this._updateButtons()),(t.searchString||t.currentMatch)&&this._layoutViewZone(),t.updateHistory&&this._delayedUpdateHistory(),t.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,Li)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){let t;if(this._matchesCount.style.minWidth=n4+"px",this._matchesCount.title=this._state.matchesCount>=g2?t4:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=g2&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Nn(i4,e,i)}else t=e4;this._matchesCount.appendChild(document.createTextNode(t)),Cm(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),n4=Math.max(n4,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===e4)return""===e?Q(0,"{0} found",t):Q(0,"{0} found for '{1}'",t,e);if(i){const s=Q(0,"{0} found for '{1}', at {2}",t,e,i.startLineNumber+":"+i.startColumn),n=this._codeEditor.getModel();return n&&i.startLineNumber<=n.getLineCount()&&i.startLineNumber>=1?`${n.getLineContent(i.startLineNumber)}, ${s}`:s}return Q(0,"{0} found for '{1}'",t,e)}_updateToggleSelectionFindButton(){const t=this._codeEditor.getSelection();this._isVisible&&(this._toggleSelectionFind.checked||t&&(t.startLineNumber!==t.endLineNumber||t.startColumn!==t.endColumn))?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const t=this._state.searchString.length>0,i=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const e=!this._codeEditor.getOption(90);this._toggleReplaceBtn.setEnabled(this._isVisible&&e)}_reveal(){if(this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const t=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":this._toggleSelectionFind.checked=!!t&&t.startLineNumber!==t.endLineNumber}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout((()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")}),0)),this._revealTimeouts.push(setTimeout((()=>{this._findInput.validate()}),200)),this._codeEditor.layoutOverlayWidget(this);let i=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=Zl(e),n=this._codeEditor.getScrolledVisiblePosition(t.getStartPosition()),r=s.left+(n?n.left:0);if(this._viewZone&&(n?n.top:0)<this._viewZone.heightInPx){t.endLineNumber>t.startLineNumber&&(i=!1);const e=Gl(this._domNode).left;r>e&&(i=!1);const n=this._codeEditor.getScrolledVisiblePosition(t.getEndPosition());s.left+(n?n.left:0)>e&&(i=!1)}}}this._showViewZone(i)}}_hide(t){this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),t&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(t){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return void this._removeViewZone();if(!this._isVisible)return;const i=this._viewZone;void 0===this._viewZoneId&&i&&this._codeEditor.changeViewZones((e=>{i.heightInPx=this._getHeight(),this._viewZoneId=e.addZone(i),this._codeEditor.setScrollTop(t||this._codeEditor.getScrollTop()+i.heightInPx)}))}_showViewZone(t=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new h4(0));const i=this._viewZone;this._codeEditor.changeViewZones((e=>{if(void 0!==this._viewZoneId){const s=this._getHeight();if(s===i.heightInPx)return;const n=s-i.heightInPx;return i.heightInPx=s,e.layoutZone(this._viewZoneId),void(t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+n))}{let s=this._getHeight();if(s-=this._codeEditor.getOption(83).top,s<=0)return;i.heightInPx=s,this._viewZoneId=e.addZone(i),t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}}))}_removeViewZone(){this._codeEditor.changeViewZones((t=>{void 0!==this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))}))}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!this._domNode.isConnected)return;const t=this._codeEditor.getLayoutInfo();if(t.contentWidth<=0)return void this._domNode.classList.add("hiddenEditor");this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=t.width,e=t.minimap.minimapWidth;let s=!1,n=!1,r=!1;if(this._resized&&Jl(this._domNode)>s4)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=Jl(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-n4>=i&&(r=!0),447+e-n4>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",r),this._domNode.classList.toggle("reduced-find-widget",n),r||s||(this._domNode.style.maxWidth=i-28-e-15+"px"),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:r,reducedFindWidget:n}),this._resized){const t=this._findInput.inputBox.element.clientWidth;t>0&&(this._replaceInput.width=t)}else this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode))}_getHeight(){let t=0;return t+=4,t+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(t+=4,t+=this._replaceInput.inputBox.height+2),t+=4,t}_tryUpdateHeight(){const t=this._getHeight();return(null===this._cachedHeight||this._cachedHeight!==t)&&(this._cachedHeight=t,this._domNode.style.height=`${t}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const t=this._codeEditor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.startLineNumber===t.endLineNumber||bs.equalsRange(t,this._state.currentMatch)?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}_onFindInputMouseDown(t){t.middleButton&&t.stopPropagation()}_onFindInputKeyDown(t){return t.equals(3|o4)?(this._keybindingService.dispatchEvent(t,t.target)||this._findInput.inputBox.insertAtCursor("\n"),void t.preventDefault()):t.equals(2)?(this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),void t.preventDefault()):t.equals(2066)?(this._codeEditor.focus(),void t.preventDefault()):t.equals(16)?c4(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?l4(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|o4)?(this._keybindingService.dispatchEvent(t,t.target)||(gt&&wt&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(Q(0,"Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(r4,!0,0,0)),this._replaceInput.inputBox.insertAtCursor("\n")),void t.preventDefault()):t.equals(2)?(this._findInput.focusOnCaseSensitive(),void t.preventDefault()):t.equals(1026)?(this._findInput.focus(),void t.preventDefault()):t.equals(2066)?(this._codeEditor.focus(),void t.preventDefault()):t.equals(16)?c4(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?l4(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):void 0}getVerticalSashLeft(t){return 0}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new R2(null,this._contextViewProvider,{width:221,label:H2,placeholder:z2,appendCaseSensitiveLabel:this._keybindingLabelFor(h2),appendWholeWordsLabel:this._keybindingLabelFor(c2),appendRegexLabel:this._keybindingLabelFor(l2),validation:t=>{if(0===t.length||!this._findInput.getRegex())return null;try{return null}catch(t){return{content:t.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>_2(this._keybindingService),inputBoxStyles:wN,toggleStyles:mN},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown((t=>this._onFindInputKeyDown(t)))),this._register(this._findInput.inputBox.onDidChange((()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)}))),this._register(this._findInput.onDidOptionChange((()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)}))),this._register(this._findInput.onCaseSensitiveKeyDown((t=>{t.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),t.preventDefault())}))),this._register(this._findInput.onRegexKeyDown((t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),t.preventDefault())}))),this._register(this._findInput.inputBox.onDidHeightChange((()=>{this._tryUpdateHeight()&&this._showViewZone()}))),mt&&this._register(this._findInput.onMouseDown((t=>this._onFindInputMouseDown(t)))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this._prevBtn=this._register(new u4({label:U2+this._keybindingLabelFor(r2),icon:W2,onTrigger:()=>{$(this._codeEditor.getAction(r2)).run().then(void 0,Li)}})),this._nextBtn=this._register(new u4({label:K2+this._keybindingLabelFor(n2),icon:j2,onTrigger:()=>{$(this._codeEditor.getAction(n2)).run().then(void 0,Li)}}));const t=document.createElement("div");t.className="find-part",t.appendChild(this._findInput.domNode);const i=document.createElement("div");i.className="find-actions",t.appendChild(i),i.appendChild(this._matchesCount),i.appendChild(this._prevBtn.domNode),i.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new BB({icon:I2,title:q2+this._keybindingLabelFor(a2),isChecked:!1,inputActiveOptionBackground:qm(aw),inputActiveOptionBorder:qm(lw),inputActiveOptionForeground:qm(uw)})),this._register(this._toggleSelectionFind.onChange((()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){const t=this._codeEditor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}else this._state.change({searchScope:null},!0)}))),i.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new u4({label:G2+this._keybindingLabelFor(o2),icon:RV,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),t.preventDefault())}})),this._replaceInput=this._register(new O2(null,void 0,{label:Z2,placeholder:J2,appendPreserveCaseLabel:this._keybindingLabelFor(u2),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>_2(this._keybindingService),inputBoxStyles:wN,toggleStyles:mN},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown((t=>this._onReplaceInputKeyDown(t)))),this._register(this._replaceInput.inputBox.onDidChange((()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)}))),this._register(this._replaceInput.inputBox.onDidHeightChange((()=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()}))),this._register(this._replaceInput.onDidOptionChange((()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)}))),this._register(this._replaceInput.onPreserveCaseKeyDown((t=>{t.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),t.preventDefault())}))),this._replaceBtn=this._register(new u4({label:Q2+this._keybindingLabelFor(d2),icon:B2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new u4({label:Y2+this._keybindingLabelFor(f2),icon:$2,onTrigger:()=>{this._controller.replaceAll()}}));const e=document.createElement("div");e.className="replace-part",e.appendChild(this._replaceInput.domNode);const s=document.createElement("div");s.className="replace-actions",e.appendChild(s),s.appendChild(this._replaceBtn.domNode),s.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new u4({label:X2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}})),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=V2,this._domNode.role="dialog",this._domNode.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(e),this._resizeSash=new AB(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=s4;this._register(this._resizeSash.onDidStart((()=>{n=Jl(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<s4||i>(parseFloat(zl(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=Jl(this._domNode);if(t<s4)return;let i=s4;if(!this._resized||t===s4){const t=this._codeEditor.getLayoutInfo();i=t.width-28-t.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}a4.ID="editor.contrib.findWidget";class u4 extends Yy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+go.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.title=this._opts.label,this._domNode.tabIndex=0,this._domNode.className=i,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this.onclick(this._domNode,(t=>{this._opts.onTrigger(),t.preventDefault()})),this.onkeydown(this._domNode,(t=>{var i,e;if(t.equals(10)||t.equals(3))return this._opts.onTrigger(),void t.preventDefault();null===(e=(i=this._opts).onKeyDown)||void 0===e||e.call(i,t)}))}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(t){this._domNode.classList.toggle("disabled",!t),this._domNode.setAttribute("aria-disabled",String(!t)),this._domNode.tabIndex=t?0:-1}setExpanded(t){this._domNode.setAttribute("aria-expanded",String(!!t)),t?(this._domNode.classList.remove(...go.asClassNameArray(P2)),this._domNode.classList.add(...go.asClassNameArray(N2))):(this._domNode.classList.remove(...go.asClassNameArray(N2)),this._domNode.classList.add(...go.asClassNameArray(P2)))}}Vk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(fv)),e(".currentFindMatch",t.getColor(dv)),e(".findScope",t.getColor(gv)),e(".find-widget",t.getColor(Zw));const s=t.getColor(nw);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(rw);n&&i.addRule(`.monaco-editor .find-widget { border-left: 1px solid ${n}; border-right: 1px solid ${n}; border-bottom: 1px solid ${n}; }`);const r=t.getColor(mv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Ey(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(pv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(wv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${Ey(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(iw);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Jw);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const a=t.getColor(Ym);a&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${a}; }`);const u=t.getColor(Yw);if(u)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${u}; }`);else{const e=t.getColor(Qw);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(yb);d&&i.addRule(`\n\t\t.monaco-editor .find-widget .button:not(.disabled):hover,\n\t\t.monaco-editor .find-widget .codicon-find-selection:hover {\n\t\t\tbackground-color: ${d} !important;\n\t\t}\n\t`);const f=t.getColor(tw);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var d4,f4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},g4=function(t,i){return function(e,s){i(e,s,t)}};function p4(t,i="single",e=!1){if(!t.hasModel())return null;const s=t.getSelection();if("single"===i&&s.startLineNumber===s.endLineNumber||"multiple"===i)if(s.isEmpty()){const i=t.getConfiguredWordAtPosition(s.getStartPosition());if(i&&!1===e)return i.word}else if(t.getModel().getValueLengthInRange(s)<524288)return t.getModel().getValueInRange(s);return null}let m4=d4=class extends Ki{get editor(){return this._editor}static get(t){return t.getContribution(d4.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=J1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new Yh(500),this._state=this._register(new v2),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._model=null,this._register(this._editor.onDidChangeModel((()=>{const t=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),t&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})})))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(t){this.saveQueryState(t),t.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),t.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(t){t.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),t.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),t.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),t.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!Q1.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){const t=this._editor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}setSearchString(t){this._state.isRegex&&(t=$n(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}async _start(t,i){if(this.disposeModel(),!this._editor.hasModel())return;const e={...i,isRevealed:!0};if("single"===t.seedSearchStringFromSelection){const i=p4(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?$n(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=p4(this._editor,t.seedSearchStringFromSelection);i&&(e.searchString=i)}if(!e.searchString&&t.seedSearchStringFromGlobalClipboard){const t=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;t&&(e.searchString=t)}if(t.forceRevealReplace||e.isReplaceRevealed?e.isReplaceRevealed=!0:this._findWidgetVisible.get()||(e.isReplaceRevealed=!1),t.updateSearchScope){const t=this._editor.getSelections();t.some((t=>!t.isEmpty()))&&(e.searchScope=t)}e.loop=t.loop,this._state.change(e,!1),this._model||(this._model=new p2(this._editor,this._state))}start(t,i){return this._start(t,i)}moveToNextMatch(){return!!this._model&&(this._model.moveToNextMatch(),!0)}moveToPrevMatch(){return!!this._model&&(this._model.moveToPrevMatch(),!0)}goToMatch(t){return!!this._model&&(this._model.moveToMatch(t),!0)}replace(){return!!this._model&&(this._model.replace(),!0)}replaceAll(){var t;return!!this._model&&((null===(t=this._editor.getModel())||void 0===t?void 0:t.isTooLargeForHeapOperation())?(this._notificationService.warn(Q(0,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0))}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(t){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};m4.ID="editor.contrib.findController",m4=d4=f4([g4(1,th),g4(2,aN),g4(3,nH),g4(4,VF)],m4);let w4=class extends m4{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h,r),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._widget=null,this._findOptionsWidget=null}async _start(t,i){this._widget||this._createFindWidget();const e=this._editor.getSelection();let s=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":s=!0;break;case"never":s=!1;break;case"multiline":s=!!e&&e.startLineNumber!==e.endLineNumber}t.updateSearchScope=t.updateSearchScope||s,await super._start(t,i),this._widget&&(2===t.shouldFocus?this._widget.focusReplaceInput():1===t.shouldFocus&&this._widget.focusFindInput())}highlightFindOptions(t=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!t?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new a4(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new m2(this._editor,this._state,this._keybindingService))}};w4=f4([g4(1,KO),g4(2,th),g4(3,HC),g4(4,Nk),g4(5,VF),g4(6,aN),g4(7,nH)],w4),tu(new Za({id:"actions.find",label:Q(0,"Find"),alias:"Find",precondition:Oo.or(PS.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"3_find",title:Q(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=m4.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})}));const v4={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},regex:{type:"boolean"},regexOverride:{type:"number",description:Q(0,'Overrides "Use Regular Expression" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},wholeWord:{type:"boolean"},wholeWordOverride:{type:"number",description:Q(0,'Overrides "Match Whole Word" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},matchCase:{type:"boolean"},matchCaseOverride:{type:"number",description:Q(0,'Overrides "Math Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},preserveCase:{type:"boolean"},preserveCaseOverride:{type:"number",description:Q(0,'Overrides "Preserve Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},findInSelection:{type:"boolean"}}}}]};class b4 extends Ga{async run(t,i){const e=m4.get(i);e&&!this._run(e)&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===e.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(e))}}class y4 extends Ga{async run(t,i){const e=m4.get(i);if(!e)return;const s=p4(i,"single",!1);s&&e.setSearchString(s),this._run(e)||(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(e))}}tu(new Za({id:"editor.action.startFindReplaceAction",label:Q(0,"Replace"),alias:"Replace",precondition:Oo.or(PS.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"3_find",title:Q(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=m4.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(41).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(41).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})})),iu(m4.ID,w4,0),Xa(class extends Ga{constructor(){super({id:"editor.actions.findWithArgs",label:Q(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:v4})}async run(t,i,e){const s=m4.get(i);if(s){const t=e?{searchString:e.searchString,replaceString:e.replaceString,isReplaceRevealed:void 0!==e.replaceString,isRegex:e.isRegex,wholeWord:e.matchWholeWord,matchCase:e.isCaseSensitive,preserveCase:e.preserveCase}:{};await s.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===s.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(41).loop},t),s.setGlobalBufferTerm(s.getState().searchString)}}}),Xa(class extends Ga{constructor(){super({id:"actions.findWithSelection",label:Q(0,"Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(t,i){const e=m4.get(i);e&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),e.setGlobalBufferTerm(e.getState().searchString))}}),Xa(class extends b4{constructor(){super({id:n2,label:Q(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:PS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Oo.and(PS.focus,Q1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),Xa(class extends b4{constructor(){super({id:r2,label:Q(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:PS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Oo.and(PS.focus,Q1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToMatchFindAction",label:Q(0,"Go to Match..."),alias:"Go to Match...",precondition:J1}),this._highlightDecorations=[]}run(t,i,e){const s=m4.get(i);if(!s)return;const n=s.getState().matchesCount;if(n<1)return void t.get(VF).notify({severity:jF.Warning,message:Q(0,"No matches. Try searching for something else.")});const r=t.get(mj).createInputBox();r.placeholder=Q(0,"Type a number to go to a specific match (between 1 and {0})",n);const o=t=>{const i=parseInt(t);if(isNaN(i))return;const e=s.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},h=t=>{const e=o(t);if("number"==typeof e){r.validationMessage=void 0,s.goToMatch(e);const t=s.getState().currentMatch;t&&this.addDecorations(i,t)}else r.validationMessage=Q(0,"Please type a number between 1 and {0}",s.getState().matchesCount),this.clearDecorations(i)};r.onDidChangeValue((t=>{h(t)})),r.onDidAccept((()=>{const t=o(r.value);"number"==typeof t?(s.goToMatch(t),r.hide()):r.validationMessage=Q(0,"Please type a number between 1 and {0}",s.getState().matchesCount)})),r.onDidHide((()=>{this.clearDecorations(i),r.dispose()})),r.show()}clearDecorations(t){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])}))}addDecorations(t,i){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[{range:i,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Bk(mC),position:bf.Full}}}])}))}}),Xa(class extends y4{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:Q(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),Xa(class extends y4{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:Q(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const k4=qa.bindToContribution(m4.get);Ya(new k4({id:o2,precondition:J1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:9,secondary:[1033]}})),Ya(new k4({id:h2,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:PS.focus,primary:X1.primary,mac:X1.mac,win:X1.win,linux:X1.linux}})),Ya(new k4({id:c2,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:PS.focus,primary:t2.primary,mac:t2.mac,win:t2.win,linux:t2.linux}})),Ya(new k4({id:l2,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:PS.focus,primary:i2.primary,mac:i2.mac,win:i2.win,linux:i2.linux}})),Ya(new k4({id:a2,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:PS.focus,primary:e2.primary,mac:e2.mac,win:e2.win,linux:e2.linux}})),Ya(new k4({id:u2,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:PS.focus,primary:s2.primary,mac:s2.mac,win:s2.win,linux:s2.linux}})),Ya(new k4({id:d2,precondition:J1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:PS.focus,primary:3094}})),Ya(new k4({id:d2,precondition:J1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Y1),primary:3}})),Ya(new k4({id:f2,precondition:J1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:PS.focus,primary:2563}})),Ya(new k4({id:f2,precondition:J1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Y1),primary:void 0,mac:{primary:2051}}})),Ya(new k4({id:"editor.action.selectAllMatches",precondition:J1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:PS.focus,primary:515}}));const C4={0:" ",1:"u",2:"r"},S4=16777215,x4=4278190080;class D4{constructor(t){const i=Math.ceil(t/32);this._states=new Uint32Array(i)}get(t){return 0!=(this._states[t/32|0]&1<<t%32)}set(t,i){const e=t/32|0,s=t%32,n=this._states[e];this._states[e]=i?n|1<<s:n&~(1<<s)}}class E4{constructor(t,i,e){if(t.length!==i.length||t.length>65535)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=t,this._endIndexes=i,this._collapseStates=new D4(t.length),this._userDefinedStates=new D4(t.length),this._recoveredStates=new D4(t.length),this._types=e,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const t=[],i=(i,e)=>{const s=t[t.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=e};for(let e=0,s=this._startIndexes.length;e<s;e++){const s=this._startIndexes[e],n=this._endIndexes[e];if(s>S4||n>S4)throw new Error("startLineNumber or endLineNumber must not exceed "+S4);for(;t.length>0&&!i(s,n);)t.pop();const r=t.length>0?t[t.length-1]:-1;t.push(e),this._startIndexes[e]=s+((255&r)<<24),this._endIndexes[e]=n+((65280&r)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(t){return this._startIndexes[t]&S4}getEndLineNumber(t){return this._endIndexes[t]&S4}getType(t){return this._types?this._types[t]:void 0}hasTypes(){return!!this._types}isCollapsed(t){return this._collapseStates.get(t)}setCollapsed(t,i){this._collapseStates.set(t,i)}isUserDefined(t){return this._userDefinedStates.get(t)}setUserDefined(t,i){return this._userDefinedStates.set(t,i)}isRecovered(t){return this._recoveredStates.get(t)}setRecovered(t,i){return this._recoveredStates.set(t,i)}getSource(t){return this.isUserDefined(t)?1:this.isRecovered(t)?2:0}setSource(t,i){1===i?(this.setUserDefined(t,!0),this.setRecovered(t,!1)):2===i?(this.setUserDefined(t,!1),this.setRecovered(t,!0)):(this.setUserDefined(t,!1),this.setRecovered(t,!1))}setCollapsedAllOfType(t,i){let e=!1;if(this._types)for(let s=0;s<this._types.length;s++)this._types[s]===t&&(this.setCollapsed(s,i),e=!0);return e}toRegion(t){return new A4(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&x4)>>>24)+((this._endIndexes[t]&x4)>>>16);return 65535===i?-1:i}contains(t,i){return this.getStartLineNumber(t)<=i&&this.getEndLineNumber(t)>=i}findIndex(t){let i=0,e=this._startIndexes.length;if(0===e)return-1;for(;i<e;){const s=Math.floor((i+e)/2);t<this.getStartLineNumber(s)?e=s:i=s+1}return i-1}findRange(t){let i=this.findIndex(t);if(i>=0){if(this.getEndLineNumber(i)>=t)return i;for(i=this.getParentIndex(i);-1!==i;){if(this.contains(i,t))return i;i=this.getParentIndex(i)}}return-1}toString(){const t=[];for(let i=0;i<this.length;i++)t[i]=`[${C4[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&S4,endLineNumber:this._endIndexes[t]&S4,type:this._types?this._types[t]:void 0,isCollapsed:this.isCollapsed(t),source:this.getSource(t)}}static fromFoldRanges(t){const i=t.length,e=new Uint32Array(i),s=new Uint32Array(i);let n=[],r=!1;for(let o=0;o<i;o++){const i=t[o];e[o]=i.startLineNumber,s[o]=i.endLineNumber,n.push(i.type),i.type&&(r=!0)}r||(n=void 0);const o=new E4(e,s,n);for(let e=0;e<i;e++)t[e].isCollapsed&&o.setCollapsed(e,!0),o.setSource(e,t[e].source);return o}static sanitizeAndMerge(t,i,e){e=null!=e?e:Number.MAX_VALUE;const s=(t,i)=>Array.isArray(t)?e=>e<i?t[e]:void 0:e=>e<i?t.toFoldRange(e):void 0,n=s(t,t.length),r=s(i,i.length);let o=0,h=0,c=n(0),l=r(0);const a=[];let u,d=0;const f=[];for(;c||l;){let t;if(l&&(!c||c.startLineNumber>=l.startLineNumber))c&&c.startLineNumber===l.startLineNumber?(1===l.source?t=l:(t=c,t.isCollapsed=l.isCollapsed&&c.endLineNumber===l.endLineNumber,t.source=0),c=n(++o)):(t=l,l.isCollapsed&&0===l.source&&(t.source=2)),l=r(++h);else{let i=h,e=l;for(;;){if(!e||e.startLineNumber>c.endLineNumber){t=c;break}if(1===e.source&&e.endLineNumber>c.endLineNumber)break;e=r(++i)}c=n(++o)}if(t){for(;u&&u.endLineNumber<t.startLineNumber;)u=a.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!u||u.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,u&&a.push(u),u=t)}}return f}}class A4{constructor(t,i){this.ranges=t,this.index=i}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(t){return t.startLineNumber<=this.startLineNumber&&t.endLineNumber>=this.endLineNumber}containsLine(t){return this.startLineNumber<=t&&t<=this.endLineNumber}}class M4{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ne,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new E4(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(t){if(!t.length)return;t=t.sort(((t,i)=>t.regionIndex-i.regionIndex));const i={};this._decorationProvider.changeDecorations((e=>{let s=0,n=-1,r=-1;const o=t=>{for(;s<t;){const t=this._regions.getEndLineNumber(s),i=this._regions.isCollapsed(s);if(t<=n){const n=0!==this.regions.getSource(s);e.changeDecorationOptions(this._editorDecorationIds[s],this._decorationProvider.getDecorationOption(i,t<=r,n))}i&&t>r&&(r=t),s++}};for(const e of t){const t=e.regionIndex,s=this._editorDecorationIds[t];if(s&&!i[s]){i[s]=!0,o(t);const e=!this._regions.isCollapsed(t);this._regions.setCollapsed(t,e),n=Math.max(n,this._regions.getEndLineNumber(t))}}o(this._regions.length)})),this._updateEventEmitter.fire({model:this,collapseStateChanged:t})}removeManualRanges(t){const i=new Array,e=i=>{for(const e of t)if(!(e.startLineNumber>i.endLineNumber||i.startLineNumber>e.endLineNumber))return!0;return!1};for(let t=0;t<this._regions.length;t++){const s=this._regions.toFoldRange(t);0!==s.source&&e(s)||i.push(s)}this.updatePost(E4.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=E4.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(E4.fromFoldRanges(s))}updatePost(t){const i=[];let e=-1;for(let s=0,n=t.length;s<n;s++){const n=t.getStartLineNumber(s),r=t.getEndLineNumber(s),o=t.isCollapsed(s),h=0!==t.getSource(s),c={startLineNumber:n,startColumn:this._textModel.getLineMaxColumn(n),endLineNumber:r,endColumn:this._textModel.getLineMaxColumn(r)+1};i.push({range:c,options:this._decorationProvider.getDecorationOption(o,r<=e,h)}),o&&r>e&&(e=r)}this._decorationProvider.changeDecorations((t=>this._editorDecorationIds=t.deltaDecorations(this._editorDecorationIds,i))),this._regions=t,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(t=[]){const i=(i,e)=>{for(const s of t)if(i<s&&s<=e)return!0;return!1},e=[];for(let t=0,s=this._regions.length;t<s;t++){let s=this.regions.isCollapsed(t);const n=this.regions.getSource(t);if(s||0!==n){const r=this._regions.toFoldRange(t),o=this._textModel.getDecorationRange(this._editorDecorationIds[t]);o&&(s&&i(o.startLineNumber,o.endLineNumber)&&(s=!1),e.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,type:r.type,isCollapsed:s,source:n}))}}return e}getMemento(){const t=this._currentFoldedOrManualRanges(),i=[],e=this._textModel.getLineCount();for(let s=0,n=t.length;s<n;s++){const n=t[s];if(n.startLineNumber>=n.endLineNumber||n.startLineNumber<1||n.endLineNumber>e)continue;const r=this._getLinesChecksum(n.startLineNumber+1,n.endLineNumber);i.push({startLineNumber:n.startLineNumber,endLineNumber:n.endLineNumber,isCollapsed:n.isCollapsed,source:n.source,checksum:r})}return i.length>0?i:void 0}applyMemento(t){var i,e;if(!Array.isArray(t))return;const s=[],n=this._textModel.getLineCount();for(const r of t){if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>n)continue;const t=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);r.checksum&&t!==r.checksum||s.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,type:void 0,isCollapsed:null===(i=r.isCollapsed)||void 0===i||i,source:null!==(e=r.source)&&void 0!==e?e:0})}const r=E4.sanitizeAndMerge(this._regions,s,n);this.updatePost(E4.fromFoldRanges(r))}_getLinesChecksum(t,i){return bl(this._textModel.getLineContent(t)+this._textModel.getLineContent(i))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(t,i){const e=[];if(this._regions){let s=this._regions.findRange(t),n=1;for(;s>=0;){const t=this._regions.toRegion(s);i&&!i(t,n)||e.push(t),n++,s=t.parentIndex}}return e}getRegionAtLine(t){if(this._regions){const i=this._regions.findRange(t);if(i>=0)return this._regions.toRegion(i)}return null}getRegionsInside(t,i){const e=[],s=t?t.regionIndex+1:0,n=t?t.endLineNumber:Number.MAX_VALUE;if(i&&2===i.length){const t=[];for(let r=s,o=this._regions.length;r<o;r++){const s=this._regions.toRegion(r);if(!(this._regions.getStartLineNumber(r)<n))break;for(;t.length>0&&!s.containedBy(t[t.length-1]);)t.pop();t.push(s),i(s,t.length)&&e.push(s)}}else for(let t=s,r=this._regions.length;t<r;t++){const s=this._regions.toRegion(t);if(!(this._regions.getStartLineNumber(t)<n))break;i&&!i(s)||e.push(s)}return e}}function L4(t,i,e){const s=[];for(const n of e){const e=t.getRegionAtLine(n);if(e){const n=!e.isCollapsed;if(s.push(e),i>1){const r=t.getRegionsInside(e,((t,e)=>t.isCollapsed!==n&&e<i));s.push(...r)}}}t.toggleCollapseState(s)}function F4(t,i,e=Number.MAX_VALUE,s){const n=[];if(s&&s.length>0)for(const r of s){const s=t.getRegionAtLine(r);if(s&&(s.isCollapsed!==i&&n.push(s),e>1)){const r=t.getRegionsInside(s,((t,s)=>t.isCollapsed!==i&&s<e));n.push(...r)}}else{const s=t.getRegionsInside(null,((t,s)=>t.isCollapsed!==i&&s<e));n.push(...s)}t.toggleCollapseState(n)}function T4(t,i,e,s){const n=[];for(const r of s){const s=t.getAllRegionsAtLine(r,((t,s)=>t.isCollapsed!==i&&s<=e));n.push(...s)}t.toggleCollapseState(n)}function R4(t,i,e){const s=[];for(const i of e){const e=t.getAllRegionsAtLine(i,void 0);e.length>0&&s.push(e[0])}const n=t.getRegionsInside(null,(t=>s.every((i=>!i.containedBy(t)&&!t.containedBy(i)))&&t.isCollapsed!==i));t.toggleCollapseState(n)}function O4(t,i,e){const s=t.textModel,n=t.regions,r=[];for(let t=n.length-1;t>=0;t--)if(e!==n.isCollapsed(t)){const e=n.getStartLineNumber(t);i.test(s.getLineContent(e))&&r.push(n.toRegion(t))}t.toggleCollapseState(r)}function _4(t,i,e){const s=t.regions,n=[];for(let t=s.length-1;t>=0;t--)e!==s.isCollapsed(t)&&i===s.getType(t)&&n.push(s.toRegion(t));t.toggleCollapseState(n)}class I4{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ne,this._hasLineChanges=!1,this._foldingModel=t,this._foldingModelListener=t.onDidChange((()=>this.updateHiddenRanges())),this._hiddenRanges=[],t.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(t){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=t.changes.some((t=>t.range.endLineNumber!==t.range.startLineNumber||0!==TD(t.text)[0])))}updateHiddenRanges(){let t=!1;const i=[];let e=0,s=0,n=Number.MAX_VALUE,r=-1;const o=this._foldingModel.regions;for(;e<o.length;e++){if(!o.isCollapsed(e))continue;const h=o.getStartLineNumber(e)+1,c=o.getEndLineNumber(e);n<=h&&c<=r||(!t&&s<this._hiddenRanges.length&&this._hiddenRanges[s].startLineNumber===h&&this._hiddenRanges[s].endLineNumber===c?(i.push(this._hiddenRanges[s]),s++):(t=!0,i.push(new bs(h,1,c,1))),n=h,r=c)}(this._hasLineChanges||t||s<this._hiddenRanges.length)&&this.applyHiddenRanges(i)}applyHiddenRanges(t){this._hiddenRanges=t,this._hasLineChanges=!1,this._updateEventEmitter.fire(t)}hasRanges(){return this._hiddenRanges.length>0}isHidden(t){return null!==P4(this._hiddenRanges,t)}adjustSelections(t){let i=!1;const e=this._foldingModel.textModel;let s=null;const n=t=>(s&&function(t,i){return t>=i.startLineNumber&&t<=i.endLineNumber}(t,s)||(s=P4(this._hiddenRanges,t)),s?s.startLineNumber-1:null);for(let s=0,r=t.length;s<r;s++){let r=t[s];const o=n(r.startLineNumber);o&&(r=r.setStartPosition(o,e.getLineMaxColumn(o)),i=!0);const h=n(r.endLineNumber);h&&(r=r.setEndPosition(h,e.getLineMaxColumn(h)),i=!0),t[s]=r}return i}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function P4(t,i){const e=qf(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class N4{constructor(t,i,e){this.editorModel=t,this.languageConfigurationService=i,this.foldingRangesLimit=e,this.id="indent"}dispose(){}compute(t){const i=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules;return Promise.resolve(function(t,i,e,s=$4){const n=t.getOptions().tabSize,r=new B4(s);let o;e&&(o=new RegExp(`(${e.start.source})|(?:${e.end.source})`));const h=[],c=t.getLineCount()+1;h.push({indent:-1,endAbove:c,line:c});for(let e=t.getLineCount();e>0;e--){const s=t.getLineContent(e),c=mx(s,n);let l,a=h[h.length-1];if(-1!==c){if(o&&(l=s.match(o))){if(!l[1]){h.push({indent:-2,endAbove:e,line:e});continue}{let t=h.length-1;for(;t>0&&-2!==h[t].indent;)t--;if(t>0){h.length=t+1,a=h[t],r.insertFirst(e,a.line,c),a.line=e,a.indent=c,a.endAbove=e;continue}}}if(a.indent>c){do{h.pop(),a=h[h.length-1]}while(a.indent>c);const t=a.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}a.indent===c?a.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(a.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class B4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>S4||i>S4)return;const s=this._length;this._startIndexes[s]=t,this._endIndexes[s]=i,this._length++,e<1e3&&(this._indentOccurrences[e]=(this._indentOccurrences[e]||0)+1)}toIndentRanges(t){const i=this._foldingRangesLimit.limit;if(this._length<=i){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let e=this._length-1,s=0;e>=0;e--,s++)t[s]=this._startIndexes[e],i[s]=this._endIndexes[e];return new E4(t,i)}{this._foldingRangesLimit.update(this._length,i);let e=0,s=this._indentOccurrences.length;for(let t=0;t<this._indentOccurrences.length;t++){const n=this._indentOccurrences[t];if(n){if(n+e>i){s=t;break}e+=n}}const n=t.getOptions().tabSize,r=new Uint32Array(i),o=new Uint32Array(i);for(let h=this._length-1,c=0;h>=0;h--){const l=this._startIndexes[h],a=mx(t.getLineContent(l),n);(a<s||a===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new E4(r,o)}}}const $4={limit:5e3,update:()=>{}},W4=Jm("editor.foldBackground",{light:Gb(cv,.3),dark:Gb(cv,.3),hcDark:null,hcLight:null},Q(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);Jm("editorGutter.foldingControlForeground",{dark:Xm,light:Xm,hcDark:Xm,hcLight:Xm},Q(0,"Color of the folding control in the editor gutter."));const j4=AV("folding-expanded",xs.chevronDown,Q(0,"Icon for expanded ranges in the editor glyph margin.")),V4=AV("folding-collapsed",xs.chevronRight,Q(0,"Icon for collapsed ranges in the editor glyph margin.")),H4=AV("folding-manual-collapsed",V4,Q(0,"Icon for manually collapsed ranges in the editor glyph margin.")),z4=AV("folding-manual-expanded",j4,Q(0,"Icon for manually expanded ranges in the editor glyph margin.")),U4={color:Bk(W4),position:kf.Inline};class K4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?K4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?K4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:K4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:K4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?K4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:K4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?K4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:K4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?K4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:K4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?K4.MANUALLY_EXPANDED_VISUAL_DECORATION:K4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}K4.COLLAPSED_VISUAL_DECORATION=aL.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:go.asClassName(V4)}),K4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=aL.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(V4)}),K4.MANUALLY_COLLAPSED_VISUAL_DECORATION=aL.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:go.asClassName(H4)}),K4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=aL.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(H4)}),K4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),K4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0}),K4.EXPANDED_VISUAL_DECORATION=aL.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+go.asClassName(j4)}),K4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=aL.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(j4)}),K4.MANUALLY_EXPANDED_VISUAL_DECORATION=aL.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+go.asClassName(z4)}),K4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=aL.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(z4)}),K4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),K4.HIDDEN_RANGE_DECORATION=aL.register({description:"folding-hidden-range-decoration",stickiness:1});const q4={};class G4{constructor(t,i,e,s,n){this.editorModel=t,this.providers=i,this.handleFoldingRangesChange=e,this.foldingRangesLimit=s,this.fallbackRangeProvider=n,this.id="syntax",this.disposables=new Ui,n&&this.disposables.add(n);for(const t of i)"function"==typeof t.onDidChange&&this.disposables.add(t.onDidChange(e))}compute(t){return function(t,i,e){let s=null;const n=t.map(((t,n)=>Promise.resolve(t.provideFoldingRanges(i,q4,e)).then((t=>{if(!e.isCancellationRequested&&Array.isArray(t)){Array.isArray(s)||(s=[]);const e=i.getLineCount();for(const i of t)i.start>0&&i.end>i.start&&i.end<=e&&s.push({start:i.start,end:i.end,rank:n,kind:i.kind})}}),Fi)));return Promise.all(n).then((()=>s))}(this.providers,this.editorModel,t).then((i=>{var e,s;return i?function(t,i){const e=t.sort(((t,i)=>{let e=t.start-i.start;return 0===e&&(e=t.rank-i.rank),e})),s=new Z4(i);let n;const r=[];for(const t of e)if(n){if(t.start>n.start)if(t.end<=n.end)r.push(n),n=t,s.add(t.start,t.end,t.kind&&t.kind.value,r.length);else{if(t.start>n.end){do{n=r.pop()}while(n&&t.start>n.end);n&&r.push(n),n=t}s.add(t.start,t.end,t.kind&&t.kind.value,r.length)}}else n=t,s.add(t.start,t.end,t.kind&&t.kind.value,r.length);return s.toIndentRanges()}(i,this.foldingRangesLimit):null!==(s=null===(e=this.fallbackRangeProvider)||void 0===e?void 0:e.compute(t))&&void 0!==s?s:null}))}dispose(){this.disposables.dispose()}}class Z4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=t}add(t,i,e,s){if(t>S4||i>S4)return;const n=this._length;this._startIndexes[n]=t,this._endIndexes[n]=i,this._nestingLevels[n]=s,this._types[n]=e,this._length++,s<30&&(this._nestingLevelCounts[s]=(this._nestingLevelCounts[s]||0)+1)}toIndentRanges(){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let e=0;e<this._length;e++)t[e]=this._startIndexes[e],i[e]=this._endIndexes[e];return new E4(t,i,this._types)}{this._foldingRangesLimit.update(this._length,t);let i=0,e=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){const n=this._nestingLevelCounts[s];if(n){if(n+i>t){e=s;break}i+=n}}const s=new Uint32Array(t),n=new Uint32Array(t),r=[];for(let o=0,h=0;o<this._length;o++){const c=this._nestingLevels[o];(c<e||c===e&&i++<t)&&(s[h]=this._startIndexes[o],n[h]=this._endIndexes[o],r[h]=this._types[o],h++)}return new E4(s,n,r)}}}var J4,Q4=function(t,i){return function(e,s){i(e,s,t)}};const Y4=new Xo("foldingEnabled",!1);let X4=J4=class extends Ki{static get(t){return t.getContribution(J4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=J4._foldingRangeSelector)||void 0===e?void 0:e.call(J4,n,i))&&void 0!==s?s:n}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Ui),this.editor=t,this._foldingLimitReporter=new t5(t);const o=this.editor.getOptions();this._isEnabled=o.get(43),this._useFoldingProviders="indentation"!==o.get(44),this._unfoldOnClickAfterEndOfLine=o.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(46),this.updateDebounceInfo=n.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new K4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=Y4.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(47)&&this.onModelChanged(),t.hasChanged(109)||t.hasChanged(45)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(109),this.foldingDecorationProvider.showFoldingHighlights=t.get(45),this.triggerFoldingModelChanged()}t.hasChanged(44)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(44),this.onFoldingStrategyChanged()),t.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),t.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))}))),this.onModelChanged()}saveViewState(){const t=this.editor.getModel();if(!t||!this._isEnabled||t.isTooLargeForTokenization())return{};if(this.foldingModel){const i=this.foldingModel.getMemento(),e=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:i,lineCount:t.getLineCount(),provider:e,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(t){const i=this.editor.getModel();if(i&&this._isEnabled&&!i.isTooLargeForTokenization()&&this.hiddenRangeModel&&t&&(this._currentModelHasFoldedImports=!!t.foldedImports,t.collapsedRegions&&t.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(t.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const t=this.editor.getModel();this._isEnabled&&t&&!t.isTooLargeForTokenization()&&(this._currentModelHasFoldedImports=!1,this.foldingModel=new M4(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new I4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new Yh(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new rc((()=>this.revealCursor()),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelContent((t=>this.onDidChangeModelContent(t)))),this.localToDispose.add(this.editor.onDidChangeCursorPosition((()=>this.onCursorPositionChanged()))),this.localToDispose.add(this.editor.onMouseDown((t=>this.onEditorMouseDown(t)))),this.localToDispose.add(this.editor.onMouseUp((t=>this.onEditorMouseUp(t)))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),null===(t=this.updateScheduler)||void 0===t||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,null===(i=this.rangeProvider)||void 0===i||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var t;null===(t=this.rangeProvider)||void 0===t||t.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(t){if(this.rangeProvider)return this.rangeProvider;const i=new N4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=J4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new G4(t,e,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,i))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(t){var i;null===(i=this.hiddenRangeModel)||void 0===i||i.notifyChangeModelContent(t),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger((()=>{const t=this.foldingModel;if(!t)return null;const i=new Yi,e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=Zh((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Bs.Imports.value,!0);t&&(s=$z.capture(this.editor),this._currentModelHasFoldedImports=t)}const n=this.editor.getSelections(),r=n?n.map((t=>t.startLineNumber)):[];t.update(e,r),null==s||s.restore(this.editor);const o=this.updateDebounceInfo.update(t.textModel,i.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=o)}return t}))})).then(void 0,(t=>(Li(t),null))))}onHiddenRangesChanges(t){if(this.hiddenRangeModel&&t.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(t,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const t=this.getFoldingModel();t&&t.then((t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const e=[];for(const s of i){const i=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(i)&&e.push(...t.getAllRegionsAtLine(i,(t=>t.isCollapsed&&i>t.startLineNumber)))}e.length&&(t.toggleCollapseState(e),this.reveal(i[0].getPosition()))}}})).then(void 0,Li)}onEditorMouseDown(t){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!t.target||!t.target.range)return;if(!t.event.leftButton&&!t.event.middleButton)return;const i=t.target.range;let e=!1;switch(t.target.type){case 4:if(t.target.detail.offsetX-t.target.element.offsetLeft<4)return;e=!0;break;case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!t.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){const t=this.editor.getModel();if(t&&i.startColumn===t.getLineMaxColumn(i.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:i.startLineNumber,iconClicked:e}}onEditorMouseUp(t){const i=this.foldingModel;if(!i||!this.mouseDownInfo||!t.target)return;const e=this.mouseDownInfo.lineNumber,s=this.mouseDownInfo.iconClicked,n=t.target.range;if(!n||n.startLineNumber!==e)return;if(s){if(4!==t.target.type)return}else{const t=this.editor.getModel();if(!t||n.startColumn!==t.getLineMaxColumn(e))return}const r=i.getRegionAtLine(e);if(r&&r.startLineNumber===e){const n=r.isCollapsed;if(s||n){let s=[];if(t.event.altKey){const t=i.getRegionsInside(null,(t=>!t.containedBy(r)&&!r.containedBy(t)));for(const i of t)i.isCollapsed&&s.push(i);0===s.length&&(s=t)}else{const e=t.event.middleButton||t.event.shiftKey;if(e)for(const t of i.getRegionsInside(r))t.isCollapsed===n&&s.push(t);!n&&e&&0!==s.length||s.push(r)}i.toggleCollapseState(s),this.reveal({lineNumber:e,column:1})}}}reveal(t){this.editor.revealPositionInCenterIfOutsideViewport(t,0)}};X4.ID="editor.contrib.folding",X4=J4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q4(1,th),Q4(2,Nd),Q4(3,VF),Q4(4,YT),Q4(5,op)],X4);class t5{constructor(t){this.editor=t,this._onDidChange=new ne,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class i5 extends Ga{runEditorCommand(t,i,e){const s=t.get(Nd),n=X4.get(i);if(!n)return;const r=n.getFoldingModel();return r?(this.reportTelemetry(t,i),r.then((t=>{if(t){this.invoke(n,t,i,e,s);const r=i.getSelection();r&&n.reveal(r.getStartPosition())}}))):void 0}getSelectedLines(t){const i=t.getSelections();return i?i.map((t=>t.startLineNumber)):[]}getLineNumbers(t,i){return t&&t.selectionLines?t.selectionLines.map((t=>t+1)):this.getSelectedLines(i)}run(t,i){}}function e5(t){if(!I(t)){if(!F(t))return!1;const i=t;if(!I(i.levels)&&!R(i.levels))return!1;if(!I(i.direction)&&!L(i.direction))return!1;if(!(I(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(R)))return!1}return!0}class s5 extends i5{getFoldingLevel(){return parseInt(this.id.substr(s5.ID_PREFIX.length))}invoke(t,i,e){!function(t,i,e,s){const n=t.getRegionsInside(null,((t,e)=>e===i&&true!==t.isCollapsed&&!s.some((i=>t.containsLine(i)))));t.toggleCollapseState(n)}(i,this.getFoldingLevel(),0,this.getSelectedLines(e))}}s5.ID_PREFIX="editor.foldLevel",s5.ID=t=>s5.ID_PREFIX+t,iu(X4.ID,X4,0),Xa(class extends i5{constructor(){super({id:"editor.unfold",label:Q(0,"Unfold"),alias:"Unfold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t* 'levels': Number of levels to unfold. If not set, defaults to 1.\n\t\t\t\t\t\t* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.\n\t\t\t\t\t\t* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t",constraint:e5,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(t,i,e,s){const n=s&&s.levels||1,r=this.getLineNumbers(s,e);s&&"up"===s.direction?T4(i,!1,n,r):F4(i,!1,n,r)}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldRecursively",label:Q(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2142),weight:100}})}invoke(t,i,e,s){F4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.fold",label:Q(0,"Fold"),alias:"Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t\t* 'levels': Number of levels to fold.\n\t\t\t\t\t\t\t* 'direction': If 'up', folds given number of levels up otherwise folds down.\n\t\t\t\t\t\t\t* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t\tIf no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.\n\t\t\t\t\t\t",constraint:e5,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(t,i,e,s){const n=this.getLineNumbers(s,e),r=s&&s.levels,o=s&&s.direction;"number"!=typeof r&&"string"!=typeof o?function(t,i,e){const s=[];for(const i of e){const e=t.getAllRegionsAtLine(i,(t=>true!==t.isCollapsed));e.length>0&&s.push(e[0])}t.toggleCollapseState(s)}(i,0,n):"up"===o?T4(i,!0,r||1,n):F4(i,!0,r||1,n)}}),Xa(class extends i5{constructor(){super({id:"editor.foldRecursively",label:Q(0,"Fold Recursively"),alias:"Fold Recursively",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);F4(i,!0,Number.MAX_VALUE,s)}}),Xa(class extends i5{constructor(){super({id:"editor.foldAll",label:Q(0,"Fold All"),alias:"Fold All",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2069),weight:100}})}invoke(t,i,e){F4(i,!0)}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAll",label:Q(0,"Unfold All"),alias:"Unfold All",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2088),weight:100}})}invoke(t,i,e){F4(i,!1)}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllBlockComments",label:Q(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&O4(i,new RegExp("^\\s*"+$n(s.blockCommentStartToken)),!0)}}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllMarkerRegions",label:Q(0,"Fold All Regions"),alias:"Fold All Regions",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&O4(i,new RegExp(s.markers.start),!0)}}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:Q(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&O4(i,new RegExp(s.markers.start),!1)}}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllExcept",label:Q(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2136),weight:100}})}invoke(t,i,e){R4(i,!0,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAllExcept",label:Q(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2134),weight:100}})}invoke(t,i,e){R4(i,!1,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.toggleFold",label:Q(0,"Toggle Fold"),alias:"Toggle Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2090),weight:100}})}invoke(t,i,e){L4(i,1,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.gotoParentFold",label:Q(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=null;const s=i.getRegionAtLine(t);if(null!==s&&(e=s.startLineNumber,t===e)){const t=s.parentIndex;e=-1!==t?i.regions.getStartLineNumber(t):null}return e}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.gotoPreviousFold",label:Q(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=i.getRegionAtLine(t);if(null!==e&&e.startLineNumber===t){if(t!==e.startLineNumber)return e.startLineNumber;{const t=e.parentIndex;let s=0;for(-1!==t&&(s=i.regions.getStartLineNumber(e.parentIndex));null!==e;){if(!(e.regionIndex>0))return null;if(e=i.regions.toRegion(e.regionIndex-1),e.startLineNumber<=s)return null;if(e.parentIndex===t)return e.startLineNumber}}}else if(i.regions.length>0)for(e=i.regions.toRegion(i.regions.length-1);null!==e;){if(e.startLineNumber<t)return e.startLineNumber;e=e.regionIndex>0?i.regions.toRegion(e.regionIndex-1):null}return null}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.gotoNextFold",label:Q(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=i.getRegionAtLine(t);if(null!==e&&e.startLineNumber===t){const t=e.parentIndex;let s=0;if(-1!==t)s=i.regions.getEndLineNumber(e.parentIndex);else{if(0===i.regions.length)return null;s=i.regions.getEndLineNumber(i.regions.length-1)}for(;null!==e;){if(!(e.regionIndex<i.regions.length))return null;if(e=i.regions.toRegion(e.regionIndex+1),e.startLineNumber>=s)return null;if(e.parentIndex===t)return e.startLineNumber}}else if(i.regions.length>0)for(e=i.regions.toRegion(0);null!==e;){if(e.startLineNumber>t)return e.startLineNumber;e=e.regionIndex<i.regions.length?i.regions.toRegion(e.regionIndex+1):null}return null}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:Q(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2135),weight:100}})}invoke(t,i,e){var s;const n=[],r=e.getSelections();if(r){for(const t of r){let i=t.endLineNumber;1===t.endColumn&&--i,i>t.startLineNumber&&(n.push({startLineNumber:t.startLineNumber,endLineNumber:i,type:void 0,isCollapsed:!0,source:1}),e.setSelection({startLineNumber:t.startLineNumber,startColumn:1,endLineNumber:t.startLineNumber,endColumn:1}))}if(n.length>0){n.sort(((t,i)=>t.startLineNumber-i.startLineNumber));const t=E4.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(E4.fromFoldRanges(t))}}}}),Xa(class extends i5{constructor(){super({id:"editor.removeManualFoldingRanges",label:Q(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2137),weight:100}})}invoke(t,i,e){const s=e.getSelections();if(s){const e=[];for(const t of s){const{startLineNumber:i,endLineNumber:s}=t;e.push(s>=i?{startLineNumber:i,endLineNumber:s}:{endLineNumber:s,startLineNumber:i})}i.removeManualRanges(e),t.triggerFoldingModelChanged()}}});for(let t=1;t<=7;t++)n5=new s5({id:s5.ID(t),label:Q(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2048|21+t),weight:100}}),su.INSTANCE.registerEditorAction(n5);var n5;mo.registerCommand("_executeFoldingRangeProvider",(async function(t,...i){const[e]=i;if(!(e instanceof hs))throw Ii();const s=t.get(op),n=t.get(no).getModel(e);if(!n)throw Ii();const r=t.get(rd);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(Nd),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new N4(n,o,c);let a=l;if("indentation"!==h){const t=X4.getFoldingRangeProviders(s,n);t.length&&(a=new G4(n,t,(()=>{}),c,l))}const u=await a.compute(fe.None),d=[];try{if(u)for(let t=0;t<u.length;t++){const i=u.getType(t);d.push({start:u.getStartLineNumber(t),end:u.getEndLineNumber(t),kind:i?Bs.fromValue(i):void 0})}return d}finally{a.dispose()}})),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomIn",label:Q(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Gr.setZoomLevel(Gr.getZoomLevel()+1)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomOut",label:Q(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Gr.setZoomLevel(Gr.getZoomLevel()-1)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomReset",label:Q(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Gr.setZoomLevel(0)}});var r5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},o5=function(t,i){return function(e,s){i(e,s,t)}};let h5=class{constructor(t,i,e,s){this._editor=t,this._languageFeaturesService=i,this._workerService=e,this._accessibleNotificationService=s,this._disposables=new Ui,this._sessionDisposables=new Ui,this._disposables.add(i.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(56)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56))return;if(!this._editor.hasModel())return;const t=this._editor.getModel(),[i]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(t);if(!i||!i.autoFormatTriggerCharacters)return;const e=new af;for(const t of i.autoFormatTriggerCharacters)e.add(t.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType((t=>{const i=t.charCodeAt(t.length-1);e.has(i)&&this._trigger(String.fromCharCode(i))})))}_trigger(t){if(!this._editor.hasModel())return;if(this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const i=this._editor.getModel(),e=this._editor.getPosition(),s=new pe,n=this._editor.onDidChangeModelContent((t=>{if(t.isFlush)return s.cancel(),void n.dispose();for(let i=0,r=t.changes.length;i<r;i++)if(t.changes[i].range.endLineNumber<=e.lineNumber)return s.cancel(),void n.dispose()}));kq(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||u(t)&&(this._accessibleNotificationService.notify("format",!1),dq.execute(this._editor,t,!0))})).finally((()=>{n.dispose()}))}};h5.ID="editor.contrib.autoFormat",h5=r5([o5(1,op),o5(2,iB),o5(3,Im)],h5);let c5=class{constructor(t,i,e){this.editor=t,this._languageFeaturesService=i,this._instantiationService=e,this._callOnDispose=new Ui,this._callOnModel=new Ui,this._callOnDispose.add(t.onDidChangeConfiguration((()=>this._update()))),this._callOnDispose.add(t.onDidChangeModel((()=>this._update()))),this._callOnDispose.add(t.onDidChangeModelLanguage((()=>this._update()))),this._callOnDispose.add(i.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste((({range:t})=>this._trigger(t))))}_trigger(t){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(wq,this.editor,t,2,xO.None,fe.None,!1).catch(Li))}};c5.ID="editor.contrib.formatOnPaste",c5=r5([o5(1,op),o5(2,io)],c5),iu(h5.ID,h5,2),iu(c5.ID,c5,2),Xa(class extends Ga{constructor(){super({id:"editor.action.formatDocument",label:Q(0,"Format Document"),alias:"Format Document",precondition:Oo.and(PS.notInCompositeEditor,PS.writable,PS.hasDocumentFormattingProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(t,i){if(i.hasModel()){const e=t.get(io),s=t.get(DO);await s.showWhile(e.invokeFunction(bq,i,1,xO.None,fe.None,!0),250)}}}),Xa(class extends Ga{constructor(){super({id:"editor.action.formatSelection",label:Q(0,"Format Selection"),alias:"Format Selection",precondition:Oo.and(PS.writable,PS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2084),weight:100},contextMenuOpts:{when:PS.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(t,i){if(!i.hasModel())return;const e=t.get(io),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new bs(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(DO);await r.showWhile(e.invokeFunction(wq,i,n,1,xO.None,fe.None,!0),250)}}),mo.registerCommand("editor.action.format",(async t=>{const i=t.get(so).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(po);i.getSelection().isEmpty()?await e.executeCommand("editor.action.formatDocument"):await e.executeCommand("editor.action.formatSelection")}));var l5=function(t,i){return function(e,s){i(e,s,t)}};class a5{remove(){var t;null===(t=this.parent)||void 0===t||t.children.delete(this.id)}static findId(t,i){let e;"string"==typeof t?e=`${i.id}/${t}`:(e=`${i.id}/${t.name}`,void 0!==i.children.get(e)&&(e=`${i.id}/${t.name}_${t.range.startLineNumber}_${t.range.startColumn}`));let s=e;for(let t=0;void 0!==i.children.get(s);t++)s=`${e}_${t}`;return s}static empty(t){return 0===t.children.size}}class u5 extends a5{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class d5 extends a5{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class f5 extends a5{static create(t,i,s){const n=new pe(s),r=new f5(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=a5.findId(`provider_${e}`,r),h=new d5(o,r,null!==(s=t.displayName)&&void 0!==s?s:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,n.token)).then((t=>{for(const i of t||[])f5._makeOutlineElement(i,h);return h}),(t=>(Fi(t),h))).then((t=>{a5.empty(t)?t.remove():r._groups.set(o,t)}))})),c=t.onDidChange((()=>{e(t.ordered(i),o)||n.cancel()}));return Promise.all(h).then((()=>n.token.isCancellationRequested&&!s.isCancellationRequested?f5.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=a5.findId(t,i),s=new u5(e,i,t);if(t.children)for(const i of t.children)f5._makeOutlineElement(i,s);i.children.set(s.id,s)}constructor(t){super(),this.uri=t,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let t=0;for(const[i,e]of this._groups)0===e.children.size?this._groups.delete(i):t+=1;if(1!==t)this.children=this._groups;else{const t=It.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const t=[];for(const i of this.children.values())i instanceof u5?t.push(i.symbol):t.push(...It.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return f5._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>vs.compare(bs.getStartPosition(t.range),bs.getStartPosition(i.range))||vs.compare(bs.getEndPosition(i.range),bs.getEndPosition(t.range))))}static _flattenDocumentSymbols(t,i,e){for(const s of i)t.push({kind:s.kind,tags:s.tags,name:s.name,detail:s.detail,containerName:s.containerName||e,range:s.range,selectionRange:s.selectionRange,children:void 0}),s.children&&f5._flattenDocumentSymbols(t,s.children,s.name)}}const g5=eo("IOutlineModelService");let p5=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Ui,this._cache=new Mg(10,.7),this._debounceInformation=i.for(t.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(e.onModelRemoved((t=>{this._cache.delete(t.id)})))}dispose(){this._disposables.dispose()}async getOrCreate(t,i){const s=this._languageFeaturesService.documentSymbolProvider,n=s.ordered(t);let r=this._cache.get(t.id);if(!r||r.versionId!==t.getVersionId()||!e(r.provider,n)){const i=new pe;r={versionId:t.getVersionId(),provider:n,promiseCnt:0,source:i,promise:f5.create(s,t,i.token),model:void 0},this._cache.set(t.id,r);const e=Date.now();r.promise.then((i=>{r.model=i,this._debounceInformation.update(t,Date.now()-e)})).catch((()=>{this._cache.delete(t.id)}))}if(r.model)return r.model;r.promiseCnt+=1;const o=i.onCancellationRequested((()=>{0==--r.promiseCnt&&(r.source.cancel(),this._cache.delete(t.id))}));try{return await r.promise}finally{o.dispose()}}};p5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([l5(0,op),l5(1,YT),l5(2,no)],p5),gd(g5,p5,1),mo.registerCommand("_executeDocumentSymbolProvider",(async function(t,...i){const[e]=i;B(hs.isUri(e));const s=t.get(g5),n=t.get(ro),r=await n.createModelReference(e);try{return(await s.getOrCreate(r.object.textEditorModel,fe.None)).getTopLevelSymbols()}finally{r.dispose()}}));class m5 extends Ki{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=m5.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=m5.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=m5.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=m5.suppressSuggestions.bindTo(this.contextKeyService),this._register(xz((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t),s=!!(null==e?void 0:e.inlineCompletion)&&void 0!==(null==e?void 0:e.ghostText)&&!(null==e?void 0:e.ghostText.isEmpty());this.inlineCompletionVisible.set(s),(null==e?void 0:e.ghostText)&&(null==e?void 0:e.inlineCompletion)&&this.suppressSuggestions.set(e.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(xz((t=>{const i=this.model.read(t);let e=!1,s=!0;const n=null==i?void 0:i.ghostText.read(t);if((null==i?void 0:i.selectedSuggestItem)&&n&&n.parts.length>0){const{column:t,lines:r}=n.parts[0],o=r[0];if(t<=i.textModel.getLineIndentColumn(n.lineNumber)){let t=Un(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=Ny.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}m5.inlineSuggestionVisible=new Xo("inlineSuggestionVisible",!1,Q(0,"Whether an inline suggestion is visible")),m5.inlineSuggestionHasIndentation=new Xo("inlineSuggestionHasIndentation",!1,Q(0,"Whether the inline suggestion starts with whitespace")),m5.inlineSuggestionHasIndentationLessThanTabSize=new Xo("inlineSuggestionHasIndentationLessThanTabSize",!0,Q(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),m5.suppressSuggestions=new Xo("inlineSuggestionSuppressSuggestions",void 0,Q(0,"Whether suggestions should be suppressed for the current suggestion"));class w5{constructor(t){this.lineStartOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let i=0;i<t.length;i++)"\n"===t.charAt(i)&&this.lineStartOffsetByLineIdx.push(i+1)}getOffset(t){return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}}const v5=[];class b5{constructor(t,i){if(this.startColumn=t,this.endColumnExclusive=i,t>i)throw new $i(`startColumn ${t} cannot be after endColumnExclusive ${i}`)}toRange(t){return new bs(t,this.startColumn,t,this.endColumnExclusive)}equals(t){return this.startColumn===t.startColumn&&this.endColumnExclusive===t.endColumnExclusive}}function y5(t,i){return new vs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function k5(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new vs(i,e)}class C5{constructor(t,i){this.lineNumber=t,this.parts=i}equals(t){return this.lineNumber===t.lineNumber&&this.parts.length===t.parts.length&&this.parts.every(((i,e)=>i.equals(t.parts[e])))}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new w5(t),s=i.map((t=>{const i=bs.lift(t.range);return{startOffset:e.getOffset(i.getStartPosition()),endOffset:e.getOffset(i.getEndPosition()),text:t.text}}));s.sort(((t,i)=>i.startOffset-t.startOffset));for(const i of s)t=t.substring(0,i.startOffset)+i.text+t.substring(i.endOffset);return t}(t.substr(0,this.parts[this.parts.length-1].column-1),this.parts.map((t=>({range:{startLineNumber:1,endLineNumber:1,startColumn:t.column,endColumn:t.column},text:t.lines.join("\n")}))));return i.substring(this.parts[0].column-1)}isEmpty(){return this.parts.every((t=>0===t.lines.length))}get lineCount(){return 1+this.parts.reduce(((t,i)=>t+i.lines.length-1),0)}}class S5{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}equals(t){return this.column===t.column&&this.lines.length===t.lines.length&&this.lines.every(((i,e)=>i===t.lines[e]))}}class x5{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new S5(this.columnRange.endColumnExclusive,this.newLines,!1)]}renderForScreenReader(t){return this.newLines.join("\n")}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every((t=>0===t.lines.length))}equals(t){return this.lineNumber===t.lineNumber&&this.columnRange.equals(t.columnRange)&&this.newLines.length===t.newLines.length&&this.newLines.every(((i,e)=>i===t.newLines[e]))&&this.additionalReservedLineCount===t.additionalReservedLineCount}}function D5(t,i){return t===i||!(!t||!i)&&(t instanceof C5&&i instanceof C5||t instanceof x5&&i instanceof x5)&&t.equals(i)}const E5="ghost-text";let A5=class extends Ki{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=gz(this,!1),this.currentTextModel=Tz(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=bz(this,(t=>{if(this.isDisposed.read(t))return;const i=this.currentTextModel.read(t);if(i!==this.model.targetTextModel.read(t))return;const e=this.model.ghostText.read(t);if(!e)return;const s=e instanceof x5?e.columnRange:void 0,n=[],r=[];function o(t,i){if(r.length>0){const e=r[r.length-1];i&&e.decorations.push(new xp(e.content.length+1,e.content.length+1+t[0].length,i,0)),e.content+=t[0],t=t.slice(1)}for(const e of t)r.push({content:e,decorations:i?[new xp(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,l=0;for(const t of e.parts){let i=t.lines;void 0===c?(n.push({column:t.column,text:i[0],preview:t.preview}),i=i.slice(1)):o([h.substring(l,t.column-1)],void 0),i.length>0&&(o(i,E5),void 0===c&&t.column<=h.length&&(c=t.column)),l=t.column-1}void 0!==c&&o([h.substring(l)],void 0);const a=void 0!==c?new b5(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:a,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=bz(this,(t=>{const i=this.uiState.read(t);if(!i)return[];const e=[];i.replacedRange&&e.push({range:i.replacedRange.toRange(i.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),i.hiddenRange&&e.push({range:i.hiddenRange.toRange(i.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const t of i.inlineTexts)e.push({range:bs.fromPositions(new vs(i.lineNumber,t.column)),options:{description:E5,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Cf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new M5(this.editor,this.languageService.languageIdCodec,bz((t=>{const i=this.uiState.read(t);return i?{lineNumber:i.lineNumber,additionalLines:i.additionalLines,minReservedLineCount:i.additionalReservedLineCount,targetTextModel:i.targetTextModel}:void 0})))),this._register(zi((()=>{this.isDisposed.set(!0,void 0)}))),this._register(function(t,i){const e=new Ui,s=t.createDecorationsCollection();return e.add(Dz({debugName:()=>`Apply decorations from ${i.debugName}`},(t=>{const e=i.read(t);s.set(e)}))),e.add({dispose:()=>{s.clear()}}),e}(this.editor,this.decorations))}ownsViewZone(t){return this.additionalLinesWidget.viewZoneId===t}};A5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,ud)],A5);class M5 extends Ki{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=Oz("editorOptionChanged",Xi.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(33)||t.hasChanged(116)||t.hasChanged(98)||t.hasChanged(93)||t.hasChanged(51)||t.hasChanged(50)||t.hasChanged(66)))),this._register(xz((t=>{const i=this.lines.read(t);this.editorOptionsChanged.read(t),i?this.updateLines(i.lineNumber,i.additionalLines,i.minReservedLineCount):this.clear()})))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones((t=>{this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0)}))}updateLines(t,i,e){const s=this.editor.getModel();if(!s)return;const{tabSize:n}=s.getOptions();this.editor.changeViewZones((s=>{this._viewZoneId&&(s.removeZone(this._viewZoneId),this._viewZoneId=void 0);const r=Math.max(i.length,e);if(r>0){const e=document.createElement("div");!function(t,i,e,s,n){const r=s.get(33),o=s.get(116),h=s.get(93),c=s.get(51),l=s.get(50),a=s.get(66),u=new Uu(1e4);u.appendString('<div class="suggest-preview-text">');for(let t=0,s=e.length;t<s;t++){const s=e[t],d=s.content;u.appendString('<div class="view-line'),u.appendString('" style="top:'),u.appendString(String(t*a)),u.appendString('px;width:1000000px;">');const f=mr(d),g=gr(d),p=Cp.createEmpty(d,n);_p(new Fp(l.isMonospace&&!r,l.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,o,"none",h,c!==li.OFF,null),u),u.appendString("</div>")}u.appendString("</div>"),Ur(t,l);const d=u.build(),f=L5?L5.createHTML(d):d;t.innerHTML=f}(e,n,i,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=s.addZone({afterLineNumber:t,heightInLines:r,domNode:e,afterColumnAffinity:1})}}))}}const L5=bu("editorGhostText",{createHTML:t=>t});class F5{constructor(t){this.lines=t,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(t){return this.lines[t-1].getLineContent().length}}class T5{constructor(){this.value="",this.pos=0}static isDigitCharacter(t){return t>=48&&t<=57}static isVariableCharacter(t){return 95===t||t>=97&&t<=122||t>=65&&t<=90}text(t){this.value=t,this.pos=0}tokenText(t){return this.value.substr(t.pos,t.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const t=this.pos;let i,e=0,s=this.value.charCodeAt(t);if(i=T5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(T5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(T5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(T5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(T5.isVariableCharacter(s)||T5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}i=10;do{e+=1,s=this.value.charCodeAt(t+e)}while(!isNaN(s)&&void 0===T5._table[s]&&!T5.isDigitCharacter(s)&&!T5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}T5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class R5{constructor(){this._children=[]}appendChild(t){return t instanceof O5&&this._children[this._children.length-1]instanceof O5?this._children[this._children.length-1].value+=t.value:(t.parent=this,this._children.push(t)),this}replace(t,i){const{parent:e}=t,s=e.children.indexOf(t),n=e.children.slice(0);n.splice(s,1,...i),e._children=n,function t(i,e){for(const s of i)s.parent=e,t(s.children,s)}(i,e)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let t=this;for(;;){if(!t)return;if(t instanceof j5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class O5 extends R5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new O5(this.value)}}class _5 extends R5{}class I5 extends _5{static compareByIndex(t,i){return t.index===i.index?0:t.isFinalTabstop?1:i.isFinalTabstop||t.index<i.index?-1:t.index>i.index?1:0}constructor(t){super(),this.index=t}get isFinalTabstop(){return 0===this.index}get choice(){return 1===this._children.length&&this._children[0]instanceof P5?this._children[0]:void 0}clone(){const t=new I5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class P5 extends R5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof O5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new P5;return this.options.forEach(t.appendChild,t),t}}class N5 extends R5{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(t){const i=this;let e=!1,s=t.replace(this.regexp,(function(){return e=!0,i._replace(Array.prototype.slice.call(arguments,0,-2))}));return!e&&this._children.some((t=>t instanceof B5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof B5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new N5;return t.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),t._children=this.children.map((t=>t.clone())),t}}class B5 extends R5{constructor(t,i,e,s){super(),this.index=t,this.shorthandName=i,this.ifValue=e,this.elseValue=s}resolve(t){return"upcase"===this.shorthandName?t?t.toLocaleUpperCase():"":"downcase"===this.shorthandName?t?t.toLocaleLowerCase():"":"capitalize"===this.shorthandName?t?t[0].toLocaleUpperCase()+t.substr(1):"":"pascalcase"===this.shorthandName?t?this._toPascalCase(t):"":"camelcase"===this.shorthandName?t?this._toCamelCase(t):"":Boolean(t)&&"string"==typeof this.ifValue?this.ifValue:Boolean(t)||"string"!=typeof this.elseValue?t||"":this.elseValue}_toPascalCase(t){const i=t.match(/[a-z0-9]+/gi);return i?i.map((t=>t.charAt(0).toUpperCase()+t.substr(1))).join(""):t}_toCamelCase(t){const i=t.match(/[a-z0-9]+/gi);return i?i.map(((t,i)=>0===i?t.charAt(0).toLowerCase()+t.substr(1):t.charAt(0).toUpperCase()+t.substr(1))).join(""):t}clone(){return new B5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class $5 extends _5{constructor(t){super(),this.name=t}resolve(t){let i=t.resolve(this);return this.transform&&(i=this.transform.resolve(i||"")),void 0!==i&&(this._children=[new O5(i)],!0)}clone(){const t=new $5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function W5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class j5 extends R5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof I5&&(t.push(e),i=!i||i.index<e.index?e:i),!0})),this._placeholders={all:t,last:i}}return this._placeholders}get placeholders(){const{all:t}=this.placeholderInfo;return t}offset(t){let i=0,e=!1;return this.walk((s=>s===t?(e=!0,!1):(i+=s.len(),!0))),e?i:-1}fullLen(t){let i=0;return W5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof I5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof $5&&i.resolve(t)&&(this._placeholders=void 0),!0))),this}appendChild(t){return this._placeholders=void 0,super.appendChild(t)}replace(t,i){return this._placeholders=void 0,super.replace(t,i)}clone(){const t=new j5;return this._children=this.children.map((t=>t.clone())),t}walk(t){W5(this.children,t)}}class V5{constructor(){this._scanner=new T5,this._token={type:14,pos:0,len:0}}static escape(t){return t.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(t){return/\${?CLIPBOARD/.test(t)}parse(t,i,e){const s=new j5;return this.parseFragment(t,s),this.ensureFinalTabstop(s,null!=e&&e,null!=i&&i),s}parseFragment(t,i){const e=i.children.length;for(this._scanner.text(t),this._token=this._scanner.next();this._parse(i););const s=new Map,n=[];i.walk((t=>(t instanceof I5&&(t.isFinalTabstop?s.set(0,void 0):!s.has(t.index)&&t.children.length>0?s.set(t.index,t.children):n.push(t)),!0)));const r=(t,e)=>{const n=s.get(t.index);if(!n)return;const o=new I5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof I5&&s.has(i.index)&&!e.has(i.index)&&(e.add(i.index),r(i,e),e.delete(i.index))}i.replace(t,[o])},o=new Set;for(const t of n)r(t,o);return i.children.slice(e)}ensureFinalTabstop(t,i,e){if(i||e&&t.placeholders.length>0){const i=t.placeholders.find((t=>0===t.index));i||t.appendChild(new I5(0))}}_accept(t,i){if(void 0===t||this._token.type===t){const t=!i||this._scanner.tokenText(this._token);return this._token=this._scanner.next(),t}return!1}_backTo(t){return this._scanner.pos=t.pos+t.len,this._token=t,!1}_until(t){const i=this._token;for(;this._token.type!==t;){if(14===this._token.type)return!1;if(5===this._token.type){const t=this._scanner.next();if(0!==t.type&&4!==t.type&&5!==t.type)return!1}this._token=this._scanner.next()}const e=this._scanner.value.substring(i.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),e}_parse(t){return this._parseEscaped(t)||this._parseTabstopOrVariableName(t)||this._parseComplexPlaceholder(t)||this._parseComplexVariable(t)||this._parseAnything(t)}_parseEscaped(t){let i;return!!(i=this._accept(5,!0))&&(i=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||i,t.appendChild(new O5(i)),!0)}_parseTabstopOrVariableName(t){let i;const e=this._token;return this._accept(0)&&(i=this._accept(9,!0)||this._accept(8,!0))?(t.appendChild(/^\d+$/.test(i)?new I5(Number(i)):new $5(i)),!0):this._backTo(e)}_parseComplexPlaceholder(t){let i;const e=this._token;if(!(this._accept(0)&&this._accept(3)&&(i=this._accept(8,!0))))return this._backTo(e);const s=new I5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new O5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}else{if(!(s.index>0&&this._accept(7)))return this._accept(6)?this._parseTransform(s)?(t.appendChild(s),!0):(this._backTo(e),!1):this._accept(4)?(t.appendChild(s),!0):this._backTo(e);{const i=new P5;for(;;){if(this._parseChoiceElement(i)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(i),this._accept(4)))return t.appendChild(s),!0}return this._backTo(e),!1}}}}_parseChoiceElement(t){const i=this._token,e=[];for(;2!==this._token.type&&7!==this._token.type;){let t;if(t=(t=this._accept(5,!0))?this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||t:this._accept(void 0,!0),!t)return this._backTo(i),!1;e.push(t)}return 0===e.length?(this._backTo(i),!1):(t.appendChild(new O5(e.join(""))),!0)}_parseComplexVariable(t){let i;const e=this._token;if(!(this._accept(0)&&this._accept(3)&&(i=this._accept(9,!0))))return this._backTo(e);const s=new $5(i);if(!this._accept(1))return this._accept(6)?this._parseTransform(s)?(t.appendChild(s),!0):(this._backTo(e),!1):this._accept(4)?(t.appendChild(s),!0):this._backTo(e);for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new O5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new N5;let e="",s="";for(;!this._accept(6);){let t;if(t=this._accept(5,!0))t=this._accept(6,!0)||t,e+=t;else{if(14===this._token.type)return!1;e+=this._accept(void 0,!0)}}for(;!this._accept(6);){let t;if(t=this._accept(5,!0))t=this._accept(5,!0)||this._accept(6,!0)||t,i.appendChild(new O5(t));else if(!this._parseFormatString(i)&&!this._parseAnything(i))return!1}for(;!this._accept(4);){if(14===this._token.type)return!1;s+=this._accept(void 0,!0)}try{i.regexp=new RegExp(e,s)}catch(t){return!1}return t.transform=i,!0}_parseFormatString(t){const i=this._token;if(!this._accept(0))return!1;let e=!1;this._accept(3)&&(e=!0);const s=this._accept(8,!0);if(!s)return this._backTo(i),!1;if(!e)return t.appendChild(new B5(Number(s))),!0;if(this._accept(4))return t.appendChild(new B5(Number(s))),!0;if(!this._accept(1))return this._backTo(i),!1;if(this._accept(6)){const e=this._accept(9,!0);return e&&this._accept(4)?(t.appendChild(new B5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,void 0,i)),!0}else if(this._accept(13)){const i=this._until(1);if(i){const e=this._until(4);if(e)return t.appendChild(new B5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new O5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}async function H5(t,i,e,s,n=fe.None,r){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new bs(t.lineNumber,e.startColumn,t.lineNumber,s):bs.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=new Fg;for(const t of h)t.groupId&&c.add(t.groupId,t);function l(t){if(!t.yieldsToGroupIds)return[];const i=[];for(const e of t.yieldsToGroupIds||[]){const t=c.get(e);for(const e of t)i.push(e)}return i}const a=new Map,u=new Set;function d(t,i){if(i=[...i,t],u.has(t))return i;u.add(t);try{const e=l(t);for(const t of e){const e=d(t,i);if(e)return e}}finally{u.delete(t)}}function f(t){const r=a.get(t);if(r)return r;const o=d(t,[]);o&&Fi(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${o.map((t=>t.toString?t.toString():""+t)).join(" -> ")}`));const h=new ac;return a.set(t,h.p),(async()=>{if(!o){const i=l(t);for(const t of i){const i=await f(t);if(i&&i.items.length>0)return}}try{return await t.provideInlineCompletions(e,i,s,n)}catch(t){return void Fi(t)}})().then((t=>h.complete(t)),(t=>h.error(t))),h.p}const g=await Promise.all(h.map((async t=>({provider:t,completions:await f(t)})))),p=new Map,m=[];for(const t of g){const i=t.completions;if(!i)continue;const s=new U5(i,t.provider);m.push(s);for(const t of i.items){const i=K5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new z5(Array.from(p.values()),new Set(p.keys()),m)}class z5{constructor(t,i,e){this.completions=t,this.hashs=i,this.providerResults=e}has(t){return this.hashs.has(t.hash())}dispose(){for(const t of this.providerResults)t.removeRef()}}class U5{constructor(t,i){this.inlineCompletions=t,this.provider=i,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,0===this.refCount&&this.provider.freeInlineCompletions(this.inlineCompletions)}}class K5{static from(t,i,e,s,n){let r,o,h=t.range?bs.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=q5(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new bs(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+i))}o=void 0}else if("snippet"in t.insertText){const i=t.insertText.snippet.length;if(n&&t.completeBracketPairs){t.insertText.snippet=q5(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new bs(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new V5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof O5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else fh();return new K5(r,t.command,h,r,o,t.additionalTextEdits||v5,t,i)}constructor(t,i,e,s,n,r,o,h){this.filterText=t,this.command=i,this.range=e,this.insertText=s,this.snippetInfo=n,this.additionalTextEdits=r,this.sourceInlineCompletion=o,this.source=h,s=(t=t.replace(/\r\n|\r/g,"\n")).replace(/\r\n|\r/g,"\n")}withRange(t){return new K5(this.filterText,this.command,t,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}}function q5(t,i,e,s){const n=e.getLineContent(i.lineNumber).substring(0,i.column-1)+t,r=e.tokenization.tokenizeLineWithEdit(i,n.length-(i.column-1),t),o=null==r?void 0:r.sliceAndInflate(i.column-1,n.length,0);if(!o)return t;const h=function(t,i){const e=new eE,s=new yE(e,(t=>i.getLanguageConfiguration(t))),n=AE(new mE(new F5([t]),s),[],void 0,!0);let r="";const o=t.getLineContent();return function t(i,e){if(2===i.kind)if(t(i.openingBracket,e),e=jD(e,i.openingBracket.length),i.child&&(t(i.child,e),e=jD(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=jD(e,i.closingBracket.length);else{const t=s.getSingleLanguageBracketTokens(i.openingBracket.languageId).findClosingTokenText(i.openingBracket.bracketIds);r+=t}else if(3===i.kind);else if(0===i.kind||1===i.kind)r+=o.substring(e,jD(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=jD(e,s.length)}(n,PD),r}(o,s);return h}class G5{constructor(t,i){this.range=t,this.text=i}removeCommonPrefix(t,i){const e=i?this.range.intersectRanges(i):this.range;if(!e)return this;const s=t.getValueInRange(e,1),n=sr(s,this.text),r=y5(this.range.getStartPosition(),k5(s.substring(0,n))),o=this.text.substring(n),h=bs.fromPositions(r,this.range.getEndPosition());return new G5(h,o)}augments(t){return this.text.startsWith(t.text)&&(i=this.range,(e=t.range).getStartPosition().equals(i.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(i.getEndPosition()));var i,e}computeGhostText(t,i,e,s=0){let n=this.removeCommonPrefix(t);if(n.range.endLineNumber!==n.range.startLineNumber)return;const r=t.getLineContent(n.range.startLineNumber),o=Kn(r).length;if(n.range.startColumn-1<=o){const t=Kn(n.text).length,i=r.substring(n.range.startColumn-1,o),[e,s]=[n.range.getStartPosition(),n.range.getEndPosition()],h=e.column+i.length<=s.column?e.delta(0,i.length):s,c=bs.fromPositions(h,s),l=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new G5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==Z5?void 0:Z5.originalValue)===t&&(null==Z5?void 0:Z5.newValue)===i)return null==Z5?void 0:Z5.changes;{let e=Q5(t,i,!0);if(e){const s=J5(e);if(s>0){const n=Q5(t,i,!1);n&&J5(n)<s&&(e=n)}}return Z5={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const l=n.range.startLineNumber,a=new Array;if("prefix"===i){const t=c.filter((t=>0===t.originalLength));if(t.length>1||1===t.length&&t[0].originalStart!==h.length)return}const u=n.text.length-s;for(const t of c){const s=n.range.startColumn+t.originalStart+t.originalLength;if("subwordSmart"===i&&e&&e.lineNumber===n.range.startLineNumber&&s<e.column)return;if(t.originalLength>0)return;if(0===t.modifiedLength)continue;const r=t.modifiedStart+t.modifiedLength,o=Math.max(t.modifiedStart,Math.min(r,u)),h=n.text.substring(t.modifiedStart,o),c=n.text.substring(o,Math.max(t.modifiedStart,r));if(h.length>0){const t=zn(h);a.push(new S5(s,t,!1))}if(c.length>0){const t=zn(c);a.push(new S5(s,t,!0))}}return new C5(l,a)}}let Z5;function J5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function Q5(t,i,e){if(t.length>5e3||i.length>5e3)return;function s(t){let i=0;for(let e=0,s=t.length;e<s;e++){const s=t.charCodeAt(e);s>i&&(i=s)}return i}const n=Math.max(s(t),s(i));function r(t){if(t<0)throw new Error("unexpected");return n+t+1}function o(t){let i=0,s=0;const n=new Int32Array(t.length);for(let o=0,h=t.length;o<h;o++)e&&"("===t[o]?(n[o]=r(2*(100*s+i)),i++):e&&")"===t[o]?(i=Math.max(i-1,0),n[o]=r(2*(100*s+i)+1),0===i&&s++):n[o]=t.charCodeAt(o);return n}const h=o(t),c=o(i);return new ef({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var Y5=function(t,i){return function(e,s){i(e,s,t)}};let X5=class extends Ki{constructor(t,i,e,s,n){super(),this.textModel=t,this.versionId=i,this._debounceValue=e,this.languageFeaturesService=s,this.languageConfigurationService=n,this._updateOperation=this._register(new qi),this.inlineCompletions=mz("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=mz("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new t3(t,i,this.textModel.getVersionId()),o=i.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if(null===(s=this._updateOperation.value)||void 0===s?void 0:s.request.satisfies(r))return this._updateOperation.value.promise;if(null===(n=o.get())||void 0===n?void 0:n.request.satisfies(r))return Promise.resolve(!0);const h=!!this._updateOperation.value;this._updateOperation.clear();const c=new pe,l=(async()=>{var s;if((h||i.triggerKind===Fs.Automatic)&&await(s=this._debounceValue.get(this.textModel),new Promise((t=>{let i;setTimeout((()=>{i&&i.dispose(),t()}),s)}))),c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const n=new Date,l=await H5(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const a=new Date;this._debounceValue.update(this.textModel,a.getTime()-n.getTime());const u=new e3(l,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!l.has(i)&&u.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),nz((t=>{o.set(u,t)})),!0})(),a=new i3(r,c,l);return this._updateOperation.value=a,l}clear(t){this._updateOperation.clear(),this.inlineCompletions.set(void 0,t),this.suggestWidgetInlineCompletions.set(void 0,t)}clearSuggestWidgetInlineCompletions(t){var i;(null===(i=this._updateOperation.value)||void 0===i?void 0:i.request.context.selectedSuggestionInfo)&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,t)}cancelUpdate(){this._updateOperation.clear()}};X5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Y5(3,op),Y5(4,Nd)],X5);class t3{constructor(t,i,e){this.position=t,this.context=i,this.versionId=e}satisfies(t){return this.position.equals(t.position)&&(e=t.context.selectedSuggestionInfo,(i=this.context.selectedSuggestionInfo)&&e?((t,i)=>t.equals(i))(i,e):i===e)&&(t.context.triggerKind===Fs.Automatic||this.context.triggerKind===Fs.Explicit)&&this.versionId===t.versionId;var i,e}}class i3{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class e3{get inlineCompletions(){return this._inlineCompletions}constructor(t,i,e,s){this.inlineCompletionProviderResult=t,this.request=i,this.textModel=e,this.versionId=s,this._refCount=1,this._prependedInlineCompletionItems=[],this._rangeVersionIdValue=0,this._rangeVersionId=bz(this,(t=>{this.versionId.read(t);let i=!1;for(const t of this._inlineCompletions)i=i||t._updateRange(this.textModel);return i&&this._rangeVersionIdValue++,this._rangeVersionIdValue}));const n=e.deltaDecorations([],t.completions.map((t=>({range:t.range,options:{description:"inline-completion-tracking-range"}}))));this._inlineCompletions=t.completions.map(((t,i)=>new s3(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){setTimeout((()=>{this.textModel.isDisposed()||this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[])}),0),this.inlineCompletionProviderResult.dispose();for(const t of this._prependedInlineCompletionItems)t.source.removeRef()}}prepend(t,i,e){e&&t.source.addRef();const s=this.textModel.deltaDecorations([],[{range:i,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new s3(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class s3{get forwardStable(){var t;return null!==(t=this.inlineCompletion.source.inlineCompletions.enableForwardStability)&&void 0!==t&&t}constructor(t,i,e,s){this.inlineCompletion=t,this.decorationId=i,this.rangeVersion=e,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._isValid=!0,this._updatedRange=null!=s?s:t.range}toInlineCompletion(t){return this.inlineCompletion.withRange(this._getUpdatedRange(t))}toSingleTextEdit(t){return new G5(this._getUpdatedRange(t),this.inlineCompletion.insertText)}isVisible(t,i,e){const s=this._toFilterTextReplacement(e).removeCommonPrefix(t);if(!this._isValid||!this.inlineCompletion.range.getStartPosition().equals(this._getUpdatedRange(e).getStartPosition())||i.lineNumber!==s.range.startLineNumber)return!1;const n=t.getValueInRange(s.range,1),r=s.text,o=Math.max(0,i.column-s.range.startColumn);let h=r.substring(0,o),c=r.substring(o),l=n.substring(0,o),a=n.substring(o);const u=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=u&&(l=l.trimStart(),0===l.length&&(a=a.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(l)&&!!S_(a,c)}canBeReused(t,i){return this._isValid&&this._getUpdatedRange(void 0).containsPosition(i)&&this.isVisible(t,i,void 0)&&!this._isSmallerThanOriginal(void 0)}_toFilterTextReplacement(t){return new G5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return n3(this._getUpdatedRange(t)).isBefore(n3(this.inlineCompletion.range))}_getUpdatedRange(t){return this.rangeVersion.read(t),this._updatedRange}_updateRange(t){const i=t.getDecorationRange(this.decorationId);return i?!this._updatedRange.equalsRange(i)&&(this._updatedRange=i,!0):(this._isValid=!1,!0)}}function n3(t){return t.startLineNumber===t.endLineNumber?new vs(1,1+t.endColumn-t.startColumn):new vs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}const r3={Visible:D2,HasFocusedSuggestion:new Xo("suggestWidgetHasFocusedSuggestion",!1,Q(0,"Whether any suggestion is focused")),DetailsVisible:new Xo("suggestWidgetDetailsVisible",!1,Q(0,"Whether suggestion details are visible")),MultipleSuggestions:new Xo("suggestWidgetMultipleSuggestions",!1,Q(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Xo("suggestionMakesTextEdit",!0,Q(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Xo("acceptSuggestionOnEnter",!0,Q(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Xo("suggestionHasInsertAndReplaceRange",!1,Q(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Xo("suggestionInsertMode",void 0,{type:"string",description:Q(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Xo("suggestionCanResolve",!1,Q(0,"Whether the current suggestion supports to resolve further details"))},o3=new Sh("suggestWidgetStatusBar");class h3{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=rI.Default,this.distance=0,this.textLabel="string"==typeof i.label?i.label:null===(n=i.label)||void 0===n?void 0:n.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=i.sortText&&i.sortText.toLowerCase(),this.filterTextLow=i.filterText&&i.filterText.toLowerCase(),this.extensionId=i.extensionId,bs.isIRange(i.range)?(this.editStart=new vs(i.range.startLineNumber,i.range.startColumn),this.editInsertEnd=new vs(i.range.endLineNumber,i.range.endColumn),this.editReplaceEnd=new vs(i.range.endLineNumber,i.range.endColumn),this.isInvalid=this.isInvalid||bs.spansMultipleLines(i.range)||i.range.startLineNumber!==t.lineNumber):(this.editStart=new vs(i.range.insert.startLineNumber,i.range.insert.startColumn),this.editInsertEnd=new vs(i.range.insert.endLineNumber,i.range.insert.endColumn),this.editReplaceEnd=new vs(i.range.replace.endLineNumber,i.range.replace.endColumn),this.isInvalid=this.isInvalid||bs.spansMultipleLines(i.range.insert)||bs.spansMultipleLines(i.range.replace)||i.range.insert.startLineNumber!==t.lineNumber||i.range.replace.startLineNumber!==t.lineNumber||i.range.insert.startColumn!==i.range.replace.startColumn),"function"!=typeof s.resolveCompletionItem&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return void 0!==this._resolveDuration}get resolveDuration(){return void 0!==this._resolveDuration?this._resolveDuration:-1}async resolve(t){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._resolveDuration=void 0})),e=new Yi(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._resolveDuration=e.elapsed()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._resolveDuration=void 0)})).finally((()=>{i.dispose()}))}return this._resolveCache}}class c3{constructor(t=2,i=new Set,e=new Set,s=new Map,n=!0){this.snippetSortOrder=t,this.kindFilter=i,this.providerFilter=e,this.providerItemsToReuse=s,this.showDeprecated=n}}c3.default=new c3;class l3{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}async function a3(t,i,e,s=c3.default,n={triggerKind:0},r=fe.None){const o=new Yi;e=e.clone();const h=i.getWordAtPosition(e),c=h?new bs(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):bs.fromPositions(e),l={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},a=[],u=new Ui,d=[];let f=!1;const g=(t,i,n)=>{var r,o,h;let c=!1;if(!i)return c;for(const n of i.suggestions)if(!s.kindFilter.has(n.kind)){if(!s.showDeprecated&&(null===(r=null==n?void 0:n.tags)||void 0===r?void 0:r.includes(1)))continue;n.range||(n.range=l),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=V5.guessNeedsClipboard(n.insertText)),a.push(new h3(e,n,i,t)),c=!0}return ji(i)&&u.add(i),d.push({providerName:null!==(o=t._debugDisplayName)&&void 0!==o?o:"unknown_provider",elapsedProvider:null!==(h=i.duration)&&void 0!==h?h:-1,elapsedOverall:n.elapsed()}),c},p=(async()=>{})();for(const o of t.orderedGroups(i)){let t=!1;if(await Promise.all(o.map((async o=>{if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>a.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Yi,h=await o.provideCompletionItems(i,e,n,r);t=g(o,h,s)||t}catch(t){Fi(t)}}))),t||r.isCancellationRequested)break}return await p,r.isCancellationRequested?(u.dispose(),Promise.reject(new _i)):new l3(a.sort(d3.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},u)}function u3(t,i){if(t.sortTextLow&&i.sortTextLow){if(t.sortTextLow<i.sortTextLow)return-1;if(t.sortTextLow>i.sortTextLow)return 1}return t.textLabel<i.textLabel?-1:t.textLabel>i.textLabel?1:t.completion.kind-i.completion.kind}const d3=new Map;d3.set(0,(function(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return-1;if(27===i.completion.kind)return 1}return u3(t,i)})),d3.set(2,(function(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return u3(t,i)})),d3.set(1,u3),mo.registerCommand("_executeCompletionItemProvider",(async(t,...i)=>{const[e,s,n,r]=i;B(hs.isUri(e)),B(vs.isIPosition(s)),B("string"==typeof n||!n),B("number"==typeof r||!r);const{completionProvider:o}=t.get(op),h=await t.get(ro).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=await a3(o,h.object.textEditorModel,e,void 0,{triggerCharacter:null!=n?n:void 0,triggerKind:n?1:0});for(const e of c.items)i.length<(null!=r?r:0)&&i.push(e.resolve(fe.None)),t.incomplete=t.incomplete||e.container.incomplete,t.suggestions.push(e.completion);try{return await Promise.all(i),t}finally{setTimeout((()=>c.disposable.dispose()),100)}}finally{h.dispose()}}));class f3{static isAllOff(t){return"off"===t.other&&"off"===t.comments&&"off"===t.strings}static isAllOn(t){return"on"===t.other&&"on"===t.comments&&"on"===t.strings}static valueFor(t,i){switch(i){case 1:return t.comments;case 2:return t.strings;default:return t.other}}}function g3(t,i=gt){return function(t,i=gt){return!!i&&QE(t.charCodeAt(0))&&58===t.charCodeAt(1)}(t,i)?t.charAt(0).toUpperCase()+t.slice(1):t}Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,CURRENT_TIMEZONE_OFFSET:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_FILEPATH:!0,CURSOR_INDEX:!0,CURSOR_NUMBER:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0});class p3{constructor(t){this._delegates=t}resolve(t){for(const i of this._delegates){const e=i.resolve(t);if(void 0!==e)return e}}}class m3{constructor(t,i,e,s){this._model=t,this._selection=i,this._selectionIdx=e,this._overtypingCapturer=s}resolve(t){const{name:i}=t;if("SELECTION"===i||"TM_SELECTED_TEXT"===i){let i=this._model.getValueInRange(this._selection)||void 0,e=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const t=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);t&&(i=t.value,e=t.multiline)}if(i&&e&&t.snippet){const e=Kn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof O5&&(s=Kn(zn(i.value).pop())),!0)));const n=sr(s,e);i=i.replace(/(\r\n|\r|\n)(.*)/g,((t,i,e)=>`${i}${s.substr(n)}${e}`))}return i}if("TM_CURRENT_LINE"===i)return this._model.getLineContent(this._selection.positionLineNumber);if("TM_CURRENT_WORD"===i){const t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}return"TM_LINE_INDEX"===i?String(this._selection.positionLineNumber-1):"TM_LINE_NUMBER"===i?String(this._selection.positionLineNumber):"CURSOR_INDEX"===i?String(this._selectionIdx):"CURSOR_NUMBER"===i?String(this._selectionIdx+1):void 0}}class w3{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Ye(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Ye(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===Qe(this._model.uri.fsPath)?"":this._labelService.getUriLabel(nA(this._model.uri)):"TM_FILEPATH"===i?this._labelService.getUriLabel(this._model.uri):"RELATIVE_FILEPATH"===i?this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0}):void 0}}class v3{constructor(t,i,e,s){this._readClipboardText=t,this._selectionIdx=i,this._selectionCount=e,this._spread=s}resolve(t){if("CLIPBOARD"!==t.name)return;const i=this._readClipboardText();if(i){if(this._spread){const t=i.split(/\r\n|\n|\r/).filter((t=>!In(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let b3=class{constructor(t,i,e){this._model=t,this._selection=i,this._languageConfigurationService=e}resolve(t){const{name:i}=t,e=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),s=this._languageConfigurationService.getLanguageConfiguration(e).comments;if(s)return"LINE_COMMENT"===i?s.lineCommentToken||void 0:"BLOCK_COMMENT_START"===i?s.blockCommentStartToken||void 0:"BLOCK_COMMENT_END"===i&&s.blockCommentEndToken||void 0}};b3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,Nd)],b3);class y3{constructor(){this._date=new Date}resolve(t){const{name:i}=t;if("CURRENT_YEAR"===i)return String(this._date.getFullYear());if("CURRENT_YEAR_SHORT"===i)return String(this._date.getFullYear()).slice(-2);if("CURRENT_MONTH"===i)return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if("CURRENT_DATE"===i)return String(this._date.getDate().valueOf()).padStart(2,"0");if("CURRENT_HOUR"===i)return String(this._date.getHours().valueOf()).padStart(2,"0");if("CURRENT_MINUTE"===i)return String(this._date.getMinutes().valueOf()).padStart(2,"0");if("CURRENT_SECOND"===i)return String(this._date.getSeconds().valueOf()).padStart(2,"0");if("CURRENT_DAY_NAME"===i)return y3.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return y3.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return y3.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return y3.monthNamesShort[this._date.getMonth()];if("CURRENT_SECONDS_UNIX"===i)return String(Math.floor(this._date.getTime()/1e3));if("CURRENT_TIMEZONE_OFFSET"===i){const t=this._date.getTimezoneOffset(),i=t>0?"-":"+",e=Math.trunc(Math.abs(t/60)),s=e<10?"0"+e:e,n=Math.abs(t)-60*e;return i+s+":"+(n<10?"0"+n:n)}}}y3.dayNames=[Q(0,"Sunday"),Q(0,"Monday"),Q(0,"Tuesday"),Q(0,"Wednesday"),Q(0,"Thursday"),Q(0,"Friday"),Q(0,"Saturday")],y3.dayNamesShort=[Q(0,"Sun"),Q(0,"Mon"),Q(0,"Tue"),Q(0,"Wed"),Q(0,"Thu"),Q(0,"Fri"),Q(0,"Sat")],y3.monthNames=[Q(0,"January"),Q(0,"February"),Q(0,"March"),Q(0,"April"),Q(0,"May"),Q(0,"June"),Q(0,"July"),Q(0,"August"),Q(0,"September"),Q(0,"October"),Q(0,"November"),Q(0,"December")],y3.monthNamesShort=[Q(0,"Jan"),Q(0,"Feb"),Q(0,"Mar"),Q(0,"Apr"),Q(0,"May"),Q(0,"Jun"),Q(0,"Jul"),Q(0,"Aug"),Q(0,"Sep"),Q(0,"Oct"),Q(0,"Nov"),Q(0,"Dec")];class k3{constructor(t){this._workspaceService=t}resolve(t){if(!this._workspaceService)return;const i="string"==typeof(e=this._workspaceService.getWorkspace())||void 0===e?"string"==typeof e?{id:Ye(e)}:_O:e.configuration?{id:e.id,configPath:e.configuration}:1===e.folders.length?{id:e.id,uri:e.folders[0].uri}:{id:e.id};var e,s;return"string"!=typeof(null==(s=i)?void 0:s.id)||OO(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&hs.isUri(t.configPath)}(s)?"WORKSPACE_NAME"===t.name?this._resolveWorkspaceName(i):"WORKSPACE_FOLDER"===t.name?this._resoveWorkspacePath(i):void 0:void 0}_resolveWorkspaceName(t){if(OO(t))return Ye(t.uri.path);let i=Ye(t.configPath.path);return i.endsWith("code-workspace")&&(i=i.substr(0,i.length-14-1)),i}_resoveWorkspacePath(t){if(OO(t))return g3(t.uri.fsPath);const i=Ye(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?g3(e):"/"}}class C3{resolve(t){const{name:i}=t;return"RANDOM"===i?Math.random().toString().slice(-6):"RANDOM_HEX"===i?Math.random().toString(16).slice(-6):"UUID"===i?G0():void 0}}var S3;class x3{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,I5.compareByIndex),this._placeholderGroupsIdx=-1}initialize(t){this._offset=t.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(-1===this._offset)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const t=this._editor.getModel();this._editor.changeDecorations((i=>{for(const e of this._snippet.placeholders){const s=this._snippet.offset(e),n=this._snippet.fullLen(e),r=bs.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?x3._decor.inactiveFinal:x3._decor.inactive);this._placeholderDecorations.set(e,o)}}))}move(t){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const t=[];for(const i of this._placeholderGroups[this._placeholderGroupsIdx])if(i.transform){const e=this._placeholderDecorations.get(i),s=this._editor.getModel().getDecorationRange(e),n=this._editor.getModel().getValueInRange(s),r=i.transform.resolve(n).split(/\r\n|\r|\n/);for(let t=1;t<r.length;t++)r[t]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+r[t]);t.push(QR.replace(s,r.join(this._editor.getModel().getEOL())))}t.length>0&&this._editor.executeEdits("snippet.placeholderTransform",t)}let i=!1;!0===t&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,i=!0):!1===t&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,i=!0);const e=this._editor.getModel().changeDecorations((t=>{const e=new Set,s=[];for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const r=this._placeholderDecorations.get(n),o=this._editor.getModel().getDecorationRange(r);s.push(new ys(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?x3._decor.activeFinal:x3._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?x3._decor.activeFinal:x3._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?x3._decor.inactiveFinal:x3._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof I5){const t=this._placeholderDecorations.get(i);if(this._editor.getModel().getDecorationRange(t).isEmpty()&&i.toString().length>0)return!0}i=i.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||0===this._placeholderGroups.length}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(0===this._snippet.placeholders.length)return!0;if(1===this._snippet.placeholders.length){const[t]=this._snippet.placeholders;if(t.isFinalTabstop&&this._snippet.rightMostDescendant===t)return!0}return!1}computePossibleSelections(){const t=new Map;for(const i of this._placeholderGroups){let e;for(const s of i){if(s.isFinalTabstop)break;e||(e=[],t.set(s.index,e));const i=this._placeholderDecorations.get(s),n=this._editor.getModel().getDecorationRange(i);if(!n){t.delete(s.index);break}e.push(n)}}return t}get activeChoice(){if(!this._placeholderDecorations)return;const t=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!(null==t?void 0:t.choice))return;const i=this._placeholderDecorations.get(t);if(!i)return;const e=this._editor.getModel().getDecorationRange(i);return e?{range:e,choice:t.choice}:void 0}get hasChoice(){let t=!1;return this._snippet.walk((i=>(t=i instanceof P5,!t))),t}merge(t){const i=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations((e=>{for(const s of this._placeholderGroups[this._placeholderGroupsIdx]){const n=t.shift();console.assert(-1!==n._offset),console.assert(!n._placeholderDecorations);const r=n._snippet.placeholderInfo.last.index;for(const t of n._snippet.placeholderInfo.all)t.index=t.isFinalTabstop?s.index+(r+1)/this._nestingLevel:s.index+t.index/this._nestingLevel;this._snippet.replace(s,n._snippet.children);const o=this._placeholderDecorations.get(s);e.removeDecoration(o),this._placeholderDecorations.delete(s);for(const t of n._snippet.placeholders){const s=n._snippet.offset(t),r=n._snippet.fullLen(t),o=bs.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,x3._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,I5.compareByIndex)}))}}x3._decor={active:aL.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:aL.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:aL.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:aL.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const D3={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let E3=S3=class{static adjustWhitespace(t,i,e,s,n){const r=Kn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof O5)||i.parent instanceof P5)return!0;if(n&&!n.has(i))return!0;const h=i.value.split(/\r\n|\r|\n/);if(e){const e=s.offset(i);if(0===e)h[0]=t.normalizeIndentation(h[0]);else{o=null!=o?o:s.toString();const i=o.charCodeAt(e-1);10!==i&&13!==i||(h[0]=t.normalizeIndentation(r+h[0]))}for(let i=1;i<h.length;i++)h[i]=t.normalizeIndentation(r+h[i])}const c=h.join(t.getEOL());return c!==i.value&&(i.parent.replace(i,[new O5(c)]),o=void 0),!0})),r}static adjustSelection(t,i,e,s){if(0!==e||0!==s){const{positionLineNumber:n,positionColumn:r}=i,o=t.validateRange({startLineNumber:n,startColumn:r-e,endLineNumber:n,endColumn:r+s});i=ys.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(t,i,e,s,n,r,o,h,c){const l=[],a=[];if(!t.hasModel())return{edits:l,snippets:a};const u=t.getModel(),d=t.invokeWithinContext((t=>t.get(RO))),f=t.invokeWithinContext((t=>new w3(t.get(CO),u))),g=()=>o,p=u.getValueInRange(S3.adjustSelection(u,t.getSelection(),e,0)),m=u.getValueInRange(S3.adjustSelection(u,t.getSelection(),0,s)),w=u.getLineFirstNonWhitespaceColumn(t.getSelection().positionLineNumber),v=t.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:o,idx:b}of v){let y=S3.adjustSelection(u,o,e,0),k=S3.adjustSelection(u,o,0,s);p!==u.getValueInRange(y)&&(y=o),m!==u.getValueInRange(k)&&(k=o);const C=o.setStartPosition(y.startLineNumber,y.startColumn).setEndPosition(k.endLineNumber,k.endColumn),S=(new V5).parse(i,!0,n),x=C.getStartPosition(),D=S3.adjustWhitespace(u,x,r||b>0&&w!==u.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new p3([f,new v3(g,b,v.length,"spread"===t.getOption(78)),new m3(u,o,b,h),new b3(u,o,c),new y3,new k3(d),new C3])),l[b]=QR.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,a[b]=new x3(t,S,D)}return{edits:l,snippets:a}}static createEditsAndSnippetsFromEdits(t,i,e,s,n,r,o){if(!t.hasModel()||0===i.length)return{edits:[],snippets:[]};const h=[],c=t.getModel(),l=new V5,a=new j5,u=new p3([t.invokeWithinContext((t=>new w3(t.get(CO),c))),new v3((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new m3(c,t.getSelection(),0,r),new b3(c,t.getSelection(),o),new y3,new k3(t.invokeWithinContext((t=>t.get(RO)))),new C3]);i=i.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)));let d=0;for(let t=0;t<i.length;t++){const{range:e,template:s}=i[t];if(t>0){const s=bs.fromPositions(i[t-1].range.getEndPosition(),e.getStartPosition()),n=new O5(c.getValueInRange(s));a.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,a);S3.adjustWhitespace(c,e.getStartPosition(),!0,a,new Set(n)),a.resolveVariables(u);const r=a.toString(),o=r.slice(d);d=r.length;const f=QR.replace(e,o);f.identifier={major:t,minor:0},f._isTracked=!0,h.push(f)}return l.ensureFinalTabstop(a,e,!0),{edits:h,snippets:[new x3(t,a,"")]}}constructor(t,i,e=D3,s){this._editor=t,this._template=i,this._options=e,this._languageConfigurationService=s,this._templateMerges=[],this._snippets=[]}dispose(){Vi(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:t,snippets:i}="string"==typeof this._template?S3.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):S3.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits("snippet",t,(t=>{const e=t.filter((t=>!!t.identifier));for(let t=0;t<i.length;t++)i[t].initialize(e[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):e.map((t=>ys.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(t,i=D3){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=S3.createEditsAndSnippetsFromSelections(this._editor,t,i.overwriteBefore,i.overwriteAfter,!0,i.adjustWhitespace,i.clipboardText,i.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",e,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<s.length;t++)s[t].initialize(i[t].textChange);const e=s[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(s);console.assert(0===s.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>ys.fromPositions(t.range.getEndPosition())))}))}next(){const t=this._move(!0);this._editor.setSelections(t),this._editor.revealPositionInCenterIfOutsideViewport(t[0].getPosition())}prev(){const t=this._move(!1);this._editor.setSelections(t),this._editor.revealPositionInCenterIfOutsideViewport(t[0].getPosition())}_move(t){const i=[];for(const e of this._snippets){const s=e.move(t);i.push(...s)}return i}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const t=this._editor.getSelections();if(t.length<this._snippets.length)return!1;const i=new Map;for(const e of this._snippets){const s=e.computePossibleSelections();if(0===i.size)for(const[e,n]of s){n.sort(bs.compareRangesUsingStarts);for(const s of t)if(n[0].containsRange(s)){i.set(e,[]);break}}if(0===i.size)return!1;i.forEach(((t,i)=>{t.push(...s.get(i))}))}t.sort(bs.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(bs.compareRangesUsingStarts);for(let n=0;n<s.length;n++)s[n].containsRange(t[n])||i.delete(e)}else i.delete(e);return i.size>0}};E3=S3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,Nd)],E3);var A3,M3=function(t,i){return function(e,s){i(e,s,t)}};const L3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let F3=A3=class{static get(t){return t.getContribution(A3.ID)}constructor(t,i,e,s,n){this._editor=t,this._logService=i,this._languageFeaturesService=e,this._languageConfigurationService=n,this._snippetListener=new Ui,this._modelVersionId=-1,this._inSnippet=A3.InSnippetMode.bindTo(s),this._hasNextTabstop=A3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=A3.HasPrevTabstop.bindTo(s)}dispose(){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),null===(t=this._session)||void 0===t||t.dispose(),this._snippetListener.dispose()}insert(t,i){try{this._doInsert(t,void 0===i?L3:{...L3,...i})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",t),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(t,i){var e;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(B("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new E3(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(e=this._session)||void 0===e?void 0:e.hasChoice){const t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!vs.equals(this._editor.getPosition(),i))return;const{activeChoice:e}=this._session;if(!e||0===e.choice.options.length)return;const s=t.getValueInRange(e.range),n=Boolean(e.choice.options.find((t=>t.value===s))),r=[];for(let t=0;t<e.choice.options.length;t++){const i=e.choice.options[t];r.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:e.range,filterText:n?`${s}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:Q(0,"Go to next placeholder...")}})}return{suggestions:r}}},i=this._editor.getModel();let e,s=!1;this._choiceCompletions={provider:t,enable:()=>{s||(e=this._languageFeaturesService.completionProvider.register({language:i.getLanguageId(),pattern:i.uri.fsPath,scheme:i.uri.scheme,exclusive:!0},t),this._snippetListener.add(e),s=!0)},disable:()=>{null==e||e.dispose(),s=!1}}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((t=>t.isFlush&&this.cancel()))),this._snippetListener.add(this._editor.onDidChangeModel((()=>this.cancel()))),this._snippetListener.add(this._editor.onDidChangeCursorSelection((()=>this._updateState())))}}_updateState(){if(this._session&&this._editor.hasModel()){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:i}=this._session;if(!i||!this._choiceCompletions)return null===(t=this._choiceCompletions)||void 0===t||t.disable(),void(this._currentChoice=void 0);this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask((()=>{!function(t,i){var e;null===(e=t.getContribution("editor.contrib.suggestController"))||void 0===e||e.triggerSuggest((new Set).add(i),void 0,!0)}(this._editor,this._choiceCompletions.provider)})))}finish(){for(;this._inSnippet.get();)this.next()}cancel(t=!1){var i;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,null===(i=this._session)||void 0===i||i.dispose(),this._session=void 0,this._modelVersionId=-1,t&&this._editor.setSelections([this._editor.getSelection()])}prev(){var t;null===(t=this._session)||void 0===t||t.prev(),this._updateState()}next(){var t;null===(t=this._session)||void 0===t||t.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}};F3.ID="snippetController2",F3.InSnippetMode=new Xo("inSnippetMode",!1,Q(0,"Whether the editor in current in snippet mode")),F3.HasNextTabstop=new Xo("hasNextTabstop",!1,Q(0,"Whether there is a next tab stop when in snippet mode")),F3.HasPrevTabstop=new Xo("hasPrevTabstop",!1,Q(0,"Whether there is a previous tab stop when in snippet mode")),F3=A3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M3(1,Rh),M3(2,op),M3(3,th),M3(4,Nd)],F3),iu(F3.ID,F3,4);const T3=qa.bindToContribution(F3.get);Ya(new T3({id:"jumpToNextSnippetPlaceholder",precondition:Oo.and(F3.InSnippetMode,F3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:2}})),Ya(new T3({id:"jumpToPrevSnippetPlaceholder",precondition:Oo.and(F3.InSnippetMode,F3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:1026}})),Ya(new T3({id:"leaveSnippet",precondition:F3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:9,secondary:[1033]}})),Ya(new T3({id:"acceptSnippet",precondition:F3.InSnippetMode,handler:t=>t.finish()}));var R3,O3=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(R3||(R3={}));let _3=class extends Ki{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(t,i,e,s,n,r,o,h,c,l,a,u){let d;super(),this.textModel=t,this.selectedSuggestItem=i,this.cursorPosition=e,this.textModelVersionId=s,this._debounceValue=n,this._suggestPreviewEnabled=r,this._suggestPreviewMode=o,this._inlineSuggestMode=h,this._enabled=c,this._instantiationService=l,this._commandService=a,this._languageConfigurationService=u,this._source=this._register(this._instantiationService.createInstance(X5,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=gz(this,!1),this._forceUpdateSignal=Iz("forceUpdate"),this._selectedInlineCompletionId=gz(this,void 0),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([R3.Redo,R3.Undo,R3.AcceptWord]),this._fetchInlineCompletions=function(t,i){var e;return new Sz(t.owner,t.debugName,i,t.createEmptyChangeSummary,t.handleChange,void 0,null!==(e=t.equalityComparer)&&void 0!==e?e:vz)}({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Fs.Automatic}),handleChange:(t,i)=>(t.didChange(this.textModelVersionId)&&this._preserveCurrentCompletionReasons.has(t.change)?i.preserveCurrentCompletion=!0:t.didChange(this._forceUpdateSignal)&&(i.inlineCompletionTriggerKind=t.change),!0)},((t,i)=>{if(this._forceUpdateSignal.read(t),!(this._enabled.read(t)&&this.selectedSuggestItem.read(t)||this._isActive.read(t)))return void this._source.cancelUpdate();this.textModelVersionId.read(t);const e=this.selectedInlineCompletion.get(),s=i.preserveCurrentCompletion||(null==e?void 0:e.forwardStable)?e:void 0,n=this._source.suggestWidgetInlineCompletions.get(),r=this.selectedSuggestItem.read(t);if(n&&!r){const t=this._source.inlineCompletions.get();nz((i=>{(!t||n.request.versionId>t.request.versionId)&&this._source.inlineCompletions.set(n.clone(),i),this._source.clearSuggestWidgetInlineCompletions(i)}))}const o=this.cursorPosition.read(t),h={triggerKind:i.inlineCompletionTriggerKind,selectedSuggestionInfo:null==r?void 0:r.toSelectedSuggestionInfo()};return this._source.fetch(o,h,s)})),this._filteredInlineCompletionItems=bz(this,(t=>{const i=this._source.inlineCompletions.read(t);if(!i)return[];const e=this.cursorPosition.read(t),s=i.inlineCompletions.filter((i=>i.isVisible(this.textModel,e,t)));return s})),this.selectedInlineCompletionIndex=bz(this,(t=>{const i=this._selectedInlineCompletionId.read(t),e=this._filteredInlineCompletionItems.read(t),s=void 0===this._selectedInlineCompletionId?-1:e.findIndex((t=>t.semanticId===i));return-1===s?(this._selectedInlineCompletionId.set(void 0,void 0),0):s})),this.selectedInlineCompletion=bz(this,(t=>this._filteredInlineCompletionItems.read(t)[this.selectedInlineCompletionIndex.read(t)])),this.lastTriggerKind=this._source.inlineCompletions.map(this,(t=>null==t?void 0:t.request.context.triggerKind)),this.inlineCompletionsCount=bz(this,(t=>this.lastTriggerKind.read(t)===Fs.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=yz({owner:this,equalityComparer:(t,i)=>t&&i?D5(t.ghostText,i.ghostText)&&t.inlineCompletion===i.inlineCompletion&&t.suggestItem===i.suggestItem:t===i},(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=s.toSingleTextEdit().removeCommonPrefix(e),r=this._computeAugmentedCompletion(n,t);if(!this._suggestPreviewEnabled.read(t)&&!r)return;const o=null!==(i=null==r?void 0:r.edit)&&void 0!==i?i:n,h=r?r.edit.text.length-n.text.length:0,c=this._suggestPreviewMode.read(t),l=this.cursorPosition.read(t),a=o.computeGhostText(e,c,l,h);return{ghostText:null!=a?a:new C5(o.range.endLineNumber,[]),inlineCompletion:null==r?void 0:r.completion,suggestItem:s}}{if(!this._isActive.read(t))return;const i=this.selectedInlineCompletion.read(t);if(!i)return;const s=i.toSingleTextEdit(t),n=this._inlineSuggestMode.read(t),r=this.cursorPosition.read(t),o=s.computeGhostText(e,n,r);return o?{ghostText:o,inlineCompletion:i,suggestItem:void 0}:void 0}})),this.ghostText=yz({owner:this,equalityComparer:D5},(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(Nz(this._fetchInlineCompletions)),this._register(xz((t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.inlineCompletion;if((null==n?void 0:n.semanticId)!==(null==d?void 0:d.semanticId)&&(d=n,n)){const t=n.inlineCompletion,s=t.source;null===(e=(i=s.provider).handleItemDidShow)||void 0===e||e.call(i,s.inlineCompletions,t.sourceInlineCompletion,t.insertText)}})))}async trigger(t){this._isActive.set(!0,t),await this._fetchInlineCompletions.get()}async triggerExplicitly(t){oz(t,(t=>{this._isActive.set(!0,t),this._forceUpdateSignal.trigger(t,Fs.Explicit)})),await this._fetchInlineCompletions.get()}stop(t){oz(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_computeAugmentedCompletion(t,i){const e=this.textModel,s=this._source.suggestWidgetInlineCompletions.read(i);return function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(s?s.inlineCompletions:[this.selectedInlineCompletion.read(i)].filter(P),(s=>{let n=s.toSingleTextEdit(i);return n=n.removeCommonPrefix(e,bs.fromPositions(n.range.getStartPosition(),t.range.getEndPosition())),n.augments(t)?{edit:n,completion:s}:void 0}))}async _deltaSelectedInlineCompletionIndex(t){await this.triggerExplicitly();const i=this._filteredInlineCompletionItems.get()||[];if(i.length>0){const e=(this.selectedInlineCompletionIndex.get()+t+i.length)%i.length;this._selectedInlineCompletionId.set(i[e].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(t){var i;if(t.getModel()!==this.textModel)throw new $i;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.inlineCompletion.toInlineCompletion(void 0);t.pushUndoStop(),s.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[QR.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=F3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[QR.replaceMove(s.range,s.insertText),...s.additionalTextEdits]),s.command&&s.source.addRef(),nz((t=>{this._source.clear(t),this._isActive.set(!1,t)})),s.command&&(await this._commandService.executeCommand(s.command.id,...s.command.arguments||[]).then(void 0,Fi),s.source.removeRef())}async acceptNextWord(t){await this._acceptNext(t,((t,i)=>{const e=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(e),n=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),r=i.match(n);let o=0;o=r&&void 0!==r.index?0===r.index?r[0].length:r.index:i.length;const h=/\s+/g.exec(i);return h&&void 0!==h.index&&h.index+h[0].length<o&&(o=h.index+h[0].length),o}))}async acceptNextLine(t){await this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}async _acceptNext(t,i){if(t.getModel()!==this.textModel)throw new $i;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.ghostText,n=e.inlineCompletion.toInlineCompletion(void 0);if(n.snippetInfo||n.filterText!==n.insertText)return void await this.accept(t);const r=s.parts[0],o=new vs(s.lineNumber,r.column),h=r.lines.join("\n"),c=i(o,h);if(c===h.length&&1===s.parts.length)return void this.accept(t);const l=h.substring(0,c);n.source.addRef();try{this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[QR.replace(bs.fromPositions(o),l)]);const i=k5(l);t.setPosition(y5(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=bs.fromPositions(n.range.getStartPosition(),y5(o,k5(l))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}finally{n.source.removeRef()}}handleSuggestAccepted(t){var i,e;const s=t.toSingleTextEdit().removeCommonPrefix(this.textModel),n=this._computeAugmentedCompletion(s,void 0);if(!n)return;const r=n.completion.inlineCompletion;null===(e=(i=r.source.provider).handlePartialAccept)||void 0===e||e.call(i,r.source.inlineCompletions,r.sourceInlineCompletion,s.text.length)}};_3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([O3(9,io),O3(10,po),O3(11,Nd)],_3);var I3,P3=function(t,i){return function(e,s){i(e,s,t)}};class N3{constructor(t){this.name=t}select(t,i,e){if(0===e.length)return 0;const s=e[0].score[0];for(let t=0;t<e.length;t++){const{score:i,completion:n}=e[t];if(i[0]!==s)break;if(n.preselect)return t}return 0}}class B3 extends N3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let $3=I3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Ui,this._persistSoon=new rc((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===uN.SHUTDOWN&&this._saveState()})))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(t,i,e){this._withStrategy(t,i).memorize(t,i,e),this._persistSoon.schedule()}select(t,i,e){return this._withStrategy(t,i).select(t,i,e)}_withStrategy(t,i){var e;const s=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:t.getLanguageIdAtPosition(i.lineNumber,i.column),resource:t.uri});if((null===(e=this._strategy)||void 0===e?void 0:e.name)!==s){this._saveState();const t=I3._strategyCtors.get(s)||B3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${I3._storagePrefix}/${s}`,t?0:1);i&&this._strategy.fromJSON(JSON.parse(i))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${I3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};$3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends N3{constructor(){super("recentlyUsedByPrefix"),this._trie=TO.forStrings(),this._seq=0}memorize(t,i,e){const{word:s}=t.getWordUntilPosition(i),n=`${t.getLanguageId()}/${s}`;this._trie.set(n,{type:e.completion.kind,insertText:e.completion.insertText,touch:this._seq++})}select(t,i,e){const{word:s}=t.getWordUntilPosition(i);if(!s)return super.select(t,i,e);const n=`${t.getLanguageId()}/${s}`;let r=this._trie.get(n);if(r||(r=this._trie.findSubstr(n)),r)for(let t=0;t<e.length;t++){const{kind:i,insertText:s}=e[t].completion;if(i===r.type&&s===r.insertText)return t}return super.select(t,i,e)}toJSON(){const t=[];return this._trie.forEach(((i,e)=>t.push([e,i]))),t.sort(((t,i)=>-(t[1].touch-i[1].touch))).forEach(((t,i)=>t[1].touch=i)),t.slice(0,200)}fromJSON(t){if(this._trie.clear(),t.length>0){this._seq=t[0][1].touch+1;for(const[i,e]of t)e.type="number"==typeof e.type?e.type:Ls.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends N3{constructor(){super("recentlyUsed"),this._cache=new Mg(300,.66),this._seq=0}memorize(t,i,e){const s=`${t.getLanguageId()}/${e.textLabel}`;this._cache.set(s,{touch:this._seq++,type:e.completion.kind,insertText:e.completion.insertText})}select(t,i,e){if(0===e.length)return 0;const s=t.getLineContent(i.lineNumber).substr(i.column-10,i.column-1);if(/\s$/.test(s))return super.select(t,i,e);const n=e[0].score[0];let r=-1,o=-1;for(let i=0;i<e.length&&e[i].score[0]===n;i++){const s=`${t.getLanguageId()}/${e[i].textLabel}`,n=this._cache.peek(s);if(n&&n.touch>o&&n.type===e[i].completion.kind&&n.insertText===e[i].completion.insertText&&(o=n.touch,r=i),e[i].completion.preselect)return i}return-1!==r?r:0}toJSON(){return this._cache.toJSON()}fromJSON(t){this._cache.clear();for(const[i,e]of t)e.touch=0,e.type="number"==typeof e.type?e.type:Ls.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",B3]]),$3._storagePrefix="suggest/memories",$3=I3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P3(0,aN),P3(1,rd)],$3);const W3=eo("ISuggestMemories");gd(W3,$3,1);var j3;let V3=j3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=j3.AtEnd.bindTo(i),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(122)&&this._update())),this._update()}dispose(){var t;this._configListener.dispose(),null===(t=this._selectionListener)||void 0===t||t.dispose(),this._ckAtEnd.reset()}_update(){const t="on"===this._editor.getOption(122);if(this._enabled!==t)if(this._enabled=t,this._enabled){const t=()=>{if(!this._editor.hasModel())return void this._ckAtEnd.set(!1);const t=this._editor.getModel(),i=this._editor.getSelection(),e=t.getWordAtPosition(i.getStartPosition());this._ckAtEnd.set(!!e&&e.endColumn===i.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};V3.AtEnd=new Xo("atEndOfWord",!1),V3=j3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],V3);var H3;let z3=H3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=H3.OtherSuggestions.bindTo(i)}dispose(){this.reset()}reset(){var t;this._ckOtherSuggestions.reset(),null===(t=this._listener)||void 0===t||t.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:t,index:i},e){0!==t.items.length&&H3._moveIndex(!0,t,i)!==i?(this._acceptNext=e,this._model=t,this._index=i,this._listener=this._editor.onDidChangeCursorPosition((()=>{this._ignore||this.reset()})),this._ckOtherSuggestions.set(!0)):this.reset()}static _moveIndex(t,i,e){let s=e;for(let n=i.items.length;n>0&&(s=(s+i.items.length+(t?1:-1))%i.items.length,s!==e)&&i.items[s].completion.additionalTextEdits;n--);return s}next(){this._move(!0)}prev(){this._move(!1)}_move(t){if(this._model)try{this._ignore=!0,this._index=H3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};z3.OtherSuggestions=new Xo("hasOtherSuggestions",!1),z3=H3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],z3);class U3{constructor(t,i,e,s){this._disposables=new Ui,this._disposables.add(e.onDidSuggest((t=>{0===t.completionModel.items.length&&this.reset()}))),this._disposables.add(e.onDidCancel((()=>{this.reset()}))),this._disposables.add(i.onDidShow((()=>this._onItem(i.getFocusedItem())))),this._disposables.add(i.onDidFocus(this._onItem,this)),this._disposables.add(i.onDidHide(this.reset,this)),this._disposables.add(t.onWillType((n=>{if(this._active&&!i.isFrozen()&&0!==e.state){const i=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(i)&&t.getOption(0)&&s(this._active.item)}})))}_onItem(t){if(!t||!u(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new af;for(const e of t.item.completion.commitCharacters)e.length>0&&i.add(e.charCodeAt(0));this._active={acceptCharacters:i,item:t}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class K3{async provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;await new Promise((i=>K3._bracketsRightYield(i,0,t,s,n))),await new Promise((e=>K3._bracketsLeftYield(e,0,t,s,n,i)))}return e}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=K3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>K3._maxDuration){setTimeout((()=>K3._bracketsRightYield(t,i+1,e,s,n)));break}if(h.bracketInfo.isOpeningBracket){const t=h.bracketInfo.bracketText,i=r.has(t)?r.get(t):0;r.set(t,i+1)}else{const t=h.bracketInfo.getOpeningBrackets()[0].bracketText;let i=r.has(t)?r.get(t):0;if(i-=1,r.set(t,Math.max(0,i)),i<0){let i=n.get(t);i||(i=new Nt,n.set(t,i)),i.push(h.range)}}s=h.range.getEndPosition()}}static _bracketsLeftYield(t,i,e,s,n,r){const o=new Map,h=Date.now();for(;;){if(i>=K3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>K3._maxDuration){setTimeout((()=>K3._bracketsLeftYield(t,i+1,e,s,n,r)));break}if(c.bracketInfo.isOpeningBracket){const t=c.bracketInfo.bracketText;let i=o.has(t)?o.get(t):0;if(i-=1,o.set(t,Math.max(0,i)),i<0){const i=n.get(t);if(i){const s=i.shift();0===i.size&&n.delete(t);const o=bs.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=bs.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),K3._addBracketLeading(e,h,r)}}}else{const t=c.bracketInfo.getOpeningBrackets()[0].bracketText,i=o.has(t)?o.get(t):0;o.set(t,i+1)}s=c.range.getStartPosition()}}static _addBracketLeading(t,i,e){if(i.startLineNumber===i.endLineNumber)return;const s=i.startLineNumber,n=t.getLineFirstNonWhitespaceColumn(s);0!==n&&n!==i.startColumn&&(e.push({range:bs.fromPositions(new vs(s,n),i.getEndPosition())}),e.push({range:bs.fromPositions(new vs(s,1),i.getEndPosition())}));const r=s-1;if(r>0){const s=t.getLineFirstNonWhitespaceColumn(r);s===i.startColumn&&s!==t.getLineLastNonWhitespaceColumn(r)&&(e.push({range:bs.fromPositions(new vs(r,s),i.getEndPosition())}),e.push({range:bs.fromPositions(new vs(r,1),i.getEndPosition())}))}}}K3._maxDuration=30,K3._maxRounds=2;class q3{static async create(t,i){if(!i.getOption(117).localityBonus)return q3.None;if(!i.hasModel())return q3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return q3.None;const[r]=await(new K3).provideSelectionRanges(e,[n]);if(0===r.length)return q3.None;const o=await t.computeWordRanges(e.uri,r[0].range);if(!o)return q3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends q3{distance(t,e){if(!n.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const h=o["string"==typeof e.label?e.label:e.label.label];if(a(h))return 2<<20;const c=s(h,bs.fromPositions(t),bs.compareRangesUsingStarts),l=c>=0?h[c]:h[Math.max(0,~c-1)];let u=r.length;for(const t of r){if(!bs.containsRange(t.range,l))break;u-=1}return u}}}}q3.None=new class extends q3{distance(){return 0}};class G3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class Z3{constructor(t,i,e,s,n,r,o=oI.default,h){this.clipboardText=h,this._snippetCompareFn=Z3._compareCompletionItems,this._items=t,this._column=i,this._wordDistance=s,this._options=n,this._refilterKind=1,this._lineContext=e,this._fuzzyScoreOptions=o,"top"===r?this._snippetCompareFn=Z3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=Z3._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(t){this._lineContext.leadingLineContent===t.leadingLineContent&&this._lineContext.characterCountDelta===t.characterCountDelta||(this._refilterKind=this._lineContext.characterCountDelta<t.characterCountDelta&&this._filteredItems?2:1,this._lineContext=t)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const t=new Set;for(const[i,e]of this.getItemsByProvider())e.length>0&&e[0].container.incomplete&&t.add(i);return t}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){0!==this._refilterKind&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const t=[],{leadingLineContent:i,characterCountDelta:e}=this._lineContext;let s="",r="";const o=1===this._refilterKind?this._items:this._filteredItems,h=[],c=!this._options.filterGraceful||o.length>2e3?hI:lI;for(let n=0;n<o.length;n++){const l=o[n];if(l.isInvalid)continue;const a=this._itemsByProvider.get(l.provider);a?a.push(l):this._itemsByProvider.set(l.provider,[l]);const u=l.position.column-l.editStart.column,d=u+e-(l.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),r=s.toLowerCase()),l.word=s,0===d)l.score=rI.Default;else{let t=0;for(;t<u;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)l.score=rI.Default;else if("string"==typeof l.completion.filterText){const i=c(s,r,t,l.completion.filterText,l.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===Jn(l.completion.filterText,l.textLabel)?l.score=i:(l.score=K_(s,r,t,l.textLabel,l.labelLow,0),l.score[0]=i[0])}else{const i=c(s,r,t,l.textLabel,l.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;l.score=i}}l.idx=n,l.distance=this._wordDistance.distance(l.position,l.completion),h.push(l),t.push(l.textLabel.length)}this._filteredItems=h.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?n(t.length-.85,t,((t,i)=>t-i)):0}}static _compareCompletionItems(t,i){return t.score[0]>i.score[0]?-1:t.score[0]<i.score[0]?1:t.distance<i.distance?-1:t.distance>i.distance?1:t.idx<i.idx?-1:t.idx>i.idx?1:0}static _compareCompletionItemsSnippetsDown(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return Z3._compareCompletionItems(t,i)}static _compareCompletionItemsSnippetsUp(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return-1;if(27===i.completion.kind)return 1}return Z3._compareCompletionItems(t,i)}}var J3,Q3=function(t,i){return function(e,s){i(e,s,t)}};class Y3{static shouldAutoTrigger(t){if(!t.hasModel())return!1;const i=t.getModel(),e=t.getPosition();i.tokenization.tokenizeIfCheap(e.lineNumber);const s=i.getWordAtPosition(e);return!(!s||s.endColumn!==e.column&&s.startColumn+1!==e.column||!isNaN(Number(s.word)))}constructor(t,i,e){this.leadingLineContent=t.getLineContent(i.lineNumber).substr(0,i.column-1),this.leadingWord=t.getWordUntilPosition(i),this.lineNumber=i.lineNumber,this.column=i.column,this.triggerOptions=e}}let X3=J3=class{constructor(t,i,e,s,n,r,o,h,c){this._editor=t,this._editorWorkerService=i,this._clipboardService=e,this._telemetryService=s,this._logService=n,this._contextKeyService=r,this._configurationService=o,this._languageFeaturesService=h,this._envService=c,this._toDispose=new Ui,this._triggerCharacterListener=new Ui,this._triggerQuickSuggest=new sc,this._triggerState=void 0,this._completionDisposables=new Ui,this._onDidCancel=new ne,this._onDidTrigger=new ne,this._onDidSuggest=new ne,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new ys(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeModelLanguage((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeConfiguration((()=>{this._updateTriggerCharacters()}))),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange((()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()})));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{l=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{l=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{l||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{l||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){Vi(this._triggerCharacterListener),Vi([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(90)||!this._editor.hasModel()||!this._editor.getOption(120))return;const t=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const e of i.triggerCharacters||[]){let s=t.get(e);s||(s=new Set,s.add(void 0),t.set(e,s)),s.add(i)}const i=i=>{var e;if(!function(t,i){if(!Boolean(i.getContextKeyValue("inlineSuggestionVisible")))return!0;const e=i.getContextKeyValue(m5.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(Y3.shouldAutoTrigger(this._editor))return;if(!i){const t=this._editor.getPosition();i=this._editor.getModel().getLineContent(t.lineNumber).substr(0,t.column-1)}let s="";or(i.charCodeAt(i.length-1))?rr(i.charCodeAt(i.length-2))&&(s=i.substr(i.length-2)):s=i.charAt(i.length-1);const n=t.get(s);if(n){const t=new Map;if(this._completionModel)for(const[i,e]of this._completionModel.getItemsByProvider())n.has(i)||t.set(i,e);this.trigger({auto:!0,triggerKind:1,triggerCharacter:s,retrigger:Boolean(this._completionModel),clipboardText:null===(e=this._completionModel)||void 0===e?void 0:e.clipboardText,completionOptions:{providerFilter:n,providerItemsToReuse:t}})}};this._triggerCharacterListener.add(this._editor.onDidType(i)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd((()=>i())))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(t=!1){var i;void 0!==this._triggerState&&(this._triggerQuickSuggest.cancel(),null===(i=this._requestToken)||void 0===i||i.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:t}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){void 0!==this._triggerState&&(this._editor.hasModel()&&this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.trigger({auto:this._triggerState.auto,retrigger:!0}):this.cancel())}_onCursorChange(t){if(!this._editor.hasModel())return;const i=this._currentSelection;this._currentSelection=this._editor.getSelection(),!t.selection.isEmpty()||0!==t.reason&&3!==t.reason||"keyboard"!==t.source&&"deleteLeft"!==t.source?this.cancel():void 0===this._triggerState&&0===t.reason?(i.containsRange(this._currentSelection)||i.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():void 0!==this._triggerState&&3===t.reason&&this._refilterCompletionItems()}_onCompositionEnd(){void 0===this._triggerState?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var t;f3.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=F3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!Y3.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),e=this._editor.getOption(88);if(!f3.isAllOff(e)){if(!f3.isAllOn(e)){t.tokenization.tokenizeIfCheap(i.lineNumber);const s=t.tokenization.getLineTokens(i.lineNumber),n=s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if("on"!==f3.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(m5.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(m5.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(89)))}_refilterCompletionItems(){B(this._editor.hasModel()),B(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new Y3(t,i,{...this._triggerState,refilter:!0});this._onNewContext(e)}trigger(t){var i,e,s,n,r,o;if(!this._editor.hasModel())return;const h=this._editor.getModel(),c=new Y3(h,this._editor.getPosition(),t);this.cancel(t.retrigger),this._triggerState=t,this._onDidTrigger.fire({auto:t.auto,shy:null!==(i=t.shy)&&void 0!==i&&i,position:this._editor.getPosition()}),this._context=c;let l={triggerKind:null!==(e=t.triggerKind)&&void 0!==e?e:0};t.triggerCharacter&&(l={triggerKind:1,triggerCharacter:t.triggerCharacter}),this._requestToken=new pe;let a=1;switch(this._editor.getOption(111)){case"top":a=0;break;case"bottom":a=2}const{itemKind:u,showDeprecated:d}=J3._createSuggestFilter(this._editor),f=new c3(a,null!==(n=null===(s=t.completionOptions)||void 0===s?void 0:s.kindFilter)&&void 0!==n?n:u,null===(r=t.completionOptions)||void 0===r?void 0:r.providerFilter,null===(o=t.completionOptions)||void 0===o?void 0:o.providerItemsToReuse,d),g=q3.create(this._editorWorkerService,this._editor),p=a3(this._languageFeaturesService.completionProvider,h,this._editor.getPosition(),f,l,this._requestToken.token);Promise.all([p,g]).then((async([i,e])=>{var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==t?void 0:t.clipboardText;if(!n&&i.needsClipboard&&(n=await this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new Y3(r,this._editor.getPosition(),t),h={...oI.default,firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly};if(this._completionModel=new Z3(i.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(117),this._editor.getOption(111),h,n),this._completionDisposables.add(i.disposable),this._onNewContext(o),this._reportDurationsTelemetry(i.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const t of i.items)t.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${t.provider._debugDisplayName}`,t.completion)})).catch(Li)}_reportDurationsTelemetry(t){this._telemetryGate++%230==0&&setTimeout((()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(t)}),this._logService.debug("suggest.durations.json",t)}))}static _createSuggestFilter(t){const i=new Set;"none"===t.getOption(111)&&i.add(27);const e=t.getOption(117);return e.showMethods||i.add(0),e.showFunctions||i.add(1),e.showConstructors||i.add(2),e.showFields||i.add(3),e.showVariables||i.add(4),e.showClasses||i.add(5),e.showStructs||i.add(6),e.showInterfaces||i.add(7),e.showModules||i.add(8),e.showProperties||i.add(9),e.showEvents||i.add(10),e.showOperators||i.add(11),e.showUnits||i.add(12),e.showValues||i.add(13),e.showConstants||i.add(14),e.showEnums||i.add(15),e.showEnumMembers||i.add(16),e.showKeywords||i.add(17),e.showWords||i.add(18),e.showColors||i.add(19),e.showFiles||i.add(20),e.showReferences||i.add(21),e.showColors||i.add(22),e.showFolders||i.add(23),e.showTypeParameters||i.add(24),e.showSnippets||i.add(27),e.showUsers||i.add(25),e.showIssues||i.add(26),{itemKind:i,showDeprecated:e.showDeprecated}}_onNewContext(t){if(this._context)if(t.lineNumber===this._context.lineNumber)if(Kn(t.leadingLineContent)===Kn(this._context.leadingLineContent)){if(t.column<this._context.column)t.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();else if(this._completionModel)if(0!==t.leadingWord.word.length&&t.leadingWord.startColumn>this._context.leadingWord.startColumn){if(Y3.shouldAutoTrigger(this._editor)&&this._context){const t=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:t}})}}else if(t.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&0!==t.leadingWord.word.length){const t=new Map,i=new Set;for(const[e,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(e):t.set(e,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const i=this._completionModel.lineContext;let e=!1;if(this._completionModel.lineContext={leadingLineContent:t.leadingLineContent,characterCountDelta:t.column-this._context.column},0===this._completionModel.items.length){const s=Y3.shouldAutoTrigger(this._editor);if(!this._context)return void this.cancel();if(s&&this._context.leadingWord.endColumn<t.leadingWord.startColumn)return void this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});if(this._context.triggerOptions.auto)return void this.cancel();if(this._completionModel.lineContext=i,e=this._completionModel.items.length>0,e&&0===t.leadingWord.word.length)return void this.cancel()}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:t.triggerOptions,isFrozen:e})}}else this.cancel();else this.cancel()}};X3=J3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q3(1,iB),Q3(2,nH),Q3(3,Th),Q3(4,Rh),Q3(5,th),Q3(6,rd),Q3(7,op),Q3(8,JT)],X3);class t6{constructor(t,i){this._disposables=new Ui,this._lastOvertyped=[],this._locked=!1,this._disposables.add(t.onWillType((()=>{if(this._locked||!t.hasModel())return;const i=t.getSelections(),e=i.length;let s=!1;for(let t=0;t<e;t++)if(!i[t].isEmpty()){s=!0;break}if(!s)return void(0!==this._lastOvertyped.length&&(this._lastOvertyped.length=0));this._lastOvertyped=[];const n=t.getModel();for(let t=0;t<e;t++){const e=i[t];if(n.getValueLengthInRange(e)>t6._maxSelectionLength)return;this._lastOvertyped[t]={value:n.getValueInRange(e),multiline:e.startLineNumber!==e.endLineNumber}}}))),this._disposables.add(i.onDidTrigger((()=>{this._locked=!0}))),this._disposables.add(i.onDidCancel((()=>{this._locked=!1})))}getLastOvertypedInfo(t){if(t>=0&&t<this._lastOvertyped.length)return this._lastOvertyped[t]}dispose(){this._disposables.dispose()}}t6._maxSelectionLength=51200;var i6=function(t,i){return function(e,s){i(e,s,t)}};class e6 extends FN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=Q(0,"{0} ({1})",this._action.label,e6.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let s6=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Ui,this.element=xa(t,Fa(".suggest-status-bar"));const r=t=>t instanceof Mh?e.createInstance(e6,t,void 0):void 0;this._leftActions=new IN(this.element,{actionViewItemProvider:r}),this._rightActions=new IN(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const t=this._menuService.createMenu(this._menuId,this._contextKeyService),i=()=>{const i=[],e=[];for(const[s,n]of t.getActions())"left"===s?i.push(...n):e.push(...n);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(e)};this._menuDisposables.add(t.onDidChange((()=>i()))),this._menuDisposables.add(t)}hide(){this._menuDisposables.clear()}};s6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([i6(2,io),i6(3,xh),i6(4,th)],s6);function n6(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let r6=class{constructor(t,i){this._editor=t,this._onDidClose=new ne,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ne,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Ui,this._renderDisposeable=new Ui,this._borderWidth=1,this._size=new ql(330,0),this.domNode=Fa(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(GZ,{editor:t}),this._body=Fa(".body"),this._scrollbar=new pk(this._body,{alwaysConsumeMouseWheel:!0}),xa(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=xa(this._body,Fa(".header")),this._close=xa(this._header,Fa("span"+go.asCSSSelector(xs.close))),this._close.title=Q(0,"Close"),this._type=xa(this._header,Fa("p.type")),this._docs=xa(this._body,Fa("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(50),e=i.getMassagedFontFamily(),s=t.get(118)||i.fontSize,n=t.get(119)||i.lineHeight,r=i.fontWeight,o=`${n}px`;this.domNode.style.fontSize=`${s}px`,this.domNode.style.lineHeight=""+n/s,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=i.fontFeatureSettings,this._type.style.fontFamily=e,this._close.style.height=o,this._close.style.width=o}getLayoutInfo(){const t=this._editor.getOption(119)||this._editor.getOption(50).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=Q(0,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,2*this.getLayoutInfo().lineHeight),this._onDidChangeContents.fire(this)}renderItem(t,i){var e,s;this._renderDisposeable.clear();let{detail:n,documentation:r}=t.completion;if(i){let i="";i+=`score: ${t.score[0]}\n`,i+=`prefix: ${null!==(e=t.word)&&void 0!==e?e:"(no prefix)"}\n`,i+=`word: ${t.completion.filterText?t.completion.filterText+" (filterText)":t.textLabel}\n`,i+=`distance: ${t.distance} (localityBonus-setting)\n`,i+=`index: ${t.idx}, based on ${t.completion.sortText&&`sortText: "${t.completion.sortText}"`||"label"}\n`,i+=`commit_chars: ${null===(s=t.completion.commitCharacters)||void 0===s?void 0:s.join("")}\n`,r=(new bI).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||n6(t)){if(this.domNode.classList.remove("no-docs","no-type"),n){const t=n.length>1e5?`${n.substr(0,1e5)}…`:n;this._type.textContent=t,this._type.title=t,Ta(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Ol(this._type),this._type.title="",Ra(this._type),this.domNode.classList.add("no-type");if(Ol(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Ol(this._docs);const t=this._markdownRenderer.render(r);this._docs.appendChild(t.element),this._renderDisposeable.add(t),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync((()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)})))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=t=>{t.preventDefault(),t.stopPropagation()},this._close.onclick=t=>{t.preventDefault(),t.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}else this.clearContents()}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get size(){return this._size}layout(t,i){const e=new ql(t,i);ql.equals(e,this._size)||(this._size=e,function(t,i,e){"number"==typeof i&&(t.style.width=`${i}px`),"number"==typeof e&&(t.style.height=`${e}px`)}(this.domNode,t,i)),this._scrollbar.scanDomNode()}scrollDown(t=8){this._body.scrollTop+=t}scrollUp(t=8){this._body.scrollTop-=t}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(t){this._borderWidth=t}get borderWidth(){return this._borderWidth}};r6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,io)],r6);class o6{constructor(t,i){let e,s;this.widget=t,this._editor=i,this._disposables=new Ui,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new hX,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(t.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let n=0,r=0;this._disposables.add(this._resizable.onDidWillResize((()=>{e=this._topLeft,s=this._resizable.size}))),this._disposables.add(this._resizable.onDidResize((t=>{if(e&&s){this.widget.layout(t.dimension.width,t.dimension.height);let i=!1;t.west&&(r=s.width-t.dimension.width,i=!0),t.north&&(n=s.height-t.dimension.height,i=!0),i&&this._applyTopLeft({top:e.top+n,left:e.left+r})}t.done&&(e=void 0,s=void 0,n=0,r=0,this._userSize=t.dimension)}))),this._disposables.add(this.widget.onDidChangeContents((()=>{var t;this._anchorBox&&this._placeAtAnchor(this._anchorBox,null!==(t=this._userSize)&&void 0!==t?t:this.widget.size,this._preferAlignAtTop)})))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return null}show(){this._added||(this._editor.addOverlayWidget(this),this.getDomNode().style.position="fixed",this._added=!0)}hide(t=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),t&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(t,i){var e;const s=t.getBoundingClientRect();this._anchorBox=s,this._preferAlignAtTop=i,this._placeAtAnchor(this._anchorBox,null!==(e=this._userSize)&&void 0!==e?e:this.widget.size,i)}_placeAtAnchor(t,i,e){var s;const n=Ul(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new ql(220,2*r.lineHeight),h=t.top,c=function(){const e=n.width-(t.left+t.width+r.borderWidth+r.horizontalPadding),s=-r.borderWidth+t.left+t.width,c=new ql(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),l=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ql(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ql(t.width-r.borderHeight,n.height-t.top-t.height-r.verticalPadding);return{top:s,left:e,fit:h.height-i.height,maxSizeBottom:h,maxSizeTop:h,minSize:o.with(h.width)}}()],a=null!==(s=l.find((t=>t.fit>=0)))&&void 0!==s?s:l.sort(((t,i)=>i.fit-t.fit))[0],u=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(a.maxSizeTop.height,a.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=a.maxSizeTop.height?(d=!0,p=a.maxSizeTop):(d=!1,p=a.maxSizeBottom):f<=a.maxSizeBottom.height?(d=!1,p=a.maxSizeBottom):(d=!0,p=a.maxSizeTop),this._applyTopLeft({left:a.left,top:d?a.top:u-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,a===c,d,a!==c),this._resizable.minSize=a.minSize,this._resizable.maxSize=p,this._resizable.layout(f,Math.min(p.width,i.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(t){this._topLeft=t,this.getDomNode().style.left=`${this._topLeft.left}px`,this.getDomNode().style.top=`${this._topLeft.top}px`}}var h6;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(h6||(h6={}));const c6=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function l6(t,i,e,s){const n=s===h6.ROOT_FOLDER?["rootfolder-icon"]:s===h6.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===dl.data)r=uA.parseMetaData(e).get(uA.META_DATA_LABEL);else{const t=e.path.match(c6);t?(r=a6(t[2].toLowerCase()),t[1]&&n.push(`${a6(t[1].toLowerCase())}-name-dir-icon`)):r=a6(e.authority.toLowerCase())}if(s===h6.ROOT_FOLDER)n.push(`${r}-root-name-folder-icon`);else if(s===h6.FOLDER)n.push(`${r}-name-folder-icon`);else{if(r){if(n.push(`${r}-name-file-icon`),n.push("name-file-icon"),r.length<=255){const t=r.split(".");for(let i=1;i<t.length;i++)n.push(`${t.slice(i).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}const s=function(t,i,e){if(!e)return null;let s=null;if(e.scheme===dl.data){const t=uA.parseMetaData(e).get(uA.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==Ld?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${a6(s)}-lang-file-icon`)}}return n}function a6(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var u6,d6=function(t,i){return function(e,s){i(e,s,t)}};function f6(t){return`suggest-aria-id:${t}`}const g6=AV("suggest-more-info",xs.chevronRight,Q(0,"Icon for more information in the suggest widget.")),p6=new((u6=class{extract(t,i){if(t.textLabel.match(u6._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(u6._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=u6._regexRelaxed.exec(t.completion.documentation);if(e&&(0===e.index||e.index+e[0].length===t.completion.documentation.length))return i[0]=e[0],!0}return!1}})._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,u6._regexStrict=new RegExp(`^${u6._regexRelaxed.source}$`,"i"),u6);let m6=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ne,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Ui,e=t;e.classList.add("show-file-icons");const s=xa(t,Fa(".icon")),n=xa(s,Fa("span.colorspan")),r=xa(t,Fa(".contents")),o=xa(r,Fa(".main")),h=xa(o,Fa(".icon-label.codicon")),c=xa(o,Fa("span.left")),l=xa(o,Fa("span.right")),a=new Tj(c,{supportHighlights:!0,supportIcons:!0});i.add(a);const u=xa(c,Fa("span.signature-label")),d=xa(c,Fa("span.qualifier-label")),f=xa(l,Fa("span.details-label")),g=xa(l,Fa("span.readMore"+go.asCSSSelector(g6)));g.title=Q(0,"Read More");const p=()=>{const t=this._editor.getOptions(),i=t.get(50),n=i.getMassagedFontFamily(),r=i.fontFeatureSettings,h=t.get(118)||i.fontSize,c=t.get(119)||i.lineHeight,l=i.fontWeight,a=`${c}px`,u=`${i.letterSpacing}px`;e.style.fontSize=`${h}px`,e.style.fontWeight=l,e.style.letterSpacing=u,o.style.fontFamily=n,o.style.fontFeatureSettings=r,o.style.lineHeight=a,s.style.height=a,s.style.width=a,g.style.height=a,g.style.width=a};return p(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(118)||t.hasChanged(119))&&p()}))),{root:e,left:c,right:l,icon:s,colorspan:n,iconLabel:a,iconContainer:h,parametersLabel:u,qualifierLabel:d,detailsLabel:f,readMore:g,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=f6(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:q_(t.score)},r=[];if(19===s.kind&&p6.extract(t,r))e.icon.className="icon customcolor",e.iconContainer.className="icon hide",e.colorspan.style.backgroundColor=r[0];else if(20===s.kind&&this._themeService.getFileIconTheme().hasFileIcons){e.icon.className="icon hide",e.iconContainer.className="icon hide";const i=l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:t.textLabel}),h6.FILE),r=l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:s.detail}),h6.FILE);n.extraClasses=i.length>r.length?i:r}else 23===s.kind&&this._themeService.getFileIconTheme().hasFolderIcons?(e.icon.className="icon hide",e.iconContainer.className="icon hide",n.extraClasses=[l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:t.textLabel}),h6.FOLDER),l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:s.detail}),h6.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...go.asClassNameArray(Ls.toIcon(s.kind))));s.tags&&s.tags.indexOf(1)>=0&&(n.extraClasses=(n.extraClasses||[]).concat(["deprecated"]),n.matches=[]),e.iconLabel.setLabel(t.textLabel,void 0,n),"string"==typeof s.label?(e.parametersLabel.textContent="",e.detailsLabel.textContent=w6(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=w6(s.label.detail||""),e.detailsLabel.textContent=w6(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Ta(e.detailsLabel):Ra(e.detailsLabel),n6(t)?(e.right.classList.add("can-expand-details"),Ta(e.readMore),e.readMore.onmousedown=t=>{t.stopPropagation(),t.preventDefault()},e.readMore.onclick=t=>{t.stopPropagation(),t.preventDefault(),this._onDidToggleDetails.fire()}):(e.right.classList.remove("can-expand-details"),Ra(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function w6(t){return t.replace(/\r\n|\r|\n/g,"")}m6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([d6(1,no),d6(2,ud),d6(3,Nk)],m6);var v6,b6=function(t,i){return function(e,s){i(e,s,t)}};Jm("editorSuggestWidget.background",{dark:Zw,light:Zw,hcDark:Zw,hcLight:Zw},Q(0,"Background color of the suggest widget.")),Jm("editorSuggestWidget.border",{dark:Qw,light:Qw,hcDark:Qw,hcLight:Qw},Q(0,"Border color of the suggest widget."));const y6=Jm("editorSuggestWidget.foreground",{dark:Gw,light:Gw,hcDark:Gw,hcLight:Gw},Q(0,"Foreground color of the suggest widget."));Jm("editorSuggestWidget.selectedForeground",{dark:ab,light:ab,hcDark:ab,hcLight:ab},Q(0,"Foreground color of the selected entry in the suggest widget.")),Jm("editorSuggestWidget.selectedIconForeground",{dark:ub,light:ub,hcDark:ub,hcLight:ub},Q(0,"Icon foreground color of the selected entry in the suggest widget."));const k6=Jm("editorSuggestWidget.selectedBackground",{dark:db,light:db,hcDark:db,hcLight:db},Q(0,"Background color of the selected entry in the suggest widget."));Jm("editorSuggestWidget.highlightForeground",{dark:Gv,light:Gv,hcDark:Gv,hcLight:Gv},Q(0,"Color of the match highlights in the suggest widget.")),Jm("editorSuggestWidget.focusHighlightForeground",{dark:Zv,light:Zv,hcDark:Zv,hcLight:Zv},Q(0,"Color of the match highlights in the suggest widget when an item is focused.")),Jm("editorSuggestWidgetStatus.foreground",{dark:Gb(y6,.5),light:Gb(y6,.5),hcDark:Gb(y6,.5),hcLight:Gb(y6,.5)},Q(0,"Foreground color of the suggest widget status."));class C6{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof LQ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ql.is(t))return ql.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let S6=v6=class{constructor(t,i,e,s,n){this.editor=t,this._storageService=i,this._state=0,this._isAuto=!1,this._pendingLayout=new qi,this._pendingShowDetails=new qi,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new sc,this._disposables=new Ui,this._onDidSelect=new oe,this._onDidFocus=new oe,this._onDidHide=new ne,this._onDidShow=new ne,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ne,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new hX,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new x6(this,t),this._persistedSize=new C6(i,t);class r{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let o;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),o=new r(this._persistedSize.restore(),this.element.size)}))),this._disposables.add(this.element.onDidResize((t=>{var i,e,s,n;if(this._resize(t.dimension.width,t.dimension.height),o&&(o.persistHeight=o.persistHeight||!!t.north||!!t.south,o.persistWidth=o.persistWidth||!!t.east||!!t.west),t.done){if(o){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),h=Math.round(t/2);let{width:c,height:l}=this.element.size;(!o.persistHeight||Math.abs(o.currentSize.height-l)<=h)&&(l=null!==(e=null===(i=o.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!o.persistWidth||Math.abs(o.currentSize.width-c)<=h)&&(c=null!==(n=null===(s=o.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ql(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=xa(this.element.domNode,Fa(".message")),this._listElement=xa(this.element.domNode,Fa(".tree"));const h=this._disposables.add(n.createInstance(r6,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new o6(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(m6,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new KP("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>Q(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:e,description:s}=t.completion.label;e&&s?i=Q(0,"{0} {1}, {2}",i,e,s):e?i=Q(0,"{0} {1}",i,e):s&&(i=Q(0,"{0}, {1}",i,s))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:e,detail:s}=t.completion;return Q(0,"{0}, docs: {1}",i,Nn("{0}{1}",s||"",e?"string"==typeof e?e:e.value:""))}}}),this._list.style(kN({listInactiveFocusBackground:k6,listInactiveFocusOutline:ew})),this._status=n.createInstance(s6,this.element.domNode,o3);const a=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);a(),this._disposables.add(s.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(s.getColorTheme()),this._disposables.add(this._list.onMouseDown((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onTap((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onDidChangeSelection((t=>this._onListSelection(t)))),this._disposables.add(this._list.onDidChangeFocus((t=>this._onListFocus(t)))),this._disposables.add(this.editor.onDidChangeCursorSelection((()=>this._onCursorSelectionChanged()))),this._disposables.add(this.editor.onDidChangeConfiguration((t=>{t.hasChanged(117)&&(a(),c())}))),this._ctxSuggestWidgetVisible=r3.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=r3.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=r3.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=r3.HasFocusedSuggestion.bindTo(e),this._disposables.add(Nl(this._details.widget.domNode,"keydown",(t=>{this._onDetailsKeydown.fire(t)}))),this._disposables.add(this.editor.onMouseDown((t=>this._onEditorMouseDown(t))))}dispose(){var t;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),null===(t=this._loadingTimeout)||void 0===t||t.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(t){this._details.widget.domNode.contains(t.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(t.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){0!==this._state&&this._contentWidget.layout()}_onListMouseDownOrTap(t){void 0!==t.element&&void 0!==t.index&&(t.browserEvent.preventDefault(),t.browserEvent.stopPropagation(),this._select(t.element,t.index))}_onListSelection(t){t.elements.length&&this._select(t.elements[0],t.indexes[0])}_select(t,i){const e=this._completionModel;e&&(this._onDidSelect.fire({item:t,index:i,model:e}),this.editor.focus())}_onThemeChange(t){this._details.widget.borderWidth=Ey(t.type)?2:1}_onListFocus(t){var i;if(this._ignoreFocusEvents)return;if(!t.elements.length)return this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),void this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const e=t.elements[0],s=t.indexes[0];e!==this._focusedItem&&(null===(i=this._currentSuggestionDetails)||void 0===i||i.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=e,this._list.reveal(s),this._currentSuggestionDetails=Zh((async t=>{const i=ic((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose()));try{return await e.resolve(t)}finally{i.dispose(),s.dispose()}})),this._currentSuggestionDetails.then((()=>{s>=this._list.length||e!==this._list.element(s)||(this._ignoreFocusEvents=!0,this._list.splice(s,1,[e]),this._list.setFocus([s]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:f6(s)}))})).catch(Li)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(t){if(this._state!==t)switch(this._state=t,this.element.domNode.classList.toggle("frozen",4===t),this.element.domNode.classList.remove("message"),t){case 0:Ra(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=v6.LOADING_MESSAGE,Ra(this._listElement,this._status.element),Ta(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Sm(v6.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=v6.NO_SUGGESTIONS_MESSAGE,Ra(this._listElement,this._status.element),Ta(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Sm(v6.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Ra(this._messageElement),Ta(this._listElement,this._status.element),this._show();break;case 5:Ra(this._messageElement),Ta(this._listElement,this._status.element),this._details.show(),this._show()}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet((()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)}),100)}showTriggered(t,i){0===this._state&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!t,this._isAuto||(this._loadingTimeout=ic((()=>this._setState(1)),i)))}showSuggestions(t,i,e,s,n){var r,o;if(this._contentWidget.setPosition(this.editor.getPosition()),null===(r=this._loadingTimeout)||void 0===r||r.dispose(),null===(o=this._currentSuggestionDetails)||void 0===o||o.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==t&&(this._completionModel=t),e&&2!==this._state&&0!==this._state)return void this._setState(4);const h=this._completionModel.items.length,c=0===h;if(this._ctxSuggestWidgetMultipleSuggestions.set(h>1),c)return this._setState(s?0:2),void(this._completionModel=void 0);this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(e?4:3),this._list.reveal(i,0),this._list.setFocus(n?[]:[i])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=Wl(Al(this.element.domNode),(()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")}))}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(0!==this._state&&2!==this._state&&1!==this._state&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){5===this._state?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):3===this._state&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):!n6(this._list.getFocusedElements()[0])&&!this._explainMode||3!==this._state&&5!==this._state&&4!==this._state||(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(t){this._pendingShowDetails.value=Wl(Al(this.element.domNode),(()=>{this._pendingShowDetails.clear(),this._details.show(),t?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._positionDetails(),this.editor.focus(),this.element.domNode.classList.add("shows-details")}))}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var t;this._pendingLayout.clear(),this._pendingShowDetails.clear(),null===(t=this._loadingTimeout)||void 0===t||t.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const i=this._persistedSize.restore(),e=Math.ceil(4.3*this.getLayoutInfo().itemHeight);i&&i.height<e&&this._persistedSize.store(i.with(void 0,e))}isFrozen(){return 4===this._state}_afterRender(t){null!==t?2!==this._state&&1!==this._state&&(this._isDetailsVisible()&&this._details.show(),this._positionDetails()):this._isDetailsVisible()&&this._details.hide()}_layout(t){var i,e,s;if(!this.editor.hasModel())return;if(!this.editor.getDomNode())return;const n=Ul(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();t||(t=r.defaultSize);let o=t.height,h=t.width;if(this._status.element.style.height=`${r.itemHeight}px`,2===this._state||1===this._state)o=r.itemHeight+r.borderHeight,h=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new ql(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const l=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,a=r.statusBarHeight+this._list.contentHeight+r.borderHeight,u=r.itemHeight+r.statusBarHeight,d=Zl(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,a),p=d.top+f.top-r.verticalPadding,m=Math.min(p,a);let w=Math.min(Math.max(m,g)+r.borderHeight,a);o===(null===(i=this._cappedHeight)||void 0===i?void 0:i.capped)&&(o=this._cappedHeight.wanted),o<u&&(o=u),o>w&&(o=w),o>g||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),w=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),w=g),this.element.preferredSize=new ql(l,r.defaultSize.height),this.element.maxSize=new ql(c,w),this.element.minSize=new ql(220,u),this._cappedHeight=o===a?{wanted:null!==(s=null===(e=this._cappedHeight)||void 0===e?void 0:e.wanted)&&void 0!==s?s:t.height,capped:o}:void 0}this._resize(h,o)}_resize(t,i){const{width:e,height:s}=this.element.maxSize;t=Math.min(e,t),i=Math.min(s,i);const{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(i-n,t),this._listElement.style.height=i-n+"px",this.element.layout(i,t),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var t;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,2===(null===(t=this._contentWidget.getPosition())||void 0===t?void 0:t.preference[0]))}getLayoutInfo(){const t=this.editor.getOption(50),i=qT(this.editor.getOption(119)||t.lineHeight,8,1e3),e=this.editor.getOption(117).showStatusBar&&2!==this._state&&1!==this._state?i:0,s=this._details.widget.borderWidth,n=2*s;return{itemHeight:i,statusBarHeight:e,borderWidth:s,borderHeight:n,typicalHalfwidthCharacterWidth:t.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new ql(430,e+12*i+n)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(t){this._storageService.store("expandSuggestionDocs",t,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};S6.LOADING_MESSAGE=Q(0,"Loading..."),S6.NO_SUGGESTIONS_MESSAGE=Q(0,"No suggestions."),S6=v6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([b6(1,aN),b6(2,th),b6(3,Nk),b6(4,io)],S6);class x6{constructor(t,i){this._widget=t,this._editor=i,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return!this._hidden&&this._position&&this._preference?{position:this._position,preference:[this._preference]}:null}beforeRender(){const{height:t,width:i}=this._widget.element.size,{borderWidth:e,horizontalPadding:s}=this._widget.getLayoutInfo();return new ql(i+2*e+s,t+2*e)}afterRender(t){this._widget._afterRender(t)}setPreference(t){this._preferenceLocked||(this._preference=t)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(t){this._position=t}}var D6,E6=function(t,i){return function(e,s){i(e,s,t)}};class A6{constructor(t,i){if(this._model=t,this._position=i,t.getLineMaxColumn(i.lineNumber)!==i.column){const e=t.getOffsetAt(i),s=t.getPositionAt(e+1);this._marker=t.deltaDecorations([],[{range:bs.fromPositions(i,s),options:{description:"suggest-line-suffix",stickiness:1}}])}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.deltaDecorations(this._marker,[])}delta(t){if(this._model.isDisposed()||this._position.lineNumber!==t.lineNumber)return 0;if(this._marker){const i=this._model.getDecorationRange(this._marker[0]);return this._model.getOffsetAt(i.getStartPosition())-this._model.getOffsetAt(t)}return this._model.getLineMaxColumn(t.lineNumber)-t.column}}let M6=D6=class{static get(t){return t.getContribution(D6.ID)}constructor(t,i,e,s,n,r,o){this._memoryService=i,this._commandService=e,this._contextKeyService=s,this._instantiationService=n,this._logService=r,this._telemetryService=o,this._lineSuffix=new qi,this._toDispose=new Ui,this._selectors=new L6((t=>t.priority)),this._onWillInsertSuggestItem=new ne,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(X3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=r3.InsertMode.bindTo(s);h.set(t.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger((()=>h.set(t.getOption(117).insertMode)))),this.widget=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>{const t=this._instantiationService.createInstance(S6,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new U3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=r3.MakesTextEdit.bindTo(this._contextKeyService),s=r3.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=r3.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(zi((()=>{e.reset(),s.reset(),n.reset()}))),this._toDispose.add(t.onDidFocus((({item:t})=>{const i=this.editor.getPosition(),r=t.editStart.column,o=i.column;let h=!0;"smart"!==this.editor.getOption(1)||2!==this.model.state||t.completion.additionalTextEdits||4&t.completion.insertTextRules||o-r!==t.completion.insertText.length||(h=this.editor.getModel().getValueInRange({startLineNumber:i.lineNumber,startColumn:r,endLineNumber:i.lineNumber,endColumn:o})!==t.completion.insertText),e.set(h),s.set(!vs.equals(t.editInsertEnd,t.editReplaceEnd)),n.set(Boolean(t.provider.resolveCompletionItem)||Boolean(t.completion.documentation)||t.completion.detail!==t.completion.label)}))),this._toDispose.add(t.onDetailsKeyDown((t=>{t.toKeyCodeChord().equals(new ch(!0,!1,!1,!1,33))||pt&&t.toKeyCodeChord().equals(new ch(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>this._toDispose.add(new t6(this.editor,this.model))))),this._alternatives=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>this._toDispose.add(new z3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(V3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new A6(this.editor.getModel(),t.position)}))),this._toDispose.add(this.model.onDidSuggest((t=>{if(t.triggerOptions.shy)return;let i=-1;for(const e of this._selectors.itemsOrderedByPriorityDesc)if(i=e.select(this.editor.getModel(),this.editor.getPosition(),t.completionModel.items),-1!==i)break;-1===i&&(i=0);let e=!1;if(t.triggerOptions.auto){const i=this.editor.getOption(117);"never"===i.selectionMode||"always"===i.selectionMode?e="never"===i.selectionMode:"whenTriggerCharacter"===i.selectionMode?e=1!==t.triggerOptions.triggerKind:"whenQuickSuggestion"===i.selectionMode&&(e=1===t.triggerOptions.triggerKind&&!t.triggerOptions.refilter)}this.widget.value.showSuggestions(t.completionModel,i,t.isFrozen,t.triggerOptions.auto,e)}))),this._toDispose.add(this.model.onDidCancel((t=>{t.retrigger||this.widget.value.hideWidget()}))),this._toDispose.add(this.editor.onDidBlurEditorWidget((()=>{this.model.cancel(),this.model.clear()})));const c=r3.AcceptSuggestionsOnEnter.bindTo(s),l=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>l()))),l()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(t,i){if(!t||!t.item)return this._alternatives.value.reset(),this.model.cancel(),void this.model.clear();if(!this.editor.hasModel())return;const e=F3.get(this.editor);if(!e)return;this._onWillInsertSuggestItem.fire({item:t.item});const s=this.editor.getModel(),n=s.getAlternativeVersionId(),{item:r}=t,o=[],h=new pe;1&i||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,Boolean(8&i));this._memoryService.memorize(s,this.editor.getPosition(),r);const l=r.isResolved;let a=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=$z.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>QR.replaceMove(bs.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!l){const t=new Yi;let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=bs.getEndPosition(i.range);e&&!vs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let l=!1;const a=this.editor.onWillType((()=>{a.dispose(),l=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return;if(e&&r.completion.additionalTextEdits.some((t=>vs.isBefore(e,bs.getStartPosition(t.range)))))return!1;l&&this.editor.pushUndoStop();const t=$z.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>QR.replaceMove(bs.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!l&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),u=!0===i?1:!1===i?0:-2})).finally((()=>{n.dispose(),a.dispose()})))}let{insertText:d}=r.completion;if(4&r.completion.insertTextRules||(d=V5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===F6.id)this.model.trigger({auto:!0,retrigger:!0});else{const t=new Yi;o.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch((t=>{r.completion.extensionId?Fi(t):Li(t)})).finally((()=>{a=t.elapsed()})))}4&i&&this._alternatives.value.set(t,(t=>{for(h.cancel();s.canUndo();){n!==s.getAlternativeVersionId()&&s.undo(),this._insertSuggestion(t,3|(8&i?8:0));break}})),this._alertCompletionItem(r),Promise.all(o).finally((()=>{this._reportSuggestionAcceptedTelemetry(r,s,l,a,u),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e,s,n){var r,o,h;0!==Math.floor(100*Math.random())&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:null!==(o=null===(r=t.extensionId)||void 0===r?void 0:r.value)&&void 0!==o?o:"unknown",providerId:null!==(h=t.provider._debugDisplayName)&&void 0!==h?h:"unknown",kind:t.completion.kind,basenameHash:bl(eA(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:sA(i.uri),resolveInfo:t.provider.resolveCompletionItem?e?1:0:-1,resolveDuration:t.resolveDuration,commandDuration:s,additionalEditsAsync:n})}getOverwriteInfo(t,i){B(this.editor.hasModel());let e="replace"===this.editor.getOption(117).insertMode;i&&(e=!e);const s=(e?t.editReplaceEnd.column:t.editInsertEnd.column)-t.position.column;return{overwriteBefore:t.position.column-t.editStart.column+(this.editor.getPosition().column-t.position.column),overwriteAfter:s+(this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0)}}_alertCompletionItem(t){u(t.completion.additionalTextEdits)&&Cm(Q(0,"Accepting '{0}' made {1} additional edits",t.textLabel,t.completion.additionalTextEdits.length))}triggerSuggest(t,i,e){this.editor.hasModel()&&(this.model.trigger({auto:null!=i&&i,completionOptions:{providerFilter:t,kindFilter:e?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(t){if(!this.editor.hasModel())return;const i=this.editor.getPosition(),e=()=>{i.equals(this.editor.getPosition())&&this._commandService.executeCommand(t.fallback)},s=t=>{if(4&t.completion.insertTextRules||t.completion.additionalTextEdits)return!0;const i=this.editor.getPosition(),e=t.editStart.column,s=i.column;return s-e!==t.completion.insertText.length||this.editor.getModel().getValueInRange({startLineNumber:i.lineNumber,startColumn:e,endLineNumber:i.lineNumber,endColumn:s})!==t.completion.insertText};Xi.once(this.model.onDidTrigger)((()=>{const t=[];Xi.any(this.model.onDidTrigger,this.model.onDidCancel)((()=>{Vi(t),e()}),void 0,t),this.model.onDidSuggest((({completionModel:i})=>{if(Vi(t),0===i.items.length)return void e();const n=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),i.items),r=i.items[n];s(r)?(this.editor.pushUndoStop(),this._insertSuggestion({index:n,item:r,model:i},7)):e()}),void 0,t)})),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(i,0),this.editor.focus()}acceptSelectedSuggestion(t,i){const e=this.widget.value.getFocusedItem();let s=0;t&&(s|=4),i&&(s|=8),this._insertSuggestion(e,s)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(t){return this._selectors.register(t)}};M6.ID="editor.contrib.suggestController",M6=D6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([E6(1,W3),E6(2,po),E6(3,th),E6(4,io),E6(5,Rh),E6(6,Th)],M6);class L6{constructor(t){this.prioritySelector=t,this._items=new Array}register(t){if(-1!==this._items.indexOf(t))throw new Error("Value is already registered");return this._items.push(t),this._items.sort(((t,i)=>this.prioritySelector(i)-this.prioritySelector(t))),{dispose:()=>{const i=this._items.indexOf(t);i>=0&&this._items.splice(i,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class F6 extends Ga{constructor(){super({id:F6.id,label:Q(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Oo.and(PS.writable,PS.hasCompletionItemProvider,r3.Visible.toNegated()),kbOpts:{kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=M6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}F6.id="editor.action.triggerSuggest",iu(M6.ID,M6,2),Xa(F6);const T6=190,R6=qa.bindToContribution(M6.get);Ya(new R6({id:"acceptSelectedSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Oo.and(r3.Visible,PS.textInputFocus),weight:T6},{primary:3,kbExpr:Oo.and(r3.Visible,PS.textInputFocus,r3.AcceptSuggestionsOnEnter,r3.MakesTextEdit),weight:T6}],menuOpts:[{menuId:o3,title:Q(0,"Insert"),group:"left",order:1,when:r3.HasInsertAndReplaceRange.toNegated()},{menuId:o3,title:Q(0,"Insert"),group:"left",order:1,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("insert"))},{menuId:o3,title:Q(0,"Replace"),group:"left",order:1,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("replace"))}]})),Ya(new R6({id:"acceptAlternativeSelectedSuggestion",precondition:Oo.and(r3.Visible,PS.textInputFocus,r3.HasFocusedSuggestion),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:o3,group:"left",order:2,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("insert")),title:Q(0,"Replace")},{menuId:o3,group:"left",order:2,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("replace")),title:Q(0,"Insert")}]})),mo.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),Ya(new R6({id:"hideSuggestWidget",precondition:r3.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:9,secondary:[1033]}})),Ya(new R6({id:"selectNextSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),Ya(new R6({id:"selectNextPageSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:12,secondary:[2060]}})),Ya(new R6({id:"selectLastSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),Ya(new R6({id:"selectPrevSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),Ya(new R6({id:"selectPrevPageSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:11,secondary:[2059]}})),Ya(new R6({id:"selectFirstSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),Ya(new R6({id:"focusSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),Ya(new R6({id:"focusAndAcceptSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),Ya(new R6({id:"toggleSuggestionDetails",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:o3,group:"right",order:1,when:Oo.and(r3.DetailsVisible,r3.CanResolve),title:Q(0,"show less")},{menuId:o3,group:"right",order:1,when:Oo.and(r3.DetailsVisible.toNegated(),r3.CanResolve),title:Q(0,"show more")}]})),Ya(new R6({id:"toggleExplainMode",precondition:r3.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),Ya(new R6({id:"toggleSuggestionFocus",precondition:r3.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2570,mac:{primary:778}}})),Ya(new R6({id:"insertBestCompletion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),V3.AtEnd,r3.Visible.toNegated(),z3.OtherSuggestions.toNegated(),F3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(F(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:T6,primary:2}})),Ya(new R6({id:"insertNextSuggestion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),z3.OtherSuggestions,r3.Visible.toNegated(),F3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2}})),Ya(new R6({id:"insertPrevSuggestion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),z3.OtherSuggestions,r3.Visible.toNegated(),F3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:1026}})),Xa(class extends Ga{constructor(){super({id:"editor.action.resetSuggestSize",label:Q(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=M6.get(i))||void 0===e||e.resetWidgetSize()}});class O6 extends Ki{get selectedItem(){return this._selectedItem}constructor(t,i,e,s){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.onWillAccept=s,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=gz(this,void 0),this._register(t.onKeyDown((t=>{t.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))}))),this._register(t.onKeyUp((t=>{t.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))})));const n=M6.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(t,i,e)=>{var s;nz((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(s=this.suggestControllerPreselector())||void 0===s?void 0:s.removeCommonPrefix(r);if(!o)return-1;const h=vs.lift(i),c=Zf(e.map(((t,i)=>{const e=_6.fromSuggestion(n,r,h,t,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(r);return{index:i,valid:o.augments(e),prefixLength:e.text.length,suggestItem:t}})).filter((t=>t&&t.valid&&t.prefixLength>0)),S((t=>t.prefixLength),x));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(n.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(n.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(n.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Xi.once(n.model.onDidTrigger)((()=>{i()}))),this._register(n.onWillInsertSuggestItem((t=>{const i=this.editor.getPosition(),e=this.editor.getModel();if(!i||!e)return;const s=_6.fromSuggestion(n,e,i,t.item,this.isShiftKeyPressed);this.onWillAccept(s)})))}this.update(this._isActive)}update(t){const i=this.getSuggestItemInfo();this._isActive===t&&function(t,i){return t===i||!(!t||!i)&&t.equals(i)}(this._currentSuggestItemInfo,i)||(this._isActive=t,this._currentSuggestItemInfo=i,nz((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=M6.get(this.editor);if(!t||!this.isSuggestWidgetVisible)return;const i=t.widget.value.getFocusedItem(),e=this.editor.getPosition(),s=this.editor.getModel();return i&&e&&s?_6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=M6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=M6.get(this.editor);null==t||t.forceRenderingAbove()}}class _6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new V5).parse(r);t.children.length<100&&E3.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new _6(bs.fromPositions(e.delta(0,-h.overwriteBefore),e.delta(0,Math.max(h.overwriteAfter,0))),r,s.completion.kind,o)}constructor(t,i,e,s){this.range=t,this.insertText=i,this.completionItemKind=e,this.isSnippetText=s}equals(t){return this.range.equalsRange(t.range)&&this.insertText===t.insertText&&this.completionItemKind===t.completionItemKind&&this.isSnippetText===t.isSnippetText}toSelectedSuggestionInfo(){return new Os(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new G5(this.range,this.insertText)}}var I6,P6=function(t,i){return function(e,s){i(e,s,t)}};let N6=I6=class extends Ki{static get(t){return t.getContribution(I6.ID)}constructor(t,i,e,s,n,r,o,h,c){super(),this.editor=t,this._instantiationService=i,this._contextKeyService=e,this._configurationService=s,this._commandService=n,this._debounceService=r,this._languageFeaturesService=o,this._audioCueService=h,this._keybindingService=c,this.model=mz("inlineCompletionModel",void 0),this._textModelVersionId=gz(this,-1),this._cursorPosition=gz(this,new vs(1,1)),this._suggestWidgetAdaptor=this._register(new O6(this.editor,(()=>{var t,i;return null===(i=null===(t=this.model.get())||void 0===t?void 0:t.selectedInlineCompletion.get())||void 0===i?void 0:i.toSingleTextEdit(void 0)}),(t=>this.updateObservables(t,R3.Other)),(t=>{nz((i=>{var e;this.updateObservables(i,R3.Other),null===(e=this.model.get())||void 0===e||e.handleSuggestAccepted(t)}))}))),this._enabled=Tz(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(62).enabled)),this._ghostTextWidget=this._register(this._instantiationService.createInstance(A5,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:Lz(0),targetTextModel:this.model.map((t=>null==t?void 0:t.textModel))})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._playAudioCueSignal=Iz(this),this._isReadonly=Tz(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(90))),this._textModel=Tz(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this._textModelIfWritable=bz((t=>this._isReadonly.read(t)?void 0:this._textModel.read(t))),this._register(new m5(this._contextKeyService,this.model)),this._register(xz((e=>{const s=this._textModelIfWritable.read(e);nz((e=>{if(this.model.set(void 0,e),this.updateObservables(e,R3.Other),s){const n=i.createInstance(_3,s,this._suggestWidgetAdaptor.selectedItem,this._cursorPosition,this._textModelVersionId,this._debounceValue,Tz(t.onDidChangeConfiguration,(()=>t.getOption(117).preview)),Tz(t.onDidChangeConfiguration,(()=>t.getOption(117).previewMode)),Tz(t.onDidChangeConfiguration,(()=>t.getOption(62).mode)),this._enabled);this.model.set(n,e)}}))})));const l=t=>{var i;return t.isUndoing?R3.Undo:t.isRedoing?R3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?R3.AcceptWord:R3.Other};let a;this._register(t.onDidChangeModelContent((t=>nz((i=>this.updateObservables(i,l(t))))))),this._register(t.onDidChangeCursorPosition((t=>nz((i=>{var e;this.updateObservables(i,R3.Other),3!==t.reason&&"api"!==t.source||null===(e=this.model.get())||void 0===e||e.stop(i)}))))),this._register(t.onDidType((()=>nz((t=>{var i;this.updateObservables(t,R3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this._commandService.onDidExecuteCommand((i=>{new Set([US.Tab.id,US.DeleteLeft.id,US.DeleteRight.id,u0,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&nz((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(62).keepOnBlur||y0.dropDownVisible||nz((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(xz((t=>{var i;const e=null===(i=this.model.read(t))||void 0===i?void 0:i.state.read(t);(null==e?void 0:e.suggestItem)?e.ghostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(zi((()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(Ez({handleChange:t=>(t.didChange(this._playAudioCueSignal)&&(a=void 0),!0)},(async t=>{this._playAudioCueSignal.read(t);const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.inlineCompletion){if(e.inlineCompletion.semanticId!==a){a=e.inlineCompletion.semanticId;const t=i.textModel.getLineContent(e.ghostText.lineNumber);this._audioCueService.playAudioCue(LH.inlineSuggestion).then((()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(e.ghostText.renderForScreenReader(t))}))}}else a=void 0}))),this._register(new w0(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}))),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAudioCue(t){this._playAudioCueSignal.trigger(t)}provideScreenReaderUpdate(t){const i=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),e=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let s;!i&&e&&this.editor.getOption(147)&&(s=Q(0,"Inspect this in the accessible view ({0})",e.getAriaLabel())),Cm(s?t+", "+s:t)}updateObservables(t,i){var e,s;const n=this.editor.getModel();this._textModelVersionId.set(null!==(e=null==n?void 0:n.getVersionId())&&void 0!==e?e:-1,t,i),this._cursorPosition.set(null!==(s=this.editor.getPosition())&&void 0!==s?s:new vs(1,1),t)}shouldShowHoverAt(t){var i;const e=null===(i=this.model.get())||void 0===i?void 0:i.ghostText.get();return!!e&&e.parts.some((i=>t.containsPosition(new vs(e.lineNumber,i.column))))}shouldShowHoverAtViewZone(t){return this._ghostTextWidget.ownsViewZone(t)}};N6.ID="editor.contrib.inlineCompletionsController",N6=I6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P6(1,io),P6(2,th),P6(3,rd),P6(4,po),P6(5,YT),P6(6,op),P6(7,EH),P6(8,HC)],N6);class B6 extends Ga{constructor(){super({id:B6.ID,label:Q(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(t,i){var e;const s=N6.get(i);null===(e=null==s?void 0:s.model.get())||void 0===e||e.next()}}B6.ID=f0;class $6 extends Ga{constructor(){super({id:$6.ID,label:Q(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(t,i){var e;const s=N6.get(i);null===(e=null==s?void 0:s.model.get())||void 0===e||e.previous()}}$6.ID=d0;class W6 extends Ga{constructor(){super({id:W6.ID,label:Q(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:m5.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(t,i){const e=N6.get(i);nz((t=>{var i;null===(i=null==e?void 0:e.model.get())||void 0===i||i.stop(t)}))}}W6.ID="editor.action.inlineSuggest.hide";class j6 extends Lh{constructor(){super({id:j6.ID,title:Q(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:Sh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Oo.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(t,i){const e=t.get(rd),s=e.getValue("editor.inlineSuggest.showToolbar");e.updateValue("editor.inlineSuggest.showToolbar","always"===s?"onHover":"always")}}j6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var V6=function(t,i){return function(e,s){i(e,s,t)}};class H6{constructor(t,i,e){this.owner=t,this.range=i,this.controller=e}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let z6=class{constructor(t,i,e,s,n,r){this._editor=t,this._languageService=i,this._openerService=e,this.accessibilityService=s,this._instantiationService=n,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(t){const i=N6.get(this._editor);if(!i)return null;const e=t.target;if(8===e.type){const s=e.detail;if(i.shouldShowHoverAtViewZone(s.viewZoneId))return new rX(1e3,this,bs.fromPositions(this._editor.getModel().validatePosition(s.positionBefore||s.position)),t.event.posx,t.event.posy,!1)}return 7===e.type&&i.shouldShowHoverAt(e.range)||6===e.type&&e.detail.mightBeForeignElement&&i.shouldShowHoverAt(e.range)?new rX(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("onHover"!==this._editor.getOption(62).showToolbar)return[];const e=N6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new H6(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Ui,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(y0,this._editor,!1,Lz(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]})));return t.fragment.appendChild(r.getDomNode()),n.triggerExplicitly(),e.add(r),e}renderScreenReaderText(t,i,e){const s=Fa,n=s("div.hover-row.markdown-hover"),r=xa(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new GZ({editor:this._editor},this._languageService,this._openerService));e.add(xz((s=>{var n;const h=null===(n=i.controller.model.read(s))||void 0===n?void 0:n.ghostText.read(s);if(h){const i=this._editor.getModel().getLineContent(h.lineNumber);(i=>{e.add(o.onDidRenderAsync((()=>{r.className="hover-contents code-hover-contents",t.onContentsChanged()})));const s=Q(0,"Suggestion:"),n=e.add(o.render((new bI).appendText(s).appendCodeblock("text",i)));r.replaceChildren(n.element)})(h.renderForScreenReader(i))}else Ea(r)}))),t.fragment.appendChild(n)}};function U6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function K6(t,i,e){t=t<0?0:t;let s="";if(!e){const e=Math.floor(t/i);t%=i;for(let t=0;t<e;t++)s+="\t"}for(let i=0;i<t;i++)s+=" ";return s}z6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([V6(1,ud),V6(2,ZN),V6(3,Om),V6(4,io),V6(5,Th)],z6),iu(N6.ID,N6,3),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:Q(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:PS.writable})}async run(t,i){const e=N6.get(i);await async function(t){const i=new hz(t,void 0);try{await t(i)}finally{i.finish()}}((async t=>{var i;await(null===(i=null==e?void 0:e.model.get())||void 0===i?void 0:i.triggerExplicitly(t)),null==e||e.playAudioCue(t)}))}}),Xa(B6),Xa($6),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:Q(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Oo.and(PS.writable,m5.inlineSuggestionVisible)},menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept Word"),group:"primary",order:2}]})}async run(t,i){var e;const s=N6.get(i);await(null===(e=null==s?void 0:s.model.get())||void 0===e?void 0:e.acceptNextWord(s.editor))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:Q(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept Line"),group:"secondary",order:2}]})}async run(t,i){var e;const s=N6.get(i);await(null===(e=null==s?void 0:s.model.get())||void 0===e?void 0:e.acceptNextLine(s.editor))}}),Xa(class extends Ga{constructor(){super({id:u0,label:Q(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:m5.inlineSuggestionVisible,menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Oo.and(m5.inlineSuggestionVisible,PS.tabMovesFocus.toNegated(),m5.inlineSuggestionHasIndentationLessThanTabSize,r3.Visible.toNegated(),PS.hoverFocused.toNegated())}})}async run(t,i){var e;const s=N6.get(i);s&&(null===(e=s.model.get())||void 0===e||e.accept(s.editor),s.editor.focus())}}),Xa(W6),Fh(j6),oX.register(z6);function q6(t,i,e,s,n){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return[];const r=i.getLanguageConfiguration(t.getLanguageId()).indentationRules;if(!r)return[];for(s=Math.min(s,t.getLineCount());e<=s&&r.unIndentedLinePattern;){const i=t.getLineContent(e);if(!r.unIndentedLinePattern.test(i))break;e++}if(e>s-1)return[];const{tabSize:o,indentSize:h,insertSpaces:c}=t.getOptions(),l=(t,i)=>SS.shiftIndent(t,t.length+(i=i||1),o,h,c),a=(t,i)=>SS.unshiftIndent(t,t.length+(i=i||1),o,h,c),u=[];let d;const f=t.getLineContent(e);let g=f;if(null!=n){d=n;const t=Kn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=a(d),g=d+f.substring(t.length)),f!==g&&u.push(QR.replaceMove(new ys(e,1,e,t.length+1),GC(d,h,c)))}else d=Kn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=l(p),d=l(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=l(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=Kn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=a(p),d=a(d)),s!==p&&u.push(QR.replaceMove(new ys(i,1,i,s.length+1),GC(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=l(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?l(p):d)}return u}class G6 extends Ga{constructor(){super({id:G6.ID,label:Q(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:PS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new n9(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}G6.ID="editor.action.indentationToSpaces";class Z6 extends Ga{constructor(){super({id:Z6.ID,label:Q(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:PS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new r9(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}Z6.ID="editor.action.indentationToTabs";class J6 extends Ga{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(mj),s=t.get(no),n=i.getModel();if(!n)return;const r=s.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget),o=n.getOptions(),h=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===r.tabSize&&t===o.tabSize?Q(0,"Configured Tab Size"):t===r.tabSize?Q(0,"Default Tab Size"):t===o.tabSize?Q(0,"Current Tab Size"):void 0}))),c=Math.min(n.getOptions().tabSize-1,7);setTimeout((()=>{e.pick(h,{placeHolder:Q(0,"Select Tab Size for Current File"),activeItem:h[c]}).then((t=>{if(t&&n&&!n.isDisposed()){const i=parseInt(t.label,10);n.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class Q6 extends J6{constructor(){super(!1,!1,{id:Q6.ID,label:Q(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}Q6.ID="editor.action.indentUsingTabs";class Y6 extends J6{constructor(){super(!0,!1,{id:Y6.ID,label:Q(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}Y6.ID="editor.action.indentUsingSpaces";class X6 extends J6{constructor(){super(!0,!0,{id:X6.ID,label:Q(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}X6.ID="editor.action.changeTabDisplaySize";class t9 extends Ga{constructor(){super({id:t9.ID,label:Q(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(no),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}t9.ID="editor.action.detectIndentation";class i9{constructor(t,i){this._initialSelection=i,this._edits=[],this._selectionId=null;for(const i of t)i.range&&"string"==typeof i.text&&this._edits.push(i)}getEditOperations(t,i){for(const t of this._edits)i.addEditOperation(bs.lift(t.range),t.text);let e=!1;Array.isArray(this._edits)&&1===this._edits.length&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(e=!0,this._selectionId=i.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(e=!0,this._selectionId=i.trackSelection(this._initialSelection,!1))),e||(this._selectionId=i.trackSelection(this._initialSelection))}computeCursorState(t,i){return i.getTrackedSelection(this._selectionId)}}let e9=class{constructor(t,i){this.editor=t,this._languageConfigurationService=i,this.callOnDispose=new Ui,this.callOnModel=new Ui,this.callOnDispose.add(t.onDidChangeConfiguration((()=>this.update()))),this.callOnDispose.add(t.onDidChangeModel((()=>this.update()))),this.callOnDispose.add(t.onDidChangeModelLanguage((()=>this.update())))}update(){this.callOnModel.clear(),this.editor.getOption(12)<4||this.editor.getOption(55)||this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste((({range:t})=>{this.trigger(t)})))}trigger(t){const i=this.editor.getSelections();if(null===i||i.length>1)return;const e=this.editor.getModel();if(!e)return;if(!e.tokenization.isCheapToTokenize(t.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>SS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>SS.unshiftIndent(t,t.length+1,n,r,o)};let l=t.startLineNumber;for(;l<=t.endLineNumber&&this.shouldIgnoreLine(e,l);)l++;if(l>t.endLineNumber)return;let a=e.getLineContent(l);if(!/\S/.test(a.substring(0,t.startColumn-1))){const t=AS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=Kn(a),s=U6(t,n);if(s!==U6(i,n)){const t=K6(s,n,o);h.push({range:new bs(l,1,l,i.length+1),text:t}),a=t+a.substr(i.length)}else{const t=MS(e,l,this._languageConfigurationService);if(0===t||8===t)return}}}const u=l;for(;l<t.endLineNumber&&!/\S/.test(e.getLineContent(l+1));)l++;if(l!==t.endLineNumber){const i=AS(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===u?a:e.getLineContent(t)},e.getLanguageId(),l+1,c,this._languageConfigurationService);if(null!==i){const s=U6(i,n),r=U6(Kn(e.getLineContent(l+1)),n);if(s!==r){const i=s-r;for(let s=l+1;s<=t.endLineNumber;s++){const t=Kn(e.getLineContent(s)),r=K6(U6(t,n)+i,n,o);r!==t&&h.push({range:new bs(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new i9(h,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",t),this.editor.pushUndoStop()}}shouldIgnoreLine(t,i){t.tokenization.forceTokenization(i);const e=t.getLineFirstNonWhitespaceColumn(i);if(0===e)return!0;const s=t.tokenization.getLineTokens(i);if(s.getCount()>0){const t=s.findTokenIndexAtOffset(e);if(t>=0&&1===s.getStandardTokenType(t))return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};function s9(t,i,e,s){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return;let n="";for(let t=0;t<e;t++)n+=" ";const r=new RegExp(n,"gi");for(let e=1,o=t.getLineCount();e<=o;e++){let o=t.getLineFirstNonWhitespaceColumn(e);if(0===o&&(o=t.getLineMaxColumn(e)),1===o)continue;const h=new bs(e,1,e,o),c=t.getValueInRange(h),l=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,l)}}e9.ID="editor.contrib.autoIndentOnPaste",e9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Nd)],e9);class n9{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),s9(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class r9{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),s9(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}iu(e9.ID,e9,2),Xa(G6),Xa(Z6),Xa(Q6),Xa(Y6),Xa(X6),Xa(t9),Xa(class extends Ga{constructor(){super({id:"editor.action.reindentlines",label:Q(0,"Reindent Lines"),alias:"Reindent Lines",precondition:PS.writable})}run(t,i){const e=t.get(Nd),s=i.getModel();if(!s)return;const n=q6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.reindentselectedlines",label:Q(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:PS.writable})}run(t,i){const e=t.get(Nd),s=i.getModel();if(!s)return;const n=i.getSelections();if(null===n)return;const r=[];for(const t of n){let i=t.startLineNumber,n=t.endLineNumber;if(i!==n&&1===t.endColumn&&n--,1===i){if(i===n)continue}else i--;const o=q6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});class o9{constructor(t,i){this.range=t,this.direction=i}}class h9{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new h9(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}async resolve(t){if("function"==typeof this.provider.resolveInlayHint){if(this._currentResolve){if(await this._currentResolve,t.isCancellationRequested)return;return this.resolve(t)}this._isResolved||(this._currentResolve=this._doResolve(t).finally((()=>this._currentResolve=void 0))),await this._currentResolve}}async _doResolve(t){var i,e;try{const s=await Promise.resolve(this.provider.resolveInlayHint(this.hint,t));this.hint.tooltip=null!==(i=null==s?void 0:s.tooltip)&&void 0!==i?i:this.hint.tooltip,this.hint.label=null!==(e=null==s?void 0:s.label)&&void 0!==e?e:this.hint.label,this._isResolved=!0}catch(t){Fi(t),this._isResolved=!1}}}class c9{static async create(t,i,e,s){const n=[],r=t.ordered(i).reverse().map((t=>e.map((async e=>{try{const r=await t.provideInlayHints(i,e,s);(null==r?void 0:r.hints.length)&&n.push([r,t])}catch(t){Fi(t)}}))));if(await Promise.all(r.flat()),s.isCancellationRequested||i.isDisposed())throw new _i;return new c9(e,n,i)}constructor(t,i,e){this._disposables=new Ui,this.ranges=t,this.provider=new Set;const s=[];for(const[t,n]of i){this._disposables.add(t),this.provider.add(n);for(const i of t.hints){const t=e.validatePosition(i.position);let r="before";const o=c9._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=bs.fromPositions(o.getStartPosition(),t),r="after"):(h=bs.fromPositions(t,o.getEndPosition()),r="before"),s.push(new h9(i,new o9(h,r),n))}}this.items=s.sort(((t,i)=>vs.compare(t.hint.position,i.hint.position)))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(t,i){const e=i.lineNumber,s=t.getWordAtPosition(i);if(s)return new bs(e,s.startColumn,e,s.endColumn);t.tokenization.tokenizeIfCheap(e);const n=t.tokenization.getLineTokens(e),r=i.column-1,o=n.findTokenIndexAtOffset(r);let h=n.getStartOffset(o),c=n.getEndOffset(o);return c-h==1&&(h===r&&o>1?(h=n.getStartOffset(o-1),c=n.getEndOffset(o-1)):c===r&&o<n.getCount()-1&&(h=n.getStartOffset(o+1),c=n.getEndOffset(o+1))),new bs(e,h+1,e,c+1)}}async function l9(t,i,e,s){var n;const r=t.get(ro),o=t.get(qO),h=t.get(po),c=t.get(io),l=t.get(VF);if(await s.item.resolve(fe.None),!s.part.location)return;const a=s.part.location,u=[],d=new Set(Eh.getMenuItems(Sh.EditorContext).map((t=>Ch(t)?t.command.id:G0())));for(const t of HY.all())d.has(t.desc.id)&&u.push(new oo(t.desc.id,Mh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(async()=>{const e=await r.createModelReference(a.uri);try{const n=new VY(e.object.textEditorModel,bs.getStartPosition(a.range)),r=s.item.anchor.range;await c.invokeFunction(t.runEditorCommand.bind(t),i,n,r)}finally{e.dispose()}})));if(s.part.command){const{command:t}=s.part;u.push(new co),u.push(new oo(t.id,t.title,void 0,!0,(async()=>{var i;try{await h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){l.notify({severity:jF.Error,source:s.item.provider.displayName,message:t})}})))}const f=i.getOption(126);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=Zl(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function a9(t,i,e,s){const n=t.get(ro),r=await n.createModelReference(s.uri);await e.invokeWithinContext((async t=>{const n=i.hasSideBySideModifier,o=t.get(th),h=$Q.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new zY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new VY(r.object.textEditorModel,bs.getStartPosition(s.range)),bs.lift(s.range))})),r.dispose()}var u9,d9=function(t,i){return function(e,s){i(e,s,t)}};class f9{constructor(){this._entries=new Mg(50)}get(t){const i=f9._key(t);return this._entries.get(i)}set(t,i){const e=f9._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const g9=eo("IInlayHintsCache");gd(g9,f9,1);class p9{constructor(t,i){this.item=t,this.index=i}get part(){const t=this.item.hint.label;return"string"==typeof t?{label:t}:t[this.index]}}class m9{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let w9=u9=class{static get(t){var i;return null!==(i=t.getContribution(u9.ID))&&void 0!==i?i:void 0}constructor(t,i,e,s,n,r,o){this._editor=t,this._languageFeaturesService=i,this._inlayHintsCache=s,this._commandService=n,this._notificationService=r,this._instaService=o,this._disposables=new Ui,this._sessionDisposables=new Ui,this._decorationsMetadata=new Map,this._ruleFactory=new uy(this._editor),this._activeRenderMode=0,this._debounceInfo=e.for(i.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(i.inlayHintsProvider.onDidChange((()=>this._update()))),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(139)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(139);if("off"===t.enabled)return;const i=this._editor.getModel();if(!i||!this._languageFeaturesService.inlayHintsProvider.has(i))return;const e=this._inlayHintsCache.get(i);let s;e&&this._updateHintsDecorators([i.getFullModelRange()],e),this._sessionDisposables.add(zi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new rc((async()=>{const t=Date.now();null==s||s.dispose(!0),s=new pe;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const e=s.token,o=await c9.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),e);if(r.delay=this._debounceInfo.update(i,Date.now()-t),e.isCancellationRequested)return void o.dispose();for(const t of o.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(o),this._updateHintsDecorators(o.ranges,o.items),this._cacheHintsForFastRestore(i)}catch(t){Li(t)}finally{s.dispose(),e.dispose()}}),this._debounceInfo.get(i));if(this._sessionDisposables.add(r),this._sessionDisposables.add(zi((()=>null==s?void 0:s.dispose(!0)))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange((t=>{!t.scrollTopChanged&&r.isScheduled()||r.schedule()}))),this._sessionDisposables.add(this._editor.onDidChangeModelContent((()=>{const t=Math.max(r.delay,1250);r.schedule(t)}))),"on"===t.enabled)this._activeRenderMode=0;else{let i,e;"onUnlessPressed"===t.enabled?(i=0,e=1):(i=1,e=0),this._activeRenderMode=i,this._sessionDisposables.add($a.getInstance().event((t=>{if(!this._editor.hasModel())return;const s=t.altKey&&t.ctrlKey&&!t.shiftKey&&!t.metaKey?e:i;if(s!==this._activeRenderMode){this._activeRenderMode=s;const t=this._editor.getModel(),i=this._copyInlayHintsWithCurrentAnchor(t);this._updateHintsDecorators([t.getFullModelRange()],i),r.schedule(0)}})))}this._sessionDisposables.add(this._installDblClickGesture((()=>r.schedule(0)))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const t=new Ui,i=t.add(new AQ(this._editor)),e=new Ui;return t.add(e),t.add(i.onMouseMoveOrRelevantKeyDown((t=>{const[i]=t,s=this._getInlayHintLabelPart(i),n=this._editor.getModel();if(!s||!n)return void e.clear();const r=new pe;e.add(zi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new m9(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new bs(o,1,o,n.getLineMaxColumn(o)),c=this._getInlineHintsForRange(h);this._updateHintsDecorators([h],c),e.add(zi((()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([h],c)})))}))),t.add(i.onCancel((()=>e.clear()))),t.add(i.onExecute((async t=>{const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(a9,t,this._editor,e.location):Ps.is(e.command)&&await this._invokeCommand(e.command,i.item)}}))),t}_getInlineHintsForRange(t){const i=new Set;for(const e of this._decorationsMetadata.values())t.containsRange(e.item.anchor.range)&&i.add(e.item);return Array.from(i)}_installDblClickGesture(t){return this._editor.onMouseUp((async i=>{if(2!==i.event.detail)return;const e=this._getInlayHintLabelPart(i);if(e&&(i.event.preventDefault(),await e.item.resolve(fe.None),u(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>QR.replace(bs.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))}_installContextMenu(){return this._editor.onContextMenu((async t=>{if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&await this._instaService.invokeFunction(l9,this._editor,t.event.target,i)}))}_getInlayHintLabelPart(t){var i;if(6!==t.target.type)return;const e=null===(i=t.target.detail.injectedText)||void 0===i?void 0:i.options;return e instanceof lL&&(null==e?void 0:e.attachedData)instanceof p9?e.attachedData:void 0}async _invokeCommand(t,i){var e;try{await this._commandService.executeCommand(t.id,...null!==(e=t.arguments)&&void 0!==e?e:[])}catch(t){this._notificationService.notify({severity:jF.Error,source:i.provider.displayName,message:t})}}_cacheHintsForFastRestore(t){const i=this._copyInlayHintsWithCurrentAnchor(t);this._inlayHintsCache.set(t,i)}_copyInlayHintsWithCurrentAnchor(t){const i=new Map;for(const[e,s]of this._decorationsMetadata){if(i.has(s.item))continue;const n=t.getDecorationRange(e);if(n){const t=new o9(n,s.item.anchor.direction),e=s.item.with({anchor:t});i.set(s.item,e)}}return Array.from(i.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),e=[];for(const s of i.sort(bs.compareRangesUsingStarts)){const i=t.validateRange(new bs(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&bs.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=bs.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(t,i){var e,s;const n=[],r=(t,i,e,s,r)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:r};n.push({item:t,classNameRef:i,decoration:{range:t.anchor.range,options:{description:"InlayHint",showIfCollapsed:t.anchor.range.isEmpty(),collapseOnReplaceEdit:!t.anchor.range.isEmpty(),stickiness:0,[t.anchor.direction]:0===this._activeRenderMode?o:void 0}}})},o=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(h/3|0)+"px",display:"inline-block"});r(t,e," ",i?Cf.Right:Cf.None)},{fontSize:h,fontFamily:c,padding:l,isUniform:a}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,c);for(const t of i){t.hint.paddingLeft&&o(t,!1);const i="string"==typeof t.hint.label?[{label:t.hint.label}]:t.hint.label;for(let s=0;s<i.length;s++){const n=i[s],o=0===s,c=s===i.length-1,f={fontSize:`${h}px`,fontFamily:`var(${d}), ${xi.fontFamily}`,verticalAlign:a?"baseline":"middle",unicodeBidi:"isolate"};u(t.hint.textEdits)&&(f.cursor="default"),this._fillInColors(f,t.hint),(n.command||n.location)&&(null===(e=this._activeInlayHintPart)||void 0===e?void 0:e.part.item)===t&&this._activeInlayHintPart.part.index===s&&(f.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(f.color=Bk(yv),f.cursor="pointer")),l&&(o&&c?(f.padding=`1px ${0|Math.max(1,h/4)}px`,f.borderRadius=(h/4|0)+"px"):o?(f.padding=`1px 0 1px ${0|Math.max(1,h/4)}px`,f.borderRadius=`${h/4|0}px 0 0 ${h/4|0}px`):c?(f.padding=`1px ${0|Math.max(1,h/4)}px 1px 0`,f.borderRadius=`0 ${h/4|0}px ${h/4|0}px 0`):f.padding="1px 0 1px 0"),r(t,this._ruleFactory.createClassNameRef(f),n.label.replace(/[ \t]/g," "),c&&!t.hint.paddingRight?Cf.Right:Cf.None,new p9(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>u9._MAX_DECORATORS)break}const f=[];for(const i of t)for(const{id:t}of null!==(s=this._editor.getDecorationsInRange(i))&&void 0!==s?s:[]){const i=this._decorationsMetadata.get(t);i&&(f.push(t),i.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const g=$z.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,n.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],n[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===Ns.Parameter?(t.backgroundColor=Bk(Ev),t.color=Bk(Dv)):i.kind===Ns.Type?(t.backgroundColor=Bk(xv),t.color=Bk(Sv)):(t.backgroundColor=Bk(Cv),t.color=Bk(kv))}_getLayoutInfo(){const t=this._editor.getOption(139),i=t.padding,e=this._editor.getOption(52),s=this._editor.getOption(49);let n=t.fontSize;(!n||n<5||n>e)&&(n=e);const r=t.fontFamily||s;return{fontSize:n,fontFamily:r,padding:i,isUniform:!i&&r===s&&n===e}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const t of this._decorationsMetadata.values())t.classNameRef.dispose();this._decorationsMetadata.clear()}};w9.ID="editor.contrib.InlayHints",w9._MAX_DECORATORS=1500,w9=u9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([d9(1,op),d9(2,YT),d9(3,g9),d9(4,po),d9(5,VF),d9(6,io)],w9),mo.registerCommand("_executeInlayHintProvider",(async(t,...i)=>{const[e,s]=i;B(hs.isUri(e)),B(bs.isIRange(s));const{inlayHintsProvider:n}=t.get(op),r=await t.get(ro).createModelReference(e);try{const t=await c9.create(n,r.object.textEditorModel,[bs.lift(s)],fe.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}));var v9=function(t,i){return function(e,s){i(e,s,t)}};class b9 extends rX{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let y9=class extends FX{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!w9.get(this._editor))return null;if(6!==t.target.type)return null;const e=null===(i=t.target.detail.injectedText)||void 0===i?void 0:i.options;return e instanceof lL&&e.attachedData instanceof p9?new b9(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof b9?new dc((async i=>{const{part:s}=t;if(await s.item.resolve(e),e.isCancellationRequested)return;let n,r;if("string"==typeof s.item.hint.tooltip?n=(new bI).appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(n=s.item.hint.tooltip),n&&i.emitOne(new LX(this,t.range,[n],!1,0)),u(s.item.hint.textEdits)&&i.emitOne(new LX(this,t.range,[(new bI).appendText(Q(0,"Double-click to insert"))],!1,10001)),"string"==typeof s.part.tooltip?r=(new bI).appendText(s.part.tooltip):s.part.tooltip&&(r=s.part.tooltip),r&&i.emitOne(new LX(this,t.range,[r],!1,1)),s.part.location||s.part.command){let e;const n=Q(0,"altKey"===this._editor.getOption(77)?pt?"cmd + click":"ctrl + click":pt?"option + click":"alt + click");s.part.location&&s.part.command?e=(new bI).appendText(Q(0,"Go to Definition ({0}), right click for more",n)):s.part.location?e=(new bI).appendText(Q(0,"Go to Definition ({0})",n)):s.part.command&&(e=new bI(`[${Q(0,"Execute Command")}](${o=s.part.command,hs.from({scheme:dl.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()} "${s.part.command.title}") (${n})`,{isTrusted:!0})),e&&i.emitOne(new LX(this,t.range,[e],!1,1e4))}var o;const h=await this._resolveInlayHintLabelPartHover(s,e);for await(const t of h)i.emitOne(t)})):dc.EMPTY}async _resolveInlayHintLabelPartHover(t,i){if(!t.part.location)return dc.EMPTY;const{uri:e,range:s}=t.part.location,n=await this._resolverService.createModelReference(e);try{const e=n.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(e)?EX(this._languageFeaturesService.hoverProvider,e,new vs(s.startLineNumber,s.startColumn),i).filter((t=>!yI(t.hover.contents))).map((i=>new LX(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):dc.EMPTY}finally{n.dispose()}}};y9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([v9(1,ud),v9(2,ZN),v9(3,rd),v9(4,ro),v9(5,op)],y9),iu(w9.ID,w9,1),oX.register(y9);class k9{constructor(t,i,e){this._editRange=t,this._originalSelection=i,this._text=e}getEditOperations(t,i){i.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(t,i){const e=i.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ys(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new ys(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}var C9;let S9=C9=class{static get(t){return t.getContribution(C9.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(t,i){var e;null===(e=this.currentRequest)||void 0===e||e.cancel();const s=this.editor.getSelection(),n=this.editor.getModel();if(!n||!s)return;let r=s;if(r.startLineNumber!==r.endLineNumber)return;const o=new oq(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=Zh((()=>this.editorWorkerService.navigateValueSet(h,r,i))),this.currentRequest.then((i=>{var e;if(!i||!i.range||!i.value)return;if(!o.validate(this.editor))return;const s=bs.lift(i.range);let n=i.range;const h=i.value.length-(r.endColumn-r.startColumn);n={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.startColumn+i.value.length},h>1&&(r=new ys(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+h-1));const c=new k9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:C9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=tc(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Li)})).catch(Li)):Promise.resolve(void 0)}};S9.ID="editor.contrib.inPlaceReplaceController",S9.DECORATION=aL.register({description:"in-place-replace",className:"valueSetReplacement"}),S9=C9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,iB)],S9),iu(S9.ID,S9,4),Xa(class extends Ga{constructor(){super({id:"editor.action.inPlaceReplace.up",label:Q(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=S9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.inPlaceReplace.down",label:Q(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=S9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),Xa(class extends Ga{constructor(){super({id:"expandLineSelection",label:Q(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:PS.textInputFocus,primary:2090}})}run(t,i,e){if(e=e||{},!i.hasModel())return;const s=i._getViewModel();s.model.pushStackElement(),s.setCursorStates(e.source,3,wS.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class x9{constructor(t,i){this._selection=t,this._cursors=i,this._selectionId=null}getEditOperations(t,i){const e=function(t,i){i.sort(((t,i)=>t.lineNumber===i.lineNumber?t.column-i.column:t.lineNumber-i.lineNumber));for(let t=i.length-2;t>=0;t--)i[t].lineNumber===i[t+1].lineNumber&&i.splice(t,1);const e=[];let s=0,n=0;const r=i.length;for(let o=1,h=t.getLineCount();o<=h;o++){const h=t.getLineContent(o),c=h.length+1;let l=0;if(n<r&&i[n].lineNumber===o&&(l=i[n].column,n++,l===c))continue;if(0===h.length)continue;const a=qn(h);let u=0;if(-1===a)u=1;else{if(a===h.length-1)continue;u=a+2}u=Math.max(l,u),e[s++]=QR.delete(new bs(o,u,o,c))}return e}(t,this._cursors);for(let t=0,s=e.length;t<s;t++){const s=e[t];i.addEditOperation(s.range,s.text)}this._selectionId=i.trackSelection(this._selection)}computeCursorState(t,i){return i.getTrackedSelection(this._selectionId)}}class D9{constructor(t,i,e){this._selection=t,this._isCopyingDown=i,this._noop=e||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(t,i){let e=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,e.startLineNumber<e.endLineNumber&&1===e.endColumn&&(this._endLineNumberDelta=1,e=e.setEndPosition(e.endLineNumber-1,t.getLineMaxColumn(e.endLineNumber-1)));const s=[];for(let i=e.startLineNumber;i<=e.endLineNumber;i++)s.push(t.getLineContent(i));const n=s.join("\n");""===n&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?i.addEditOperation(new bs(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new bs(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new bs(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber,t.getLineMaxColumn(e.endLineNumber)),"\n"+n),this._selectionId=i.trackSelection(e),this._selectionDirection=this._selection.getDirection()}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);if(0!==this._startLineNumberDelta||0!==this._endLineNumberDelta){let t=e.startLineNumber,i=e.startColumn,s=e.endLineNumber,n=e.endColumn;0!==this._startLineNumberDelta&&(t+=this._startLineNumberDelta,i=1),0!==this._endLineNumberDelta&&(s+=this._endLineNumberDelta,n=1),e=ys.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let E9=class{constructor(t,i,e,s){this._languageConfigurationService=s,this._selection=t,this._isMovingDown=i,this._autoIndent=e,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(t,i){const e=t.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===e)return void(this._selectionId=i.trackSelection(this._selection));if(!this._isMovingDown&&1===this._selection.startLineNumber)return void(this._selectionId=i.trackSelection(this._selection));this._moveEndPositionDown=!1;let s=this._selection;s.startLineNumber<s.endLineNumber&&1===s.endColumn&&(this._moveEndPositionDown=!0,s=s.setEndPosition(s.endLineNumber-1,t.getLineMaxColumn(s.endLineNumber-1)));const{tabSize:n,indentSize:r,insertSpaces:o}=t.getOptions(),h=this.buildIndentConverter(n,r,o),c={tokenization:{getLineTokens:i=>t.tokenization.getLineTokens(i),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(i,e)=>t.getLanguageIdAtPosition(i,e)},getLineContent:null};if(s.startLineNumber===s.endLineNumber&&1===t.getLineMaxColumn(s.startLineNumber)){const e=s.startLineNumber,n=this._isMovingDown?e+1:e-1;1===t.getLineMaxColumn(n)?i.addEditOperation(new bs(1,1,1,1),null):(i.addEditOperation(new bs(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new bs(n,1,n,t.getLineMaxColumn(n)),null)),s=new ys(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new bs(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let l=r;if(this.shouldAutoIndent(t,s)){const a=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==a){const i=K6(a+U6(Kn(t.getLineContent(e)),n),n,o);l=i+this.trimStart(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=AS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=Kn(t.getLineContent(e)),h=U6(i,n);if(h!==U6(s,n)){const t=K6(h,n,o);l=t+this.trimStart(r)}}}i.addEditOperation(new bs(s.startLineNumber,1,s.startLineNumber,1),l+"\n");const u=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,l);if(null!==u)0!==u&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,u);else{c.getLineContent=i=>i===s.startLineNumber?l:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=AS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=Kn(t.getLineContent(s.startLineNumber)),h=U6(r,n),c=U6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new bs(s.startLineNumber,1,s.startLineNumber,1),l+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new bs(e,1,e+1,1),null),i.addEditOperation(new bs(s.endLineNumber,t.getLineMaxColumn(s.endLineNumber),s.endLineNumber,t.getLineMaxColumn(s.endLineNumber)),"\n"+r),this.shouldAutoIndent(t,s)){c.getLineContent=i=>t.getLineContent(i===e?s.startLineNumber:i);const r=this.matchEnterRule(t,h,n,s.startLineNumber,s.startLineNumber-2);if(null!==r)0!==r&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,r);else{const r=AS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=Kn(t.getLineContent(s.startLineNumber)),h=U6(r,n),c=U6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}}this._selectionId=i.trackSelection(s)}buildIndentConverter(t,i,e){return{shiftIndent:s=>SS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>SS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Su.None||n.indentAction===Su.Indent?r=n.indentation+n.appendText:n.indentAction===Su.IndentOutdent?r=n.indentation:n.indentAction===Su.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimStart(o).indexOf(this.trimStart(r))>=0){const n=Kn(t.getLineContent(s));let o=Kn(r);const h=MS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),U6(o,e)-U6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(qn(r)>=0){const r=t.getLineMaxColumn(n),o=bS(this._autoIndent,t,new bs(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(qn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=bS(this._autoIndent,t,new bs(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}}matchEnterRule(t,i,e,s,n,r){let o=n;for(;o>=1;){let i;if(i=o===n&&void 0!==r?r:t.getLineContent(o),qn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=bS(this._autoIndent,t,new bs(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimStart(t){return t.replace(/^\s+/,"")}shouldAutoIndent(t,i){if(this._autoIndent<4)return!1;if(!t.tokenization.isCheapToTokenize(i.startLineNumber))return!1;const e=t.getLanguageIdAtPosition(i.startLineNumber,1);return e===t.getLanguageIdAtPosition(i.endLineNumber,1)&&null!==this._languageConfigurationService.getLanguageConfiguration(e).indentRulesSupport}getIndentEditsOfMovingBlock(t,i,e,s,n,r){for(let o=e.startLineNumber;o<=e.endLineNumber;o++){const h=Kn(t.getLineContent(o)),c=K6(U6(h,s)+r,s,n);c!==h&&(i.addEditOperation(new bs(o,1,o,h.length+1),c),o===e.endLineNumber&&e.endColumn<=h.length+1&&""===c&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&e.startLineNumber<e.endLineNumber&&(e=e.setEndPosition(e.endLineNumber,2)),e}};E9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,Nd)],E9);class A9{static getCollator(){return A9._COLLATOR||(A9._COLLATOR=new Intl.Collator),A9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=M9(t,i,e);return s?QR.replace(new bs(s.startLineNumber,1,s.endLineNumber,t.getLineMaxColumn(s.endLineNumber)),s.after.join("\n")):null}(t,this.selection,this.descending);e&&i.addEditOperation(e.range,e.text),this.selectionId=i.trackSelection(this.selection)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}static canRun(t,i,e){if(null===t)return!1;const s=M9(t,i,e);if(!s)return!1;for(let t=0,i=s.before.length;t<i;t++)if(s.before[t]!==s.after[t])return!0;return!1}}function M9(t,i,e){const s=i.startLineNumber;let n=i.endLineNumber;if(1===i.endColumn&&n--,s>=n)return null;const r=[];for(let i=s;i<=n;i++)r.push(t.getLineContent(i));let o=r.slice(0);return o.sort(A9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}A9._COLLATOR=null;class L9 extends Ga{constructor(t,i){super(i),this.down=t}run(t,i){if(!i.hasModel())return;const e=i.getSelections().map(((t,i)=>({selection:t,index:i,ignore:!1})));e.sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));let s=e[0];for(let t=1;t<e.length;t++){const i=e[t];s.selection.endLineNumber===i.selection.startLineNumber&&(s.index<i.index?i.ignore=!0:(s.ignore=!0,s=i))}const n=[];for(const t of e)n.push(new D9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class F9 extends Ga{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(Nd),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new E9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class T9 extends Ga{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!A9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new A9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class R9 extends Ga{constructor(){super({id:R9.ID,label:Q(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2102),weight:100}})}run(t,i,e){let s=[];"auto-save"===e.reason&&(s=(i.getSelections()||[]).map((t=>new vs(t.positionLineNumber,t.positionColumn))));const n=i.getSelection();if(null===n)return;const r=new x9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}R9.ID="editor.action.trimTrailingWhitespace";class O9 extends Ga{run(t,i){if(!i.hasModel())return;const e=i.getSelection(),s=this._getRangesToDelete(i),n=[];for(let t=0,i=s.length-1;t<i;t++){const i=s[t],e=s[t+1];null===bs.intersectRanges(i,e)?n.push(i):s[t+1]=bs.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>QR.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class _9 extends Ga{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(129),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new bs(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(QR.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(QR.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class I9{constructor(t,i){this._pattern=t,this._flags=i,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(t){}}return this._actual}isSupported(){return null!==this.get()}}class P9 extends _9{constructor(){super({id:"editor.action.transformToTitlecase",label:Q(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:PS.writable})}_modifyText(t,i){const e=P9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}P9.titleBoundary=new I9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class N9 extends _9{constructor(){super({id:"editor.action.transformToSnakecase",label:Q(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:PS.writable})}_modifyText(t,i){const e=N9.caseBoundary.get(),s=N9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}N9.caseBoundary=new I9("(\\p{Ll})(\\p{Lu})","gmu"),N9.singleLetters=new I9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class B9 extends _9{constructor(){super({id:"editor.action.transformToCamelcase",label:Q(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:PS.writable})}_modifyText(t,i){const e=B9.wordBoundary.get();if(!e)return t;const s=t.split(e);return s.shift()+s.map((t=>t.substring(0,1).toLocaleUpperCase()+t.substring(1))).join("")}}B9.wordBoundary=new I9("[_\\s-]","gm");class $9 extends _9{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:Q(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:PS.writable})}_modifyText(t,i){const e=$9.caseBoundary.get(),s=$9.singleLetters.get(),n=$9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}$9.caseBoundary=new I9("(\\p{Ll})(\\p{Lu})","gmu"),$9.singleLetters=new I9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),$9.underscoreBoundary=new I9("(\\S)(_)(\\S)","gm"),Xa(class extends L9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:Q(0,"Copy Line Up"),alias:"Copy Line Up",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"&&Copy Line Up"),order:1}})}}),Xa(class extends L9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:Q(0,"Copy Line Down"),alias:"Copy Line Down",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Co&&py Line Down"),order:2}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.duplicateSelection",label:Q(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:PS.writable,menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"&&Duplicate Selection"),order:5}})}run(t,i,e){if(!i.hasModel())return;const s=[],n=i.getSelections(),r=i.getModel();for(const t of n)if(t.isEmpty())s.push(new D9(t,!0));else{const i=new ys(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new hS(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),Xa(class extends F9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:Q(0,"Move Line Up"),alias:"Move Line Up",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Mo&&ve Line Up"),order:3}})}}),Xa(class extends F9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:Q(0,"Move Line Down"),alias:"Move Line Down",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Move &&Line Down"),order:4}})}}),Xa(class extends T9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:Q(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:PS.writable})}}),Xa(class extends T9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:Q(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:PS.writable})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.removeDuplicateLines",label:Q(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:PS.writable})}run(t,i){if(!i.hasModel())return;const e=i.getModel();if(1===e.getLineCount()&&1===e.getLineMaxColumn(1))return;const s=[],n=[];let r=0;for(const t of i.getSelections()){const i=new Set,o=[];for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const t=e.getLineContent(s);i.has(t)||(o.push(t),i.add(t))}const h=new ys(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,l=new ys(c,1,c+o.length-1,o[o.length-1].length);s.push(QR.replace(h,o.join("\n"))),n.push(l),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),Xa(R9),Xa(class extends Ga{constructor(){super({id:"editor.action.deleteLines",label:Q(0,"Delete Line"),alias:"Delete Line",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:3113,weight:100}})}run(t,i){if(!i.hasModel())return;const e=this._getLinesToRemove(i),s=i.getModel();if(1===s.getLineCount()&&1===s.getLineMaxColumn(1))return;let n=0;const r=[],o=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];let h=i.startLineNumber,c=i.endLineNumber,l=1,a=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,a=1):h>1&&(h-=1,l=s.getLineMaxColumn(h)),r.push(QR.replace(new ys(h,l,c,a),"")),o.push(new ys(h-n,i.positionColumn,h-n,i.positionColumn)),n+=i.endLineNumber-i.startLineNumber+1}i.pushUndoStop(),i.executeEdits(this.id,r,o),i.pushUndoStop()}_getLinesToRemove(t){const i=t.getSelections().map((t=>{let i=t.endLineNumber;return t.startLineNumber<t.endLineNumber&&1===t.endColumn&&(i-=1),{startLineNumber:t.startLineNumber,selectionStartColumn:t.selectionStartColumn,endLineNumber:i,positionColumn:t.positionColumn}}));i.sort(((t,i)=>t.startLineNumber===i.startLineNumber?t.endLineNumber-i.endLineNumber:t.startLineNumber-i.startLineNumber));const e=[];let s=i[0];for(let t=1;t<i.length;t++)s.endLineNumber+1>=i[t].startLineNumber?s.endLineNumber=i[t].endLineNumber:(e.push(s),s=i[t]);return e.push(s),e}}),Xa(class extends Ga{constructor(){super({id:"editor.action.indentLines",label:Q(0,"Indent Line"),alias:"Indent Line",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.outdentLines",label:Q(0,"Outdent Line"),alias:"Outdent Line",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2140,weight:100}})}run(t,i){US.Outdent.runEditorCommand(t,i,null)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertLineBefore",label:Q(0,"Insert Line Above"),alias:"Insert Line Above",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertLineAfter",label:Q(0,"Insert Line Below"),alias:"Insert Line Below",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),Xa(class extends O9{constructor(){super({id:"deleteAllLeft",label:Q(0,"Delete All Left"),alias:"Delete All Left",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(t,i){let e=null;const s=[];let n=0;return i.forEach((i=>{let r;if(1===i.endColumn&&n>0){const t=i.startLineNumber-n;r=new ys(t,i.startColumn,t,i.startColumn)}else r=new ys(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn);n+=i.endLineNumber-i.startLineNumber,i.intersectRanges(t)?e=r:s.push(r)})),e&&s.unshift(e),s}_getRangesToDelete(t){const i=t.getSelections();if(null===i)return[];let e=i;const s=t.getModel();return null===s?[]:(e.sort(bs.compareRangesUsingStarts),e=e.map((t=>{if(t.isEmpty()){if(1===t.startColumn){const i=Math.max(1,t.startLineNumber-1),e=1===t.startLineNumber?1:s.getLineLength(i)+1;return new bs(i,e,t.startLineNumber,1)}return new bs(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new bs(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),Xa(class extends O9{constructor(){super({id:"deleteAllRight",label:Q(0,"Delete All Right"),alias:"Delete All Right",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(t,i){let e=null;const s=[];for(let n=0,r=i.length,o=0;n<r;n++){const r=i[n],h=new ys(r.startLineNumber-o,r.startColumn,r.startLineNumber-o,r.startColumn);r.intersectRanges(t)?e=h:s.push(h)}return e&&s.unshift(e),s}_getRangesToDelete(t){const i=t.getModel();if(null===i)return[];const e=t.getSelections();if(null===e)return[];const s=e.map((t=>{if(t.isEmpty()){const e=i.getLineMaxColumn(t.startLineNumber);return t.startColumn===e?new bs(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new bs(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(bs.compareRangesUsingStarts),s}}),Xa(class extends Ga{constructor(){super({id:"editor.action.joinLines",label:Q(0,"Join Lines"),alias:"Join Lines",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(t,i){const e=i.getSelections();if(null===e)return;let s=i.getSelection();if(null===s)return;e.sort(bs.compareRangesUsingStarts);const n=[],r=e.reduce(((t,i)=>t.isEmpty()?t.endLineNumber===i.startLineNumber?(s.equalsSelection(t)&&(s=i),i):i.startLineNumber>t.endLineNumber+1?(n.push(t),i):new ys(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new ys(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let l=s,a=0;for(let t=0,i=n.length;t<i;t++){const i=n[t],e=i.startLineNumber,r=1;let u,d,f=0;const g=o.getLineLength(i.endLineNumber)-i.endColumn;if(i.isEmpty()||i.startLineNumber===i.endLineNumber){const t=i.getStartPosition();t.lineNumber<o.getLineCount()?(u=e+1,d=o.getLineMaxColumn(u)):(u=t.lineNumber,d=o.getLineMaxColumn(t.lineNumber))}else u=i.endLineNumber,d=o.getLineMaxColumn(u);let p=o.getLineContent(e);for(let t=e+1;t<=u;t++){const i=o.getLineContent(t),e=o.getLineFirstNonWhitespaceColumn(t);if(e>=1){let t=!0;""===p&&(t=!1),!t||" "!==p.charAt(p.length-1)&&"\t"!==p.charAt(p.length-1)||(t=!1,p=p.replace(/[\s\uFEFF\xA0]+$/g," "));const s=i.substr(e-1);p+=(t?" ":"")+s,f=t?s.length+1:s.length}else f=0}const m=new bs(e,r,u,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(QR.replace(m,p)),t=new ys(m.startLineNumber-a,p.length-f+1,e-a,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(QR.replace(m,p)),t=new ys(i.startLineNumber-a,i.startColumn,i.endLineNumber-a,i.endColumn)):(h.push(QR.replace(m,p)),t=new ys(i.startLineNumber-a,i.startColumn,i.startLineNumber-a,p.length-g)),null!==bs.intersectRanges(m,s)?l=t:c.push(t)}a+=m.endLineNumber-m.startLineNumber}c.unshift(l),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.transpose",label:Q(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:PS.writable})}run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!i.isEmpty())continue;const r=i.getStartPosition(),o=s.getLineMaxColumn(r.lineNumber);if(r.column>=o){if(r.lineNumber===s.getLineCount())continue;const t=new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new oS(new ys(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new aS(t,i,new ys(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),Xa(class extends _9{constructor(){super({id:"editor.action.transformToUppercase",label:Q(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:PS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),Xa(class extends _9{constructor(){super({id:"editor.action.transformToLowercase",label:Q(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:PS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),N9.caseBoundary.isSupported()&&N9.singleLetters.isSupported()&&Xa(N9),B9.wordBoundary.isSupported()&&Xa(B9),P9.titleBoundary.isSupported()&&Xa(P9),$9.isSupported()&&Xa($9);var W9,j9=function(t,i){return function(e,s){i(e,s,t)}};const V9=new Xo("LinkedEditingInputVisible",!1);let H9=W9=class extends Ki{static get(t){return t.getContribution(W9.ID)}constructor(t,i,e,s,n){super(),this.languageConfigurationService=s,this._syncRangesToken=0,this._localToDispose=this._register(new Ui),this._editor=t,this._providers=e.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=V9.bindTo(i),this._debounceInformation=n.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new Ui),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequest=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel((()=>this.reinitialize(!0)))),this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(69)||t.hasChanged(92))&&this.reinitialize(!1)}))),this._register(this._providers.onDidChange((()=>this.reinitialize(!1)))),this._register(this._editor.onDidChangeModelLanguage((()=>this.reinitialize(!0)))),this.reinitialize(!0)}reinitialize(t){const i=this._editor.getModel(),e=null!==i&&(this._editor.getOption(69)||this._editor.getOption(92))&&this._providers.has(i);if(e===this._enabled&&!t)return;if(this._enabled=e,this.clearRanges(),this._localToDispose.clear(),!e||null===i)return;this._localToDispose.add(Xi.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new Yh(this._debounceInformation.get(i)),n=()=>{var t;this._rangeUpdateTriggerPromise=s.trigger((()=>this.updateRanges()),null!==(t=this._debounceDuration)&&void 0!==t?t:this._debounceInformation.get(i))},r=new Yh(0),o=t=>{this._rangeSyncTriggerPromise=r.trigger((()=>this._syncRanges(t)))};this._localToDispose.add(this._editor.onDidChangeCursorPosition((()=>{n()}))),this._localToDispose.add(this._editor.onDidChangeModelContent((t=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const i=this._currentDecorations.getRange(0);if(i&&t.changes.every((t=>i.intersectRanges(t.range))))return void o(this._syncRangesToken)}n()}))),this._localToDispose.add({dispose:()=>{s.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(t){if(!this._editor.hasModel()||t!==this._syncRangesToken||0===this._currentDecorations.length)return;const i=this._editor.getModel(),e=this._currentDecorations.getRange(0);if(!e||e.startLineNumber!==e.endLineNumber)return this.clearRanges();const s=i.getValueInRange(e);if(this._currentWordPattern){const t=s.match(this._currentWordPattern);if((t?t[0].length:0)!==s.length)return this.clearRanges()}const n=[];for(let t=1,e=this._currentDecorations.length;t<e;t++){const e=this._currentDecorations.getRange(t);if(e)if(e.startLineNumber!==e.endLineNumber)n.push({range:e,text:s});else{let t=i.getValueInRange(e),r=s,o=e.startColumn,h=e.endColumn;const c=sr(t,r);o+=c,t=t.substr(c),r=r.substr(c);const l=nr(t,r);h-=l,t=t.substr(0,t.length-l),r=r.substr(0,r.length-l),o===h&&0===r.length||n.push({range:new bs(e.startLineNumber,o,e.endLineNumber,h),text:r})}}if(0!==n.length)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const t=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",n),this._editor._getViewModel().setPrevEditOperationType(t)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequest&&(this._currentRequest.cancel(),this._currentRequest=null,this._currentRequestPosition=null)}async updateRanges(t=!1){if(!this._editor.hasModel())return void this.clearRanges();const i=this._editor.getPosition();if(!this._enabled&&!t||this._editor.getSelections().length>1)return void this.clearRanges();const e=this._editor.getModel(),s=e.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===s){if(i.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(i))return}}this.clearRanges(),this._currentRequestPosition=i,this._currentRequestModelVersion=s;const n=Zh((async t=>{try{const r=new Yi(!1),o=await z9(this._providers,e,i,t);if(this._debounceInformation.update(e,r.elapsed()),n!==this._currentRequest)return;if(this._currentRequest=null,s!==e.getVersionId())return;let h=[];(null==o?void 0:o.ranges)&&(h=o.ranges),this._currentWordPattern=(null==o?void 0:o.wordPattern)||this._languageWordPattern;let c=!1;for(let t=0,e=h.length;t<e;t++)if(bs.containsPosition(h[t],i)){if(c=!0,0!==t){const i=h[t];h.splice(t,1),h.unshift(i)}break}if(!c)return void this.clearRanges();const l=h.map((t=>({range:t,options:W9.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Li(t),this._currentRequest!==n&&this._currentRequest||this.clearRanges()}}));return this._currentRequest=n,n}};function z9(t,i,e,s){return ec(t.ordered(i).map((t=>async()=>{try{return await t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Fi(t)}})),(t=>!!t&&u(null==t?void 0:t.ranges)))}H9.ID="editor.contrib.linkedEditing",H9.DECORATION=aL.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),H9=W9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j9(1,th),j9(2,op),j9(3,Nd),j9(4,YT)],H9),Ya(new(qa.bindToContribution(H9.get))({id:"cancelLinkedEditingInput",precondition:V9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:PS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Jm("editor.linkedEditingBackground",{dark:Gg.fromHex("#f00").transparent(.3),light:Gg.fromHex("#f00").transparent(.3),hcDark:Gg.fromHex("#f00").transparent(.3),hcLight:Gg.white},Q(0,"Background color when the editor auto renames on type.")),Qa("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(op);return z9(s,i,e,fe.None)})),iu(H9.ID,H9,1),Xa(class extends Ga{constructor(){super({id:"editor.action.linkedEditing",label:Q(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Oo.and(PS.writable,PS.hasRenameProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(so),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return hs.isUri(s)&&vs.isIPosition(n)?e.openCodeEditor({resource:s},e.getActiveCodeEditor()).then((t=>{t&&(t.setPosition(n),t.invokeWithinContext((i=>(this.reportTelemetry(i,t),this.run(i,t)))))}),Li):super.runCommand(t,i)}run(t,i){const e=H9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});class U9{constructor(t,i){this._link=t,this._provider=i}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(t){return this._link.url?this._link.url:"function"==typeof this._provider.resolveLink?Promise.resolve(this._provider.resolveLink(this._link,t)).then((i=>(this._link=i||this._link,this._link.url?this.resolve(t):Promise.reject(new Error("missing"))))):Promise.reject(new Error("missing"))}}class K9{constructor(t){this._disposables=new Ui;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new U9(t,s)));i=K9._union(i,t),ji(e)&&this._disposables.add(e)}this.links=i}dispose(){this._disposables.dispose(),this.links.length=0}static _union(t,i){const e=[];let s,n,r,o;for(s=0,r=0,n=t.length,o=i.length;s<n&&r<o;){const n=t[s],o=i[r];bs.areIntersectingOrTouching(n.range,o.range)?s++:bs.compareRangesUsingStarts(n.range,o.range)<0?(e.push(n),s++):(e.push(o),r++)}for(;s<n;s++)e.push(t[s]);for(;r<o;r++)e.push(i[r]);return e}}function q9(t,i,e){const s=[],n=t.ordered(i).reverse().map(((t,n)=>Promise.resolve(t.provideLinks(i,e)).then((i=>{i&&(s[n]=[i,t])}),Fi)));return Promise.all(n).then((()=>{const t=new K9(c(s));return e.isCancellationRequested?(t.dispose(),new K9([])):t}))}mo.registerCommand("_executeLinkProvider",(async(t,...i)=>{let[e,s]=i;B(e instanceof hs),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(op),r=t.get(no).getModel(e);if(!r)return[];const o=await q9(n,r,fe.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)await o.links[t].resolve(fe.None);const h=o.links.slice(0);return o.dispose(),h}));var G9,Z9=function(t,i){return function(e,s){i(e,s,t)}};let J9=G9=class extends Ki{static get(t){return t.getContribution(G9.ID)}constructor(t,i,e,s,n){super(),this.editor=t,this.openerService=i,this.notificationService=e,this.languageFeaturesService=s,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=n.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new rc((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new AQ(t));this._register(r.onMouseMoveOrRelevantKeyDown((([t,i])=>{this._onEditorMouseMove(t,i)}))),this._register(r.onExecute((t=>{this.onEditorMouseUp(t)}))),this._register(r.onCancel((()=>{this.cleanUpActiveLinkDecoration()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(70)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))}))),this._register(t.onDidChangeModelContent((()=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))}))),this._register(t.onDidChangeModel((()=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)}))),this._register(t.onDidChangeModelLanguage((()=>{this.stop(),this.computeLinks.schedule(0)}))),this._register(this.providers.onDidChange((()=>{this.stop(),this.computeLinks.schedule(0)}))),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(70))return;const t=this.editor.getModel();if(!t.isTooLargeForSyncing()&&this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Zh((i=>q9(this.providers,t,i)));try{const i=new Yi(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(t,i.elapsed()),t.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Li(t)}finally{this.computePromise=null}}}updateDecorations(t){const i="altKey"===this.editor.getOption(77),e=[],s=Object.keys(this.currentOccurrences);for(const t of s)e.push(this.currentOccurrences[t].decorationId);const n=[];if(t)for(const e of t)n.push(X9.decoration(e,i));this.editor.changeDecorations((i=>{const s=i.deltaDecorations(e,n);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let i=0,e=s.length;i<e;i++){const e=new X9(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(77);if(this.isEnabled(t,i)){this.cleanUpActiveLinkDecoration();const i=this.getLinkOccurrence(t.target.position);i&&this.editor.changeDecorations((t=>{i.activate(t,e),this.activeLinkDecorationId=i.decorationId}))}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const t="altKey"===this.editor.getOption(77);if(this.activeLinkDecorationId){const i=this.currentOccurrences[this.activeLinkDecorationId];i&&this.editor.changeDecorations((e=>{i.deactivate(e,t)})),this.activeLinkDecorationId=null}}onEditorMouseUp(t){if(!this.isEnabled(t))return;const i=this.getLinkOccurrence(t.target.position);i&&this.openLinkOccurrence(i,t.hasSideBySideModifier,!0)}openLinkOccurrence(t,i,e=!1){if(!this.openerService)return;const{link:s}=t;s.resolve(fe.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===dl.file&&t.startsWith(`${dl.file}:`)){const e=hs.parse(t);if(e.scheme===dl.file){const s=YE(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=rA(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:e,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(Q(0,"Failed to open this link because it is not well-formed: {0}",s.url.toString())):"missing"===i?this.notificationService.warn(Q(0,"Failed to open this link because its target is missing.")):Li(t)}))}getLinkOccurrence(t){if(!this.editor.hasModel()||!t)return null;const i=this.editor.getModel().getDecorationsInRange({startLineNumber:t.lineNumber,startColumn:t.column,endLineNumber:t.lineNumber,endColumn:t.column},0,!0);for(const t of i){const i=this.currentOccurrences[t.id];if(i)return i}return null}isEnabled(t,i){return Boolean(6===t.target.type&&(t.hasTriggerModifier||i&&i.keyCodeIsTriggerKey))}stop(){var t;this.computeLinks.cancel(),this.activeLinksList&&(null===(t=this.activeLinksList)||void 0===t||t.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};J9.ID="editor.linkDetector",J9=G9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Z9(1,ZN),Z9(2,VF),Z9(3,op),Z9(4,YT)],J9);const Q9=aL.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),Y9=aL.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"});class X9{static decoration(t,i){return{range:t.range,options:X9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s={...e?Y9:Q9};return s.hoverMessage=function(t,i){const e=t.url&&/^command:/i.test(t.url.toString()),s=t.tooltip?t.tooltip:Q(0,e?"Execute command":"Follow link"),n=Q(0,i?pt?"cmd + click":"ctrl + click":pt?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const e=t.url.toString().match(/^command:([^?#]+)/);e&&(i=Q(0,"Execute command {0}",e[1]))}return new bI("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),s,i).appendMarkdown(` (${n})`)}return(new bI).appendText(`${s} (${n})`)}(t,i),s}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,X9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,X9._getOptions(this.link,i,!1))}}iu(J9.ID,J9,1),Xa(class extends Ga{constructor(){super({id:"editor.action.openLink",label:Q(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=J9.get(i);if(!e)return;if(!i.hasModel())return;const s=i.getSelections();for(const t of s){const i=e.getLinkOccurrence(t.getEndPosition());i&&e.openLinkOccurrence(i,!1)}}});class t7 extends Ki{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(116);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}t7.ID="editor.contrib.longLinesHelper",iu(t7.ID,t7,2);const i7=Jm("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},Q(0,"Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);Jm("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},Q(0,"Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0),Jm("editor.wordHighlightTextBackground",{light:i7,dark:i7,hcDark:i7,hcLight:i7},Q(0,"Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const e7=Jm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:ew,hcLight:ew},Q(0,"Border color of a symbol during read-access, like reading a variable."));Jm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:ew,hcLight:ew},Q(0,"Border color of a symbol during write-access, like writing to a variable.")),Jm("editor.wordHighlightTextBorder",{light:e7,dark:e7,hcDark:e7,hcLight:e7},Q(0,"Border color of a textual occurrence for a symbol."));const s7=Jm("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},Q(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),n7=Jm("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},Q(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),r7=Jm("editorOverviewRuler.wordHighlightTextForeground",{dark:_b,light:_b,hcDark:_b,hcLight:_b},Q(0,"Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),o7=aL.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Bk(n7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),h7=aL.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Bk(r7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),c7=aL.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Bk(_b),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),l7=aL.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),a7=aL.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Bk(s7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}});function u7(t){return t?l7:c7}Vk(((t,i)=>{const e=t.getColor(uv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var d7;function f7(t,i){const e=i.filter((i=>!t.find((t=>t.equals(i)))));if(e.length>=1){const t=e.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");Sm(Q(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class g7{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class p7{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new p7(t,i,!1,e.searchString,e.wholeWord,e.matchCase,null);let s,n,r=!1;const o=t.getSelections();1===o.length&&o[0].isEmpty()?(r=!0,s=!0,n=!0):(s=e.wholeWord,n=e.matchCase);const h=t.getSelection();let c,l=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,l=new ys(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new p7(t,i,r,c,s,n,l)}constructor(t,i,e,s,n,r,o){this._editor=t,this.findController=i,this.isDisconnectedFromFindController=e,this.searchText=s,this.wholeWord=n,this.matchCase=r,this.currentMatch=o}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.concat(t),t,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.slice(0,i.length-1).concat(t),t,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findNextMatch(this.searchText,i.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ys(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const t=this._getPreviousMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.concat(t),t,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const t=this._getPreviousMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.slice(0,i.length-1).concat(t),t,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findPreviousMatch(this.searchText,i.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ys(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}selectAll(t){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();return this._editor.getModel().findMatches(this.searchText,t||!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1,1073741824)}}class m7 extends Ki{static get(t){return t.getContribution(m7.ID)}constructor(t){super(),this._sessionDispose=this._register(new Ui),this._editor=t,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(t){if(!this._session){const i=p7.create(this._editor,t);if(!i)return;this._session=i;const e={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(e.wholeWordOverride=1,e.matchCaseOverride=1,e.isRegexOverride=2),t.getState().change(e,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection((()=>{this._ignoreSelectionChange||this._endSession()}))),this._sessionDispose.add(this._editor.onDidBlurEditorText((()=>{this._endSession()}))),this._sessionDispose.add(t.getState().onFindReplaceStateChange((t=>{(t.matchCase||t.wholeWord)&&this._endSession()})))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const t={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(t,!1)}this._session=null}_setSelections(t){this._ignoreSelectionChange=!0,this._editor.setSelections(t),this._ignoreSelectionChange=!1}_expandEmptyToWord(t,i){if(!i.isEmpty())return i;const e=this._editor.getConfiguredWordAtPosition(i.getStartPosition());return e?new ys(i.startLineNumber,e.startColumn,i.startLineNumber,e.endColumn):i}_applySessionResult(t){t&&(this._setSelections(t.selections),t.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(t.revealRange,t.revealScrollType))}getSession(t){return this._session}addSelectionToNextFindMatch(t){if(this._editor.hasModel()){if(!this._session){const i=this._editor.getSelections();if(i.length>1){const e=t.getState().matchCase;if(!y7(this._editor.getModel(),i,e)){const t=this._editor.getModel(),e=[];for(let s=0,n=i.length;s<n;s++)e[s]=this._expandEmptyToWord(t,i[s]);return void this._editor.setSelections(e)}}}this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(t){if(!this._editor.hasModel())return;let i=null;const e=t.getState();if(e.isRevealed&&e.searchString.length>0&&e.isRegex){i=this._editor.getModel().findMatches(e.searchString,!e.searchScope||e.searchScope,e.isRegex,e.matchCase,e.wholeWord?this._editor.getOption(129):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(t),!this._session)return;i=this._session.selectAll(e.searchScope)}if(i.length>0){const t=this._editor.getSelection();for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s.range.intersectRanges(t)){i[e]=i[0],i[0]=s;break}}this._setSelections(i.map((t=>new ys(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}m7.ID="editor.contrib.multiCursorController";class w7 extends Ga{run(t,i){const e=m7.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=m4.get(i);if(r)this._run(e,r);else{const s=t.get(io).createInstance(m4,i);this._run(e,s),s.dispose()}f7(n,s.getCursorStates())}}}class v7{constructor(t,i,e,s,n){this._model=t,this._searchText=i,this._matchCase=e,this._wordSeparators=s,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,n&&this._model===n._model&&this._searchText===n._searchText&&this._matchCase===n._matchCase&&this._wordSeparators===n._wordSeparators&&this._modelVersionId===n._modelVersionId&&(this._cachedFindMatches=n._cachedFindMatches)}findMatches(){return null===this._cachedFindMatches&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map((t=>t.range)),this._cachedFindMatches.sort(bs.compareRangesUsingStarts)),this._cachedFindMatches}}let b7=d7=class extends Ki{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(107),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new rc((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(107)}))),this._register(t.onDidChangeCursorSelection((t=>{this._isEnabled&&(t.selection.isEmpty()?3===t.reason?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())}))),this._register(t.onDidChangeModel((()=>{this._setState(null)}))),this._register(t.onDidChangeModelContent((()=>{this._isEnabled&&this.updateSoon.schedule()})));const e=m4.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(d7._createState(this.state,this._isEnabled,this.editor))}static _createState(t,i,e){if(!i)return null;if(!e.hasModel())return null;const s=e.getSelection();if(s.startLineNumber!==s.endLineNumber)return null;const n=m7.get(e);if(!n)return null;const r=m4.get(e);if(!r)return null;let o=n.getSession(r);if(!o){const t=e.getSelections();if(t.length>1){const i=r.getState().matchCase;if(!y7(e.getModel(),t,i))return null}o=p7.create(e,r)}if(!o)return null;if(o.currentMatch)return null;if(/^[ \t]+$/.test(o.searchText))return null;if(o.searchText.length>200)return null;const h=r.getState(),c=h.matchCase;if(h.isRevealed){let t=h.searchString;c||(t=t.toLowerCase());let i=o.searchText;if(c||(i=i.toLowerCase()),t===i&&o.matchCase===h.matchCase&&o.wholeWord===h.wholeWord&&!h.isRegex)return null}return new v7(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(129):null,t)}_setState(t){if(this.state=t,!this.state)return void this._decorations.clear();if(!this.editor.hasModel())return;const i=this.editor.getModel();if(i.isTooLargeForTokenization())return;const e=this.state.findMatches(),s=this.editor.getSelections();s.sort(bs.compareRangesUsingStarts);const n=[];for(let t=0,i=0,r=e.length,o=s.length;t<r;){const r=e[t];if(i>=o)n.push(r),t++;else{const e=bs.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&bs.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r="off"!==this.editor.getOption(80),o=this._languageFeaturesService.documentHighlightProvider.has(i)&&r,h=n.map((t=>({range:t,options:u7(o)})));this._decorations.set(h)}dispose(){this._setState(null),super.dispose()}};function y7(t,i,e){const s=k7(t,i[0],!e);for(let n=1,r=i.length;n<r;n++){const r=i[n];if(r.isEmpty())return!1;if(s!==k7(t,r,!e))return!1}return!0}function k7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}b7.ID="editor.contrib.selectionHighlighter",b7=d7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,op)],b7),iu(m7.ID,m7,4),iu(b7.ID,b7,1),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorAbove",label:Q(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"&&Add Cursor Above"),order:2}})}run(t,i,e){if(!i.hasModel())return;let s=!0;e&&!1===e.logicalLine&&(s=!1);const n=i._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const r=n.getCursorStates();n.setCursorStates(e.source,3,wS.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorBelow",label:Q(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"A&&dd Cursor Below"),order:3}})}run(t,i,e){if(!i.hasModel())return;let s=!0;e&&!1===e.logicalLine&&(s=!1);const n=i._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const r=n.getCursorStates();n.setCursorStates(e.source,3,wS.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:Q(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(t,i,e){if(!t.isEmpty()){for(let s=t.startLineNumber;s<t.endLineNumber;s++){const t=i.getLineMaxColumn(s);e.push(new ys(s,t,s,t))}t.endColumn>1&&e.push(new ys(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn))}}run(t,i){if(!i.hasModel())return;const e=i.getModel(),s=i.getSelections(),n=i._getViewModel(),r=n.getCursorStates(),o=[];s.forEach((t=>this.getCursorsForSelection(t,e,o))),o.length>0&&i.setSelections(o),f7(r,n.getCursorStates())}}),Xa(class extends w7{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:Q(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2082,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:Q(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:Q(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:Ae(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:Q(0,"Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(t,i){t.moveSelectionToPreviousFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.selectHighlights",label:Q(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:3114,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.changeAll",label:Q(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Oo.and(PS.writable,PS.editorTextFocus),kbOpts:{kbExpr:PS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.addCursorsToBottom",label:Q(0,"Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getSelections(),s=i.getModel().getLineCount(),n=[];for(let t=e[0].startLineNumber;t<=s;t++)n.push(new ys(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),f7(o,r.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.addCursorsToTop",label:Q(0,"Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getSelections(),s=[];for(let t=e[0].startLineNumber;t>=1;t--)s.push(new ys(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.focusNextCursor",label:Q(0,"Focus Next Cursor"),metadata:{description:Q(0,"Focuses the next cursor"),args:[]},alias:"Focus Next Cursor",precondition:void 0})}run(t,i,e){if(!i.hasModel())return;const s=i._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const n=Array.from(s.getCursorStates()),r=n.shift();r&&(n.push(r),s.setCursorStates(e.source,3,n),s.revealPrimaryCursor(e.source,!0),f7(n,s.getCursorStates()))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.focusPreviousCursor",label:Q(0,"Focus Previous Cursor"),metadata:{description:Q(0,"Focuses the previous cursor"),args:[]},alias:"Focus Previous Cursor",precondition:void 0})}run(t,i,e){if(!i.hasModel())return;const s=i._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const n=Array.from(s.getCursorStates()),r=n.pop();r&&(n.unshift(r),s.setCursorStates(e.source,3,n),s.revealPrimaryCursor(e.source,!0),f7(n,s.getCursorStates()))}});const C7={Visible:new Xo("parameterHintsVisible",!1),MultipleSignatures:new Xo("parameterHintsMultipleSignatures",!1)};async function S7(t,i,e,s,n){const r=t.ordered(i);for(const t of r)try{const r=await t.provideSignatureHelp(i,e,n,s);if(r)return r}catch(t){Fi(t)}}var x7;mo.registerCommand("_executeSignatureHelpProvider",(async(t,...i)=>{const[e,s,n]=i;B(hs.isUri(e)),B(vs.isIPosition(s)),B("string"==typeof n||!n);const r=t.get(op),o=await t.get(ro).createModelReference(e);try{const t=await S7(r.signatureHelpProvider,o.object.textEditorModel,vs.lift(s),{triggerKind:Ts.Invoke,isRetrigger:!1,triggerCharacter:n},fe.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}})),function(t){t.Default={type:0},t.Pending=class{constructor(t,i){this.request=t,this.previouslyActiveHints=i,this.type=2}},t.Active=class{constructor(t){this.hints=t,this.type=1}}}(x7||(x7={}));class D7 extends Ki{constructor(t,i,e=D7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ne),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=x7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new qi),this.triggerChars=new af,this.retriggerChars=new af,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new Yh(e),this._register(this.editor.onDidBlurEditorWidget((()=>this.cancel()))),this._register(this.editor.onDidChangeConfiguration((()=>this.onEditorConfigurationChange()))),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeModelLanguage((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeCursorSelection((t=>this.onCursorChange(t)))),this._register(this.editor.onDidChangeModelContent((()=>this.onModelContentChange()))),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType((t=>this.onDidType(t)))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(t){2===this._state.type&&this._state.request.cancel(),this._state=t}cancel(t=!1){this.state=x7.Default,this.throttledDelayer.cancel(),t||this._onChangedHints.fire(void 0)}trigger(t,i){const e=this.editor.getModel();if(!e||!this.providers.has(e))return;const s=++this.triggerId;this._pendingTriggers.push(t),this.throttledDelayer.trigger((()=>this.doTrigger(s)),i).catch(Li)}next(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=i%t==t-1,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?0:i+1):this.cancel()}previous(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=0===i,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new x7.Active({...this.state.hints,activeSignature:t}),this._onChangedHints.fire(this.state.hints))}async doTrigger(t){const i=1===this.state.type||2===this.state.type,e=this.getLastActiveHints();if(this.cancel(!0),0===this._pendingTriggers.length)return!1;const s=this._pendingTriggers.reduce(E7);this._pendingTriggers=[];const n={triggerKind:s.triggerKind,triggerCharacter:s.triggerCharacter,isRetrigger:i,activeSignatureHelp:e};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),o=this.editor.getPosition();this.state=new x7.Pending(Zh((t=>S7(this.providers,r,o,n,t))),e);try{const i=await this.state.request;return t!==this.triggerId?(null==i||i.dispose(),!1):i&&i.value.signatures&&0!==i.value.signatures.length?(this.state=new x7.Active(i.value),this._lastSignatureHelpResult.value=i,this._onChangedHints.fire(this.state.hints),!0):(null==i||i.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1)}catch(i){return t===this.triggerId&&(this.state=x7.Default),Li(i),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return 1===this.state.type||2===this.state.type||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const t=this.editor.getModel();if(t)for(const i of this.providers.ordered(t)){for(const t of i.signatureHelpTriggerCharacters||[])if(t.length){const i=t.charCodeAt(0);this.triggerChars.add(i),this.retriggerChars.add(i)}for(const t of i.signatureHelpRetriggerCharacters||[])t.length&&this.retriggerChars.add(t.charCodeAt(0))}}onDidType(t){if(!this.triggerOnType)return;const i=t.length-1,e=t.charCodeAt(i);(this.triggerChars.has(e)||this.isTriggered&&this.retriggerChars.has(e))&&this.trigger({triggerKind:Ts.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ts.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ts.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(85).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function E7(t,i){switch(i.triggerKind){case Ts.Invoke:return i;case Ts.ContentChange:return t;default:return i}}D7.DEFAULT_DELAY=120;var A7,M7=function(t,i){return function(e,s){i(e,s,t)}};const L7=Fa,F7=AV("parameter-hints-next",xs.chevronDown,Q(0,"Icon for show next parameter hint.")),T7=AV("parameter-hints-previous",xs.chevronUp,Q(0,"Icon for show previous parameter hint."));let R7=A7=class extends Ki{constructor(t,i,e,s,n){super(),this.editor=t,this.model=i,this.renderDisposeables=this._register(new Ui),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new GZ({editor:t},n,s)),this.keyVisible=C7.Visible.bindTo(e),this.keyMultipleSignatures=C7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=L7(".editor-widget.parameter-hints-widget"),i=xa(t,L7(".phwrapper"));i.tabIndex=-1;const e=xa(i,L7(".controls")),s=xa(e,L7(".button"+go.asCSSSelector(T7))),n=xa(e,L7(".overloads")),r=xa(e,L7(".button"+go.asCSSSelector(F7)));this._register(Il(s,"click",(t=>{ka(t),this.previous()}))),this._register(Il(r,"click",(t=>{ka(t),this.next()})));const o=L7(".body"),h=new pk(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=xa(o,L7(".signature")),l=xa(o,L7(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:l,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const a=()=>{if(!this.domNodes)return;const t=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};a(),this._register(Xi.chain(this.editor.onDidChangeConfiguration.bind(this.editor),(t=>t.filter((t=>t.hasChanged(50)))))(a)),this._register(this.editor.onDidLayoutChange((()=>this.updateMaxHeight()))),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout((()=>{var t;null===(t=this.domNodes)||void 0===t||t.element.classList.add("visible")}),100),this.editor.layoutContentWidget(this))}hide(){var t;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,null===(t=this.domNodes)||void 0===t||t.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(t){var i;if(this.renderDisposeables.clear(),!this.domNodes)return;const e=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",e),this.keyMultipleSignatures.set(e),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const s=t.signatures[t.activeSignature];if(!s)return;const n=xa(this.domNodes.signature,L7(".code")),r=this.editor.getOption(50);n.style.fontSize=`${r.fontSize}px`,n.style.fontFamily=r.fontFamily;const o=null!==(i=s.activeParameter)&&void 0!==i?i:t.activeParameter;s.parameters.length>0?this.renderParameters(n,s,o):xa(n,L7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=L7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}xa(this.domNodes.docs,L7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)xa(this.domNodes.docs,L7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);xa(this.domNodes.docs,t.element)}const c=this.hasDocs(s,h);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,h){let t="";const i=s.parameters[o];t=Array.isArray(i.label)?s.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),s.documentation&&(t+="string"==typeof s.documentation?`, ${s.documentation}`:`, ${s.documentation.value}`),this.announcedLabel!==t&&(Cm(Q(0,"{0}, hint",t)),this.announcedLabel=t)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(t){const i=this.renderDisposeables.add(this.markdownRenderer.render(t,{asyncRenderCallback:()=>{var t;null===(t=this.domNodes)||void 0===t||t.scrollbar.scanDomNode()}}));return i.element.classList.add("markdown-docs"),i}hasDocs(t,i){return!!(i&&"string"==typeof i.documentation&&$(i.documentation).length>0||i&&"object"==typeof i.documentation&&$(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&$(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&$(t.documentation.value).length>0)}renderParameters(t,i,e){const[s,n]=this.getParameterLabelOffsets(i,e),r=document.createElement("span");r.textContent=i.label.substring(0,s);const o=document.createElement("span");o.textContent=i.label.substring(s,n),o.className="parameter active";const h=document.createElement("span");h.textContent=i.label.substring(n),xa(t,r,o,h)}getParameterLabelOffsets(t,i){const e=t.parameters[i];if(e){if(Array.isArray(e.label))return e.label;if(e.label.length){const i=new RegExp(`(\\W|^)${$n(e.label)}(?=\\W|$)`,"g");i.test(t.label);const s=i.lastIndex-e.label.length;return s>=0?[s,i.lastIndex]:[0,0]}return[0,0]}return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return A7.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}};R7.ID="editor.widget.parameterHintsWidget",R7=A7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M7(2,th),M7(3,ZN),M7(4,ud)],R7),Jm("editorHoverWidget.highlightForeground",{dark:Gv,light:Gv,hcDark:Gv,hcLight:Gv},Q(0,"Foreground color of the active item in the parameter hint."));var O7,_7=function(t,i){return function(e,s){i(e,s,t)}};let I7=O7=class extends Ki{static get(t){return t.getContribution(O7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new D7(t,e.signatureHelpProvider)),this._register(this.model.onChangedHints((t=>{var i;t?(this.widget.value.show(),this.widget.value.render(t)):null===(i=this.widget.rawValue)||void 0===i||i.hide()}))),this.widget=new On((()=>this._register(i.createInstance(R7,this.editor,this.model))))}cancel(){this.model.cancel()}previous(){var t;null===(t=this.widget.rawValue)||void 0===t||t.previous()}next(){var t;null===(t=this.widget.rawValue)||void 0===t||t.next()}trigger(t){this.model.trigger(t,0)}};I7.ID="editor.controller.parameterHints",I7=O7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([_7(1,io),_7(2,op)],I7),iu(I7.ID,I7,2),Xa(class extends Ga{constructor(){super({id:"editor.action.triggerParameterHints",label:Q(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:PS.hasSignatureHelpProvider,kbOpts:{kbExpr:PS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=I7.get(i);null==e||e.trigger({triggerKind:Ts.Invoke})}});const P7=qa.bindToContribution(I7.get);Ya(new P7({id:"closeParameterHints",precondition:C7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:PS.focus,primary:9,secondary:[1033]}})),Ya(new P7({id:"showPrevParameterHint",precondition:Oo.and(C7.Visible,C7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:PS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),Ya(new P7({id:"showNextParameterHint",precondition:Oo.and(C7.Visible,C7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:PS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var N7=function(t,i){return function(e,s){i(e,s,t)}};const B7=new Xo("renameInputVisible",!1,Q(0,"Whether the rename input widget is visible"));let $7=class{constructor(t,i,e,s,n){this._editor=t,this._acceptKeybindings=i,this._themeService=e,this._keybindingService=s,this._disposables=new Ui,this.allowEditorOverflow=!0,this._visibleContextKey=B7.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._disposables.add(e.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",Q(0,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._input),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(t){var i,e,s,n;if(!this._input||!this._domNode)return;const r=t.getColor(nw),o=t.getColor(rw);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Zw))&&void 0!==i?i:""),this._domNode.style.boxShadow=r?` 0 0 8px 2px ${r}`:"",this._domNode.style.border=o?`1px solid ${o}`:"",this._domNode.style.color=String(null!==(e=t.getColor(hw))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(ow))&&void 0!==s?s:"");const h=t.getColor(cw);this._input.style.borderWidth=h?"1px":"0px",this._input.style.borderStyle=h?"solid":"none",this._input.style.borderColor=null!==(n=null==h?void 0:h.toString())&&void 0!==n?n:"none"}_updateFont(){if(!this._input||!this._label)return;const t=this._editor.getOption(50);this._input.style.fontFamily=t.fontFamily,this._input.style.fontWeight=t.fontWeight,this._input.style.fontSize=`${t.fontSize}px`,this._label.style.fontSize=.8*t.fontSize+"px"}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}beforeRender(){var t,i;const[e,s]=this._acceptKeybindings;return this._label.innerText=Q(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(e))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(s))||void 0===i?void 0:i.getLabel()),null}afterRender(t){t||this.cancelInput(!0)}acceptInput(t){var i;null===(i=this._currentAcceptInput)||void 0===i||i.call(this,t)}cancelInput(t){var i;null===(i=this._currentCancelInput)||void 0===i||i.call(this,t)}getInput(t,i,e,s,n,r){this._domNode.classList.toggle("preview",n),this._position=new vs(t.startLineNumber,t.startColumn),this._input.value=i,this._input.setAttribute("selectionStart",e.toString()),this._input.setAttribute("selectionEnd",s.toString()),this._input.size=Math.max(1.1*(t.endColumn-t.startColumn),20);const o=new Ui;return new Promise((t=>{this._currentCancelInput=i=>(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,t(i),!0),this._currentAcceptInput=e=>{0!==this._input.value.trim().length&&this._input.value!==i?(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,t({newName:this._input.value,wantsPreview:n&&e})):this.cancelInput(!0)},o.add(r.onCancellationRequested((()=>this.cancelInput(!0)))),o.add(this._editor.onDidBlurEditorWidget((()=>{var t;return this.cancelInput(!(null===(t=this._domNode)||void 0===t?void 0:t.ownerDocument.hasFocus()))}))),this._show()})).finally((()=>{o.dispose(),this._hide()}))}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout((()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))}),100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};$7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([N7(2,Nk),N7(3,HC),N7(4,th)],$7);var W7,j7=function(t,i){return function(e,s){i(e,s,t)}};class V7{constructor(t,i,e){this.model=t,this.position=i,this._providerRenameIdx=0,this._providers=e.ordered(t)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(t){const i=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const e=this._providers[this._providerRenameIdx];if(!e.resolveRenameLocation)break;const s=await e.resolveRenameLocation(this.model,this.position,t);if(s){if(!s.rejectReason)return s;i.push(s.rejectReason)}}this._providerRenameIdx=0;const e=this.model.getWordAtPosition(this.position);return e?{range:new bs(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:bs.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}async provideRenameEdits(t,i){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}async _provideRenameEdits(t,i,e,s){const n=this._providers[i];if(!n)return{edits:[],rejectReason:e.join("\n")};const r=await n.provideRenameEdits(this.model,this.position,t,s);return r?r.rejectReason?this._provideRenameEdits(t,i+1,e.concat(r.rejectReason),s):r:this._provideRenameEdits(t,i+1,e.concat(Q(0,"No result.")),s)}}let H7=W7=class{static get(t){return t.getContribution(W7.ID)}constructor(t,i,e,s,n,r,o,h){this.editor=t,this._instaService=i,this._notificationService=e,this._bulkEditService=s,this._progressService=n,this._logService=r,this._configService=o,this._languageFeaturesService=h,this._disposableStore=new Ui,this._cts=new pe,this._renameInputField=this._disposableStore.add(this._instaService.createInstance($7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var t,i;if(this._cts.dispose(!0),this._cts=new pe,!this.editor.hasModel())return;const e=this.editor.getPosition(),s=new V7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new hq(this.editor,5,void 0,this._cts.token);let r;try{const t=s.resolveRenameLocation(n.token);this._progressService.showWhile(t,250),r=await t}catch(i){return void(null===(t=XZ.get(this.editor))||void 0===t||t.showMessage(i||Q(0,"An unknown error occurred while resolving rename location"),e))}finally{n.dispose()}if(!r)return;if(r.rejectReason)return void(null===(i=XZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new hq(this.editor,5,r.range,this._cts.token),h=this.editor.getSelection();let c=0,l=r.text.length;bs.isEmpty(h)||bs.spansMultipleLines(h)||!bs.containsRange(r.range,h)||(c=Math.max(0,h.startColumn-r.range.startColumn),l=Math.min(r.range.endColumn,h.endColumn)-r.range.startColumn);const a=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameInputField.getInput(r.range,r.text,c,l,a,o.token);if("boolean"==typeof u)return u&&this.editor.focus(),void o.dispose();this.editor.focus();const d=Jh(s.provideRenameEdits(u.newName,o.token),o.token).then((async t=>{t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(bs.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:u.wantsPreview,label:Q(0,"Renaming '{0}' to '{1}'",null==r?void 0:r.text,u.newName),code:"undoredo.rename",quotableLabel:Q(0,"Renaming {0} to {1}",null==r?void 0:r.text,u.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&Cm(Q(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,u.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(Q(0,"Rename failed to apply edits")),this._logService.error(t)}))))}),(t=>{this._notificationService.error(Q(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{o.dispose()}));return this._progressService.showWhile(d,250),d}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};H7.ID="editor.contrib.renameController",H7=W7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j7(1,io),j7(2,VF),j7(3,jR),j7(4,DO),j7(5,Rh),j7(6,np),j7(7,op)],H7),iu(H7.ID,H7,4),Xa(class extends Ga{constructor(){super({id:"editor.action.rename",label:Q(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Oo.and(PS.writable,PS.hasRenameProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(so),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return hs.isUri(s)&&vs.isIPosition(n)?e.openCodeEditor({resource:s},e.getActiveCodeEditor()).then((t=>{t&&(t.setPosition(n),t.invokeWithinContext((i=>(this.reportTelemetry(i,t),this.run(i,t)))))}),Li):super.runCommand(t,i)}run(t,i){const e=H7.get(i);return e?e.run():Promise.resolve()}});const z7=qa.bindToContribution(H7.get);function U7(t){const i=new Uint32Array(function(t){let i=0;if(i+=2,"full"===t.type)i+=1+t.data.length;else{i+=1,i+=3*t.deltas.length;for(const e of t.deltas)e.data&&(i+=e.data.length)}return i}(t));let e=0;if(i[e++]=t.id,"full"===t.type)i[e++]=1,i[e++]=t.data.length,i.set(t.data,e),e+=t.data.length;else{i[e++]=2,i[e++]=t.deltas.length;for(const s of t.deltas)i[e++]=s.start,i[e++]=s.deleteCount,s.data?(i[e++]=s.data.length,i.set(s.data,e),e+=s.data.length):i[e++]=0}return function(t){const i=new Uint8Array(t.buffer,t.byteOffset,4*t.length);return Lt()||function(t){for(let i=0,e=t.length;i<e;i+=4){const e=t[i+0],s=t[i+1],n=t[i+2];t[i+0]=t[i+3],t[i+1]=n,t[i+2]=s,t[i+3]=e}}(i),Pu.wrap(i)}(i)}function K7(t){return t&&!!t.data}function q7(t){return t&&Array.isArray(t.edits)}Ya(new z7({id:"acceptRenameInput",precondition:B7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:3}})),Ya(new z7({id:"acceptRenameInputWithPreview",precondition:Oo.and(B7,Oo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:1027}})),Ya(new z7({id:"cancelRenameInput",precondition:B7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:PS.focus,primary:9,secondary:[1033]}})),Qa("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get(op);return async function(t,i,e,s){const n=new V7(i,e,t),r=await n.resolveRenameLocation(fe.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,fe.None)}(r,i,e,n)})),Qa("_executePrepareRename",(async function(t,i,e){const{renameProvider:s}=t.get(op),n=new V7(i,e,s),r=await n.resolveRenameLocation(fe.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r})),mh.as(bd).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:Q(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});class G7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function Z7(t,i){return t.has(i)}async function J7(t,i,e,s,n){const r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}(t,i),o=await Promise.all(r.map((async t=>{let r,o=null;try{r=await t.provideDocumentSemanticTokens(i,t===e?s:null,n)}catch(t){o=t,r=null}return r&&(K7(r)||q7(r))||(r=null),new G7(t,r,o)})));for(const t of o){if(t.error)throw t.error;if(t.tokens)return t}return o.length>0?o[0]:null}class Q7{constructor(t,i){this.provider=t,this.tokens=i}}function Y7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}async function X7(t,i,e,s){const n=Y7(t,i),r=await Promise.all(n.map((async t=>{let n;try{n=await t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Fi(t),n=null}return n&&K7(n)||(n=null),new Q7(t,n)})));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}mo.registerCommand("_provideDocumentSemanticTokensLegend",(async(t,...i)=>{const[e]=i;B(e instanceof hs);const s=t.get(no).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(op),r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:null}(n,s);return r?r[0].getLegend():t.get(po).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})),mo.registerCommand("_provideDocumentSemanticTokens",(async(t,...i)=>{const[e]=i;B(e instanceof hs);const s=t.get(no).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(op);if(!Z7(n,s))return t.get(po).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=await J7(n,s,null,null,fe.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!K7(h))return;const c=U7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})),mo.registerCommand("_provideDocumentRangeSemanticTokensLegend",(async(t,...i)=>{const[e,s]=i;B(e instanceof hs);const n=t.get(no).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(op),o=Y7(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!bs.isIRange(s))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),o[0].getLegend();const h=await X7(r,n,bs.lift(s),fe.None);return h?h.provider.getLegend():void 0})),mo.registerCommand("_provideDocumentRangeSemanticTokens",(async(t,...i)=>{const[e,s]=i;B(e instanceof hs),B(bs.isIRange(s));const n=t.get(no).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(op),o=await X7(r,n,bs.lift(s),fe.None);return o&&o.tokens?U7({id:0,type:"full",data:o.tokens.data}):void 0}));const t8="editor.semanticHighlighting";function i8(t,i,e){var s;const n=null===(s=e.getValue(t8,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var e8,s8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},n8=function(t,i){return function(e,s){i(e,s,t)}};let r8=class extends Ki{constructor(t,i,e,s,n,r){super(),this._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new o8(i,t,e,n,r)},h=(t,i)=>{i.dispose(),delete this._watchers[t.uri.toString()]},c=()=>{for(const t of i.getModels()){const i=this._watchers[t.uri.toString()];i8(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{i8(t,e,s)&&o(t)}))),this._register(i.onModelRemoved((t=>{const i=this._watchers[t.uri.toString()];i&&h(t,i)}))),this._register(s.onDidChangeConfiguration((t=>{t.affectsConfiguration(t8)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};r8=s8([n8(0,uR),n8(1,no),n8(2,Nk),n8(3,rd),n8(4,YT),n8(5,op)],r8);let o8=e8=class extends Ki{constructor(t,i,e,s,n){super(),this._semanticTokensStylingService=i,this._isDisposed=!1,this._model=t,this._provider=n.documentSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentSemanticTokens",{min:e8.REQUEST_MIN_DELAY,max:e8.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new rc((()=>this._fetchDocumentSemanticTokensNow()),e8.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeAttached((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeLanguage((()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)})));const r=()=>{Vi(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const i of this._provider.all(t))"function"==typeof i.onDidChange&&this._documentProvidersChangeListeners.push(i.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};r(),this._register(this._provider.onDidChange((()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(e.onDidColorThemeChange((()=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),Vi(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!Z7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new pe,i=J7(this._provider,this._model,this._currentDocumentResponse?this._currentDocumentResponse.provider:null,this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,t.token);this._currentDocumentRequestCancellationTokenSource=t,this._providersChangedDuringRequest=!1;const e=[],s=this._model.onDidChangeContent((t=>{e.push(t)})),n=new Yi(!1);i.then((t=>{if(this._debounceInformation.update(this._model,n.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),t){const{provider:i,tokens:s}=t,n=this._semanticTokensStylingService.getStyling(i);this._setDocumentSemanticTokens(i,s||null,n,e)}else this._setDocumentSemanticTokens(null,null,null,e)}),(t=>{t&&(Oi(t)||"string"==typeof t.message&&-1!==t.message.indexOf("busy"))||Li(t),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),(e.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))}))}static _copy(t,i,e,s,n){n=Math.min(n,e.length-s,t.length-i);for(let r=0;r<n;r++)e[s+r]=t[i+r]}_setDocumentSemanticTokens(t,i,e,s){const n=this._currentDocumentResponse,r=()=>{(s.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed)t&&i&&t.releaseDocumentSemanticTokens(i.resultId);else if(t&&e){if(!i)return this._model.tokenization.setSemanticTokens(null,!0),void r();if(q7(i)){if(!n)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===i.edits.length)i={resultId:i.resultId,data:n.data};else{let t=0;for(const e of i.edits)t+=(e.data?e.data.length:0)-e.deleteCount;const s=n.data,r=new Uint32Array(s.length+t);let o=s.length,h=r.length;for(let t=i.edits.length-1;t>=0;t--){const c=i.edits[t];if(c.start>s.length)return e.warnInvalidEditStart(n.resultId,i.resultId,t,c.start,s.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=o-(c.start+c.deleteCount);l>0&&(e8._copy(s,o-l,r,h-l,l),h-=l),c.data&&(e8._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&e8._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(K7(i)){this._currentDocumentResponse=new h8(t,i.resultId,i.data);const n=cR(i,e,this._model.getLanguageId());if(s.length>0)for(const t of s)for(const i of n)for(const e of t.changes)i.applyEdit(e.range,e.text);this._model.tokenization.setSemanticTokens(n,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}else this._model.tokenization.setSemanticTokens(null,!1)}};o8.REQUEST_MIN_DELAY=300,o8.REQUEST_MAX_DELAY=2e3,o8=e8=s8([n8(1,uR),n8(2,Nk),n8(3,YT),n8(4,op)],o8);class h8{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}RH(r8);var c8=function(t,i){return function(e,s){i(e,s,t)}};let l8=class extends Ki{constructor(t,i,e,s,n,r){super(),this._semanticTokensStylingService=i,this._themeService=e,this._configurationService=s,this._editor=t,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new rc((()=>this._tokenizeViewportNow()),100)),this._outstandingRequests=[];const o=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange((()=>{o()}))),this._register(this._editor.onDidChangeModel((()=>{this._cancelAll(),o()}))),this._register(this._editor.onDidChangeModelContent((()=>{this._cancelAll(),o()}))),this._register(this._provider.onDidChange((()=>{this._cancelAll(),o()}))),this._register(this._configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration(t8)&&(this._cancelAll(),o())}))),this._register(this._themeService.onDidColorThemeChange((()=>{this._cancelAll(),o()}))),o()}_cancelAll(){for(const t of this._outstandingRequests)t.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(t){for(let i=0,e=this._outstandingRequests.length;i<e;i++)if(this._outstandingRequests[i]===t)return void this._outstandingRequests.splice(i,1)}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const t=this._editor.getModel();if(t.tokenization.hasCompleteSemanticTokens())return;if(!i8(t,this._themeService,this._configurationService))return void(t.tokenization.hasSomeSemanticTokens()&&t.tokenization.setSemanticTokens(null,!1));if(!function(t,i){return t.has(i)}(this._provider,t))return void(t.tokenization.hasSomeSemanticTokens()&&t.tokenization.setSemanticTokens(null,!1));const i=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(i.map((i=>this._requestRange(t,i))))}_requestRange(t,i){const e=t.getVersionId(),s=Zh((e=>Promise.resolve(X7(this._provider,t,i,e)))),n=new Yi(!1);return s.then((s=>{if(this._debounceInformation.update(t,n.elapsed()),!s||!s.tokens||t.isDisposed()||t.getVersionId()!==e)return;const{provider:r,tokens:o}=s,h=this._semanticTokensStylingService.getStyling(r);t.tokenization.setPartialSemanticTokens(i,cR(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};l8.ID="editor.contrib.viewportSemanticTokens",l8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([c8(1,uR),c8(2,Nk),c8(3,rd),c8(4,YT),c8(5,op)],l8),iu(l8.ID,l8,1);class a8{constructor(t=!0){this.selectSubwords=t}provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),this.selectSubwords&&this._addInWordRanges(i,t,s),this._addWordRanges(i,t,s),this._addWhitespaceLine(i,t,s),i.push({range:t.getFullModelRange()})}return e}_addInWordRanges(t,i,e){const s=i.getWordAtPosition(e);if(!s)return;const{word:n,startColumn:r}=s,o=e.column-r;let h=o,c=o,l=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(Xn(t)&&tr(l))break;l=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(tr(t)&&Xn(l))break;if(95===t||45===t)break;l=t}h<c&&t.push({range:new bs(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new bs(e.lineNumber,s.startColumn,e.lineNumber,s.endColumn)})}_addWhitespaceLine(t,i,e){i.getLineLength(e.lineNumber)>0&&0===i.getLineFirstNonWhitespaceColumn(e.lineNumber)&&0===i.getLineLastNonWhitespaceColumn(e.lineNumber)&&t.push({range:new bs(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var u8;class d8{constructor(t,i){this.index=t,this.ranges=i}mov(t){const i=this.index+(t?1:-1);if(i<0||i>=this.ranges.length)return this;const e=new d8(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let f8=u8=class{static get(t){return t.getContribution(u8.ID)}constructor(t,i){this._editor=t,this._languageFeaturesService=i,this._ignoreSelection=!1}dispose(){var t;null===(t=this._selectionListener)||void 0===t||t.dispose()}async run(t){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||await p8(this._languageFeaturesService.selectionRangeProvider,s,i.map((t=>t.getPosition())),this._editor.getOption(112),fe.None).then((t=>{var s;if(u(t)&&t.length===i.length&&this._editor.hasModel()&&e(this._editor.getSelections(),i,((t,i)=>t.equalsSelection(i)))){for(let e=0;e<t.length;e++)t[e]=t[e].filter((t=>t.containsPosition(i[e].getStartPosition())&&t.containsPosition(i[e].getEndPosition()))),t[e].unshift(i[e]);this._state=t.map((t=>new d8(0,t))),null===(s=this._selectionListener)||void 0===s||s.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition((()=>{var t;this._ignoreSelection||(null===(t=this._selectionListener)||void 0===t||t.dispose(),this._state=void 0)}))}})),!this._state)return;this._state=this._state.map((i=>i.mov(t)));const n=this._state.map((t=>ys.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}};f8.ID="editor.contrib.smartSelectController",f8=u8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,op)],f8);class g8 extends Ga{constructor(t,i){super(i),this._forward=t}async run(t,i){const e=f8.get(i);e&&await e.run(this._forward)}}async function p8(t,i,e,s,n){const r=t.all(i).concat(new a8(s.selectSubwords));1===r.length&&r.unshift(new K3);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(u(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])bs.isIRange(s.range)&&bs.containsPosition(s.range,e[i])&&h[i].push(bs.lift(s.range))}}),Fi));return await Promise.all(o),h.map((t=>{if(0===t.length)return[];t.sort(((t,i)=>vs.isBefore(t.getStartPosition(),i.getStartPosition())?1:vs.isBefore(i.getStartPosition(),t.getStartPosition())||vs.isBefore(t.getEndPosition(),i.getEndPosition())?-1:vs.isBefore(i.getEndPosition(),t.getEndPosition())?1:0));const e=[];let n;for(const i of t)(!n||bs.containsRange(i,n)&&!bs.equalsRange(i,n))&&(e.push(i),n=i);if(!s.selectLeadingAndTrailingWhitespace)return e;const r=[e[0]];for(let t=1;t<e.length;t++){const s=e[t-1],n=e[t];if(n.startLineNumber!==s.startLineNumber||n.endLineNumber!==s.endLineNumber){const t=new bs(s.startLineNumber,i.getLineFirstNonWhitespaceColumn(s.startLineNumber),s.endLineNumber,i.getLineLastNonWhitespaceColumn(s.endLineNumber));t.containsRange(s)&&!t.equalsRange(s)&&n.containsRange(t)&&!n.equalsRange(t)&&r.push(t);const e=new bs(s.startLineNumber,1,s.endLineNumber,i.getLineMaxColumn(s.endLineNumber));e.containsRange(s)&&!e.equalsRange(t)&&n.containsRange(e)&&!n.equalsRange(e)&&r.push(e)}r.push(n)}return r}))}mo.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),iu(f8.ID,f8,4),Xa(class extends g8{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:Q(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"1_basic",title:Q(0,"&&Expand Selection"),order:2}})}}),Xa(class extends g8{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:Q(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"1_basic",title:Q(0,"&&Shrink Selection"),order:3}})}}),mo.registerCommand("_executeSelectionRangeProvider",(async function(t,...i){const[e,s]=i;B(hs.isUri(e));const n=t.get(op).selectionRangeProvider,r=await t.get(ro).createModelReference(e);try{return p8(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},fe.None)}finally{r.dispose()}}));const m8=Object.freeze({View:{value:Q(0,"View"),original:"View"},Help:{value:Q(0,"Help"),original:"Help"},Test:{value:Q(0,"Test"),original:"Test"},File:{value:Q(0,"File"),original:"File"},Preferences:{value:Q(0,"Preferences"),original:"Preferences"},Developer:{value:Q(0,"Developer"),original:"Developer"}});class w8{constructor(t,i,e,s=null){this.startLineNumbers=t,this.endLineNumbers=i,this.lastLineRelativePosition=e,this.showEndForLine=s}equals(t){return!!t&&this.lastLineRelativePosition===t.lastLineRelativePosition&&this.showEndForLine===t.showEndForLine&&e(this.startLineNumbers,t.startLineNumbers)&&e(this.endLineNumbers,t.endLineNumbers)}}const v8=bu("stickyScrollViewLayer",{createHTML:t=>t}),b8="data-sticky-line-index",y8="data-sticky-is-line",k8="data-sticky-is-folding-icon";class C8 extends Ki{constructor(t){super(),this._editor=t,this._foldingIconStore=new Ui,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof LQ),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const i=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&i(),t.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))}))),this._register(this._editor.onDidScrollChange((t=>{t.scrollLeftChanged&&i(),t.scrollWidthChanged&&this._updateWidgetWidth()}))),this._register(this._editor.onDidChangeModel((()=>{i(),this._updateWidgetWidth()}))),this._register(this._foldingIconStore),i(),this._register(this._editor.onDidLayoutChange((()=>{this._updateWidgetWidth()}))),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(t){return this._stickyLines.find((i=>i.lineNumber===t))}getCurrentLines(){return this._lineNumbers}setState(t,i,e=1/0){if((!this._previousState&&!t||this._previousState&&this._previousState.equals(t))&&e===1/0)return;this._previousState=t;const s=this._stickyLines;if(this._clearStickyWidget(),t&&this._editor._getViewModel()){if(t.startLineNumbers.length*this._lineHeight+t.lastLineRelativePosition>0){this._lastLineRelativePosition=t.lastLineRelativePosition;const i=[...t.startLineNumbers];null!==t.showEndForLine&&(i[t.showEndForLine]=t.endLineNumbers[t.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(s,i,e)}}_updateWidgetWidth(){const t=this._editor.getLayoutInfo();this._lineNumbersDomNode.style.width=`${t.contentLeft}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",this._editor.getScrollWidth()-t.verticalScrollbarWidth+"px"),this._rootDomNode.style.width=t.width-t.verticalScrollbarWidth+"px"}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),Ol(this._lineNumbersDomNode),Ol(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(t){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${t?.5:0}s`)}_setFoldingIconsVisibility(t){for(const i of this._stickyLines){const e=i.foldingIcon;e&&e.setVisible(!!t||e.isCollapsed)}}async _renderRootNode(t,i,e=1/0){const s=this._editor.getLayoutInfo();for(const[n,r]of this._lineNumbers.entries()){const o=t[n],h=r>=e||(null==o?void 0:o.lineNumber)!==r?this._renderChildNode(n,r,i,s):this._updateTopAndZIndexOfStickyLine(o);h&&(this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),this._stickyLines.push(h))}i&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const n=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;0!==n?(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${n}px`,this._linesDomNodeScrollable.style.height=`${n}px`,this._rootDomNode.style.height=`${n}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)):this._clearStickyWidget()}_setFoldingHoverListeners(){"mouseover"===this._editor.getOption(109)&&(this._foldingIconStore.add(Il(this._lineNumbersDomNode,ya.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Il(this._lineNumbersDomNode,ya.MOUSE_LEAVE,(()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)}))))}_renderChildNode(t,i,e,s){const n=this._editor._getViewModel();if(!n)return;const r=n.coordinatesConverter.convertModelPositionToViewPosition(new vs(i,1)).lineNumber,o=n.getViewLineRenderingData(r),h=this._editor.getOption(67);let c;try{c=xp.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new Fp(!0,!0,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,0,o.tokens,c,o.tabSize,o.startVisibleColumn,1,1,1,500,"none",!0,!0,null),a=new Uu(2e3),u=_p(l,a);let d;d=v8?v8.createHTML(a.build()):a.build();const f=document.createElement("span");f.setAttribute(b8,String(t)),f.setAttribute(y8,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${i}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=d;const g=document.createElement("span");g.setAttribute(b8,String(t)),g.setAttribute("data-sticky-is-line-number",""),g.className="sticky-line-number",g.style.lineHeight=`${this._lineHeight}px`,g.style.width=`${s.contentLeft}px`;const p=document.createElement("span");1===h.renderType||3===h.renderType&&i%10==0?p.innerText=i.toString():2===h.renderType&&(p.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),p.className="sticky-line-number-inner",p.style.lineHeight=`${this._lineHeight}px`,p.style.width=`${s.lineNumbersWidth}px`,p.style.paddingLeft=`${s.lineNumbersLeft}px`,g.appendChild(p);const m=this._renderFoldingIconForLine(e,i);m&&g.appendChild(m.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(p),g.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const w=new S8(t,i,f,g,m,u.characterMapping);return this._updateTopAndZIndexOfStickyLine(w)}_updateTopAndZIndexOfStickyLine(t){var i;const e=t.index,s=t.lineDomNode,n=t.lineNumberDomNode,r=e===this._lineNumbers.length-1;s.style.zIndex=r?"0":"1",n.style.zIndex=r?"0":"1";const o=`${e*this._lineHeight+this._lastLineRelativePosition+((null===(i=t.foldingIcon)||void 0===i?void 0:i.isCollapsed)?1:0)}px`,h=e*this._lineHeight+"px";return s.style.top=r?o:h,n.style.top=r?o:h,t}_renderFoldingIconForLine(t,i){const e=this._editor.getOption(109);if(!t||"never"===e)return;const s=t.regions,n=s.findRange(i),r=s.getStartLineNumber(n);if(i!==r)return;const o=s.isCollapsed(n),h=new x8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(k8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=Py(i.characterMapping,t,0);return new vs(i.lineNumber,e)}getLineNumberFromChildDomNode(t){var i,e;return null!==(e=null===(i=this._getRenderedStickyLineFromChildDomNode(t))||void 0===i?void 0:i.lineNumber)&&void 0!==e?e:null}_getRenderedStickyLineFromChildDomNode(t){const i=this.getLineIndexFromChildDomNode(t);return null===i||i<0||i>=this._stickyLines.length?null:this._stickyLines[i]}getLineIndexFromChildDomNode(t){const i=this._getAttributeValue(t,b8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,y8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,k8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class S8{constructor(t,i,e,s,n,r){this.index=t,this.lineNumber=i,this.lineDomNode=e,this.lineNumberDomNode=s,this.foldingIcon=n,this.characterMapping=r}}class x8{constructor(t,i,e,s){this.isCollapsed=t,this.foldingStartLine=i,this.foldingEndLine=e,this.dimension=s,this.domNode=document.createElement("div"),this.domNode.style.width=`${s}px`,this.domNode.style.height=`${s}px`,this.domNode.className=go.asClassName(t?V4:j4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class D8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class E8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class A8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var M8,L8,F8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},T8=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t.OUTLINE_MODEL="outlineModel",t.FOLDING_PROVIDER_MODEL="foldingProviderModel",t.INDENTATION_MODEL="indentationModel"}(M8||(M8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(L8||(L8={}));let R8=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Yh(300)),this._updateOperation=this._register(new Ui);const n=new _8(e),r=new N8(this._editor,e),o=new P8(this._editor,i);switch(s){case M8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case M8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case M8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(t,i,e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger((async()=>{for(const s of this._modelProviders){const{statusPromise:n,modelPromise:r}=s.computeStickyModel(t,i,e);this._modelPromise=r;const o=await n;if(this._modelPromise!==r)return null;switch(o){case L8.CANCELED:return this._updateOperation.clear(),null;case L8.VALID:return s.stickyModel}}return null})).catch((t=>(Li(t),null)))}};R8=F8([T8(1,Nd),T8(2,op)],R8);class O8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,L8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=Zh((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?L8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),L8.VALID):this._invalid())).then(void 0,(t=>(Li(t),L8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let _8=class extends O8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return f5.create(this._languageFeaturesService.documentSymbolProvider,t,e)}createStickyModel(t,i,e,s){var n;const{stickyOutlineElement:r,providerID:o}=this._stickyModelFromOutlineModel(s,null===(n=this._stickyModel)||void 0===n?void 0:n.outlineProviderId);return new A8(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(It.first(t.children.values())instanceof d5){const s=It.find(t.children.values(),(t=>t.id===i));if(s)e=s.children;else{let s,n="",r=-1;for(const[i,e]of t.children.entries()){const t=this._findSumOfRangesOfGroup(e);t>r&&(s=e,r=t,n=e.id)}i=n,e=s.children}}else e=t.children;const s=[],n=Array.from(e.values()).sort(((t,i)=>{const e=new D8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new D8(i.symbol.range.startLineNumber,i.symbol.range.endLineNumber);return this._comparator(e,s)}));for(const t of n)s.push(this._stickyModelFromOutlineElement(t,t.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new E8(void 0,s,void 0),providerID:i}}_stickyModelFromOutlineElement(t,i){const e=[];for(const s of t.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==i)e.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const t of s.children.values())e.push(this._stickyModelFromOutlineElement(t,s.symbol.selectionRange.startLineNumber));e.sort(((t,i)=>this._comparator(t.range,i.range)));const s=new D8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new E8(s,e,void 0)}_comparator(t,i){return t.startLineNumber!==i.startLineNumber?t.startLineNumber-i.startLineNumber:i.endLineNumber-t.endLineNumber}_findSumOfRangesOfGroup(t){let i=0;for(const e of t.children.values())i+=this._findSumOfRangesOfGroup(e);return t instanceof u5?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};_8=F8([T8(0,op)],_8);class I8 extends O8{constructor(t){super(),this._foldingLimitReporter=new t5(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new A8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new E8(void 0,[],void 0);for(let n=0;n<i;n++){const i=t.getParentIndex(n);let r;r=-1!==i?e[i]:s;const o=new E8(new D8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let P8=class extends I8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new N4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};P8=F8([T8(1,Nd)],P8);let N8=class extends I8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return X4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=X4.getFoldingRangeProviders(this._languageFeaturesService,t);return new G4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};N8=F8([T8(1,op)],N8);var B8=function(t,i){return function(e,s){i(e,s,t)}};class $8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let W8=class extends Ki{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._register(new ne),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=this._register(new Ui),this._updateSoon=this._register(new rc((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&this.readConfiguration()}))),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new R8(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel((()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()}))),this._sessionStore.add(this._editor.onDidChangeHiddenAreas((()=>this.update()))),this._sessionStore.add(this._editor.onDidChangeModelContent((()=>this._updateSoon.schedule()))),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>this.update()))),this.update())}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}async update(){var t;null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new pe,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(t){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization())return void(this._model=null);const i=this._editor.getModel(),e=i.getVersionId(),s=await this._stickyModelProvider.update(i,e,t);t.isCancellationRequested||(this._model=s)}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,n,r){if(0===i.children.length)return;let o=r;const h=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&h.push(e.range.startLineNumber)}const c=this.updateIndex(s(h,t.startLineNumber,((t,i)=>t-i))),l=this.updateIndex(s(h,t.startLineNumber+n,((t,i)=>t-i)));for(let s=c;s<=l;s++){const h=i.children[s];if(!h)return;if(h.range){const i=h.range.startLineNumber,s=h.range.endLineNumber;t.startLineNumber<=s+1&&i-1<=t.endLineNumber&&i!==o&&(o=i,e.push(new $8(i,s-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n,r)}}getCandidateStickyLinesIntersecting(t){var i,e;if(!(null===(i=this._model)||void 0===i?void 0:i.element))return[];let s=[];this.getCandidateStickyLinesIntersectingFromStickyModel(t,this._model.element,s,0,-1);const n=null===(e=this._editor._getViewModel())||void 0===e?void 0:e.getHiddenAreas();if(n)for(const t of n)s=s.filter((i=>!(i.startLineNumber>=t.startLineNumber&&i.endLineNumber<=t.endLineNumber+1)));return s}};W8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([B8(1,op),B8(2,Nd)],W8);var j8,V8=function(t,i){return function(e,s){i(e,s,t)}};let H8=j8=class extends Ki{constructor(t,i,e,s,n,r,o){super(),this._editor=t,this._contextMenuService=i,this._languageFeaturesService=e,this._instaService=s,this._contextKeyService=o,this._sessionStore=new Ui,this._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new C8(this._editor),this._stickyLineCandidateProvider=new W8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new w8([],[],0),this._readConfiguration();const h=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(114)||t.hasChanged(72)||t.hasChanged(66)||t.hasChanged(109))&&this._readConfiguration()}))),this._register(Il(h,ya.CONTEXT_MENU,(async t=>{this._onContextMenu(Al(h),t)}))),this._stickyScrollFocusedContextKey=PS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=PS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Sa(h));this._register(c.onDidBlur((()=>{!1===this._positionRevealed&&0===h.clientHeight?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(c.onDidFocus((()=>{this.focus()}))),this._registerMouseListeners(),this._register(Il(h,ya.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(j8.ID)}_disposeFocusStickyScrollStore(){var t;this._stickyScrollFocusedContextKey.set(!1),null===(t=this._focusDisposableStore)||void 0===t||t.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown)return this._onMouseDown=!1,void this._editor.focus();!0!==this._stickyScrollFocusedContextKey.get()&&(this._focused=!0,this._focusDisposableStore=new Ui,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(t){this._focusedStickyElementIndex=t?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._reveaInEditor(t,(()=>this._editor.revealPosition(t)))}_revealLineInCenterIfOutsideViewport(t){this._reveaInEditor(t,(()=>this._editor.revealLineInCenterIfOutsideViewport(t.lineNumber,0)))}_reveaInEditor(t,i){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,i(),this._editor.setSelection(bs.fromPositions(t)),this._editor.focus()}_registerMouseListeners(){const t=this._register(new Ui),i=this._register(new AQ(this._editor,{extractLineNumberFromMouseEvent:t=>{const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);return i?i.lineNumber:0}})),e=t=>{if(!this._editor.hasModel())return null;if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return null;const i=t.target.element;if(!i||i.innerText!==i.innerHTML)return null;const e=this._stickyScrollWidget.getEditorPositionFromNode(i);return e?{range:new bs(e.lineNumber,e.column,e.lineNumber,e.column+i.innerText.length),textElement:i}:null},s=this._stickyScrollWidget.getDomNode();this._register(Nl(s,ya.CLICK,(t=>{if(t.ctrlKey||t.altKey||t.metaKey)return;if(!t.leftButton)return;if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i)return;const e=new vs(this._endLineNumbers[i],1);return void this._revealLineInCenterIfOutsideViewport(e)}if(this._stickyScrollWidget.isInFoldingIconDomNode(t.target)){const i=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);return void this._toggleFoldingRegionForLine(i)}if(!this._stickyScrollWidget.isInStickyLine(t.target))return;let i=this._stickyScrollWidget.getEditorPositionFromNode(t.target);if(!i){const e=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);if(null===e)return;i=new vs(e,1)}this._revealPosition(i)}))),this._register(Nl(s,ya.MOUSE_MOVE,(t=>{if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i||null!==this._showEndForLine&&this._showEndForLine===i)return;return this._showEndForLine=i,void this._renderStickyScroll()}null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(Il(s,ya.MOUSE_LEAVE,(()=>{null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(i.onMouseMoveOrRelevantKeyDown((([i,s])=>{const n=e(i);if(!n||!i.hasTriggerModifier||!this._editor.hasModel())return void t.clear();const{range:r,textElement:o}=n;if(r.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===o.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=r,t.clear();const h=new pe;let c;t.add(zi((()=>h.dispose(!0)))),MY(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new vs(r.startLineNumber,r.startColumn+1),h.token).then((i=>{if(!h.token.isCancellationRequested)if(0!==i.length){this._candidateDefinitionsLength=i.length;const e=o;c!==e?(t.clear(),c=e,c.style.textDecoration="underline",t.add(zi((()=>{c.style.textDecoration="none"})))):c||(c=e,c.style.textDecoration="underline",t.add(zi((()=>{c.style.textDecoration="none"}))))}else t.clear()}))}))),this._register(i.onCancel((()=>{t.clear()}))),this._register(i.onExecute((async t=>{if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return;const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);i&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:i.lineNumber,column:1})),this._instaService.invokeFunction(a9,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))}_onContextMenu(t,i){const e=new Uh(t,i);this._contextMenuService.showContextMenu({menuId:Sh.StickyScrollContext,getAnchor:()=>e})}_toggleFoldingRegionForLine(t){if(!this._foldingModel||null===t)return;const i=this._stickyScrollWidget.getStickyLineForLine(t),e=null==i?void 0:i.foldingIcon;if(!e)return;L4(this._foldingModel,Number.MAX_VALUE,[t]),e.isCollapsed=!e.isCollapsed;const s=this._editor.getTopForLineNumber(e.isCollapsed?e.foldingEndLine:e.foldingStartLine)-this._editor.getOption(66)*i.index+1;this._editor.setScrollTop(s),this._renderStickyScroll(t)}_readConfiguration(){const t=this._editor.getOption(114);if(!1===t.enabled)return this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),void(this._enabled=!1);t.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._sessionStore.add(this._editor.onDidLayoutChange((()=>this._onDidResize()))),this._sessionStore.add(this._editor.onDidChangeModelTokens((t=>this._onTokensChange(t)))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll((()=>{this._showEndForLine=null,this._renderStickyScroll()}))),this._enabled=!0),2===this._editor.getOption(67).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>{this._showEndForLine=null,this._renderStickyScroll(-1)})))}_needsUpdate(t){const i=this._stickyScrollWidget.getCurrentLines();for(const e of i)for(const i of t.ranges)if(e>=i.fromLineNumber&&e<=i.toLineNumber)return!0;return!1}_onTokensChange(t){this._needsUpdate(t)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(.25*t)}async _renderStickyScroll(t=1/0){var i,e;const s=this._editor.getModel();if(!s||s.isTooLargeForTokenization())return this._foldingModel=null,void this._stickyScrollWidget.setState(void 0,null,t);const n=this._stickyLineCandidateProvider.getVersionId();if(void 0===n||n===s.getVersionId())if(this._foldingModel=null!==(e=await(null===(i=X4.get(this._editor))||void 0===i?void 0:i.getFoldingModel()))&&void 0!==e?e:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.startLineNumbers.length)),this._focused)if(-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,-1!==this._focusedStickyElementIndex&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const i=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),0===this._stickyScrollWidget.lineNumberCount?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(i)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}else this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t)}findScrollWidgetState(){const t=this._editor.getOption(66),i=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=[],o=this._editor.getVisibleRanges();if(0!==o.length){const h=new D8(o[0].startLineNumber,o[o.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(h);for(const o of c){const h=o.startLineNumber,c=o.endLineNumber,l=o.nestingDepth;if(c-h>0){const o=(l-1)*t,a=l*t,u=this._editor.getBottomForLineNumber(h)-e,d=this._editor.getTopForLineNumber(c)-e,f=this._editor.getBottomForLineNumber(c)-e;if(o>d&&o<=f){n.push(h),r.push(c+1),s=f-a;break}if(a>u&&a<=f&&(n.push(h),r.push(c+1)),n.length===i)break}}}return this._endLineNumbers=r,new w8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};H8.ID="store.contrib.stickyScrollController",H8=j8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([V8(1,qO),V8(2,op),V8(3,io),V8(4,Nd),V8(5,YT),V8(6,th)],H8);const z8=100;iu(H8.ID,H8,1),Fh(class extends Lh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:Q(0,"Toggle Sticky Scroll"),mnemonicTitle:Q(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:m8.View,toggled:{condition:Oo.equals("config.editor.stickyScroll.enabled",!0),title:Q(0,"Sticky Scroll"),mnemonicTitle:Q(0,"&&Sticky Scroll")},menu:[{id:Sh.CommandPalette},{id:Sh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:Sh.StickyScrollContext}]})}async run(t){const i=t.get(rd),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}}),Fh(class extends Ja{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:Q(0,"Focus Sticky Scroll"),mnemonicTitle:Q(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Oo.and(Oo.has("config.editor.stickyScroll.enabled"),PS.stickyScrollVisible),menu:[{id:Sh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focus()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:Q(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:16}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focusPrevious()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:Q(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:18}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focusNext()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:Q(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:3}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.goToFocused()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectEditor",title:{value:Q(0,"Select Editor"),original:"Select Editor"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:9}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.selectEditor()}});var U8,K8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},q8=function(t,i){return function(e,s){i(e,s,t)}};class G8{constructor(t,i,e,s,n,r){this.range=t,this.insertText=i,this.filterText=e,this.additionalTextEdits=s,this.command=n,this.completion=r}}let Z8=class extends Gi{constructor(t,i,e,s,n,r){super(n.disposable),this.model=t,this.line=i,this.word=e,this.completionModel=s,this._suggestMemoryService=r}canBeReused(t,i,e){return this.model===t&&this.line===i&&this.word.word.length>0&&this.word.startColumn===e.startColumn&&this.word.endColumn<e.endColumn&&0===this.completionModel.getIncompleteProvider().size}get items(){var t;const i=[],{items:e}=this.completionModel,s=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},e),n=It.slice(e,s),r=It.slice(e,0,s);let o=5;for(const e of It.concat(n,r)){if(e.score===rI.Default)continue;const s=new bs(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new G8(s,e.completion.insertTextRules&&4&e.completion.insertTextRules?{snippet:e.completion.insertText}:e.completion.insertText,null!==(t=e.filterTextLow)&&void 0!==t?t:e.labelLow,e.completion.additionalTextEdits,e.completion.command,e)),o-- >=0&&e.resolve(fe.None)}return i}};Z8=K8([q8(5,W3)],Z8);let J8=class{constructor(t,i,e,s){this._getEditorOption=t,this._languageFeatureService=i,this._clipboardService=e,this._suggestMemoryService=s}async provideInlineCompletions(t,i,e,s){var n;if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(88,t);if(f3.isAllOff(r))return;t.tokenization.tokenizeIfCheap(i.lineNumber);const o=t.tokenization.getLineTokens(i.lineNumber),h=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if("inline"!==f3.valueFor(r,h))return;let c,l,a=t.getWordAtPosition(i);if((null==a?void 0:a.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==a?void 0:a.word)&&!c)return;if(a||(a=t.getWordUntilPosition(i)),a.endColumn!==i.column)return;const u=t.getValueInRange(new bs(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,a))){const t=new G3(u,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=await a3(this._languageFeatureService.completionProvider,t,i,new c3(void 0,void 0,null==c?void 0:c.providers),c&&{triggerKind:1,triggerCharacter:c.ch},s);let n;e.needsClipboard&&(n=await this._clipboardService.readText());const r=new Z3(e.items,i.column,new G3(u,0),q3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new Z8(t,i.lineNumber,a,r,e,this._suggestMemoryService)}return this._lastResult=l,l}handleItemDidShow(t,i){i.completion.resolve(fe.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(bs.fromPositions({lineNumber:i.lineNumber,column:i.column-1},i)),n=new Set;for(const i of this._languageFeatureService.completionProvider.all(t))(null===(e=i.triggerCharacters)||void 0===e?void 0:e.includes(s))&&n.add(i);if(0!==n.size)return{providers:n,ch:s}}};J8=K8([q8(1,op),q8(2,nH),q8(3,W3)],J8);let Q8=U8=class{constructor(t,i,e,s){if(1==++U8._counter){const n=s.createInstance(J8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));U8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--U8._counter&&(null===(t=U8._disposable)||void 0===t||t.dispose(),U8._disposable=void 0)}};Q8._counter=0,Q8=U8=K8([q8(1,op),q8(2,so),q8(3,io)],Q8),iu("suggest.inlineCompletionsProvider",Q8,0),Xa(class extends Ga{constructor(){super({id:"editor.action.forceRetokenize",label:Q(0,"Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getModel();e.tokenization.resetTokenization();const s=new Yi;e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class Y8 extends Lh{constructor(){super({id:Y8.ID,title:{value:Q(0,"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!Rm.getTabFocusMode();Rm.setTabFocusMode(t),Cm(Q(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}Y8.ID="editor.action.toggleTabFocusMode",Fh(Y8);let X8=class extends Ki{get enabled(){return this._enabled}set enabled(t){t?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=t}constructor(t,i,e={},s){var n;super(),this._link=i,this._enabled=!0,this.el=xa(t,Fa("a.monaco-link",{tabIndex:null!==(n=i.tabIndex)&&void 0!==n?n:0,href:i.href,title:i.title},i.label)),this.el.setAttribute("role","button");const r=this._register(new kk(this.el,"click")),o=this._register(new kk(this.el,"keypress")),h=Xi.chain(o.event,(t=>t.map((t=>new jh(t))).filter((t=>3===t.keyCode)))),c=this._register(new kk(this.el,Hm.Tap)).event;this._register(zm.addTarget(this.el));const l=Xi.any(r.event,h,c);this._register(l((t=>{this.enabled&&(ka(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};X8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,ZN)],X8);var ttt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},itt=function(t,i){return function(e,s){i(e,s,t)}};let ett=class extends Ki{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(stt))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(t){this.banner.show({...t,onClose:()=>{var i;this.hide(),null===(i=t.onClose)||void 0===i||i.call(t)}}),this._editor.setBanner(this.banner.element,26)}};ett=ttt([itt(1,io)],ett);let stt=class extends Ki{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(GZ,{}),this.element=Fa("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(t){return t.ariaLabel?t.ariaLabel:"string"==typeof t.message?t.message:void 0}getBannerMessage(t){if("string"==typeof t){const i=Fa("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Ol(this.element)}show(t){Ol(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=xa(this.element,Fa("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Fa(`div${go.asCSSSelector(t.icon)}`));const s=xa(this.element,Fa("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=xa(this.element,Fa("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(X8,this.messageActionsContainer,{...i,tabIndex:-1},{}));const n=xa(this.element,Fa("div.action-container"));this.actionBar=this._register(new IN(n)),this.actionBar.push(this._register(new oo("banner.close","Close Banner",go.asClassName(RV),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};stt=ttt([itt(0,io)],stt);var ntt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},rtt=function(t,i){return function(e,s){i(e,s,t)}};const ott=AV("extensions-warning-message",xs.warning,Q(0,"Icon shown with a warning message in the extensions editor."));let htt=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=e,this._highlighter=null,this._bannerClosed=!1,this._updateState=t=>{if(t&&t.hasMore){if(this._bannerClosed)return;const i=Math.max(t.ambiguousCharacterCount,t.nonBasicAsciiCharacterCount,t.invisibleCharacterCount);let e;if(t.nonBasicAsciiCharacterCount>=i)e={message:Q(0,"This document contains many non-basic ASCII unicode characters"),command:new btt};else if(t.ambiguousCharacterCount>=i)e={message:Q(0,"This document contains many ambiguous unicode characters"),command:new wtt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:Q(0,"This document contains many invisible unicode characters"),command:new vtt}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:ott,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(ett,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(124),this._register(e.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(124)&&(this._options=t.getOption(124),this._updateHighlighter())}))),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const t=function(t,i){return{nonBasicASCII:i.nonBasicASCII===pi?!t:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===pi?!t:i.includeComments,includeStrings:i.includeStrings===pi?!t:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([t.nonBasicASCII,t.ambiguousCharacters,t.invisibleCharacters].every((t=>!1===t)))return;const i={nonBasicASCII:t.nonBasicASCII,ambiguousCharacters:t.ambiguousCharacters,invisibleCharacters:t.invisibleCharacters,includeComments:t.includeComments,includeStrings:t.includeStrings,allowedCodePoints:Object.keys(t.allowedCharacters).map((t=>t.codePointAt(0))),allowedLocales:Object.keys(t.allowedLocales).map((t=>"_os"===t?(new Intl.NumberFormat).resolvedOptions().locale:"_vscode"===t?St:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new ctt(this._editor,i,this._updateState,this._editorWorkerService):new ltt(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};htt.ID="editor.contrib.unicodeHighlighter",htt=ntt([rtt(1,iB),rtt(2,UO),rtt(3,io)],htt);let ctt=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._options=i,this._updateState=e,this._editorWorkerService=s,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new rc((()=>this._update()),250)),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void this._decorations.clear();const t=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then((i=>{if(this._model.isDisposed())return;if(this._model.getVersionId()!==t)return;this._updateState(i);const e=[];if(!i.hasMore)for(const t of i.ranges)e.push({range:t,options:gtt.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return pF(i,t)?{reason:ftt(i.getValueInRange(t.range),this._options),inComment:mF(i,t),inString:wF(i,t)}:null}};ctt=ntt([rtt(3,iB)],ctt);class ltt extends Ki{constructor(t,i,e){super(),this._editor=t,this._options=i,this._updateState=e,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new rc((()=>this._update()),250)),this._register(this._editor.onDidLayoutChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidScrollChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeHiddenAreas((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void this._decorations.clear();const t=this._editor.getVisibleRanges(),i=[],e={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const i of t){const t=Nf.computeUnicodeHighlights(this._model,this._options,i);for(const i of t.ranges)e.ranges.push(i);e.ambiguousCharacterCount+=e.ambiguousCharacterCount,e.invisibleCharacterCount+=e.invisibleCharacterCount,e.nonBasicAsciiCharacterCount+=e.nonBasicAsciiCharacterCount,e.hasMore=e.hasMore||t.hasMore}if(!e.hasMore)for(const t of e.ranges)i.push({range:t,options:gtt.instance.getDecorationFromOptions(this._options)});this._updateState(e),this._decorations.set(i)}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel(),e=i.getValueInRange(t.range);return pF(i,t)?{reason:ftt(e,this._options),inComment:mF(i,t),inString:wF(i,t)}:null}}let att=class{constructor(t,i,e){this._editor=t,this._languageService=i,this._openerService=e,this.hoverOrdinal=5}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=this._editor.getContribution(htt.ID);if(!s)return[];const n=[],r=new Set;let o=300;for(const t of i){const i=s.getDecorationInfo(t);if(!i)continue;const h=e.getValueInRange(t.range).codePointAt(0),c=dtt(h);let l;switch(i.reason.kind){case 0:l=mr(i.reason.confusableWith)?Q(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,dtt(i.reason.confusableWith.codePointAt(0))):Q(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,dtt(i.reason.confusableWith.codePointAt(0)));break;case 1:l=Q(0,"The character {0} is invisible.",c);break;case 2:l=Q(0,"The character {0} is not a basic ASCII character.",c)}if(r.has(l))continue;r.add(l);const a={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},u=Q(0,"Adjust settings"),d=`command:${ytt.ID}?${encodeURIComponent(JSON.stringify(a))}`,f=new bI("",!0).appendMarkdown(l).appendText(" ").appendLink(d,u);n.push(new LX(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return TX(t,i,this._editor,this._languageService,this._openerService)}};function utt(t){return`U+${t.toString(16).padStart(4,"0")}`}function dtt(t){let i=`\`${utt(t)}\``;return Mr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function ftt(t,i){return Nf.computeUnicodeHighlightReason(t,i)}att=ntt([rtt(1,ud),rtt(2,ZN)],att);class gtt{constructor(){this.map=new Map}getDecorationFromOptions(t){return this.getDecoration(!t.includeComments,!t.includeStrings)}getDecoration(t,i){const e=`${t}${i}`;let s=this.map.get(e);return s||(s=aL.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:t,hideInStringTokens:i}),this.map.set(e,s)),s}}gtt.instance=new gtt;class ptt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=Q(0,"Disable Highlight In Comments")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(yi,!1,2)}}class mtt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=Q(0,"Disable Highlight In Strings")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(ki,!1,2)}}class wtt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Ambiguous Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(bi,!1,2)}}wtt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class vtt extends Ga{constructor(){super({id:vtt.ID,label:Q(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Invisible Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(wi,!1,2)}}vtt.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class btt extends Ga{constructor(){super({id:btt.ID,label:Q(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Non ASCII Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(vi,!1,2)}}btt.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class ytt extends Ga{constructor(){super({id:ytt.ID,label:Q(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(t,i,e){const{codePoint:s,reason:n,inString:r,inComment:o}=e,h=String.fromCodePoint(s),c=t.get(mj),l=t.get(rd),a=[];if(0===n.kind)for(const t of n.notAmbiguousInLocales)a.push({label:Q(0,'Allow unicode characters that are more common in the language "{0}".',t),run:async()=>{ktt(l,[t])}});if(a.push({label:function(t){return Mr.isInvisibleCharacter(t)?Q(0,"Exclude {0} (invisible character) from being highlighted",utt(t)):Q(0,"Exclude {0} from being highlighted",`${utt(t)} "${h}"`)}(s),run:()=>async function(t,i){const e=t.getValue(mi);let s;s="object"==typeof e&&e?e:{};for(const t of i)s[String.fromCodePoint(t)]=!0;await t.updateValue(mi,s,2)}(l,[s])}),o){const t=new ptt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(r){const t=new mtt;a.push({label:t.label,run:async()=>t.runAction(l)})}if(0===n.kind){const t=new wtt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(1===n.kind){const t=new vtt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(2===n.kind){const t=new btt;a.push({label:t.label,run:async()=>t.runAction(l)})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(n);const u=await c.pick(a,{title:Q(0,"Configure Unicode Highlight Options")});u&&await u.run()}}async function ktt(t,i){var e;const s=null===(e=t.inspect(Ci).user)||void 0===e?void 0:e.value;let n;n="object"==typeof s&&s?Object.assign({},s):{};for(const t of i)n[t]=!0;await t.updateValue(Ci,n,2)}ytt.ID="editor.action.unicodeHighlight.showExcludeOptions",Xa(wtt),Xa(vtt),Xa(btt),Xa(ytt),iu(htt.ID,htt,1),oX.register(att);var Ctt=function(t,i){return function(e,s){i(e,s,t)}};const Stt="ignoreUnusualLineTerminators";let xtt=class extends Ki{constructor(t,i,e){super(),this._editor=t,this._dialogService=i,this._codeEditorService=e,this._isPresentingDialog=!1,this._config=this._editor.getOption(125),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if("off"===this._config)return;if(!this._editor.hasModel())return;const t=this._editor.getModel();if(!t.mightContainUnusualLineTerminators())return;const i=function(t,i){return t.getModelProperty(i.uri,Stt)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(90))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let e;try{this._isPresentingDialog=!0,e=await this._dialogService.confirm({title:Q(0,"Unusual Line Terminators"),message:Q(0,"Detected unusual line terminators"),detail:Q(0,"The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",eA(t.uri)),primaryButton:Q(0,"&&Remove Unusual Line Terminators"),cancelButton:Q(0,"Ignore")})}finally{this._isPresentingDialog=!1}e.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,Stt,!0)}(this._codeEditorService,t)}};xtt.ID="editor.contrib.unusualLineTerminatorsDetector",xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Ctt(1,_T),Ctt(2,so)],xtt),iu(xtt.ID,xtt,1);var Dtt,Ett,Att=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},Mtt=function(t,i){return function(e,s){i(e,s,t)}};const Ltt=new Xo("hasWordHighlights",!1);function Ftt(t,i,e,s){return ec(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Fi))),u).then((t=>{if(t){const e=new Eg;return e.set(i.uri,t),e}return new Eg}))}class Ttt{constructor(t,i,e){this._model=t,this._selection=i,this._wordSeparators=e,this._wordRange=this._getCurrentWordRange(t,i),this._result=null}get result(){return this._result||(this._result=Zh((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new bs(i.startLineNumber,e.startColumn,i.startLineNumber,e.endColumn):null}isValid(t,i,e){const s=i.startLineNumber,n=i.startColumn,r=i.endColumn,o=this._getCurrentWordRange(t,i);let h=Boolean(this._wordRange&&this._wordRange.equalsRange(o));for(let t=0,i=e.length;!h&&t<i;t++){const i=e.getRange(t);i&&i.startLineNumber===s&&i.startColumn<=n&&i.endColumn>=r&&(h=!0)}return h}cancel(){this.result.cancel()}}class Rtt extends Ttt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return Ftt(this._providers,t,i.getPosition(),s).then((t=>t||new Eg))}}class Ott extends Ttt{constructor(t,i,e,s,n){super(t,i,e),this._providers=s,this._otherModels=n}_compute(t,i,e,s){return function(t,i,e,s,n,r){return ec(t.ordered(i).map((t=>()=>{const s=r.filter((i=>PR(t.selector,i.uri,i.getLanguageId(),!0,void 0,void 0)>0));return Promise.resolve(t.provideMultiDocumentHighlights(i,e,s,n)).then(void 0,Fi)})),(t=>t instanceof Eg&&t.size>0))}(this._providers,t,i.getPosition(),0,s,this._otherModels).then((t=>t||new Eg))}}class _tt extends Ttt{constructor(t,i,e,s,n){super(t,i,s),this._otherModels=n,this._selectionIsEmpty=i.isEmpty(),this._word=e}_compute(t,i,e,s){return tc(250,s).then((()=>{const s=new Eg;let n;if(n=this._word?this._word:t.getWordAtPosition(i.getPosition()),!n)return new Eg;const r=[t,...this._otherModels];for(const t of r){if(t.isDisposed())continue;const i=t.findMatches(n.word,!0,!1,!0,e,!1).map((t=>({range:t.range,kind:Rs.Text})));i&&s.set(t.uri,i)}return s}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}Qa("_executeDocumentHighlights",(async(t,i,e)=>{const s=t.get(op),n=await Ftt(s.documentHighlightProvider,i,e,fe.None);return null==n?void 0:n.get(i.uri)}));let Itt=Dtt=class{constructor(t,i,e,s,n){this.toUnhook=new Ui,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Eg,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=t,this.providers=i,this.multiDocumentProviders=e,this.codeEditorService=n,this._hasWordHighlights=Ltt.bindTo(s),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),this.model=this.editor.getModel(),this.toUnhook.add(t.onDidChangeCursorPosition((t=>{this._ignorePositionChangeEvent||"off"!==this.occurrencesHighlight&&this._onPositionChanged(t)}))),this.toUnhook.add(t.onDidChangeModelContent((()=>{this._stopAll()}))),this.toUnhook.add(t.onDidChangeModel((t=>{!t.newModelUrl&&t.oldModelUrl?this._stopSingular():Dtt.query&&this._run()}))),this.toUnhook.add(t.onDidChangeConfiguration((()=>{const t=this.editor.getOption(80);this.occurrencesHighlight!==t&&(this.occurrencesHighlight=t,this._stopAll())}))),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,Dtt.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){"off"!==this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(bs.compareRangesUsingStarts)}moveNext(){const t=this._getSortedHighlights(),i=t.findIndex((t=>t.containsPosition(this.editor.getPosition()))),e=(i+1)%t.length,s=t[e];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(s.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(s);const i=this._getWord();i&&Cm(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const t=this._getSortedHighlights(),i=t.findIndex((t=>t.containsPosition(this.editor.getPosition()))),e=(i-1+t.length)%t.length,s=t[e];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(s.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(s);const i=this._getWord();i&&Cm(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const t=Dtt.storedDecorations.get(this.editor.getModel().uri);t&&(this.editor.removeDecorations(t),Dtt.storedDecorations.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(){const t=this.codeEditorService.listCodeEditors();for(const i of t){if(!i.hasModel())continue;const t=Dtt.storedDecorations.get(i.getModel().uri);if(!t)continue;i.removeDecorations(t),Dtt.storedDecorations.delete(i.getModel().uri);const e=Ptt.get(i);(null==e?void 0:e.wordHighlighter)&&e.wordHighlighter.decorations.length>0&&(e.wordHighlighter.decorations.clear(),e.wordHighlighter._hasWordHighlights.set(!1))}}_stopSingular(){var t,i,e,s;this._removeSingleDecorations(),this.editor.hasWidgetFocus()&&((null===(t=this.editor.getModel())||void 0===t?void 0:t.uri.scheme)!==dl.vscodeNotebookCell&&(null===(e=null===(i=Dtt.query)||void 0===i?void 0:i.modelInfo)||void 0===e?void 0:e.model.uri.scheme)!==dl.vscodeNotebookCell?(Dtt.query=null,this._run()):(null===(s=Dtt.query)||void 0===s?void 0:s.modelInfo)&&(Dtt.query.modelInfo=null)),-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),null!==this.workerRequest&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(){this._removeAllDecorations(),-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),null!==this.workerRequest&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(t){var i;"off"===this.occurrencesHighlight||3!==t.reason&&(null===(i=this.editor.getModel())||void 0===i?void 0:i.uri.scheme)!==dl.vscodeNotebookCell?this._stopAll():this._run()}_getWord(){const t=this.editor.getSelection(),i=t.startLineNumber,e=t.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:i,column:e})}getOtherModelsToHighlight(t){if(!t)return[];if(t.uri.scheme===dl.vscodeNotebookCell){const i=[],e=this.codeEditorService.listCodeEditors();for(const s of e){const e=s.getModel();e&&e!==t&&e.uri.scheme===dl.vscodeNotebookCell&&i.push(e)}return i}const i=[],e=this.codeEditorService.listCodeEditors();for(const s of e){if(!aq(s))continue;const e=s.getModel();e&&t===e.modified&&i.push(e.modified)}if(i.length)return i;if("singleFile"===this.occurrencesHighlight)return[];for(const s of e){const e=s.getModel();e&&e!==t&&i.push(e)}return i}_run(){var t,i;let e;if(this.editor.hasWidgetFocus()){const t=this.editor.getSelection();if(!t||t.startLineNumber!==t.endLineNumber)return void this._stopAll();const i=t.startColumn,s=t.endColumn,n=this._getWord();if(!n||n.startColumn>i||n.endColumn<s)return Dtt.query=null,void this._stopAll();e=this.workerRequest&&this.workerRequest.isValid(this.model,t,this.decorations),Dtt.query={modelInfo:{model:this.model,selection:t},word:n}}else if(null===Dtt.query)return;if(this.lastCursorPositionChangeTime=(new Date).getTime(),e)this.workerRequestCompleted&&-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const e=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel()),n=!((Dtt.query.modelInfo||!Dtt.query.word)&&(null===(t=Dtt.query.modelInfo)||void 0===t?void 0:t.model.uri)===this.model.uri);this.workerRequest=Dtt.query.modelInfo&&Dtt.query.modelInfo.model.uri===this.model.uri?this.computeWithModel(Dtt.query.modelInfo.model,Dtt.query.modelInfo.selection,Dtt.query.word,s):this.computeWithModel(this.model,this.editor.getSelection(),n?Dtt.query.word:null,s),null===(i=this.workerRequest)||void 0===i||i.result.then((t=>{e===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=t||[],this._beginRenderDecorations())}),Li)}}computeWithModel(t,i,e,s){return s.length?function(t,i,e,s,n,r){return t.has(i)?new Ott(i,e,n,t,r):new _tt(i,e,s,n,r)}(this.multiDocumentProviders,t,i,e,this.editor.getOption(129),s):function(t,i,e,s,n){return t.has(i)?new Rtt(i,e,n,t):new _tt(i,e,s,n,[])}(this.providers,t,i,e,this.editor.getOption(129))}_beginRenderDecorations(){const t=(new Date).getTime(),i=this.lastCursorPositionChangeTime+250;t>=i?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout((()=>{this.renderDecorations()}),i-t)}renderDecorations(){var t,i,e;this.renderDecorationsTimer=-1;const s=this.codeEditorService.listCodeEditors();for(const r of s){const s=Ptt.get(r);if(!s)continue;const o=[],h=null===(t=r.getModel())||void 0===t?void 0:t.uri;if(h&&this.workerRequestValue.has(h)){const t=Dtt.storedDecorations.get(h),c=this.workerRequestValue.get(h);if(c)for(const t of c)o.push({range:t.range,options:(n=t.kind,n===Rs.Write?o7:n===Rs.Text?h7:a7)});let l=[];r.changeDecorations((i=>{l=i.deltaDecorations(null!=t?t:[],o)})),Dtt.storedDecorations=Dtt.storedDecorations.set(h,l),o.length>0&&(null===(i=s.wordHighlighter)||void 0===i||i.decorations.set(o),null===(e=s.wordHighlighter)||void 0===e||e._hasWordHighlights.set(!0))}}var n}dispose(){this._stopSingular(),this.toUnhook.dispose()}};Itt.storedDecorations=new Eg,Itt.query=null,Itt=Dtt=Att([Mtt(4,so)],Itt);let Ptt=Ett=class extends Ki{static get(t){return t.getContribution(Ett.ID)}constructor(t,i,e,s){super(),this._wordHighlighter=null;const n=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new Itt(t,e.documentHighlightProvider,e.multiDocumentHighlightProvider,i,s))};this._register(t.onDidChangeModel((()=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),n()}))),n()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!(!this._wordHighlighter||!this._wordHighlighter.hasDecorations())}moveNext(){var t;null===(t=this._wordHighlighter)||void 0===t||t.moveNext()}moveBack(){var t;null===(t=this._wordHighlighter)||void 0===t||t.moveBack()}restoreViewState(t){this._wordHighlighter&&t&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};Ptt.ID="editor.contrib.wordHighlighter",Ptt=Ett=Att([Mtt(1,th),Mtt(2,op),Mtt(3,so)],Ptt);class Ntt extends Ga{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=Ptt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}iu(Ptt.ID,Ptt,0),Xa(class extends Ntt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:Q(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:Ltt,kbOpts:{kbExpr:PS.editorTextFocus,primary:65,weight:100}})}}),Xa(class extends Ntt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:Q(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:Ltt,kbOpts:{kbExpr:PS.editorTextFocus,primary:1089,weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.wordHighlight.trigger",label:Q(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:Ltt.toNegated(),kbOpts:{kbExpr:PS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=Ptt.get(i);s&&s.restoreViewState(!0)}});class Btt extends qa{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=vf(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=new vs(t.positionLineNumber,t.positionColumn),e=this._move(s,n,i,this._wordNavigationType);return this._moveTo(t,e,this._inSelectionMode)}));if(n.pushStackElement(),i._getViewModel().setCursorStates("moveWordCommand",3,r.map((t=>XC.fromModelSelection(t)))),1===r.length){const t=new vs(r[0].positionLineNumber,r[0].positionColumn);i.revealPosition(t,0)}}_moveTo(t,i,e){return e?new ys(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new ys(i.lineNumber,i.column,i.lineNumber,i.column)}}class $tt extends Btt{_move(t,i,e,s){return gS.moveWordLeft(t,i,e,s)}}class Wtt extends Btt{_move(t,i,e,s){return gS.moveWordRight(t,i,e,s)}}class jtt extends qa{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(Nd);if(!i.hasModel())return;const n=vf(i.getOption(129)),r=i.getModel(),o=i.getSelections(),h=i.getOption(6),c=i.getOption(11),l=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),a=i._getViewModel(),u=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(9),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:l,autoClosedCharacters:a.getCursorAutoClosedCharacters()},this._wordNavigationType);return new oS(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,u),i.pushUndoStop()}}class Vtt extends jtt{_delete(t,i){return gS.deleteWordLeft(t,i)||new bs(1,1,1,1)}}class Htt extends jtt{_delete(t,i){const e=gS.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new bs(s,n,s,n)}}Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),Ya(new class extends $tt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:PS.writable})}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:PS.writable})}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:PS.writable})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:PS.writable})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"deleteInsideWord",precondition:PS.writable,label:Q(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=vf(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=gS.deleteInsideWord(s,n,t);return new oS(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class ztt extends Btt{_move(t,i,e,s){return pS.moveWordPartLeft(t,i,e)}}mo.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),mo.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Utt extends Btt{_move(t,i,e,s){return pS.moveWordPartRight(t,i,e)}}Ya(new class extends jtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return pS.deleteWordPartLeft(t)||new bs(1,1,1,1)}}),Ya(new class extends jtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=pS.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new bs(s,n,s,n)}}),Ya(new class extends ztt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),Ya(new class extends ztt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),Ya(new class extends Utt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),Ya(new class extends Utt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Ktt extends Ki{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=XZ.get(this.editor);if(t&&this.editor.hasModel()){let i=this.editor.getOptions().get(91);i||(i=new bI(Q(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"))),t.showMessage(i,this.editor.getPosition())}}}Ktt.ID="editor.contrib.readOnlyMessageController",iu(Ktt.ID,Ktt,2);class qtt extends Ki{constructor(t){super(),this.editor=t,this.widget=null,yt&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(90);!this.widget&&t?this.widget=new Gtt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}qtt.ID="editor.contrib.iPadShowKeyboard";class Gtt extends Ki{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Il(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Il(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Gtt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Gtt.ID="editor.contrib.ShowKeyboardWidget",iu(qtt.ID,qtt,3);var Ztt,Jtt=function(t,i){return function(e,s){i(e,s,t)}};let Qtt=Ztt=class extends Ki{static get(t){return t.getContribution(Ztt.ID)}constructor(t,i,e){super(),this._editor=t,this._languageService=e,this._widget=null,this._register(this._editor.onDidChangeModel((()=>this.stop()))),this._register(this._editor.onDidChangeModelLanguage((()=>this.stop()))),this._register(Ws.onDidChange((()=>this.stop()))),this._register(this._editor.onKeyUp((t=>9===t.keyCode&&this.stop())))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Ytt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Qtt.ID="editor.contrib.inspectTokens",Qtt=Ztt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Jtt(1,zV),Jtt(2,ud)],Qtt);class Ytt extends Ki{constructor(t,i){super(),this.allowEditorOverflow=!0,this._editor=t,this._languageService=i,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=function(t,i){const e=Ws.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>vp,tokenize:(t,e,s)=>bp(i,s),tokenizeEncoded:(t,i,e)=>yp(s,e)}}(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition((()=>this._compute(this._editor.getPosition())))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return Ytt._ID}_compute(t){const i=this._getTokensAtLine(t.lineNumber);let e=0;for(let s=i.tokens1.length-1;s>=0;s--)if(t.column-1>=i.tokens1[s].offset){e=s;break}let s=0;for(let e=i.tokens2.length>>>1;e>=0;e--)if(t.column-1>=i.tokens2[e<<1]){s=e;break}const n=this._model.getLineContent(t.lineNumber);let r="";e<i.tokens1.length&&(r=n.substring(i.tokens1[e].offset,e+1<i.tokens1.length?i.tokens1[e+1].offset:n.length)),Ea(this._domNode,Fa("h2.tm-token",void 0,function(t){let i="";for(let e=0,s=t.length;e<s;e++){const s=t.charCodeAt(e);switch(s){case 9:i+="→";break;case 32:i+="·";break;default:i+=String.fromCharCode(s)}}return i}(r),Fa("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),xa(this._domNode,Fa("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;xa(this._domNode,Fa("table.tm-metadata-table",void 0,Fa("tbody",void 0,Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"language"),Fa("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"token type"),Fa("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"font style"),Fa("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"foreground"),Fa("td.tm-metadata-value",void 0,`${o?Gg.Format.CSS.formatHex(o.foreground):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"background"),Fa("td.tm-metadata-value",void 0,`${o?Gg.Format.CSS.formatHex(o.background):"-?-"}`))))),xa(this._domNode,Fa("hr.tokens-inspect-separator")),e<i.tokens1.length&&xa(this._domNode,Fa("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ws.getColorMap(),e=kp.getLanguageId(t),s=kp.getTokenType(t),n=kp.getFontStyle(t),r=kp.getForeground(t),o=kp.getBackground(t);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(e),tokenType:s,fontStyle:n,foreground:i[r],background:i[o]}}_tokenTypeToString(t){switch(t){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(t){let i="";return 1&t&&(i+="italic "),2&t&&(i+="bold "),4&t&&(i+="underline "),8&t&&(i+="strikethrough "),0===i.length&&(i="---"),i}_getTokensAtLine(t){const i=this._getStateBeforeLine(t),e=this._tokenizationSupport.tokenize(this._model.getLineContent(t),!0,i),s=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(t),!0,i);return{startState:i,tokens1:e.tokens,tokens2:s.tokens,endState:e.endState}}_getStateBeforeLine(t){let i=this._tokenizationSupport.getInitialState();for(let e=1;e<t;e++)i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,i).endState;return i}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}}Ytt._ID="editor.contrib.inspectTokensWidget",iu(Qtt.ID,Qtt,4),Xa(class extends Ga{constructor(){super({id:"editor.action.inspectTokens",label:NO.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=Qtt.get(i);null==e||e.launch()}});var Xtt,tit=function(t,i){return function(e,s){i(e,s,t)}};let iit=Xtt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=mh.as(dj)}provide(t){const i=new Ui;return i.add(t.onDidAccept((()=>{const[i]=t.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),i.add(t.onDidChangeValue((t=>{const i=this.registry.getQuickAccessProvider(t.substr(Xtt.PREFIX.length));i&&i.prefix&&i.prefix!==Xtt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Xtt.PREFIX)),i}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort(((t,i)=>t.prefix.localeCompare(i.prefix))).flatMap((t=>this.createPicks(t)))}createPicks(t){return t.helpEntries.map((i=>{const e=i.prefix||t.prefix,s=e||"…";return{prefix:e,label:s,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:Q(0,"{0}, {1}",s,i.description),description:i.description}}))}};iit.PREFIX="?",iit=Xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tit(0,mj),tit(1,HC)],iit),mh.as(dj).registerQuickAccessProvider({ctor:iit,prefix:"",helpEntries:[{description:$O.helpQuickAccessActionLabel}]});class eit{constructor(t){this.options=t,this.rangeHighlightDecorationId=void 0}provide(t,i){var e;const s=new Ui;t.canAcceptInBackground=!!(null===(e=this.options)||void 0===e?void 0:e.canAcceptInBackground),t.matchOnLabel=t.matchOnDescription=t.matchOnDetail=t.sortByLabel=!1;const n=s.add(new qi);return n.value=this.doProvide(t,i),s.add(this.onDidActiveTextEditorControlChange((()=>{n.value=void 0,n.value=this.doProvide(t,i)}))),s}doProvide(t,i){var e;const s=new Ui,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const r={editor:n},o=uq(n);if(o){let t=null!==(e=n.saveViewState())&&void 0!==e?e:void 0;s.add(o.onDidChangeCursorPosition((()=>{var i;t=null!==(i=n.saveViewState())&&void 0!==i?i:void 0}))),r.restoreViewState=()=>{t&&n===this.activeTextEditorControl&&n.restoreViewState(t)},s.add(Wi(i.onCancellationRequested)((()=>{var t;return null===(t=r.restoreViewState)||void 0===t?void 0:t.call(r)})))}s.add(zi((()=>this.clearDecorations(n)))),s.add(this.provideWithTextEditor(r,t,i))}else s.add(this.provideWithoutTextEditor(t,i));return s}canProvideWithTextEditor(t){return!0}gotoLocation({editor:t},i){t.setSelection(i.range),t.revealRangeInCenter(i.range,0),i.preserveFocus||t.focus();const e=t.getModel();e&&"getLineContent"in e&&Sm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return aq(t)?null===(i=t.getModel())||void 0===i?void 0:i.modified:t.getModel()}addDecorations(t,i){t.changeDecorations((t=>{const e=[];this.rangeHighlightDecorationId&&(e.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),e.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:i,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:Bk(mC),position:bf.Full}}}],[n,r]=t.deltaDecorations(e,s);this.rangeHighlightDecorationId={rangeHighlightId:n,overviewRulerDecorationId:r}}))}clearDecorations(t){const i=this.rangeHighlightDecorationId;i&&(t.changeDecorations((t=>{t.deltaDecorations([i.overviewRulerDecorationId,i.rangeHighlightId],[])})),this.rangeHighlightDecorationId=void 0)}}class sit extends eit{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=Q(0,"Open a text editor first to go to a line.");return t.items=[{label:i}],t.ariaLabel=i,Ki.None}provideWithTextEditor(t,i,e){const s=t.editor,n=new Ui;n.add(i.onDidAccept((e=>{const[n]=i.selectedItems;if(n){if(!this.isValidLineNumber(s,n.lineNumber))return;this.gotoLocation(t,{range:this.toRange(n.lineNumber,n.column),keyMods:i.keyMods,preserveFocus:e.inBackground}),e.inBackground||i.hide()}})));const r=()=>{const t=this.parsePosition(s,i.value.trim().substr(sit.PREFIX.length)),e=this.getPickLabel(s,t.lineNumber,t.column);if(i.items=[{lineNumber:t.lineNumber,column:t.column,label:e}],i.ariaLabel=e,!this.isValidLineNumber(s,t.lineNumber))return void this.clearDecorations(s);const n=this.toRange(t.lineNumber,t.column);s.revealRangeInCenter(n,0),this.addDecorations(s,n)};r(),n.add(i.onDidChangeValue((()=>r())));const o=uq(s);return o&&2===o.getOptions().get(67).renderType&&(o.updateOptions({lineNumbers:"on"}),n.add(zi((()=>o.updateOptions({lineNumbers:"relative"}))))),n}toRange(t=1,i=1){return{startLineNumber:t,startColumn:i,endLineNumber:t,endColumn:i}}parsePosition(t,i){const e=i.split(/,|:|#/).map((t=>parseInt(t,10))).filter((t=>!isNaN(t))),s=this.lineCount(t)+1;return{lineNumber:e[0]>0?e[0]:s+e[0],column:e[1]}}getPickLabel(t,i,e){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,e)?Q(0,"Go to line {0} and character {1}.",i,e):Q(0,"Go to line {0}.",i);const s=t.getPosition()||{lineNumber:1,column:1},n=this.lineCount(t);return n>1?Q(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",s.lineNumber,s.column,n):Q(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",s.lineNumber,s.column)}isValidLineNumber(t,i){return!(!i||"number"!=typeof i)&&i>0&&i<=this.lineCount(t)}isValidColumn(t,i,e){if(!e||"number"!=typeof e)return!1;const s=this.getModel(t);if(!s)return!1;const n={lineNumber:i,column:e};return s.validatePosition(n).equals(n)}lineCount(t){var i,e;return null!==(e=null===(i=this.getModel(t))||void 0===i?void 0:i.getLineCount())&&void 0!==e?e:0}}sit.PREFIX=":";let nit=class extends sit{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Xi.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};nit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,so)],nit);class rit extends Ga{constructor(){super({id:rit.ID,label:BO.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(mj).quickAccess.show(nit.PREFIX)}}rit.ID="editor.action.gotoLine",Xa(rit),mh.as(dj).registerQuickAccessProvider({ctor:nit,prefix:nit.PREFIX,helpEntries:[{description:BO.gotoLineActionLabel,commandId:rit.ID}]});const oit=[void 0,[]];function hit(t,i,e=0,s=0){return i.values&&i.values.length>1?function(t,i,e,s){let n=0;const r=[];for(const o of i){const[i,h]=cit(t,o,e,s);if("number"!=typeof i)return oit;n+=i,r.push(...h)}return[n,lit(r)]}(t,i.values,e,s):cit(t,i,e,s)}function cit(t,i,e,s){const n=hI(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],q_(n)]:oit}function lit(t){const i=t.sort(((t,i)=>t.start-i.start)),e=[];let s;for(const t of i)!s||((n=s).end<(r=t).start||r.end<n.start)?(s=t,e.push(t)):(s.start=Math.min(s.start,t.start),s.end=Math.max(s.end,t.end));var n,r;return e}function ait(t){return t.startsWith('"')&&t.endsWith('"')}Object.freeze({score:0});const uit=" ";function dit(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=fit(t),r=e.indexOf(ts)>=0,o=ait(t);let h;const c=t.split(uit);if(c.length>1)for(const t of c){const i=ait(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=fit(t);s&&(h||(h=[]),h.push({original:t,originalLowercase:t.toLowerCase(),pathNormalized:e,normalized:s,normalizedLowercase:n,expectContiguousMatch:i}))}return{original:t,originalLowercase:i,pathNormalized:e,normalized:s,normalizedLowercase:n,values:h,containsPathSeparator:r,expectContiguousMatch:o}}function fit(t){let i;i=t.replace(gt?/\//g:/\\/g,ts);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function git(t){return Array.isArray(t)?dit(t.map((t=>t.original)).join(uit)):dit(t.original)}var pit,mit=function(t,i){return function(e,s){i(e,s,t)}};let wit=pit=class extends eit{constructor(t,i,e=Object.create(null)){super(e),this._languageFeaturesService=t,this._outlineModelService=i,this.options=e,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(t){return this.provideLabelPick(t,Q(0,"To go to a symbol, first open a text editor with symbol information.")),Ki.None}provideWithTextEditor(t,i,e){const s=this.getModel(t.editor);return s?this._languageFeaturesService.documentSymbolProvider.has(s)?this.doProvideWithEditorSymbols(t,s,i,e):this.doProvideWithoutEditorSymbols(t,s,i,e):Ki.None}doProvideWithoutEditorSymbols(t,i,e,s){const n=new Ui;return this.provideLabelPick(e,Q(0,"The active text editor does not provide symbol information.")),(async()=>{await this.waitForLanguageSymbolRegistry(i,n)&&!s.isCancellationRequested&&n.add(this.doProvideWithEditorSymbols(t,i,e,s))})(),n}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}async waitForLanguageSymbolRegistry(t,i){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new ac,s=i.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>{this._languageFeaturesService.documentSymbolProvider.has(t)&&(s.dispose(),e.complete(!0))})));return i.add(zi((()=>e.complete(!1)))),e.p}doProvideWithEditorSymbols(t,i,e,s){var n;const r=t.editor,o=new Ui;o.add(e.onDidAccept((i=>{const[s]=e.selectedItems;s&&s.range&&(this.gotoLocation(t,{range:s.range.selection,keyMods:e.keyMods,preserveFocus:i.inBackground}),i.inBackground||e.hide())}))),o.add(e.onDidTriggerItemButton((({item:i})=>{i&&i.range&&(this.gotoLocation(t,{range:i.range.selection,keyMods:e.keyMods,forceSideBySide:!0}),e.hide())})));const h=this.getDocumentSymbols(i,s);let c;const l=async t=>{null==c||c.dispose(!0),e.busy=!1,c=new pe(s),e.busy=!0;try{const i=dit(e.value.substr(pit.PREFIX.length).trim()),n=await this.doGetSymbolPicks(h,i,void 0,c.token);if(s.isCancellationRequested)return;if(n.length>0){if(e.items=n,t&&0===i.original.length){const i=zf(n,(i=>Boolean("separator"!==i.type&&i.range&&bs.containsPosition(i.range.decoration,t))));i&&(e.activeItems=[i])}}else this.provideLabelPick(e,Q(0,i.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{s.isCancellationRequested||(e.busy=!1)}};return o.add(e.onDidChangeValue((()=>l(void 0)))),l(null===(n=r.getSelection())||void 0===n?void 0:n.getPosition()),o.add(e.onDidChangeActive((()=>{const[t]=e.activeItems;t&&t.range&&(r.revealRangeInCenter(t.range.selection,0),this.addDecorations(r,t.range.decoration))}))),o}async doGetSymbolPicks(t,i,e,s){var n,r;const o=await t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(pit.SCOPE_PREFIX),c=h?1:0;let l,a,u;i.values&&i.values.length>1?(l=git(i.values[0]),a=git(i.values.slice(1))):l=i;const d=null===(r=null===(n=this.options)||void 0===n?void 0:n.openSideBySideDirection)||void 0===r?void 0:r.call(n);d&&(u=[{iconClass:go.asClassName("right"===d?xs.splitHorizontal:xs.splitVertical),tooltip:Q(0,"right"===d?"Open to the Side":"Open to the Bottom")}]);const f=[];for(let v=0;v<o.length;v++){const b=o[v],y=Wn(b.name),k=`$(${Is.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==e?void 0:e.extraContainerLabel)&&(A=A?`${e.extraContainerLabel} • ${A}`:e.extraContainerLabel),i.original.length>c){let L=!1;if(l!==i&&([S,x]=hit(k,{...i,values:void 0},c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=hit(k,l,c,C),"number"!=typeof S))continue;if(!L&&a){if(A&&a.original.length>0&&([D,E]=hit(A,a)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const M=b.tags&&b.tags.indexOf(1)>=0;f.push({index:v,kind:b.kind,score:S,label:k,ariaLabel:(g=b.name,p=b.kind,Q(0,"{0} ({1})",g,_s[p])),description:A,highlights:M?void 0:{label:x,description:E},range:{selection:bs.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:M,buttons:u})}var g,p;const m=f.sort(((t,i)=>h?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let w=[];if(h){let F,T,R=0;function O(){T&&"number"==typeof F&&R>0&&(T.label=Nn(bit[F]||vit,R))}for(const _ of m)F!==_.kind?(O(),F=_.kind,R=1,T={type:"separator"},w.push(T)):R++,w.push(_);O()}else m.length>0&&(w=[{label:Q(0,"symbols ({0})",f.length),type:"separator"},...m]);return w}compareByScore(t,i){if("number"!=typeof t.score&&"number"==typeof i.score)return 1;if("number"==typeof t.score&&"number"!=typeof i.score)return-1;if("number"==typeof t.score&&"number"==typeof i.score){if(t.score>i.score)return-1;if(t.score<i.score)return 1}return t.index<i.index?-1:t.index>i.index?1:0}compareByKindAndScore(t,i){const e=(bit[t.kind]||vit).localeCompare(bit[i.kind]||vit);return 0===e?this.compareByScore(t,i):e}async getDocumentSymbols(t,i){const e=await this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}};wit.PREFIX="@",wit.SCOPE_PREFIX=":",wit.PREFIX_BY_CATEGORY=`${pit.PREFIX}${pit.SCOPE_PREFIX}`,wit=pit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([mit(0,op),mit(1,g5)],wit);const vit=Q(0,"properties ({0})"),bit={5:Q(0,"methods ({0})"),11:Q(0,"functions ({0})"),8:Q(0,"constructors ({0})"),12:Q(0,"variables ({0})"),4:Q(0,"classes ({0})"),22:Q(0,"structs ({0})"),23:Q(0,"events ({0})"),24:Q(0,"operators ({0})"),10:Q(0,"interfaces ({0})"),2:Q(0,"namespaces ({0})"),3:Q(0,"packages ({0})"),25:Q(0,"type parameters ({0})"),1:Q(0,"modules ({0})"),6:Q(0,"properties ({0})"),9:Q(0,"enumerations ({0})"),21:Q(0,"enumeration members ({0})"),14:Q(0,"strings ({0})"),0:Q(0,"files ({0})"),17:Q(0,"arrays ({0})"),15:Q(0,"numbers ({0})"),16:Q(0,"booleans ({0})"),18:Q(0,"objects ({0})"),19:Q(0,"keys ({0})"),7:Q(0,"fields ({0})"),13:Q(0,"constants ({0})")};var yit=function(t,i){return function(e,s){i(e,s,t)}};let kit=class extends wit{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Xi.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};kit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([yit(0,so),yit(1,op),yit(2,g5)],kit);class Cit extends Ga{constructor(){super({id:Cit.ID,label:jO.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:PS.hasDocumentSymbolProvider,kbOpts:{kbExpr:PS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(mj).quickAccess.show(wit.PREFIX,{itemActivation:pj.NONE})}}function Sit(t,i){return i&&(t.stack||t.stacktrace)?Q(0,"{0}: {1}",Dit(t),xit(t.stack)||xit(t.stacktrace)):Dit(t)}function xit(t){return Array.isArray(t)?t.join("\n"):t}function Dit(t){return"ERR_UNC_HOST_NOT_ALLOWED"===t.code?`${t.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:"string"==typeof t.code&&"number"==typeof t.errno&&"string"==typeof t.syscall?Q(0,"A system error occurred ({0})",t.message):t.message||Q(0,"An unknown error occurred. Please consult the log for more details.")}function Eit(t=null,i=!1){if(!t)return Q(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const e=c(t),s=Eit(e[0],i);return e.length>1?Q(0,"{0} ({1} errors in total)",s,e.length):s}if(L(t))return t;if(t.detail){const e=t.detail;if(e.error)return Sit(e.error,i);if(e.exception)return Sit(e.exception,i)}return t.stack?Sit(t,i):t.message?t.message:Q(0,"An unknown error occurred. Please consult the log for more details.")}Cit.ID="editor.action.quickOutline",Xa(Cit),mh.as(dj).registerQuickAccessProvider({ctor:kit,prefix:wit.PREFIX,helpEntries:[{description:jO.quickOutlineActionLabel,prefix:wit.PREFIX,commandId:Cit.ID},{description:jO.quickOutlineByCategoryActionLabel,prefix:wit.PREFIX_BY_CATEGORY}]});class Ait{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(t,i){const e=this.computeEmbedding(t),s=new Map,n=[];for(const[t,r]of this.documents){if(i.isCancellationRequested)return[];for(const i of r.chunks){const r=this.computeSimilarityScore(i,e,s);r>0&&n.push({key:t,score:r})}}return n}static termFrequencies(t){return function(t){var i;const e=new Map;for(const s of t)e.set(s,(null!==(i=e.get(s))&&void 0!==i?i:0)+1);return e}(Ait.splitTerms(t))}static*splitTerms(t){const i=t=>t.toLowerCase();for(const[e]of t.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield i(e);const t=e.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(t.length>1)for(const e of t)e.length>2&&/\p{Letter}{3,}/gu.test(e)&&(yield i(e))}}updateDocuments(t){var i;for(const{key:i}of t)this.deleteDocument(i);for(const e of t){const t=[];for(const s of e.textChunks){const e=Ait.termFrequencies(s);for(const t of e.keys())this.chunkOccurrences.set(t,(null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0)+1);t.push({text:s,tf:e})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(t){const i=this.documents.get(t);if(i){this.documents.delete(t),this.chunkCount-=i.chunks.length;for(const t of i.chunks)for(const i of t.tf.keys()){const t=this.chunkOccurrences.get(i);if("number"==typeof t){const e=t-1;e<=0?this.chunkOccurrences.delete(i):this.chunkOccurrences.set(i,e)}}}}computeSimilarityScore(t,i,e){let s=0;for(const[n,r]of Object.entries(i)){const i=t.tf.get(n);if(!i)continue;let o=e.get(n);"number"!=typeof o&&(o=this.computeIdf(n),e.set(n,o)),s+=i*o*r}return s}computeEmbedding(t){const i=Ait.termFrequencies(t);return this.computeTfidf(i)}computeIdf(t){var i;const e=null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(t){const i=Object.create(null);for(const[e,s]of t){const t=this.computeIdf(e);t>0&&(i[e]=s*t)}return i}}var Mit;function Lit(t){return Array.isArray(t.items)}function Fit(t){return!!t.picks&&t.additionalPicks instanceof Promise}!function(t){t[t.NO_ACTION=0]="NO_ACTION",t[t.CLOSE_PICKER=1]="CLOSE_PICKER",t[t.REFRESH_PICKER=2]="REFRESH_PICKER",t[t.REMOVE_ITEM=3]="REMOVE_ITEM"}(Mit||(Mit={}));class Tit extends Ki{constructor(t,i){super(),this.prefix=t,this.options=i}provide(t,i,e){var s;const n=new Ui;let r;t.canAcceptInBackground=!!(null===(s=this.options)||void 0===s?void 0:s.canAcceptInBackground),t.matchOnLabel=t.matchOnDescription=t.matchOnDetail=t.sortByLabel=!1;const o=n.add(new qi),h=async()=>{const s=o.value=new Ui;null==r||r.dispose(!0),t.busy=!1,r=new pe(i);const n=r.token,h=t.value.substr(this.prefix.length).trim(),c=this._getPicks(h,s,n,e),l=(i,e)=>{var s;let n,r;if(Lit(i)?(n=i.items,r=i.active):n=i,0===n.length){if(e)return!1;(h.length>0||t.hideInput)&&(null===(s=this.options)||void 0===s?void 0:s.noResultsPick)&&(n=W(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},a=async i=>{let e=!1,s=!1;await Promise.all([(async()=>{"number"==typeof i.mergeDelay&&(await tc(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})(),(async()=>{t.busy=!0;try{const s=await i.additionalPicks;if(n.isCancellationRequested)return;let r,o,h,c;if(Lit(i.picks)?(r=i.picks.items,o=i.picks.active):r=i.picks,Lit(s)?(h=s.items,c=s.active):h=s,h.length>0||!e){let i;if(!o&&!c){const e=t.activeItems[0];e&&-1!==r.indexOf(e)&&(i=e)}l({items:[...r,...h],active:o||c||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})()])};if(null===c);else if(Fit(c))await a(c);else if(c instanceof Promise){t.busy=!0;try{const t=await c;if(n.isCancellationRequested)return;Fit(t)?await a(t):l(t)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)};return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((async({button:e,item:s})=>{var n,r;if("function"==typeof s.trigger){const o=null!==(r=null===(n=s.buttons)||void 0===n?void 0:n.indexOf(e))&&void 0!==r?r:-1;if(o>=0){const e=s.trigger(o,t.keyMods),n="number"==typeof e?e:await e;if(i.isCancellationRequested)return;switch(n){case Mit.NO_ACTION:break;case Mit.CLOSE_PICKER:t.hide();break;case Mit.REFRESH_PICKER:h();break;case Mit.REMOVE_ITEM:{const i=t.items.indexOf(s);if(-1!==i){const e=t.items.slice(),s=e.splice(i,1),n=t.activeItems.filter((t=>t!==s[0])),r=t.keepScrollPosition;t.keepScrollPosition=!0,t.items=e,n&&(t.activeItems=n),t.keepScrollPosition=r}break}}}}}))),n}}var Rit,Oit,_it=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},Iit=function(t,i){return function(e,s){i(e,s,t)}};let Pit=Rit=class extends Tit{constructor(t,i,e,s,n,r){super(Rit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Nit)),this.options=t}async _getPicks(t,i,e,s){var n,r,o,h;const c=await this.getCommandPicks(e);if(e.isCancellationRequested)return[];const l=Wi((()=>{const i=new Ait;return i.updateDocuments(c.map((t=>({key:t.commandId,textChunks:[this.getTfIdfChunk(t)]})))),function(t){var i,e;const s=t.slice(0);s.sort(((t,i)=>i.score-t.score));const n=null!==(e=null===(i=s[0])||void 0===i?void 0:i.score)&&void 0!==e?e:0;if(n>0)for(const t of s)t.score/=n;return s}(i.calculateScores(t,e)).filter((t=>t.score>Rit.TFIDF_THRESHOLD)).slice(0,Rit.TFIDF_MAX_RESULTS)})),a=[];for(const i of c){const s=null!==(n=Rit.WORD_FILTER(t,i.label))&&void 0!==n?n:void 0,o=i.commandAlias&&null!==(r=Rit.WORD_FILTER(t,i.commandAlias))&&void 0!==r?r:void 0;if(s||o)i.highlights={label:s,detail:this.options.showAlias?o:void 0},a.push(i);else if(t===i.commandId)a.push(i);else if(t.length>=3){const t=l();if(e.isCancellationRequested)return[];const s=t.find((t=>t.key===i.commandId));s&&(i.tfIdfScore=s.score,a.push(i))}}const u=new Map;for(const t of a){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}a.sort(((t,i)=>{if(t.tfIdfScore&&i.tfIdfScore)return t.tfIdfScore===i.tfIdfScore?t.label.localeCompare(i.label):i.tfIdfScore-t.tfIdfScore;if(t.tfIdfScore)return 1;if(i.tfIdfScore)return-1;const e=this.commandsHistory.peek(t.commandId),s=this.commandsHistory.peek(i.commandId);if(e&&s)return e>s?-1:1;if(e)return-1;if(s)return 1;if(this.options.suggestedCommandIds){const e=this.options.suggestedCommandIds.has(t.commandId),s=this.options.suggestedCommandIds.has(i.commandId);if(e&&s)return 0;if(e)return-1;if(s)return 1}return t.label.localeCompare(i.label)}));const d=[];let f=!1,g=!0,p=!!this.options.suggestedCommandIds;for(let t=0;t<a.length;t++){const i=a[t];0===t&&this.commandsHistory.peek(i.commandId)&&(d.push({type:"separator",label:Q(0,"recently used")}),f=!0),g&&void 0!==i.tfIdfScore&&(d.push({type:"separator",label:Q(0,"similar commands")}),g=!1),p&&void 0===i.tfIdfScore&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(d.push({type:"separator",label:Q(0,"commonly used")}),f=!0,p=!1),!f||void 0!==i.tfIdfScore||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(d.push({type:"separator",label:Q(0,"other commands")}),f=!1),d.push(this.toCommandPick(i,s))}return this.hasAdditionalCommandPicks(t,e)?{picks:d,additionalPicks:(async()=>{var i;const n=await this.getAdditionalCommandPicks(c,a,t,e);if(e.isCancellationRequested)return[];const r=n.map((t=>this.toCommandPick(t,s)));return g&&"separator"!==(null===(i=r[0])||void 0===i?void 0:i.type)&&r.unshift({type:"separator",label:Q(0,"similar commands")}),r})()}:d}toCommandPick(t,i){if("separator"===t.type)return t;const e=this.keybindingService.lookupKeybinding(t.commandId),s=e?Q(0,"{0}, {1}",t.label,e.getAriaLabel()):t.label;return{...t,ariaLabel:s,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:e,accept:async()=>{var e,s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(e=null==i?void 0:i.from)&&void 0!==e?e:"quick open"});try{(null===(s=t.args)||void 0===s?void 0:s.length)?await this.commandService.executeCommand(t.commandId,...t.args):await this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(Q(0,"Command '{0}' resulted in an error",t.label),Eit(i))}}}}getTfIdfChunk({label:t,commandAlias:i,commandDescription:e}){let s=t;return i&&i!==t&&(s+=` - ${i}`),e&&e.value!==t&&(s+=` - ${e.value===e.original?e.value:`${e.value} (${e.original})`}`),s}};Pit.PREFIX=">",Pit.TFIDF_THRESHOLD=.5,Pit.TFIDF_MAX_RESULTS=5,Pit.WORD_FILTER=b_(y_,(function(t,i,e=!1){if(!i||0===i.length)return null;let s=null,n=0;for(t=t.toLowerCase(),i=i.toLowerCase();n<i.length&&(s=$_(t,i,0,n,e),null===s);)n=W_(i,n+1);return s}),C_),Pit=Rit=_it([Iit(1,io),Iit(2,HC),Iit(3,po),Iit(4,Th),Iit(5,_T)],Pit);let Nit=Oit=class extends Ki{constructor(t,i){super(),this.storageService=t,this.configurationService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration((t=>this.updateConfiguration(t)))),this._register(this.storageService.onWillSaveState((t=>{t.reason===uN.SHUTDOWN&&this.saveState()})))}updateConfiguration(t){t&&!t.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Oit.getConfiguredCommandHistoryLength(this.configurationService),Oit.cache&&Oit.cache.limit!==this.configuredCommandsHistoryLength&&(Oit.cache.limit=this.configuredCommandsHistoryLength,Oit.hasChanges=!0))}load(){const t=this.storageService.get(Oit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=Oit.cache=new Mg(this.configuredCommandsHistoryLength,1);if(i){let t;t=i.usesLRU?i.entries:i.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>e.set(t.key,t.value)))}Oit.counter=this.storageService.getNumber(Oit.PREF_KEY_COUNTER,0,Oit.counter)}push(t){Oit.cache&&(Oit.cache.set(t,Oit.counter++),Oit.hasChanges=!0)}peek(t){var i;return null===(i=Oit.cache)||void 0===i?void 0:i.peek(t)}saveState(){if(!Oit.cache)return;if(!Oit.hasChanges)return;const t={usesLRU:!0,entries:[]};Oit.cache.forEach(((i,e)=>t.entries.push({key:e,value:i}))),this.storageService.store(Oit.PREF_KEY_CACHE,JSON.stringify(t),0,0),this.storageService.store(Oit.PREF_KEY_COUNTER,Oit.counter,0,0),Oit.hasChanges=!1}static getConfiguredCommandHistoryLength(t){var i,e;const s=null===(e=null===(i=t.getValue().workbench)||void 0===i?void 0:i.commandPalette)||void 0===e?void 0:e.history;return"number"==typeof s?s:Oit.DEFAULT_COMMANDS_HISTORY_LENGTH}};Nit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Nit.PREF_KEY_CACHE="commandPalette.mru.cache",Nit.PREF_KEY_COUNTER="commandPalette.mru.counter",Nit.counter=1,Nit.hasChanges=!1,Nit=Oit=_it([Iit(0,aN),Iit(1,rd)],Nit);class Bit extends Pit{constructor(t,i,e,s,n,r){super(t,i,e,s,n,r)}getCodeEditorCommandPicks(){const t=this.activeTextEditorControl;if(!t)return[];const i=[];for(const e of t.getSupportedActions())i.push({commandId:e.id,commandAlias:e.alias,label:pI(e.label)||e.id});return i}}var $it=function(t,i){return function(e,s){i(e,s,t)}};let Wit=class extends Bit{get activeTextEditorControl(){var t;return null!==(t=this.codeEditorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};Wit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$it(0,io),$it(1,so),$it(2,HC),$it(3,po),$it(4,Th),$it(5,_T)],Wit);class jit extends Ga{constructor(){super({id:jit.ID,label:WO.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(mj).quickAccess.show(Wit.PREFIX)}}jit.ID="editor.action.quickCommand",Xa(jit),mh.as(dj).registerQuickAccessProvider({ctor:Wit,prefix:Wit.PREFIX,helpEntries:[{description:WO.quickCommandHelp,commandId:jit.ID}]});var Vit=function(t,i){return function(e,s){i(e,s,t)}};let Hit=class extends bY{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Hit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Vit(1,th),Vit(2,so),Vit(3,VF),Vit(4,io),Vit(5,aN),Vit(6,rd)],Hit),iu(bY.ID,Hit,4),Xa(class extends Ga{constructor(){super({id:"editor.action.toggleHighContrast",label:HO.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(zV),s=e.getColorTheme();Ey(s.type)?(e.setTheme(this._originalThemeName||(Ay(s.type)?IV:_V)),this._originalThemeName=null):(e.setTheme(Ay(s.type)?PV:NV),this._originalThemeName=s.themeName)}});var zit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Uit(t,i,e){return t(e={path:i,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},e.exports),e.exports}var Kit=Uit((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,l,a,u,d,f,g,p,m,w,v,b,y,k,C,S,x,D,E,A,M,L;Object.defineProperty(i,"__esModule",{value:!0}),i.TextDocument=i.EOL=i.WorkspaceFolder=i.InlineCompletionContext=i.SelectedCompletionInfo=i.InlineCompletionTriggerKind=i.InlineCompletionList=i.InlineCompletionItem=i.StringValue=i.InlayHint=i.InlayHintLabelPart=i.InlayHintKind=i.InlineValueContext=i.InlineValueEvaluatableExpression=i.InlineValueVariableLookup=i.InlineValueText=i.SemanticTokens=i.SemanticTokenModifiers=i.SemanticTokenTypes=i.SelectionRange=i.DocumentLink=i.FormattingOptions=i.CodeLens=i.CodeAction=i.CodeActionContext=i.CodeActionTriggerKind=i.CodeActionKind=i.DocumentSymbol=i.WorkspaceSymbol=i.SymbolInformation=i.SymbolTag=i.SymbolKind=i.DocumentHighlight=i.DocumentHighlightKind=i.SignatureInformation=i.ParameterInformation=i.Hover=i.MarkedString=i.CompletionList=i.CompletionItem=i.CompletionItemLabelDetails=i.InsertTextMode=i.InsertReplaceEdit=i.CompletionItemTag=i.InsertTextFormat=i.CompletionItemKind=i.MarkupContent=i.MarkupKind=i.TextDocumentItem=i.OptionalVersionedTextDocumentIdentifier=i.VersionedTextDocumentIdentifier=i.TextDocumentIdentifier=i.WorkspaceChange=i.WorkspaceEdit=i.DeleteFile=i.RenameFile=i.CreateFile=i.TextDocumentEdit=i.AnnotatedTextEdit=i.ChangeAnnotationIdentifier=i.ChangeAnnotation=i.TextEdit=i.Command=i.Diagnostic=i.CodeDescription=i.DiagnosticTag=i.DiagnosticSeverity=i.DiagnosticRelatedInformation=i.FoldingRange=i.FoldingRangeKind=i.ColorPresentation=i.ColorInformation=i.Color=i.LocationLink=i.Location=i.Range=i.Position=i.uinteger=i.integer=i.URI=i.DocumentUri=void 0,function(t){t.is=function(t){return"string"==typeof t}}(e||(i.DocumentUri=e={})),function(t){t.is=function(t){return"string"==typeof t}}(s||(i.URI=s={})),function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(n||(i.integer=n={})),function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(r||(i.uinteger=r={})),function(t){t.create=function(t,i){return t===Number.MAX_VALUE&&(t=r.MAX_VALUE),i===Number.MAX_VALUE&&(i=r.MAX_VALUE),{line:t,character:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.uinteger(i.line)&&Ft.uinteger(i.character)}}(o||(i.Position=o={})),function(t){t.create=function(t,i,e,s){if(Ft.uinteger(t)&&Ft.uinteger(i)&&Ft.uinteger(e)&&Ft.uinteger(s))return{start:o.create(t,i),end:o.create(e,s)};if(o.is(t)&&o.is(i))return{start:t,end:i};throw new Error("Range#create called with invalid arguments[".concat(t,", ").concat(i,", ").concat(e,", ").concat(s,"]"))},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&o.is(i.start)&&o.is(i.end)}}(h||(i.Range=h={})),function(t){t.create=function(t,i){return{uri:t,range:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.range)&&(Ft.string(i.uri)||Ft.undefined(i.uri))}}(c||(i.Location=c={})),function(t){t.create=function(t,i,e,s){return{targetUri:t,targetRange:i,targetSelectionRange:e,originSelectionRange:s}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.targetRange)&&Ft.string(i.targetUri)&&h.is(i.targetSelectionRange)&&(h.is(i.originSelectionRange)||Ft.undefined(i.originSelectionRange))}}(l||(i.LocationLink=l={})),function(t){t.create=function(t,i,e,s){return{red:t,green:i,blue:e,alpha:s}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.numberRange(i.red,0,1)&&Ft.numberRange(i.green,0,1)&&Ft.numberRange(i.blue,0,1)&&Ft.numberRange(i.alpha,0,1)}}(a||(i.Color=a={})),function(t){t.create=function(t,i){return{range:t,color:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.range)&&a.is(i.color)}}(u||(i.ColorInformation=u={})),function(t){t.create=function(t,i,e){return{label:t,textEdit:i,additionalTextEdits:e}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.label)&&(Ft.undefined(i.textEdit)||k.is(i))&&(Ft.undefined(i.additionalTextEdits)||Ft.typedArray(i.additionalTextEdits,k.is))}}(d||(i.ColorPresentation=d={})),function(t){t.Comment="comment",t.Imports="imports",t.Region="region"}(f||(i.FoldingRangeKind=f={})),function(t){t.create=function(t,i,e,s,n,r){var o={startLine:t,endLine:i};return Ft.defined(e)&&(o.startCharacter=e),Ft.defined(s)&&(o.endCharacter=s),Ft.defined(n)&&(o.kind=n),Ft.defined(r)&&(o.collapsedText=r),o},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.uinteger(i.startLine)&&Ft.uinteger(i.startLine)&&(Ft.undefined(i.startCharacter)||Ft.uinteger(i.startCharacter))&&(Ft.undefined(i.endCharacter)||Ft.uinteger(i.endCharacter))&&(Ft.undefined(i.kind)||Ft.string(i.kind))}}(g||(i.FoldingRange=g={})),function(t){t.create=function(t,i){return{location:t,message:i}},t.is=function(t){var i=t;return Ft.defined(i)&&c.is(i.location)&&Ft.string(i.message)}}(p||(i.DiagnosticRelatedInformation=p={})),function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4}(m||(i.DiagnosticSeverity=m={})),function(t){t.Unnecessary=1,t.Deprecated=2}(w||(i.DiagnosticTag=w={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.href)}}(v||(i.CodeDescription=v={})),function(t){t.create=function(t,i,e,s,n,r){var o={range:t,message:i};return Ft.defined(e)&&(o.severity=e),Ft.defined(s)&&(o.code=s),Ft.defined(n)&&(o.source=n),Ft.defined(r)&&(o.relatedInformation=r),o},t.is=function(t){var i,e=t;return Ft.defined(e)&&h.is(e.range)&&Ft.string(e.message)&&(Ft.number(e.severity)||Ft.undefined(e.severity))&&(Ft.integer(e.code)||Ft.string(e.code)||Ft.undefined(e.code))&&(Ft.undefined(e.codeDescription)||Ft.string(null===(i=e.codeDescription)||void 0===i?void 0:i.href))&&(Ft.string(e.source)||Ft.undefined(e.source))&&(Ft.undefined(e.relatedInformation)||Ft.typedArray(e.relatedInformation,p.is))}}(b||(i.Diagnostic=b={})),function(t){t.create=function(t,i){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];var n={title:t,command:i};return Ft.defined(e)&&e.length>0&&(n.arguments=e),n},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.title)&&Ft.string(i.command)}}(y||(i.Command=y={})),function(t){t.replace=function(t,i){return{range:t,newText:i}},t.insert=function(t,i){return{range:{start:t,end:t},newText:i}},t.del=function(t){return{range:t,newText:""}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.newText)&&h.is(i.range)}}(k||(i.TextEdit=k={})),function(t){t.create=function(t,i,e){var s={label:t};return void 0!==i&&(s.needsConfirmation=i),void 0!==e&&(s.description=e),s},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.label)&&(Ft.boolean(i.needsConfirmation)||void 0===i.needsConfirmation)&&(Ft.string(i.description)||void 0===i.description)}}(C||(i.ChangeAnnotation=C={})),function(t){t.is=function(t){return Ft.string(t)}}(S||(i.ChangeAnnotationIdentifier=S={})),function(t){t.replace=function(t,i,e){return{range:t,newText:i,annotationId:e}},t.insert=function(t,i,e){return{range:{start:t,end:t},newText:i,annotationId:e}},t.del=function(t,i){return{range:t,newText:"",annotationId:i}},t.is=function(t){var i=t;return k.is(i)&&(C.is(i.annotationId)||S.is(i.annotationId))}}(x||(i.AnnotatedTextEdit=x={})),function(t){t.create=function(t,i){return{textDocument:t,edits:i}},t.is=function(t){var i=t;return Ft.defined(i)&&R.is(i.textDocument)&&Array.isArray(i.edits)}}(D||(i.TextDocumentEdit=D={})),function(t){t.create=function(t,i,e){var s={kind:"create",uri:t};return void 0===i||void 0===i.overwrite&&void 0===i.ignoreIfExists||(s.options=i),void 0!==e&&(s.annotationId=e),s},t.is=function(t){var i=t;return i&&"create"===i.kind&&Ft.string(i.uri)&&(void 0===i.options||(void 0===i.options.overwrite||Ft.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ft.boolean(i.options.ignoreIfExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(E||(i.CreateFile=E={})),function(t){t.create=function(t,i,e,s){var n={kind:"rename",oldUri:t,newUri:i};return void 0===e||void 0===e.overwrite&&void 0===e.ignoreIfExists||(n.options=e),void 0!==s&&(n.annotationId=s),n},t.is=function(t){var i=t;return i&&"rename"===i.kind&&Ft.string(i.oldUri)&&Ft.string(i.newUri)&&(void 0===i.options||(void 0===i.options.overwrite||Ft.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ft.boolean(i.options.ignoreIfExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(A||(i.RenameFile=A={})),function(t){t.create=function(t,i,e){var s={kind:"delete",uri:t};return void 0===i||void 0===i.recursive&&void 0===i.ignoreIfNotExists||(s.options=i),void 0!==e&&(s.annotationId=e),s},t.is=function(t){var i=t;return i&&"delete"===i.kind&&Ft.string(i.uri)&&(void 0===i.options||(void 0===i.options.recursive||Ft.boolean(i.options.recursive))&&(void 0===i.options.ignoreIfNotExists||Ft.boolean(i.options.ignoreIfNotExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(M||(i.DeleteFile=M={})),function(t){t.is=function(t){return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every((function(t){return Ft.string(t.kind)?E.is(t)||A.is(t)||M.is(t):D.is(t)})))}}(L||(i.WorkspaceEdit=L={}));var F,T,R,O,_,I,P,N,B,$,W,j,V,H,z,U,K,q,G,Z,J,Q,Y,X,tt,it,et,st,nt,rt,ot,ht,ct,lt,at,ut,dt,ft,gt,pt,mt,wt,vt,bt,yt,kt,Ct,St,xt,Dt,Et,At=function(){function t(t,i){this.edits=t,this.changeAnnotations=i}return t.prototype.insert=function(t,i,e){var s,n;if(void 0===e?s=k.insert(t,i):S.is(e)?(n=e,s=x.insert(t,i,e)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(e),s=x.insert(t,i,n)),this.edits.push(s),void 0!==n)return n},t.prototype.replace=function(t,i,e){var s,n;if(void 0===e?s=k.replace(t,i):S.is(e)?(n=e,s=x.replace(t,i,e)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(e),s=x.replace(t,i,n)),this.edits.push(s),void 0!==n)return n},t.prototype.delete=function(t,i){var e,s;if(void 0===i?e=k.del(t):S.is(i)?(s=i,e=x.del(t,i)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(i),e=x.del(t,s)),this.edits.push(e),void 0!==s)return s},t.prototype.add=function(t){this.edits.push(t)},t.prototype.all=function(){return this.edits},t.prototype.clear=function(){this.edits.splice(0,this.edits.length)},t.prototype.assertChangeAnnotations=function(t){if(void 0===t)throw new Error("Text edit change is not configured to manage change annotations.")},t}(),Mt=function(){function t(t){this._annotations=void 0===t?Object.create(null):t,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(t,i){var e;if(S.is(t)?e=t:(e=this.nextId(),i=t),void 0!==this._annotations[e])throw new Error("Id ".concat(e," is already in use."));if(void 0===i)throw new Error("No annotation provided for id ".concat(e));return this._annotations[e]=i,this._size++,e},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),Lt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Mt(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach((function(t){if(D.is(t)){var e=new At(t.edits,i._changeAnnotations);i._textEditChanges[t.textDocument.uri]=e}}))):t.changes&&Object.keys(t.changes).forEach((function(e){var s=new At(t.changes[e]);i._textEditChanges[e]=s}))):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(this._workspaceEdit.changeAnnotations=0===this._changeAnnotations.size?void 0:this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(t){if(R.is(t)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var i={uri:t.uri,version:t.version};return(e=this._textEditChanges[i.uri])||(this._workspaceEdit.documentChanges.push({textDocument:i,edits:s=[]}),e=new At(s,this._changeAnnotations),this._textEditChanges[i.uri]=e),e}if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var e,s;return(e=this._textEditChanges[t])||(this._workspaceEdit.changes[t]=s=[],e=new At(s),this._textEditChanges[t]=e),e},t.prototype.initDocumentChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new Mt,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=E.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=E.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t.prototype.renameFile=function(t,i,e,s){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n,r,o;if(C.is(e)||S.is(e)?n=e:s=e,void 0===n?r=A.create(t,i,s):(o=S.is(n)?n:this._changeAnnotations.manage(n),r=A.create(t,i,s,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},t.prototype.deleteFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=M.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=M.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Lt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)}}(F||(i.TextDocumentIdentifier=F={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&Ft.integer(i.version)}}(T||(i.VersionedTextDocumentIdentifier=T={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&(null===i.version||Ft.integer(i.version))}}(R||(i.OptionalVersionedTextDocumentIdentifier=R={})),function(t){t.create=function(t,i,e,s){return{uri:t,languageId:i,version:e,text:s}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&Ft.string(i.languageId)&&Ft.integer(i.version)&&Ft.string(i.text)}}(O||(i.TextDocumentItem=O={})),function(t){t.PlainText="plaintext",t.Markdown="markdown",t.is=function(i){return i===t.PlainText||i===t.Markdown}}(_||(i.MarkupKind=_={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(t)&&_.is(i.kind)&&Ft.string(i.value)}}(I||(i.MarkupContent=I={})),function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25}(P||(i.CompletionItemKind=P={})),function(t){t.PlainText=1,t.Snippet=2}(N||(i.InsertTextFormat=N={})),function(t){t.Deprecated=1}(B||(i.CompletionItemTag=B={})),function(t){t.create=function(t,i,e){return{newText:t,insert:i,replace:e}},t.is=function(t){var i=t;return i&&Ft.string(i.newText)&&h.is(i.insert)&&h.is(i.replace)}}($||(i.InsertReplaceEdit=$={})),function(t){t.asIs=1,t.adjustIndentation=2}(W||(i.InsertTextMode=W={})),function(t){t.is=function(t){var i=t;return i&&(Ft.string(i.detail)||void 0===i.detail)&&(Ft.string(i.description)||void 0===i.description)}}(j||(i.CompletionItemLabelDetails=j={})),function(t){t.create=function(t){return{label:t}}}(V||(i.CompletionItem=V={})),function(t){t.create=function(t,i){return{items:t||[],isIncomplete:!!i}}}(H||(i.CompletionList=H={})),function(t){t.fromPlainText=function(t){return t.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},t.is=function(t){var i=t;return Ft.string(i)||Ft.objectLiteral(i)&&Ft.string(i.language)&&Ft.string(i.value)}}(z||(i.MarkedString=z={})),function(t){t.is=function(t){var i=t;return!!i&&Ft.objectLiteral(i)&&(I.is(i.contents)||z.is(i.contents)||Ft.typedArray(i.contents,z.is))&&(void 0===t.range||h.is(t.range))}}(U||(i.Hover=U={})),function(t){t.create=function(t,i){return i?{label:t,documentation:i}:{label:t}}}(K||(i.ParameterInformation=K={})),function(t){t.create=function(t,i){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];var n={label:t};return Ft.defined(i)&&(n.documentation=i),n.parameters=Ft.defined(e)?e:[],n}}(q||(i.SignatureInformation=q={})),function(t){t.Text=1,t.Read=2,t.Write=3}(G||(i.DocumentHighlightKind=G={})),function(t){t.create=function(t,i){var e={range:t};return Ft.number(i)&&(e.kind=i),e}}(Z||(i.DocumentHighlight=Z={})),function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26}(J||(i.SymbolKind=J={})),function(t){t.Deprecated=1}(Q||(i.SymbolTag=Q={})),function(t){t.create=function(t,i,e,s,n){var r={name:t,kind:i,location:{uri:s,range:e}};return n&&(r.containerName=n),r}}(Y||(i.SymbolInformation=Y={})),function(t){t.create=function(t,i,e,s){return void 0!==s?{name:t,kind:i,location:{uri:e,range:s}}:{name:t,kind:i,location:{uri:e}}}}(X||(i.WorkspaceSymbol=X={})),function(t){t.create=function(t,i,e,s,n,r){var o={name:t,detail:i,kind:e,range:s,selectionRange:n};return void 0!==r&&(o.children=r),o},t.is=function(t){var i=t;return i&&Ft.string(i.name)&&Ft.number(i.kind)&&h.is(i.range)&&h.is(i.selectionRange)&&(void 0===i.detail||Ft.string(i.detail))&&(void 0===i.deprecated||Ft.boolean(i.deprecated))&&(void 0===i.children||Array.isArray(i.children))&&(void 0===i.tags||Array.isArray(i.tags))}}(tt||(i.DocumentSymbol=tt={})),function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"}(it||(i.CodeActionKind=it={})),function(t){t.Invoked=1,t.Automatic=2}(et||(i.CodeActionTriggerKind=et={})),function(t){t.create=function(t,i,e){var s={diagnostics:t};return null!=i&&(s.only=i),null!=e&&(s.triggerKind=e),s},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.typedArray(i.diagnostics,b.is)&&(void 0===i.only||Ft.typedArray(i.only,Ft.string))&&(void 0===i.triggerKind||i.triggerKind===et.Invoked||i.triggerKind===et.Automatic)}}(st||(i.CodeActionContext=st={})),function(t){t.create=function(t,i,e){var s={title:t},n=!0;return"string"==typeof i?(n=!1,s.kind=i):y.is(i)?s.command=i:s.edit=i,n&&void 0!==e&&(s.kind=e),s},t.is=function(t){var i=t;return i&&Ft.string(i.title)&&(void 0===i.diagnostics||Ft.typedArray(i.diagnostics,b.is))&&(void 0===i.kind||Ft.string(i.kind))&&(void 0!==i.edit||void 0!==i.command)&&(void 0===i.command||y.is(i.command))&&(void 0===i.isPreferred||Ft.boolean(i.isPreferred))&&(void 0===i.edit||L.is(i.edit))}}(nt||(i.CodeAction=nt={})),function(t){t.create=function(t,i){var e={range:t};return Ft.defined(i)&&(e.data=i),e},t.is=function(t){var i=t;return Ft.defined(i)&&h.is(i.range)&&(Ft.undefined(i.command)||y.is(i.command))}}(rt||(i.CodeLens=rt={})),function(t){t.create=function(t,i){return{tabSize:t,insertSpaces:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.uinteger(i.tabSize)&&Ft.boolean(i.insertSpaces)}}(ot||(i.FormattingOptions=ot={})),function(t){t.create=function(t,i,e){return{range:t,target:i,data:e}},t.is=function(t){var i=t;return Ft.defined(i)&&h.is(i.range)&&(Ft.undefined(i.target)||Ft.string(i.target))}}(ht||(i.DocumentLink=ht={})),function(t){t.create=function(t,i){return{range:t,parent:i}},t.is=function(i){var e=i;return Ft.objectLiteral(e)&&h.is(e.range)&&(void 0===e.parent||t.is(e.parent))}}(ct||(i.SelectionRange=ct={})),function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"}(lt||(i.SemanticTokenTypes=lt={})),function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"}(at||(i.SemanticTokenModifiers=at={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&(void 0===i.resultId||"string"==typeof i.resultId)&&Array.isArray(i.data)&&(0===i.data.length||"number"==typeof i.data[0])}}(ut||(i.SemanticTokens=ut={})),function(t){t.create=function(t,i){return{range:t,text:i}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&Ft.string(i.text)}}(dt||(i.InlineValueText=dt={})),function(t){t.create=function(t,i,e){return{range:t,variableName:i,caseSensitiveLookup:e}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&Ft.boolean(i.caseSensitiveLookup)&&(Ft.string(i.variableName)||void 0===i.variableName)}}(ft||(i.InlineValueVariableLookup=ft={})),function(t){t.create=function(t,i){return{range:t,expression:i}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&(Ft.string(i.expression)||void 0===i.expression)}}(gt||(i.InlineValueEvaluatableExpression=gt={})),function(t){t.create=function(t,i){return{frameId:t,stoppedLocation:i}},t.is=function(t){return Ft.defined(t)&&h.is(t.stoppedLocation)}}(pt||(i.InlineValueContext=pt={})),function(t){t.Type=1,t.Parameter=2,t.is=function(t){return 1===t||2===t}}(mt||(i.InlayHintKind=mt={})),function(t){t.create=function(t){return{value:t}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&(void 0===i.tooltip||Ft.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.location||c.is(i.location))&&(void 0===i.command||y.is(i.command))}}(wt||(i.InlayHintLabelPart=wt={})),function(t){t.create=function(t,i,e){var s={position:t,label:i};return void 0!==e&&(s.kind=e),s},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&o.is(i.position)&&(Ft.string(i.label)||Ft.typedArray(i.label,wt.is))&&(void 0===i.kind||mt.is(i.kind))&&void 0===i.textEdits||Ft.typedArray(i.textEdits,k.is)&&(void 0===i.tooltip||Ft.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.paddingLeft||Ft.boolean(i.paddingLeft))&&(void 0===i.paddingRight||Ft.boolean(i.paddingRight))}}(vt||(i.InlayHint=vt={})),function(t){t.createSnippet=function(t){return{kind:"snippet",value:t}}}(bt||(i.StringValue=bt={})),function(t){t.create=function(t,i,e,s){return{insertText:t,filterText:i,range:e,command:s}}}(yt||(i.InlineCompletionItem=yt={})),function(t){t.create=function(t){return{items:t}}}(kt||(i.InlineCompletionList=kt={})),function(t){t.Invoked=0,t.Automatic=1}(Ct||(i.InlineCompletionTriggerKind=Ct={})),function(t){t.create=function(t,i){return{range:t,text:i}}}(St||(i.SelectedCompletionInfo=St={})),function(t){t.create=function(t,i){return{triggerKind:t,selectedCompletionInfo:i}}}(xt||(i.InlineCompletionContext=xt={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&s.is(i.uri)&&Ft.string(i.name)}}(Dt||(i.WorkspaceFolder=Dt={})),i.EOL=["\n","\r\n","\r"],function(t){function i(t,e){if(t.length<=1)return t;var s=t.length/2|0,n=t.slice(0,s),r=t.slice(s);i(n,e),i(r,e);for(var o=0,h=0,c=0;o<n.length&&h<r.length;){var l=e(n[o],r[h]);t[c++]=l<=0?n[o++]:r[h++]}for(;o<n.length;)t[c++]=n[o++];for(;h<r.length;)t[c++]=r[h++];return t}t.create=function(t,i,e,s){return new Tt(t,i,e,s)},t.is=function(t){var i=t;return!!(Ft.defined(i)&&Ft.string(i.uri)&&(Ft.undefined(i.languageId)||Ft.string(i.languageId))&&Ft.uinteger(i.lineCount)&&Ft.func(i.getText)&&Ft.func(i.positionAt)&&Ft.func(i.offsetAt))},t.applyEdits=function(t,e){for(var s=t.getText(),n=i(e,(function(t,i){var e=t.range.start.line-i.range.start.line;return 0===e?t.range.start.character-i.range.start.character:e})),r=s.length,o=n.length-1;o>=0;o--){var h=n[o],c=t.offsetAt(h.range.start),l=t.offsetAt(h.range.end);if(!(l<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(l,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var Ft,Tt=function(){function t(t,i,e,s){this._uri=t,this._languageId=i,this._version=e,this._content=s,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(t){if(t){var i=this.offsetAt(t.start),e=this.offsetAt(t.end);return this._content.substring(i,e)}return this._content},t.prototype.update=function(t,i){this._content=t.text,this._version=i,this._lineOffsets=void 0},t.prototype.getLineOffsets=function(){if(void 0===this._lineOffsets){for(var t=[],i=this._content,e=!0,s=0;s<i.length;s++){e&&(t.push(s),e=!1);var n=i.charAt(s);e="\r"===n||"\n"===n,"\r"===n&&s+1<i.length&&"\n"===i.charAt(s+1)&&s++}e&&i.length>0&&t.push(i.length),this._lineOffsets=t}return this._lineOffsets},t.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var i=this.getLineOffsets(),e=0,s=i.length;if(0===s)return o.create(0,t);for(;e<s;){var n=Math.floor((e+s)/2);i[n]>t?s=n:e=n+1}var r=e-1;return o.create(r,t-i[r])},t.prototype.offsetAt=function(t){var i=this.getLineOffsets();if(t.line>=i.length)return this._content.length;if(t.line<0)return 0;var e=i[t.line];return Math.max(Math.min(e+t.character,t.line+1<i.length?i[t.line+1]:this._content.length),e)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t}();!function(t){var i=Object.prototype.toString;t.defined=function(t){return void 0!==t},t.undefined=function(t){return void 0===t},t.boolean=function(t){return!0===t||!1===t},t.string=function(t){return"[object String]"===i.call(t)},t.number=function(t){return"[object Number]"===i.call(t)},t.numberRange=function(t,e,s){return"[object Number]"===i.call(t)&&e<=t&&t<=s},t.integer=function(t){return"[object Number]"===i.call(t)&&-2147483648<=t&&t<=2147483647},t.uinteger=function(t){return"[object Number]"===i.call(t)&&0<=t&&t<=2147483647},t.func=function(t){return"[object Function]"===i.call(t)},t.objectLiteral=function(t){return null!==t&&"object"==typeof t},t.typedArray=function(t,i){return Array.isArray(t)&&t.every(i)}}(Ft||(Ft={}))}(0,i),void 0!==e&&(t.exports=e)}));const qit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Git(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Zit(){return qit?Git("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Jit(){return qit?Git("esri/request"):(await import("@arcgis/core/request.js")).default}async function Qit(t){return new(await async function(){return qit?Git("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function Yit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Xit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function tet(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")&&"fields"in t&&"function"==typeof t.queryFeatures}function iet(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function eet(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function set(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function net(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function ret(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function oet(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var het=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function cet(t,i){let e=t;for(;e;){if(e===i)return!0;if(!e.parentNode)return!1;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1}function aet(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)cet(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function uet(t,i){let e=t;for(;e;){let t=e.closest(i);if(t)return t;let s=e.getRootNode();if(s===document)return null;e=s.host}return null}function det(t){let i=uet(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function fet(t,i=""){if(!function(t){return t.nodeType===Node.ELEMENT_NODE}(t))return!1;if(t.matches(i))return setTimeout((()=>t?.setFocus()),0),!0;for(let e=0;e<t.children.length;e++)if(fet(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(fet(e.children[t],i))return!0;return!1}function get(t,i){if(!t?.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void fet(t,i);let e=new MutationObserver((()=>{e.disconnect(),fet(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function pet(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function met(){return[pet(2),pet(1),pet(1),pet(1),pet(3)].join("-")}var wet=new Set(["ar","bg","bs","ca","cs","da","de","el","en","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nl","nb","pl","pt-BR","pt-PT","ro","ru","sk","sl","sr","sv","th","tr","uk","vi","zh-CN","zh-HK","zh-TW"]),vet=new Map;async function bet(t,i,e=""){let s=`${i}/${e}${t}.json`;if(vet.has(s))return vet.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return vet.set(s,t),t}if("en"===t)return void vet.set(s,void 0);let r=await bet("en",i,e);return vet.set(s,r),r}catch{return void vet.set(s,void 0)}}var yet=new WeakMap,ket=new WeakMap,Cet=new WeakMap;async function xet(t,i,e){ket.set(t,i),yet.set(t,aet(t._hostElement,["lang"],(()=>{Eet(t,e)}))),await Eet(t,e)}function Det(t){yet.get(t)?.disconnect(),yet.delete(t),ket.delete(t)}async function Eet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return uet(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator.language||"en");if(wet.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:wet.has(e)?e:"en"}}(t._hostElement);if(e===t._lang&&s===t._t9nLocale||(e!==t._lang&&(t._lang=e),s===t._t9nLocale))return;let n=Cet.get(t);if(!n){let i=ket.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await bet(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function Aet(t,i){return new Array(i+1).join(t)}function Met(t){let i='"',e="'";t.includes(i)&&!t.includes(e)&&(e='"',i="'");let s=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${e})+)`,"gu");t=t.replace(s,((t,i,s,n)=>i+s+Aet(e,n.length/2)));let n=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${i}+)`,"gu");return t=t.replace(n,((t,e,s,n)=>e+s+Aet(`\\${i}`,n.length))),i+t+i}function Let(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu,"\\$&"):"^.*$";return new RegExp(i,"i")}function Fet(t,i={}){return(t??"").replace(/\{(.*?)\}/gu,((t,e)=>i[e]??t))}function Tet(t){return`${t??""}`}function Ret(t){return null!==t}function Oet(t){return void 0!==t}function _et(t,i,e=!1){if(!t||!i)return!1;let s=new URL(t),n=new URL(i);return!(!e&&s.protocol!==n.protocol||null==s.host||null==n.host)&&s.host.toLowerCase()===n.host.toLowerCase()&&s.port===n.port}function Iet(t){try{return new URL(t),!0}catch{return!1}}function Pet(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=Let(e);return t.filter((t=>{if(s){const i=s(t);if(null!==i||void 0!==i)return i}return n.some((i=>r.test(`${t[i]??""}`)))}))}function Net(t){switch(t.type){case"oid":case"global-id":case"guid":return"key";case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":return"number";case"string":return"string";case"date":return"date-time";case"date-only":return"calendar";case"time-only":return"clock";case"timestamp-offset":return"time-zone";default:return"cube"}}function Bet(t){return(t??[]).filter((t=>{switch(t.type){case"string":case"small-integer":case"integer":case"big-integer":case"single":case"double":case"long":case"date":case"date-only":case"time-only":case"timestamp-offset":case"oid":case"guid":case"global-id":return!0;default:return!1}}))}function $et(t,i){if(!t)return"";const e=i.split(".");let s=e.shift(),n=t;for(;n&&s;)n=n[s],s=e.shift();return"string"==typeof n?n:i}function Wet(t){return!!t?.typeIdField}function jet(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Wet(t)){if(i.name===t.typeIdField)return-1;if(e.name===t.typeIdField)return 1}return i.name.localeCompare(e.name,"en",{sensitivity:"base"})}}function Vet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new Qet({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new tst(t,e,s)}const Het=/^[a-z_$][a-z0-9_$]*$/giu;function zet(t,i=!0){return t.match(Het)?`${i?".":""}${t}`:`["${t}"]`}function Uet(t,i){return t?`${t}${zet(i)}`:i}async function Ket(t){if(!t)return null;let i=null;return i=Yit(t)||Xit(t)||net(t)?t:await Qit(t),i?(e=i,"function"==typeof e?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null);var e}function qet(t,i){return t.filter((t=>("Feature Layer"===t.type||"Table"===t.type)&&(t.capabilities?t.capabilities.toLowerCase().split(",").map((t=>t.trim())):[]).includes(i)))}async function Get(t,i=Kit.CompletionItemKind.Variable){if(!t)return[];const e=await Promise.all(t.map((async t=>{switch(t.type){case"dictionary":return await async function(t,i){const{name:e,dictionaryVariables:s}=t,n=t.getDescription(),r=s.reduce(((t,i)=>{""!==t&&(t+=" \n \n"),t+=`**${i.name}** \n${i.type}`;const e=i.getDescription();return e&&(t+=` \n${e}`),t}),n??"");return{name:e,description:n,type:"dictionary",properties:await Get(s,Kit.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:r}}}}(t,i);case"feature":return await async function(t,i){const e=await t.loadSource(),{name:s}=t,n=t.getDescription(),r={label:s,detail:s,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],l=[];return Bet(e.fields).forEach((t=>{let i=`**${t.name}** \n${t.type}`;t.description&&(i+=` \n'${t.description}`),h&&(h+=" \n \n"),h+=`**${t.name}** (${t.alias??t.name}) \n${t.type}`,t.description&&(h+=` \n'${t.description}`);const e=function(t){switch(t.type){case"small-integer":case"integer":case"big-integer":case"single":case"double":case"long":case"oid":return"number";case"global-id":case"guid":case"string":default:return"text";case"date":return"date";case"date-only":return"dateOnly";case"time-only":return"time"}}(t),s=zet(t.name,!1);if(c.push({name:t.name,description:t.alias||t.name,type:e,completion:{label:t.name,detail:t.alias||t.name,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:Kit.CompletionItemKind.Field,documentation:{kind:"markdown",value:i}}}),!t.alias||t.alias.toLowerCase()===t.name.toLowerCase())return;let n=`**${t.alias}** \n${t.type}`;t.description&&(n+=` \n'${t.description}`),l.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:Kit.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...l],r.documentation={kind:"markdown",value:h},o}(t,i);default:return function(t,i){const{name:e,type:s}=t,n=t.getDescription();return{name:e,description:n,type:s,completion:{label:e,detail:e,insertText:e,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class Zet{constructor(t,i,e){this._profile=t,this._label=i,this.description=e,this.filterDescription=!1}getLabel(){return null==this._label?"":"string"==typeof this._label?Tet(this._label):Fet(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:Fet(this._profile?.intlStrings[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Jet extends Zet{constructor(t){super(t.profile,t.label,t.description??t.declaration?.description),this.declaration=t.declaration??{},this.name=t.declaration?.name??"",this.snippet=t.snippet||"",this.nonInteractive=t.nonInteractive??!1,this.filterDescription=t.filterDescription??!1,this.icon=t.icon}}class Qet extends Jet{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t.declaration?.type??"text"}getDescription(){return null==this.description?$et(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class Yet extends Jet{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?$et(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Xet extends Jet{constructor(t){super(t),this.isCollection=!0,this._loaded=!0,this.variables=[]}get loaded(){return this._loaded}async loadSource(){}get informationUrl(){return null}get informationType(){return""}}class tst extends Zet{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class ist extends Xet{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new tst(this._profile,this.snippet,this.dictionaryVariables)])}loadPropertyDeclarations(t){this.dictionaryVariables=this.createVariableInstances(t),this.variables=this.dictionaryVariables}createVariableInstances(t){if(!Array.isArray(t))return[];const i=[];return t.forEach((t=>{const e=this.createVariableInstance(t);e&&i.push(e)})),i}createVariableInstance(t){const i=Uet(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new Qet({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new sst({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new nst({profile:this._profile,declaration:t,label:i,snippet:i},[new Qet({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new rst({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new ist({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new Yet({profile:this._profile,declaration:t,label:i,snippet:i});default:return console.error("Invalid profile variable",t),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}class est extends Xet{constructor(t,i){super(t),this.relationshipsProperties=i,this._source=null,this._loaded=!1,this._definition=t.declaration?.definition}get title(){return this._source?.title??""}get url(){return this._definition?.url??""}get informationUrl(){if(!this.loaded)return null;const t=this._source?.url;return t?`${t}/${this._source?.layerId??""}`:null}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return Ret(this._loadPromise)&&Oet(this._loadPromise)||(this._loadPromise=this._loadSource()),await this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Uet(this.snippet,t.name):t.name;return new Qet({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Net(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if(i=this._source,"function"!=typeof i?.getFieldDomain)return null;var i;const e="feature"===this.type?Uet(this.snippet,t.name):t.name,s=new ist({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:"form-dropdown"}),n=new tst(this._profile,t.alias??t.name,[new Qet({profile:this._profile,label:e,description:"",snippet:e})]);if(s.variables=[n],Wet(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Vet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new Qet({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new tst(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return s.variables.push(i),s}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;n.variables.push(new Qet({profile:this._profile,label:i,description:"",snippet:i}))}if(Wet(this._source)&&!this._source.types.every((i=>"inherited"===i.domains[t.name].type))){const i=function(t,i,e){const s=[];return i.forEach((i=>{let n=i.domains[e.name];if(!n)return;if("inherited"===n.type)return void(n=e.domain);const r=Vet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new ist({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new tst(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(s.variables.push(i),s):null}const r=Vet(this._profile,this._source.getFieldDomain(t.name),{code:"domainvalues"});return r?(s.variables.push(r),s):null}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;const t=this._source;if(i=t,!Array.isArray(i?.relationships)||"string"!=typeof i?.url)return null;var i;const e=new tst(this._profile,{code:"relationships"}),s=await Promise.all(t.relationships.map((async i=>{const e=await async function(t,i){if(!i)return null;const e=await Qit({url:`${t.url}/${i.relatedTableId}`});return await e.load(),e}(t,i);if(!tet(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new nst({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new Qet({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(Ret),e.variables.length?e:null}}class sst extends est{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return Yit(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await Ket(this._definition),!this._source)throw new Error("Invalid definition");const i=Yit(this._source)?this._source.title:"";this.variables.push(new tst(this._profile,i,[new Qet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const e=new tst(this._profile,{code:"values"});if(this.variables.push(e),t=this._source,"boolean"==typeof t?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,i=new Qet({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});e.variables.push(i)}this._source.fields.sort(jet(this._source)).forEach((t=>{e.variables.push(this._getFieldProperty(t))}));const s=await this._getRelationshipsProperty();s&&this.variables.push(s)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}var t;return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class nst extends est{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return Yit(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await Ket(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new tst(this._profile,this.title,this.featureSetSnippets));const t=new tst(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(jet(this._source)).map((t=>this._getFieldProperty(t)));const i=await this._getRelationshipsProperty();i&&this.variables.push(i)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class rst extends Xet{constructor(t){super(t),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=t.declaration?.definition}get informationUrl(){return this.loaded&&this._featureSetCollections&&"string"!=typeof this._featureSetCollections.source?(t=this._featureSetCollections.source.portalItem)?`${t.portal.url}/home/item.html?id=${t.id}`:"":null;var t}get informationType(){return this.loaded&&this._featureSetCollections?"string"!=typeof this._featureSetCollections.source?this._profile?.intlStrings.webmap??"webmap":this._profile?.intlStrings.featureservice??"featureservice":""}async loadSource(){return Ret(this._loadPromise)&&Oet(this._loadPromise)||(this._loadPromise=this._loadSource()),await this._loadPromise}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");const t="string"==typeof this._featureSetCollections.source?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:this._featureSetCollections.source.portalItem.title??"Untitled map"}},i=new tst(this._profile,t,[new Qet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new tst(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new tst(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(i,e,s)}catch(t){console.error("Loading issue",t,this),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?iet(this._definition)?await this._featureSetCollectionFromWebMap(this._definition):Yit(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):eet(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):ret(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=iet(t)?t:await async function(t){return new(await async function(){return qit?Git("esri/WebMap"):(await import("@arcgis/core/WebMap.js")).default}())(t)}({portalItem:t});return await i.loadAll(),await Promise.all(i.tables.map((async t=>await t.load()))),{layers:this._convertWebMapLayersToVariables(i.layers),tables:this._convertWebMapLayersToVariables(i.tables,!0),source:i}}async _featureSetCollectionFromPortalItem(t){const i=await async function(t){return new(await async function(){return qit?Git("esri/portal/PortalItem"):(await import("@arcgis/core/portal/PortalItem.js")).default}())(t)}(t);switch(await i.load(),i.type){case"Web Map":return await this._featureSetCollectionFromWebMap(i);case"Feature Service":return await this._featureSetCollectionFromUrl(i.url);default:return console.error("Unsupported portal item",t),null}}async _featureSetCollectionFromUrl(t){t=(t=(t=t.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer")).replace(/\/mapserver\/[0-9]*/iu,"/MapServer")).split("?")[0];const i=await async function(t){t+="/layers";const i=await Jit(),e=await i(t,{responseType:"json",query:{f:"json"}}),s={layers:e.data?.layers??[],tables:e.data?.tables??[]},n=t.endsWith("MapServer/layers")?"data":"query";return{layers:qet(s.layers,n),tables:qet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await Qit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await Qit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),[n,r]=await Promise.all([e,s]);return{layers:n,tables:r,source:t}}_convertWebMapLayersToVariables(t,i=!1){const e=[];return t.toArray().reverse().forEach((t=>{var s;if(tet(t))e.push(this._createFeatureSetVariable(t,!0));else if((s=t)&&"object"==typeof s&&"string"==typeof s.declaredClass&&"esri.layers.GroupLayer"===s.declaredClass){const s=i?this._convertWebMapLayersToVariables(t.allTables,!0):this._convertWebMapLayersToVariables(t.allLayers);e.push(...s)}})),e}_createFeatureSetVariable(t,i=!1){return new nst({profile:this._profile,declaration:{definition:t},label:t.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(t,i))}_makeFeatureSetSnippets(t,i=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(i){const i=`FeatureSetById(${this.snippet}, "${t.id}")`,e=`FeatureSetByName(${this.snippet}, "${t.title}")`;return[new Qet({profile:this._profile,label:i,description:"",snippet:i}),new Qet({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new Qet({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class ost extends ist{constructor(t,i,e="en"){super({profile:null,declaration:{properties:[]}}),this.definition=t,this.intlStrings=i,this.locale=e,this.variables=[],this._profile=this,this.loadPropertyDeclarations(t?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}async toLSProfile(){const{apiVersion:t,bundles:i,hiddenApiItems:e}=this.definition??{};return{apiVersion:t,bundles:i,variables:await Get(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function hst(t){return tet(t)||Xit(t)||ret(t)||net(t)||set(t)}async function cst(i="en"){const e=lst.get(i);if(e)return e;if(!wet.has(i))return await cst("en");try{const e=await fetch(t(`./assets/arcade-language/profiles/arcade-profiles.t9n.${i}.json`));return e.ok?function(t,i){const e=new Map;return i.forEach((t=>{e.set(t.id,t)})),lst.set(t,e),e}(i,await e.json()):"en"===i?null:await cst("en")}catch{return null}}const lst=new Map;function ast(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(ast):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function ust(t,i="en"){if(!oet(t))return;const e=await async function(t,i="en"){const e=await cst(i);return e?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};var n;return e.variables.forEach((i=>{if(t.disabledVariables?.includes(i.name))return;const e=t.definitions[i.name];switch(i.type){case"dictionary":return s.variables.push(ast({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return Yit(n=e)||Xit(n)||ret(n)||net(n)||set(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return hst(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return eet(t)||iet(t)||hst(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(ast(i))}var n})),n=t,Array.isArray(n?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const dst={locale:"en"},fst=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new xq,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new xq,this._onDidModelContextChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onModelContextDidChange(){return this._onModelContextDidChange.event}get languageId(){return this._languageId}get languageOptions(){return this._languageOptions}_fireModelContextDidChange(t){-1===this._onDidModelContextChangeTimeout&&(this._onDidModelContextChangeTimeout=window.setTimeout((()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(t)}),0))}_getApiKey(t){return Oq.isUri(t)||(t=Oq.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){oet(e)&&(e=await ust(e,s.locale));const n=await bet(s.locale,t("./assets/arcade-language/t9n"),"profile.t9n.");if(!n)throw new Error(`Failed to load the language bundle for ${s.locale}`);this.disposeEditorProfileForModel(i);const r=this._getApiKey(i),o=new ost(e,n);this._profileMap.set(r,o);const h=await o.toLSProfile();this.updateApiContextForModel(i,{locale:s.locale,profile:h,snippets:s.snippets})}disposeEditorProfileForModel(t){const i=this._getApiKey(t);this._profileMap.delete(i)}disposeApiContextForModel(t){const i=this._getApiKey(t);this._apiContextMap.delete(i)&&this._fireModelContextDidChange(i)}getEditorProfileForModel(t){return this._profileMap.get(this._getApiKey(t))}getApiContextForModel(t){return this._apiContextMap.get(this._getApiKey(t))??dst}updateApiContextForModel(t,i){const e=this._getApiKey(t),s=this._apiContextMap.get(e)??{};this._apiContextMap.set(e,{...s,...i}),this._fireModelContextDidChange(e)}setLanguageOptions(t={}){this._languageOptions.assetsPath!==t.assetsPath&&(this._languageOptions={...this._languageOptions,...t},this._onDidChange.fire(this))}},gst={setProfileForModel:fst.setProfileForModel.bind(fst)};export{det as $,Det as B,Fet as D,xq as E,met as F,Tet as G,zV as I,Dq as K,Tq as M,Let as Q,Mq as R,YH as S,aet as T,Oq as U,xet as W,gst as a,zit as b,Uit as c,fst as d,Iq as e,Pet as f,bV as g,Zit as h,Jit as i,get as j,het as k,Pq as l,Eq as m,Iet as n,Bq as o,KG as p,Met as q,Kit as r,Bet as s,_et as t}
|
|
63
|
+
var OG=Object.defineProperty,_G=Object.getOwnPropertyDescriptor,IG=Object.getOwnPropertyNames,PG=Object.prototype.hasOwnProperty,NG=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of IG(i))PG.call(t,n)||n===e||OG(t,n,{get:()=>i[n],enumerable:!(s=_G(i,n))||s.enumerable});return t},BG={};((t,i)=>{NG(BG,i,"default")})(0,Bq);var $G=(t=>(t[t.None=0]="None",t[t.CommonJS=1]="CommonJS",t[t.AMD=2]="AMD",t[t.UMD=3]="UMD",t[t.System=4]="System",t[t.ES2015=5]="ES2015",t[t.ESNext=99]="ESNext",t))($G||{}),WG=(t=>(t[t.None=0]="None",t[t.Preserve=1]="Preserve",t[t.React=2]="React",t[t.ReactNative=3]="ReactNative",t[t.ReactJSX=4]="ReactJSX",t[t.ReactJSXDev=5]="ReactJSXDev",t))(WG||{}),jG=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(jG||{}),VG=(t=>(t[t.ES3=0]="ES3",t[t.ES5=1]="ES5",t[t.ES2015=2]="ES2015",t[t.ES2016=3]="ES2016",t[t.ES2017=4]="ES2017",t[t.ES2018=5]="ES2018",t[t.ES2019=6]="ES2019",t[t.ES2020=7]="ES2020",t[t.ESNext=99]="ESNext",t[t.JSON=100]="JSON",t[t.Latest=99]="Latest",t))(VG||{}),HG=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(HG||{}),zG=class{_onDidChange=new BG.Emitter;_onDidExtraLibsChange=new BG.Emitter;_extraLibs;_removedExtraLibs;_eagerModelSync;_compilerOptions;_diagnosticsOptions;_workerOptions;_onDidExtraLibsChangeTimeout;_inlayHintsOptions;_modeConfiguration;constructor(t,i,e,s,n){this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(t),this.setDiagnosticsOptions(i),this.setWorkerOptions(e),this.setInlayHintsOptions(s),this.setModeConfiguration(n),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(t,i){let e;if(e=void 0===i?`ts:extralib-${Math.random().toString(36).substring(2,15)}`:i,this._extraLibs[e]&&this._extraLibs[e].content===t)return{dispose:()=>{}};let s=1;return this._removedExtraLibs[e]&&(s=this._removedExtraLibs[e]+1),this._extraLibs[e]&&(s=this._extraLibs[e].version+1),this._extraLibs[e]={content:t,version:s},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let t=this._extraLibs[e];t&&t.version===s&&(delete this._extraLibs[e],this._removedExtraLibs[e]=s,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(t){for(const t in this._extraLibs)this._removedExtraLibs[t]=this._extraLibs[t].version;if(this._extraLibs=Object.create(null),t&&t.length>0)for(const i of t){const t=i.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`;let e=1;this._removedExtraLibs[t]&&(e=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i.content,version:e}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){-1===this._onDidExtraLibsChangeTimeout&&(this._onDidExtraLibsChangeTimeout=window.setTimeout((()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)}),0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(t){this._compilerOptions=t||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(t){this._diagnosticsOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(t){this._workerOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(t){this._inlayHintsOptions=t||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(t){}setEagerModelSync(t){this._eagerModelSync=t}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(t){this._modeConfiguration=t||Object.create(null),this._onDidChange.fire(void 0)}},UG={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},KG=new zG({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},UG),qG=new zG({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},UG);function GG(){return import("./p-ec3e9c42.js")}BG.languages.typescript={ModuleKind:$G,JsxEmit:WG,NewLineKind:jG,ScriptTarget:VG,ModuleResolutionKind:HG,typescriptVersion:"5.0.2",typescriptDefaults:KG,javascriptDefaults:qG,getTypeScriptWorker:()=>GG().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>GG().then((t=>t.getJavaScriptWorker()))},BG.languages.onLanguage("typescript",(()=>GG().then((t=>t.setupTypeScript(KG))))),BG.languages.onLanguage("javascript",(()=>GG().then((t=>t.setupJavaScript(qG))))),Fh(class extends Lh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:Q(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:xs.map,toggled:Oo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Oo.has("isInDiffEditor"),menu:{when:Oo.has("isInDiffEditor"),id:Sh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class ZG extends Lh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:Q(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Oo.has("isInDiffEditor")})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Fh(ZG);class JG extends Lh{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:Q(0,"Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:Oo.has("isInDiffEditor")})}run(t,...i){const e=t.get(rd),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Fh(JG),Eh.appendMenuItem(Sh.EditorTitle,{command:{id:(new JG).desc.id,title:Q(0,"Use Inline View When Space Is Limited"),toggled:Oo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Oo.has("isInDiffEditor")},order:11,group:"1_diff",when:Oo.and(PS.diffEditorRenderSideBySideInlineBreakpointReached,Oo.has("isInDiffEditor"))}),Eh.appendMenuItem(Sh.EditorTitle,{command:{id:(new ZG).desc.id,title:Q(0,"Show Moved Code Blocks"),icon:xs.move,toggled:Bo.create("config.diffEditor.experimental.showMoves",!0),precondition:Oo.has("isInDiffEditor")},order:10,group:"1_diff",when:Oo.has("isInDiffEditor")});const QG={value:Q(0,"Diff Editor"),original:"Diff Editor"};Fh(class extends Ja{constructor(){super({id:"diffEditor.switchSide",title:{value:Q(0,"Switch Side"),original:"Switch Side"},icon:xs.arrowSwap,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,e){const s=iZ(t);if(s instanceof vK){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:Q(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:xs.close,precondition:PS.comparingMovedCode,f1:!1,category:QG,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.exitCompareMove()}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:Q(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:xs.fold,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.collapseAllUnchangedRegions()}}),Fh(class extends Ja{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:Q(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:xs.unfold,precondition:Oo.has("isInDiffEditor"),f1:!0,category:QG})}runEditorCommand(t,i,...e){const s=iZ(t);s instanceof vK&&s.showAllUnchangedRegions()}});const YG={value:Q(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class XG extends Lh{constructor(){super({id:XG.id,title:{value:Q(0,"Go to Next Difference"),original:"Go to Next Difference"},category:YG,precondition:Oo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=iZ(t);null==i||i.accessibleDiffViewerNext()}}XG.id="editor.action.accessibleDiffViewer.next",Eh.appendMenuItem(Sh.EditorTitle,{command:{id:XG.id,title:Q(0,"Open Accessible Diff Viewer"),precondition:Oo.has("isInDiffEditor")},order:10,group:"2_diff",when:Oo.and(PS.accessibleDiffViewerVisible.negate(),Oo.has("isInDiffEditor"))});class tZ extends Lh{constructor(){super({id:tZ.id,title:{value:Q(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:YG,precondition:Oo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=iZ(t);null==i||i.accessibleDiffViewerPrev()}}function iZ(t){var i;const e=t.get(so),s=e.listDiffEditors(),n=null!==(i=e.getFocusedCodeEditor())&&void 0!==i?i:e.getActiveCodeEditor();if(!n)return null;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i.getModifiedEditor().getId()===n.getId()||i.getOriginalEditor().getId()===n.getId())return i}const r=ra();if(r)for(const t of s)if(eZ(t.getContainerDomNode(),r))return t;return null}function eZ(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}tZ.id="editor.action.accessibleDiffViewer.prev",mo.registerCommandAlias("editor.action.diffReview.next",XG.id),Fh(XG),mo.registerCommandAlias("editor.action.diffReview.prev",tZ.id),Fh(tZ);var sZ;const nZ=new Xo("selectionAnchorSet",!1);let rZ=sZ=class{static get(t){return t.getContribution(sZ.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=nZ.bindTo(i),this.modelChangeListener=t.onDidChangeModel((()=>this.selectionAnchorSetContextKey.reset()))}setSelectionAnchor(){if(this.editor.hasModel()){const t=this.editor.getPosition();this.editor.changeDecorations((i=>{this.decorationId&&i.removeDecoration(this.decorationId),this.decorationId=i.addDecoration(ys.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new bI).appendText(Q(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),Cm(Q(0,"Anchor set at {0}:{1}",t.lineNumber,t.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const t=this.editor.getModel().getDecorationRange(this.decorationId);t&&this.editor.setPosition(t.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const t=this.editor.getModel().getDecorationRange(this.decorationId);if(t){const i=this.editor.getPosition();this.editor.setSelection(ys.fromPositions(t.getStartPosition(),i)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const t=this.decorationId;this.editor.changeDecorations((i=>{i.removeDecoration(t),this.decorationId=void 0})),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};rZ.ID="editor.contrib.selectionAnchorController",rZ=sZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],rZ),iu(rZ.ID,rZ,4),Xa(class extends Ga{constructor(){super({id:"editor.action.setSelectionAnchor",label:Q(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2080),weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.setSelectionAnchor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToSelectionAnchor",label:Q(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:nZ})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.goToSelectionAnchor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:Q(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:nZ,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2089),weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.selectFromAnchorToCursor()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:Q(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:nZ,kbOpts:{kbExpr:PS.editorTextFocus,primary:9,weight:100}})}async run(t,i){var e;null===(e=rZ.get(i))||void 0===e||e.cancelSelectionAnchor()}});const oZ=Jm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},Q(0,"Overview ruler marker color for matching brackets."));class hZ{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class cZ extends Ki{static get(t){return t.getContribution(cZ.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new rc((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(t.onDidChangeCursorPosition((()=>{"never"!==this._matchBrackets&&this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelContent((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModel((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelLanguageConfiguration((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())}))),this._register(t.onDidBlurEditorWidget((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidFocusEditorWidget((()=>{this._updateBracketsSoon.schedule()})))}jumpToBracket(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._editor.getSelections().map((i=>{const e=i.getStartPosition(),s=t.bracketPairs.matchBracket(e);let n=null;if(s)s[0].containsPosition(e)&&!s[1].containsPosition(e)?n=s[1].getStartPosition():s[1].containsPosition(e)&&(n=s[0].getStartPosition());else{const i=t.bracketPairs.findEnclosingBrackets(e);if(i)n=i[1].getStartPosition();else{const i=t.bracketPairs.findNextBracket(e);i&&i.range&&(n=i.range.getStartPosition())}}return n?new ys(n.lineNumber,n.column,n.lineNumber,n.column):new ys(e.lineNumber,e.column,e.lineNumber,e.column)}));this._editor.setSelections(i),this._editor.revealRange(i[0])}selectToBracket(t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),e=[];this._editor.getSelections().forEach((s=>{const n=s.getStartPosition();let r=i.bracketPairs.matchBracket(n);if(!r&&(r=i.bracketPairs.findEnclosingBrackets(n),!r)){const t=i.bracketPairs.findNextBracket(n);t&&t.range&&(r=i.bracketPairs.matchBracket(t.range.getStartPosition()))}let o=null,h=null;if(r){r.sort(bs.compareRangesUsingStarts);const[i,e]=r;if(o=t?i.getStartPosition():i.getEndPosition(),h=t?e.getEndPosition():e.getStartPosition(),e.containsPosition(n)){const t=o;o=h,h=t}}o&&h&&e.push(new ys(o.lineNumber,o.column,h.lineNumber,h.column))})),e.length>0&&(this._editor.setSelections(e),this._editor.revealRange(e[0]))}removeBrackets(t){if(!this._editor.hasModel())return;const i=this._editor.getModel();this._editor.getSelections().forEach((e=>{const s=e.getPosition();let n=i.bracketPairs.matchBracket(s);n||(n=i.bracketPairs.findEnclosingBrackets(s)),n&&(this._editor.pushUndoStop(),this._editor.executeEdits(t,[{range:n[0],text:""},{range:n[1],text:""}]),this._editor.pushUndoStop())}))}_updateBrackets(){if("never"===this._matchBrackets)return;this._recomputeBrackets();const t=[];let i=0;for(const e of this._lastBracketsData){const s=e.brackets;s&&(t[i++]={range:s[0],options:e.options},t[i++]={range:s[1],options:e.options})}this._decorations.set(t)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return this._lastBracketsData=[],void(this._lastVersionId=0);const t=this._editor.getSelections();if(t.length>100)return this._lastBracketsData=[],void(this._lastVersionId=0);const i=this._editor.getModel(),e=i.getVersionId();let s=[];this._lastVersionId===e&&(s=this._lastBracketsData);const n=[];let r=0;for(let i=0,e=t.length;i<e;i++){const e=t[i];e.isEmpty()&&(n[r++]=e.getStartPosition())}n.length>1&&n.sort(vs.compare);const o=[];let h=0,c=0;const l=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<l&&s[c].position.isBefore(e);)c++;if(c<l&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=cZ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=cZ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new hZ(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}cZ.ID="editor.contrib.bracketMatchingController",cZ._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=aL.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Bk(oZ),position:bf.Center}}),cZ._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=aL.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),iu(cZ.ID,cZ,1),Xa(class extends Ga{constructor(){super({id:"editor.action.selectToBracket",label:Q(0,"Select to Bracket"),alias:"Select to Bracket",precondition:void 0,metadata:{description:Y(0,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(t,i,e){var s;let n=!0;e&&!1===e.selectBrackets&&(n=!1),null===(s=cZ.get(i))||void 0===s||s.selectToBracket(n)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.jumpToBracket",label:Q(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=cZ.get(i))||void 0===e||e.jumpToBracket()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.removeBrackets",label:Q(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=cZ.get(i))||void 0===e||e.removeBrackets(this.id)}}),Eh.appendMenuItem(Sh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:Q(0,"Go to &&Bracket")},order:2});class lZ{constructor(t,i){this._selection=t,this._isMovingLeft=i}getEditOperations(t,i){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const e=this._selection.startLineNumber,s=this._selection.startColumn,n=this._selection.endColumn;if((!this._isMovingLeft||1!==s)&&(this._isMovingLeft||n!==t.getLineMaxColumn(e)))if(this._isMovingLeft){const r=new bs(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new bs(e,n,e,n),o)}else{const r=new bs(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new bs(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new ys(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ys(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class aZ extends Ga{constructor(t,i){super(i),this.left=t}run(t,i){if(!i.hasModel())return;const e=[],s=i.getSelections();for(const t of s)e.push(new lZ(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}Xa(class extends aZ{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:Q(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:PS.writable})}}),Xa(class extends aZ{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:Q(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:PS.writable})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.transposeLetters",label:Q(0,"Transpose Letters"),alias:"Transpose Letters",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(t,i){if(!i.hasModel())return;const e=i.getModel(),s=[],n=i.getSelections();for(const t of n){if(!t.isEmpty())continue;const i=t.startLineNumber,n=t.startColumn,r=e.getLineMaxColumn(i);if(1===i&&(1===n||2===n&&2===r))continue;const o=n===r?t.getPosition():dS.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=dS.leftPosition(e,o),c=dS.leftPosition(e,h),l=e.getValueInRange(bs.fromPositions(c,h)),a=e.getValueInRange(bs.fromPositions(h,o)),u=bs.fromPositions(c,o);s.push(new oS(u,a+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const uZ="9_cutcopypaste",dZ=wt||document.queryCommandSupported("cut"),fZ=wt||document.queryCommandSupported("copy"),gZ=void 0!==navigator.clipboard&&!Ir||document.queryCommandSupported("paste");function pZ(t){return t.register(),t}const mZ=dZ?pZ(new Ua({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:wt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"Cu&&t"),order:1},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Cut"),when:PS.writable,order:1},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Cut"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Cut"),when:PS.writable,order:1}]})):void 0,wZ=fZ?pZ(new Ua({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:wt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"&&Copy"),order:2},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Copy"),order:2},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Copy"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Copy"),order:2}]})):void 0;Eh.appendMenuItem(Sh.MenubarEditMenu,{submenu:Sh.MenubarCopy,title:{value:Q(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextCopy,title:{value:Q(0,"Copy As"),original:"Copy As"},group:uZ,order:3}),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Oo.and(Oo.notEquals("resourceScheme","output"),PS.editorTextFocus)}),Eh.appendMenuItem(Sh.EditorTitleContext,{submenu:Sh.EditorTitleContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1}),Eh.appendMenuItem(Sh.ExplorerContext,{submenu:Sh.ExplorerContextShare,title:{value:Q(0,"Share"),original:"Share"},group:"11_share",order:-1});const vZ=gZ?pZ(new Ua({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:wt?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:Sh.MenubarEditMenu,group:"2_ccp",title:Q(0,"&&Paste"),order:4},{menuId:Sh.EditorContext,group:uZ,title:Q(0,"Paste"),when:PS.writable,order:4},{menuId:Sh.CommandPalette,group:"",title:Q(0,"Paste"),order:1},{menuId:Sh.SimpleEditorContext,group:uZ,title:Q(0,"Paste"),when:PS.writable,order:4}]})):void 0;function bZ(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(so).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(37),s=e.getSelection();return s&&s.isEmpty()&&!t||e.getContainerDomNode().ownerDocument.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(ha().execCommand(i),!0))))}bZ(mZ,"cut"),bZ(wZ,"copy"),vZ&&(vZ.addImplementation(1e4,"code-editor",(t=>{const i=t.get(so),e=t.get(nH),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!s.getContainerDomNode().ownerDocument.execCommand("paste")&&vt)||(async()=>{const t=await e.readText();if(""!==t){const i=Mk.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(37)&&!!i.isFromEmptySelection,n=void 0!==i.multicursorText?i.multicursorText:null,r=i.mode),s.trigger("keyboard","paste",{text:t,pasteOnNewLine:e,multicursorText:n,mode:r})}})())})),vZ.addImplementation(0,"generic-dom",(()=>(ha().execCommand("paste"),!0)))),fZ&&Xa(class extends Ga{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:Q(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(Ak.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),Ak.forceCopyWithSyntaxHighlighting=!1))}});class yZ{constructor(t){this.value=t}equals(t){return this.value===t.value}contains(t){return this.equals(t)||""===this.value||t.value.startsWith(this.value+yZ.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new yZ(this.value+yZ.sep+t)}}var kZ;function CZ(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}yZ.sep=".",yZ.None=new yZ("@@none@@"),yZ.Empty=new yZ(""),yZ.QuickFix=new yZ("quickfix"),yZ.Refactor=new yZ("refactor"),yZ.RefactorExtract=yZ.Refactor.append("extract"),yZ.RefactorInline=yZ.Refactor.append("inline"),yZ.RefactorMove=yZ.Refactor.append("move"),yZ.RefactorRewrite=yZ.Refactor.append("rewrite"),yZ.Notebook=new yZ("notebook"),yZ.Source=new yZ("source"),yZ.SourceOrganizeImports=yZ.Source.append("organizeImports"),yZ.SourceFixAll=yZ.Source.append("fixAll"),yZ.SurroundWith=yZ.Refactor.append("surround"),function(t){t.Refactor="refactor",t.RefactorPreview="refactor preview",t.Lightbulb="lightbulb",t.Default="other (default)",t.SourceAction="source action",t.QuickFix="quick fix action",t.FixAll="fix all",t.OrganizeImports="organize imports",t.AutoFix="auto fix",t.QuickFixHover="quick fix hover window",t.OnSave="save participants",t.ProblemsView="problems view"}(kZ||(kZ={}));class SZ{static fromUser(t,i){return t&&"object"==typeof t?new SZ(SZ.getKindFromUser(t,i.kind),SZ.getApplyFromUser(t,i.apply),SZ.getPreferredUser(t)):new SZ(i.kind,i.apply,!1)}static getApplyFromUser(t,i){switch("string"==typeof t.apply?t.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return i}}static getKindFromUser(t,i){return"string"==typeof t.kind?new yZ(t.kind):i}static getPreferredUser(t){return"boolean"==typeof t.preferred&&t.preferred}constructor(t,i,e){this.kind=t,this.apply=i,this.preferred=e}}class xZ{constructor(t,i,e){this.action=t,this.provider=i,this.highlightRange=e}async resolve(t){var i;if((null===(i=this.provider)||void 0===i?void 0:i.resolveCodeAction)&&!this.action.edit){let i;try{i=await this.provider.resolveCodeAction(this.action,t)}catch(t){Fi(t)}i&&(this.action.edit=i.edit)}return this}}const DZ="editor.action.codeAction",EZ="editor.action.quickFix",AZ="editor.action.autoFix",MZ="editor.action.refactor",LZ="editor.action.sourceAction",FZ="editor.action.organizeImports",TZ="editor.action.fixAll";class RZ extends Ki{static codeActionsPreferredComparator(t,i){return t.isPreferred&&!i.isPreferred?-1:!t.isPreferred&&i.isPreferred?1:0}static codeActionsComparator({action:t},{action:i}){return t.isAI&&!i.isAI?1:!t.isAI&&i.isAI?-1:u(t.diagnostics)?u(i.diagnostics)?RZ.codeActionsPreferredComparator(t,i):-1:u(i.diagnostics)?1:RZ.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(RZ.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&yZ.QuickFix.contains(new yZ(t.kind))&&!!t.isPreferred))}get hasAIFix(){return this.validActions.some((({action:t})=>!!t.isAI))}get allAIFixes(){return this.validActions.every((({action:t})=>!!t.isAI))}}const OZ={actions:[],documentation:void 0};async function _Z(t,i,s,n,r,o){var h;const l=n.filter||{},a={...l,excludes:[...l.excludes||[],yZ.Notebook]},u={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new cq(i,o),f=function(t,i,e){return t.all(i).filter((t=>!t.providedCodeActionKinds||t.providedCodeActionKinds.some((t=>function(t,i){return!(t.include&&!t.include.intersects(i)||t.excludes&&t.excludes.some((e=>CZ(i,e,t.include)))||!t.includeSourceActions&&yZ.Source.contains(i))}(e,new yZ(t))))))}(t,i,2===n.type?a:l),g=new Ui,p=f.map((async t=>{try{r.report(t);const e=await t.provideCodeActions(i,s,u,d.token);if(e&&g.add(e),d.token.isCancellationRequested)return OZ;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new yZ(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>CZ(e,i,t.include)))||!t.includeSourceActions&&e&&yZ.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(l,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new yZ(t.kind),command:t.command})));if(e){let t;for(const i of s)i.kind.contains(e)&&(t?t.kind.contains(i.kind)&&(t=i):t=i);if(t)return null==t?void 0:t.command}for(const t of i)if(t.kind)for(const i of s)if(i.kind.contains(new yZ(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new xZ(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Fi(t),OZ}})),m=t.onDidChange((()=>{e(t.all(i),f)||d.cancel()}));try{const e=await Promise.all(p),s=e.map((t=>t.actions)).flat(),r=[...c(e.map((t=>t.documentation))),...IZ(t,i,n,s)];return new RZ(s,r,g)}finally{m.dispose(),d.dispose()}}function*IZ(t,i,e,s){var n,r,o;if(i&&s.length)for(const h of t.all(i))h._getAdditionalMenuItems&&(yield*null===(n=h._getAdditionalMenuItems)||void 0===n?void 0:n.call(h,{trigger:e.type,only:null===(o=null===(r=e.filter)||void 0===r?void 0:r.include)||void 0===o?void 0:o.value},s.map((t=>t.action))))}var PZ;async function NZ(t,i,e,s,n=fe.None){var r;const o=t.get(jR),h=t.get(po),c=t.get(Th),l=t.get(VF);if(c.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),await i.resolve(n),!n.isCancellationRequested){if((null===(r=i.action.edit)||void 0===r?void 0:r.edits.length)&&!(await o.apply(i.action.edit,{editor:null==s?void 0:s.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!==PZ.OnSave,showPreview:null==s?void 0:s.preview})).isApplied)return;if(i.action.command)try{await h.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(t){const i=function(t){return"string"==typeof t?t:t instanceof Error&&"string"==typeof t.message?t.message:void 0}(t);l.error("string"==typeof i?i:Q(0,"An unknown error occurred while applying the code action"))}}}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(PZ||(PZ={})),mo.registerCommand("_executeCodeActionProvider",(async function(t,i,e,s,n){if(!(i instanceof hs))throw Ii();const{codeActionProvider:r}=t.get(op),o=t.get(no).getModel(i);if(!o)throw Ii();const h=ys.isISelection(e)?ys.liftSelection(e):bs.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ii();const c="string"==typeof s?new yZ(s):void 0,l=await _Z(r,o,h,{type:1,triggerAction:kZ.Default,filter:{includeSourceActions:!0,include:c}},xO.None,fe.None),a=[],u=Math.min(l.validActions.length,"number"==typeof n?n:0);for(let t=0;t<u;t++)a.push(l.validActions[t].resolve(fe.None));try{return await Promise.all(a),l.validActions.map((t=>t.action))}finally{setTimeout((()=>l.dispose()),100)}}));var BZ;let $Z=BZ=class{constructor(t){this.keybindingService=t}getResolver(){const t=new On((()=>this.keybindingService.getKeybindings().filter((t=>BZ.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===FZ?i={kind:yZ.SourceOrganizeImports.value}:t.command===TZ&&(i={kind:yZ.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...SZ.fromUser(i,{kind:yZ.None,apply:"never"})}}))));return i=>{if(i.kind){const e=this.bestKeybindingForCodeAction(i,t.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new yZ(t.kind);return i.filter((t=>t.kind.contains(e))).filter((i=>!i.preferred||t.isPreferred)).reduceRight(((t,i)=>t?t.kind.contains(i.kind)?i:t:i),void 0)}};$Z.codeActionCommands=[MZ,DZ,LZ,FZ,TZ],$Z=BZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,HC)],$Z),Jm("symbolIcon.arrayForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.booleanForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.colorForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.constantForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},Q(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.fileForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.folderForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.keyForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.keywordForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},Q(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.moduleForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.namespaceForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.nullForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.numberForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.objectForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.operatorForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.packageForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.propertyForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.referenceForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.snippetForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.stringForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.structForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.textForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.typeParameterForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.unitForeground",{dark:Qm,light:Qm,hcDark:Qm,hcLight:Qm},Q(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Jm("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},Q(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const WZ=Object.freeze({kind:yZ.Empty,title:Q(0,"More Actions...")}),jZ=Object.freeze([{kind:yZ.QuickFix,title:Q(0,"Quick Fix")},{kind:yZ.RefactorExtract,title:Q(0,"Extract"),icon:xs.wrench},{kind:yZ.RefactorInline,title:Q(0,"Inline"),icon:xs.wrench},{kind:yZ.RefactorRewrite,title:Q(0,"Rewrite"),icon:xs.wrench},{kind:yZ.RefactorMove,title:Q(0,"Move"),icon:xs.wrench},{kind:yZ.SurroundWith,title:Q(0,"Surround With"),icon:xs.symbolSnippet},{kind:yZ.Source,title:Q(0,"Source Action"),icon:xs.symbolFile},WZ]);var VZ,HZ,zZ=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t.Hidden={type:0},t.Showing=class{constructor(t,i,e,s){this.actions=t,this.trigger=i,this.editorPosition=e,this.widgetPosition=s,this.type=1}}}(HZ||(HZ={}));let UZ=VZ=class extends Ki{constructor(t,i,e){var s,n,r;super(),this._editor=t,this._keybindingService=i,this._onClick=this._register(new ne),this.onClick=this._onClick.event,this._state=HZ.Hidden,this._iconClasses=[],this._domNode=Fa("div.lightBulbWidget"),this._register(zm.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent((()=>{const t=this._editor.getModel();(1!==this.state.type||!t||this.state.editorPosition.lineNumber>=t.getLineCount())&&this.hide()}))),this._register((n=t=>{var i;if(1!==this.state.type)return;const s=this._editor.getOption(64).experimental.showAiIcon;if((s===ci.On||s===ci.OnCode)&&this.state.actions.allAIFixes&&1===this.state.actions.validActions.length){const s=this.state.actions.validActions[0].action;if(null===(i=s.command)||void 0===i?void 0:i.id)return e.executeCommand(s.command.id,...s.command.arguments||[]),void t.preventDefault()}this._editor.focus(),t.preventDefault();const{top:n,height:r}=Zl(this._domNode),o=this._editor.getOption(66);let h=Math.floor(o/3);null!==this.state.widgetPosition.position&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(h+=o),this._onClick.fire({x:t.posx,y:n+r+h,actions:this.state.actions,trigger:this.state.trigger})},function(t,i,e){return Il(t,yt&&Bh?ya.POINTER_DOWN:ya.MOUSE_DOWN,i,e)}(s=this._domNode,Pl(Al(s),n),r))),this._register(Il(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(64)&&(this._editor.getOption(64).enabled||this.hide(),this._updateLightBulbTitleAndIcon())}))),this._register(Xi.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,(()=>{var t,i,e,s;this._preferredKbLabel=null!==(i=null===(t=this._keybindingService.lookupKeybinding(AZ))||void 0===t?void 0:t.getLabel())&&void 0!==i?i:void 0,this._quickFixKbLabel=null!==(s=null===(e=this._keybindingService.lookupKeybinding(EZ))||void 0===e?void 0:e.getLabel())&&void 0!==s?s:void 0,this._updateLightBulbTitleAndIcon()})))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return 1===this._state.type?this._state.widgetPosition:null}update(t,i,e){if(t.validActions.length<=0)return this.hide();const s=this._editor.getOptions();if(!s.get(64).enabled)return this.hide();const n=this._editor.getModel();if(!n)return this.hide();const{lineNumber:r,column:o}=n.validatePosition(e),h=n.getOptions().tabSize,c=s.get(50),l=mx(n.getLineContent(r),h),a=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let u=r;if(!(c.spaceWidth*l>22))if(r>1&&!a(r-1))u-=1;else if(a(r+1)){if(o*c.spaceWidth<22)return this.hide()}else u+=1;this.state=new HZ.Showing(t,i,e,{position:{lineNumber:u,column:n.getLineContent(u).match(/^\S\s*$/)?2:1},preference:VZ._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==HZ.Hidden&&(this.state=HZ.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(t){this._state=t,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){var t,i,e;if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],1!==this.state.type)return;const s=()=>{this._preferredKbLabel&&(this.title=Q(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel))},n=()=>{this.title=this._quickFixKbLabel?Q(0,"Show Code Actions ({0})",this._quickFixKbLabel):Q(0,"Show Code Actions")};let r;const o=this._editor.getOption(64).experimental.showAiIcon;if(o===ci.On||o===ci.OnCode)if(o===ci.On&&this.state.actions.allAIFixes)if(r=xs.sparkleFilled,this.state.actions.allAIFixes&&1===this.state.actions.validActions.length)if("inlineChat.start"===(null===(t=this.state.actions.validActions[0].action.command)||void 0===t?void 0:t.id)){const t=null!==(e=null===(i=this._keybindingService.lookupKeybinding("inlineChat.start"))||void 0===i?void 0:i.getLabel())&&void 0!==e?e:void 0;this.title=t?Q(0,"Start Inline Chat ({0})",t):Q(0,"Start Inline Chat")}else this.title=Q(0,"Trigger AI Action");else n();else this.state.actions.hasAutoFix?(r=this.state.actions.hasAIFix?xs.lightbulbSparkleAutofix:xs.lightbulbAutofix,s()):this.state.actions.hasAIFix?(r=xs.lightbulbSparkle,n()):(r=xs.lightBulb,n());else this.state.actions.hasAutoFix?(r=xs.lightbulbAutofix,s()):(r=xs.lightBulb,n());this._iconClasses=go.asClassNameArray(r),this._domNode.classList.add(...this._iconClasses)}set title(t){this._domNode.title=t}};UZ.ID="editor.contrib.lightbulbWidget",UZ._posPref=[0],UZ=VZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([zZ(1,HC),zZ(2,po)],UZ);var KZ,qZ=function(t,i){return function(e,s){i(e,s,t)}};let GZ=KZ=class{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ne,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(t,i,e){if(!t)return{element:document.createElement("span"),dispose:()=>{}};const s=new Ui,n=s.add(VI(t,{...this._getRenderOptions(t,s),...i},e));return n.element.classList.add("rendered-markdown"),{element:n.element,dispose:()=>s.dispose()}}_getRenderOptions(t,i){return{codeBlockRenderer:async(t,i)=>{var e,s,n;let r;t?r=this._languageService.getLanguageIdByLanguageName(t):this._options.editor&&(r=null===(e=this._options.editor.getModel())||void 0===e?void 0:e.getLanguageId()),r||(r=Ld);const o=await async function(t,i,e){if(!e)return hF(i,t.languageIdCodec,rF);const s=await Ws.getOrCreate(e);return hF(i,t.languageIdCodec,s||rF)}(this._languageService,i,r),h=document.createElement("span");return h.innerHTML=null!==(n=null===(s=KZ._ttpTokenizer)||void 0===s?void 0:s.createHTML(o))&&void 0!==n?n:o,this._options.editor?Ur(h,this._options.editor.getOption(50)):this._options.codeBlockFontFamily&&(h.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(h.style.fontSize=this._options.codeBlockFontSize),h},asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>ZZ(this._openerService,i,t.isTrusted),disposables:i}}}};async function ZZ(t,i,e){try{return await t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:JZ(e)})}catch(t){return Li(t),!1}}function JZ(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}GZ._ttpTokenizer=bu("tokenizeToString",{createHTML:t=>t}),GZ=KZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([qZ(1,ud),qZ(2,ZN)],GZ);var QZ,YZ=function(t,i){return function(e,s){i(e,s,t)}};let XZ=QZ=class{static get(t){return t.getContribution(QZ.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new qi,this._messageListeners=new Ui,this._mouseOverMessage=!1,this._editor=t,this._visible=QZ.MESSAGE_VISIBLE.bindTo(i)}dispose(){var t;null===(t=this._message)||void 0===t||t.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;Cm(kI(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=kI(t)?VI(t,{actionHandler:{callback:i=>ZZ(this._openerService,i,kI(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new tJ(this._editor,i,"string"==typeof t?t:this._message.element),this._messageListeners.add(Xi.debounce(this._editor.onDidBlurEditorText,((t,i)=>i),0)((()=>{this._mouseOverMessage||this._messageWidget.value&&ta(ra(),this._messageWidget.value.getDomNode())||this.closeMessage()}))),this._messageListeners.add(this._editor.onDidChangeCursorPosition((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidDispose((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidChangeModel((()=>this.closeMessage()))),this._messageListeners.add(Il(this._messageWidget.value.getDomNode(),ya.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Il(this._messageWidget.value.getDomNode(),ya.MOUSE_LEAVE,(()=>this._mouseOverMessage=!1),!0)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new bs(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(tJ.fadeOut(this._messageWidget.value))}};XZ.ID="editor.contrib.messageController",XZ.MESSAGE_VISIBLE=new Xo("messageVisible",!1,Q(0,"Whether the editor is currently showing an inline message")),XZ=QZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([YZ(1,th),YZ(2,ZN)],XZ),Ya(new(qa.bindToContribution(XZ.get))({id:"leaveEditorMessage",precondition:XZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class tJ{static fadeOut(t){const i=()=>{t.dispose(),clearTimeout(e),t.getDomNode().removeEventListener("animationend",i)},e=setTimeout(i,110);return t.getDomNode().addEventListener("animationend",i),t.getDomNode().classList.add("fadeOut"),{dispose:i}}constructor(t,{lineNumber:i,column:e},s){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=t,this._editor.revealLinesInCenterIfOutsideViewport(i,i,0),this._position={lineNumber:i,column:e},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);const r=document.createElement("div");"string"==typeof s?(r.classList.add("message"),r.textContent=s):(s.classList.add("message"),r.appendChild(s)),this._domNode.appendChild(r);const o=document.createElement("div");o.classList.add("anchor","below"),this._domNode.appendChild(o),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(t){this._domNode.classList.toggle("below",2===t)}}iu(XZ.ID,XZ,4);var iJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},eJ=function(t,i){return function(e,s){i(e,s,t)}};const sJ="acceptSelectedCodeAction",nJ="previewSelectedCodeAction";class rJ{get templateId(){return"header"}renderTemplate(t){t.classList.add("group-header");const i=document.createElement("span");return t.append(i),{container:t,text:i}}renderElement(t,i,e){var s,n;e.text.textContent=null!==(n=null===(s=t.group)||void 0===s?void 0:s.title)&&void 0!==n?n:""}disposeTemplate(t){}}let oJ=class{get templateId(){return"action"}constructor(t,i){this._supportsPreview=t,this._keybindingService=i}renderTemplate(t){t.classList.add(this.templateId);const i=document.createElement("div");i.className="icon",t.append(i);const e=document.createElement("span");return e.className="title",t.append(e),{container:t,icon:i,text:e,keybinding:new Pj(t,Et)}}renderElement(t,i,e){var s,n,r;if((null===(s=t.group)||void 0===s?void 0:s.icon)?(e.icon.className=go.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=qm(t.group.icon.color.id))):(e.icon.className=go.asClassName(xs.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=uJ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Ta(...i):Ra(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(sJ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(nJ))||void 0===r?void 0:r.getLabel();e.container.classList.toggle("option-disabled",t.disabled),e.container.title=t.disabled?t.label:o&&h?this._supportsPreview&&t.canPreview?Q(0,"{0} to apply, {1} to preview",o,h):Q(0,"{0} to apply",o):""}disposeTemplate(t){}};oJ=iJ([eJ(1,HC)],oJ);class hJ extends UIEvent{constructor(){super("acceptSelectedAction")}}class cJ extends UIEvent{constructor(){super("previewSelectedAction")}}function lJ(t){if("action"===t.kind)return t.label}let aJ=class extends Ki{constructor(t,i,e,s,n,r){super(),this._delegate=s,this._contextViewService=n,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new pe),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new KP(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new oJ(i,this._keybindingService),new rJ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:lJ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?uJ(null==t?void 0:t.label):"";return t.disabled&&(i=Q(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>Q(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(yN),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this.onFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=e,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(t){return!t.disabled&&"action"===t.kind}hide(t){this._delegate.onHide(t),this.cts.cancel(),this._contextViewService.hideContextView()}layout(t){const i=this._allMenuItems.filter((t=>"header"===t.kind)).length,e=this._allMenuItems.length*this._actionLineHeight+i*this._headerLineHeight-i*this._actionLineHeight;this._list.layout(e);let s=t;if(this._allMenuItems.length>=50)s=380;else{const i=this._allMenuItems.map(((t,i)=>{const e=this.domNode.ownerDocument.getElementById(this._list.getElementID(i));if(e){e.style.width="auto";const t=e.getBoundingClientRect().width;return e.style.width="",t}return 0}));s=Math.max(...i,t)}const n=Math.min(e,.7*this.domNode.ownerDocument.body.clientHeight);return this._list.layout(n,s),this.domNode.style.height=`${n}px`,this._list.domFocus(),s}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(t){const i=this._list.getFocus();if(0===i.length)return;const e=i[0],s=this._list.element(e);if(!this.focusCondition(s))return;const n=t?new cJ:new hJ;this._list.setSelection([e],n)}onListSelection(t){if(!t.elements.length)return;const i=t.elements[0];i.item&&this.focusCondition(i)?this._delegate.onSelect(i.item,t.browserEvent instanceof cJ):this._list.setSelection([])}onFocus(){var t,i;this._list.domFocus();const e=this._list.getFocus();if(0===e.length)return;const s=this._list.element(e[0]);null===(i=(t=this._delegate).onFocus)||void 0===i||i.call(t,s.item)}async onListHover(t){const i=t.element;if(i&&i.item&&this.focusCondition(i)){if(this._delegate.onHover&&!i.disabled&&"action"===i.kind){const t=await this._delegate.onHover(i.item,this.cts.token);i.canPreview=t?t.canPreview:void 0}t.index&&this._list.splice(t.index,1,[i])}this._list.setFocus("number"==typeof t.index?[t.index]:[])}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function uJ(t){return t.replace(/\r\n|\r|\n/g," ")}aJ=iJ([eJ(4,KO),eJ(5,HC)],aJ);var dJ=function(t,i){return function(e,s){i(e,s,t)}};Jm("actionBar.toggledBackground",{dark:aw,light:aw,hcDark:aw,hcLight:aw},Q(0,"Background color for toggled action items in action bar."));const fJ={Visible:new Xo("codeActionMenuVisible",!1,Q(0,"Whether the action widget list is visible"))},gJ=eo("actionWidgetService");let pJ=class extends Ki{get isVisible(){return fJ.Visible.getValue(this._contextKeyService)||!1}constructor(t,i,e){super(),this._contextViewService=t,this._contextKeyService=i,this._instantiationService=e,this._list=this._register(new qi)}show(t,i,e,s,n,r,o){const h=fJ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(aJ,t,i,e,s);this._contextViewService.showContextView({getAnchor:()=>n,render:t=>(h.set(!0),this._renderWidget(t,c,null!=o?o:[])),onHide:t=>{h.reset(),this._onWidgetClosed(t)}},r,!1)}acceptSelected(t){var i;null===(i=this._list.value)||void 0===i||i.acceptSelected(t)}focusPrevious(){var t,i;null===(i=null===(t=this._list)||void 0===t?void 0:t.value)||void 0===i||i.focusPrevious()}focusNext(){var t,i;null===(i=null===(t=this._list)||void 0===t?void 0:t.value)||void 0===i||i.focusNext()}hide(){var t;null===(t=this._list.value)||void 0===t||t.hide(),this._list.clear()}_renderWidget(t,i,e){var s;const n=document.createElement("div");if(n.classList.add("action-widget"),t.appendChild(n),this._list.value=i,!this._list.value)throw new Error("List has no value");n.appendChild(this._list.value.domNode);const r=new Ui,o=document.createElement("div"),h=t.appendChild(o);h.classList.add("context-view-block"),r.add(Il(h,ya.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Il(l,ya.POINTER_MOVE,(()=>l.remove()))),r.add(Il(l,ya.MOUSE_DOWN,(()=>l.remove())));let a=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),a=t.getContainer().offsetWidth)}const u=null===(s=this._list.value)||void 0===s?void 0:s.layout(a);n.style.width=`${u}px`;const d=r.add(Sa(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Fa(t),s=new IN(e);return s.push(i,{icon:!1,label:!0}),s}_onWidgetClosed(t){var i;null===(i=this._list.value)||void 0===i||i.hide(t)}};pJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([dJ(0,KO),dJ(1,th),dJ(2,io)],pJ),gd(gJ,pJ,1);const mJ=1100;Fh(class extends Lh{constructor(){super({id:"hideCodeActionWidget",title:{value:Q(0,"Hide action widget"),original:"Hide action widget"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:9,secondary:[1033]}})}run(t){t.get(gJ).hide()}}),Fh(class extends Lh{constructor(){super({id:"selectPrevCodeAction",title:{value:Q(0,"Select previous action"),original:"Select previous action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.focusPrevious()}}),Fh(class extends Lh{constructor(){super({id:"selectNextCodeAction",title:{value:Q(0,"Select next action"),original:"Select next action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.focusNext()}}),Fh(class extends Lh{constructor(){super({id:sJ,title:{value:Q(0,"Accept selected action"),original:"Accept selected action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:3,secondary:[2137]}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.acceptSelected()}}),Fh(class extends Lh{constructor(){super({id:nJ,title:{value:Q(0,"Preview selected action"),original:"Preview selected action"},precondition:fJ.Visible,keybinding:{weight:mJ,primary:2051}})}run(t){const i=t.get(gJ);i instanceof pJ&&i.acceptSelected(!0)}});const wJ=new Xo("supportedCodeAction","");class vJ extends Ki{constructor(t,i,e,s=250){super(),this._editor=t,this._markerService=i,this._signalChange=e,this._delay=s,this._autoTriggerTimer=this._register(new sc),this._register(this._markerService.onMarkerChanged((t=>this._onMarkerChanges(t)))),this._register(this._editor.onDidChangeCursorPosition((()=>this._tryAutoTrigger())))}trigger(t){const i=this._getRangeOfSelectionUnlessWhitespaceEnclosed(t);this._signalChange(i?{trigger:t,selection:i}:void 0)}_onMarkerChanges(t){const i=this._editor.getModel();i&&t.some((t=>tA(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:kZ.Default})}),this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(t){var i;if(!this._editor.hasModel())return;const e=this._editor.getModel(),s=this._editor.getSelection();if(s.isEmpty()&&2===t.type){const{lineNumber:t,column:n}=s.getPosition(),r=e.getLineContent(t);if(0===r.length){if((null===(i=this._editor.getOption(64).experimental)||void 0===i?void 0:i.showAiIcon)!==ci.On)return}else if(1===n){if(/\s/.test(r[0]))return}else if(n===e.getLineMaxColumn(t)){if(/\s/.test(r[r.length-1]))return}else if(/\s/.test(r[n-2])&&/\s/.test(r[n-1]))return}return s}}var bJ;!function(t){t.Empty={type:0},t.Triggered=class{constructor(t,i,e){this.trigger=t,this.position=i,this._cancellablePromise=e,this.type=1,this.actions=e.catch((t=>{if(Oi(t))return yJ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(bJ||(bJ={}));const yJ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class kJ extends Ki{constructor(t,i,e,s,n,r){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._configurationService=r,this._codeActionOracle=this._register(new qi),this._state=bJ.Empty,this._onDidChangeState=this._register(new ne),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=wJ.bindTo(s),this._register(this._editor.onDidChangeModel((()=>this._update()))),this._register(this._editor.onDidChangeModelLanguage((()=>this._update()))),this._register(this._registry.onDidChange((()=>this._update()))),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(bJ.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return!!this._configurationService&&this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:null==i?void 0:i.uri})}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(bJ.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(90)){const i=this._registry.all(t).flatMap((t=>{var i;return null!==(i=t.providedCodeActionKinds)&&void 0!==i?i:[]}));this._supportedCodeActions.set(i.join(" ")),this._codeActionOracle.value=new vJ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(bJ.Empty);const s=i.selection.getStartPosition(),n=Zh((async e=>{var s,n,r,o,h,c;if(this._settingEnabledNearbyQuickfixes()&&1===i.trigger.type&&(i.trigger.triggerAction===kZ.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(yZ.QuickFix)))){const s=await _Z(this._registry,t,i.selection,i.trigger,xO.None,e),n=[...s.allActions];if(e.isCancellationRequested)return yJ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&yZ.QuickFix.contains(new yZ(t.action.kind)))))){const r=this._markerService.read({resource:t.uri});if(r.length>0){const l=i.selection.getPosition();let a=l,u=Number.MAX_VALUE;const d=[...s.validActions];for(const f of r){const r=f.endColumn,g=f.endLineNumber;if(g===l.lineNumber||f.startLineNumber===l.lineNumber){a=new vs(g,r);const f={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(null===(o=i.trigger.filter)||void 0===o?void 0:o.include)?null===(h=i.trigger.filter)||void 0===h?void 0:h.include:yZ.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:(null===(c=i.trigger.context)||void 0===c?void 0:c.notAvailableMessage)||"",position:a}},p=new ys(a.lineNumber,a.column,a.lineNumber,a.column),m=await _Z(this._registry,t,p,f,xO.None,e);if(0!==m.validActions.length){for(const t of m.validActions)t.highlightRange=t.action.isPreferred;0===s.allActions.length&&n.push(...m.allActions),Math.abs(l.column-r)<u?d.unshift(...m.validActions):d.push(...m.validActions)}u=Math.abs(l.column-r)}}const f=d.filter(((t,i,e)=>e.findIndex((i=>i.action.title===t.action.title))===i));return f.sort(((t,i)=>t.action.isPreferred&&!i.action.isPreferred?-1:!t.action.isPreferred&&i.action.isPreferred||t.action.isAI&&!i.action.isAI?1:!t.action.isAI&&i.action.isAI?-1:0)),{validActions:f,allActions:n,documentation:s.documentation,hasAutoFix:s.hasAutoFix,hasAIFix:s.hasAIFix,allAIFixes:s.allAIFixes,dispose:()=>{s.dispose()}}}}}return _Z(this._registry,t,i.selection,i.trigger,xO.None,e)}));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new bJ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:kZ.Default})}else this._supportedCodeActions.reset()}trigger(t){var i;null===(i=this._codeActionOracle.value)||void 0===i||i.trigger(t)}setState(t,i){t!==this._state&&(1===this._state.type&&this._state.cancel(),this._state=t,i||this._disposed||this._onDidChangeState.fire(t))}}var CJ,SJ=function(t,i){return function(e,s){i(e,s,t)}};let xJ=CJ=class extends Ki{static get(t){return t.getContribution(CJ.ID)}constructor(t,i,e,s,n,r,o,h,c,l){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=l,this._activeCodeActions=this._register(new qi),this._showDisabled=!1,this._disposed=!1,this._editor=t,this._model=this._register(new kJ(this._editor,n.codeActionProvider,i,e,r,h)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new On((()=>{const t=this._editor.getContribution(UZ.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance($Z),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(t,i,e){return this.showCodeActionList(i,e,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(t,i,e,s){var n;if(!this._editor.hasModel())return;null===(n=XZ.get(this._editor))||void 0===n||n.closeMessage();const r=this._editor.getPosition();this._trigger({type:1,triggerAction:i,filter:e,autoApply:s,context:{notAvailableMessage:t,position:r}})}_trigger(t){return this._model.trigger(t)}async _applyCodeAction(t,i,e){try{await this._instantiationService.invokeFunction(NZ,t,PZ.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:kZ.QuickFix,filter:{}})}}async update(t){var i,e,s,n,r,o,h;if(1!==t.type)return void(null===(i=this._lightBulbWidget.rawValue)||void 0===i||i.hide());let c;try{c=await t.actions}catch(t){return void Li(t)}if(!this._disposed)if(null===(e=this._lightBulbWidget.value)||void 0===e||e.update(c,t.trigger,t.position),1===t.trigger.type){if(null===(s=t.trigger.filter)||void 0===s?void 0:s.include){const i=this.tryGetValidActionToApply(t.trigger,c);if(i){try{null===(n=this._lightBulbWidget.value)||void 0===n||n.hide(),await this._applyCodeAction(i,!1,!1)}finally{c.dispose()}return}if(t.trigger.context){const i=this.getInvalidActionThatWouldHaveBeenApplied(t.trigger,c);if(i&&i.action.disabled)return null===(r=XZ.get(this._editor))||void 0===r||r.showMessage(i.action.disabled,t.trigger.context.position),void c.dispose()}}const i=!!(null===(o=t.trigger.filter)||void 0===o?void 0:o.include);if(t.trigger.context&&(!c.allActions.length||!i&&!c.validActions.length))return null===(h=XZ.get(this._editor))||void 0===h||h.showMessage(t.trigger.context.notAvailableMessage,t.trigger.context.position),this._activeCodeActions.value=c,void c.dispose();this._activeCodeActions.value=c,this.showCodeActionList(c,this.toCoords(t.position),{includeDisabledActions:i,fromLightbulb:!1})}else this._actionWidgetService.isVisible?c.dispose():this._activeCodeActions.value=c}getInvalidActionThatWouldHaveBeenApplied(t,i){if(i.allActions.length)return"first"===t.autoApply&&0===i.validActions.length||"ifSingle"===t.autoApply&&1===i.allActions.length?i.allActions.find((({action:t})=>t.disabled)):void 0}tryGetValidActionToApply(t,i){if(i.validActions.length)return"first"===t.autoApply&&i.validActions.length>0||"ifSingle"===t.autoApply&&1===i.validActions.length?i.validActions[0]:void 0}async showCodeActionList(t,i,e){const s=this._editor.createDecorationsCollection(),n=this._editor.getDomNode();if(!n)return;const r=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!r.length)return;const o=vs.isIPosition(i)?this.toCoords(i):i,h={onSelect:async(t,i)=>{this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide(),s.clear()},onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus(),s.clear()},onHover:async(t,i)=>{var e;if(await t.resolve(i),!i.isCancellationRequested)return{canPreview:!!(null===(e=t.action.edit)||void 0===e?void 0:e.edits.length)}},onFocus:t=>{var i,e;if(t&&t.highlightRange&&t.action.diagnostics){s.set([{range:t.action.diagnostics[0],options:CJ.DECORATION}]);const n=t.action.diagnostics[0];Sm(Q(0,"Context: {0} at line {1} and column {2}.",null===(e=null===(i=this._editor.getModel())||void 0===i?void 0:i.getWordAtPosition({lineNumber:n.startLineNumber,column:n.startColumn}))||void 0===e?void 0:e.word,n.startLineNumber,n.startColumn))}else s.clear()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>{var i;return{kind:"action",item:t,group:WZ,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title,canPreview:!!(null===(i=t.action.edit)||void 0===i?void 0:i.edits.length)}}));const s=jZ.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new yZ(i.action.kind):yZ.None;for(const e of s)if(e.group.kind.contains(t)){e.actions.push(i);break}}const n=[];for(const t of s)if(t.actions.length){n.push({kind:"header",group:t.group});for(const i of t.actions){const s=t.group;n.push({kind:"action",item:i,group:i.action.isAI?{title:s.title,kind:s.kind,icon:xs.sparkle}:s,label:i.action.title,disabled:!!i.action.disabled,keybinding:e(i.action)})}}return n}(r,this._shouldShowHeaders(),this._resolver.getResolver()),h,o,n,this._getActionBarActions(t,i,e))}toCoords(t){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(t,1),this._editor.render();const i=this._editor.getScrolledVisiblePosition(t),e=Zl(this._editor.getDomNode());return{x:e.left+i.left,y:e.top+i.top+i.height}}_shouldShowHeaders(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:null==i?void 0:i.uri})}_getActionBarActions(t,i,e){if(e.fromLightbulb)return[];const s=t.documentation.map((t=>{var i;return{id:t.id,label:t.title,tooltip:null!==(i=t.tooltip)&&void 0!==i?i:"",class:void 0,enabled:!0,run:()=>{var i;return this._commandService.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}}}));return e.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&s.push(this._showDisabled?{id:"hideMoreActions",label:Q(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,e))}:{id:"showMoreActions",label:Q(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,e))}),s}};function DJ(t){return Oo.regex(wJ.keys()[0],new RegExp("(\\s|^)"+$n(t.value)+"\\b"))}xJ.ID="editor.contrib.codeActionController",xJ.DECORATION=aL.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),xJ=CJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([SJ(1,nB),SJ(2,th),SJ(3,io),SJ(4,op),SJ(5,DO),SJ(6,po),SJ(7,rd),SJ(8,gJ),SJ(9,io)],xJ),Vk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(fv));const e=t.getColor(mv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Ey(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const EJ={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:Q(0,"Kind of the code action to run.")},apply:{type:"string",description:Q(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[Q(0,"Always apply the first returned code action."),Q(0,"Apply the first returned code action if it is the only one."),Q(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:Q(0,"Controls if only preferred code actions should be returned.")}}};function AJ(t,i,e,s,n=kZ.Default){if(t.hasModel()){const r=xJ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}iu(xJ.ID,xJ,3),iu(UZ.ID,UZ,4),Xa(class extends Ga{constructor(){super({id:EZ,label:Q(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),kbOpts:{kbExpr:PS.textInputFocus,primary:2137,weight:100}})}run(t,i){return AJ(i,Q(0,"No code actions available"),void 0,void 0,kZ.QuickFix)}}),Xa(class extends Ga{constructor(){super({id:MZ,label:Q(0,"Refactor..."),alias:"Refactor...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),kbOpts:{kbExpr:PS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Oo.and(PS.writable,DJ(yZ.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:EJ}]}})}run(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Refactor,apply:"never"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",e.kind):Q(0,s.preferred?"No preferred refactorings available":"No refactorings available"),{include:yZ.Refactor.contains(s.kind)?s.kind:yZ.None,onlyIncludePreferredActions:s.preferred},s.apply,kZ.Refactor)}}),Xa(class extends Ga{constructor(){super({id:LZ,label:Q(0,"Source Action..."),alias:"Source Action...",precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Oo.and(PS.writable,DJ(yZ.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:EJ}]}})}run(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Source,apply:"never"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",e.kind):Q(0,s.preferred?"No preferred source actions available":"No source actions available"),{include:yZ.Source.contains(s.kind)?s.kind:yZ.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,kZ.SourceAction)}}),Xa(class extends Ga{constructor(){super({id:FZ,label:Q(0,"Organize Imports"),alias:"Organize Imports",precondition:Oo.and(PS.writable,DJ(yZ.SourceOrganizeImports)),kbOpts:{kbExpr:PS.textInputFocus,primary:1581,weight:100}})}run(t,i){return AJ(i,Q(0,"No organize imports action available"),{include:yZ.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",kZ.OrganizeImports)}}),Xa(class extends Ga{constructor(){super({id:AZ,label:Q(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Oo.and(PS.writable,DJ(yZ.QuickFix)),kbOpts:{kbExpr:PS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return AJ(i,Q(0,"No auto fixes available"),{include:yZ.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",kZ.AutoFix)}}),Xa(class extends Ga{constructor(){super({id:TZ,label:Q(0,"Fix All"),alias:"Fix All",precondition:Oo.and(PS.writable,DJ(yZ.SourceFixAll))})}run(t,i){return AJ(i,Q(0,"No fix all action available"),{include:yZ.SourceFixAll,includeSourceActions:!0},"ifSingle",kZ.FixAll)}}),Ya(new class extends qa{constructor(){super({id:DZ,precondition:Oo.and(PS.writable,PS.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:EJ}]}})}runEditorCommand(t,i,e){const s=SZ.fromUser(e,{kind:yZ.Empty,apply:"ifSingle"});return AJ(i,"string"==typeof(null==e?void 0:e.kind)?Q(0,s.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",e.kind):Q(0,s.preferred?"No preferred code actions available":"No code actions available"),{include:s.kind,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply)}}),mh.as(bd).registerConfiguration({...KR,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:Q(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}}),mh.as(bd).registerConfiguration({...KR,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:5,description:Q(0,"Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});class MJ{constructor(){this.lenses=[],this._disposables=new Ui}dispose(){this._disposables.dispose()}get isDisposed(){return this._disposables.isDisposed}add(t,i){this._disposables.add(t);for(const e of t.lenses)this.lenses.push({symbol:e,provider:i})}}async function LJ(t,i,e){const s=t.ordered(i),n=new Map,r=new MJ,o=s.map((async(t,s)=>{n.set(t,s);try{const s=await Promise.resolve(t.provideCodeLenses(i,e));s&&r.add(s,t)}catch(t){Fi(t)}}));return await Promise.all(o),r.lenses=r.lenses.sort(((t,i)=>t.symbol.range.startLineNumber<i.symbol.range.startLineNumber?-1:t.symbol.range.startLineNumber>i.symbol.range.startLineNumber?1:n.get(t.provider)<n.get(i.provider)?-1:n.get(t.provider)>n.get(i.provider)?1:t.symbol.range.startColumn<i.symbol.range.startColumn?-1:t.symbol.range.startColumn>i.symbol.range.startColumn?1:0)),r}mo.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(hs.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get(op),r=t.get(no).getModel(e);if(!r)throw Ii();const o=[],h=new Ui;return LJ(n,r,fe.None).then((t=>{h.add(t);const i=[];for(const e of t.lenses)null==s||Boolean(e.symbol.command)?o.push(e.symbol):s-- >0&&e.provider.resolveCodeLens&&i.push(Promise.resolve(e.provider.resolveCodeLens(r,e.symbol,fe.None)).then((t=>o.push(t||e.symbol))));return Promise.all(i)})).then((()=>o)).finally((()=>{setTimeout((()=>h.dispose()),100)}))}));const FJ=eo("ICodeLensCache");class TJ{constructor(t,i){this.lineCount=t,this.data=i}}let RJ=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new Mg(20,.75),Bl(Fn,(()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Xi.once(t.onWillSaveState)((e=>{e.reason===uN.SHUTDOWN&&t.store(i,this._serialize(),1,1)}))}put(t,i){const e=i.lenses.map((t=>{var i;return{range:t.symbol.range,command:t.symbol.command&&{id:"",title:null===(i=t.symbol.command)||void 0===i?void 0:i.title}}})),s=new MJ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new TJ(t.getLineCount(),s);this._cache.set(t.uri.toString(),n)}get(t){const i=this._cache.get(t.uri.toString());return i&&i.lineCount===t.getLineCount()?i.data:void 0}delete(t){this._cache.delete(t.uri.toString())}_serialize(){const t=Object.create(null);for(const[i,e]of this._cache){const s=new Set;for(const t of e.data.lenses)s.add(t.symbol.range.startLineNumber);t[i]={lineCount:e.lineCount,lines:[...s.values()]}}return JSON.stringify(t)}_deserialize(t){try{const i=JSON.parse(t);for(const t in i){const e=i[t],s=[];for(const t of e.lines)s.push({range:new bs(t,1,t,11)});const n=new MJ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new TJ(e.lineCount,n))}}catch(t){}}};RJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,aN)],RJ),gd(FJ,RJ,1);class OJ{constructor(t,i,e){this.afterColumn=1073741824,this.afterLineNumber=t,this.heightInPx=i,this._onHeight=e,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(t){void 0===this._lastHeight?this._lastHeight=t:this._lastHeight!==t&&(this._lastHeight=t,this._onHeight())}isVisible(){return 0!==this._lastHeight&&this.domNode.hasAttribute("monaco-visible-view-zone")}}class _J{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+_J._idPool++,this.updatePosition(i),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(t,i){this._commands.clear();const e=[];let s=!1;for(let i=0;i<t.length;i++){const n=t[i];if(n&&(s=!0,n.command)){const s=RI(n.command.title.trim());n.command.id?(e.push(Fa("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Fa("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Fa("span",void 0," | "))}}s?(Ea(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Ea(this._domNode,Fa("span",void 0,"no commands"))}getCommand(t){return t.parentElement===this._domNode?this._commands.get(t.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(t){const i=this._editor.getModel().getLineFirstNonWhitespaceColumn(t);this._widgetPosition={position:{lineNumber:t,column:i},preference:[1]}}getPosition(){return this._widgetPosition||null}}_J._idPool=0;class IJ{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(t,i){this._addDecorations.push(t),this._addDecorationsCallbacks.push(i)}removeDecoration(t){this._removeDecorations.push(t)}commit(t){const i=t.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,e=i.length;t<e;t++)this._addDecorationsCallbacks[t](i[t])}}const PJ=aL.register({collapseOnReplaceEdit:!0,description:"codelens"});class NJ{constructor(t,i,e,s,n,r){let o;this._isDisposed=!1,this._editor=i,this._data=t,this._decorationIds=[];const h=[];this._data.forEach(((t,i)=>{t.symbol.command&&h.push(t.symbol),e.addDecoration({range:t.symbol.range,options:PJ},(t=>this._decorationIds[i]=t)),o=o?bs.plusRange(o,t.symbol.range):bs.lift(t.symbol.range)})),this._viewZone=new OJ(o.startLineNumber-1,n,r),this._viewZoneId=s.addZone(this._viewZone),h.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(h,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new _J(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(t,i){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],null==i||i.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some(((t,i)=>{const e=this._editor.getModel().getDecorationRange(t);return!(!e||bs.isEmpty(this._data[i].symbol.range)!==e.isEmpty())}))}updateCodeLensSymbols(t,i){this._decorationIds.forEach(i.removeDecoration,i),this._decorationIds=[],this._data=t,this._data.forEach(((t,e)=>{i.addDecoration({range:t.symbol.range,options:PJ},(t=>this._decorationIds[e]=t))}))}updateHeight(t,i){this._viewZone.heightInPx=t,i.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(t){if(!this._viewZone.isVisible())return null;for(let i=0;i<this._decorationIds.length;i++){const e=t.getDecorationRange(this._decorationIds[i]);e&&(this._data[i].symbol.range=e)}return this._data}updateCommands(t){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(t,!0);for(let i=0;i<this._data.length;i++){const e=t[i];if(e){const{symbol:t}=this._data[i];t.command=e.command||t.command}}}getCommand(t){var i;return null===(i=this._contentWidget)||void 0===i?void 0:i.getCommand(t)}getLineNumber(){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return t?t.startLineNumber:-1}update(t){if(this.isValid()){const i=this._editor.getModel().getDecorationRange(this._decorationIds[0]);i&&(this._viewZone.afterLineNumber=i.startLineNumber-1,t.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(i.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}var BJ=function(t,i){return function(e,s){i(e,s,t)}};let $J=class{constructor(t,i,e,s,n,r){this._editor=t,this._languageFeaturesService=i,this._commandService=s,this._notificationService=n,this._codeLensCache=r,this._disposables=new Ui,this._localToDispose=new Ui,this._lenses=[],this._oldCodeLensModels=new Ui,this._provideCodeLensDebounce=e.for(i.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=e.for(i.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new rc((()=>this._resolveCodeLensesInViewport()),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(19)||t.hasChanged(18))&&this._updateLensStyle(),t.hasChanged(17)&&this._onModelChange()}))),this._disposables.add(i.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var t;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),null===(t=this._currentCodeLensModel)||void 0===t||t.dispose()}_getLayoutInfo(){const t=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let i=this._editor.getOption(19);return(!i||i<5)&&(i=.9*this._editor.getOption(52)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(18),s=this._editor.getOption(50),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${t}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",s.fontFeatureSettings),e&&(n.setProperty("--vscode-editorCodeLens-fontFamily",e),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",xi.fontFamily)),this._editor.changeViewZones((i=>{for(const e of this._lenses)e.updateHeight(t,i)}))}_localDispose(){var t,i,e;null===(t=this._getCodeLensModelPromise)||void 0===t||t.cancel(),this._getCodeLensModelPromise=void 0,null===(i=this._resolveCodeLensesPromise)||void 0===i||i.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),null===(e=this._currentCodeLensModel)||void 0===e||e.dispose()}_onModelChange(){this._localDispose();const t=this._editor.getModel();if(!t)return;if(!this._editor.getOption(17)||t.isTooLargeForTokenization())return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&ic((()=>{const e=this._codeLensCache.get(t);i===e&&(this._codeLensCache.delete(t),this._onModelChange())}),3e4,this._localToDispose));for(const i of this._languageFeaturesService.codeLensProvider.all(t))if("function"==typeof i.onDidChange){const t=i.onDidChange((()=>e.schedule()));this._localToDispose.add(t)}const e=new rc((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=Zh((i=>LJ(this._languageFeaturesService.codeLensProvider,t,i))),this._getCodeLensModelPromise.then((i=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=i,this._codeLensCache.put(t,i);const n=this._provideCodeLensDebounce.update(t,Date.now()-s);e.delay=n,this._renderCodeLensSymbols(i),this._resolveCodeLensesInViewportSoon()}),Li)}),this._provideCodeLensDebounce.get(t));this._localToDispose.add(e),this._localToDispose.add(zi((()=>this._resolveCodeLensesScheduler.cancel()))),this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{var t;this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const e=[];let s=-1;this._lenses.forEach((t=>{t.isValid()&&s!==t.getLineNumber()?(t.update(i),s=t.getLineNumber()):e.push(t)}));const n=new IJ;e.forEach((t=>{t.dispose(n,i),this._lenses.splice(this._lenses.indexOf(t),1)})),n.commit(t)}))})),e.schedule(),this._resolveCodeLensesScheduler.cancel(),null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0}))),this._localToDispose.add(this._editor.onDidFocusEditorWidget((()=>{e.schedule()}))),this._localToDispose.add(this._editor.onDidBlurEditorText((()=>{e.cancel()}))),this._localToDispose.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(zi((()=>{if(this._editor.getModel()){const t=$z.capture(this._editor);this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{this._disposeAllLenses(t,i)}))})),t.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)}))),this._localToDispose.add(this._editor.onMouseDown((t=>{if(9!==t.target.type)return;let i=t.target.element;if("SPAN"===(null==i?void 0:i.tagName)&&(i=i.parentElement),"A"===(null==i?void 0:i.tagName))for(const t of this._lenses){const e=t.getCommand(i);if(e){this._commandService.executeCommand(e.id,...e.arguments||[]).catch((t=>this._notificationService.error(t)));break}}}))),e.schedule()}_disposeAllLenses(t,i){const e=new IJ;for(const t of this._lenses)t.dispose(e,i);t&&e.commit(t),this._lenses.length=0}_renderCodeLensSymbols(t){if(!this._editor.hasModel())return;const i=this._editor.getModel().getLineCount(),e=[];let s;for(const n of t.lenses){const t=n.symbol.range.startLineNumber;t<1||t>i||(s&&s[s.length-1].symbol.range.startLineNumber===t?s.push(n):(s=[n],e.push(s)))}if(!e.length&&!this._lenses.length)return;const n=$z.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new IJ;let n=0,o=0;for(;o<e.length&&n<this._lenses.length;){const t=e[o][0].symbol.range.startLineNumber,h=this._lenses[n].getLineNumber();h<t?(this._lenses[n].dispose(s,i),this._lenses.splice(n,1)):h===t?(this._lenses[n].updateCodeLensSymbols(e[o],s),o++,n++):(this._lenses.splice(n,0,new NJ(e[o],this._editor,s,i,r.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),n++,o++)}for(;n<this._lenses.length;)this._lenses[n].dispose(s,i),this._lenses.splice(n,1);for(;o<e.length;)this._lenses.push(new NJ(e[o],this._editor,s,i,r.codeLensHeight,(()=>this._resolveCodeLensesInViewportSoon()))),o++;s.commit(t)}))})),n.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){var t;null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0;const i=this._editor.getModel();if(!i)return;const e=[],s=[];if(this._lenses.forEach((t=>{const n=t.computeIfNecessary(i);n&&(e.push(n),s.push(t))})),0===e.length)return;const n=Date.now(),r=Zh((t=>{const n=e.map(((e,n)=>{const r=new Array(e.length),o=e.map(((e,s)=>e.symbol.command||"function"!=typeof e.provider.resolveCodeLens?(r[s]=e.symbol,Promise.resolve(void 0)):Promise.resolve(e.provider.resolveCodeLens(i,e.symbol,t)).then((t=>{r[s]=t}),Fi)));return Promise.all(o).then((()=>{t.isCancellationRequested||s[n].isDisposed()||s[n].updateCommands(r)}))}));return Promise.all(n)}));this._resolveCodeLensesPromise=r,this._resolveCodeLensesPromise.then((()=>{const t=this._resolveCodeLensesDebounce.update(i,Date.now()-n);this._resolveCodeLensesScheduler.delay=t,this._currentCodeLensModel&&this._codeLensCache.put(i,this._currentCodeLensModel),this._oldCodeLensModels.clear(),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}),(t=>{Li(t),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}))}async getModel(){var t;return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,(null===(t=this._currentCodeLensModel)||void 0===t?void 0:t.isDisposed)?void 0:this._currentCodeLensModel}};$J.ID="css.editor.codeLens",$J=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([BJ(1,op),BJ(2,YT),BJ(3,po),BJ(4,VF),BJ(5,FJ)],$J),iu($J.ID,$J,1),Xa(class extends Ga{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:PS.hasCodeLensProvider,label:Q(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}async run(t,i){if(!i.hasModel())return;const e=t.get(mj),s=t.get(po),n=t.get(VF),r=i.getSelection().positionLineNumber,o=i.getContribution($J.ID);if(!o)return;const h=await o.getModel();if(!h)return;const c=[];for(const t of h.lenses)t.symbol.command&&t.symbol.range.startLineNumber===r&&c.push({label:t.symbol.command.title,command:t.symbol.command});if(0===c.length)return;const l=await e.pick(c,{canPickMany:!1,placeHolder:Q(0,"Select a command")});if(!l)return;let a=l.command;if(h.isDisposed){const t=await o.getModel(),i=null==t?void 0:t.lenses.find((t=>{var i;return t.symbol.range.startLineNumber===r&&(null===(i=t.symbol.command)||void 0===i?void 0:i.title)===a.title}));if(!i||!i.symbol.command)return;a=i.symbol.command}try{await s.executeCommand(a.id,...a.arguments||[])}catch(t){n.error(t)}}});var WJ=function(t,i){return function(e,s){i(e,s,t)}};class jJ{constructor(t,i){this._editorWorkerClient=new pp(t,!1,"editorWorkerService",i)}async provideDocumentColors(t,i){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new Gg(new Ug(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Gg.Format.CSS.formatRGB(o):Gg.Format.CSS.formatRGBA(o),c=r?Gg.Format.CSS.formatHSL(o):Gg.Format.CSS.formatHSLA(o),l=r?Gg.Format.CSS.formatHex(o):Gg.Format.CSS.formatHexA(o),a=[];return a.push({label:h,textEdit:{range:s,text:h}}),a.push({label:c,textEdit:{range:s,text:c}}),a.push({label:l,textEdit:{range:s,text:l}}),a}}let VJ=class extends Ki{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new jJ(t,i)))}};async function HJ(t,i,e,s=!0){return GJ(new UJ,t,i,e,s)}function zJ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}VJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([WJ(0,no),WJ(1,Nd),WJ(2,op)],VJ),RH(VJ);class UJ{constructor(){}async compute(t,i,e,s){const n=await t.provideDocumentColors(i,e);if(Array.isArray(n))for(const i of n)s.push({colorInfo:i,provider:t});return Array.isArray(n)}}class KJ{constructor(){}async compute(t,i,e,s){const n=await t.provideDocumentColors(i,e);if(Array.isArray(n))for(const t of n)s.push({range:t.range,color:[t.color.red,t.color.green,t.color.blue,t.color.alpha]});return Array.isArray(n)}}class qJ{constructor(t){this.colorInfo=t}async compute(t,i,e,s){const n=await t.provideColorPresentations(i,this.colorInfo,fe.None);return Array.isArray(n)&&s.push(...n),Array.isArray(n)}}async function GJ(t,i,e,s,n){let r,o=!1;const h=[],c=i.ordered(e);for(let i=c.length-1;i>=0;i--){const n=c[i];if(n instanceof jJ)r=n;else try{await t.compute(n,e,s,h)&&(o=!0)}catch(t){Fi(t)}}return o?h:r&&n?(await t.compute(r,e,s,h),h):[]}function ZJ(t,i){const{colorProvider:e}=t.get(op),s=t.get(no).getModel(i);if(!s)throw Ii();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(rd).getValue("editor.defaultColorDecorators",{resource:i})}}mo.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof hs))throw Ii();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=ZJ(t,e);return GJ(new KJ,n,s,fe.None,r)})),mo.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof hs&&Array.isArray(e)&&4===e.length&&bs.isIRange(r)))throw Ii();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=ZJ(t,n),[l,a,u,d]=e;return GJ(new qJ({range:r,color:{red:l,green:a,blue:u,alpha:d}}),h,o,fe.None,c)}));var JJ,QJ=function(t,i){return function(e,s){i(e,s,t)}};const YJ=Object.create({});let XJ=JJ=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._configurationService=i,this._languageFeaturesService=e,this._localToDispose=this._register(new Ui),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new uy(this._editor),this._decoratorLimitReporter=new tQ,this._colorDecorationClassRefs=this._register(new Ui),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:JJ.RECOMPUTE_TIME}),this._register(t.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(t.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(e.colorProvider.onDidChange((()=>this.updateColors()))),this._register(t.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(21),s=t.hasChanged(145);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const t=this._editor.getModel();if(!t)return!1;const i=t.getLanguageId(),e=this._configurationService.getValue(i);if(e&&"object"==typeof e){const t=e.colorDecorators;if(t&&void 0!==t.enable&&!t.enable)return t.enable}return this._editor.getOption(20)}static get(t){return t.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const t=this._editor.getModel();t&&this._languageFeaturesService.colorProvider.has(t)&&(this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._timeoutTimer||(this._timeoutTimer=new sc,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}async beginCompute(){this._computePromise=Zh((async t=>{const i=this._editor.getModel();if(!i)return[];const e=new Yi(!1),s=await HJ(this._languageFeaturesService.colorProvider,i,t,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(i,e.elapsed()),s}));try{const t=await this._computePromise;this.updateDecorations(t),this.updateColorDecorators(t),this._computePromise=null}catch(t){Li(t)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(t){const i=t.map((t=>({range:{startLineNumber:t.colorInfo.range.startLineNumber,startColumn:t.colorInfo.range.startColumn,endLineNumber:t.colorInfo.range.endLineNumber,endColumn:t.colorInfo.range.endColumn},options:aL.EMPTY})));this._editor.changeDecorations((e=>{this._decorationsIds=e.deltaDecorations(this._decorationsIds,i),this._colorDatas=new Map,this._decorationsIds.forEach(((i,e)=>this._colorDatas.set(i,t[e])))}))}updateColorDecorators(t){this._colorDecorationClassRefs.clear();const i=[],e=this._editor.getOption(21);for(let s=0;s<t.length&&i.length<e;s++){const{red:e,green:n,blue:r,alpha:o}=t[s].colorInfo.color,h=new Ug(Math.round(255*e),Math.round(255*n),Math.round(255*r),o),c=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:`rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`}));i.push({range:{startLineNumber:t[s].colorInfo.range.startLineNumber,startColumn:t[s].colorInfo.range.startColumn,endLineNumber:t[s].colorInfo.range.endLineNumber,endColumn:t[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:" ",inlineClassName:`${c.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:YJ}}})}this._decoratorLimitReporter.update(t.length,e<t.length&&e),this._colorDecoratorIds.set(i)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(t){const i=this._editor.getModel();if(!i)return null;const e=i.getDecorationsInRange(bs.fromPositions(t,t)).filter((t=>this._colorDatas.has(t.id)));return 0===e.length?null:this._colorDatas.get(e[0].id)}isColorDecoration(t){return this._colorDecoratorIds.has(t)}};XJ.ID="editor.contrib.colorDetector",XJ.RECOMPUTE_TIME=1e3,XJ=JJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([QJ(1,rd),QJ(2,op),QJ(3,YT)],XJ);class tQ{constructor(){this._onDidChange=new ne,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}iu(XJ.ID,XJ,1);class iQ{get color(){return this._color}set color(t){this._color.equals(t)||(this._color=t,this._onDidChangeColor.fire(t))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(t){this._colorPresentations=t,this.presentationIndex>t.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(t,i,e){this.presentationIndex=e,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ne,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ne,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=t,this._color=t,this._colorPresentations=i}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(t,i){let e=-1;for(let t=0;t<this.colorPresentations.length;t++)if(i.toLowerCase()===this.colorPresentations[t].label){e=t;break}if(-1===e){const t=i.split("(")[0].toLowerCase();for(let i=0;i<this.colorPresentations.length;i++)if(this.colorPresentations[i].label.toLowerCase().startsWith(t)){e=i;break}}-1!==e&&e!==this.presentationIndex&&(this.presentationIndex=e,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}const eQ=Fa;class sQ extends Ki{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=eQ(".colorpicker-header"),xa(t,this._domNode),this._pickedColorNode=xa(this._domNode,eQ(".picked-color")),xa(this._pickedColorNode,eQ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=xa(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const n=Q(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",n),this._originalColorNode=xa(this._domNode,eQ(".original-color")),this._originalColorNode.style.backgroundColor=Gg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(vv)||Gg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(vv)||Gg.white}))),this._register(Il(this._pickedColorNode,ya.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Il(this._originalColorNode,ya.CLICK,(()=>{this.model.color=this.model.originalColor,this.model.flushColor()}))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this._register(i.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=Gg.Format.CSS.format(i.color)||"",this._pickedColorNode.classList.toggle("light",i.color.rgba.a<.5?this.backgroundColor.isLighter():i.color.isLighter()),this.onDidChangeColor(this.model.color),this.showingStandaloneColorPicker&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new nQ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Gg.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class nQ extends Ki{constructor(t){super(),this._onClicked=this._register(new ne),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),xa(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),xa(this._button,i),xa(i,eQ(".button"+go.asCSSSelector(AV("color-picker-close",xs.close,Q(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class rQ extends Ki{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=eQ(".colorpicker-body"),xa(t,this._domNode),this._saturationBox=new oQ(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new cQ(this._domNode,this.model,s),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new lQ(this._domNode,this.model,s),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),s&&(this._insertButton=this._register(new aQ(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:t,v:i}){const e=this.model.color.hsva;this.model.color=new Gg(new qg(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Gg(new qg(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Gg(new qg(360===e?0:e,i.s,i.v,i.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}class oQ extends Ki{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,this._domNode=eQ(".saturation-wrap"),xa(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",xa(this._domNode,this._canvas),this.selection=eQ(".saturation-selection"),xa(this._domNode,this.selection),this.layout(),this._register(Il(this._domNode,ya.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;this.monitor=this._register(new Um);const i=Zl(this._domNode);t.target!==this.selection&&this.onDidChangePosition(t.offsetX,t.offsetY),this.monitor.startMonitoring(t.target,t.pointerId,t.buttons,(t=>this.onDidChangePosition(t.pageX-i.left,t.pageY-i.top)),(()=>null));const e=Il(t.target.ownerDocument,ya.POINTER_UP,(()=>{this._onColorFlushed.fire(),e.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)}),!0)}onDidChangePosition(t,i){const e=Math.max(0,Math.min(1,t/this.width)),s=Math.max(0,Math.min(1,1-i/this.height));this.paintSelection(e,s),this._onDidChange.fire({s:e,v:s})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const t=this.model.color.hsva;this.paintSelection(t.s,t.v)}paint(){const t=new Gg(new qg(this.model.color.hsva.h,1,1,1)),i=this._canvas.getContext("2d"),e=i.createLinearGradient(0,0,this._canvas.width,0);e.addColorStop(0,"rgba(255, 255, 255, 1)"),e.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),e.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=Gg.Format.CSS.format(t),i.fill(),i.fillStyle=e,i.fill(),i.fillStyle=s,i.fill()}paintSelection(t,i){this.selection.style.left=t*this.width+"px",this.selection.style.top=this.height-i*this.height+"px"}onDidChangeColor(t){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const i=t.hsva;this.paintSelection(i.s,i.v)}}class hQ extends Ki{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ne,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=xa(t,eQ(".standalone-strip")),this.overlay=xa(this.domNode,eQ(".standalone-overlay"))):(this.domNode=xa(t,eQ(".strip")),this.overlay=xa(this.domNode,eQ(".overlay"))),this.slider=xa(this.domNode,eQ(".slider")),this.slider.style.top="0px",this._register(Il(this.domNode,ya.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onDidChangeColor(t){const i=this.getValue(t);this.updateSliderPosition(i)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new Um),e=Zl(this.domNode);this.domNode.classList.add("grabbing"),t.target!==this.slider&&this.onDidChangeTop(t.offsetY),i.startMonitoring(t.target,t.pointerId,t.buttons,(t=>this.onDidChangeTop(t.pageY-e.top)),(()=>null));const s=Il(t.target.ownerDocument,ya.POINTER_UP,(()=>{this._onColorFlushed.fire(),s.dispose(),i.stopMonitoring(!0),this.domNode.classList.remove("grabbing")}),!0)}onDidChangeTop(t){const i=Math.max(0,Math.min(1,1-t/this.height));this.updateSliderPosition(i),this._onDidChange.fire(i)}updateSliderPosition(t){this.slider.style.top=(1-t)*this.height+"px"}}class cQ extends hQ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){super.onDidChangeColor(t);const{r:i,g:e,b:s}=t.rgba,n=new Gg(new Ug(i,e,s,1)),r=new Gg(new Ug(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class lQ extends hQ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class aQ extends Ki{constructor(t){super(),this._onClicked=this._register(new ne),this.onClicked=this._onClicked.event,this._button=xa(t,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._button.onclick=()=>{this._onClicked.fire()}}get button(){return this._button}}class uQ extends Yy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Or.onDidChange((()=>this.layout())));const r=eQ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new sQ(r,this.model,s,n)),this.body=this._register(new rQ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var dQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},fQ=function(t,i){return function(e,s){i(e,s,t)}};class gQ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s,this.forceShowAtRange=!0}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let pQ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return dc.fromPromise(this._computeAsync(t,i,e))}async _computeAsync(t,i,e){if(!this._editor.hasModel())return[];const s=XJ.get(this._editor);if(!s)return[];for(const t of i){if(!s.isColorDecoration(t))continue;const i=s.getColorData(t.range.getStartPosition());if(i)return[await vQ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}renderHoverParts(t,i){return bQ(this,this._editor,this._themeService,i,t)}};pQ=dQ([fQ(1,Nk)],pQ);class mQ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let wQ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}async createColorHover(t,i,e){if(!this._editor.hasModel())return null;if(!XJ.get(this._editor))return null;const s=await HJ(e,this._editor.getModel(),fe.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;bs.containsRange(e.range,t.range)&&(n=e,r=i.provider)}const o=null!=n?n:t,h=null!=r?r:i,c=!!n;return{colorHover:await vQ(this,this._editor.getModel(),o,h),foundInEditor:c}}async updateEditorModel(t){if(!this._editor.hasModel())return;const i=t.model;let e=new bs(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(await kQ(this._editor.getModel(),i,this._color,e,t),e=yQ(this._editor,e,i))}renderHoverParts(t,i){return bQ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};async function vQ(t,i,e,s){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Ug(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),a=new Gg(l),u=await zJ(i,e,s,fe.None),d=new iQ(a,[],0);return d.colorPresentations=u||[],d.guessColorPresentation(a,n),t instanceof pQ?new gQ(t,bs.lift(e.range),d,s):new mQ(t,bs.lift(e.range),d,s)}function bQ(t,i,e,s,n){if(0===s.length||!i.hasModel())return Ki.None;if(n.setMinimumDimensions){const t=i.getOption(66)+8;n.setMinimumDimensions(new ql(302,t))}const r=new Ui,o=s[0],h=i.getModel(),c=o.model,l=r.add(new uQ(n.fragment,c,i.getOption(141),e,t instanceof wQ));n.setColorPicker(l);let a=!1,u=new bs(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof wQ){const i=s[0].model.color;t.color=i,kQ(h,c,i,u,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((async t=>{await kQ(h,c,t,u,o),a=!0,u=yQ(i,u,c,n)})));return r.add(c.onDidChangeColor((t=>{kQ(h,c,t,u,o)}))),r.add(i.onDidChangeModelContent((()=>{a?a=!1:(n.hide(),i.focus())}))),r}function yQ(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new bs(e.presentation.textEdit.range.startLineNumber,e.presentation.textEdit.range.startColumn,e.presentation.textEdit.range.endLineNumber,e.presentation.textEdit.range.endColumn);const i=t.getModel()._setTrackedRange(null,r,3);t.pushUndoStop(),t.executeEdits("colorpicker",n),r=t.getModel()._getTrackedRange(i)||r}else n=[{range:i,text:e.presentation.label,forceMoveMarkers:!1}],r=i.setEndPosition(i.endLineNumber,i.startColumn+e.presentation.label.length),t.pushUndoStop(),t.executeEdits("colorpicker",n);return e.presentation.additionalTextEdits&&(n=[...e.presentation.additionalTextEdits],t.executeEdits("colorpicker",n),s&&s.hide()),t.pushUndoStop(),r}async function kQ(t,i,e,s,n){const r=await zJ(t,{range:s,color:{red:e.rgba.r/255,green:e.rgba.g/255,blue:e.rgba.b/255,alpha:e.rgba.a}},n.provider,fe.None);i.colorPresentations=r||[]}function CQ(t,i){return!!t[i]}wQ=dQ([fQ(1,Nk)],wQ);class SQ{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=CQ(t.event,i.triggerModifier),this.hasSideBySideModifier=CQ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class xQ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=CQ(t,i.triggerModifier)}}class DQ{constructor(t,i,e,s){this.triggerKey=t,this.triggerModifier=i,this.triggerSideBySideKey=e,this.triggerSideBySideModifier=s}equals(t){return this.triggerKey===t.triggerKey&&this.triggerModifier===t.triggerModifier&&this.triggerSideBySideKey===t.triggerSideBySideKey&&this.triggerSideBySideModifier===t.triggerSideBySideModifier}}function EQ(t){return"altKey"===t?pt?new DQ(57,"metaKey",6,"altKey"):new DQ(5,"ctrlKey",6,"altKey"):pt?new DQ(6,"altKey",57,"metaKey"):new DQ(6,"altKey",5,"ctrlKey")}class AQ extends Ki{constructor(t,i){var e;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ne),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ne),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ne),this.onCancel=this._onCancel.event,this._editor=t,this._extractLineNumberFromMouseEvent=null!==(e=null==i?void 0:i.extractLineNumberFromMouseEvent)&&void 0!==e?e:t=>t.target.position?t.target.position.lineNumber:0,this._opts=EQ(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(77)){const t=EQ(this._editor.getOption(77));if(this._opts.equals(t))return;this._opts=t,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}}))),this._register(this._editor.onMouseMove((t=>this._onEditorMouseMove(new SQ(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new SQ(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new SQ(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new xQ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new xQ(t,this._opts))))),this._register(this._editor.onMouseDrag((()=>this._resetHandler()))),this._register(this._editor.onDidChangeCursorSelection((t=>this._onDidChangeCursorSelection(t)))),this._register(this._editor.onDidChangeModel((()=>this._resetHandler()))),this._register(this._editor.onDidChangeModelContent((()=>this._resetHandler()))),this._register(this._editor.onDidScrollChange((t=>{(t.scrollTopChanged||t.scrollLeftChanged)&&this._resetHandler()})))}_onDidChangeCursorSelection(t){t.selection&&t.selection.startColumn!==t.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(t){this._lastMouseMoveEvent=t,this._onMouseMoveOrRelevantKeyDown.fire([t,null])}_onEditorMouseDown(t){this._hasTriggerKeyOnMouseDown=t.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(t)}_onEditorMouseUp(t){const i=this._extractLineNumberFromMouseEvent(t);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===i&&this._onExecute.fire(t)}_onEditorKeyDown(t){this._lastMouseMoveEvent&&(t.keyCodeIsTriggerKey||t.keyCodeIsSideBySideKey&&t.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,t]):t.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(t){t.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var MQ=function(t,i){return function(e,s){i(e,s,t)}};let LQ=class extends gT{constructor(t,i,e,s,n,r,o,h,c,l,a,u,d){super(t,{...s.getRawOptions(),overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()},e,n,r,o,h,c,l,a,u,d),this._parentEditor=s,this._overwriteOptions=i,super.updateOptions(this._overwriteOptions),this._register(s.onDidChangeConfiguration((t=>this._onParentConfigurationChanged(t))))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(t){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(t){K(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};LQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([MQ(4,io),MQ(5,so),MQ(6,po),MQ(7,th),MQ(8,Nk),MQ(9,VF),MQ(10,Om),MQ(11,Nd),MQ(12,op)],LQ);const FQ=new Gg(new Ug(0,122,204)),TQ={showArrow:!0,showFrame:!0,className:"",frameColor:FQ,arrowColor:FQ,keepEditorSelection:!1};class RQ{constructor(t,i,e,s,n,r,o,h){this.id="",this.domNode=t,this.afterLineNumber=i,this.afterColumn=e,this.heightInLines=s,this.showInHiddenAreas=o,this.ordinal=h,this._onDomNodeTop=n,this._onComputedHeight=r}onDomNodeTop(t){this._onDomNodeTop(t)}onComputedHeight(t){this._onComputedHeight(t)}}class OQ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class _Q{constructor(t){this._editor=t,this._ruleName=_Q._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),ma(this._ruleName)}set color(t){this._color!==t&&(this._color=t,this._updateStyle())}set height(t){this._height!==t&&(this._height=t,this._updateStyle())}_updateStyle(){ma(this._ruleName),pa(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `)}show(t){1===t.column&&(t={lineNumber:t.lineNumber,column:2}),this._decorations.set([{range:bs.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}_Q._IdGenerator=new _I(".arrow-decoration-");class IQ{constructor(t,i={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Ui,this.container=null,this._isShowing=!1,this.editor=t,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=V(i),K(this.options,TQ,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange((t=>{const i=this._getWidth(t);this.domNode.style.width=i+"px",this.domNode.style.left=this._getLeft(t)+"px",this._onWidth(i)})))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._viewZone=null})),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new _Q(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(t){t.frameColor&&(this.options.frameColor=t.frameColor),t.arrowColor&&(this.options.arrowColor=t.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const t=this.options.frameColor.toString();this.container.style.borderTopColor=t,this.container.style.borderBottomColor=t}if(this._arrow&&this.options.arrowColor){const t=this.options.arrowColor.toString();this._arrow.color=t}}_getWidth(t){return t.width-t.minimap.minimapWidth-t.verticalScrollbarWidth}_getLeft(t){return t.minimap.minimapWidth>0&&0===t.minimap.minimapLeft?t.minimap.minimapWidth:0}_onViewZoneTop(t){this.domNode.style.top=t+"px"}_onViewZoneHeight(t){var i;if(this.domNode.style.height=`${t}px`,this.container){const i=t-this._decoratingElementsHeight();this.container.style.height=`${i}px`;const e=this.editor.getLayoutInfo();this._doLayout(i,this._getWidth(e))}null===(i=this._resizeSash)||void 0===i||i.layout()}get position(){const t=this._positionMarkerId.getRange(0);if(t)return t.getStartPosition()}show(t,i){const e=bs.isIRange(t)?bs.lift(t):bs.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:aL.EMPTY}])}hide(){var t;this._viewZone&&(this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id)})),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),null===(t=this._arrow)||void 0===t||t.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const t=this.editor.getOption(66);let i=0;return this.options.showArrow&&(i+=2*Math.round(t/3)),this.options.showFrame&&(i+=2*Math.round(t/9)),i}_showImpl(t,i){const e=t.getStartPosition(),s=this.editor.getLayoutInfo(),n=this._getWidth(s);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(s)+"px";const r=document.createElement("div");r.style.overflow="hidden";const o=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const t=Math.max(12,this.editor.getLayoutInfo().height/o*.8);i=Math.min(i,t)}let h=0,c=0;if(this._arrow&&this.options.showArrow&&(h=Math.round(o/3),this._arrow.height=h,this._arrow.show(e)),this.options.showFrame&&(c=Math.round(o/9)),this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new RQ(r,e.lineNumber,e.column,i,(t=>this._onViewZoneTop(t)),(t=>this._onViewZoneHeight(t)),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=t.addZone(this._viewZone),this._overlayWidget=new OQ("vs.editor.contrib.zoneWidget"+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)})),this.container&&this.options.showFrame){const t=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=t+"px",this.container.style.borderBottomWidth=t+"px"}const l=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=l+"px",this.container.style.overflow="hidden"),this._doLayout(l,n),this.options.keepEditorSelection||this.editor.setSelection(t);const a=this.editor.getModel();if(a){const i=a.validateRange(new bs(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===a.getLineCount())}}revealRange(t,i){i?this.editor.revealLineNearTop(t.endLineNumber,0):this.editor.revealRange(t,0)}setCssClass(t,i){this.container&&(i&&this.container.classList.remove(i),this.container.classList.add(t))}_onWidth(t){}_doLayout(t,i){}_relayout(t){this._viewZone&&this._viewZone.heightInLines!==t&&this.editor.changeViewZones((i=>{this._viewZone&&(this._viewZone.heightInLines=t,i.layoutZone(this._viewZone.id))}))}_initSash(){if(this._resizeSash)return;let t;this._resizeSash=this._disposables.add(new AB(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0),this._disposables.add(this._resizeSash.onDidStart((i=>{this._viewZone&&(t={startY:i.startY,heightInLines:this._viewZone.heightInLines})}))),this._disposables.add(this._resizeSash.onDidEnd((()=>{t=void 0}))),this._disposables.add(this._resizeSash.onDidChange((i=>{if(t){const e=(i.currentY-t.startY)/this.editor.getOption(66),s=e<0?Math.ceil(e):Math.floor(e),n=t.heightInLines+s;n>5&&n<35&&this._relayout(n)}})))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(null===this.domNode.style.height?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const t=this.editor.getLayoutInfo();return t.width-t.minimap.minimapWidth}}var PQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},NQ=function(t,i){return function(e,s){i(e,s,t)}};const BQ=eo("IPeekViewService");var $Q;gd(BQ,class{constructor(){this._widgets=new Map}addExclusiveWidget(t,i){const e=this._widgets.get(t);e&&(e.listener.dispose(),e.widget.dispose()),this._widgets.set(t,{widget:i,listener:i.onDidClose((()=>{const e=this._widgets.get(t);e&&e.widget===i&&(e.listener.dispose(),this._widgets.delete(t))}))})}},1),function(t){t.inPeekEditor=new Xo("inReferenceSearchEditor",!0,Q(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}($Q||($Q={}));let WQ=class{constructor(t,i){t instanceof LQ&&$Q.inPeekEditor.bindTo(i)}dispose(){}};WQ.ID="editor.contrib.referenceController",WQ=PQ([NQ(1,th)],WQ),iu(WQ.ID,WQ,0);const jQ={headerBackgroundColor:Gg.white,primaryHeadingColor:Gg.fromHex("#333333"),secondaryHeadingColor:Gg.fromHex("#6c6c6cb3")};let VQ=class extends IQ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ne,this.onDidClose=this._onDidClose.event,K(this.options,jQ,!1)}dispose(){this.disposed||(this.disposed=!0,super.dispose(),this._onDidClose.fire(this))}style(t){const i=this.options;t.headerBackgroundColor&&(i.headerBackgroundColor=t.headerBackgroundColor),t.primaryHeadingColor&&(i.primaryHeadingColor=t.primaryHeadingColor),t.secondaryHeadingColor&&(i.secondaryHeadingColor=t.secondaryHeadingColor),super.style(t)}_applyStyles(){super._applyStyles();const t=this.options;this._headElement&&t.headerBackgroundColor&&(this._headElement.style.backgroundColor=t.headerBackgroundColor.toString()),this._primaryHeading&&t.primaryHeadingColor&&(this._primaryHeading.style.color=t.primaryHeadingColor.toString()),this._secondaryHeading&&t.secondaryHeadingColor&&(this._secondaryHeading.style.color=t.secondaryHeadingColor.toString()),this._bodyElement&&t.frameColor&&(this._bodyElement.style.borderColor=t.frameColor.toString())}_fillContainer(t){this.setCssClass("peekview-widget"),this._headElement=Fa(".head"),this._bodyElement=Fa(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Fa(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Nl(this._titleElement,"click",(t=>this._onTitleClick(t)))),xa(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Fa("span.filename"),this._secondaryHeading=Fa("span.dirname"),this._metaHeading=Fa("span.meta"),xa(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=Fa(".peekview-actions");xa(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new IN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new oo("peekview.close",Q(0,"Close"),go.asClassName(xs.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:_N.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(t){}setTitle(t,i){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=t,this._primaryHeading.setAttribute("title",t),i?this._secondaryHeading.innerText=i:Ol(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Ta(this._metaHeading)):Ra(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(66)),s=Math.round(t-(e+2));this._doLayoutHead(e,i),this._doLayoutBody(s,i)}_doLayoutHead(t,i){this._headElement&&(this._headElement.style.height=`${t}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(t,i){this._bodyElement&&(this._bodyElement.style.height=`${t}px`)}};VQ=PQ([NQ(2,io)],VQ);const HQ=Jm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view title area.")),zQ=Jm("peekViewTitleLabel.foreground",{dark:Gg.white,light:Gg.black,hcDark:Gg.white,hcLight:Gw},Q(0,"Color of the peek view title.")),UQ=Jm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},Q(0,"Color of the peek view title info.")),KQ=Jm("peekView.border",{dark:zw,light:zw,hcDark:iw,hcLight:iw},Q(0,"Color of the peek view borders and arrow.")),qQ=Jm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view result list."));Jm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color for line nodes in the peek view result list.")),Jm("peekViewResult.fileForeground",{dark:Gg.white,light:"#1E1E1E",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color for file nodes in the peek view result list.")),Jm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},Q(0,"Background color of the selected entry in the peek view result list.")),Jm("peekViewResult.selectionForeground",{dark:Gg.white,light:"#6C6C6C",hcDark:Gg.white,hcLight:Gw},Q(0,"Foreground color of the selected entry in the peek view result list."));const GQ=Jm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Gg.black,hcLight:Gg.white},Q(0,"Background color of the peek view editor."));Jm("peekViewEditorGutter.background",{dark:GQ,light:GQ,hcDark:GQ,hcLight:GQ},Q(0,"Background color of the gutter in the peek view editor.")),Jm("peekViewEditorStickyScroll.background",{dark:GQ,light:GQ,hcDark:GQ,hcLight:GQ},Q(0,"Background color of sticky scroll in the peek view editor.")),Jm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},Q(0,"Match highlight color in the peek view result list.")),Jm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},Q(0,"Match highlight color in the peek view editor.")),Jm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:ew,hcLight:ew},Q(0,"Match highlight border in the peek view editor."));class ZQ{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=II.nextId()}get uri(){return this.link.uri}get range(){var t,i;return null!==(i=null!==(t=this._range)&&void 0!==t?t:this.link.targetSelectionRange)&&void 0!==i?i:this.link.range}set range(t){this._range=t,this._rangeCallback(this)}get ariaMessage(){var t;const i=null===(t=this.parent.getPreview(this))||void 0===t?void 0:t.preview(this.range);return i?Q(0,"{0} in {1} on line {2} at column {3}",i.value,eA(this.uri),this.range.startLineNumber,this.range.startColumn):Q(0,"in {0} on line {1} at column {2}",eA(this.uri),this.range.startLineNumber,this.range.startColumn)}}class JQ{constructor(t){this._modelReference=t}dispose(){this._modelReference.dispose()}preview(t,i=8){const e=this._modelReference.object.textEditorModel;if(!e)return;const{startLineNumber:s,startColumn:n,endLineNumber:r,endColumn:o}=t,h=e.getWordUntilPosition({lineNumber:s,column:n-i}),c=new bs(s,h.startColumn,s,n),l=new bs(r,o,r,1073741824),a=e.getValueInRange(c).replace(/^\s+/,""),u=e.getValueInRange(t);return{value:a+u+e.getValueInRange(l).replace(/\s+$/,""),highlight:{start:a.length,end:a.length+u.length}}}}class QQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new Eg}dispose(){Vi(this._previews.values()),this._previews.clear()}getPreview(t){return this._previews.get(t.uri)}get ariaMessage(){const t=this.children.length;return 1===t?Q(0,"1 symbol in {0}, full path {1}",eA(this.uri),this.uri.fsPath):Q(0,"{0} symbols in {1}, full path {2}",t,eA(this.uri),this.uri.fsPath)}async resolve(t){if(0!==this._previews.size)return this;for(const i of this.children)if(!this._previews.has(i.uri))try{const e=await t.createModelReference(i.uri);this._previews.set(i.uri,new JQ(e))}catch(t){Li(t)}return this}}class YQ{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ne,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(YQ._compareReferences);for(const i of t)if(s&&XE.isEqual(s.uri,i.uri,!0)||(s=new QQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==YQ._compareReferences(i,s.children[s.children.length-1])){const t=new ZQ(e===i,s,i,(t=>this._onDidChangeReferenceRange.fire(t)));this.references.push(t),s.children.push(t)}}dispose(){Vi(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new YQ(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?Q(0,"No results found"):1===this.references.length?Q(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?Q(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):Q(0,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(t,i){const{parent:e}=t;let s=e.children.indexOf(t);const n=e.children.length,r=e.parent.groups.length;return 1===r||i&&s+1<n||!i&&s>0?(s=i?(s+1)%n:(s+n-1)%n,e.children[s]):(s=e.parent.groups.indexOf(e),i?(s=(s+1)%r,e.parent.groups[s].children[0]):(s=(s+r-1)%r,e.parent.groups[s].children[e.parent.groups[s].children.length-1]))}nearestReference(t,i){const e=this.references.map(((e,s)=>({idx:s,prefixLen:sr(e.uri.toString(),t.toString()),offsetDist:100*Math.abs(e.range.startLineNumber-i.lineNumber)+Math.abs(e.range.startColumn-i.column)}))).sort(((t,i)=>t.prefixLen>i.prefixLen?-1:t.prefixLen<i.prefixLen?1:t.offsetDist<i.offsetDist?-1:t.offsetDist>i.offsetDist?1:0))[0];if(e)return this.references[e.idx]}referenceAt(t,i){for(const e of this.references)if(e.uri.toString()===t.toString()&&bs.containsPosition(e.range,i))return e}firstReference(){for(const t of this.references)if(t.isProviderFirst)return t;return this.references[0]}static _compareReferences(t,i){return XE.compare(t.uri,i.uri)||bs.compareRangesUsingStarts(t.range,i.range)}}var XQ,tY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},iY=function(t,i){return function(e,s){i(e,s,t)}};let eY=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof YQ||t instanceof QQ}getChildren(t){if(t instanceof YQ)return t.groups;if(t instanceof QQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};eY=tY([iY(0,ro)],eY);class sY{getHeight(){return 23}getTemplateId(t){return t instanceof QQ?hY.id:lY.id}}let nY=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof ZQ){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return eA(t.uri)}};nY=tY([iY(0,HC)],nY);class rY{getId(t){return t instanceof ZQ?t.id:t.uri}}let oY=class extends Ki{constructor(t,i){super(),this._labelService=i;const e=document.createElement("div");e.classList.add("reference-file"),this.file=this._register(new Tj(e,{supportHighlights:!0})),this.badge=new yj(xa(e,Fa(".count")),{},bN),t.appendChild(e)}set(t,i){const e=nA(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(e,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const s=t.children.length;this.badge.setCount(s),this.badge.setTitleFormat(Q(0,s>1?"{0} references":"{0} reference",s))}};oY=tY([iY(1,CO)],oY);let hY=XQ=class{constructor(t){this._instantiationService=t,this.templateId=XQ.id}renderTemplate(t){return this._instantiationService.createInstance(oY,t)}renderElement(t,i,e){e.set(t.element,q_(t.filterData))}disposeTemplate(t){t.dispose()}};hY.id="FileReferencesRenderer",hY=XQ=tY([iY(0,io)],hY);class cY{constructor(t){this.label=new Lj(t)}set(t,i){var e;const s=null===(e=t.parent.getPreview(t))||void 0===e?void 0:e.preview(t.range);if(s&&s.value){const{value:t,highlight:e}=s;i&&!rI.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,q_(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${eA(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class lY{constructor(){this.templateId=lY.id}renderTemplate(t){return new cY(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}lY.id="OneReferenceRenderer";class aY{getWidgetAriaLabel(){return Q(0,"References")}getAriaLabel(t){return t.ariaMessage}}var uY=function(t,i){return function(e,s){i(e,s,t)}};class dY{constructor(t,i){this._editor=t,this._model=i,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Ui,this._callOnModelChange=new Ui,this._callOnDispose.add(this._editor.onDidChangeModel((()=>this._onModelChanged()))),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const t=this._editor.getModel();if(t)for(const i of this._model.references)if(i.uri.toString()===t.uri.toString())return void this._addDecorations(i.parent)}_addDecorations(t){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations((()=>this._onDecorationChanged())));const i=[],e=[];for(let s=0,n=t.children.length;s<n;s++){const n=t.children[s];this._decorationIgnoreSet.has(n.id)||n.uri.toString()===this._editor.getModel().uri.toString()&&(i.push({range:n.range,options:dY.DecorationOptions}),e.push(s))}this._editor.changeDecorations((s=>{const n=s.deltaDecorations([],i);for(let i=0;i<n.length;i++)this._decorations.set(n[i],t.children[e[i]])}))}_onDecorationChanged(){const t=[],i=this._editor.getModel();if(i){for(const[e,s]of this._decorations){const n=i.getDecorationRange(e);if(!n)continue;let r=!1;bs.equalsRange(n,s.range)||((bs.spansMultipleLines(n)||s.range.endColumn-s.range.startColumn!=n.endColumn-n.startColumn)&&(r=!0),r?(this._decorationIgnoreSet.add(s.id),t.push(e)):s.range=n)}for(let i=0,e=t.length;i<e;i++)this._decorations.delete(t[i]);this._editor.removeDecorations(t)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}}dY.DecorationOptions=aL.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class fY{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(t){let i,e;try{const s=JSON.parse(t);i=s.ratio,e=s.heightInLines}catch(t){}return{ratio:i||.7,heightInLines:e||18}}}class gY extends rj{}let pY=class extends VQ{constructor(t,i,e,s,n,r,o,h,c,l,a,u){super(t,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=i,this.layoutData=e,this._textModelResolverService=n,this._instantiationService=r,this._peekViewService=o,this._uriLabel=h,this._undoRedoService=c,this._keybindingService=l,this._languageService=a,this._languageConfigurationService=u,this._disposeOnNewModel=new Ui,this._callOnDispose=new Ui,this._onDidSelectReference=new ne,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ql(0,0),this._applyTheme(s.getColorTheme()),this._callOnDispose.add(s.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(t,this),this.create()}dispose(){this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Vi(this._preview),Vi(this._previewNotAvailableMessage),Vi(this._tree),Vi(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(t){const i=t.getColor(KQ)||Gg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(HQ)||Gg.transparent,primaryHeadingColor:t.getColor(zQ),secondaryHeadingColor:t.getColor(UQ)})}show(t){super.show(t,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(t){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"title"})}_fillBody(t){this.setCssClass("reference-zone-widget"),this._messageContainer=xa(t,Fa("div.messages")),Ra(this._messageContainer),this._splitView=new _B(t,{orientation:1}),this._previewContainer=xa(t,Fa("div.preview.inline")),this._preview=this._instantiationService.createInstance(LQ,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Ra(this._previewContainer),this._previewNotAvailableMessage=new tL(Q(0,"no preview available"),Ld,tL.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=xa(t,Fa("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new aY,keyboardNavigationLabelProvider:this._instantiationService.createInstance(nY),identityProvider:new rY,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:qQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Nl(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(gY,"ReferencesWidget",this._treeContainer,new sY,[this._instantiationService.createInstance(hY),this._instantiationService.createInstance(lY)],this._instantiationService.createInstance(eY),i),this._splitView.addView({onDidChange:Xi.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},OB.Distribute),this._splitView.addView({onDidChange:Xi.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:t=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${t}px`,this._tree.layout(this._dim.height,t)}},OB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const e=(t,i)=>{t instanceof ZQ&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{e(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Ra(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ql(i,t),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(i),this._splitView.resizeView(0,i*this.layoutData.ratio)}setSelection(t){return this._revealReference(t,!0).then((()=>{this._model&&(this._tree.setSelection([t]),this._tree.setFocus([t]))}))}setModel(t){return this._disposeOnNewModel.clear(),this._model=t,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=Q(0,"No results"),Ta(this._messageContainer),Promise.resolve(void 0)):(Ra(this._messageContainer),this._decorationsManager=new dY(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange((t=>this._tree.rerender(t)))),this._disposeOnNewModel.add(this._preview.onMouseDown((t=>{const{event:i,target:e}=t;if(2!==i.detail)return;const s=this._getFocusedReference();s&&this._onDidSelectReference.fire({element:{uri:s.uri,range:e.range},kind:i.ctrlKey||i.metaKey||i.altKey?"side":"open",source:"editor"})}))),this.container.classList.add("results-loaded"),Ta(this._treeContainer),Ta(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(1===this._model.groups.length?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[t]=this._tree.getFocus();return t instanceof ZQ?t:t instanceof QQ&&t.children.length>0?t.children[0]:void 0}async revealReference(t){await this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}async _revealReference(t,i){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==dl.inMemory?this.setTitle(iA(t.uri),this._uriLabel.getUriLabel(nA(t.uri))):this.setTitle(Q(0,"References"));const e=this._textModelResolverService.createModelReference(t.uri);this._tree.getInput()===t.parent||(i&&this._tree.reveal(t.parent),await this._tree.expand(t.parent)),this._tree.reveal(t);const s=await e;if(!this._model)return void s.dispose();Vi(this._previewModelReference);const n=s.object;if(n){const i=this._preview.getModel()===n.textEditorModel?0:1,e=bs.lift(t.range).collapseToStart();this._previewModelReference=s,this._preview.setModel(n.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),s.dispose()}};pY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([uY(3,Nk),uY(4,ro),uY(5,io),uY(6,BQ),uY(7,CO),uY(8,zM),uY(9,HC),uY(10,ud),uY(11,Nd)],pY);var mY,wY=function(t,i){return function(e,s){i(e,s,t)}};const vY=new Xo("referenceSearchVisible",!1,Q(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let bY=mY=class{static get(t){return t.getContribution(mY.ID)}constructor(t,i,e,s,n,r,o,h){this._defaultTreeKeyboardSupport=t,this._editor=i,this._editorService=s,this._notificationService=n,this._instantiationService=r,this._storageService=o,this._configurationService=h,this._disposables=new Ui,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=vY.bindTo(e)}dispose(){var t,i;this._referenceSearchVisible.reset(),this._disposables.dispose(),null===(t=this._widget)||void 0===t||t.dispose(),null===(i=this._model)||void 0===i||i.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(t,i,e){let s;if(this._widget&&(s=this._widget.position),this.closeWidget(),s&&t.containsPosition(s))return;this._peekMode=e,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const n="peekViewLayout",r=fY.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(pY,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(Q(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:s}=t;if(i)switch(s){case"open":"editor"===t.source&&this._configurationService.getValue("editor.stablePeek")||this.openReference(i,!1,!1);break;case"side":this.openReference(i,!0,!1);break;case"goto":e?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const o=++this._requestIdPool;i.then((i=>{var e;if(o===this._requestIdPool&&this._widget)return null===(e=this._model)||void 0===e||e.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":Q(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,e=new vs(t.startLineNumber,t.startColumn),s=this._model.nearestReference(i,e);if(s)return this._widget.setSelection(s).then((()=>{this._widget&&"editor"===this._editor.getOption(86)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(t){if(!this._editor.hasModel()||!this._model||!this._widget)return;const i=this._widget.position;if(!i)return;const e=this._model.nearestReference(this._editor.getModel().uri,i);if(!e)return;const s=this._model.nextOrPreviousReference(e,t),n=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(s),await this._gotoReference(s,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(t){this._editor.hasModel()&&this._model&&this._widget&&await this._widget.revealReference(t)}closeWidget(t=!0){var i,e;null===(i=this._widget)||void 0===i||i.dispose(),null===(e=this._model)||void 0===e||e.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,t&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(t,i){var e;null===(e=this._widget)||void 0===e||e.hide(),this._ignoreModelChangeEvent=!0;const s=bs.lift(t.range).collapseToStart();return this._editorService.openCodeEditor({resource:t.uri,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor).then((t=>{var i;if(this._ignoreModelChangeEvent=!1,t&&this._widget)if(this._editor===t)this._widget.show(s),this._widget.focusOnReferenceTree();else{const e=mY.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,Zh((()=>Promise.resolve(n))),null!==(i=this._peekMode)&&void 0!==i&&i)}else this.closeWidget()}),(t=>{this._ignoreModelChangeEvent=!1,Li(t)}))}openReference(t,i,e){i||this.closeWidget();const{uri:s,range:n}=t;this._editorService.openCodeEditor({resource:s,options:{selection:n,selectionSource:"code.jump",pinned:e}},this._editor,i)}};function yY(t,i){const e=function(t){const i=t.get(so).getFocusedCodeEditor();return i instanceof LQ?i.getParentEditor():i}(t);if(!e)return;const s=bY.get(e);s&&i(s)}bY.ID="editor.contrib.referencesController",bY=mY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([wY(2,th),wY(3,so),wY(4,VF),wY(5,io),wY(6,aN),wY(7,rd)],bY),vh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ae(2089,60),when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),vh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),vh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Oo.or(vY,$Q.inPeekEditor),handler(t){yY(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),mo.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),mo.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),mo.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),mo.registerCommand("closeReferenceSearch",(t=>yY(t,(t=>t.closeWidget())))),vh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Oo.and($Q.inPeekEditor,Oo.not("config.editor.stablePeek"))}),vh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Oo.and(vY,Oo.not("config.editor.stablePeek"))}),vh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Oo.and(vY,gW,yW.negate(),CW.negate()),handler(t){var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.revealReference(e[0])))}}),vh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Oo.and(vY,gW,yW.negate(),CW.negate()),handler(t){var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.openReference(e[0],!0,!0)))}}),mo.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(aW).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof ZQ&&yY(t,(t=>t.openReference(e[0],!1,!0)))}));var kY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},CY=function(t,i){return function(e,s){i(e,s,t)}};const SY=new Xo("hasSymbols",!1,Q(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),xY=eo("ISymbolNavigationService");let DY=class{constructor(t,i,e,s){this._editorService=i,this._notificationService=e,this._keybindingService=s,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=SY.bindTo(t)}reset(){var t,i;this._ctxHasSymbols.reset(),null===(t=this._currentState)||void 0===t||t.dispose(),null===(i=this._currentMessage)||void 0===i||i.dispose(),this._currentModel=void 0,this._currentIdx=-1}put(t){const i=t.parent.parent;if(i.references.length<=1)return void this.reset();this._currentModel=i,this._currentIdx=i.references.indexOf(t),this._ctxHasSymbols.set(!0),this._showMessage();const e=new EY(this._editorService),s=e.onDidChange((()=>{if(this._ignoreEditorChange)return;const t=this._editorService.getActiveCodeEditor();if(!t)return;const e=t.getModel(),s=t.getPosition();if(!e||!s)return;let n=!1,r=!1;for(const t of i.references)if(tA(t.uri,e.uri))n=!0,r=r||bs.containsPosition(t.range,s);else if(n)break;n&&r||this.reset()}));this._currentState=Hi(e,s)}revealNext(t){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const i=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:i.uri,options:{selection:bs.collapseToStart(i.range),selectionRevealType:3}},t).finally((()=>{this._ignoreEditorChange=!1}))}_showMessage(){var t;null===(t=this._currentMessage)||void 0===t||t.dispose();const i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?Q(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):Q(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};DY=kY([CY(0,th),CY(1,so),CY(2,VF),CY(3,HC)],DY),gd(xY,DY,1),Ya(new class extends qa{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:SY,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(xY).revealNext(i)}}),vh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:SY,primary:9,handler(t){t.get(xY).reset()}});let EY=class{constructor(t){this._listener=new Map,this._disposables=new Ui,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._disposables.add(t.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(t.onCodeEditorAdd(this._onDidAddEditor,this)),t.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Vi(this._listener.values())}_onDidAddEditor(t){this._listener.set(t,Hi(t.onDidChangeCursorPosition((()=>this._onDidChange.fire({editor:t}))),t.onDidChangeModelContent((()=>this._onDidChange.fire({editor:t})))))}_onDidRemoveEditor(t){var i;null===(i=this._listener.get(t))||void 0===i||i.dispose(),this._listener.delete(t)}};async function AY(t,i,e,s){const n=e.ordered(t).map((e=>Promise.resolve(s(e,t,i)).then(void 0,(t=>{Fi(t)}))));return c((await Promise.all(n)).flat())}function MY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function LY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function FY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function TY(t,i,e,s){return AY(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function RY(t,i,e,s,n){return AY(i,e,t,(async(t,i,e)=>{const r=await t.provideReferences(i,e,{includeDeclaration:!0},n);if(!s||!r||2!==r.length)return r;const o=await t.provideReferences(i,e,{includeDeclaration:!1},n);return o&&1===o.length?o:r}))}async function OY(t){const i=await t(),e=new YQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}var _Y,IY,PY,NY,BY,$Y,WY,jY;EY=kY([CY(0,so)],EY),Qa("_executeDefinitionProvider",((t,i,e)=>{const s=MY(t.get(op).definitionProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeTypeDefinitionProvider",((t,i,e)=>{const s=TY(t.get(op).typeDefinitionProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeDeclarationProvider",((t,i,e)=>{const s=LY(t.get(op).declarationProvider,i,e,fe.None);return OY((()=>s))})),Qa("_executeReferenceProvider",((t,i,e)=>{const s=RY(t.get(op).referenceProvider,i,e,!1,fe.None);return OY((()=>s))})),Qa("_executeImplementationProvider",((t,i,e)=>{const s=FY(t.get(op).implementationProvider,i,e,fe.None);return OY((()=>s))})),Eh.appendMenuItem(Sh.EditorContext,{submenu:Sh.EditorContextPeek,title:Q(0,"Peek"),group:"navigation",order:100});class VY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof VY||!(!vs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class HY extends Ja{static all(){return HY._allSymbolNavigationCommands.values()}static _patchConfig(t){const i={...t,f1:!0};if(i.menu)for(const e of It.wrap(i.menu))e.id!==Sh.EditorContext&&e.id!==Sh.EditorContextPeek||(e.when=Oo.and(t.precondition,e.when));return i}constructor(t,i){super(HY._patchConfig(i)),this.configuration=t,HY._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(VF),r=t.get(so),o=t.get(DO),h=t.get(xY),c=t.get(op),l=t.get(io),a=i.getModel(),u=i.getPosition(),d=VY.is(e)?e:new VY(a,u),f=new hq(i,5),g=Jh(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((async t=>{var n;if(!t||f.token.isCancellationRequested)return;let o;if(Cm(t.ariaMessage),t.referenceAt(a.uri,u)){const t=this._getAlternativeCommand(i);!HY._activeAlternativeCommands.has(t)&&HY._allSymbolNavigationCommands.has(t)&&(o=HY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=a.getWordAtPosition(u);null===(n=XZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),u)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);HY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{HY._activeAlternativeCommands.delete(this.desc.id)}))))}}),(t=>{n.error(t)})).finally((()=>{f.dispose()}));return o.showWhile(g,250),g}async _onResult(t,i,e,s,n){const r=this._getGoToPreference(e);if(e instanceof LQ||!(this.configuration.openInPeek||"peek"===r&&s.references.length>1)){const o=s.firstReference(),h=s.references.length>1&&"gotoAndPeek"===r,c=await this._openReference(e,t,o,this.configuration.openToSide,!h);h&&c?this._openInPeek(c,s,n):s.dispose(),"goto"===r&&i.put(o)}else this._openInPeek(e,s,n)}async _openReference(t,i,e,s,n){let r;var o;if((o=e)&&hs.isUri(o.uri)&&bs.isIRange(o.range)&&(bs.isIRange(o.originSelectionRange)||bs.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=await i.openCodeEditor({resource:e.uri,options:{selection:bs.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},t,s);if(h){if(n){const t=h.getModel(),i=h.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout((()=>{h.getModel()===t&&i.clear()}),350)}return h}}_openInPeek(t,i,e){const s=bY.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),Zh((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}HY._allSymbolNavigationCommands=new Map,HY._activeAlternativeCommands=new Set;class zY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await MY(t.definitionProvider,i,e,s),Q(0,"Definitions"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No definition found for '{0}'",t.word):Q(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleDefinitions}}Fh(((_Y=class extends zY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:_Y.id,title:{value:Q(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:Q(0,"Go to &&Definition")},precondition:Oo.and(PS.hasDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:PS.editorTextFocus,primary:70,weight:100},{when:Oo.and(PS.editorTextFocus,sW),primary:2118,weight:100}],menu:[{id:Sh.EditorContext,group:"navigation",order:1.1},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),mo.registerCommandAlias("editor.action.goToDeclaration",_Y.id)}}).id="editor.action.revealDefinition",_Y)),Fh(((IY=class extends zY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:IY.id,title:{value:Q(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Oo.and(PS.hasDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:PS.editorTextFocus,primary:Ae(2089,70),weight:100},{when:Oo.and(PS.editorTextFocus,sW),primary:Ae(2089,2118),weight:100}]}),mo.registerCommandAlias("editor.action.openDeclarationToTheSide",IY.id)}}).id="editor.action.revealDefinitionAside",IY)),Fh(((PY=class extends zY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:PY.id,title:{value:Q(0,"Peek Definition"),original:"Peek Definition"},precondition:Oo.and(PS.hasDefinitionProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:Sh.EditorContextPeek,group:"peek",order:2}}),mo.registerCommandAlias("editor.action.previewDeclaration",PY.id)}}).id="editor.action.peekDefinition",PY));class UY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await LY(t.declarationProvider,i,e,s),Q(0,"Declarations"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No declaration found for '{0}'",t.word):Q(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(58).multipleDeclarations}}Fh(((NY=class extends UY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:NY.id,title:{value:Q(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:Q(0,"Go to &&Declaration")},precondition:Oo.and(PS.hasDeclarationProvider,PS.isInWalkThroughSnippet.toNegated()),menu:[{id:Sh.EditorContext,group:"navigation",order:1.3},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No declaration found for '{0}'",t.word):Q(0,"No declaration found")}}).id="editor.action.revealDeclaration",NY)),Fh(class extends UY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:Q(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Oo.and(PS.hasDeclarationProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:3}})}});class KY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await TY(t.typeDefinitionProvider,i,e,s),Q(0,"Type Definitions"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No type definition found for '{0}'",t.word):Q(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleTypeDefinitions}}Fh(((BY=class extends KY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:BY.ID,title:{value:Q(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:Q(0,"Go to &&Type Definition")},precondition:Oo.and(PS.hasTypeDefinitionProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:0,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.4},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",BY)),Fh((($Y=class extends KY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:$Y.ID,title:{value:Q(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Oo.and(PS.hasTypeDefinitionProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",$Y));class qY extends HY{async _getLocationModel(t,i,e,s){return new YQ(await FY(t.implementationProvider,i,e,s),Q(0,"Implementations"))}_getNoResultFoundMessage(t){return t&&t.word?Q(0,"No implementation found for '{0}'",t.word):Q(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(58).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(58).multipleImplementations}}Fh(((WY=class extends qY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:WY.ID,title:{value:Q(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:Q(0,"Go to &&Implementations")},precondition:Oo.and(PS.hasImplementationProvider,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:2118,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.45},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",WY)),Fh(((jY=class extends qY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:jY.ID,title:{value:Q(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Oo.and(PS.hasImplementationProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:3142,weight:100},menu:{id:Sh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",jY));class GY extends HY{_getNoResultFoundMessage(t){return t?Q(0,"No references found for '{0}'",t.word):Q(0,"No references found")}_getAlternativeCommand(t){return t.getOption(58).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(58).multipleReferences}}Fh(class extends GY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:Q(0,"Go to References"),original:"Go to References",mnemonicTitle:Q(0,"Go to &&References")},precondition:Oo.and(PS.hasReferenceProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),keybinding:{when:PS.editorTextFocus,primary:1094,weight:100},menu:[{id:Sh.EditorContext,group:"navigation",order:1.45},{id:Sh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(t,i,e,s){return new YQ(await RY(t.referenceProvider,i,e,!0,s),Q(0,"References"))}}),Fh(class extends GY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:Q(0,"Peek References"),original:"Peek References"},precondition:Oo.and(PS.hasReferenceProvider,$Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated()),menu:{id:Sh.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(t,i,e,s){return new YQ(await RY(t.referenceProvider,i,e,!1,s),Q(0,"References"))}});class ZY extends HY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:Q(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Oo.and($Q.notInPeekEditor,PS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}async _getLocationModel(t,i,e,s){return new YQ(this._references,Q(0,"Locations"))}_getNoResultFoundMessage(t){return t&&Q(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}mo.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:hs},{name:"position",description:"The position at which to start",constraint:vs.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(t,i,e,s,n,r,o)=>{B(hs.isUri(i)),B(vs.isIPosition(e)),B(Array.isArray(s)),B(void 0===n||"string"==typeof n),B(void 0===o||"boolean"==typeof o);const h=t.get(so),c=await h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(lq(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends ZY{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(io).invokeFunction(i.run.bind(i),c)}))}}),mo.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:hs},{name:"position",description:"The position at which to start",constraint:vs.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto"}]},handler:async(t,i,e,s,n)=>{t.get(po).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}}),mo.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(hs.isUri(i)),B(vs.isIPosition(e));const s=t.get(op),n=t.get(so);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!lq(t)||!t.hasModel())return;const i=bY.get(t);if(!i)return;const n=Zh((i=>RY(s.referenceProvider,t.getModel(),vs.lift(e),!1,i).then((t=>new YQ(t,Q(0,"References")))))),r=new bs(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),mo.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var JY,QY=function(t,i){return function(e,s){i(e,s,t)}};let YY=JY=class{constructor(t,i,e,s){this.textModelResolverService=i,this.languageService=e,this.languageFeaturesService=s,this.toUnhook=new Ui,this.toUnhookForKeyboard=new Ui,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=t,this.linkDecorations=this.editor.createDecorationsCollection();const n=new AQ(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,null!=i?i:void 0)}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Li(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(t){return t.getContribution(JY.ID)}async startFindDefinitionFromCursor(t){await this.startFindDefinition(t),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition((()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()}))),this.toUnhookForKeyboard.add(this.editor.onKeyDown((t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())})))}startFindDefinitionFromMouse(t,i){if(!(9===t.target.type&&this.linkDecorations.length>0))return this.editor.hasModel()&&this.isEnabled(t,i)?void this.startFindDefinition(t.target.position):(this.currentWordAtPosition=null,void this.removeLinkDecorations())}async startFindDefinition(t){var i;this.toUnhookForKeyboard.clear();const e=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!e)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;const s=new oq(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Zh((i=>this.findDefinition(t,i)));try{n=await this.previousPromise}catch(t){return void Li(t)}if(!n||!n.length||!s.validate(this.editor))return void this.removeLinkDecorations();const r=n[0].originSelectionRange?bs.lift(n[0].originSelectionRange):new bs(t.lineNumber,e.startColumn,t.lineNumber,e.endColumn);if(n.length>1){let t=r;for(const{originSelectionRange:i}of n)i&&(t=bs.plusRange(t,i));this.addDecoration(t,(new bI).appendText(Q(0,"Click to show {0} definitions.",n.length)))}else{const t=n[0];if(!t.uri)return;this.textModelResolverService.createModelReference(t.uri).then((i=>{if(!i.object||!i.object.textEditorModel)return void i.dispose();const{object:{textEditorModel:e}}=i,{startLineNumber:s}=t.range;if(s<1||s>e.getLineCount())return void i.dispose();const n=this.getPreviewValue(e,s,t),o=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(r,n?(new bI).appendCodeblock(o||"",n):void 0),i.dispose()}))}}getPreviewValue(t,i,e){let s=e.range;return s.endLineNumber-s.startLineNumber>=JY.MAX_SOURCE_PREVIEW_LINES&&(s=this.getPreviewRangeBasedOnIndentation(t,i)),this.stripIndentationFromPreviewRange(t,i,s)}stripIndentationFromPreviewRange(t,i,e){let s=t.getLineFirstNonWhitespaceColumn(i);for(let n=i+1;n<e.endLineNumber;n++){const i=t.getLineFirstNonWhitespaceColumn(n);s=Math.min(s,i)}return t.getValueInRange(e).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(t,i){const e=t.getLineFirstNonWhitespaceColumn(i),s=Math.min(t.getLineCount(),i+JY.MAX_SOURCE_PREVIEW_LINES);let n=i+1;for(;n<s&&e!==t.getLineFirstNonWhitespaceColumn(n);n++);return new bs(i,1,n+1,1)}addDecoration(t,i){this.linkDecorations.set([{range:t,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:i}}])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(t,i){var e;return this.editor.hasModel()&&t.isLeftClick&&t.isNoneOrSingleMouseDown&&6===t.target.type&&!((null===(e=t.target.detail.injectedText)||void 0===e?void 0:e.options)instanceof lL)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?MY(this.languageFeaturesService.definitionProvider,e,t,i):Promise.resolve(null)}gotoDefinition(t,i){return this.editor.setPosition(t),this.editor.invokeWithinContext((t=>{const e=!i&&this.editor.getOption(87)&&!this.isInPeekEditor(t);return new zY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(th);return $Q.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};YY.ID="editor.contrib.gotodefinitionatposition",YY.MAX_SOURCE_PREVIEW_LINES=8,YY=JY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([QY(1,ro),QY(2,ud),QY(3,op)],YY),iu(YY.ID,YY,2);const XY=Fa;class tX extends Ki{constructor(){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new pk(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class iX extends Ki{static render(t,i,e){return new iX(t,i,e)}constructor(t,i,e){super(),this.actionContainer=xa(t,XY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=xa(this.actionContainer,XY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&xa(this.action,XY(`span.icon.${i.iconClass}`)),xa(this.action,XY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Il(this.actionContainer,ya.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Il(this.actionContainer,ya.KEY_DOWN,(t=>{const e=new jh(t);(e.equals(3)||e.equals(10))&&(t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer))}))),this.setEnabled(!0)}setEnabled(t){t?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}class eX{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class sX extends Ki{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ne),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new rc((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new rc((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new rc((()=>this._triggerLoadingMessage()),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(t,i=!0){this._state=t,i&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=function(t){const i=new pe,e=t(i.token);return new fc(i,(async t=>{const s=i.token.onCancellationRequested((()=>{s.dispose(),i.dispose(),t.reject(new _i)}));try{for await(const s of e){if(i.token.isCancellationRequested)return;t.emitOne(s)}s.dispose(),i.dispose()}catch(e){s.dispose(),i.dispose(),t.reject(e)}}))}((t=>this._computer.computeAsync(t))),(async()=>{try{for await(const t of this._asyncIterable)t&&(this._result.push(t),this._fireResult());this._asyncIterableDone=!0,3!==this._state&&4!==this._state||this._setState(0)}catch(t){Li(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync())),this._setState(this._asyncIterableDone?0:3)}_triggerLoadingMessage(){3===this._state&&this._setState(4)}_fireResult(){if(1===this._state||2===this._state)return;const t=0===this._state,i=4===this._state;this._onResult.fire(new eX(this._result.slice(0),t,i))}start(t){if(0===t)0===this._state&&(this._setState(1),this._firstWaitScheduler.schedule(this._firstWaitTime),this._loadingMessageScheduler.schedule(this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(),this._secondWaitScheduler.cancel(),this._triggerSyncComputation();break;case 2:this._secondWaitScheduler.cancel(),this._triggerSyncComputation()}}cancel(){this._firstWaitScheduler.cancel(),this._secondWaitScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._setState(0,!1)}}class nX{constructor(t,i,e,s){this.priority=t,this.range=i,this.initialMousePosX=e,this.initialMousePosY=s,this.type=1}equals(t){return 1===t.type&&this.range.equalsRange(t.range)}canAdoptVisibleHover(t,i){return 1===t.type&&i.lineNumber===this.range.startLineNumber}}class rX{constructor(t,i,e,s,n,r){this.priority=t,this.owner=i,this.range=e,this.initialMousePosX=s,this.initialMousePosY=n,this.supportsMarkerHover=r,this.type=2}equals(t){return 2===t.type&&this.owner===t.owner}canAdoptVisibleHover(t,i){return 2===t.type&&this.owner===t.owner}}const oX=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class hX{constructor(){let t;this._onDidWillResize=new ne,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ne,this.onDidResize=this._onDidResize.event,this._sashListener=new Ui,this._size=new ql(0,0),this._minSize=new ql(0,0),this._maxSize=new ql(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new AB(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new AB(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new AB(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:bB.North}),this._southSash=new AB(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:bB.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let i=0,e=0;this._sashListener.add(Xi.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)((()=>{void 0===t&&(this._onDidWillResize.fire(),t=this._size,i=0,e=0)}))),this._sashListener.add(Xi.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)((()=>{void 0!==t&&(t=void 0,i=0,e=0,this._onDidResize.fire({dimension:this._size,done:!0}))}))),this._sashListener.add(this._eastSash.onDidChange((s=>{t&&(e=s.currentX-s.startX,this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))}))),this._sashListener.add(this._westSash.onDidChange((s=>{t&&(e=-(s.currentX-s.startX),this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))}))),this._sashListener.add(this._northSash.onDidChange((s=>{t&&(i=-(s.currentY-s.startY),this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))}))),this._sashListener.add(this._southSash.onDidChange((s=>{t&&(i=s.currentY-s.startY,this.layout(t.height+i,t.width+e),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))}))),this._sashListener.add(Xi.any(this._eastSash.onDidReset,this._westSash.onDidReset)((()=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))),this._sashListener.add(Xi.any(this._northSash.onDidReset,this._southSash.onDidReset)((()=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))})))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(t,i,e,s){this._northSash.state=t?3:0,this._eastSash.state=i?3:0,this._southSash.state=e?3:0,this._westSash.state=s?3:0}layout(t=this.size.height,i=this.size.width){const{height:e,width:s}=this._minSize,{height:n,width:r}=this._maxSize;t=Math.max(e,Math.min(n,t)),i=Math.max(s,Math.min(r,i));const o=new ql(i,t);ql.equals(o,this._size)||(this.domNode.style.height=t+"px",this.domNode.style.width=i+"px",this._size=o,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(t){this._maxSize=t}get maxSize(){return this._maxSize}set minSize(t){this._minSize=t}get minSize(){return this._minSize}set preferredSize(t){this._preferredSize=t}get preferredSize(){return this._preferredSize}}class cX extends Ki{constructor(t,i=new ql(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new hX),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ql.lift(i),this._resizableNode.layout(i.height,i.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize((t=>{this._resize(new ql(t.dimension.width,t.dimension.height)),t.done&&(this._isResizing=!1)}))),this._register(this._resizableNode.onDidWillResize((()=>{this._isResizing=!0})))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var t;return(null===(t=this._contentPosition)||void 0===t?void 0:t.position)?vs.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(i&&e)return Zl(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=Zl(i);return Ul(i.ownerDocument.body).height-(s.top+e.top+e.height)-24}_findPositionPreference(t,i){var e,s;const n=Math.min(null!==(e=this._availableVerticalSpaceBelow(i))&&void 0!==e?e:1/0,t),r=Math.min(null!==(s=this._availableVerticalSpaceAbove(i))&&void 0!==s?s:1/0,t),o=Math.min(Math.max(r,n),t),h=Math.min(t,o);let c;return c=this._editor.getOption(60).above?h<=r?1:2:h<=n?2:1,1===c?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),c}_resize(t){this._resizableNode.layout(t.height,t.width)}}var lX,aX,uX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},dX=function(t,i){return function(e,s){i(e,s,t)}};const fX=Fa;let gX=lX=class extends Ki{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(vX,this._editor)),this._participants=[];for(const t of oX.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new yX(this._editor,this._participants),this._hoverOperation=this._register(new sX(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{if(!this._computer.anchor)return;const i=t.hasLoadingMessage?this._addLoadingMessage(t.value):t.value;this._withResult(new pX(this._computer.anchor,i,t.isComplete))}))),this._register(Nl(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register(Ws.onDidChange((()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})))}get widget(){return this._widget}maybeShowAt(t){if(this._widget.isResizing)return!0;const i=[];for(const e of this._participants)if(e.suggestHoverAnchor){const s=e.suggestHoverAnchor(t);s&&i.push(s)}const e=t.target;if(6===e.type&&i.push(new nX(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new nX(0,e.range,t.event.posx,t.event.posy))}return 0===i.length?this._startShowingOrUpdateHover(null,0,0,!1,t):(i.sort(((t,i)=>i.priority-t.priority)),this._startShowingOrUpdateHover(i[0],0,0,!1,t))}startShowingAtRange(t,i,e,s){this._startShowingOrUpdateHover(new nX(0,t,void 0,void 0),i,e,s,null)}_startShowingOrUpdateHover(t,i,e,s,n){return this._widget.position&&this._currentResult?this._editor.getOption(60).sticky&&n&&this._widget.isMouseGettingCloser(n.event.posx,n.event.posy)?(t&&this._startHoverOperationIfNecessary(t,i,e,s,!0),!0):t?!(!t||!this._currentResult.anchor.equals(t))||(t.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(t)),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)):(this._setCurrentResult(null),!1):!!t&&(this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)}_startHoverOperationIfNecessary(t,i,e,s,n){this._computer.anchor&&this._computer.anchor.equals(t)||(this._hoverOperation.cancel(),this._computer.anchor=t,this._computer.shouldFocus=s,this._computer.source=e,this._computer.insistOnKeepingHoverVisible=n,this._hoverOperation.start(i))}_setCurrentResult(t){this._currentResult!==t&&(t&&0===t.messages.length&&(t=null),this._currentResult=t,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(t){return!!t&&this._widget.getDomNode().contains(t)}_addLoadingMessage(t){if(this._computer.anchor)for(const i of this._participants)if(i.createLoadingMessage){const e=i.createLoadingMessage(this._computer.anchor);if(e)return t.slice(0).concat([e])}return t}_withResult(t){if(this._widget.position&&this._currentResult&&this._currentResult.isComplete){if(!t.isComplete)return;if(this._computer.insistOnKeepingHoverVisible&&0===t.messages.length)return}this._setCurrentResult(t)}_renderMessages(t,i){const{showAtPosition:e,showAtSecondaryPosition:s,highlightRange:n}=lX.computeHoverRanges(this._editor,t.range,i),r=new Ui,o=r.add(new bX(this._keybindingService)),h=document.createDocumentFragment();let c=null;const l={fragment:h,statusBar:o,setColorPicker:t=>c=t,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:t=>this._widget.setMinimumDimensions(t),hide:()=>this.hide()};for(const t of this._participants){const e=i.filter((i=>i.owner===t));e.length>0&&r.add(t.renderHoverParts(l,e))}const a=i.some((t=>t.isBeforeContent));if(o.hasContent&&h.appendChild(o.hoverElement),h.hasChildNodes()){if(n){const t=this._editor.createDecorationsCollection();t.set([{range:n,options:lX._DECORATION_OPTIONS}]),r.add(zi((()=>{t.clear()})))}this._widget.showAt(h,new wX(c,e,s,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,a,t.initialMousePosX,t.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(t,i,e){let s=1;if(t.hasModel()){const e=t._getViewModel(),n=e.coordinatesConverter,r=n.convertModelRangeToViewRange(i),o=new vs(r.startLineNumber,e.getLineMinColumn(r.startLineNumber));s=n.convertViewPositionToModelPosition(o).column}const n=i.startLineNumber;let r=i.startColumn,o=e[0].range,h=null;for(const t of e)o=bs.plusRange(o,t.range),t.range.startLineNumber===n&&t.range.endLineNumber===n&&(r=Math.max(Math.min(r,t.range.startColumn),s)),t.forceShowAtRange&&(h=t.range);return{showAtPosition:h?h.getStartPosition():new vs(n,i.startColumn),showAtSecondaryPosition:h?h.getStartPosition():new vs(n,r),highlightRange:o}}focus(){this._widget.focus()}scrollUp(){this._widget.scrollUp()}scrollDown(){this._widget.scrollDown()}scrollLeft(){this._widget.scrollLeft()}scrollRight(){this._widget.scrollRight()}pageUp(){this._widget.pageUp()}pageDown(){this._widget.pageDown()}goToTop(){this._widget.goToTop()}goToBottom(){this._widget.goToBottom()}};gX._DECORATION_OPTIONS=aL.register({description:"content-hover-highlight",className:"hoverHighlight"}),gX=lX=uX([dX(1,io),dX(2,HC)],gX);class pX{constructor(t,i,e){this.anchor=t,this.messages=i,this.isComplete=e}filter(t){const i=this.messages.filter((i=>i.isValidForHoverAnchor(t)));return i.length===this.messages.length?this:new mX(this,this.anchor,i,this.isComplete)}}class mX extends pX{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class wX{constructor(t,i,e,s,n,r,o,h,c,l){this.colorPicker=t,this.showAtPosition=i,this.showAtSecondaryPosition=e,this.preferAbove=s,this.stoleFocus=n,this.source=r,this.isBeforeContent=o,this.initialMousePosX=h,this.initialMousePosY=c,this.disposables=l,this.closestMouseDistance=void 0}}let vX=aX=class extends cX{get isColorPickerVisible(){var t;return Boolean(null===(t=this._visibleData)||void 0===t?void 0:t.colorPicker)}get isVisibleFromKeyboard(){var t;return 1===(null===(t=this._visibleData)||void 0===t?void 0:t.source)}get isVisible(){var t;return null!==(t=this._hoverVisibleKey.get())&&void 0!==t&&t}get isFocused(){var t;return null!==(t=this._hoverFocusedKey.get())&&void 0!==t&&t}constructor(t,i,e,s,n){const r=t.getOption(66)+8,o=new ql(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new tX),this._minimumSize=o,this._hoverVisibleKey=PS.hoverVisible.bindTo(i),this._hoverFocusedKey=PS.hoverFocused.bindTo(i),xa(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange((()=>{this.isVisible&&this._updateMaxDimensions()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()})));const h=this._register(Sa(this._resizableNode.domNode));this._register(h.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(h.onDidBlur((()=>{this._hoverFocusedKey.set(!1)}))),this._setHoverData(void 0),this._editor.addContentWidget(this)}dispose(){var t;super.dispose(),null===(t=this._visibleData)||void 0===t||t.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return aX.ID}static _applyDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.width="number"==typeof i?`${i}px`:i,t.style.height=s}_setContentsDomNodeDimensions(t,i){return aX._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return aX._applyDimensions(this._hover.containerDomNode,t,i)}_setHoverWidgetDimensions(t,i){this._setContentsDomNodeDimensions(t,i),this._setContainerDomNodeDimensions(t,i),this._layoutContentWidget()}static _applyMaxDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.maxWidth="number"==typeof i?`${i}px`:i,t.style.maxHeight=s}_setHoverWidgetMaxDimensions(t,i){aX._applyMaxDimensions(this._hover.contentsDomNode,t,i),aX._applyMaxDimensions(this._hover.containerDomNode,t,i),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth","number"==typeof t?`${t}px`:t),this._layoutContentWidget()}_hasHorizontalScrollbar(){const t=this._hover.scrollbar.getScrollDimensions();return t.scrollWidth>t.width}_adjustContentsBottomPadding(){const t=this._hover.contentsDomNode,i=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;t.style.paddingBottom!==i&&(t.style.paddingBottom=i)}_setAdjustedHoverWidgetDimensions(t){this._setHoverWidgetMaxDimensions("none","none");const i=t.width,e=t.height;this._setHoverWidgetDimensions(i,e),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(i,e-10))}_updateResizableNodeMaxDimensions(){var t,i;const e=null!==(t=this._findMaximumRenderingWidth())&&void 0!==t?t:1/0,s=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._resizableNode.maxSize=new ql(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;aX._lastDimensions=new ql(t.width,t.height),this._setAdjustedHoverWidgetDimensions(t),this._resizableNode.layout(t.height,t.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),null===(e=null===(i=this._visibleData)||void 0===i?void 0:i.colorPicker)||void 0===e||e.layout()}_findAvailableSpaceVertically(){var t;const i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition;if(i)return 1===this._positionPreference?this._availableVerticalSpaceAbove(i):this._availableVerticalSpaceBelow(i)}_findMaximumRenderingHeight(){const t=this._findAvailableSpaceVertically();if(!t)return;let i=6;return Array.from(this._hover.contentsDomNode.children).forEach((t=>{i+=t.clientHeight})),this._hasHorizontalScrollbar()&&(i+=10),Math.min(t,i)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const t=Array.from(this._hover.contentsDomNode.children).some((t=>t.scrollWidth>t.clientWidth));return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),t}_findMaximumRenderingWidth(){if(this._editor&&this._editor.hasModel())return this._isHoverTextOverflowing()||this._hover.containerDomNode.clientWidth<(void 0===this._contentWidth?0:this._contentWidth-2)?Ul(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(t,i){if(!this._visibleData)return!1;if(void 0===this._visibleData.initialMousePosX||void 0===this._visibleData.initialMousePosY)return this._visibleData.initialMousePosX=t,this._visibleData.initialMousePosY=i,!1;const e=Zl(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=kX(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=kX(t,i,e.left,e.top,e.width,e.height);return!(s>this._visibleData.closestMouseDistance+4||(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,s),0))}_setHoverData(t){var i;null===(i=this._visibleData)||void 0===i||i.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!t),this._hover.containerDomNode.classList.toggle("hidden",!t)}_updateFont(){const{fontSize:t,lineHeight:i}=this._editor.getOption(50),e=this._hover.contentsDomNode;e.style.fontSize=`${t}px`,e.style.lineHeight=""+i/t,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_updateContent(t){const i=this._hover.contentsDomNode;i.style.paddingBottom="",i.textContent="",i.appendChild(t)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const t=Math.max(this._editor.getLayoutInfo().height/4,250,aX._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,aX._lastDimensions.width);this._setHoverWidgetMaxDimensions(i,t)}_render(t,i){this._setHoverData(i),this._updateFont(),this._updateContent(t),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var t;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[null!==(t=this._positionPreference)&&void 0!==t?t:1]}:null}showAt(t,i){var e,s,n,r;if(!this._editor||!this._editor.hasModel())return;this._render(t,i);const o=Xl(this._hover.containerDomNode);this._positionPreference=null!==(e=this._findPositionPreference(o,i.showAtPosition))&&void 0!==e?e:1,this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(s=i.colorPicker)||void 0===s||s.layout();const h=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&(c=!0===this._configurationService.getValue("accessibility.verbosity.hover")&&this._accessibilityService.isScreenReaderOptimized(),l=null!==(r=null===(n=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))||void 0===n?void 0:n.getAriaLabel())&&void 0!==r?r:"",c&&l?Q(0,"Inspect this in the accessible view with {0}.",l):c?Q(0,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):"");var c,l;h&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+h)}hide(){if(!this._visibleData)return;const t=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new ql(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}_removeConstraintsRenderNormally(){const t=this._editor.getLayoutInfo();this._resizableNode.layout(t.height,t.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(t){var i;const e=this._hover.containerDomNode,s=this._hover.contentsDomNode,n=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._setContainerDomNodeDimensions(Jl(e),Math.min(n,t)),this._setContentsDomNodeDimensions(Jl(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new ql(Math.max(this._minimumSize.width,t.width),Math.max(this._minimumSize.height,t.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const t=void 0===this._contentWidth?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new ql(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=Xl(i),s=Jl(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=Xl(i),s=Jl(i),this._contentWidth=s,this._updateMinimumWidth(),this._resizableNode.layout(e,s),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(e)),null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition){const t=Xl(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(t,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-30})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+30})}pageUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t-i})}pageDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t+i})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};vX.ID="editor.contrib.resizableContentHoverWidget",vX._lastDimensions=new ql(0,0),vX=aX=uX([dX(1,th),dX(2,rd),dX(3,Om),dX(4,HC)],vX);let bX=class extends Ki{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=fX("div.hover-row.status-bar"),this.actionsElement=xa(this.hoverElement,fX("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(iX.render(this.actionsElement,t,e))}append(t){const i=xa(this.actionsElement,t);return this._hasContent=!0,i}};bX=uX([dX(0,HC)],bX);class yX{get anchor(){return this._anchor}set anchor(t){this._anchor=t}get shouldFocus(){return this._shouldFocus}set shouldFocus(t){this._shouldFocus=t}get source(){return this._source}set source(t){this._source=t}get insistOnKeepingHoverVisible(){return this._insistOnKeepingHoverVisible}set insistOnKeepingHoverVisible(t){this._insistOnKeepingHoverVisible=t}constructor(t,i){this._editor=t,this._participants=i,this._anchor=null,this._shouldFocus=!1,this._source=0,this._insistOnKeepingHoverVisible=!1}static _getLineDecorations(t,i){if(1!==i.type&&!i.supportsMarkerHover)return[];const e=t.getModel(),s=i.range.startLineNumber;if(s>e.getLineCount())return[];const n=e.getLineMaxColumn(s);return t.getLineDecorations(s).filter((t=>{if(t.options.isWholeLine)return!0;const e=t.range.startLineNumber===s?t.range.startColumn:1,r=t.range.endLineNumber===s?t.range.endColumn:n;if(t.options.showIfCollapsed){if(e>i.range.startColumn+1||i.range.endColumn-1>r)return!1}else if(e>i.range.startColumn||i.range.endColumn>r)return!1;return!0}))}computeAsync(t){const i=this._anchor;if(!this._editor.hasModel()||!i)return dc.EMPTY;const e=yX._getLineDecorations(this._editor,i);return dc.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):dc.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=yX._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return c(i)}}function kX(t,i,e,s,n,r){const o=s+r/2,h=Math.max(Math.abs(t-(e+n/2))-n/2,0),c=Math.max(Math.abs(i-o)-r/2,0);return Math.sqrt(h*h+c*c)}const CX=Fa;class SX extends Ki{constructor(t,i,e){super(),this._renderDisposeables=this._register(new Ui),this._editor=t,this._isVisible=!1,this._messages=[],this._hover=this._register(new tX),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new GZ({editor:this._editor},i,e)),this._computer=new xX(this._editor),this._hoverOperation=this._register(new sX(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{this._withResult(t.value)}))),this._register(this._editor.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return SX.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_onModelDecorationsChanged(){this._isVisible&&(this._hoverOperation.cancel(),this._hoverOperation.start(0))}startShowingAt(t){this._computer.lineNumber!==t&&(this._hoverOperation.cancel(),this.hide(),this._computer.lineNumber=t,this._hoverOperation.start(0))}hide(){this._computer.lineNumber=-1,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(t){this._messages=t,this._messages.length>0?this._renderMessages(this._computer.lineNumber,this._messages):this.hide()}_renderMessages(t,i){this._renderDisposeables.clear();const e=document.createDocumentFragment();for(const t of i){const i=CX("div.hover-row.markdown-hover"),s=xa(i,CX("div.hover-contents")),n=this._renderDisposeables.add(this._markdownRenderer.render(t.value));s.appendChild(n.element),e.appendChild(i)}this._updateContents(e),this._showAt(t)}_updateContents(t){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._updateFont()}_showAt(t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),e=this._editor.getTopForLineNumber(t),s=this._editor.getScrollTop(),n=this._editor.getOption(66),r=e-s-(this._hover.containerDomNode.clientHeight-n)/2;this._hover.containerDomNode.style.left=`${i.glyphMarginLeft+i.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(r),0)}px`}}SX.ID="editor.contrib.modesGlyphHoverWidget";class xX{get lineNumber(){return this._lineNumber}set lineNumber(t){this._lineNumber=t}constructor(t){this._editor=t,this._lineNumber=-1}computeSync(){const t=t=>({value:t}),i=this._editor.getLineDecorations(this._lineNumber),e=[];if(!i)return e;for(const s of i){if(!s.options.glyphMarginClassName)continue;const i=s.options.glyphMarginHoverMessage;i&&!yI(i)&&e.push(...b(i).map(t))}return e}}class DX{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function EX(t,i,e,s){const n=t.ordered(i).map(((t,n)=>async function(t,i,e,s,n){try{const r=await Promise.resolve(t.provideHover(e,s,n));if(r&&function(t){return void 0!==t.range&&void 0!==t.contents&&t.contents&&t.contents.length>0}(r))return new DX(t,r,i)}catch(t){Fi(t)}}(t,n,i,e,s)));return dc.fromPromises(n).coalesce()}Qa("_executeHoverProvider",((t,i,e)=>function(t,i,e){return EX(t,i,e,fe.None).map((t=>t.hover)).toPromise()}(t.get(op).hoverProvider,i,e)));var AX=function(t,i){return function(e,s){i(e,s,t)}};const MX=Fa;class LX{constructor(t,i,e,s,n){this.owner=t,this.range=i,this.contents=e,this.isBeforeContent=s,this.ordinal=n}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let FX=class{constructor(t,i,e,s,n){this._editor=t,this._languageService=i,this._openerService=e,this._configurationService=s,this._languageFeaturesService=n,this.hoverOrdinal=3}createLoadingMessage(t){return new LX(this,t.range,[(new bI).appendText(Q(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];let o=1e3;const h=e.getLineLength(s),c=e.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(116),a=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let u=!1;l>=0&&h>l&&t.range.startColumn>=l&&(u=!0,r.push(new LX(this,t.range,[{value:Q(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,o++))),!u&&"number"==typeof a&&h>=a&&r.push(new LX(this,t.range,[{value:Q(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,o++));let d=!1;for(const e of i){const i=e.range.startLineNumber===s?e.range.startColumn:1,h=e.range.endLineNumber===s?e.range.endColumn:n,c=e.options.hoverMessage;if(!c||yI(c))continue;e.options.beforeContentClassName&&(d=!0);const l=new bs(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new LX(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return dc.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return dc.EMPTY;const n=new vs(t.range.startLineNumber,t.range.startColumn);return EX(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!yI(t.hover.contents))).map((i=>{const e=i.hover.range?bs.lift(i.hover.range):t.range;return new LX(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return TX(t,i,this._editor,this._languageService,this._openerService)}};function TX(t,i,e,s,n){i.sort(((t,i)=>t.ordinal-i.ordinal));const r=new Ui;for(const o of i)for(const i of o.contents){if(yI(i))continue;const o=MX("div.hover-row.markdown-hover"),h=xa(o,MX("div.hover-contents")),c=r.add(new GZ({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const l=r.add(c.render(i));h.appendChild(l.element),t.fragment.appendChild(o)}return r}FX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([AX(1,ud),AX(2,ZN),AX(3,rd),AX(4,op)],FX);var RX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},OX=function(t,i){return function(e,s){i(e,s,t)}};class _X{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let IX=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ne,this.onDidChange=this._onDidChange.event,this._dispoables=new Ui,this._markers=[],this._nextIdx=-1,hs.isUri(t)?this._resourceFilter=i=>i.toString()===t.toString():t&&(this._resourceFilter=t);const s=this._configService.getValue("problems.sortOrder"),n=(t,i)=>{let e=Gn(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?bs.compareRangesUsingStarts(t,i)||eB.compare(t.severity,i.severity):eB.compare(t.severity,i.severity)||bs.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:hs.isUri(t)?t:void 0,severities:eB.Error|eB.Warning|eB.Info}),"function"==typeof t&&(this._markers=this._markers.filter((t=>this._resourceFilter(t.resource)))),this._markers.sort(n)};r(),this._dispoables.add(i.onMarkerChanged((t=>{this._resourceFilter&&!t.some((t=>this._resourceFilter(t)))||(r(),this._nextIdx=-1,this._onDidChange.fire())})))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(t){return!this._resourceFilter&&!t||!(!this._resourceFilter||!t)&&this._resourceFilter(t)}get selected(){const t=this._markers[this._nextIdx];return t&&new _X(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let n=!1,r=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));r<0&&(r=s(this._markers,{resource:t.uri},((t,i)=>Gn(t.resource.toString(),i.resource.toString()))),r<0&&(r=~r));for(let e=r;e<this._markers.length;e++){let s=bs.lift(this._markers[e]);if(s.isEmpty()){const i=t.getWordAtPosition(s.getStartPosition());i&&(s=new bs(s.startLineNumber,i.startColumn,s.startLineNumber,i.endColumn))}if(i&&(s.containsPosition(i)||i.isBeforeOrEqual(s.getStartPosition()))){this._nextIdx=e,n=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}n||(this._nextIdx=e?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(t,i,e){if(0===this._markers.length)return!1;const s=this._nextIdx;return-1===this._nextIdx?this._initIdx(i,e,t):t?this._nextIdx=(this._nextIdx+1)%this._markers.length:t||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),s!==this._nextIdx}find(t,i){let e=this._markers.findIndex((i=>i.resource.toString()===t.toString()));if(!(e<0))for(;e<this._markers.length;e++)if(bs.containsPosition(this._markers[e],i))return new _X(this._markers[e],e+1,this._markers.length)}};IX=RX([OX(1,nB),OX(2,rd)],IX);const PX=eo("IMarkerNavigationService");let NX=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new Nt}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new IX(t,this._markerService,this._configService)}};var BX;NX=RX([OX(0,nB),OX(1,rd)],NX),gd(PX,NX,1),function(t){t.className=function(t){switch(t){case WF.Ignore:return"severity-ignore "+go.asClassName(xs.info);case WF.Info:return go.asClassName(xs.info);case WF.Warning:return go.asClassName(xs.warning);case WF.Error:return go.asClassName(xs.error);default:return""}}}(BX||(BX={}));var $X,WX=function(t,i){return function(e,s){i(e,s,t)}};class jX{constructor(t,i,e,s,n){this._openerService=s,this._labelService=n,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new Ui,this._editor=i;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Nl(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new fk(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),t.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll((t=>{r.style.left=`-${t.scrollLeft}px`,r.style.top=`-${t.scrollTop}px`}))),this._disposables.add(this._scrollable)}dispose(){Vi(this._disposables)}update(t){const{source:i,message:e,relatedInformation:s,code:n}=t;let r=((null==i?void 0:i.length)||0)+2;n&&(r+="string"==typeof n?n.length:n.value.length);const o=zn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Ol(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(t)),this._editor.applyFontInfo(this._messageBlock);let h=this._messageBlock;for(const t of o)h=document.createElement("div"),h.innerText=t,""===t&&(h.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(h);if(i||n){const t=document.createElement("span");if(t.classList.add("details"),h.appendChild(t),i){const e=document.createElement("span");e.innerText=i,e.classList.add("source"),t.appendChild(e)}if(n)if("string"==typeof n){const i=document.createElement("span");i.innerText=`(${n})`,i.classList.add("code"),t.appendChild(i)}else this._codeLink=Fa("a.code-link"),this._codeLink.setAttribute("href",`${n.target.toString()}`),this._codeLink.onclick=t=>{this._openerService.open(n.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()},xa(this._codeLink,Fa("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Ol(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),u(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(66))}px`,this._lines+=1;for(const i of s){const e=document.createElement("div"),s=document.createElement("a");s.classList.add("filename"),s.innerText=`${this._labelService.getUriBasenameLabel(i.resource)}(${i.startLineNumber}, ${i.startColumn}): `,s.title=this._labelService.getUriLabel(i.resource),this._relatedDiagnostics.set(s,i);const n=document.createElement("span");n.innerText=i.message,e.appendChild(s),e.appendChild(n),this._lines+=1,t.appendChild(e)}}const c=this._editor.getOption(50),l=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:l,scrollHeight:c.lineHeight*this._lines})}layout(t,i){this._scrollable.getDomNode().style.height=`${t}px`,this._scrollable.getDomNode().style.width=`${i}px`,this._scrollable.setScrollDimensions({width:i,height:t})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(t){let i="";switch(t.severity){case eB.Error:i=Q(0,"Error");break;case eB.Warning:i=Q(0,"Warning");break;case eB.Info:i=Q(0,"Info");break;case eB.Hint:i=Q(0,"Hint")}let e=Q(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const s=this._editor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1&&(e=`${s.getLineContent(t.startLineNumber)}, ${e}`),e}}let VX=$X=class extends VQ{constructor(t,i,e,s,n,r,o){super(t,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},n),this._themeService=i,this._openerService=e,this._menuService=s,this._contextKeyService=r,this._labelService=o,this._callOnDispose=new Ui,this._onDidSelectRelatedInformation=new ne,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=eB.Warning,this._backgroundColor=Gg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(YX);let i=KX,e=qX;this._severity===eB.Warning?(i=GX,e=ZX):this._severity===eB.Info&&(i=JX,e=QX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(zQ),secondaryHeadingColor:t.getColor(UQ)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(t){super._fillHead(t),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const i=[],e=this._menuService.createMenu($X.TitleMenu,this._contextKeyService);MN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=xa(t,Fa(""))}_fillBody(t){this._parentContainer=t,t.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),t.appendChild(this._container),this._message=new jX(this._container,this.editor,(t=>this._onDidSelectRelatedInformation.fire(t)),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(t,i,e){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const s=bs.lift(t),n=this.editor.getPosition(),r=n&&s.containsPosition(n)?n:s.getStartPosition();super.show(r,this.computeRequiredHeight());const o=this.editor.getModel();if(o){const t=Q(0,e>1?"{0} of {1} problems":"{0} of {1} problem",i,e);this.setTitle(eA(o.uri),t)}this._icon.className=`codicon ${BX.className(eB.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(t){this._container.classList.remove("stale"),this._message.update(t)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._heightInPixel=t,this._message.layout(t,i),this._container.style.height=`${t}px`}_onWidth(t){this._message.layout(this._heightInPixel,t)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};VX.TitleMenu=new Sh("gotoErrorTitleMenu"),VX=$X=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([WX(1,Nk),WX(2,ZN),WX(3,xh),WX(4,io),WX(5,th),WX(6,CO)],VX);const HX=Zb(Ww,jw),zX=Zb(Vw,Hw),UX=Zb(zw,Uw),KX=Jm("editorMarkerNavigationError.background",{dark:HX,light:HX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget error color.")),qX=Jm("editorMarkerNavigationError.headerBackground",{dark:Gb(KX,.1),light:Gb(KX,.1),hcDark:null,hcLight:null},Q(0,"Editor marker navigation widget error heading background.")),GX=Jm("editorMarkerNavigationWarning.background",{dark:zX,light:zX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget warning color.")),ZX=Jm("editorMarkerNavigationWarning.headerBackground",{dark:Gb(GX,.1),light:Gb(GX,.1),hcDark:"#0C141F",hcLight:Gb(GX,.2)},Q(0,"Editor marker navigation widget warning heading background.")),JX=Jm("editorMarkerNavigationInfo.background",{dark:UX,light:UX,hcDark:iw,hcLight:iw},Q(0,"Editor marker navigation widget info color.")),QX=Jm("editorMarkerNavigationInfo.headerBackground",{dark:Gb(JX,.1),light:Gb(JX,.1),hcDark:null,hcLight:null},Q(0,"Editor marker navigation widget info heading background.")),YX=Jm("editorMarkerNavigation.background",{dark:qw,light:qw,hcDark:qw,hcLight:qw},Q(0,"Editor marker navigation widget background."));var XX,t0=function(t,i){return function(e,s){i(e,s,t)}};let i0=XX=class{static get(t){return t.getContribution(XX.ID)}constructor(t,i,e,s,n){this._markerNavigationService=i,this._contextKeyService=e,this._editorService=s,this._instantiationService=n,this._sessionDispoables=new Ui,this._editor=t,this._widgetVisible=r0.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(t){if(this._model&&this._model.matches(t))return this._model;let i=!1;return this._model&&(i=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(t),i&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(VX,this._editor),this._widget.onDidClose((()=>this.close()),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition((t=>{var i,e,s;(null===(i=this._model)||void 0===i?void 0:i.selected)&&bs.containsPosition(null===(e=this._model)||void 0===e?void 0:e.selected.marker,t.position)||null===(s=this._model)||void 0===s||s.resetIndex()}))),this._sessionDispoables.add(this._model.onDidChange((()=>{if(!this._widget||!this._widget.position||!this._model)return;const t=this._model.find(this._editor.getModel().uri,this._widget.position);t?this._widget.updateMarker(t.marker):this._widget.showStale()}))),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation((t=>{this._editorService.openCodeEditor({resource:t.resource,options:{pinned:!0,revealIfOpened:!0,selection:bs.lift(t).collapseToStart()}},this._editor),this.close(!1)}))),this._sessionDispoables.add(this._editor.onDidChangeModel((()=>this._cleanUp()))),this._model}close(t=!0){this._cleanUp(),t&&this._editor.focus()}showAtMarker(t){if(this._editor.hasModel()){const i=this._getOrCreateModel(this._editor.getModel().uri);i.resetIndex(),i.move(!0,this._editor.getModel(),new vs(t.startLineNumber,t.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}async nagivate(t,i){var e,s;if(this._editor.hasModel()){const n=this._getOrCreateModel(i?void 0:this._editor.getModel().uri);if(n.move(t,this._editor.getModel(),this._editor.getPosition()),!n.selected)return;if(n.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=await this._editorService.openCodeEditor({resource:n.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:n.selected.marker}},this._editor);r&&(null===(e=XX.get(r))||void 0===e||e.close(),null===(s=XX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}};i0.ID="editor.contrib.markerController",i0=XX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t0(1,PX),t0(2,th),t0(3,so),t0(4,io)],i0);class e0 extends Ga{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}async run(t,i){var e;i.hasModel()&&(null===(e=i0.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}}class s0 extends e0{constructor(){super(!0,!1,{id:s0.ID,label:s0.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:578,weight:100},menuOpts:{menuId:VX.TitleMenu,title:s0.LABEL,icon:AV("marker-navigation-next",xs.arrowDown,Q(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}s0.ID="editor.action.marker.next",s0.LABEL=Q(0,"Go to Next Problem (Error, Warning, Info)");class n0 extends e0{constructor(){super(!1,!1,{id:n0.ID,label:n0.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:1602,weight:100},menuOpts:{menuId:VX.TitleMenu,title:n0.LABEL,icon:AV("marker-navigation-previous",xs.arrowUp,Q(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}n0.ID="editor.action.marker.prev",n0.LABEL=Q(0,"Go to Previous Problem (Error, Warning, Info)"),iu(i0.ID,i0,4),Xa(s0),Xa(n0),Xa(class extends e0{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:Q(0,"Go to Next Problem in Files (Error, Warning, Info)"),alias:"Go to Next Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:66,weight:100},menuOpts:{menuId:Sh.MenubarGoMenu,title:Q(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),Xa(class extends e0{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:Q(0,"Go to Previous Problem in Files (Error, Warning, Info)"),alias:"Go to Previous Problem in Files (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:1090,weight:100},menuOpts:{menuId:Sh.MenubarGoMenu,title:Q(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const r0=new Xo("markersNavigationVisible",!1);Ya(new(qa.bindToContribution(i0.get))({id:"closeMarkersNavigation",precondition:r0,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:PS.focus,primary:9,secondary:[1033]}}));var o0=function(t,i){return function(e,s){i(e,s,t)}};const h0=Fa;class c0{constructor(t,i,e){this.owner=t,this.range=i,this.marker=e}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}const l0={type:1,filter:{include:yZ.QuickFix},triggerAction:kZ.QuickFixHover};let a0=class{constructor(t,i,e,s){this._editor=t,this._markerDecorationsService=i,this._openerService=e,this._languageFeaturesService=s,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type&&!t.supportsMarkerHover)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];for(const o of i){const i=o.range.startLineNumber===s?o.range.startColumn:1,h=o.range.endLineNumber===s?o.range.endColumn:n,c=this._markerDecorationsService.getMarker(e.uri,o);if(!c)continue;const l=new bs(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new c0(this,l,c))}return r}renderHoverParts(t,i){if(!i.length)return Ki.None;const e=new Ui;i.forEach((i=>t.fragment.appendChild(this.renderMarkerHover(i,e))));const s=1===i.length?i[0]:i.sort(((t,i)=>eB.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=h0("div.hover-row"),s=xa(e,h0("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=xa(s,h0("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=h0("span");n&&(xa(t,h0("span")).innerText=n);const e=xa(t,h0("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Il(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),xa(e,h0("span")).innerText=o.value;const r=xa(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=xa(s,h0("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(u(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=xa(s,h0("div"));o.style.marginTop="8px";const h=xa(o,h0("a"));h.innerText=`${eA(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Il(h,"click",(t=>{t.stopPropagation(),t.preventDefault(),this._openerService&&this._openerService.open(e,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:n,startColumn:r}}}).catch(Li)})));const c=xa(o,h0("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,e){if(i.marker.severity!==eB.Error&&i.marker.severity!==eB.Warning&&i.marker.severity!==eB.Info||t.statusBar.addAction({label:Q(0,"View Problem"),commandId:s0.ID,run:()=>{var e;t.hide(),null===(e=i0.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(h0("div"));this.recentMarkerCodeActionsInfo&&(sB.makeKey(this.recentMarkerCodeActionsInfo.marker)===sB.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(s.textContent=Q(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Ki.None:e.add(ic((()=>s.textContent=Q(0,"Checking for quick fixes...")),200));s.textContent||(s.textContent=String.fromCharCode(160));const r=this.getCodeActions(i.marker);e.add(zi((()=>r.cancel()))),r.then((r=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:r.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return r.dispose(),void(s.textContent=Q(0,"No quick fixes available"));s.style.display="none";let o=!1;e.add(zi((()=>{o||r.dispose()}))),t.statusBar.addAction({label:Q(0,"Quick Fix..."),commandId:EZ,run:i=>{o=!0;const e=xJ.get(this._editor),s=Zl(i);t.hide(),null==e||e.showCodeActions(l0,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Li)}}getCodeActions(t){return Zh((i=>_Z(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new bs(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),l0,xO.None,i)))}};a0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([o0(1,Dm),o0(2,ZN),o0(3,op)],a0);const u0="editor.action.inlineSuggest.commit",d0="editor.action.inlineSuggest.showPrevious",f0="editor.action.inlineSuggest.showNext";var g0,p0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},m0=function(t,i){return function(e,s){i(e,s,t)}};let w0=class extends Ki{constructor(t,i,e){super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=Tz(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(62).showToolbar)),this.sessionPosition=void 0,this.position=bz(this,(t=>{var i,e,s;const n=null===(i=this.model.read(t))||void 0===i?void 0:i.ghostText.read(t);if(!this.alwaysShowToolbar.read(t)||!n||0===n.parts.length)return this.sessionPosition=void 0,null;const r=n.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==n.lineNumber&&(this.sessionPosition=void 0);const o=new vs(n.lineNumber,Math.min(r,null!==(s=null===(e=this.sessionPosition)||void 0===e?void 0:e.column)&&void 0!==s?s:Number.MAX_SAFE_INTEGER));return this.sessionPosition=o,o})),this._register(Az(((i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(y0,this.editor,!0,this.position,s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]}))));t.addContentWidget(n),e.add(zi((()=>t.removeContentWidget(n)))),e.add(xz((t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Fs.Explicit&&s.triggerExplicitly()})))})))}};w0=p0([m0(2,io)],w0);const v0=AV("inline-suggestion-hints-next",xs.chevronRight,Q(0,"Icon for show next parameter hint.")),b0=AV("inline-suggestion-hints-previous",xs.chevronLeft,Q(0,"Icon for show previous parameter hint."));let y0=g0=class extends Ki{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new oo(t,i,e,!0,(()=>this._commandService.executeCommand(t))),n=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let r=i;return n&&(r=Q(0,"{0} ({1})",i,n.getLabel())),s.tooltip=r,s}constructor(t,i,s,n,r,o,h,c,l,a,u){super(),this.editor=t,this.withBorder=i,this._position=s,this._currentSuggestionIdx=n,this._suggestionCount=r,this._extraCommands=o,this._commandService=h,this.keybindingService=l,this._contextKeyService=a,this._menuService=u,this.id="InlineSuggestionHintsContentWidget"+g0.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Va("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Va("div@toolBar")]),this.previousAction=this.createCommandAction(d0,Q(0,"Previous"),go.asClassName(b0)),this.availableSuggestionCountAction=new oo("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(f0,Q(0,"Next"),go.asClassName(v0)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Sh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new rc((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new rc((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(S0,this.nodes.toolBar,Sh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof Mh)return c.createInstance(C0,t,void 0);if(t===this.availableSuggestionCountAction){const i=new k0(void 0,t,{label:!0,icon:!1});return i.setClass("availableSuggestionCount"),i}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility((t=>{g0._dropDownVisible=t}))),this._register(xz((t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(xz((t=>{const i=this._suggestionCount.read(t),e=this._currentSuggestionIdx.read(t);void 0!==i?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${e+1}/${i}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),void 0!==i&&i>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()}))),this._register(xz((t=>{const i=this._extraCommands.read(t);if(e(this.lastCommands,i))return;this.lastCommands=i;const s=i.map((t=>({class:void 0,id:t.id,enabled:!0,tooltip:t.tooltip||"",label:t.title,run:()=>this._commandService.executeCommand(t.id)})));for(const[t,i]of this.inlineCompletionsActionsMenus.getActions())for(const t of i)t instanceof Mh&&s.push(t);s.length>0&&s.unshift(new co),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};y0._dropDownVisible=!1,y0.id=0,y0=g0=p0([m0(6,po),m0(7,io),m0(8,HC),m0(9,th),m0(10,xh)],y0);class k0 extends tN{constructor(){super(...arguments),this._className=void 0}setClass(t){this._className=t}render(t){super.render(t),this._className&&t.classList.add(this._className)}}class C0 extends FN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Va("div.keybinding").root;new Pj(i,Et,{disableTitle:!0,...Ij}).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let S0=class extends RK{constructor(t,i,e,s,n,r,o,h){super(t,{resetMenu:i,...e},s,n,r,o,h),this.menuId=i,this.options2=e,this.menuService=s,this.contextKeyService=n,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];MN(this.menu,null===(t=this.options2)||void 0===t?void 0:t.menuOptions,{primary:h,secondary:c},null===(e=null===(i=this.options2)||void 0===i?void 0:i.toolbarOptions)||void 0===e?void 0:e.primaryGroup,null===(n=null===(s=this.options2)||void 0===s?void 0:s.toolbarOptions)||void 0===n?void 0:n.shouldInlineSubmenu,null===(o=null===(r=this.options2)||void 0===r?void 0:r.toolbarOptions)||void 0===o?void 0:o.useSeparatorsInPrimaryActions),c.push(...this.additionalActions),h.unshift(...this.prependedPrimaryActions),this.setActions(h,c)}setPrependedPrimaryActions(t){e(this.prependedPrimaryActions,t,((t,i)=>t===i))||(this.prependedPrimaryActions=t,this.updateToolbar())}setAdditionalSecondaryActions(t){e(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};S0=p0([m0(3,xh),m0(4,th),m0(5,qO),m0(6,HC),m0(7,Th)],S0);var x0,D0=function(t,i){return function(e,s){i(e,s,t)}};let E0=x0=class extends Ki{static get(t){return t.getContribution(x0.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Ui,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new rc((()=>this._reactToEditorMouseMove(this._mouseMoveEvent)),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())})))}_hookEvents(){const t=this._editor.getOption(60);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,this._hidingDelay=t.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._toUnhook.add(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))):(this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))),this._toUnhook.add(this._editor.onMouseLeave((t=>this._onEditorMouseLeave(t)))),this._toUnhook.add(this._editor.onDidChangeModel((()=>{this._cancelScheduler(),this._hideWidgets()}))),this._toUnhook.add(this._editor.onDidChangeModelContent((()=>this._cancelScheduler()))),this._toUnhook.add(this._editor.onDidScrollChange((t=>this._onEditorScrollChanged(t))))}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(t){(t.scrollTopChanged||t.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(t){var i;this._isMouseDown=!0;const e=t.target;9!==e.type||e.detail!==vX.ID?12===e.type&&e.detail===SX.ID||(12!==e.type&&(this._hoverClicked=!1),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i,e;this._cancelScheduler(),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||(null===(e=this._contentWidget)||void 0===e?void 0:e.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_isMouseOverWidget(t){var i,e,s,n,r;const o=t.target;return!((!this._isHoverSticky||9!==o.type||o.detail!==vX.ID)&&(!this._isHoverSticky||!(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(null===(e=t.event.browserEvent.view)||void 0===e?void 0:e.document.activeElement))||(null===(n=null===(s=t.event.browserEvent.view)||void 0===s?void 0:s.getSelection())||void 0===n?void 0:n.isCollapsed))&&(this._isHoverSticky||9!==o.type||o.detail!==vX.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==SX.ID))}_onEditorMouseMove(t){var i,e,s,n;this._mouseMoveEvent=t,(null===(i=this._contentWidget)||void 0===i?void 0:i.isFocused)||(null===(e=this._contentWidget)||void 0===e?void 0:e.isResizing)||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(null===(s=this._contentWidget)||void 0===s?void 0:s.isVisibleFromKeyboard)||(this._isMouseOverWidget(t)?this._reactToEditorMouseMoveRunner.cancel():(null===(n=this._contentWidget)||void 0===n?void 0:n.isVisible)&&this._isHoverSticky&&this._hidingDelay>0?this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay):this._reactToEditorMouseMove(t))}_reactToEditorMouseMove(t){var i,e,s;if(!t)return;const n=t.target,r=null===(i=n.element)||void 0===i?void 0:i.classList.contains("colorpicker-color-decoration"),o=this._editor.getOption(146);if((!r||("click"!==o||this._hoverActivatedByColorDecoratorClick)&&("hover"!==o||this._isHoverEnabled)&&("clickAndHover"!==o||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))&&(r||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(e=this._glyphWidget)||void 0===e||e.hide()):2===n.type&&n.position?(null===(s=this._contentWidget)||void 0===s||s.hide(),this._glyphWidget||(this._glyphWidget=new SX(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(n.position.lineNumber)):void this._hideWidgets();this._hideWidgets()}_onKeyDown(t){var i;if(!this._editor.hasModel())return;const e=this._keybindingService.softDispatch(t,this._editor.getDomNode()),s=1===e.kind||2===e.kind&&"editor.action.showHover"===e.commandId&&(null===(i=this._contentWidget)||void 0===i?void 0:i.isVisible);5===t.keyCode||6===t.keyCode||57===t.keyCode||4===t.keyCode||s||this._hideWidgets()}_hideWidgets(){var t,i,e;this._isMouseDown&&this._hoverClicked&&(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible)||y0.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,null===(i=this._glyphWidget)||void 0===i||i.hide(),null===(e=this._contentWidget)||void 0===e||e.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(gX,this._editor)),this._contentWidget}showContentHover(t,i,e,s,n=!1){this._hoverActivatedByColorDecoratorClick=n,this._getOrCreateContentWidget().startShowingAtRange(t,i,e,s)}focus(){var t;null===(t=this._contentWidget)||void 0===t||t.focus()}scrollUp(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollUp()}scrollDown(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollDown()}scrollLeft(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollLeft()}scrollRight(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollRight()}pageUp(){var t;null===(t=this._contentWidget)||void 0===t||t.pageUp()}pageDown(){var t;null===(t=this._contentWidget)||void 0===t||t.pageDown()}goToTop(){var t;null===(t=this._contentWidget)||void 0===t||t.goToTop()}goToBottom(){var t;null===(t=this._contentWidget)||void 0===t||t.goToBottom()}get isColorPickerVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible}get isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible}dispose(){var t,i;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};var A0;E0.ID="editor.contrib.hover",E0=x0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D0(1,io),D0(2,ZN),D0(3,ud),D0(4,HC)],E0),function(t){t.NoAutoFocus="noAutoFocus",t.FocusIfVisible="focusIfVisible",t.AutoFocusImmediately="autoFocusImmediately"}(A0||(A0={})),iu(E0.ID,E0,2),Xa(class extends Ga{constructor(){super({id:"editor.action.showHover",label:Q(0,"Show or Focus Hover"),metadata:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[A0.NoAutoFocus,A0.FocusIfVisible,A0.AutoFocusImmediately],enumDescriptions:[Q(0,"The hover will not automatically take focus."),Q(0,"The hover will take focus only if it is already visible."),Q(0,"The hover will automatically take focus when it appears.")],default:A0.FocusIfVisible}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=E0.get(i);if(!s)return;const n=null==e?void 0:e.focus;let r=A0.FocusIfVisible;n in A0?r=n:"boolean"==typeof n&&n&&(r=A0.AutoFocusImmediately);const o=t=>{const e=i.getPosition(),n=new bs(e.lineNumber,e.column,e.lineNumber,e.column);s.showContentHover(n,1,1,t)},h=2===i.getOption(2);s.isHoverVisible?r!==A0.NoAutoFocus?s.focus():o(h):o(h||r===A0.AutoFocusImmediately)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:Q(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=E0.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new bs(s.lineNumber,s.column,s.lineNumber,s.column),r=YY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollUpHover",label:Q(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollUp()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollDownHover",label:Q(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollDown()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollLeftHover",label:Q(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollLeft()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.scrollRightHover",label:Q(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=E0.get(i);e&&e.scrollRight()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pageUpHover",label:Q(0,"Page Up Hover"),alias:"Page Up Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=E0.get(i);e&&e.pageUp()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pageDownHover",label:Q(0,"Page Down Hover"),alias:"Page Down Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=E0.get(i);e&&e.pageDown()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToTopHover",label:Q(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=E0.get(i);e&&e.goToTop()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToBottomHover",label:Q(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:PS.hoverFocused,kbOpts:{kbExpr:PS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=E0.get(i);e&&e.goToBottom()}}),oX.register(FX),oX.register(a0),Vk(((t,i)=>{const e=t.getColor(bv);e&&(i.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${e.transparent(.5)}; }`),i.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${e.transparent(.5)}; }`))}));class M0 extends Ki{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=this._editor.getOption(146);if("click"!==i&&"clickAndHover"!==i)return;const e=t.target;if(6!==e.type)return;if(!e.detail.injectedText)return;if(e.detail.injectedText.options.attachedData!==YJ)return;if(!e.range)return;const s=this._editor.getContribution(E0.ID);if(s&&!s.isColorPickerVisible){const t=new bs(e.range.startLineNumber,e.range.startColumn+1,e.range.endLineNumber,e.range.endColumn+1);s.showContentHover(t,1,0,!1,!0)}}}M0.ID="editor.contrib.colorContribution",iu(M0.ID,M0,2),oX.register(pQ);var L0,F0,T0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},R0=function(t,i){return function(e,s){i(e,s,t)}};let O0=L0=class extends Ki{constructor(t,i,e,s,n,r,o){super(),this._editor=t,this._modelService=e,this._keybindingService=s,this._instantiationService=n,this._languageFeatureService=r,this._languageConfigurationService=o,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=PS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=PS.standaloneColorPickerFocused.bindTo(i)}showOrFocus(){var t;this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||null===(t=this._standaloneColorPickerWidget)||void 0===t||t.focus():this._standaloneColorPickerWidget=new _0(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var t;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),null===(t=this._standaloneColorPickerWidget)||void 0===t||t.hide(),this._editor.focus()}insertColor(){var t;null===(t=this._standaloneColorPickerWidget)||void 0===t||t.updateEditor(),this.hide()}static get(t){return t.getContribution(L0.ID)}};O0.ID="editor.contrib.standaloneColorPickerController",O0=L0=T0([R0(1,th),R0(2,no),R0(3,HC),R0(4,io),R0(5,op),R0(6,Nd)],O0),iu(O0.ID,O0,1);let _0=F0=class extends Ki{constructor(t,i,e,s,n,r,o,h){var c;super(),this._editor=t,this._standaloneColorPickerVisible=i,this._standaloneColorPickerFocused=e,this._modelService=n,this._keybindingService=r,this._languageFeaturesService=o,this._languageConfigurationService=h,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ne),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(wQ,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),a=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Sa(this._body));this._register(u.onDidBlur((()=>{this.hide()}))),this._register(u.onDidFocus((()=>{this.focus()}))),this._register(this._editor.onDidChangeCursorPosition((()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()}))),this._register(this._editor.onMouseMove((t=>{var i;const e=null===(i=t.target.element)||void 0===i?void 0:i.classList;e&&e.contains("colorpicker-color-decoration")&&this.hide()}))),this._register(this.onResult((t=>{this._render(t.value,t.foundInEditor)}))),this._start(a),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return F0.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:t?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(t){const i=await this._computeAsync(t);i&&this._onResult.fire(new I0(i.result,i.foundInEditor))}async _computeAsync(t){if(!this._editor.hasModel())return null;const i={range:t,color:{red:0,green:0,blue:0,alpha:1}},e=await this._standaloneColorPickerParticipant.createColorHover(i,new jJ(this._modelService,this._languageConfigurationService),this._languageFeaturesService.colorProvider);return e?{result:e.colorHover,foundInEditor:e.foundInEditor}:null}_render(t,i){const e=document.createDocumentFragment();let s;const n={fragment:e,statusBar:this._register(new bX(this._keybindingService)),setColorPicker:t=>s=t,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=t,this._register(this._standaloneColorPickerParticipant.renderHoverParts(n,[t])),void 0===s)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(.66*this._editor.getLayoutInfo().width,500)+"px",this._body.tabIndex=0,this._body.appendChild(e),s.layout();const r=s.body,o=r.saturationBox.domNode.clientWidth,h=r.domNode.clientWidth-o-22-8,c=s.body.enterButton;null==c||c.onClicked((()=>{this.updateEditor(),this.hide()}));const l=s.header;l.pickedColorNode.style.width=o+8+"px",l.originalColorNode.style.width=h+"px";const a=s.header.closeButton;null==a||a.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};_0.ID="editor.contrib.standaloneColorPickerWidget",_0=F0=T0([R0(3,io),R0(4,no),R0(5,HC),R0(6,op),R0(7,Nd)],_0);class I0{constructor(t,i){this.value=t,this.foundInEditor=i}}Xa(class extends Ga{constructor(){super({id:"editor.action.hideColorPicker",label:Q(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:PS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=O0.get(i))||void 0===e||e.hide()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:Q(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:PS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=O0.get(i))||void 0===e||e.insertColor()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:Q(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:Q(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:Sh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=O0.get(i))||void 0===e||e.showOrFocus()}});class P0{constructor(t,i,e){this.languageConfigurationService=e,this._selection=t,this._insertSpace=i,this._usedEndToken=null}static _haystackHasNeedleAtOffset(t,i,e){if(e<0)return!1;const s=i.length;if(e+s>t.length)return!1;for(let n=0;n<s;n++){const s=t.charCodeAt(e+n),r=i.charCodeAt(n);if(s!==r&&!(s>=65&&s<=90&&s+32===r||r>=65&&r<=90&&r+32===s))return!1}return!0}_createOperationsForBlockComment(t,i,e,s,n,r){const o=t.startLineNumber,h=t.startColumn,c=t.endLineNumber,l=t.endColumn,a=n.getLineContent(o),u=n.getLineContent(c);let d,f=a.lastIndexOf(i,h-1+i.length),g=u.indexOf(e,l-1-e.length);if(-1!==f&&-1!==g)if(o===c)a.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=a.substring(f+i.length),s=u.substring(0,g);(t.indexOf(e)>=0||s.indexOf(e)>=0)&&(f=-1,g=-1)}-1!==f&&-1!==g?(s&&f+i.length<a.length&&32===a.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===u.charCodeAt(g-1)&&(e=" "+e,g-=1),d=P0._createRemoveBlockCommentOperations(new bs(o,f+i.length+1,c,g+1),i,e)):(d=P0._createAddBlockCommentOperations(t,i,e,this._insertSpace),this._usedEndToken=1===d.length?e:null);for(const t of d)r.addTrackedEditOperation(t.range,t.text)}static _createRemoveBlockCommentOperations(t,i,e){const s=[];return bs.isEmpty(t)?s.push(QR.delete(new bs(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(QR.delete(new bs(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(QR.delete(new bs(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return bs.isEmpty(t)?n.push(QR.replace(new bs(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(QR.insert(new vs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(QR.insert(new vs(t.endLineNumber,t.endColumn),(s?" ":"")+e))),n}getEditOperations(t,i){const e=this._selection.startLineNumber,s=this._selection.startColumn;t.tokenization.tokenizeIfCheap(e);const n=t.getLanguageIdAtPosition(e,s),r=this.languageConfigurationService.getLanguageConfiguration(n).comments;r&&r.blockCommentStartToken&&r.blockCommentEndToken&&this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,t,i)}computeCursorState(t,i){const e=i.getInverseEditOperations();if(2===e.length){const t=e[0],i=e[1];return new ys(t.range.endLineNumber,t.range.endColumn,i.range.startLineNumber,i.range.startColumn)}{const t=e[0].range,i=this._usedEndToken?-this._usedEndToken.length-1:0;return new ys(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class N0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,a=s.length;h<a;h++){const a=s[h],u=n+h;if(u===n&&o){a.ignore=!0;continue}const d=e.getLineContent(u),f=Un(d);if(-1!==f){if(l=!1,a.ignore=!1,a.commentStrOffset=f,c&&!P0._haystackHasNeedleAtOffset(d,a.commentStr,f)&&(0===t?c=!1:1===t||(a.ignore=!0)),c&&i){const t=f+a.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(a.commentStrLength+=1)}}else a.ignore=r,a.commentStrOffset=d.length}if(0===t&&l){c=!1;for(let t=0,i=s.length;t<i;t++)s[t].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:s}}static _gatherPreflightData(t,i,e,s,n,r,o,h){const c=N0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:N0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=N0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(N0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new vs(s.positionLineNumber,s.positionColumn);for(let e=0,s=n.length;e<s;e++)i.addEditOperation(n[e].range,n[e].text),bs.isEmpty(n[e].range)&&bs.getStartPosition(n[e].range).equals(r)&&t.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(n[e].text||"").length);this._selectionId=i.trackSelection(s)}_attemptRemoveBlockComment(t,i,e,s){let n=i.startLineNumber,r=i.endLineNumber;const o=s.length+Math.max(t.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.startColumn);let h=t.getLineContent(n).lastIndexOf(e,o-1),c=t.getLineContent(r).indexOf(s,i.endColumn-1-e.length);return-1!==h&&-1===c&&(c=t.getLineContent(n).indexOf(s,h+e.length),r=n),-1===h&&-1!==c&&(h=t.getLineContent(r).lastIndexOf(e,c),n=r),!i.isEmpty()||-1!==h&&-1!==c||(h=t.getLineContent(n).indexOf(e),-1!==h&&(c=t.getLineContent(n).indexOf(s,h+e.length))),-1!==h&&32===t.getLineContent(n).charCodeAt(h+e.length)&&(e+=" "),-1!==c&&32===t.getLineContent(r).charCodeAt(c-1)&&(s=" "+s,c-=1),-1!==h&&-1!==c?P0._createRemoveBlockCommentOperations(new bs(n,h+e.length+1,r,c+1),e,s):null}_executeBlockComment(t,i,e){t.tokenization.tokenizeIfCheap(e.startLineNumber);const s=t.getLanguageIdAtPosition(e.startLineNumber,1),n=this.languageConfigurationService.getLanguageConfiguration(s).comments;if(!n||!n.blockCommentStartToken||!n.blockCommentEndToken)return;const r=n.blockCommentStartToken,o=n.blockCommentEndToken;let h=this._attemptRemoveBlockComment(t,e,r,o);if(!h){if(e.isEmpty()){const i=t.getLineContent(e.startLineNumber);let s=Un(i);-1===s&&(s=i.length),h=P0._createAddBlockCommentOperations(new bs(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=P0._createAddBlockCommentOperations(new bs(e.startLineNumber,t.getLineFirstNonWhitespaceColumn(e.startLineNumber),e.endLineNumber,t.getLineMaxColumn(e.endLineNumber)),r,o,this._insertSpace);1===h.length&&(this._deltaColumn=r.length+1)}this._selectionId=i.trackSelection(e);for(const t of h)i.addEditOperation(t.range,t.text)}getEditOperations(t,i){let e=this._selection;if(this._moveEndPositionDown=!1,e.startLineNumber===e.endLineNumber&&this._ignoreFirstLine)return i.addEditOperation(new bs(e.startLineNumber,t.getLineMaxColumn(e.startLineNumber),e.startLineNumber+1,1),e.startLineNumber===t.getLineCount()?"":"\n"),void(this._selectionId=i.trackSelection(e));e.startLineNumber<e.endLineNumber&&1===e.endColumn&&(this._moveEndPositionDown=!0,e=e.setEndPosition(e.endLineNumber-1,t.getLineMaxColumn(e.endLineNumber-1)));const s=N0._gatherPreflightData(this._type,this._insertSpace,t,e.startLineNumber,e.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return s.supported?this._executeLineComments(t,i,s,e):this._executeBlockComment(t,i,e)}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),new ys(e.selectionStartLineNumber,e.selectionStartColumn+this._deltaColumn,e.positionLineNumber,e.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(t,i){const e=[];for(let s=0,n=t.length;s<n;s++){const n=t[s];n.ignore||e.push(QR.delete(new bs(i+s,n.commentStrOffset+1,i+s,n.commentStrOffset+n.commentStrLength+1)))}return e}_createAddLineCommentsOperations(t,i){const e=[],s=this._insertSpace?" ":"";for(let n=0,r=t.length;n<r;n++){const r=t[n];r.ignore||e.push(QR.insert(new vs(i+n,r.commentStrOffset+1),r.commentStr+s))}return e}static nextVisibleColumn(t,i,e,s){return e?t+(i-t%i):t+s}static _normalizeInsertionPoint(t,i,e,s){let n,r,o=1073741824;for(let n=0,r=i.length;n<r;n++){if(i[n].ignore)continue;const r=t.getLineContent(e+n);let h=0;for(let t=0,e=i[n].commentStrOffset;h<o&&t<e;t++)h=N0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=N0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class B0 extends Ga{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(Nd);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(23),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));let h=o[0];for(let t=1;t<o.length;t++){const i=o[t];h.selection.endLineNumber===i.selection.startLineNumber&&(h.index<i.index?i.ignoreFirstLine=!0:(h.ignoreFirstLine=!0,h=i))}for(const t of o)s.push(new N0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}Xa(class extends B0{constructor(){super(0,{id:"editor.action.commentLine",label:Q(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"5_insert",title:Q(0,"&&Toggle Line Comment"),order:1}})}}),Xa(class extends B0{constructor(){super(1,{id:"editor.action.addCommentLine",label:Q(0,"Add Line Comment"),alias:"Add Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2081),weight:100}})}}),Xa(class extends B0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:Q(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2099),weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.blockComment",label:Q(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"5_insert",title:Q(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(Nd);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new P0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var $0,W0=function(t,i){return function(e,s){i(e,s,t)}};let j0=$0=class{static get(t){return t.getContribution($0.ID)}constructor(t,i,e,s,n,r,o,h){this._contextMenuService=i,this._contextViewService=e,this._contextKeyService=s,this._keybindingService=n,this._menuService=r,this._configurationService=o,this._workspaceContextService=h,this._toDispose=new Ui,this._contextMenuIsBeingShownCount=0,this._editor=t,this._toDispose.add(this._editor.onContextMenu((t=>this._onContextMenu(t)))),this._toDispose.add(this._editor.onMouseWheel((t=>{if(this._contextMenuIsBeingShownCount>0){const i=this._contextViewService.getContextViewElement(),e=t.srcElement;e.shadowRoot&&na(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(24)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(24))return this._editor.focus(),void(t.target.position&&!this._editor.getSelection().containsPosition(t.target.position)&&this._editor.setPosition(t.target.position));if(12===t.target.type)return;if(6===t.target.type&&t.target.detail.injectedText)return;if(t.event.preventDefault(),t.event.stopPropagation(),11===t.target.type)return this._showScrollbarContextMenu(t.event);if(6!==t.target.type&&7!==t.target.type&&1!==t.target.type)return;if(this._editor.focus(),t.target.position){let i=!1;for(const e of this._editor.getSelections())if(e.containsPosition(t.target.position)){i=!0;break}i||this._editor.setPosition(t.target.position)}let i=null;1!==t.target.type&&(i=t.event),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(24))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?Sh.SimpleEditorContext:Sh.EditorContext);i.length>0&&this._doShowContextMenu(i,t)}_getMenuActions(t,i){const e=[],s=this._menuService.createMenu(i,this._contextKeyService),n=s.getActions({arg:t.uri});s.dispose();for(const i of n){const[,s]=i;let n=0;for(const i of s)if(i instanceof Ah){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new lo(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new co)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let s=i;if(!s){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),i=Zl(this._editor.getDomNode());s={x:i.left+t.left,y:i.top+t.top+t.height}}const n=this._editor.getOption(126)&&!yt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getDomNode():void 0,getAnchor:()=>s,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new tN(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new tN(t,t,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:t=>this._keybindingFor(t),onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.updateOptions({hover:e})}})}_showScrollbarContextMenu(t){if(!this._editor.hasModel())return;if(this._workspaceContextService.getWorkspace().id===PO)return;const i=this._editor.getOption(72);let e=0;const s=t=>({id:"menu-action-"+ ++e,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),n=(t,i,n,r,o)=>{if(!i)return s({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(n,t)},c=[];for(const t of o)c.push(s({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new lo("menu-action-"+ ++e,t,i,void 0))(t,c)},r=[];r.push(s({label:Q(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),r.push(new co),r.push(s({label:Q(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),r.push(n(Q(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:Q(0,"Proportional"),value:"proportional"},{label:Q(0,"Fill"),value:"fill"},{label:Q(0,"Fit"),value:"fit"}])),r.push(n(Q(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:Q(0,"Mouse Over"),value:"mouseover"},{label:Q(0,"Always"),value:"always"}]));const o=this._editor.getOption(126)&&!yt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>r,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};j0.ID="editor.contrib.contextmenu",j0=$0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([W0(1,qO),W0(2,KO),W0(3,th),W0(4,HC),W0(5,xh),W0(6,rd),W0(7,RO)],j0),iu(j0.ID,j0,2),Xa(class extends Ga{constructor(){super({id:"editor.action.showContextMenu",label:Q(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=j0.get(i))||void 0===e||e.showContextMenu()}});class V0{constructor(t){this.selections=t}equals(t){const i=this.selections.length;if(i!==t.selections.length)return!1;for(let e=0;e<i;e++)if(!this.selections[e].equalsSelection(t.selections[e]))return!1;return!0}}class H0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class z0 extends Ki{static get(t){return t.getContribution(z0.ID)}constructor(t){super(),this._editor=t,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(t.onDidChangeModel((()=>{this._undoStack=[],this._redoStack=[]}))),this._register(t.onDidChangeModelContent((()=>{this._undoStack=[],this._redoStack=[]}))),this._register(t.onDidChangeCursorSelection((i=>{if(this._isCursorUndoRedo)return;if(!i.oldSelections)return;if(i.oldModelVersionId!==i.modelVersionId)return;const e=new V0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new H0(e,t.getScrollTop(),t.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new H0(new V0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){this._editor.hasModel()&&0!==this._redoStack.length&&(this._undoStack.push(new H0(new V0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(t){this._isCursorUndoRedo=!0,this._editor.setSelections(t.cursorState.selections),this._editor.setScrollPosition({scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),this._isCursorUndoRedo=!1}}z0.ID="editor.contrib.cursorUndoRedoController",iu(z0.ID,z0,0),Xa(class extends Ga{constructor(){super({id:"cursorUndo",label:Q(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=z0.get(i))||void 0===s||s.cursorUndo()}}),Xa(class extends Ga{constructor(){super({id:"cursorRedo",label:Q(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=z0.get(i))||void 0===s||s.cursorRedo()}});class U0{constructor(t,i,e){this.selection=t,this.targetPosition=i,this.copy=e,this.targetSelection=null}getEditOperations(t,i){const e=t.getValueInRange(this.selection);this.copy||i.addEditOperation(this.selection,null),i.addEditOperation(new bs(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),e),this.targetSelection=!this.selection.containsPosition(this.targetPosition)||this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition))?this.copy?new ys(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.targetPosition.lineNumber>this.selection.endLineNumber?new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.targetPosition.lineNumber<this.selection.endLineNumber?new ys(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn):this.selection.endColumn<=this.targetPosition.column?new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):new ys(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn):this.selection}computeCursorState(t,i){return this.targetSelection}}function K0(t){return pt?t.altKey:t.ctrlKey}class q0 extends Ki{constructor(t){super(),this._editor=t,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._register(this._editor.onMouseDrag((t=>this._onEditorMouseDrag(t)))),this._register(this._editor.onMouseDrop((t=>this._onEditorMouseDrop(t)))),this._register(this._editor.onMouseDropCanceled((()=>this._onEditorMouseDropCanceled()))),this._register(this._editor.onKeyDown((t=>this.onEditorKeyDown(t)))),this._register(this._editor.onKeyUp((t=>this.onEditorKeyUp(t)))),this._register(this._editor.onDidBlurEditorWidget((()=>this.onEditorBlur()))),this._register(this._editor.onDidBlurEditorText((()=>this.onEditorBlur()))),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(K0(t)&&(this._modifierPressed=!0),this._mouseDown&&K0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(K0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===q0.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(t){this._mouseDown=!0}_onEditorMouseUp(t){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(t){const i=t.target;if(null===this._dragSelection){const t=(this._editor.getSelections()||[]).filter((t=>i.position&&t.containsPosition(i.position)));if(1!==t.length)return;this._dragSelection=t[0]}K0(t.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),i.position&&(this._dragSelection.containsPosition(i.position)?this._removeDecoration():this.showAt(i.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(t){if(t.target&&(this._hitContent(t.target)||this._hitMargin(t.target))&&t.target.position){const i=new vs(t.target.position.lineNumber,t.target.position.column);if(null===this._dragSelection){let e=null;if(t.event.shiftKey){const t=this._editor.getSelection();if(t){const{selectionStartLineNumber:s,selectionStartColumn:n}=t;e=[new ys(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new ys(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(K0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(q0.ID,new U0(this._dragSelection,i,K0(t.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(t){this._dndDecorationIds.set([{range:new bs(t.lineNumber,t.column,t.lineNumber,t.column),options:q0._DECORATION_OPTIONS}]),this._editor.revealPosition(t,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(t){return 6===t.type||7===t.type}_hitMargin(t){return 2===t.type||3===t.type||4===t.type}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}q0.ID="editor.contrib.dragAndDrop",q0.TRIGGER_KEY_VALUE=pt?6:5,q0._DECORATION_OPTIONS=aL.register({description:"dnd-target",className:"dnd-target"}),iu(q0.ID,q0,2);const G0=function(){if("object"==typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID.bind(crypto);let t;t="object"==typeof crypto&&"function"==typeof crypto.getRandomValues?crypto.getRandomValues.bind(crypto):function(t){for(let i=0;i<t.length;i++)t[i]=Math.floor(256*Math.random());return t};const i=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){t(i),i[6]=15&i[6]|64,i[8]=63&i[8]|128;let s=0,n="";return n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+="-",n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n+=e[i[s++]],n}}();function Z0(t){return{asString:async()=>t,asFile:()=>{},value:"string"==typeof t?t:void 0}}class J0{constructor(){this._entries=new Map}get size(){let t=0;for(const i of this._entries)t++;return t}has(t){return this._entries.has(this.toKey(t))}matches(t){const i=[...this._entries.keys()];return It.some(this,(([t,i])=>i.asFile()))&&i.push("files"),X0(Q0(t),i)}get(t){var i;return null===(i=this._entries.get(this.toKey(t)))||void 0===i?void 0:i[0]}append(t,i){const e=this._entries.get(t);e?e.push(i):this._entries.set(this.toKey(t),[i])}replace(t,i){this._entries.set(this.toKey(t),[i])}delete(t){this._entries.delete(this.toKey(t))}*[Symbol.iterator](){for(const[t,i]of this._entries)for(const e of i)yield[t,e]}toKey(t){return Q0(t)}}function Q0(t){return t.toLowerCase()}function Y0(t,i){return X0(Q0(t),i.map(Q0))}function X0(t,i){if("*/*"===t)return i.length>0;if(i.includes(t))return!0;const e=t.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!e)return!1;const[s,n,r]=e;return"*"===r&&i.some((t=>t.startsWith(n+"/")))}const t1=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>t1.split(t).filter((t=>!t.startsWith("#")))});mh.add("workbench.contributions.dragAndDrop",new class{});class i1{constructor(){}static getInstance(){return i1.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}function e1(t){const i=new J0;for(const e of t.items){const t=e.type;if("string"===e.kind){const s=new Promise((t=>e.getAsString(t)));i.append(t,Z0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,s1(s))}}return i}function s1(t){const i=t.path?hs.parse(t.path):void 0;return function(t,i,e){const s={id:G0(),name:t,uri:i,data:e};return{asString:async()=>"",asFile:()=>s,value:void 0}}(t.name,i,(async()=>new Uint8Array(await t.arrayBuffer())))}i1.INSTANCE=new i1;const n1=Object.freeze(["CodeEditors","CodeFiles",u_.RESOURCES,u_.INTERNAL_URI_LIST]);function r1(t,i=!1){const e=e1(t),s=e.get(u_.INTERNAL_URI_LIST);if(s)e.replace(md.uriList,s);else if(i||!e.has(md.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?hs.file(e).toString():hs.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(md.uriList,Z0(t1.create(i)))}for(const t of n1)e.delete(t);return e}function o1(t){var i;function e(t,i){return"providerId"in t&&t.providerId===i.providerId||"mimeType"in t&&t.mimeType===i.handledMimeType}const s=new Map;for(const n of t)for(const r of null!==(i=n.yieldTo)&&void 0!==i?i:[])for(const i of t)if(i!==n&&e(r,i)){let t=s.get(n);t||(t=[],s.set(n,t)),t.push(i)}if(!s.size)return Array.from(t);const n=new Set,r=[];return function t(i){if(!i.length)return[];const e=i[0];if(r.includes(e))return console.warn(`Yield to cycle detected for ${e.providerId}`),i;if(n.has(e))return t(i.slice(1));let o=[];const h=s.get(e);return h&&(r.push(e),o=t(h),r.pop()),n.add(e),[...o,e,...t(i.slice(1))]}(Array.from(t))}const h1=aL.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class c1 extends Ki{constructor(t,i,e,s,n){super(),this.typeId=t,this.editor=i,this.range=e,this.delegate=n,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(s),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(t){this.domNode=Fa(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Fa("span.icon");this.domNode.append(i),i.classList.add(...go.asClassNameArray(xs.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(66);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(52)||t.hasChanged(66))&&e()}))),this._register(Il(this.domNode,ya.CLICK,(()=>{this.delegate.cancel()})))}getId(){return c1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}}c1.baseId="editor.widget.inlineProgressWidget";let l1=class extends Ki{constructor(t,i,e){super(),this.id=t,this._editor=i,this._instantiationService=e,this._showDelay=500,this._showPromise=this._register(new qi),this._currentWidget=new qi,this._operationIdPool=0,this._currentDecorations=i.createDecorationsCollection()}async showWhile(t,i,e){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=ic((()=>{const s=bs.fromPositions(t);this._currentDecorations.set([{range:s,options:h1}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(c1,this.id,this._editor,s,i,e))}),this._showDelay);try{return await e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};l1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,io)],l1);var a1,u1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},d1=function(t,i){return function(e,s){i(e,s,t)}};let f1=a1=class extends Ki{constructor(t,i,e,s,n,r,o,h,c,l){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=l,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(zi((()=>this.visibleContext.reset()))),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(zi((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition((t=>{n.containsPosition(t.position)||this.dispose()}))),this._register(Xi.runAndSubscribe(l.onDidUpdateKeybindings,(()=>{this._updateButtonTitle()})))}_updateButtonTitle(){var t;const i=null===(t=this._keybindingService.lookupKeybinding(this.showCommand.id))||void 0===t?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(i?` (${i})`:"")}create(){this.domNode=Fa(".post-edit-widget"),this.button=this._register(new bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Il(this.domNode,ya.CLICK,(()=>this.showSelector())))}getId(){return a1.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=Zl(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>uo({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};f1.baseId="editor.widget.postEditWidget",f1=a1=u1([d1(7,qO),d1(8,th),d1(9,HC)],f1);let g1=class extends Ki{constructor(t,i,e,s,n,r){super(),this._id=t,this._editor=i,this._visibleContext=e,this._showCommand=s,this._instantiationService=n,this._bulkEditService=r,this._currentWidget=this._register(new qi),this._register(Xi.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}async applyEditAndShowIfNeeded(t,i,e,s){var n,r;const o=this._editor.getModel();if(!o||!t.length)return;const h=i.allEdits[i.activeEditIndex];if(!h)return;let c=[];c=("string"==typeof h.insertText?""===h.insertText:""===h.insertText.snippet)?[]:t.map((t=>new HR(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0})));const l={edits:[...c,...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},a=t[0],u=o.deltaDecorations([],[{range:a,options:{description:"paste-line-suffix",stickiness:0}}]);let d,f;try{d=await this._bulkEditService.apply(l,{editor:this._editor,token:s}),f=o.getDecorationRange(u[0])}finally{o.deltaDecorations(u,[])}e&&d.isApplied&&i.allEdits.length>1&&this.show(null!=f?f:a,i,(async n=>{const r=this._editor.getModel();r&&(await r.undo(),this.applyEditAndShowIfNeeded(t,{activeEditIndex:n,allEdits:i.allEdits},e,s))}))}show(t,i,e){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(f1,this._id,this._editor,this._visibleContext,this._showCommand,t,i,e))}clear(){this._currentWidget.clear()}tryShowSelector(){var t;null===(t=this._currentWidget.value)||void 0===t||t.showSelector()}};g1=u1([d1(4,io),d1(5,jR)],g1);var p1,m1=function(t,i){return function(e,s){i(e,s,t)}};const w1="editor.changePasteType",v1=new Xo("pasteWidgetVisible",!1,Q(0,"Whether the paste widget is showing")),b1="application/vnd.code.copyMetadata";let y1=p1=class extends Ki{static get(t){return t.getContribution(p1.ID)}constructor(t,i,e,s,n,r,o){super(),this._bulkEditService=e,this._clipboardService=s,this._languageFeaturesService=n,this._quickInputService=r,this._progressService=o,this._editor=t;const h=t.getContainerDomNode();this._register(Il(h,"copy",(t=>this.handleCopy(t)))),this._register(Il(h,"cut",(t=>this.handleCopy(t)))),this._register(Il(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new l1("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(g1,"pasteIntoEditor",t,v1,{id:w1,label:Q(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},ha().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(84).enabled&&!this._editor.getOption(90)}handleCopy(t){var i,e;if(!this._editor.hasTextFocus())return;if(vt&&this._clipboardService.writeResources([]),!t.clipboardData||!this.isPasteAsEnabled())return;const s=this._editor.getModel(),n=this._editor.getSelections();if(!s||!(null==n?void 0:n.length))return;const r=this._editor.getOption(37);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new bs(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const l=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,gt),a={multicursorText:Array.isArray(l)?l:null,pasteOnNewLine:h,mode:null},u=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!u.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:a});const d=e1(t.clipboardData),f=u.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=G0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:a});const p=Zh((async t=>{const i=c(await Promise.all(u.map((async i=>{try{return await i.prepareDocumentPaste(s,o,d,t)}catch(t){return void console.error(t)}}))));i.reverse();for(const t of i)for(const[i,e]of t)d.replace(i,e);return d}));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:g,dataTransferPromise:p}}async handlePaste(t){var i,e;if(!t.clipboardData||!this._editor.hasTextFocus())return;null===(i=this._currentPasteOperation)||void 0===i||i.cancel(),this._currentPasteOperation=void 0;const s=this._editor.getModel(),n=this._editor.getSelections();if(!(null==n?void 0:n.length)||!s)return;if(!this.isPasteAsEnabled())return;const r=this.fetchCopyMetadata(t),o=r1(t.clipboardData);o.delete(b1);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],md.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>Y0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}doPasteInline(t,i,e,s){const n=Zh((async r=>{const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new hq(o,3,void 0,r);try{if(await this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const n=t.filter((t=>k1(t,e)));if(!n.length||1===n.length&&"text"===n[0].id)return void await this.applyDefaultPasteHandler(e,s,c.token);const r=await this.getPasteEdits(n,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===r.length&&"text"===r[0].providerId)return void await this.applyDefaultPasteHandler(e,s,c.token);if(r.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:r},t,c.token)}await this.applyDefaultPasteHandler(e,s,c.token)}finally{c.dispose(),this._currentPasteOperation===n&&(this._currentPasteOperation=void 0)}}));this._pasteProgressManager.showWhile(i[0].getEndPosition(),Q(0,"Running paste handlers. Click to cancel"),n),this._currentPasteOperation=n}showPasteAsPick(t,i,e,s,n){const r=Zh((async o=>{const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new hq(h,3,void 0,o);try{if(await this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let r=i.filter((t=>k1(t,s)));t&&(r=r.filter((i=>i.id===t)));const o=await this.getPasteEdits(r,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!o.length)return;let h;if(t)h=o.at(0);else{const t=await this._quickInputService.pick(o.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:Q(0,"Select Paste Action")});h=null==t?void 0:t.edit}if(!h)return;const a=function(t,i,e){var s,n;return{edits:[...i.map((i=>new HR(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,h);await this._bulkEditService.apply(a,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}));this._progressService.withProgress({location:10,title:Q(0,"Running paste handlers")},(()=>r))}setCopyMetadata(t,i){t.setData(b1,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(b1);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=Tk.getTextData(t.clipboardData);return n?{defaultPastePayload:{mode:n.mode,multicursorText:null!==(i=n.multicursorText)&&void 0!==i?i:null,pasteOnNewLine:!!n.isFromEmptySelection}}:void 0}async mergeInDataFromCopy(t,i,e){var s;if((null==i?void 0:i.id)&&(null===(s=this._currentCopyOperation)||void 0===s?void 0:s.handle)===i.id){const i=await this._currentCopyOperation.dataTransferPromise;if(e.isCancellationRequested)return;for(const[e,s]of i)t.replace(e,s)}if(!t.has(md.uriList)){const i=await this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(md.uriList,Z0(t1.create(i)))}}async getPasteEdits(t,i,e,s,n){const r=await Jh(Promise.all(t.map((async t=>{var r;try{const o=await(null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n));if(o)return{...o,providerId:t.id}}catch(t){console.error(t)}}))),n);return o1(c(null!=r?r:[]))}async applyDefaultPasteHandler(t,i,e){var s,n,r;const o=null!==(s=t.get(md.text))&&void 0!==s?s:t.get("text");if(!o)return;const h=await o.asString();if(e.isCancellationRequested)return;const c={text:h,pasteOnNewLine:null!==(n=null==i?void 0:i.defaultPastePayload.pasteOnNewLine)&&void 0!==n&&n,multicursorText:null!==(r=null==i?void 0:i.defaultPastePayload.multicursorText)&&void 0!==r?r:null,mode:null};this._editor.trigger("keyboard","paste",c)}};function k1(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}y1.ID="editor.contrib.copyPasteActionController",y1=p1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([m1(1,io),m1(2,jR),m1(3,nH),m1(4,op),m1(5,mj),m1(6,SO)],y1);var C1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},S1=function(t,i){return function(e,s){i(e,s,t)}};const x1=Q(0,"Built-in");class D1{async provideDocumentPasteEdits(t,i,e,s){const n=await this.getEdit(e,s);return n?{insertText:n.insertText,label:n.label,detail:n.detail,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}:void 0}async provideDocumentOnDropEdits(t,i,e,s){const n=await this.getEdit(e,s);return n?{insertText:n.insertText,label:n.label,handledMimeType:n.handledMimeType,yieldTo:n.yieldTo}:void 0}}class E1 extends D1{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[md.text],this.pasteMimeTypes=[md.text]}async getEdit(t,i){const e=t.get(md.text);if(!e)return;if(t.has(md.uriList))return;const s=await e.asString();return{handledMimeType:md.text,label:Q(0,"Insert Plain Text"),detail:x1,insertText:s}}}class A1 extends D1{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[md.uriList],this.pasteMimeTypes=[md.uriList]}async getEdit(t,i){const e=await L1(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===dl.file?t.fsPath:(s++,i))).join(" ");let r;return r=Q(0,s>0?e.length>1?"Insert Uris":"Insert Uri":e.length>1?"Insert Paths":"Insert Path"),{handledMimeType:md.uriList,insertText:n,label:r,detail:x1}}}let M1=class extends D1{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[md.uriList],this.pasteMimeTypes=[md.uriList]}async getEdit(t,i){const e=await L1(t);if(!e.length||i.isCancellationRequested)return;const s=c(e.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?hA(i.uri,t):void 0})));return s.length?{handledMimeType:md.uriList,insertText:s.join(" "),label:Q(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:x1}:void 0}};async function L1(t){const i=t.get(md.uriList);if(!i)return[];const e=await i.asString(),s=[];for(const t of t1.parse(e))try{s.push({uri:hs.parse(t),originalText:t})}catch(t){}return s}M1=C1([S1(0,RO)],M1);let F1=class extends Ki{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new E1)),this._register(t.documentOnDropEditProvider.register("*",new A1)),this._register(t.documentOnDropEditProvider.register("*",new M1(i)))}};F1=C1([S1(0,op),S1(1,RO)],F1);let T1=class extends Ki{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new E1)),this._register(t.documentPasteEditProvider.register("*",new A1)),this._register(t.documentPasteEditProvider.register("*",new M1(i)))}};T1=C1([S1(0,op),S1(1,RO)],T1),iu(y1.ID,y1,0),RH(T1),Ya(new class extends qa{constructor(){super({id:w1,precondition:v1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=y1.get(i))||void 0===s?void 0:s.changePasteType()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.pasteAs",label:Q(0,"Paste As..."),alias:"Paste As...",precondition:void 0,metadata:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:Q(0,"The id of the paste edit to try applying. If not provided, the editor will show a picker.")}}}}]}})}run(t,i,e){var s;const n="string"==typeof(null==e?void 0:e.id)?e.id:void 0;return null===(s=y1.get(i))||void 0===s?void 0:s.pasteAs(n)}});class R1{constructor(t){this.identifier=t}}const O1=eo("treeViewsDndService");gd(O1,class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(t){if(t&&this._dragOperations.has(t)){const i=this._dragOperations.get(t);return this._dragOperations.delete(t),i}}},1);var _1,I1=function(t,i){return function(e,s){i(e,s,t)}};const P1="editor.experimental.dropIntoEditor.defaultProvider",N1="editor.changeDropType",B1=new Xo("dropWidgetVisible",!1,Q(0,"Whether the drop widget is showing"));let $1=_1=class extends Ki{static get(t){return t.getContribution(_1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=i1.getInstance(),this._dropProgressManager=this._register(i.createInstance(l1,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(g1,"dropIntoEditor",t,B1,{id:N1,label:Q(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(t,i,e){var s;if(!e.dataTransfer||!t.hasModel())return;null===(s=this._currentOperation)||void 0===s||s.cancel(),t.focus(),t.setPosition(i);const n=Zh((async s=>{const r=new hq(t,1,void 0,s);try{const n=await this.extractDataTransferData(e);if(0===n.size||r.token.isCancellationRequested)return;const o=t.getModel();if(!o)return;const h=this._languageFeaturesService.documentOnDropEditProvider.ordered(o).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>n.matches(t))))),c=await this.getDropEdits(h,o,i,n,r);if(r.token.isCancellationRequested)return;if(c.length){const e=this.getInitialActiveEditIndex(o,c),n="afterDrop"===t.getOption(36).showDropSelector;await this._postDropWidgetManager.applyEditAndShowIfNeeded([bs.fromPositions(i)],{activeEditIndex:e,allEdits:c},n,s)}}finally{r.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}}));this._dropProgressManager.showWhile(i,Q(0,"Running drop handlers. Click to cancel"),n),this._currentOperation=n}async getDropEdits(t,i,e,s,n){const r=await Jh(Promise.all(t.map((async t=>{try{const r=await t.provideDocumentOnDropEdits(i,e,s,n.token);if(r)return{...r,providerId:t.id}}catch(t){console.error(t)}}))),n.token);return o1(c(null!=r?r:[]))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(P1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&Y0(t,[i.handledMimeType])));if(e>=0)return e}return 0}async extractDataTransferData(t){if(!t.dataTransfer)return new J0;const i=r1(t.dataTransfer);if(this.treeItemsTransfer.hasData(R1.prototype)){const t=this.treeItemsTransfer.getData(R1.prototype);if(Array.isArray(t))for(const e of t){const t=await this._treeViewsDragAndDropService.removeDragOperationTransfer(e.identifier);if(t)for(const[e,s]of t)i.replace(e,s)}}return i}};$1.ID="editor.contrib.dropIntoEditorController",$1=_1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([I1(1,io),I1(2,rd),I1(3,op),I1(4,O1)],$1),iu($1.ID,$1,2),Ya(new class extends qa{constructor(){super({id:N1,precondition:B1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=$1.get(i))||void 0===s||s.changeDropType()}}),RH(F1),mh.as(bd).registerConfiguration({...KR,properties:{[P1]:{type:"object",scope:5,description:Q(0,"Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}});class W1{constructor(t){this._editor=t,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const t=this._findScopeDecorationIds.map((t=>this._editor.getModel().getDecorationRange(t))).filter((t=>!!t));if(t.length)return t}return null}getStartPosition(){return this._startPosition}setStartPosition(t){this._startPosition=t,this.setCurrentFindMatch(null)}_getDecorationIndex(t){const i=this._decorations.indexOf(t);return i>=0?i+1:1}getDecorationRangeAt(t){const i=t<this._decorations.length?this._decorations[t]:null;return i?this._editor.getModel().getDecorationRange(i):null}getCurrentMatchesPosition(t){const i=this._editor.getModel().getDecorationsInRange(t);for(const t of i){const i=t.options;if(i===W1._FIND_MATCH_DECORATION||i===W1._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(t){let i=null,e=0;if(t)for(let s=0,n=this._decorations.length;s<n;s++){const n=this._editor.getModel().getDecorationRange(this._decorations[s]);if(t.equalsRange(n)){i=this._decorations[s],e=s+1;break}}return null===this._highlightedDecorationId&&null===i||this._editor.changeDecorations((t=>{if(null!==this._highlightedDecorationId&&(t.changeDecorationOptions(this._highlightedDecorationId,W1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,W1._CURRENT_FIND_MATCH_DECORATION)),null!==this._rangeHighlightDecorationId&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),null!==i){let e=this._editor.getModel().getDecorationRange(i);if(e.startLineNumber!==e.endLineNumber&&1===e.endColumn){const t=e.endLineNumber-1,i=this._editor.getModel().getLineMaxColumn(t);e=new bs(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,W1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=W1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=W1._FIND_MATCH_NO_OVERVIEW_DECORATION;const i=this._editor.getModel().getLineCount(),e=this._editor.getLayoutInfo().height,r=Math.max(2,Math.ceil(3/(e/i)));let o=t[0].range.startLineNumber,h=t[0].range.endLineNumber;for(let i=1,e=t.length;i<e;i++){const e=t[i].range;h+r>=e.startLineNumber?e.endLineNumber>h&&(h=e.endLineNumber):(n.push({range:new bs(o,1,h,1),options:W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new bs(o,1,h,1),options:W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(t.length);for(let i=0,e=t.length;i<e;i++)r[i]={range:t[i].range,options:s};this._decorations=e.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=e.deltaDecorations(this._overviewRulerApproximateDecorations,n),this._rangeHighlightDecorationId&&(e.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach((t=>e.removeDecoration(t))),this._findScopeDecorationIds=[]),(null==i?void 0:i.length)&&(this._findScopeDecorationIds=i.map((t=>e.addDecoration(t,W1._FIND_SCOPE_DECORATION))))}))}matchBeforePosition(t){if(0===this._decorations.length)return null;for(let i=this._decorations.length-1;i>=0;i--){const e=this._decorations[i],s=this._editor.getModel().getDecorationRange(e);if(s&&!(s.endLineNumber>t.lineNumber)){if(s.endLineNumber<t.lineNumber)return s;if(!(s.endColumn>t.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(t){if(0===this._decorations.length)return null;for(let i=0,e=this._decorations.length;i<e;i++){const e=this._decorations[i],s=this._editor.getModel().getDecorationRange(e);if(s&&!(s.startLineNumber<t.lineNumber)){if(s.startLineNumber>t.lineNumber)return s;if(!(s.startColumn<t.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let t=[];return t=t.concat(this._decorations),t=t.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&t.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&t.push(this._rangeHighlightDecorationId),t}}W1._CURRENT_FIND_MATCH_DECORATION=aL.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:Bk(Ob),position:bf.Center},minimap:{color:Bk(Ib),position:kf.Inline}}),W1._FIND_MATCH_DECORATION=aL.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:Bk(Ob),position:bf.Center},minimap:{color:Bk(Ib),position:kf.Inline}}),W1._FIND_MATCH_NO_OVERVIEW_DECORATION=aL.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),W1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=aL.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Bk(Ob),position:bf.Center}}),W1._RANGE_HIGHLIGHT_DECORATION=aL.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),W1._FIND_SCOPE_DECORATION=aL.register({description:"find-scope",className:"findScope",isWholeLine:!0});class j1{constructor(t,i,e){this._editorSelection=t,this._ranges=i,this._replaceStrings=e,this._trackedEditorSelectionId=null}getEditOperations(t,i){if(this._ranges.length>0){const t=[];for(let i=0;i<this._ranges.length;i++)t.push({range:this._ranges[i],text:this._replaceStrings[i]});t.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)));const e=[];let s=t[0];for(let i=1;i<t.length;i++)s.range.endLineNumber===t[i].range.startLineNumber&&s.range.endColumn===t[i].range.startColumn?(s.range=s.range.plusRange(t[i].range),s.text=s.text+t[i].text):(e.push(s),s=t[i]);e.push(s);for(const t of e)i.addEditOperation(t.range,t.text)}this._trackedEditorSelectionId=i.trackSelection(this._editorSelection)}computeCursorState(t,i){return i.getTrackedSelection(this._trackedEditorSelectionId)}}function V1(t,i){if(t&&""!==t[0]){const e=H1(t,i,"-"),s=H1(t,i,"_");return e&&!s?z1(t,i,"-"):!e&&s?z1(t,i,"_"):t[0].toUpperCase()===t[0]?i.toUpperCase():t[0].toLowerCase()===t[0]?i.toLowerCase():function(t,i=!1){return!!t&&(i&&(t=t.replace(/\\./g,"")),t.toLowerCase()!==t)}(t[0][0])&&i.length>0?i[0].toUpperCase()+i.substr(1):t[0][0].toUpperCase()!==t[0][0]&&i.length>0?i[0].toLowerCase()+i.substr(1):i}return i}function H1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function z1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=V1([n[i]],t)+e})),r.slice(0,-1)}class U1{constructor(t){this.staticValue=t,this.kind=0}}class K1{constructor(t){this.pieces=t,this.kind=1}}class q1{static fromStaticValue(t){return new q1([G1.staticValue(t)])}get hasReplacementPatterns(){return 1===this._state.kind}constructor(t){this._state=t&&0!==t.length?1===t.length&&null!==t[0].staticValue?new U1(t[0].staticValue):new K1(t):new U1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?V1(t,this._state.staticValue):this._state.staticValue;let e="";for(let i=0,s=this._state.pieces.length;i<s;i++){const s=this._state.pieces[i];if(null!==s.staticValue){e+=s.staticValue;continue}let n=q1._substitute(s.matchIndex,t);if(null!==s.caseOps&&s.caseOps.length>0){const t=[],i=s.caseOps.length;let e=0;for(let r=0,o=n.length;r<o;r++){if(e>=i){t.push(n.slice(r));break}switch(s.caseOps[e]){case"U":t.push(n[r].toUpperCase());break;case"u":t.push(n[r].toUpperCase()),e++;break;case"L":t.push(n[r].toLowerCase());break;case"l":t.push(n[r].toLowerCase()),e++;break;default:t.push(n[r])}}n=t.join("")}e+=n}return e}static _substitute(t,i){if(null===i)return"";if(0===t)return i[0];let e="";for(;t>0;){if(t<i.length)return(i[t]||"")+e;e=String(t%10)+e,t=Math.floor(t/10)}return"$"+e}}class G1{static staticValue(t){return new G1(t,-1,null)}static caseOps(t,i){return new G1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class Z1{constructor(t){this._source=t,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(t){this._emitStatic(this._source.substring(this._lastCharIndex,t)),this._lastCharIndex=t}emitStatic(t,i){this._emitStatic(t),this._lastCharIndex=i}_emitStatic(t){0!==t.length&&(this._currentStaticPiece+=t)}emitMatchIndex(t,i,e){0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=G1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=G1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=G1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new q1(this._result)}}const J1=new Xo("findWidgetVisible",!1);J1.toNegated();const Q1=new Xo("findInputFocussed",!1),Y1=new Xo("replaceInputFocussed",!1),X1={primary:545,mac:{primary:2593}},t2={primary:565,mac:{primary:2613}},i2={primary:560,mac:{primary:2608}},e2={primary:554,mac:{primary:2602}},s2={primary:558,mac:{primary:2606}},n2="editor.action.nextMatchFindAction",r2="editor.action.previousMatchFindAction",o2="closeFindWidget",h2="toggleFindCaseSensitive",c2="toggleFindWholeWord",l2="toggleFindRegex",a2="toggleFindInSelection",u2="togglePreserveCase",d2="editor.action.replaceOne",f2="editor.action.replaceAll",g2=19999;class p2{constructor(t,i){this._toDispose=new Ui,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new sc,this._decorations=new W1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new rc((()=>this.research(!1)),100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition((t=>{3!==t.reason&&5!==t.reason&&6!==t.reason||this._decorations.setStartPosition(this._editor.getPosition())}))),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent((t=>{this._ignoreModelContentChanged||(t.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())}))),this._toDispose.add(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Vi(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(t){!this._isDisposed&&this._editor.hasModel()&&(t.searchString||t.isReplaceRevealed||t.isRegex||t.wholeWord||t.matchCase||t.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet((()=>{t.searchScope?this.research(t.moveCursor,this._state.searchScope):this.research(t.moveCursor)}),240)):t.searchScope?this.research(t.moveCursor,this._state.searchScope):this.research(t.moveCursor))}static _getSearchRange(t,i){return i||t.getFullModelRange()}research(t,i){let e=null;void 0!==i?null!==i&&(e=Array.isArray(i)?i:[i]):e=this._decorations.getFindScopes(),null!==e&&(e=e.map((t=>{if(t.startLineNumber!==t.endLineNumber){let i=t.endLineNumber;return 1===t.endColumn&&(i-=1),new bs(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,g2);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=qf(s.map((t=>t.range)),(t=>bs.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const t=this._decorations.getFindScope();return t&&this._editor.revealRangeInCenterIfOutsideViewport(t,0),!0}return!1}_setCurrentFindMatch(t){const i=this._decorations.setCurrentFindMatch(t);this._state.changeMatchInfo(i,this._decorations.getCount(),t),this._editor.setSelection(t),this._editor.revealRangeInCenterIfOutsideViewport(t,0)}_prevSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||1===s?(1===e?e=n.getLineCount():e--,s=n.getLineMaxColumn(e)):s--,new vs(e,s)}_moveToPrevMatch(t,i=!1){if(!this._state.canNavigateBack()){const i=this._decorations.matchAfterPosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<g2){let i=this._decorations.matchBeforePosition(t);return i&&i.isEmpty()&&i.getStartPosition().equals(t)&&(t=this._prevSearchPosition(t),i=this._decorations.matchBeforePosition(t)),void(i&&this._setCurrentFindMatch(i))}if(this._cannotFind())return;const e=this._decorations.getFindScope(),s=p2._getSearchRange(this._editor.getModel(),e);s.getEndPosition().isBefore(t)&&(t=s.getEndPosition()),t.isBefore(s.getStartPosition())&&(t=s.getEndPosition());const{lineNumber:n,column:r}=t,o=this._editor.getModel();let h=new vs(n,r),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1);return c&&c.range.isEmpty()&&c.range.getStartPosition().equals(h)&&(h=this._prevSearchPosition(h),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1)),c?i||s.containsRange(c.range)?void this._setCurrentFindMatch(c.range):this._moveToPrevMatch(c.range.getStartPosition(),!0):void 0}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||s===n.getLineMaxColumn(e)?(e===n.getLineCount()?e=1:e++,s=1):s++,new vs(e,s)}_moveToNextMatch(t){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<g2){let i=this._decorations.matchAfterPosition(t);return i&&i.isEmpty()&&i.getStartPosition().equals(t)&&(t=this._nextSearchPosition(t),i=this._decorations.matchAfterPosition(t)),void(i&&this._setCurrentFindMatch(i))}const i=this._getNextMatch(t,!1,!0);i&&this._setCurrentFindMatch(i.range)}_getNextMatch(t,i,e,s=!1){if(this._cannotFind())return null;const n=this._decorations.getFindScope(),r=p2._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(t)&&(t=r.getStartPosition()),t.isBefore(r.getStartPosition())&&(t=r.getStartPosition());const{lineNumber:o,column:h}=t,c=this._editor.getModel();let l=new vs(o,h),a=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i);return e&&a&&a.range.isEmpty()&&a.range.getStartPosition().equals(l)&&(l=this._nextSearchPosition(l),a=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i)),a?s||r.containsRange(a.range)?a:this._getNextMatch(a.range.getEndPosition(),i,e,!0):null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(t){const i=this._decorations.getDecorationRangeAt(t);i&&this._setCurrentFindMatch(i)}moveToMatch(t){this._moveToMatch(t)}_getReplacePattern(){return this._state.isRegex?function(t){if(!t||0===t.length)return new q1(null);const i=[],e=new Z1(t);for(let s=0,n=t.length;s<n;s++){const r=t.charCodeAt(s);if(92!==r){if(36===r){if(s++,s>=n)break;const r=t.charCodeAt(s);if(36===r){e.emitUnchanged(s-1),e.emitStatic("$",s+1);continue}if(48===r||38===r){e.emitUnchanged(s-1),e.emitMatchIndex(0,s+1,i),i.length=0;continue}if(49<=r&&r<=57){let o=r-48;if(s+1<n){const n=t.charCodeAt(s+1);if(48<=n&&n<=57){s++,o=10*o+(n-48),e.emitUnchanged(s-2),e.emitMatchIndex(o,s+1,i),i.length=0;continue}}e.emitUnchanged(s-1),e.emitMatchIndex(o,s+1,i),i.length=0;continue}}}else{if(s++,s>=n)break;const r=t.charCodeAt(s);switch(r){case 92:e.emitUnchanged(s-1),e.emitStatic("\\",s+1);break;case 110:e.emitUnchanged(s-1),e.emitStatic("\n",s+1);break;case 116:e.emitUnchanged(s-1),e.emitStatic("\t",s+1);break;case 117:case 85:case 108:case 76:e.emitUnchanged(s-1),e.emitStatic("",s+1),i.push(String.fromCharCode(r))}}}return e.finalize()}(this._state.replaceString):q1.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const t=this._getReplacePattern(),i=this._editor.getSelection(),e=this._getNextMatch(i.getStartPosition(),!0,!1);if(e)if(i.equalsRange(e.range)){const s=t.buildReplaceString(e.matches,this._state.preserveCase),n=new oS(i,s);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new vs(i.startLineNumber,i.startColumn+s.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(e.range)}_findMatches(t,i,e){const s=(t||[null]).map((t=>p2._getSearchRange(this._editor.getModel(),t)));return this._editor.getModel().findMatches(this._state.searchString,s,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=g2?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new Tf(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let t="mu";i.ignoreCase&&(t+="i"),i.global&&(t+="g"),i=new RegExp(i.source,t)}const e=this._editor.getModel(),s=e.getValue(1),n=e.getFullModelRange(),r=this._getReplacePattern();let o;const h=this._state.preserveCase;o=s.replace(i,r.hasReplacementPatterns||h?function(){return r.buildReplaceString(arguments,h)}:r.buildReplaceString(null,h));const c=new aS(n,o,this._editor.getSelection());this._executeEditorCommand("replaceAll",c)}_regularReplaceAll(t){const i=this._getReplacePattern(),e=this._findMatches(t,i.hasReplacementPatterns||this._state.preserveCase,1073741824),s=[];for(let t=0,n=e.length;t<n;t++)s[t]=i.buildReplaceString(e[t].matches,this._state.preserveCase);const n=new j1(this._editor.getSelection(),e.map((t=>t.range)),s);this._executeEditorCommand("replaceAll",n)}selectAllMatches(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();let i=this._findMatches(t,!1,1073741824).map((t=>new ys(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn)));const e=this._editor.getSelection();for(let t=0,s=i.length;t<s;t++)if(i[t].equalsRange(e)){i=[e].concat(i.slice(0,t)).concat(i.slice(t+1));break}this._editor.setSelections(i)}_executeEditorCommand(t,i){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(t,i),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}class m2 extends Yy{constructor(t,i,e){super(),this._hideSoon=this._register(new rc((()=>this._hide()),2e3)),this._isVisible=!1,this._editor=t,this._state=i,this._keybindingService=e,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const s={inputActiveOptionBorder:qm(lw),inputActiveOptionForeground:qm(uw),inputActiveOptionBackground:qm(aw)};this.caseSensitive=this._register(new VB({appendTitle:this._keybindingLabelFor(h2),isChecked:this._state.matchCase,...s})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange((()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)}))),this.wholeWords=this._register(new HB({appendTitle:this._keybindingLabelFor(c2),isChecked:this._state.wholeWord,...s})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange((()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)}))),this.regex=this._register(new zB({appendTitle:this._keybindingLabelFor(l2),isChecked:this._state.isRegex,...s})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange((()=>{this._state.change({isRegex:this.regex.checked},!1)}))),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange((t=>{let i=!1;t.isRegex&&(this.regex.checked=this._state.isRegex,i=!0),t.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,i=!0),t.matchCase&&(this.caseSensitive.checked=this._state.matchCase,i=!0),!this._state.isRevealed&&i&&this._revealTemporarily()}))),this._register(Il(this._domNode,ya.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Il(this._domNode,"mouseover",(()=>this._onMouseOver())))}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return m2.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}}function w2(t,i){return 1===t||2!==t&&i}m2.ID="editor.contrib.findOptionsWidget";class v2 extends Ki{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return w2(this._isRegexOverride,this._isRegex)}get wholeWord(){return w2(this._wholeWordOverride,this._wholeWord)}get matchCase(){return w2(this._matchCaseOverride,this._matchCase)}get preserveCase(){return w2(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new ne),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(t,i,e){const s={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let n=!1;0===i&&(t=0),t>i&&(t=i),this._matchesPosition!==t&&(this._matchesPosition=t,s.matchesPosition=!0,n=!0),this._matchesCount!==i&&(this._matchesCount=i,s.matchesCount=!0,n=!0),void 0!==e&&(bs.equalsRange(this._currentMatch,e)||(this._currentMatch=e,s.currentMatch=!0,n=!0)),n&&this._onFindReplaceStateChange.fire(s)}change(t,i,e=!0){var s;const n={moveCursor:i,updateHistory:e,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let r=!1;const o=this.isRegex,h=this.wholeWord,c=this.matchCase,l=this.preserveCase;void 0!==t.searchString&&this._searchString!==t.searchString&&(this._searchString=t.searchString,n.searchString=!0,r=!0),void 0!==t.replaceString&&this._replaceString!==t.replaceString&&(this._replaceString=t.replaceString,n.replaceString=!0,r=!0),void 0!==t.isRevealed&&this._isRevealed!==t.isRevealed&&(this._isRevealed=t.isRevealed,n.isRevealed=!0,r=!0),void 0!==t.isReplaceRevealed&&this._isReplaceRevealed!==t.isReplaceRevealed&&(this._isReplaceRevealed=t.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),void 0!==t.isRegex&&(this._isRegex=t.isRegex),void 0!==t.wholeWord&&(this._wholeWord=t.wholeWord),void 0!==t.matchCase&&(this._matchCase=t.matchCase),void 0!==t.preserveCase&&(this._preserveCase=t.preserveCase),void 0!==t.searchScope&&((null===(s=t.searchScope)||void 0===s?void 0:s.every((t=>{var i;return null===(i=this._searchScope)||void 0===i?void 0:i.some((i=>!bs.equalsRange(i,t)))})))||(this._searchScope=t.searchScope,n.searchScope=!0,r=!0)),void 0!==t.loop&&this._loop!==t.loop&&(this._loop=t.loop,n.loop=!0,r=!0),void 0!==t.isSearching&&this._isSearching!==t.isSearching&&(this._isSearching=t.isSearching,n.isSearching=!0,r=!0),void 0!==t.filters&&(this._filters?this._filters.update(t.filters):this._filters=t.filters,n.filters=!0,r=!0),this._isRegexOverride=void 0!==t.isRegexOverride?t.isRegexOverride:0,this._wholeWordOverride=void 0!==t.wholeWordOverride?t.wholeWordOverride:0,this._matchCaseOverride=void 0!==t.matchCaseOverride?t.matchCaseOverride:0,this._preserveCaseOverride=void 0!==t.preserveCaseOverride?t.preserveCaseOverride:0,o!==this.isRegex&&(r=!0,n.isRegex=!0),h!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),l!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||1!==this.matchesPosition}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=g2}}const b2=Q(0,"input"),y2=Q(0,"Preserve Case");class k2 extends BB{constructor(t){super({icon:xs.preserveCase,title:y2+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class C2 extends Yy{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ne),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ne),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ne),this._onInput=this._register(new ne),this._onKeyUp=this._register(new ne),this._onPreserveCaseKeyDown=this._register(new ne),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||b2;const n=s.appendPreserveCaseLabel||"",r=s.history||[],o=!!s.flexibleHeight,h=!!s.flexibleWidth,c=s.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new ZB(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:s.showHistoryHint,flexibleHeight:o,flexibleWidth:h,flexibleMaxHeight:c,inputBoxStyles:s.inputBoxStyles})),this.preserveCase=this._register(new k2({appendTitle:n,isChecked:!1,...s.toggleStyles})),this._register(this.preserveCase.onChange((t=>{this._onDidOptionChange.fire(t),!t&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()}))),this._register(this.preserveCase.onKeyDown((t=>{this._onPreserveCaseKeyDown.fire(t)}))),this.cachedOptionsWidth=this._showOptionButtons?this.preserveCase.width():0;const l=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=l.indexOf(this.domNode.ownerDocument.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%l.length:t.equals(15)&&(e=0===i?l.length-1:i-1),t.equals(9)?(l[i].blur(),this.inputBox.focus()):e>=0&&l[e].focus(),ka(t,!0)}}}));const a=document.createElement("div");a.className="controls",a.style.display=this._showOptionButtons?"block":"none",a.appendChild(this.preserveCase.domNode),this.domNode.appendChild(a),null==t||t.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,(t=>this._onKeyDown.fire(t))),this.onkeyup(this.inputBox.inputElement,(t=>this._onKeyUp.fire(t))),this.oninput(this.inputBox.inputElement,(()=>this._onInput.fire())),this.onmousedown(this.inputBox.inputElement,(t=>this._onMouseDown.fire(t)))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(t){t?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(t){this.preserveCase.checked=t}focusOnPreserve(){this.preserveCase.focus()}validate(){var t;null===(t=this.inputBox)||void 0===t||t.validate()}set width(t){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=t+"px"}dispose(){super.dispose()}}var S2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},x2=function(t,i){return function(e,s){i(e,s,t)}};const D2=new Xo("suggestWidgetVisible",!1,Q(0,"Whether suggestion are visible")),E2="historyNavigationWidgetFocus",A2="historyNavigationForwardsEnabled",M2="historyNavigationBackwardsEnabled";let L2;const F2=[];function T2(t,i){if(F2.includes(i))throw new Error("Cannot register the same widget multiple times");F2.push(i);const e=new Ui,s=new Xo(E2,!1).bindTo(t),n=new Xo(A2,!0).bindTo(t),r=new Xo(M2,!0).bindTo(t),o=()=>{s.set(!0),L2=i},h=()=>{s.set(!1),L2===i&&(L2=void 0)};return oa(i.element)&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(zi((()=>{F2.splice(F2.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let R2=class extends QB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(T2(n,this.inputBox))}};R2=S2([x2(3,th)],R2);let O2=class extends C2{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(T2(r,this.inputBox))}};function _2(t){var i,e;return"Up"===(null===(i=t.lookupKeybinding("history.showPrevious"))||void 0===i?void 0:i.getElectronAccelerator())&&"Down"===(null===(e=t.lookupKeybinding("history.showNext"))||void 0===e?void 0:e.getElectronAccelerator())}O2=S2([x2(3,th)],O2),vh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Oo.and(Oo.has(E2),Oo.equals(M2,!0),Oo.not("isComposing"),D2.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==L2||L2.showPreviousValue()}}),vh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Oo.and(Oo.has(E2),Oo.equals(A2,!0),Oo.not("isComposing"),D2.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==L2||L2.showNextValue()}});const I2=AV("find-selection",xs.selection,Q(0,"Icon for 'Find in Selection' in the editor find widget.")),P2=AV("find-collapsed",xs.chevronRight,Q(0,"Icon to indicate that the editor find widget is collapsed.")),N2=AV("find-expanded",xs.chevronDown,Q(0,"Icon to indicate that the editor find widget is expanded.")),B2=AV("find-replace",xs.replace,Q(0,"Icon for 'Replace' in the editor find widget.")),$2=AV("find-replace-all",xs.replaceAll,Q(0,"Icon for 'Replace All' in the editor find widget.")),W2=AV("find-previous-match",xs.arrowUp,Q(0,"Icon for 'Find Previous' in the editor find widget.")),j2=AV("find-next-match",xs.arrowDown,Q(0,"Icon for 'Find Next' in the editor find widget.")),V2=Q(0,"Find / Replace"),H2=Q(0,"Find"),z2=Q(0,"Find"),U2=Q(0,"Previous Match"),K2=Q(0,"Next Match"),q2=Q(0,"Find in Selection"),G2=Q(0,"Close"),Z2=Q(0,"Replace"),J2=Q(0,"Replace"),Q2=Q(0,"Replace"),Y2=Q(0,"Replace All"),X2=Q(0,"Toggle Replace"),t4=Q(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",g2),i4=Q(0,"{0} of {1}"),e4=Q(0,"No results"),s4=419;let n4=69;const r4="ctrlEnterReplaceAll.windows.donotask",o4=pt?256:2048;class h4{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function c4(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function l4(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class a4 extends Yy{constructor(t,i,e,s,n,r,o,h,c){super(),this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=t,this._controller=i,this._state=e,this._contextViewProvider=s,this._keybindingService=n,this._contextKeyService=r,this._storageService=h,this._notificationService=c,this._ctrlEnterReplaceAllWarningPrompted=!!h.getBoolean(r4,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new Yh(500),this._register(zi((()=>this._updateHistoryDelayer.cancel()))),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration((t=>{if(t.hasChanged(90)&&(this._codeEditor.getOption(90)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(143)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(41)){const t=this._codeEditor.getOption(41).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(41).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new h4(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((async()=>{if(this._isVisible){const t=await this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}}))),this._findInputFocused=Q1.bindTo(r),this._findFocusTracker=this._register(Sa(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus((()=>{this._findInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._findFocusTracker.onDidBlur((()=>{this._findInputFocused.set(!1)}))),this._replaceInputFocused=Y1.bindTo(r),this._replaceFocusTracker=this._register(Sa(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus((()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._replaceFocusTracker.onDidBlur((()=>{this._replaceInputFocused.set(!1)}))),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new h4(0)),this._register(this._codeEditor.onDidChangeModel((()=>{this._isVisible&&(this._viewZoneId=void 0)}))),this._register(this._codeEditor.onDidScrollChange((t=>{t.scrollTopChanged?this._layoutViewZone():setTimeout((()=>{this._layoutViewZone()}),0)})))}getId(){return a4.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(t){if(t.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}t.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),t.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),t.isReplaceRevealed&&(this._state.isReplaceRevealed?this._codeEditor.getOption(90)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=Jl(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(t.isRevealed||t.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),t.isRegex&&this._findInput.setRegex(this._state.isRegex),t.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),t.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),t.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),t.searchScope&&(this._toggleSelectionFind.checked=!!this._state.searchScope,this._updateToggleSelectionFindButton()),(t.searchString||t.matchesCount||t.matchesPosition)&&(this._domNode.classList.toggle("no-results",this._state.searchString.length>0&&0===this._state.matchesCount),this._updateMatchesCount(),this._updateButtons()),(t.searchString||t.currentMatch)&&this._layoutViewZone(),t.updateHistory&&this._delayedUpdateHistory(),t.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,Li)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){let t;if(this._matchesCount.style.minWidth=n4+"px",this._matchesCount.title=this._state.matchesCount>=g2?t4:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=g2&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Nn(i4,e,i)}else t=e4;this._matchesCount.appendChild(document.createTextNode(t)),Cm(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),n4=Math.max(n4,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===e4)return""===e?Q(0,"{0} found",t):Q(0,"{0} found for '{1}'",t,e);if(i){const s=Q(0,"{0} found for '{1}', at {2}",t,e,i.startLineNumber+":"+i.startColumn),n=this._codeEditor.getModel();return n&&i.startLineNumber<=n.getLineCount()&&i.startLineNumber>=1?`${n.getLineContent(i.startLineNumber)}, ${s}`:s}return Q(0,"{0} found for '{1}'",t,e)}_updateToggleSelectionFindButton(){const t=this._codeEditor.getSelection();this._isVisible&&(this._toggleSelectionFind.checked||t&&(t.startLineNumber!==t.endLineNumber||t.startColumn!==t.endColumn))?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const t=this._state.searchString.length>0,i=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const e=!this._codeEditor.getOption(90);this._toggleReplaceBtn.setEnabled(this._isVisible&&e)}_reveal(){if(this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const t=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":this._toggleSelectionFind.checked=!!t&&t.startLineNumber!==t.endLineNumber}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout((()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")}),0)),this._revealTimeouts.push(setTimeout((()=>{this._findInput.validate()}),200)),this._codeEditor.layoutOverlayWidget(this);let i=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=Zl(e),n=this._codeEditor.getScrolledVisiblePosition(t.getStartPosition()),r=s.left+(n?n.left:0);if(this._viewZone&&(n?n.top:0)<this._viewZone.heightInPx){t.endLineNumber>t.startLineNumber&&(i=!1);const e=Gl(this._domNode).left;r>e&&(i=!1);const n=this._codeEditor.getScrolledVisiblePosition(t.getEndPosition());s.left+(n?n.left:0)>e&&(i=!1)}}}this._showViewZone(i)}}_hide(t){this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),t&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(t){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return void this._removeViewZone();if(!this._isVisible)return;const i=this._viewZone;void 0===this._viewZoneId&&i&&this._codeEditor.changeViewZones((e=>{i.heightInPx=this._getHeight(),this._viewZoneId=e.addZone(i),this._codeEditor.setScrollTop(t||this._codeEditor.getScrollTop()+i.heightInPx)}))}_showViewZone(t=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new h4(0));const i=this._viewZone;this._codeEditor.changeViewZones((e=>{if(void 0!==this._viewZoneId){const s=this._getHeight();if(s===i.heightInPx)return;const n=s-i.heightInPx;return i.heightInPx=s,e.layoutZone(this._viewZoneId),void(t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+n))}{let s=this._getHeight();if(s-=this._codeEditor.getOption(83).top,s<=0)return;i.heightInPx=s,this._viewZoneId=e.addZone(i),t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}}))}_removeViewZone(){this._codeEditor.changeViewZones((t=>{void 0!==this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))}))}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!this._domNode.isConnected)return;const t=this._codeEditor.getLayoutInfo();if(t.contentWidth<=0)return void this._domNode.classList.add("hiddenEditor");this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=t.width,e=t.minimap.minimapWidth;let s=!1,n=!1,r=!1;if(this._resized&&Jl(this._domNode)>s4)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=Jl(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-n4>=i&&(r=!0),447+e-n4>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",r),this._domNode.classList.toggle("reduced-find-widget",n),r||s||(this._domNode.style.maxWidth=i-28-e-15+"px"),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:r,reducedFindWidget:n}),this._resized){const t=this._findInput.inputBox.element.clientWidth;t>0&&(this._replaceInput.width=t)}else this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode))}_getHeight(){let t=0;return t+=4,t+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(t+=4,t+=this._replaceInput.inputBox.height+2),t+=4,t}_tryUpdateHeight(){const t=this._getHeight();return(null===this._cachedHeight||this._cachedHeight!==t)&&(this._cachedHeight=t,this._domNode.style.height=`${t}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const t=this._codeEditor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.startLineNumber===t.endLineNumber||bs.equalsRange(t,this._state.currentMatch)?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}_onFindInputMouseDown(t){t.middleButton&&t.stopPropagation()}_onFindInputKeyDown(t){return t.equals(3|o4)?(this._keybindingService.dispatchEvent(t,t.target)||this._findInput.inputBox.insertAtCursor("\n"),void t.preventDefault()):t.equals(2)?(this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),void t.preventDefault()):t.equals(2066)?(this._codeEditor.focus(),void t.preventDefault()):t.equals(16)?c4(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?l4(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|o4)?(this._keybindingService.dispatchEvent(t,t.target)||(gt&&wt&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(Q(0,"Ctrl+Enter now inserts line break instead of replacing all. You can modify the keybinding for editor.action.replaceAll to override this behavior.")),this._ctrlEnterReplaceAllWarningPrompted=!0,this._storageService.store(r4,!0,0,0)),this._replaceInput.inputBox.insertAtCursor("\n")),void t.preventDefault()):t.equals(2)?(this._findInput.focusOnCaseSensitive(),void t.preventDefault()):t.equals(1026)?(this._findInput.focus(),void t.preventDefault()):t.equals(2066)?(this._codeEditor.focus(),void t.preventDefault()):t.equals(16)?c4(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?l4(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):void 0}getVerticalSashLeft(t){return 0}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new R2(null,this._contextViewProvider,{width:221,label:H2,placeholder:z2,appendCaseSensitiveLabel:this._keybindingLabelFor(h2),appendWholeWordsLabel:this._keybindingLabelFor(c2),appendRegexLabel:this._keybindingLabelFor(l2),validation:t=>{if(0===t.length||!this._findInput.getRegex())return null;try{return null}catch(t){return{content:t.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>_2(this._keybindingService),inputBoxStyles:wN,toggleStyles:mN},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown((t=>this._onFindInputKeyDown(t)))),this._register(this._findInput.inputBox.onDidChange((()=>{this._ignoreChangeEvent||this._state.change({searchString:this._findInput.getValue()},!0)}))),this._register(this._findInput.onDidOptionChange((()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)}))),this._register(this._findInput.onCaseSensitiveKeyDown((t=>{t.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),t.preventDefault())}))),this._register(this._findInput.onRegexKeyDown((t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),t.preventDefault())}))),this._register(this._findInput.inputBox.onDidHeightChange((()=>{this._tryUpdateHeight()&&this._showViewZone()}))),mt&&this._register(this._findInput.onMouseDown((t=>this._onFindInputMouseDown(t)))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount(),this._prevBtn=this._register(new u4({label:U2+this._keybindingLabelFor(r2),icon:W2,onTrigger:()=>{$(this._codeEditor.getAction(r2)).run().then(void 0,Li)}})),this._nextBtn=this._register(new u4({label:K2+this._keybindingLabelFor(n2),icon:j2,onTrigger:()=>{$(this._codeEditor.getAction(n2)).run().then(void 0,Li)}}));const t=document.createElement("div");t.className="find-part",t.appendChild(this._findInput.domNode);const i=document.createElement("div");i.className="find-actions",t.appendChild(i),i.appendChild(this._matchesCount),i.appendChild(this._prevBtn.domNode),i.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new BB({icon:I2,title:q2+this._keybindingLabelFor(a2),isChecked:!1,inputActiveOptionBackground:qm(aw),inputActiveOptionBorder:qm(lw),inputActiveOptionForeground:qm(uw)})),this._register(this._toggleSelectionFind.onChange((()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){const t=this._codeEditor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}else this._state.change({searchScope:null},!0)}))),i.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new u4({label:G2+this._keybindingLabelFor(o2),icon:RV,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),t.preventDefault())}})),this._replaceInput=this._register(new O2(null,void 0,{label:Z2,placeholder:J2,appendPreserveCaseLabel:this._keybindingLabelFor(u2),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>_2(this._keybindingService),inputBoxStyles:wN,toggleStyles:mN},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown((t=>this._onReplaceInputKeyDown(t)))),this._register(this._replaceInput.inputBox.onDidChange((()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)}))),this._register(this._replaceInput.inputBox.onDidHeightChange((()=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()}))),this._register(this._replaceInput.onDidOptionChange((()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)}))),this._register(this._replaceInput.onPreserveCaseKeyDown((t=>{t.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),t.preventDefault())}))),this._replaceBtn=this._register(new u4({label:Q2+this._keybindingLabelFor(d2),icon:B2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new u4({label:Y2+this._keybindingLabelFor(f2),icon:$2,onTrigger:()=>{this._controller.replaceAll()}}));const e=document.createElement("div");e.className="replace-part",e.appendChild(this._replaceInput.domNode);const s=document.createElement("div");s.className="replace-actions",e.appendChild(s),s.appendChild(this._replaceBtn.domNode),s.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new u4({label:X2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}})),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=V2,this._domNode.role="dialog",this._domNode.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(e),this._resizeSash=new AB(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=s4;this._register(this._resizeSash.onDidStart((()=>{n=Jl(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<s4||i>(parseFloat(zl(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=Jl(this._domNode);if(t<s4)return;let i=s4;if(!this._resized||t===s4){const t=this._codeEditor.getLayoutInfo();i=t.width-28-t.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=Jl(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}a4.ID="editor.contrib.findWidget";class u4 extends Yy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+go.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.title=this._opts.label,this._domNode.tabIndex=0,this._domNode.className=i,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this.onclick(this._domNode,(t=>{this._opts.onTrigger(),t.preventDefault()})),this.onkeydown(this._domNode,(t=>{var i,e;if(t.equals(10)||t.equals(3))return this._opts.onTrigger(),void t.preventDefault();null===(e=(i=this._opts).onKeyDown)||void 0===e||e.call(i,t)}))}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(t){this._domNode.classList.toggle("disabled",!t),this._domNode.setAttribute("aria-disabled",String(!t)),this._domNode.tabIndex=t?0:-1}setExpanded(t){this._domNode.setAttribute("aria-expanded",String(!!t)),t?(this._domNode.classList.remove(...go.asClassNameArray(P2)),this._domNode.classList.add(...go.asClassNameArray(N2))):(this._domNode.classList.remove(...go.asClassNameArray(N2)),this._domNode.classList.add(...go.asClassNameArray(P2)))}}Vk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(fv)),e(".currentFindMatch",t.getColor(dv)),e(".findScope",t.getColor(gv)),e(".find-widget",t.getColor(Zw));const s=t.getColor(nw);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(rw);n&&i.addRule(`.monaco-editor .find-widget { border-left: 1px solid ${n}; border-right: 1px solid ${n}; border-bottom: 1px solid ${n}; }`);const r=t.getColor(mv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Ey(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(pv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(wv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${Ey(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(iw);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Jw);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const a=t.getColor(Ym);a&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${a}; }`);const u=t.getColor(Yw);if(u)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${u}; }`);else{const e=t.getColor(Qw);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(yb);d&&i.addRule(`\n\t\t.monaco-editor .find-widget .button:not(.disabled):hover,\n\t\t.monaco-editor .find-widget .codicon-find-selection:hover {\n\t\t\tbackground-color: ${d} !important;\n\t\t}\n\t`);const f=t.getColor(tw);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var d4,f4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},g4=function(t,i){return function(e,s){i(e,s,t)}};function p4(t,i="single",e=!1){if(!t.hasModel())return null;const s=t.getSelection();if("single"===i&&s.startLineNumber===s.endLineNumber||"multiple"===i)if(s.isEmpty()){const i=t.getConfiguredWordAtPosition(s.getStartPosition());if(i&&!1===e)return i.word}else if(t.getModel().getValueLengthInRange(s)<524288)return t.getModel().getValueInRange(s);return null}let m4=d4=class extends Ki{get editor(){return this._editor}static get(t){return t.getContribution(d4.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=J1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new Yh(500),this._state=this._register(new v2),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._model=null,this._register(this._editor.onDidChangeModel((()=>{const t=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),t&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})})))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(t){this.saveQueryState(t),t.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),t.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(t){t.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),t.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),t.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),t.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!Q1.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){const t=this._editor.getSelections();t.map((t=>(1===t.endColumn&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t))).filter((t=>!!t)),t.length&&this._state.change({searchScope:t},!0)}}setSearchString(t){this._state.isRegex&&(t=$n(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}async _start(t,i){if(this.disposeModel(),!this._editor.hasModel())return;const e={...i,isRevealed:!0};if("single"===t.seedSearchStringFromSelection){const i=p4(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?$n(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=p4(this._editor,t.seedSearchStringFromSelection);i&&(e.searchString=i)}if(!e.searchString&&t.seedSearchStringFromGlobalClipboard){const t=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;t&&(e.searchString=t)}if(t.forceRevealReplace||e.isReplaceRevealed?e.isReplaceRevealed=!0:this._findWidgetVisible.get()||(e.isReplaceRevealed=!1),t.updateSearchScope){const t=this._editor.getSelections();t.some((t=>!t.isEmpty()))&&(e.searchScope=t)}e.loop=t.loop,this._state.change(e,!1),this._model||(this._model=new p2(this._editor,this._state))}start(t,i){return this._start(t,i)}moveToNextMatch(){return!!this._model&&(this._model.moveToNextMatch(),!0)}moveToPrevMatch(){return!!this._model&&(this._model.moveToPrevMatch(),!0)}goToMatch(t){return!!this._model&&(this._model.moveToMatch(t),!0)}replace(){return!!this._model&&(this._model.replace(),!0)}replaceAll(){var t;return!!this._model&&((null===(t=this._editor.getModel())||void 0===t?void 0:t.isTooLargeForHeapOperation())?(this._notificationService.warn(Q(0,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0))}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}async getGlobalBufferTerm(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(t){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};m4.ID="editor.contrib.findController",m4=d4=f4([g4(1,th),g4(2,aN),g4(3,nH),g4(4,VF)],m4);let w4=class extends m4{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h,r),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._widget=null,this._findOptionsWidget=null}async _start(t,i){this._widget||this._createFindWidget();const e=this._editor.getSelection();let s=!1;switch(this._editor.getOption(41).autoFindInSelection){case"always":s=!0;break;case"never":s=!1;break;case"multiline":s=!!e&&e.startLineNumber!==e.endLineNumber}t.updateSearchScope=t.updateSearchScope||s,await super._start(t,i),this._widget&&(2===t.shouldFocus?this._widget.focusReplaceInput():1===t.shouldFocus&&this._widget.focusFindInput())}highlightFindOptions(t=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!t?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new a4(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new m2(this._editor,this._state,this._keybindingService))}};w4=f4([g4(1,KO),g4(2,th),g4(3,HC),g4(4,Nk),g4(5,VF),g4(6,aN),g4(7,nH)],w4),tu(new Za({id:"actions.find",label:Q(0,"Find"),alias:"Find",precondition:Oo.or(PS.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"3_find",title:Q(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=m4.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})}));const v4={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},regex:{type:"boolean"},regexOverride:{type:"number",description:Q(0,'Overrides "Use Regular Expression" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},wholeWord:{type:"boolean"},wholeWordOverride:{type:"number",description:Q(0,'Overrides "Match Whole Word" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},matchCase:{type:"boolean"},matchCaseOverride:{type:"number",description:Q(0,'Overrides "Math Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},preserveCase:{type:"boolean"},preserveCaseOverride:{type:"number",description:Q(0,'Overrides "Preserve Case" flag.\nThe flag will not be saved for the future.\n0: Do Nothing\n1: True\n2: False')},findInSelection:{type:"boolean"}}}}]};class b4 extends Ga{async run(t,i){const e=m4.get(i);e&&!this._run(e)&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===e.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(e))}}class y4 extends Ga{async run(t,i){const e=m4.get(i);if(!e)return;const s=p4(i,"single",!1);s&&e.setSearchString(s),this._run(e)||(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(e))}}tu(new Za({id:"editor.action.startFindReplaceAction",label:Q(0,"Replace"),alias:"Replace",precondition:Oo.or(PS.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:Sh.MenubarEditMenu,group:"3_find",title:Q(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=m4.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(41).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(41).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})})),iu(m4.ID,w4,0),Xa(class extends Ga{constructor(){super({id:"editor.actions.findWithArgs",label:Q(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:v4})}async run(t,i,e){const s=m4.get(i);if(s){const t=e?{searchString:e.searchString,replaceString:e.replaceString,isReplaceRevealed:void 0!==e.replaceString,isRegex:e.isRegex,wholeWord:e.matchWholeWord,matchCase:e.isCaseSensitive,preserveCase:e.preserveCase}:{};await s.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===s.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(41).loop},t),s.setGlobalBufferTerm(s.getState().searchString)}}}),Xa(class extends Ga{constructor(){super({id:"actions.findWithSelection",label:Q(0,"Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(t,i){const e=m4.get(i);e&&(await e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),e.setGlobalBufferTerm(e.getState().searchString))}}),Xa(class extends b4{constructor(){super({id:n2,label:Q(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:PS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Oo.and(PS.focus,Q1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),Xa(class extends b4{constructor(){super({id:r2,label:Q(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:PS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Oo.and(PS.focus,Q1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.goToMatchFindAction",label:Q(0,"Go to Match..."),alias:"Go to Match...",precondition:J1}),this._highlightDecorations=[]}run(t,i,e){const s=m4.get(i);if(!s)return;const n=s.getState().matchesCount;if(n<1)return void t.get(VF).notify({severity:jF.Warning,message:Q(0,"No matches. Try searching for something else.")});const r=t.get(mj).createInputBox();r.placeholder=Q(0,"Type a number to go to a specific match (between 1 and {0})",n);const o=t=>{const i=parseInt(t);if(isNaN(i))return;const e=s.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},h=t=>{const e=o(t);if("number"==typeof e){r.validationMessage=void 0,s.goToMatch(e);const t=s.getState().currentMatch;t&&this.addDecorations(i,t)}else r.validationMessage=Q(0,"Please type a number between 1 and {0}",s.getState().matchesCount),this.clearDecorations(i)};r.onDidChangeValue((t=>{h(t)})),r.onDidAccept((()=>{const t=o(r.value);"number"==typeof t?(s.goToMatch(t),r.hide()):r.validationMessage=Q(0,"Please type a number between 1 and {0}",s.getState().matchesCount)})),r.onDidHide((()=>{this.clearDecorations(i),r.dispose()})),r.show()}clearDecorations(t){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])}))}addDecorations(t,i){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[{range:i,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:Bk(mC),position:bf.Full}}}])}))}}),Xa(class extends y4{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:Q(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),Xa(class extends y4{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:Q(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const k4=qa.bindToContribution(m4.get);Ya(new k4({id:o2,precondition:J1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:9,secondary:[1033]}})),Ya(new k4({id:h2,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:PS.focus,primary:X1.primary,mac:X1.mac,win:X1.win,linux:X1.linux}})),Ya(new k4({id:c2,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:PS.focus,primary:t2.primary,mac:t2.mac,win:t2.win,linux:t2.linux}})),Ya(new k4({id:l2,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:PS.focus,primary:i2.primary,mac:i2.mac,win:i2.win,linux:i2.linux}})),Ya(new k4({id:a2,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:PS.focus,primary:e2.primary,mac:e2.mac,win:e2.win,linux:e2.linux}})),Ya(new k4({id:u2,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:PS.focus,primary:s2.primary,mac:s2.mac,win:s2.win,linux:s2.linux}})),Ya(new k4({id:d2,precondition:J1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:PS.focus,primary:3094}})),Ya(new k4({id:d2,precondition:J1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Y1),primary:3}})),Ya(new k4({id:f2,precondition:J1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:PS.focus,primary:2563}})),Ya(new k4({id:f2,precondition:J1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Oo.and(PS.focus,Y1),primary:void 0,mac:{primary:2051}}})),Ya(new k4({id:"editor.action.selectAllMatches",precondition:J1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:PS.focus,primary:515}}));const C4={0:" ",1:"u",2:"r"},S4=16777215,x4=4278190080;class D4{constructor(t){const i=Math.ceil(t/32);this._states=new Uint32Array(i)}get(t){return 0!=(this._states[t/32|0]&1<<t%32)}set(t,i){const e=t/32|0,s=t%32,n=this._states[e];this._states[e]=i?n|1<<s:n&~(1<<s)}}class E4{constructor(t,i,e){if(t.length!==i.length||t.length>65535)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=t,this._endIndexes=i,this._collapseStates=new D4(t.length),this._userDefinedStates=new D4(t.length),this._recoveredStates=new D4(t.length),this._types=e,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const t=[],i=(i,e)=>{const s=t[t.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=e};for(let e=0,s=this._startIndexes.length;e<s;e++){const s=this._startIndexes[e],n=this._endIndexes[e];if(s>S4||n>S4)throw new Error("startLineNumber or endLineNumber must not exceed "+S4);for(;t.length>0&&!i(s,n);)t.pop();const r=t.length>0?t[t.length-1]:-1;t.push(e),this._startIndexes[e]=s+((255&r)<<24),this._endIndexes[e]=n+((65280&r)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(t){return this._startIndexes[t]&S4}getEndLineNumber(t){return this._endIndexes[t]&S4}getType(t){return this._types?this._types[t]:void 0}hasTypes(){return!!this._types}isCollapsed(t){return this._collapseStates.get(t)}setCollapsed(t,i){this._collapseStates.set(t,i)}isUserDefined(t){return this._userDefinedStates.get(t)}setUserDefined(t,i){return this._userDefinedStates.set(t,i)}isRecovered(t){return this._recoveredStates.get(t)}setRecovered(t,i){return this._recoveredStates.set(t,i)}getSource(t){return this.isUserDefined(t)?1:this.isRecovered(t)?2:0}setSource(t,i){1===i?(this.setUserDefined(t,!0),this.setRecovered(t,!1)):2===i?(this.setUserDefined(t,!1),this.setRecovered(t,!0)):(this.setUserDefined(t,!1),this.setRecovered(t,!1))}setCollapsedAllOfType(t,i){let e=!1;if(this._types)for(let s=0;s<this._types.length;s++)this._types[s]===t&&(this.setCollapsed(s,i),e=!0);return e}toRegion(t){return new A4(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&x4)>>>24)+((this._endIndexes[t]&x4)>>>16);return 65535===i?-1:i}contains(t,i){return this.getStartLineNumber(t)<=i&&this.getEndLineNumber(t)>=i}findIndex(t){let i=0,e=this._startIndexes.length;if(0===e)return-1;for(;i<e;){const s=Math.floor((i+e)/2);t<this.getStartLineNumber(s)?e=s:i=s+1}return i-1}findRange(t){let i=this.findIndex(t);if(i>=0){if(this.getEndLineNumber(i)>=t)return i;for(i=this.getParentIndex(i);-1!==i;){if(this.contains(i,t))return i;i=this.getParentIndex(i)}}return-1}toString(){const t=[];for(let i=0;i<this.length;i++)t[i]=`[${C4[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&S4,endLineNumber:this._endIndexes[t]&S4,type:this._types?this._types[t]:void 0,isCollapsed:this.isCollapsed(t),source:this.getSource(t)}}static fromFoldRanges(t){const i=t.length,e=new Uint32Array(i),s=new Uint32Array(i);let n=[],r=!1;for(let o=0;o<i;o++){const i=t[o];e[o]=i.startLineNumber,s[o]=i.endLineNumber,n.push(i.type),i.type&&(r=!0)}r||(n=void 0);const o=new E4(e,s,n);for(let e=0;e<i;e++)t[e].isCollapsed&&o.setCollapsed(e,!0),o.setSource(e,t[e].source);return o}static sanitizeAndMerge(t,i,e){e=null!=e?e:Number.MAX_VALUE;const s=(t,i)=>Array.isArray(t)?e=>e<i?t[e]:void 0:e=>e<i?t.toFoldRange(e):void 0,n=s(t,t.length),r=s(i,i.length);let o=0,h=0,c=n(0),l=r(0);const a=[];let u,d=0;const f=[];for(;c||l;){let t;if(l&&(!c||c.startLineNumber>=l.startLineNumber))c&&c.startLineNumber===l.startLineNumber?(1===l.source?t=l:(t=c,t.isCollapsed=l.isCollapsed&&c.endLineNumber===l.endLineNumber,t.source=0),c=n(++o)):(t=l,l.isCollapsed&&0===l.source&&(t.source=2)),l=r(++h);else{let i=h,e=l;for(;;){if(!e||e.startLineNumber>c.endLineNumber){t=c;break}if(1===e.source&&e.endLineNumber>c.endLineNumber)break;e=r(++i)}c=n(++o)}if(t){for(;u&&u.endLineNumber<t.startLineNumber;)u=a.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!u||u.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,u&&a.push(u),u=t)}}return f}}class A4{constructor(t,i){this.ranges=t,this.index=i}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(t){return t.startLineNumber<=this.startLineNumber&&t.endLineNumber>=this.endLineNumber}containsLine(t){return this.startLineNumber<=t&&t<=this.endLineNumber}}class M4{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ne,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new E4(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(t){if(!t.length)return;t=t.sort(((t,i)=>t.regionIndex-i.regionIndex));const i={};this._decorationProvider.changeDecorations((e=>{let s=0,n=-1,r=-1;const o=t=>{for(;s<t;){const t=this._regions.getEndLineNumber(s),i=this._regions.isCollapsed(s);if(t<=n){const n=0!==this.regions.getSource(s);e.changeDecorationOptions(this._editorDecorationIds[s],this._decorationProvider.getDecorationOption(i,t<=r,n))}i&&t>r&&(r=t),s++}};for(const e of t){const t=e.regionIndex,s=this._editorDecorationIds[t];if(s&&!i[s]){i[s]=!0,o(t);const e=!this._regions.isCollapsed(t);this._regions.setCollapsed(t,e),n=Math.max(n,this._regions.getEndLineNumber(t))}}o(this._regions.length)})),this._updateEventEmitter.fire({model:this,collapseStateChanged:t})}removeManualRanges(t){const i=new Array,e=i=>{for(const e of t)if(!(e.startLineNumber>i.endLineNumber||i.startLineNumber>e.endLineNumber))return!0;return!1};for(let t=0;t<this._regions.length;t++){const s=this._regions.toFoldRange(t);0!==s.source&&e(s)||i.push(s)}this.updatePost(E4.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=E4.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(E4.fromFoldRanges(s))}updatePost(t){const i=[];let e=-1;for(let s=0,n=t.length;s<n;s++){const n=t.getStartLineNumber(s),r=t.getEndLineNumber(s),o=t.isCollapsed(s),h=0!==t.getSource(s),c={startLineNumber:n,startColumn:this._textModel.getLineMaxColumn(n),endLineNumber:r,endColumn:this._textModel.getLineMaxColumn(r)+1};i.push({range:c,options:this._decorationProvider.getDecorationOption(o,r<=e,h)}),o&&r>e&&(e=r)}this._decorationProvider.changeDecorations((t=>this._editorDecorationIds=t.deltaDecorations(this._editorDecorationIds,i))),this._regions=t,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(t=[]){const i=(i,e)=>{for(const s of t)if(i<s&&s<=e)return!0;return!1},e=[];for(let t=0,s=this._regions.length;t<s;t++){let s=this.regions.isCollapsed(t);const n=this.regions.getSource(t);if(s||0!==n){const r=this._regions.toFoldRange(t),o=this._textModel.getDecorationRange(this._editorDecorationIds[t]);o&&(s&&i(o.startLineNumber,o.endLineNumber)&&(s=!1),e.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,type:r.type,isCollapsed:s,source:n}))}}return e}getMemento(){const t=this._currentFoldedOrManualRanges(),i=[],e=this._textModel.getLineCount();for(let s=0,n=t.length;s<n;s++){const n=t[s];if(n.startLineNumber>=n.endLineNumber||n.startLineNumber<1||n.endLineNumber>e)continue;const r=this._getLinesChecksum(n.startLineNumber+1,n.endLineNumber);i.push({startLineNumber:n.startLineNumber,endLineNumber:n.endLineNumber,isCollapsed:n.isCollapsed,source:n.source,checksum:r})}return i.length>0?i:void 0}applyMemento(t){var i,e;if(!Array.isArray(t))return;const s=[],n=this._textModel.getLineCount();for(const r of t){if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>n)continue;const t=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);r.checksum&&t!==r.checksum||s.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,type:void 0,isCollapsed:null===(i=r.isCollapsed)||void 0===i||i,source:null!==(e=r.source)&&void 0!==e?e:0})}const r=E4.sanitizeAndMerge(this._regions,s,n);this.updatePost(E4.fromFoldRanges(r))}_getLinesChecksum(t,i){return bl(this._textModel.getLineContent(t)+this._textModel.getLineContent(i))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(t,i){const e=[];if(this._regions){let s=this._regions.findRange(t),n=1;for(;s>=0;){const t=this._regions.toRegion(s);i&&!i(t,n)||e.push(t),n++,s=t.parentIndex}}return e}getRegionAtLine(t){if(this._regions){const i=this._regions.findRange(t);if(i>=0)return this._regions.toRegion(i)}return null}getRegionsInside(t,i){const e=[],s=t?t.regionIndex+1:0,n=t?t.endLineNumber:Number.MAX_VALUE;if(i&&2===i.length){const t=[];for(let r=s,o=this._regions.length;r<o;r++){const s=this._regions.toRegion(r);if(!(this._regions.getStartLineNumber(r)<n))break;for(;t.length>0&&!s.containedBy(t[t.length-1]);)t.pop();t.push(s),i(s,t.length)&&e.push(s)}}else for(let t=s,r=this._regions.length;t<r;t++){const s=this._regions.toRegion(t);if(!(this._regions.getStartLineNumber(t)<n))break;i&&!i(s)||e.push(s)}return e}}function L4(t,i,e){const s=[];for(const n of e){const e=t.getRegionAtLine(n);if(e){const n=!e.isCollapsed;if(s.push(e),i>1){const r=t.getRegionsInside(e,((t,e)=>t.isCollapsed!==n&&e<i));s.push(...r)}}}t.toggleCollapseState(s)}function F4(t,i,e=Number.MAX_VALUE,s){const n=[];if(s&&s.length>0)for(const r of s){const s=t.getRegionAtLine(r);if(s&&(s.isCollapsed!==i&&n.push(s),e>1)){const r=t.getRegionsInside(s,((t,s)=>t.isCollapsed!==i&&s<e));n.push(...r)}}else{const s=t.getRegionsInside(null,((t,s)=>t.isCollapsed!==i&&s<e));n.push(...s)}t.toggleCollapseState(n)}function T4(t,i,e,s){const n=[];for(const r of s){const s=t.getAllRegionsAtLine(r,((t,s)=>t.isCollapsed!==i&&s<=e));n.push(...s)}t.toggleCollapseState(n)}function R4(t,i,e){const s=[];for(const i of e){const e=t.getAllRegionsAtLine(i,void 0);e.length>0&&s.push(e[0])}const n=t.getRegionsInside(null,(t=>s.every((i=>!i.containedBy(t)&&!t.containedBy(i)))&&t.isCollapsed!==i));t.toggleCollapseState(n)}function O4(t,i,e){const s=t.textModel,n=t.regions,r=[];for(let t=n.length-1;t>=0;t--)if(e!==n.isCollapsed(t)){const e=n.getStartLineNumber(t);i.test(s.getLineContent(e))&&r.push(n.toRegion(t))}t.toggleCollapseState(r)}function _4(t,i,e){const s=t.regions,n=[];for(let t=s.length-1;t>=0;t--)e!==s.isCollapsed(t)&&i===s.getType(t)&&n.push(s.toRegion(t));t.toggleCollapseState(n)}class I4{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ne,this._hasLineChanges=!1,this._foldingModel=t,this._foldingModelListener=t.onDidChange((()=>this.updateHiddenRanges())),this._hiddenRanges=[],t.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(t){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=t.changes.some((t=>t.range.endLineNumber!==t.range.startLineNumber||0!==TD(t.text)[0])))}updateHiddenRanges(){let t=!1;const i=[];let e=0,s=0,n=Number.MAX_VALUE,r=-1;const o=this._foldingModel.regions;for(;e<o.length;e++){if(!o.isCollapsed(e))continue;const h=o.getStartLineNumber(e)+1,c=o.getEndLineNumber(e);n<=h&&c<=r||(!t&&s<this._hiddenRanges.length&&this._hiddenRanges[s].startLineNumber===h&&this._hiddenRanges[s].endLineNumber===c?(i.push(this._hiddenRanges[s]),s++):(t=!0,i.push(new bs(h,1,c,1))),n=h,r=c)}(this._hasLineChanges||t||s<this._hiddenRanges.length)&&this.applyHiddenRanges(i)}applyHiddenRanges(t){this._hiddenRanges=t,this._hasLineChanges=!1,this._updateEventEmitter.fire(t)}hasRanges(){return this._hiddenRanges.length>0}isHidden(t){return null!==P4(this._hiddenRanges,t)}adjustSelections(t){let i=!1;const e=this._foldingModel.textModel;let s=null;const n=t=>(s&&function(t,i){return t>=i.startLineNumber&&t<=i.endLineNumber}(t,s)||(s=P4(this._hiddenRanges,t)),s?s.startLineNumber-1:null);for(let s=0,r=t.length;s<r;s++){let r=t[s];const o=n(r.startLineNumber);o&&(r=r.setStartPosition(o,e.getLineMaxColumn(o)),i=!0);const h=n(r.endLineNumber);h&&(r=r.setEndPosition(h,e.getLineMaxColumn(h)),i=!0),t[s]=r}return i}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function P4(t,i){const e=qf(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class N4{constructor(t,i,e){this.editorModel=t,this.languageConfigurationService=i,this.foldingRangesLimit=e,this.id="indent"}dispose(){}compute(t){const i=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules;return Promise.resolve(function(t,i,e,s=$4){const n=t.getOptions().tabSize,r=new B4(s);let o;e&&(o=new RegExp(`(${e.start.source})|(?:${e.end.source})`));const h=[],c=t.getLineCount()+1;h.push({indent:-1,endAbove:c,line:c});for(let e=t.getLineCount();e>0;e--){const s=t.getLineContent(e),c=mx(s,n);let l,a=h[h.length-1];if(-1!==c){if(o&&(l=s.match(o))){if(!l[1]){h.push({indent:-2,endAbove:e,line:e});continue}{let t=h.length-1;for(;t>0&&-2!==h[t].indent;)t--;if(t>0){h.length=t+1,a=h[t],r.insertFirst(e,a.line,c),a.line=e,a.indent=c,a.endAbove=e;continue}}}if(a.indent>c){do{h.pop(),a=h[h.length-1]}while(a.indent>c);const t=a.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}a.indent===c?a.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(a.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class B4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>S4||i>S4)return;const s=this._length;this._startIndexes[s]=t,this._endIndexes[s]=i,this._length++,e<1e3&&(this._indentOccurrences[e]=(this._indentOccurrences[e]||0)+1)}toIndentRanges(t){const i=this._foldingRangesLimit.limit;if(this._length<=i){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let e=this._length-1,s=0;e>=0;e--,s++)t[s]=this._startIndexes[e],i[s]=this._endIndexes[e];return new E4(t,i)}{this._foldingRangesLimit.update(this._length,i);let e=0,s=this._indentOccurrences.length;for(let t=0;t<this._indentOccurrences.length;t++){const n=this._indentOccurrences[t];if(n){if(n+e>i){s=t;break}e+=n}}const n=t.getOptions().tabSize,r=new Uint32Array(i),o=new Uint32Array(i);for(let h=this._length-1,c=0;h>=0;h--){const l=this._startIndexes[h],a=mx(t.getLineContent(l),n);(a<s||a===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new E4(r,o)}}}const $4={limit:5e3,update:()=>{}},W4=Jm("editor.foldBackground",{light:Gb(cv,.3),dark:Gb(cv,.3),hcDark:null,hcLight:null},Q(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);Jm("editorGutter.foldingControlForeground",{dark:Xm,light:Xm,hcDark:Xm,hcLight:Xm},Q(0,"Color of the folding control in the editor gutter."));const j4=AV("folding-expanded",xs.chevronDown,Q(0,"Icon for expanded ranges in the editor glyph margin.")),V4=AV("folding-collapsed",xs.chevronRight,Q(0,"Icon for collapsed ranges in the editor glyph margin.")),H4=AV("folding-manual-collapsed",V4,Q(0,"Icon for manually collapsed ranges in the editor glyph margin.")),z4=AV("folding-manual-expanded",j4,Q(0,"Icon for manually expanded ranges in the editor glyph margin.")),U4={color:Bk(W4),position:kf.Inline};class K4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?K4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?K4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:K4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:K4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?K4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:K4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?K4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:K4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?K4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:K4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?K4.MANUALLY_EXPANDED_VISUAL_DECORATION:K4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}K4.COLLAPSED_VISUAL_DECORATION=aL.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:go.asClassName(V4)}),K4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=aL.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(V4)}),K4.MANUALLY_COLLAPSED_VISUAL_DECORATION=aL.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:go.asClassName(H4)}),K4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=aL.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(H4)}),K4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),K4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:U4,isWholeLine:!0}),K4.EXPANDED_VISUAL_DECORATION=aL.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+go.asClassName(j4)}),K4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=aL.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(j4)}),K4.MANUALLY_EXPANDED_VISUAL_DECORATION=aL.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+go.asClassName(z4)}),K4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=aL.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:go.asClassName(z4)}),K4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=aL.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),K4.HIDDEN_RANGE_DECORATION=aL.register({description:"folding-hidden-range-decoration",stickiness:1});const q4={};class G4{constructor(t,i,e,s,n){this.editorModel=t,this.providers=i,this.handleFoldingRangesChange=e,this.foldingRangesLimit=s,this.fallbackRangeProvider=n,this.id="syntax",this.disposables=new Ui,n&&this.disposables.add(n);for(const t of i)"function"==typeof t.onDidChange&&this.disposables.add(t.onDidChange(e))}compute(t){return function(t,i,e){let s=null;const n=t.map(((t,n)=>Promise.resolve(t.provideFoldingRanges(i,q4,e)).then((t=>{if(!e.isCancellationRequested&&Array.isArray(t)){Array.isArray(s)||(s=[]);const e=i.getLineCount();for(const i of t)i.start>0&&i.end>i.start&&i.end<=e&&s.push({start:i.start,end:i.end,rank:n,kind:i.kind})}}),Fi)));return Promise.all(n).then((()=>s))}(this.providers,this.editorModel,t).then((i=>{var e,s;return i?function(t,i){const e=t.sort(((t,i)=>{let e=t.start-i.start;return 0===e&&(e=t.rank-i.rank),e})),s=new Z4(i);let n;const r=[];for(const t of e)if(n){if(t.start>n.start)if(t.end<=n.end)r.push(n),n=t,s.add(t.start,t.end,t.kind&&t.kind.value,r.length);else{if(t.start>n.end){do{n=r.pop()}while(n&&t.start>n.end);n&&r.push(n),n=t}s.add(t.start,t.end,t.kind&&t.kind.value,r.length)}}else n=t,s.add(t.start,t.end,t.kind&&t.kind.value,r.length);return s.toIndentRanges()}(i,this.foldingRangesLimit):null!==(s=null===(e=this.fallbackRangeProvider)||void 0===e?void 0:e.compute(t))&&void 0!==s?s:null}))}dispose(){this.disposables.dispose()}}class Z4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=t}add(t,i,e,s){if(t>S4||i>S4)return;const n=this._length;this._startIndexes[n]=t,this._endIndexes[n]=i,this._nestingLevels[n]=s,this._types[n]=e,this._length++,s<30&&(this._nestingLevelCounts[s]=(this._nestingLevelCounts[s]||0)+1)}toIndentRanges(){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let e=0;e<this._length;e++)t[e]=this._startIndexes[e],i[e]=this._endIndexes[e];return new E4(t,i,this._types)}{this._foldingRangesLimit.update(this._length,t);let i=0,e=this._nestingLevelCounts.length;for(let s=0;s<this._nestingLevelCounts.length;s++){const n=this._nestingLevelCounts[s];if(n){if(n+i>t){e=s;break}i+=n}}const s=new Uint32Array(t),n=new Uint32Array(t),r=[];for(let o=0,h=0;o<this._length;o++){const c=this._nestingLevels[o];(c<e||c===e&&i++<t)&&(s[h]=this._startIndexes[o],n[h]=this._endIndexes[o],r[h]=this._types[o],h++)}return new E4(s,n,r)}}}var J4,Q4=function(t,i){return function(e,s){i(e,s,t)}};const Y4=new Xo("foldingEnabled",!1);let X4=J4=class extends Ki{static get(t){return t.getContribution(J4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=J4._foldingRangeSelector)||void 0===e?void 0:e.call(J4,n,i))&&void 0!==s?s:n}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Ui),this.editor=t,this._foldingLimitReporter=new t5(t);const o=this.editor.getOptions();this._isEnabled=o.get(43),this._useFoldingProviders="indentation"!==o.get(44),this._unfoldOnClickAfterEndOfLine=o.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(46),this.updateDebounceInfo=n.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new K4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=Y4.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(47)&&this.onModelChanged(),t.hasChanged(109)||t.hasChanged(45)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(109),this.foldingDecorationProvider.showFoldingHighlights=t.get(45),this.triggerFoldingModelChanged()}t.hasChanged(44)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(44),this.onFoldingStrategyChanged()),t.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),t.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))}))),this.onModelChanged()}saveViewState(){const t=this.editor.getModel();if(!t||!this._isEnabled||t.isTooLargeForTokenization())return{};if(this.foldingModel){const i=this.foldingModel.getMemento(),e=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:i,lineCount:t.getLineCount(),provider:e,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(t){const i=this.editor.getModel();if(i&&this._isEnabled&&!i.isTooLargeForTokenization()&&this.hiddenRangeModel&&t&&(this._currentModelHasFoldedImports=!!t.foldedImports,t.collapsedRegions&&t.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(t.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const t=this.editor.getModel();this._isEnabled&&t&&!t.isTooLargeForTokenization()&&(this._currentModelHasFoldedImports=!1,this.foldingModel=new M4(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new I4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new Yh(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new rc((()=>this.revealCursor()),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelContent((t=>this.onDidChangeModelContent(t)))),this.localToDispose.add(this.editor.onDidChangeCursorPosition((()=>this.onCursorPositionChanged()))),this.localToDispose.add(this.editor.onMouseDown((t=>this.onEditorMouseDown(t)))),this.localToDispose.add(this.editor.onMouseUp((t=>this.onEditorMouseUp(t)))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),null===(t=this.updateScheduler)||void 0===t||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,null===(i=this.rangeProvider)||void 0===i||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var t;null===(t=this.rangeProvider)||void 0===t||t.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(t){if(this.rangeProvider)return this.rangeProvider;const i=new N4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=J4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new G4(t,e,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,i))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(t){var i;null===(i=this.hiddenRangeModel)||void 0===i||i.notifyChangeModelContent(t),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger((()=>{const t=this.foldingModel;if(!t)return null;const i=new Yi,e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=Zh((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Bs.Imports.value,!0);t&&(s=$z.capture(this.editor),this._currentModelHasFoldedImports=t)}const n=this.editor.getSelections(),r=n?n.map((t=>t.startLineNumber)):[];t.update(e,r),null==s||s.restore(this.editor);const o=this.updateDebounceInfo.update(t.textModel,i.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=o)}return t}))})).then(void 0,(t=>(Li(t),null))))}onHiddenRangesChanges(t){if(this.hiddenRangeModel&&t.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(t,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const t=this.getFoldingModel();t&&t.then((t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const e=[];for(const s of i){const i=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(i)&&e.push(...t.getAllRegionsAtLine(i,(t=>t.isCollapsed&&i>t.startLineNumber)))}e.length&&(t.toggleCollapseState(e),this.reveal(i[0].getPosition()))}}})).then(void 0,Li)}onEditorMouseDown(t){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!t.target||!t.target.range)return;if(!t.event.leftButton&&!t.event.middleButton)return;const i=t.target.range;let e=!1;switch(t.target.type){case 4:if(t.target.detail.offsetX-t.target.element.offsetLeft<4)return;e=!0;break;case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!t.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){const t=this.editor.getModel();if(t&&i.startColumn===t.getLineMaxColumn(i.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:i.startLineNumber,iconClicked:e}}onEditorMouseUp(t){const i=this.foldingModel;if(!i||!this.mouseDownInfo||!t.target)return;const e=this.mouseDownInfo.lineNumber,s=this.mouseDownInfo.iconClicked,n=t.target.range;if(!n||n.startLineNumber!==e)return;if(s){if(4!==t.target.type)return}else{const t=this.editor.getModel();if(!t||n.startColumn!==t.getLineMaxColumn(e))return}const r=i.getRegionAtLine(e);if(r&&r.startLineNumber===e){const n=r.isCollapsed;if(s||n){let s=[];if(t.event.altKey){const t=i.getRegionsInside(null,(t=>!t.containedBy(r)&&!r.containedBy(t)));for(const i of t)i.isCollapsed&&s.push(i);0===s.length&&(s=t)}else{const e=t.event.middleButton||t.event.shiftKey;if(e)for(const t of i.getRegionsInside(r))t.isCollapsed===n&&s.push(t);!n&&e&&0!==s.length||s.push(r)}i.toggleCollapseState(s),this.reveal({lineNumber:e,column:1})}}}reveal(t){this.editor.revealPositionInCenterIfOutsideViewport(t,0)}};X4.ID="editor.contrib.folding",X4=J4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q4(1,th),Q4(2,Nd),Q4(3,VF),Q4(4,YT),Q4(5,op)],X4);class t5{constructor(t){this.editor=t,this._onDidChange=new ne,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class i5 extends Ga{runEditorCommand(t,i,e){const s=t.get(Nd),n=X4.get(i);if(!n)return;const r=n.getFoldingModel();return r?(this.reportTelemetry(t,i),r.then((t=>{if(t){this.invoke(n,t,i,e,s);const r=i.getSelection();r&&n.reveal(r.getStartPosition())}}))):void 0}getSelectedLines(t){const i=t.getSelections();return i?i.map((t=>t.startLineNumber)):[]}getLineNumbers(t,i){return t&&t.selectionLines?t.selectionLines.map((t=>t+1)):this.getSelectedLines(i)}run(t,i){}}function e5(t){if(!I(t)){if(!F(t))return!1;const i=t;if(!I(i.levels)&&!R(i.levels))return!1;if(!I(i.direction)&&!L(i.direction))return!1;if(!(I(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(R)))return!1}return!0}class s5 extends i5{getFoldingLevel(){return parseInt(this.id.substr(s5.ID_PREFIX.length))}invoke(t,i,e){!function(t,i,e,s){const n=t.getRegionsInside(null,((t,e)=>e===i&&true!==t.isCollapsed&&!s.some((i=>t.containsLine(i)))));t.toggleCollapseState(n)}(i,this.getFoldingLevel(),0,this.getSelectedLines(e))}}s5.ID_PREFIX="editor.foldLevel",s5.ID=t=>s5.ID_PREFIX+t,iu(X4.ID,X4,0),Xa(class extends i5{constructor(){super({id:"editor.unfold",label:Q(0,"Unfold"),alias:"Unfold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t* 'levels': Number of levels to unfold. If not set, defaults to 1.\n\t\t\t\t\t\t* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.\n\t\t\t\t\t\t* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t",constraint:e5,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(t,i,e,s){const n=s&&s.levels||1,r=this.getLineNumbers(s,e);s&&"up"===s.direction?T4(i,!1,n,r):F4(i,!1,n,r)}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldRecursively",label:Q(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2142),weight:100}})}invoke(t,i,e,s){F4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.fold",label:Q(0,"Fold"),alias:"Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:"Property-value pairs that can be passed through this argument:\n\t\t\t\t\t\t\t* 'levels': Number of levels to fold.\n\t\t\t\t\t\t\t* 'direction': If 'up', folds given number of levels up otherwise folds down.\n\t\t\t\t\t\t\t* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.\n\t\t\t\t\t\t\tIf no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.\n\t\t\t\t\t\t",constraint:e5,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(t,i,e,s){const n=this.getLineNumbers(s,e),r=s&&s.levels,o=s&&s.direction;"number"!=typeof r&&"string"!=typeof o?function(t,i,e){const s=[];for(const i of e){const e=t.getAllRegionsAtLine(i,(t=>true!==t.isCollapsed));e.length>0&&s.push(e[0])}t.toggleCollapseState(s)}(i,0,n):"up"===o?T4(i,!0,r||1,n):F4(i,!0,r||1,n)}}),Xa(class extends i5{constructor(){super({id:"editor.foldRecursively",label:Q(0,"Fold Recursively"),alias:"Fold Recursively",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);F4(i,!0,Number.MAX_VALUE,s)}}),Xa(class extends i5{constructor(){super({id:"editor.foldAll",label:Q(0,"Fold All"),alias:"Fold All",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2069),weight:100}})}invoke(t,i,e){F4(i,!0)}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAll",label:Q(0,"Unfold All"),alias:"Unfold All",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2088),weight:100}})}invoke(t,i,e){F4(i,!1)}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllBlockComments",label:Q(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&O4(i,new RegExp("^\\s*"+$n(s.blockCommentStartToken)),!0)}}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllMarkerRegions",label:Q(0,"Fold All Regions"),alias:"Fold All Regions",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&O4(i,new RegExp(s.markers.start),!0)}}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:Q(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())_4(i,Bs.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&O4(i,new RegExp(s.markers.start),!1)}}}),Xa(class extends i5{constructor(){super({id:"editor.foldAllExcept",label:Q(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2136),weight:100}})}invoke(t,i,e){R4(i,!0,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.unfoldAllExcept",label:Q(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2134),weight:100}})}invoke(t,i,e){R4(i,!1,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.toggleFold",label:Q(0,"Toggle Fold"),alias:"Toggle Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2090),weight:100}})}invoke(t,i,e){L4(i,1,this.getSelectedLines(e))}}),Xa(class extends i5{constructor(){super({id:"editor.gotoParentFold",label:Q(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=null;const s=i.getRegionAtLine(t);if(null!==s&&(e=s.startLineNumber,t===e)){const t=s.parentIndex;e=-1!==t?i.regions.getStartLineNumber(t):null}return e}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.gotoPreviousFold",label:Q(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=i.getRegionAtLine(t);if(null!==e&&e.startLineNumber===t){if(t!==e.startLineNumber)return e.startLineNumber;{const t=e.parentIndex;let s=0;for(-1!==t&&(s=i.regions.getStartLineNumber(e.parentIndex));null!==e;){if(!(e.regionIndex>0))return null;if(e=i.regions.toRegion(e.regionIndex-1),e.startLineNumber<=s)return null;if(e.parentIndex===t)return e.startLineNumber}}}else if(i.regions.length>0)for(e=i.regions.toRegion(i.regions.length-1);null!==e;){if(e.startLineNumber<t)return e.startLineNumber;e=e.regionIndex>0?i.regions.toRegion(e.regionIndex-1):null}return null}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.gotoNextFold",label:Q(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);if(s.length>0){const t=function(t,i){let e=i.getRegionAtLine(t);if(null!==e&&e.startLineNumber===t){const t=e.parentIndex;let s=0;if(-1!==t)s=i.regions.getEndLineNumber(e.parentIndex);else{if(0===i.regions.length)return null;s=i.regions.getEndLineNumber(i.regions.length-1)}for(;null!==e;){if(!(e.regionIndex<i.regions.length))return null;if(e=i.regions.toRegion(e.regionIndex+1),e.startLineNumber>=s)return null;if(e.parentIndex===t)return e.startLineNumber}}else if(i.regions.length>0)for(e=i.regions.toRegion(0);null!==e;){if(e.startLineNumber>t)return e.startLineNumber;e=e.regionIndex<i.regions.length?i.regions.toRegion(e.regionIndex+1):null}return null}(s[0],i);null!==t&&e.setSelection({startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1})}}}),Xa(class extends i5{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:Q(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2135),weight:100}})}invoke(t,i,e){var s;const n=[],r=e.getSelections();if(r){for(const t of r){let i=t.endLineNumber;1===t.endColumn&&--i,i>t.startLineNumber&&(n.push({startLineNumber:t.startLineNumber,endLineNumber:i,type:void 0,isCollapsed:!0,source:1}),e.setSelection({startLineNumber:t.startLineNumber,startColumn:1,endLineNumber:t.startLineNumber,endColumn:1}))}if(n.length>0){n.sort(((t,i)=>t.startLineNumber-i.startLineNumber));const t=E4.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(E4.fromFoldRanges(t))}}}}),Xa(class extends i5{constructor(){super({id:"editor.removeManualFoldingRanges",label:Q(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2137),weight:100}})}invoke(t,i,e){const s=e.getSelections();if(s){const e=[];for(const t of s){const{startLineNumber:i,endLineNumber:s}=t;e.push(s>=i?{startLineNumber:i,endLineNumber:s}:{endLineNumber:s,startLineNumber:i})}i.removeManualRanges(e),t.triggerFoldingModelChanged()}}});for(let t=1;t<=7;t++)n5=new s5({id:s5.ID(t),label:Q(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:Y4,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2048|21+t),weight:100}}),su.INSTANCE.registerEditorAction(n5);var n5;mo.registerCommand("_executeFoldingRangeProvider",(async function(t,...i){const[e]=i;if(!(e instanceof hs))throw Ii();const s=t.get(op),n=t.get(no).getModel(e);if(!n)throw Ii();const r=t.get(rd);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(Nd),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new N4(n,o,c);let a=l;if("indentation"!==h){const t=X4.getFoldingRangeProviders(s,n);t.length&&(a=new G4(n,t,(()=>{}),c,l))}const u=await a.compute(fe.None),d=[];try{if(u)for(let t=0;t<u.length;t++){const i=u.getType(t);d.push({start:u.getStartLineNumber(t),end:u.getEndLineNumber(t),kind:i?Bs.fromValue(i):void 0})}return d}finally{a.dispose()}})),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomIn",label:Q(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Gr.setZoomLevel(Gr.getZoomLevel()+1)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomOut",label:Q(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Gr.setZoomLevel(Gr.getZoomLevel()-1)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.fontZoomReset",label:Q(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Gr.setZoomLevel(0)}});var r5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},o5=function(t,i){return function(e,s){i(e,s,t)}};let h5=class{constructor(t,i,e,s){this._editor=t,this._languageFeaturesService=i,this._workerService=e,this._accessibleNotificationService=s,this._disposables=new Ui,this._sessionDisposables=new Ui,this._disposables.add(i.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(56)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56))return;if(!this._editor.hasModel())return;const t=this._editor.getModel(),[i]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(t);if(!i||!i.autoFormatTriggerCharacters)return;const e=new af;for(const t of i.autoFormatTriggerCharacters)e.add(t.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType((t=>{const i=t.charCodeAt(t.length-1);e.has(i)&&this._trigger(String.fromCharCode(i))})))}_trigger(t){if(!this._editor.hasModel())return;if(this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const i=this._editor.getModel(),e=this._editor.getPosition(),s=new pe,n=this._editor.onDidChangeModelContent((t=>{if(t.isFlush)return s.cancel(),void n.dispose();for(let i=0,r=t.changes.length;i<r;i++)if(t.changes[i].range.endLineNumber<=e.lineNumber)return s.cancel(),void n.dispose()}));kq(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||u(t)&&(this._accessibleNotificationService.notify("format",!1),dq.execute(this._editor,t,!0))})).finally((()=>{n.dispose()}))}};h5.ID="editor.contrib.autoFormat",h5=r5([o5(1,op),o5(2,iB),o5(3,Im)],h5);let c5=class{constructor(t,i,e){this.editor=t,this._languageFeaturesService=i,this._instantiationService=e,this._callOnDispose=new Ui,this._callOnModel=new Ui,this._callOnDispose.add(t.onDidChangeConfiguration((()=>this._update()))),this._callOnDispose.add(t.onDidChangeModel((()=>this._update()))),this._callOnDispose.add(t.onDidChangeModelLanguage((()=>this._update()))),this._callOnDispose.add(i.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste((({range:t})=>this._trigger(t))))}_trigger(t){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(wq,this.editor,t,2,xO.None,fe.None,!1).catch(Li))}};c5.ID="editor.contrib.formatOnPaste",c5=r5([o5(1,op),o5(2,io)],c5),iu(h5.ID,h5,2),iu(c5.ID,c5,2),Xa(class extends Ga{constructor(){super({id:"editor.action.formatDocument",label:Q(0,"Format Document"),alias:"Format Document",precondition:Oo.and(PS.notInCompositeEditor,PS.writable,PS.hasDocumentFormattingProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(t,i){if(i.hasModel()){const e=t.get(io),s=t.get(DO);await s.showWhile(e.invokeFunction(bq,i,1,xO.None,fe.None,!0),250)}}}),Xa(class extends Ga{constructor(){super({id:"editor.action.formatSelection",label:Q(0,"Format Selection"),alias:"Format Selection",precondition:Oo.and(PS.writable,PS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2084),weight:100},contextMenuOpts:{when:PS.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(t,i){if(!i.hasModel())return;const e=t.get(io),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new bs(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(DO);await r.showWhile(e.invokeFunction(wq,i,n,1,xO.None,fe.None,!0),250)}}),mo.registerCommand("editor.action.format",(async t=>{const i=t.get(so).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(po);i.getSelection().isEmpty()?await e.executeCommand("editor.action.formatDocument"):await e.executeCommand("editor.action.formatSelection")}));var l5=function(t,i){return function(e,s){i(e,s,t)}};class a5{remove(){var t;null===(t=this.parent)||void 0===t||t.children.delete(this.id)}static findId(t,i){let e;"string"==typeof t?e=`${i.id}/${t}`:(e=`${i.id}/${t.name}`,void 0!==i.children.get(e)&&(e=`${i.id}/${t.name}_${t.range.startLineNumber}_${t.range.startColumn}`));let s=e;for(let t=0;void 0!==i.children.get(s);t++)s=`${e}_${t}`;return s}static empty(t){return 0===t.children.size}}class u5 extends a5{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class d5 extends a5{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class f5 extends a5{static create(t,i,s){const n=new pe(s),r=new f5(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=a5.findId(`provider_${e}`,r),h=new d5(o,r,null!==(s=t.displayName)&&void 0!==s?s:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,n.token)).then((t=>{for(const i of t||[])f5._makeOutlineElement(i,h);return h}),(t=>(Fi(t),h))).then((t=>{a5.empty(t)?t.remove():r._groups.set(o,t)}))})),c=t.onDidChange((()=>{e(t.ordered(i),o)||n.cancel()}));return Promise.all(h).then((()=>n.token.isCancellationRequested&&!s.isCancellationRequested?f5.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=a5.findId(t,i),s=new u5(e,i,t);if(t.children)for(const i of t.children)f5._makeOutlineElement(i,s);i.children.set(s.id,s)}constructor(t){super(),this.uri=t,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let t=0;for(const[i,e]of this._groups)0===e.children.size?this._groups.delete(i):t+=1;if(1!==t)this.children=this._groups;else{const t=It.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const t=[];for(const i of this.children.values())i instanceof u5?t.push(i.symbol):t.push(...It.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return f5._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>vs.compare(bs.getStartPosition(t.range),bs.getStartPosition(i.range))||vs.compare(bs.getEndPosition(i.range),bs.getEndPosition(t.range))))}static _flattenDocumentSymbols(t,i,e){for(const s of i)t.push({kind:s.kind,tags:s.tags,name:s.name,detail:s.detail,containerName:s.containerName||e,range:s.range,selectionRange:s.selectionRange,children:void 0}),s.children&&f5._flattenDocumentSymbols(t,s.children,s.name)}}const g5=eo("IOutlineModelService");let p5=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Ui,this._cache=new Mg(10,.7),this._debounceInformation=i.for(t.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(e.onModelRemoved((t=>{this._cache.delete(t.id)})))}dispose(){this._disposables.dispose()}async getOrCreate(t,i){const s=this._languageFeaturesService.documentSymbolProvider,n=s.ordered(t);let r=this._cache.get(t.id);if(!r||r.versionId!==t.getVersionId()||!e(r.provider,n)){const i=new pe;r={versionId:t.getVersionId(),provider:n,promiseCnt:0,source:i,promise:f5.create(s,t,i.token),model:void 0},this._cache.set(t.id,r);const e=Date.now();r.promise.then((i=>{r.model=i,this._debounceInformation.update(t,Date.now()-e)})).catch((()=>{this._cache.delete(t.id)}))}if(r.model)return r.model;r.promiseCnt+=1;const o=i.onCancellationRequested((()=>{0==--r.promiseCnt&&(r.source.cancel(),this._cache.delete(t.id))}));try{return await r.promise}finally{o.dispose()}}};p5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([l5(0,op),l5(1,YT),l5(2,no)],p5),gd(g5,p5,1),mo.registerCommand("_executeDocumentSymbolProvider",(async function(t,...i){const[e]=i;B(hs.isUri(e));const s=t.get(g5),n=t.get(ro),r=await n.createModelReference(e);try{return(await s.getOrCreate(r.object.textEditorModel,fe.None)).getTopLevelSymbols()}finally{r.dispose()}}));class m5 extends Ki{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=m5.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=m5.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=m5.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=m5.suppressSuggestions.bindTo(this.contextKeyService),this._register(xz((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t),s=!!(null==e?void 0:e.inlineCompletion)&&void 0!==(null==e?void 0:e.ghostText)&&!(null==e?void 0:e.ghostText.isEmpty());this.inlineCompletionVisible.set(s),(null==e?void 0:e.ghostText)&&(null==e?void 0:e.inlineCompletion)&&this.suppressSuggestions.set(e.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(xz((t=>{const i=this.model.read(t);let e=!1,s=!0;const n=null==i?void 0:i.ghostText.read(t);if((null==i?void 0:i.selectedSuggestItem)&&n&&n.parts.length>0){const{column:t,lines:r}=n.parts[0],o=r[0];if(t<=i.textModel.getLineIndentColumn(n.lineNumber)){let t=Un(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=Ny.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}m5.inlineSuggestionVisible=new Xo("inlineSuggestionVisible",!1,Q(0,"Whether an inline suggestion is visible")),m5.inlineSuggestionHasIndentation=new Xo("inlineSuggestionHasIndentation",!1,Q(0,"Whether the inline suggestion starts with whitespace")),m5.inlineSuggestionHasIndentationLessThanTabSize=new Xo("inlineSuggestionHasIndentationLessThanTabSize",!0,Q(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),m5.suppressSuggestions=new Xo("inlineSuggestionSuppressSuggestions",void 0,Q(0,"Whether suggestions should be suppressed for the current suggestion"));class w5{constructor(t){this.lineStartOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let i=0;i<t.length;i++)"\n"===t.charAt(i)&&this.lineStartOffsetByLineIdx.push(i+1)}getOffset(t){return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}}const v5=[];class b5{constructor(t,i){if(this.startColumn=t,this.endColumnExclusive=i,t>i)throw new $i(`startColumn ${t} cannot be after endColumnExclusive ${i}`)}toRange(t){return new bs(t,this.startColumn,t,this.endColumnExclusive)}equals(t){return this.startColumn===t.startColumn&&this.endColumnExclusive===t.endColumnExclusive}}function y5(t,i){return new vs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function k5(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new vs(i,e)}class C5{constructor(t,i){this.lineNumber=t,this.parts=i}equals(t){return this.lineNumber===t.lineNumber&&this.parts.length===t.parts.length&&this.parts.every(((i,e)=>i.equals(t.parts[e])))}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new w5(t),s=i.map((t=>{const i=bs.lift(t.range);return{startOffset:e.getOffset(i.getStartPosition()),endOffset:e.getOffset(i.getEndPosition()),text:t.text}}));s.sort(((t,i)=>i.startOffset-t.startOffset));for(const i of s)t=t.substring(0,i.startOffset)+i.text+t.substring(i.endOffset);return t}(t.substr(0,this.parts[this.parts.length-1].column-1),this.parts.map((t=>({range:{startLineNumber:1,endLineNumber:1,startColumn:t.column,endColumn:t.column},text:t.lines.join("\n")}))));return i.substring(this.parts[0].column-1)}isEmpty(){return this.parts.every((t=>0===t.lines.length))}get lineCount(){return 1+this.parts.reduce(((t,i)=>t+i.lines.length-1),0)}}class S5{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}equals(t){return this.column===t.column&&this.lines.length===t.lines.length&&this.lines.every(((i,e)=>i===t.lines[e]))}}class x5{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new S5(this.columnRange.endColumnExclusive,this.newLines,!1)]}renderForScreenReader(t){return this.newLines.join("\n")}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every((t=>0===t.lines.length))}equals(t){return this.lineNumber===t.lineNumber&&this.columnRange.equals(t.columnRange)&&this.newLines.length===t.newLines.length&&this.newLines.every(((i,e)=>i===t.newLines[e]))&&this.additionalReservedLineCount===t.additionalReservedLineCount}}function D5(t,i){return t===i||!(!t||!i)&&(t instanceof C5&&i instanceof C5||t instanceof x5&&i instanceof x5)&&t.equals(i)}const E5="ghost-text";let A5=class extends Ki{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=gz(this,!1),this.currentTextModel=Tz(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=bz(this,(t=>{if(this.isDisposed.read(t))return;const i=this.currentTextModel.read(t);if(i!==this.model.targetTextModel.read(t))return;const e=this.model.ghostText.read(t);if(!e)return;const s=e instanceof x5?e.columnRange:void 0,n=[],r=[];function o(t,i){if(r.length>0){const e=r[r.length-1];i&&e.decorations.push(new xp(e.content.length+1,e.content.length+1+t[0].length,i,0)),e.content+=t[0],t=t.slice(1)}for(const e of t)r.push({content:e,decorations:i?[new xp(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,l=0;for(const t of e.parts){let i=t.lines;void 0===c?(n.push({column:t.column,text:i[0],preview:t.preview}),i=i.slice(1)):o([h.substring(l,t.column-1)],void 0),i.length>0&&(o(i,E5),void 0===c&&t.column<=h.length&&(c=t.column)),l=t.column-1}void 0!==c&&o([h.substring(l)],void 0);const a=void 0!==c?new b5(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:a,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=bz(this,(t=>{const i=this.uiState.read(t);if(!i)return[];const e=[];i.replacedRange&&e.push({range:i.replacedRange.toRange(i.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),i.hiddenRange&&e.push({range:i.hiddenRange.toRange(i.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const t of i.inlineTexts)e.push({range:bs.fromPositions(new vs(i.lineNumber,t.column)),options:{description:E5,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:Cf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new M5(this.editor,this.languageService.languageIdCodec,bz((t=>{const i=this.uiState.read(t);return i?{lineNumber:i.lineNumber,additionalLines:i.additionalLines,minReservedLineCount:i.additionalReservedLineCount,targetTextModel:i.targetTextModel}:void 0})))),this._register(zi((()=>{this.isDisposed.set(!0,void 0)}))),this._register(function(t,i){const e=new Ui,s=t.createDecorationsCollection();return e.add(Dz({debugName:()=>`Apply decorations from ${i.debugName}`},(t=>{const e=i.read(t);s.set(e)}))),e.add({dispose:()=>{s.clear()}}),e}(this.editor,this.decorations))}ownsViewZone(t){return this.additionalLinesWidget.viewZoneId===t}};A5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,ud)],A5);class M5 extends Ki{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=Oz("editorOptionChanged",Xi.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(33)||t.hasChanged(116)||t.hasChanged(98)||t.hasChanged(93)||t.hasChanged(51)||t.hasChanged(50)||t.hasChanged(66)))),this._register(xz((t=>{const i=this.lines.read(t);this.editorOptionsChanged.read(t),i?this.updateLines(i.lineNumber,i.additionalLines,i.minReservedLineCount):this.clear()})))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones((t=>{this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0)}))}updateLines(t,i,e){const s=this.editor.getModel();if(!s)return;const{tabSize:n}=s.getOptions();this.editor.changeViewZones((s=>{this._viewZoneId&&(s.removeZone(this._viewZoneId),this._viewZoneId=void 0);const r=Math.max(i.length,e);if(r>0){const e=document.createElement("div");!function(t,i,e,s,n){const r=s.get(33),o=s.get(116),h=s.get(93),c=s.get(51),l=s.get(50),a=s.get(66),u=new Uu(1e4);u.appendString('<div class="suggest-preview-text">');for(let t=0,s=e.length;t<s;t++){const s=e[t],d=s.content;u.appendString('<div class="view-line'),u.appendString('" style="top:'),u.appendString(String(t*a)),u.appendString('px;width:1000000px;">');const f=mr(d),g=gr(d),p=Cp.createEmpty(d,n);_p(new Fp(l.isMonospace&&!r,l.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,o,"none",h,c!==li.OFF,null),u),u.appendString("</div>")}u.appendString("</div>"),Ur(t,l);const d=u.build(),f=L5?L5.createHTML(d):d;t.innerHTML=f}(e,n,i,this.editor.getOptions(),this.languageIdCodec),this._viewZoneId=s.addZone({afterLineNumber:t,heightInLines:r,domNode:e,afterColumnAffinity:1})}}))}}const L5=bu("editorGhostText",{createHTML:t=>t});class F5{constructor(t){this.lines=t,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(t){return this.lines[t-1].getLineContent().length}}class T5{constructor(){this.value="",this.pos=0}static isDigitCharacter(t){return t>=48&&t<=57}static isVariableCharacter(t){return 95===t||t>=97&&t<=122||t>=65&&t<=90}text(t){this.value=t,this.pos=0}tokenText(t){return this.value.substr(t.pos,t.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const t=this.pos;let i,e=0,s=this.value.charCodeAt(t);if(i=T5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(T5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(T5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(T5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(T5.isVariableCharacter(s)||T5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}i=10;do{e+=1,s=this.value.charCodeAt(t+e)}while(!isNaN(s)&&void 0===T5._table[s]&&!T5.isDigitCharacter(s)&&!T5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}T5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class R5{constructor(){this._children=[]}appendChild(t){return t instanceof O5&&this._children[this._children.length-1]instanceof O5?this._children[this._children.length-1].value+=t.value:(t.parent=this,this._children.push(t)),this}replace(t,i){const{parent:e}=t,s=e.children.indexOf(t),n=e.children.slice(0);n.splice(s,1,...i),e._children=n,function t(i,e){for(const s of i)s.parent=e,t(s.children,s)}(i,e)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let t=this;for(;;){if(!t)return;if(t instanceof j5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class O5 extends R5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new O5(this.value)}}class _5 extends R5{}class I5 extends _5{static compareByIndex(t,i){return t.index===i.index?0:t.isFinalTabstop?1:i.isFinalTabstop||t.index<i.index?-1:t.index>i.index?1:0}constructor(t){super(),this.index=t}get isFinalTabstop(){return 0===this.index}get choice(){return 1===this._children.length&&this._children[0]instanceof P5?this._children[0]:void 0}clone(){const t=new I5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class P5 extends R5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof O5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new P5;return this.options.forEach(t.appendChild,t),t}}class N5 extends R5{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(t){const i=this;let e=!1,s=t.replace(this.regexp,(function(){return e=!0,i._replace(Array.prototype.slice.call(arguments,0,-2))}));return!e&&this._children.some((t=>t instanceof B5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof B5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new N5;return t.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),t._children=this.children.map((t=>t.clone())),t}}class B5 extends R5{constructor(t,i,e,s){super(),this.index=t,this.shorthandName=i,this.ifValue=e,this.elseValue=s}resolve(t){return"upcase"===this.shorthandName?t?t.toLocaleUpperCase():"":"downcase"===this.shorthandName?t?t.toLocaleLowerCase():"":"capitalize"===this.shorthandName?t?t[0].toLocaleUpperCase()+t.substr(1):"":"pascalcase"===this.shorthandName?t?this._toPascalCase(t):"":"camelcase"===this.shorthandName?t?this._toCamelCase(t):"":Boolean(t)&&"string"==typeof this.ifValue?this.ifValue:Boolean(t)||"string"!=typeof this.elseValue?t||"":this.elseValue}_toPascalCase(t){const i=t.match(/[a-z0-9]+/gi);return i?i.map((t=>t.charAt(0).toUpperCase()+t.substr(1))).join(""):t}_toCamelCase(t){const i=t.match(/[a-z0-9]+/gi);return i?i.map(((t,i)=>0===i?t.charAt(0).toLowerCase()+t.substr(1):t.charAt(0).toUpperCase()+t.substr(1))).join(""):t}clone(){return new B5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class $5 extends _5{constructor(t){super(),this.name=t}resolve(t){let i=t.resolve(this);return this.transform&&(i=this.transform.resolve(i||"")),void 0!==i&&(this._children=[new O5(i)],!0)}clone(){const t=new $5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function W5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class j5 extends R5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof I5&&(t.push(e),i=!i||i.index<e.index?e:i),!0})),this._placeholders={all:t,last:i}}return this._placeholders}get placeholders(){const{all:t}=this.placeholderInfo;return t}offset(t){let i=0,e=!1;return this.walk((s=>s===t?(e=!0,!1):(i+=s.len(),!0))),e?i:-1}fullLen(t){let i=0;return W5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof I5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof $5&&i.resolve(t)&&(this._placeholders=void 0),!0))),this}appendChild(t){return this._placeholders=void 0,super.appendChild(t)}replace(t,i){return this._placeholders=void 0,super.replace(t,i)}clone(){const t=new j5;return this._children=this.children.map((t=>t.clone())),t}walk(t){W5(this.children,t)}}class V5{constructor(){this._scanner=new T5,this._token={type:14,pos:0,len:0}}static escape(t){return t.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(t){return/\${?CLIPBOARD/.test(t)}parse(t,i,e){const s=new j5;return this.parseFragment(t,s),this.ensureFinalTabstop(s,null!=e&&e,null!=i&&i),s}parseFragment(t,i){const e=i.children.length;for(this._scanner.text(t),this._token=this._scanner.next();this._parse(i););const s=new Map,n=[];i.walk((t=>(t instanceof I5&&(t.isFinalTabstop?s.set(0,void 0):!s.has(t.index)&&t.children.length>0?s.set(t.index,t.children):n.push(t)),!0)));const r=(t,e)=>{const n=s.get(t.index);if(!n)return;const o=new I5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof I5&&s.has(i.index)&&!e.has(i.index)&&(e.add(i.index),r(i,e),e.delete(i.index))}i.replace(t,[o])},o=new Set;for(const t of n)r(t,o);return i.children.slice(e)}ensureFinalTabstop(t,i,e){if(i||e&&t.placeholders.length>0){const i=t.placeholders.find((t=>0===t.index));i||t.appendChild(new I5(0))}}_accept(t,i){if(void 0===t||this._token.type===t){const t=!i||this._scanner.tokenText(this._token);return this._token=this._scanner.next(),t}return!1}_backTo(t){return this._scanner.pos=t.pos+t.len,this._token=t,!1}_until(t){const i=this._token;for(;this._token.type!==t;){if(14===this._token.type)return!1;if(5===this._token.type){const t=this._scanner.next();if(0!==t.type&&4!==t.type&&5!==t.type)return!1}this._token=this._scanner.next()}const e=this._scanner.value.substring(i.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),e}_parse(t){return this._parseEscaped(t)||this._parseTabstopOrVariableName(t)||this._parseComplexPlaceholder(t)||this._parseComplexVariable(t)||this._parseAnything(t)}_parseEscaped(t){let i;return!!(i=this._accept(5,!0))&&(i=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||i,t.appendChild(new O5(i)),!0)}_parseTabstopOrVariableName(t){let i;const e=this._token;return this._accept(0)&&(i=this._accept(9,!0)||this._accept(8,!0))?(t.appendChild(/^\d+$/.test(i)?new I5(Number(i)):new $5(i)),!0):this._backTo(e)}_parseComplexPlaceholder(t){let i;const e=this._token;if(!(this._accept(0)&&this._accept(3)&&(i=this._accept(8,!0))))return this._backTo(e);const s=new I5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new O5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}else{if(!(s.index>0&&this._accept(7)))return this._accept(6)?this._parseTransform(s)?(t.appendChild(s),!0):(this._backTo(e),!1):this._accept(4)?(t.appendChild(s),!0):this._backTo(e);{const i=new P5;for(;;){if(this._parseChoiceElement(i)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(i),this._accept(4)))return t.appendChild(s),!0}return this._backTo(e),!1}}}}_parseChoiceElement(t){const i=this._token,e=[];for(;2!==this._token.type&&7!==this._token.type;){let t;if(t=(t=this._accept(5,!0))?this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||t:this._accept(void 0,!0),!t)return this._backTo(i),!1;e.push(t)}return 0===e.length?(this._backTo(i),!1):(t.appendChild(new O5(e.join(""))),!0)}_parseComplexVariable(t){let i;const e=this._token;if(!(this._accept(0)&&this._accept(3)&&(i=this._accept(9,!0))))return this._backTo(e);const s=new $5(i);if(!this._accept(1))return this._accept(6)?this._parseTransform(s)?(t.appendChild(s),!0):(this._backTo(e),!1):this._accept(4)?(t.appendChild(s),!0):this._backTo(e);for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new O5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new N5;let e="",s="";for(;!this._accept(6);){let t;if(t=this._accept(5,!0))t=this._accept(6,!0)||t,e+=t;else{if(14===this._token.type)return!1;e+=this._accept(void 0,!0)}}for(;!this._accept(6);){let t;if(t=this._accept(5,!0))t=this._accept(5,!0)||this._accept(6,!0)||t,i.appendChild(new O5(t));else if(!this._parseFormatString(i)&&!this._parseAnything(i))return!1}for(;!this._accept(4);){if(14===this._token.type)return!1;s+=this._accept(void 0,!0)}try{i.regexp=new RegExp(e,s)}catch(t){return!1}return t.transform=i,!0}_parseFormatString(t){const i=this._token;if(!this._accept(0))return!1;let e=!1;this._accept(3)&&(e=!0);const s=this._accept(8,!0);if(!s)return this._backTo(i),!1;if(!e)return t.appendChild(new B5(Number(s))),!0;if(this._accept(4))return t.appendChild(new B5(Number(s))),!0;if(!this._accept(1))return this._backTo(i),!1;if(this._accept(6)){const e=this._accept(9,!0);return e&&this._accept(4)?(t.appendChild(new B5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,void 0,i)),!0}else if(this._accept(13)){const i=this._until(1);if(i){const e=this._until(4);if(e)return t.appendChild(new B5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new B5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new O5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}async function H5(t,i,e,s,n=fe.None,r){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new bs(t.lineNumber,e.startColumn,t.lineNumber,s):bs.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=new Fg;for(const t of h)t.groupId&&c.add(t.groupId,t);function l(t){if(!t.yieldsToGroupIds)return[];const i=[];for(const e of t.yieldsToGroupIds||[]){const t=c.get(e);for(const e of t)i.push(e)}return i}const a=new Map,u=new Set;function d(t,i){if(i=[...i,t],u.has(t))return i;u.add(t);try{const e=l(t);for(const t of e){const e=d(t,i);if(e)return e}}finally{u.delete(t)}}function f(t){const r=a.get(t);if(r)return r;const o=d(t,[]);o&&Fi(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${o.map((t=>t.toString?t.toString():""+t)).join(" -> ")}`));const h=new ac;return a.set(t,h.p),(async()=>{if(!o){const i=l(t);for(const t of i){const i=await f(t);if(i&&i.items.length>0)return}}try{return await t.provideInlineCompletions(e,i,s,n)}catch(t){return void Fi(t)}})().then((t=>h.complete(t)),(t=>h.error(t))),h.p}const g=await Promise.all(h.map((async t=>({provider:t,completions:await f(t)})))),p=new Map,m=[];for(const t of g){const i=t.completions;if(!i)continue;const s=new U5(i,t.provider);m.push(s);for(const t of i.items){const i=K5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new z5(Array.from(p.values()),new Set(p.keys()),m)}class z5{constructor(t,i,e){this.completions=t,this.hashs=i,this.providerResults=e}has(t){return this.hashs.has(t.hash())}dispose(){for(const t of this.providerResults)t.removeRef()}}class U5{constructor(t,i){this.inlineCompletions=t,this.provider=i,this.refCount=1}addRef(){this.refCount++}removeRef(){this.refCount--,0===this.refCount&&this.provider.freeInlineCompletions(this.inlineCompletions)}}class K5{static from(t,i,e,s,n){let r,o,h=t.range?bs.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=q5(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new bs(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+i))}o=void 0}else if("snippet"in t.insertText){const i=t.insertText.snippet.length;if(n&&t.completeBracketPairs){t.insertText.snippet=q5(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new bs(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new V5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof O5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else fh();return new K5(r,t.command,h,r,o,t.additionalTextEdits||v5,t,i)}constructor(t,i,e,s,n,r,o,h){this.filterText=t,this.command=i,this.range=e,this.insertText=s,this.snippetInfo=n,this.additionalTextEdits=r,this.sourceInlineCompletion=o,this.source=h,s=(t=t.replace(/\r\n|\r/g,"\n")).replace(/\r\n|\r/g,"\n")}withRange(t){return new K5(this.filterText,this.command,t,this.insertText,this.snippetInfo,this.additionalTextEdits,this.sourceInlineCompletion,this.source)}hash(){return JSON.stringify({insertText:this.insertText,range:this.range.toString()})}}function q5(t,i,e,s){const n=e.getLineContent(i.lineNumber).substring(0,i.column-1)+t,r=e.tokenization.tokenizeLineWithEdit(i,n.length-(i.column-1),t),o=null==r?void 0:r.sliceAndInflate(i.column-1,n.length,0);if(!o)return t;const h=function(t,i){const e=new eE,s=new yE(e,(t=>i.getLanguageConfiguration(t))),n=AE(new mE(new F5([t]),s),[],void 0,!0);let r="";const o=t.getLineContent();return function t(i,e){if(2===i.kind)if(t(i.openingBracket,e),e=jD(e,i.openingBracket.length),i.child&&(t(i.child,e),e=jD(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=jD(e,i.closingBracket.length);else{const t=s.getSingleLanguageBracketTokens(i.openingBracket.languageId).findClosingTokenText(i.openingBracket.bracketIds);r+=t}else if(3===i.kind);else if(0===i.kind||1===i.kind)r+=o.substring(e,jD(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=jD(e,s.length)}(n,PD),r}(o,s);return h}class G5{constructor(t,i){this.range=t,this.text=i}removeCommonPrefix(t,i){const e=i?this.range.intersectRanges(i):this.range;if(!e)return this;const s=t.getValueInRange(e,1),n=sr(s,this.text),r=y5(this.range.getStartPosition(),k5(s.substring(0,n))),o=this.text.substring(n),h=bs.fromPositions(r,this.range.getEndPosition());return new G5(h,o)}augments(t){return this.text.startsWith(t.text)&&(i=this.range,(e=t.range).getStartPosition().equals(i.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(i.getEndPosition()));var i,e}computeGhostText(t,i,e,s=0){let n=this.removeCommonPrefix(t);if(n.range.endLineNumber!==n.range.startLineNumber)return;const r=t.getLineContent(n.range.startLineNumber),o=Kn(r).length;if(n.range.startColumn-1<=o){const t=Kn(n.text).length,i=r.substring(n.range.startColumn-1,o),[e,s]=[n.range.getStartPosition(),n.range.getEndPosition()],h=e.column+i.length<=s.column?e.delta(0,i.length):s,c=bs.fromPositions(h,s),l=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new G5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==Z5?void 0:Z5.originalValue)===t&&(null==Z5?void 0:Z5.newValue)===i)return null==Z5?void 0:Z5.changes;{let e=Q5(t,i,!0);if(e){const s=J5(e);if(s>0){const n=Q5(t,i,!1);n&&J5(n)<s&&(e=n)}}return Z5={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const l=n.range.startLineNumber,a=new Array;if("prefix"===i){const t=c.filter((t=>0===t.originalLength));if(t.length>1||1===t.length&&t[0].originalStart!==h.length)return}const u=n.text.length-s;for(const t of c){const s=n.range.startColumn+t.originalStart+t.originalLength;if("subwordSmart"===i&&e&&e.lineNumber===n.range.startLineNumber&&s<e.column)return;if(t.originalLength>0)return;if(0===t.modifiedLength)continue;const r=t.modifiedStart+t.modifiedLength,o=Math.max(t.modifiedStart,Math.min(r,u)),h=n.text.substring(t.modifiedStart,o),c=n.text.substring(o,Math.max(t.modifiedStart,r));if(h.length>0){const t=zn(h);a.push(new S5(s,t,!1))}if(c.length>0){const t=zn(c);a.push(new S5(s,t,!0))}}return new C5(l,a)}}let Z5;function J5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function Q5(t,i,e){if(t.length>5e3||i.length>5e3)return;function s(t){let i=0;for(let e=0,s=t.length;e<s;e++){const s=t.charCodeAt(e);s>i&&(i=s)}return i}const n=Math.max(s(t),s(i));function r(t){if(t<0)throw new Error("unexpected");return n+t+1}function o(t){let i=0,s=0;const n=new Int32Array(t.length);for(let o=0,h=t.length;o<h;o++)e&&"("===t[o]?(n[o]=r(2*(100*s+i)),i++):e&&")"===t[o]?(i=Math.max(i-1,0),n[o]=r(2*(100*s+i)+1),0===i&&s++):n[o]=t.charCodeAt(o);return n}const h=o(t),c=o(i);return new ef({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var Y5=function(t,i){return function(e,s){i(e,s,t)}};let X5=class extends Ki{constructor(t,i,e,s,n){super(),this.textModel=t,this.versionId=i,this._debounceValue=e,this.languageFeaturesService=s,this.languageConfigurationService=n,this._updateOperation=this._register(new qi),this.inlineCompletions=mz("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=mz("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new t3(t,i,this.textModel.getVersionId()),o=i.selectedSuggestionInfo?this.suggestWidgetInlineCompletions:this.inlineCompletions;if(null===(s=this._updateOperation.value)||void 0===s?void 0:s.request.satisfies(r))return this._updateOperation.value.promise;if(null===(n=o.get())||void 0===n?void 0:n.request.satisfies(r))return Promise.resolve(!0);const h=!!this._updateOperation.value;this._updateOperation.clear();const c=new pe,l=(async()=>{var s;if((h||i.triggerKind===Fs.Automatic)&&await(s=this._debounceValue.get(this.textModel),new Promise((t=>{let i;setTimeout((()=>{i&&i.dispose(),t()}),s)}))),c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const n=new Date,l=await H5(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const a=new Date;this._debounceValue.update(this.textModel,a.getTime()-n.getTime());const u=new e3(l,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!l.has(i)&&u.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),nz((t=>{o.set(u,t)})),!0})(),a=new i3(r,c,l);return this._updateOperation.value=a,l}clear(t){this._updateOperation.clear(),this.inlineCompletions.set(void 0,t),this.suggestWidgetInlineCompletions.set(void 0,t)}clearSuggestWidgetInlineCompletions(t){var i;(null===(i=this._updateOperation.value)||void 0===i?void 0:i.request.context.selectedSuggestionInfo)&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,t)}cancelUpdate(){this._updateOperation.clear()}};X5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Y5(3,op),Y5(4,Nd)],X5);class t3{constructor(t,i,e){this.position=t,this.context=i,this.versionId=e}satisfies(t){return this.position.equals(t.position)&&(e=t.context.selectedSuggestionInfo,(i=this.context.selectedSuggestionInfo)&&e?((t,i)=>t.equals(i))(i,e):i===e)&&(t.context.triggerKind===Fs.Automatic||this.context.triggerKind===Fs.Explicit)&&this.versionId===t.versionId;var i,e}}class i3{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class e3{get inlineCompletions(){return this._inlineCompletions}constructor(t,i,e,s){this.inlineCompletionProviderResult=t,this.request=i,this.textModel=e,this.versionId=s,this._refCount=1,this._prependedInlineCompletionItems=[],this._rangeVersionIdValue=0,this._rangeVersionId=bz(this,(t=>{this.versionId.read(t);let i=!1;for(const t of this._inlineCompletions)i=i||t._updateRange(this.textModel);return i&&this._rangeVersionIdValue++,this._rangeVersionIdValue}));const n=e.deltaDecorations([],t.completions.map((t=>({range:t.range,options:{description:"inline-completion-tracking-range"}}))));this._inlineCompletions=t.completions.map(((t,i)=>new s3(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){setTimeout((()=>{this.textModel.isDisposed()||this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[])}),0),this.inlineCompletionProviderResult.dispose();for(const t of this._prependedInlineCompletionItems)t.source.removeRef()}}prepend(t,i,e){e&&t.source.addRef();const s=this.textModel.deltaDecorations([],[{range:i,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new s3(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class s3{get forwardStable(){var t;return null!==(t=this.inlineCompletion.source.inlineCompletions.enableForwardStability)&&void 0!==t&&t}constructor(t,i,e,s){this.inlineCompletion=t,this.decorationId=i,this.rangeVersion=e,this.semanticId=JSON.stringify([this.inlineCompletion.filterText,this.inlineCompletion.insertText,this.inlineCompletion.range.getStartPosition().toString()]),this._isValid=!0,this._updatedRange=null!=s?s:t.range}toInlineCompletion(t){return this.inlineCompletion.withRange(this._getUpdatedRange(t))}toSingleTextEdit(t){return new G5(this._getUpdatedRange(t),this.inlineCompletion.insertText)}isVisible(t,i,e){const s=this._toFilterTextReplacement(e).removeCommonPrefix(t);if(!this._isValid||!this.inlineCompletion.range.getStartPosition().equals(this._getUpdatedRange(e).getStartPosition())||i.lineNumber!==s.range.startLineNumber)return!1;const n=t.getValueInRange(s.range,1),r=s.text,o=Math.max(0,i.column-s.range.startColumn);let h=r.substring(0,o),c=r.substring(o),l=n.substring(0,o),a=n.substring(o);const u=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=u&&(l=l.trimStart(),0===l.length&&(a=a.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(l)&&!!S_(a,c)}canBeReused(t,i){return this._isValid&&this._getUpdatedRange(void 0).containsPosition(i)&&this.isVisible(t,i,void 0)&&!this._isSmallerThanOriginal(void 0)}_toFilterTextReplacement(t){return new G5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return n3(this._getUpdatedRange(t)).isBefore(n3(this.inlineCompletion.range))}_getUpdatedRange(t){return this.rangeVersion.read(t),this._updatedRange}_updateRange(t){const i=t.getDecorationRange(this.decorationId);return i?!this._updatedRange.equalsRange(i)&&(this._updatedRange=i,!0):(this._isValid=!1,!0)}}function n3(t){return t.startLineNumber===t.endLineNumber?new vs(1,1+t.endColumn-t.startColumn):new vs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}const r3={Visible:D2,HasFocusedSuggestion:new Xo("suggestWidgetHasFocusedSuggestion",!1,Q(0,"Whether any suggestion is focused")),DetailsVisible:new Xo("suggestWidgetDetailsVisible",!1,Q(0,"Whether suggestion details are visible")),MultipleSuggestions:new Xo("suggestWidgetMultipleSuggestions",!1,Q(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Xo("suggestionMakesTextEdit",!0,Q(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Xo("acceptSuggestionOnEnter",!0,Q(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Xo("suggestionHasInsertAndReplaceRange",!1,Q(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Xo("suggestionInsertMode",void 0,{type:"string",description:Q(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Xo("suggestionCanResolve",!1,Q(0,"Whether the current suggestion supports to resolve further details"))},o3=new Sh("suggestWidgetStatusBar");class h3{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=rI.Default,this.distance=0,this.textLabel="string"==typeof i.label?i.label:null===(n=i.label)||void 0===n?void 0:n.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=i.sortText&&i.sortText.toLowerCase(),this.filterTextLow=i.filterText&&i.filterText.toLowerCase(),this.extensionId=i.extensionId,bs.isIRange(i.range)?(this.editStart=new vs(i.range.startLineNumber,i.range.startColumn),this.editInsertEnd=new vs(i.range.endLineNumber,i.range.endColumn),this.editReplaceEnd=new vs(i.range.endLineNumber,i.range.endColumn),this.isInvalid=this.isInvalid||bs.spansMultipleLines(i.range)||i.range.startLineNumber!==t.lineNumber):(this.editStart=new vs(i.range.insert.startLineNumber,i.range.insert.startColumn),this.editInsertEnd=new vs(i.range.insert.endLineNumber,i.range.insert.endColumn),this.editReplaceEnd=new vs(i.range.replace.endLineNumber,i.range.replace.endColumn),this.isInvalid=this.isInvalid||bs.spansMultipleLines(i.range.insert)||bs.spansMultipleLines(i.range.replace)||i.range.insert.startLineNumber!==t.lineNumber||i.range.replace.startLineNumber!==t.lineNumber||i.range.insert.startColumn!==i.range.replace.startColumn),"function"!=typeof s.resolveCompletionItem&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return void 0!==this._resolveDuration}get resolveDuration(){return void 0!==this._resolveDuration?this._resolveDuration:-1}async resolve(t){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._resolveDuration=void 0})),e=new Yi(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._resolveDuration=e.elapsed()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._resolveDuration=void 0)})).finally((()=>{i.dispose()}))}return this._resolveCache}}class c3{constructor(t=2,i=new Set,e=new Set,s=new Map,n=!0){this.snippetSortOrder=t,this.kindFilter=i,this.providerFilter=e,this.providerItemsToReuse=s,this.showDeprecated=n}}c3.default=new c3;class l3{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}async function a3(t,i,e,s=c3.default,n={triggerKind:0},r=fe.None){const o=new Yi;e=e.clone();const h=i.getWordAtPosition(e),c=h?new bs(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):bs.fromPositions(e),l={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},a=[],u=new Ui,d=[];let f=!1;const g=(t,i,n)=>{var r,o,h;let c=!1;if(!i)return c;for(const n of i.suggestions)if(!s.kindFilter.has(n.kind)){if(!s.showDeprecated&&(null===(r=null==n?void 0:n.tags)||void 0===r?void 0:r.includes(1)))continue;n.range||(n.range=l),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=V5.guessNeedsClipboard(n.insertText)),a.push(new h3(e,n,i,t)),c=!0}return ji(i)&&u.add(i),d.push({providerName:null!==(o=t._debugDisplayName)&&void 0!==o?o:"unknown_provider",elapsedProvider:null!==(h=i.duration)&&void 0!==h?h:-1,elapsedOverall:n.elapsed()}),c},p=(async()=>{})();for(const o of t.orderedGroups(i)){let t=!1;if(await Promise.all(o.map((async o=>{if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>a.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Yi,h=await o.provideCompletionItems(i,e,n,r);t=g(o,h,s)||t}catch(t){Fi(t)}}))),t||r.isCancellationRequested)break}return await p,r.isCancellationRequested?(u.dispose(),Promise.reject(new _i)):new l3(a.sort(d3.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},u)}function u3(t,i){if(t.sortTextLow&&i.sortTextLow){if(t.sortTextLow<i.sortTextLow)return-1;if(t.sortTextLow>i.sortTextLow)return 1}return t.textLabel<i.textLabel?-1:t.textLabel>i.textLabel?1:t.completion.kind-i.completion.kind}const d3=new Map;d3.set(0,(function(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return-1;if(27===i.completion.kind)return 1}return u3(t,i)})),d3.set(2,(function(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return u3(t,i)})),d3.set(1,u3),mo.registerCommand("_executeCompletionItemProvider",(async(t,...i)=>{const[e,s,n,r]=i;B(hs.isUri(e)),B(vs.isIPosition(s)),B("string"==typeof n||!n),B("number"==typeof r||!r);const{completionProvider:o}=t.get(op),h=await t.get(ro).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=await a3(o,h.object.textEditorModel,e,void 0,{triggerCharacter:null!=n?n:void 0,triggerKind:n?1:0});for(const e of c.items)i.length<(null!=r?r:0)&&i.push(e.resolve(fe.None)),t.incomplete=t.incomplete||e.container.incomplete,t.suggestions.push(e.completion);try{return await Promise.all(i),t}finally{setTimeout((()=>c.disposable.dispose()),100)}}finally{h.dispose()}}));class f3{static isAllOff(t){return"off"===t.other&&"off"===t.comments&&"off"===t.strings}static isAllOn(t){return"on"===t.other&&"on"===t.comments&&"on"===t.strings}static valueFor(t,i){switch(i){case 1:return t.comments;case 2:return t.strings;default:return t.other}}}function g3(t,i=gt){return function(t,i=gt){return!!i&&QE(t.charCodeAt(0))&&58===t.charCodeAt(1)}(t,i)?t.charAt(0).toUpperCase()+t.slice(1):t}Object.freeze({CURRENT_YEAR:!0,CURRENT_YEAR_SHORT:!0,CURRENT_MONTH:!0,CURRENT_DATE:!0,CURRENT_HOUR:!0,CURRENT_MINUTE:!0,CURRENT_SECOND:!0,CURRENT_DAY_NAME:!0,CURRENT_DAY_NAME_SHORT:!0,CURRENT_MONTH_NAME:!0,CURRENT_MONTH_NAME_SHORT:!0,CURRENT_SECONDS_UNIX:!0,CURRENT_TIMEZONE_OFFSET:!0,SELECTION:!0,CLIPBOARD:!0,TM_SELECTED_TEXT:!0,TM_CURRENT_LINE:!0,TM_CURRENT_WORD:!0,TM_LINE_INDEX:!0,TM_LINE_NUMBER:!0,TM_FILENAME:!0,TM_FILENAME_BASE:!0,TM_DIRECTORY:!0,TM_FILEPATH:!0,CURSOR_INDEX:!0,CURSOR_NUMBER:!0,RELATIVE_FILEPATH:!0,BLOCK_COMMENT_START:!0,BLOCK_COMMENT_END:!0,LINE_COMMENT:!0,WORKSPACE_NAME:!0,WORKSPACE_FOLDER:!0,RANDOM:!0,RANDOM_HEX:!0,UUID:!0});class p3{constructor(t){this._delegates=t}resolve(t){for(const i of this._delegates){const e=i.resolve(t);if(void 0!==e)return e}}}class m3{constructor(t,i,e,s){this._model=t,this._selection=i,this._selectionIdx=e,this._overtypingCapturer=s}resolve(t){const{name:i}=t;if("SELECTION"===i||"TM_SELECTED_TEXT"===i){let i=this._model.getValueInRange(this._selection)||void 0,e=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const t=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);t&&(i=t.value,e=t.multiline)}if(i&&e&&t.snippet){const e=Kn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof O5&&(s=Kn(zn(i.value).pop())),!0)));const n=sr(s,e);i=i.replace(/(\r\n|\r|\n)(.*)/g,((t,i,e)=>`${i}${s.substr(n)}${e}`))}return i}if("TM_CURRENT_LINE"===i)return this._model.getLineContent(this._selection.positionLineNumber);if("TM_CURRENT_WORD"===i){const t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}return"TM_LINE_INDEX"===i?String(this._selection.positionLineNumber-1):"TM_LINE_NUMBER"===i?String(this._selection.positionLineNumber):"CURSOR_INDEX"===i?String(this._selectionIdx):"CURSOR_NUMBER"===i?String(this._selectionIdx+1):void 0}}class w3{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Ye(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Ye(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===Qe(this._model.uri.fsPath)?"":this._labelService.getUriLabel(nA(this._model.uri)):"TM_FILEPATH"===i?this._labelService.getUriLabel(this._model.uri):"RELATIVE_FILEPATH"===i?this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0}):void 0}}class v3{constructor(t,i,e,s){this._readClipboardText=t,this._selectionIdx=i,this._selectionCount=e,this._spread=s}resolve(t){if("CLIPBOARD"!==t.name)return;const i=this._readClipboardText();if(i){if(this._spread){const t=i.split(/\r\n|\n|\r/).filter((t=>!In(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let b3=class{constructor(t,i,e){this._model=t,this._selection=i,this._languageConfigurationService=e}resolve(t){const{name:i}=t,e=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),s=this._languageConfigurationService.getLanguageConfiguration(e).comments;if(s)return"LINE_COMMENT"===i?s.lineCommentToken||void 0:"BLOCK_COMMENT_START"===i?s.blockCommentStartToken||void 0:"BLOCK_COMMENT_END"===i&&s.blockCommentEndToken||void 0}};b3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,Nd)],b3);class y3{constructor(){this._date=new Date}resolve(t){const{name:i}=t;if("CURRENT_YEAR"===i)return String(this._date.getFullYear());if("CURRENT_YEAR_SHORT"===i)return String(this._date.getFullYear()).slice(-2);if("CURRENT_MONTH"===i)return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if("CURRENT_DATE"===i)return String(this._date.getDate().valueOf()).padStart(2,"0");if("CURRENT_HOUR"===i)return String(this._date.getHours().valueOf()).padStart(2,"0");if("CURRENT_MINUTE"===i)return String(this._date.getMinutes().valueOf()).padStart(2,"0");if("CURRENT_SECOND"===i)return String(this._date.getSeconds().valueOf()).padStart(2,"0");if("CURRENT_DAY_NAME"===i)return y3.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return y3.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return y3.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return y3.monthNamesShort[this._date.getMonth()];if("CURRENT_SECONDS_UNIX"===i)return String(Math.floor(this._date.getTime()/1e3));if("CURRENT_TIMEZONE_OFFSET"===i){const t=this._date.getTimezoneOffset(),i=t>0?"-":"+",e=Math.trunc(Math.abs(t/60)),s=e<10?"0"+e:e,n=Math.abs(t)-60*e;return i+s+":"+(n<10?"0"+n:n)}}}y3.dayNames=[Q(0,"Sunday"),Q(0,"Monday"),Q(0,"Tuesday"),Q(0,"Wednesday"),Q(0,"Thursday"),Q(0,"Friday"),Q(0,"Saturday")],y3.dayNamesShort=[Q(0,"Sun"),Q(0,"Mon"),Q(0,"Tue"),Q(0,"Wed"),Q(0,"Thu"),Q(0,"Fri"),Q(0,"Sat")],y3.monthNames=[Q(0,"January"),Q(0,"February"),Q(0,"March"),Q(0,"April"),Q(0,"May"),Q(0,"June"),Q(0,"July"),Q(0,"August"),Q(0,"September"),Q(0,"October"),Q(0,"November"),Q(0,"December")],y3.monthNamesShort=[Q(0,"Jan"),Q(0,"Feb"),Q(0,"Mar"),Q(0,"Apr"),Q(0,"May"),Q(0,"Jun"),Q(0,"Jul"),Q(0,"Aug"),Q(0,"Sep"),Q(0,"Oct"),Q(0,"Nov"),Q(0,"Dec")];class k3{constructor(t){this._workspaceService=t}resolve(t){if(!this._workspaceService)return;const i="string"==typeof(e=this._workspaceService.getWorkspace())||void 0===e?"string"==typeof e?{id:Ye(e)}:_O:e.configuration?{id:e.id,configPath:e.configuration}:1===e.folders.length?{id:e.id,uri:e.folders[0].uri}:{id:e.id};var e,s;return"string"!=typeof(null==(s=i)?void 0:s.id)||OO(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&hs.isUri(t.configPath)}(s)?"WORKSPACE_NAME"===t.name?this._resolveWorkspaceName(i):"WORKSPACE_FOLDER"===t.name?this._resoveWorkspacePath(i):void 0:void 0}_resolveWorkspaceName(t){if(OO(t))return Ye(t.uri.path);let i=Ye(t.configPath.path);return i.endsWith("code-workspace")&&(i=i.substr(0,i.length-14-1)),i}_resoveWorkspacePath(t){if(OO(t))return g3(t.uri.fsPath);const i=Ye(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?g3(e):"/"}}class C3{resolve(t){const{name:i}=t;return"RANDOM"===i?Math.random().toString().slice(-6):"RANDOM_HEX"===i?Math.random().toString(16).slice(-6):"UUID"===i?G0():void 0}}var S3;class x3{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,I5.compareByIndex),this._placeholderGroupsIdx=-1}initialize(t){this._offset=t.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(-1===this._offset)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const t=this._editor.getModel();this._editor.changeDecorations((i=>{for(const e of this._snippet.placeholders){const s=this._snippet.offset(e),n=this._snippet.fullLen(e),r=bs.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?x3._decor.inactiveFinal:x3._decor.inactive);this._placeholderDecorations.set(e,o)}}))}move(t){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const t=[];for(const i of this._placeholderGroups[this._placeholderGroupsIdx])if(i.transform){const e=this._placeholderDecorations.get(i),s=this._editor.getModel().getDecorationRange(e),n=this._editor.getModel().getValueInRange(s),r=i.transform.resolve(n).split(/\r\n|\r|\n/);for(let t=1;t<r.length;t++)r[t]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+r[t]);t.push(QR.replace(s,r.join(this._editor.getModel().getEOL())))}t.length>0&&this._editor.executeEdits("snippet.placeholderTransform",t)}let i=!1;!0===t&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,i=!0):!1===t&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,i=!0);const e=this._editor.getModel().changeDecorations((t=>{const e=new Set,s=[];for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const r=this._placeholderDecorations.get(n),o=this._editor.getModel().getDecorationRange(r);s.push(new ys(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?x3._decor.activeFinal:x3._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?x3._decor.activeFinal:x3._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?x3._decor.inactiveFinal:x3._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof I5){const t=this._placeholderDecorations.get(i);if(this._editor.getModel().getDecorationRange(t).isEmpty()&&i.toString().length>0)return!0}i=i.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||0===this._placeholderGroups.length}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(0===this._snippet.placeholders.length)return!0;if(1===this._snippet.placeholders.length){const[t]=this._snippet.placeholders;if(t.isFinalTabstop&&this._snippet.rightMostDescendant===t)return!0}return!1}computePossibleSelections(){const t=new Map;for(const i of this._placeholderGroups){let e;for(const s of i){if(s.isFinalTabstop)break;e||(e=[],t.set(s.index,e));const i=this._placeholderDecorations.get(s),n=this._editor.getModel().getDecorationRange(i);if(!n){t.delete(s.index);break}e.push(n)}}return t}get activeChoice(){if(!this._placeholderDecorations)return;const t=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!(null==t?void 0:t.choice))return;const i=this._placeholderDecorations.get(t);if(!i)return;const e=this._editor.getModel().getDecorationRange(i);return e?{range:e,choice:t.choice}:void 0}get hasChoice(){let t=!1;return this._snippet.walk((i=>(t=i instanceof P5,!t))),t}merge(t){const i=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations((e=>{for(const s of this._placeholderGroups[this._placeholderGroupsIdx]){const n=t.shift();console.assert(-1!==n._offset),console.assert(!n._placeholderDecorations);const r=n._snippet.placeholderInfo.last.index;for(const t of n._snippet.placeholderInfo.all)t.index=t.isFinalTabstop?s.index+(r+1)/this._nestingLevel:s.index+t.index/this._nestingLevel;this._snippet.replace(s,n._snippet.children);const o=this._placeholderDecorations.get(s);e.removeDecoration(o),this._placeholderDecorations.delete(s);for(const t of n._snippet.placeholders){const s=n._snippet.offset(t),r=n._snippet.fullLen(t),o=bs.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,x3._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,I5.compareByIndex)}))}}x3._decor={active:aL.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:aL.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:aL.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:aL.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const D3={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let E3=S3=class{static adjustWhitespace(t,i,e,s,n){const r=Kn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof O5)||i.parent instanceof P5)return!0;if(n&&!n.has(i))return!0;const h=i.value.split(/\r\n|\r|\n/);if(e){const e=s.offset(i);if(0===e)h[0]=t.normalizeIndentation(h[0]);else{o=null!=o?o:s.toString();const i=o.charCodeAt(e-1);10!==i&&13!==i||(h[0]=t.normalizeIndentation(r+h[0]))}for(let i=1;i<h.length;i++)h[i]=t.normalizeIndentation(r+h[i])}const c=h.join(t.getEOL());return c!==i.value&&(i.parent.replace(i,[new O5(c)]),o=void 0),!0})),r}static adjustSelection(t,i,e,s){if(0!==e||0!==s){const{positionLineNumber:n,positionColumn:r}=i,o=t.validateRange({startLineNumber:n,startColumn:r-e,endLineNumber:n,endColumn:r+s});i=ys.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(t,i,e,s,n,r,o,h,c){const l=[],a=[];if(!t.hasModel())return{edits:l,snippets:a};const u=t.getModel(),d=t.invokeWithinContext((t=>t.get(RO))),f=t.invokeWithinContext((t=>new w3(t.get(CO),u))),g=()=>o,p=u.getValueInRange(S3.adjustSelection(u,t.getSelection(),e,0)),m=u.getValueInRange(S3.adjustSelection(u,t.getSelection(),0,s)),w=u.getLineFirstNonWhitespaceColumn(t.getSelection().positionLineNumber),v=t.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:o,idx:b}of v){let y=S3.adjustSelection(u,o,e,0),k=S3.adjustSelection(u,o,0,s);p!==u.getValueInRange(y)&&(y=o),m!==u.getValueInRange(k)&&(k=o);const C=o.setStartPosition(y.startLineNumber,y.startColumn).setEndPosition(k.endLineNumber,k.endColumn),S=(new V5).parse(i,!0,n),x=C.getStartPosition(),D=S3.adjustWhitespace(u,x,r||b>0&&w!==u.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new p3([f,new v3(g,b,v.length,"spread"===t.getOption(78)),new m3(u,o,b,h),new b3(u,o,c),new y3,new k3(d),new C3])),l[b]=QR.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,a[b]=new x3(t,S,D)}return{edits:l,snippets:a}}static createEditsAndSnippetsFromEdits(t,i,e,s,n,r,o){if(!t.hasModel()||0===i.length)return{edits:[],snippets:[]};const h=[],c=t.getModel(),l=new V5,a=new j5,u=new p3([t.invokeWithinContext((t=>new w3(t.get(CO),c))),new v3((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new m3(c,t.getSelection(),0,r),new b3(c,t.getSelection(),o),new y3,new k3(t.invokeWithinContext((t=>t.get(RO)))),new C3]);i=i.sort(((t,i)=>bs.compareRangesUsingStarts(t.range,i.range)));let d=0;for(let t=0;t<i.length;t++){const{range:e,template:s}=i[t];if(t>0){const s=bs.fromPositions(i[t-1].range.getEndPosition(),e.getStartPosition()),n=new O5(c.getValueInRange(s));a.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,a);S3.adjustWhitespace(c,e.getStartPosition(),!0,a,new Set(n)),a.resolveVariables(u);const r=a.toString(),o=r.slice(d);d=r.length;const f=QR.replace(e,o);f.identifier={major:t,minor:0},f._isTracked=!0,h.push(f)}return l.ensureFinalTabstop(a,e,!0),{edits:h,snippets:[new x3(t,a,"")]}}constructor(t,i,e=D3,s){this._editor=t,this._template=i,this._options=e,this._languageConfigurationService=s,this._templateMerges=[],this._snippets=[]}dispose(){Vi(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:t,snippets:i}="string"==typeof this._template?S3.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):S3.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits("snippet",t,(t=>{const e=t.filter((t=>!!t.identifier));for(let t=0;t<i.length;t++)i[t].initialize(e[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):e.map((t=>ys.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(t,i=D3){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=S3.createEditsAndSnippetsFromSelections(this._editor,t,i.overwriteBefore,i.overwriteAfter,!0,i.adjustWhitespace,i.clipboardText,i.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",e,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<s.length;t++)s[t].initialize(i[t].textChange);const e=s[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(s);console.assert(0===s.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>ys.fromPositions(t.range.getEndPosition())))}))}next(){const t=this._move(!0);this._editor.setSelections(t),this._editor.revealPositionInCenterIfOutsideViewport(t[0].getPosition())}prev(){const t=this._move(!1);this._editor.setSelections(t),this._editor.revealPositionInCenterIfOutsideViewport(t[0].getPosition())}_move(t){const i=[];for(const e of this._snippets){const s=e.move(t);i.push(...s)}return i}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const t=this._editor.getSelections();if(t.length<this._snippets.length)return!1;const i=new Map;for(const e of this._snippets){const s=e.computePossibleSelections();if(0===i.size)for(const[e,n]of s){n.sort(bs.compareRangesUsingStarts);for(const s of t)if(n[0].containsRange(s)){i.set(e,[]);break}}if(0===i.size)return!1;i.forEach(((t,i)=>{t.push(...s.get(i))}))}t.sort(bs.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(bs.compareRangesUsingStarts);for(let n=0;n<s.length;n++)s[n].containsRange(t[n])||i.delete(e)}else i.delete(e);return i.size>0}};E3=S3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,Nd)],E3);var A3,M3=function(t,i){return function(e,s){i(e,s,t)}};const L3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let F3=A3=class{static get(t){return t.getContribution(A3.ID)}constructor(t,i,e,s,n){this._editor=t,this._logService=i,this._languageFeaturesService=e,this._languageConfigurationService=n,this._snippetListener=new Ui,this._modelVersionId=-1,this._inSnippet=A3.InSnippetMode.bindTo(s),this._hasNextTabstop=A3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=A3.HasPrevTabstop.bindTo(s)}dispose(){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),null===(t=this._session)||void 0===t||t.dispose(),this._snippetListener.dispose()}insert(t,i){try{this._doInsert(t,void 0===i?L3:{...L3,...i})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",t),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(t,i){var e;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(B("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new E3(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(e=this._session)||void 0===e?void 0:e.hasChoice){const t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!vs.equals(this._editor.getPosition(),i))return;const{activeChoice:e}=this._session;if(!e||0===e.choice.options.length)return;const s=t.getValueInRange(e.range),n=Boolean(e.choice.options.find((t=>t.value===s))),r=[];for(let t=0;t<e.choice.options.length;t++){const i=e.choice.options[t];r.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:e.range,filterText:n?`${s}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:Q(0,"Go to next placeholder...")}})}return{suggestions:r}}},i=this._editor.getModel();let e,s=!1;this._choiceCompletions={provider:t,enable:()=>{s||(e=this._languageFeaturesService.completionProvider.register({language:i.getLanguageId(),pattern:i.uri.fsPath,scheme:i.uri.scheme,exclusive:!0},t),this._snippetListener.add(e),s=!0)},disable:()=>{null==e||e.dispose(),s=!1}}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((t=>t.isFlush&&this.cancel()))),this._snippetListener.add(this._editor.onDidChangeModel((()=>this.cancel()))),this._snippetListener.add(this._editor.onDidChangeCursorSelection((()=>this._updateState())))}}_updateState(){if(this._session&&this._editor.hasModel()){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:i}=this._session;if(!i||!this._choiceCompletions)return null===(t=this._choiceCompletions)||void 0===t||t.disable(),void(this._currentChoice=void 0);this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask((()=>{!function(t,i){var e;null===(e=t.getContribution("editor.contrib.suggestController"))||void 0===e||e.triggerSuggest((new Set).add(i),void 0,!0)}(this._editor,this._choiceCompletions.provider)})))}finish(){for(;this._inSnippet.get();)this.next()}cancel(t=!1){var i;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,null===(i=this._session)||void 0===i||i.dispose(),this._session=void 0,this._modelVersionId=-1,t&&this._editor.setSelections([this._editor.getSelection()])}prev(){var t;null===(t=this._session)||void 0===t||t.prev(),this._updateState()}next(){var t;null===(t=this._session)||void 0===t||t.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}};F3.ID="snippetController2",F3.InSnippetMode=new Xo("inSnippetMode",!1,Q(0,"Whether the editor in current in snippet mode")),F3.HasNextTabstop=new Xo("hasNextTabstop",!1,Q(0,"Whether there is a next tab stop when in snippet mode")),F3.HasPrevTabstop=new Xo("hasPrevTabstop",!1,Q(0,"Whether there is a previous tab stop when in snippet mode")),F3=A3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M3(1,Rh),M3(2,op),M3(3,th),M3(4,Nd)],F3),iu(F3.ID,F3,4);const T3=qa.bindToContribution(F3.get);Ya(new T3({id:"jumpToNextSnippetPlaceholder",precondition:Oo.and(F3.InSnippetMode,F3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:2}})),Ya(new T3({id:"jumpToPrevSnippetPlaceholder",precondition:Oo.and(F3.InSnippetMode,F3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:1026}})),Ya(new T3({id:"leaveSnippet",precondition:F3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:PS.editorTextFocus,primary:9,secondary:[1033]}})),Ya(new T3({id:"acceptSnippet",precondition:F3.InSnippetMode,handler:t=>t.finish()}));var R3,O3=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(R3||(R3={}));let _3=class extends Ki{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(t,i,e,s,n,r,o,h,c,l,a,u){let d;super(),this.textModel=t,this.selectedSuggestItem=i,this.cursorPosition=e,this.textModelVersionId=s,this._debounceValue=n,this._suggestPreviewEnabled=r,this._suggestPreviewMode=o,this._inlineSuggestMode=h,this._enabled=c,this._instantiationService=l,this._commandService=a,this._languageConfigurationService=u,this._source=this._register(this._instantiationService.createInstance(X5,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=gz(this,!1),this._forceUpdateSignal=Iz("forceUpdate"),this._selectedInlineCompletionId=gz(this,void 0),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([R3.Redo,R3.Undo,R3.AcceptWord]),this._fetchInlineCompletions=function(t,i){var e;return new Sz(t.owner,t.debugName,i,t.createEmptyChangeSummary,t.handleChange,void 0,null!==(e=t.equalityComparer)&&void 0!==e?e:vz)}({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Fs.Automatic}),handleChange:(t,i)=>(t.didChange(this.textModelVersionId)&&this._preserveCurrentCompletionReasons.has(t.change)?i.preserveCurrentCompletion=!0:t.didChange(this._forceUpdateSignal)&&(i.inlineCompletionTriggerKind=t.change),!0)},((t,i)=>{if(this._forceUpdateSignal.read(t),!(this._enabled.read(t)&&this.selectedSuggestItem.read(t)||this._isActive.read(t)))return void this._source.cancelUpdate();this.textModelVersionId.read(t);const e=this.selectedInlineCompletion.get(),s=i.preserveCurrentCompletion||(null==e?void 0:e.forwardStable)?e:void 0,n=this._source.suggestWidgetInlineCompletions.get(),r=this.selectedSuggestItem.read(t);if(n&&!r){const t=this._source.inlineCompletions.get();nz((i=>{(!t||n.request.versionId>t.request.versionId)&&this._source.inlineCompletions.set(n.clone(),i),this._source.clearSuggestWidgetInlineCompletions(i)}))}const o=this.cursorPosition.read(t),h={triggerKind:i.inlineCompletionTriggerKind,selectedSuggestionInfo:null==r?void 0:r.toSelectedSuggestionInfo()};return this._source.fetch(o,h,s)})),this._filteredInlineCompletionItems=bz(this,(t=>{const i=this._source.inlineCompletions.read(t);if(!i)return[];const e=this.cursorPosition.read(t),s=i.inlineCompletions.filter((i=>i.isVisible(this.textModel,e,t)));return s})),this.selectedInlineCompletionIndex=bz(this,(t=>{const i=this._selectedInlineCompletionId.read(t),e=this._filteredInlineCompletionItems.read(t),s=void 0===this._selectedInlineCompletionId?-1:e.findIndex((t=>t.semanticId===i));return-1===s?(this._selectedInlineCompletionId.set(void 0,void 0),0):s})),this.selectedInlineCompletion=bz(this,(t=>this._filteredInlineCompletionItems.read(t)[this.selectedInlineCompletionIndex.read(t)])),this.lastTriggerKind=this._source.inlineCompletions.map(this,(t=>null==t?void 0:t.request.context.triggerKind)),this.inlineCompletionsCount=bz(this,(t=>this.lastTriggerKind.read(t)===Fs.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=yz({owner:this,equalityComparer:(t,i)=>t&&i?D5(t.ghostText,i.ghostText)&&t.inlineCompletion===i.inlineCompletion&&t.suggestItem===i.suggestItem:t===i},(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=s.toSingleTextEdit().removeCommonPrefix(e),r=this._computeAugmentedCompletion(n,t);if(!this._suggestPreviewEnabled.read(t)&&!r)return;const o=null!==(i=null==r?void 0:r.edit)&&void 0!==i?i:n,h=r?r.edit.text.length-n.text.length:0,c=this._suggestPreviewMode.read(t),l=this.cursorPosition.read(t),a=o.computeGhostText(e,c,l,h);return{ghostText:null!=a?a:new C5(o.range.endLineNumber,[]),inlineCompletion:null==r?void 0:r.completion,suggestItem:s}}{if(!this._isActive.read(t))return;const i=this.selectedInlineCompletion.read(t);if(!i)return;const s=i.toSingleTextEdit(t),n=this._inlineSuggestMode.read(t),r=this.cursorPosition.read(t),o=s.computeGhostText(e,n,r);return o?{ghostText:o,inlineCompletion:i,suggestItem:void 0}:void 0}})),this.ghostText=yz({owner:this,equalityComparer:D5},(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(Nz(this._fetchInlineCompletions)),this._register(xz((t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.inlineCompletion;if((null==n?void 0:n.semanticId)!==(null==d?void 0:d.semanticId)&&(d=n,n)){const t=n.inlineCompletion,s=t.source;null===(e=(i=s.provider).handleItemDidShow)||void 0===e||e.call(i,s.inlineCompletions,t.sourceInlineCompletion,t.insertText)}})))}async trigger(t){this._isActive.set(!0,t),await this._fetchInlineCompletions.get()}async triggerExplicitly(t){oz(t,(t=>{this._isActive.set(!0,t),this._forceUpdateSignal.trigger(t,Fs.Explicit)})),await this._fetchInlineCompletions.get()}stop(t){oz(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_computeAugmentedCompletion(t,i){const e=this.textModel,s=this._source.suggestWidgetInlineCompletions.read(i);return function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(s?s.inlineCompletions:[this.selectedInlineCompletion.read(i)].filter(P),(s=>{let n=s.toSingleTextEdit(i);return n=n.removeCommonPrefix(e,bs.fromPositions(n.range.getStartPosition(),t.range.getEndPosition())),n.augments(t)?{edit:n,completion:s}:void 0}))}async _deltaSelectedInlineCompletionIndex(t){await this.triggerExplicitly();const i=this._filteredInlineCompletionItems.get()||[];if(i.length>0){const e=(this.selectedInlineCompletionIndex.get()+t+i.length)%i.length;this._selectedInlineCompletionId.set(i[e].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}async accept(t){var i;if(t.getModel()!==this.textModel)throw new $i;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.inlineCompletion.toInlineCompletion(void 0);t.pushUndoStop(),s.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[QR.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=F3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[QR.replaceMove(s.range,s.insertText),...s.additionalTextEdits]),s.command&&s.source.addRef(),nz((t=>{this._source.clear(t),this._isActive.set(!1,t)})),s.command&&(await this._commandService.executeCommand(s.command.id,...s.command.arguments||[]).then(void 0,Fi),s.source.removeRef())}async acceptNextWord(t){await this._acceptNext(t,((t,i)=>{const e=this.textModel.getLanguageIdAtPosition(t.lineNumber,t.column),s=this._languageConfigurationService.getLanguageConfiguration(e),n=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),r=i.match(n);let o=0;o=r&&void 0!==r.index?0===r.index?r[0].length:r.index:i.length;const h=/\s+/g.exec(i);return h&&void 0!==h.index&&h.index+h[0].length<o&&(o=h.index+h[0].length),o}))}async acceptNextLine(t){await this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}async _acceptNext(t,i){if(t.getModel()!==this.textModel)throw new $i;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.ghostText,n=e.inlineCompletion.toInlineCompletion(void 0);if(n.snippetInfo||n.filterText!==n.insertText)return void await this.accept(t);const r=s.parts[0],o=new vs(s.lineNumber,r.column),h=r.lines.join("\n"),c=i(o,h);if(c===h.length&&1===s.parts.length)return void this.accept(t);const l=h.substring(0,c);n.source.addRef();try{this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[QR.replace(bs.fromPositions(o),l)]);const i=k5(l);t.setPosition(y5(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=bs.fromPositions(n.range.getStartPosition(),y5(o,k5(l))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}finally{n.source.removeRef()}}handleSuggestAccepted(t){var i,e;const s=t.toSingleTextEdit().removeCommonPrefix(this.textModel),n=this._computeAugmentedCompletion(s,void 0);if(!n)return;const r=n.completion.inlineCompletion;null===(e=(i=r.source.provider).handlePartialAccept)||void 0===e||e.call(i,r.source.inlineCompletions,r.sourceInlineCompletion,s.text.length)}};_3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([O3(9,io),O3(10,po),O3(11,Nd)],_3);var I3,P3=function(t,i){return function(e,s){i(e,s,t)}};class N3{constructor(t){this.name=t}select(t,i,e){if(0===e.length)return 0;const s=e[0].score[0];for(let t=0;t<e.length;t++){const{score:i,completion:n}=e[t];if(i[0]!==s)break;if(n.preselect)return t}return 0}}class B3 extends N3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let $3=I3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Ui,this._persistSoon=new rc((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===uN.SHUTDOWN&&this._saveState()})))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(t,i,e){this._withStrategy(t,i).memorize(t,i,e),this._persistSoon.schedule()}select(t,i,e){return this._withStrategy(t,i).select(t,i,e)}_withStrategy(t,i){var e;const s=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:t.getLanguageIdAtPosition(i.lineNumber,i.column),resource:t.uri});if((null===(e=this._strategy)||void 0===e?void 0:e.name)!==s){this._saveState();const t=I3._strategyCtors.get(s)||B3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${I3._storagePrefix}/${s}`,t?0:1);i&&this._strategy.fromJSON(JSON.parse(i))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${I3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};$3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends N3{constructor(){super("recentlyUsedByPrefix"),this._trie=TO.forStrings(),this._seq=0}memorize(t,i,e){const{word:s}=t.getWordUntilPosition(i),n=`${t.getLanguageId()}/${s}`;this._trie.set(n,{type:e.completion.kind,insertText:e.completion.insertText,touch:this._seq++})}select(t,i,e){const{word:s}=t.getWordUntilPosition(i);if(!s)return super.select(t,i,e);const n=`${t.getLanguageId()}/${s}`;let r=this._trie.get(n);if(r||(r=this._trie.findSubstr(n)),r)for(let t=0;t<e.length;t++){const{kind:i,insertText:s}=e[t].completion;if(i===r.type&&s===r.insertText)return t}return super.select(t,i,e)}toJSON(){const t=[];return this._trie.forEach(((i,e)=>t.push([e,i]))),t.sort(((t,i)=>-(t[1].touch-i[1].touch))).forEach(((t,i)=>t[1].touch=i)),t.slice(0,200)}fromJSON(t){if(this._trie.clear(),t.length>0){this._seq=t[0][1].touch+1;for(const[i,e]of t)e.type="number"==typeof e.type?e.type:Ls.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends N3{constructor(){super("recentlyUsed"),this._cache=new Mg(300,.66),this._seq=0}memorize(t,i,e){const s=`${t.getLanguageId()}/${e.textLabel}`;this._cache.set(s,{touch:this._seq++,type:e.completion.kind,insertText:e.completion.insertText})}select(t,i,e){if(0===e.length)return 0;const s=t.getLineContent(i.lineNumber).substr(i.column-10,i.column-1);if(/\s$/.test(s))return super.select(t,i,e);const n=e[0].score[0];let r=-1,o=-1;for(let i=0;i<e.length&&e[i].score[0]===n;i++){const s=`${t.getLanguageId()}/${e[i].textLabel}`,n=this._cache.peek(s);if(n&&n.touch>o&&n.type===e[i].completion.kind&&n.insertText===e[i].completion.insertText&&(o=n.touch,r=i),e[i].completion.preselect)return i}return-1!==r?r:0}toJSON(){return this._cache.toJSON()}fromJSON(t){this._cache.clear();for(const[i,e]of t)e.touch=0,e.type="number"==typeof e.type?e.type:Ls.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",B3]]),$3._storagePrefix="suggest/memories",$3=I3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P3(0,aN),P3(1,rd)],$3);const W3=eo("ISuggestMemories");gd(W3,$3,1);var j3;let V3=j3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=j3.AtEnd.bindTo(i),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(122)&&this._update())),this._update()}dispose(){var t;this._configListener.dispose(),null===(t=this._selectionListener)||void 0===t||t.dispose(),this._ckAtEnd.reset()}_update(){const t="on"===this._editor.getOption(122);if(this._enabled!==t)if(this._enabled=t,this._enabled){const t=()=>{if(!this._editor.hasModel())return void this._ckAtEnd.set(!1);const t=this._editor.getModel(),i=this._editor.getSelection(),e=t.getWordAtPosition(i.getStartPosition());this._ckAtEnd.set(!!e&&e.endColumn===i.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};V3.AtEnd=new Xo("atEndOfWord",!1),V3=j3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],V3);var H3;let z3=H3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=H3.OtherSuggestions.bindTo(i)}dispose(){this.reset()}reset(){var t;this._ckOtherSuggestions.reset(),null===(t=this._listener)||void 0===t||t.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:t,index:i},e){0!==t.items.length&&H3._moveIndex(!0,t,i)!==i?(this._acceptNext=e,this._model=t,this._index=i,this._listener=this._editor.onDidChangeCursorPosition((()=>{this._ignore||this.reset()})),this._ckOtherSuggestions.set(!0)):this.reset()}static _moveIndex(t,i,e){let s=e;for(let n=i.items.length;n>0&&(s=(s+i.items.length+(t?1:-1))%i.items.length,s!==e)&&i.items[s].completion.additionalTextEdits;n--);return s}next(){this._move(!0)}prev(){this._move(!1)}_move(t){if(this._model)try{this._ignore=!0,this._index=H3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};z3.OtherSuggestions=new Xo("hasOtherSuggestions",!1),z3=H3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,th)],z3);class U3{constructor(t,i,e,s){this._disposables=new Ui,this._disposables.add(e.onDidSuggest((t=>{0===t.completionModel.items.length&&this.reset()}))),this._disposables.add(e.onDidCancel((()=>{this.reset()}))),this._disposables.add(i.onDidShow((()=>this._onItem(i.getFocusedItem())))),this._disposables.add(i.onDidFocus(this._onItem,this)),this._disposables.add(i.onDidHide(this.reset,this)),this._disposables.add(t.onWillType((n=>{if(this._active&&!i.isFrozen()&&0!==e.state){const i=n.charCodeAt(n.length-1);this._active.acceptCharacters.has(i)&&t.getOption(0)&&s(this._active.item)}})))}_onItem(t){if(!t||!u(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new af;for(const e of t.item.completion.commitCharacters)e.length>0&&i.add(e.charCodeAt(0));this._active={acceptCharacters:i,item:t}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class K3{async provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;await new Promise((i=>K3._bracketsRightYield(i,0,t,s,n))),await new Promise((e=>K3._bracketsLeftYield(e,0,t,s,n,i)))}return e}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=K3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>K3._maxDuration){setTimeout((()=>K3._bracketsRightYield(t,i+1,e,s,n)));break}if(h.bracketInfo.isOpeningBracket){const t=h.bracketInfo.bracketText,i=r.has(t)?r.get(t):0;r.set(t,i+1)}else{const t=h.bracketInfo.getOpeningBrackets()[0].bracketText;let i=r.has(t)?r.get(t):0;if(i-=1,r.set(t,Math.max(0,i)),i<0){let i=n.get(t);i||(i=new Nt,n.set(t,i)),i.push(h.range)}}s=h.range.getEndPosition()}}static _bracketsLeftYield(t,i,e,s,n,r){const o=new Map,h=Date.now();for(;;){if(i>=K3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>K3._maxDuration){setTimeout((()=>K3._bracketsLeftYield(t,i+1,e,s,n,r)));break}if(c.bracketInfo.isOpeningBracket){const t=c.bracketInfo.bracketText;let i=o.has(t)?o.get(t):0;if(i-=1,o.set(t,Math.max(0,i)),i<0){const i=n.get(t);if(i){const s=i.shift();0===i.size&&n.delete(t);const o=bs.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=bs.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),K3._addBracketLeading(e,h,r)}}}else{const t=c.bracketInfo.getOpeningBrackets()[0].bracketText,i=o.has(t)?o.get(t):0;o.set(t,i+1)}s=c.range.getStartPosition()}}static _addBracketLeading(t,i,e){if(i.startLineNumber===i.endLineNumber)return;const s=i.startLineNumber,n=t.getLineFirstNonWhitespaceColumn(s);0!==n&&n!==i.startColumn&&(e.push({range:bs.fromPositions(new vs(s,n),i.getEndPosition())}),e.push({range:bs.fromPositions(new vs(s,1),i.getEndPosition())}));const r=s-1;if(r>0){const s=t.getLineFirstNonWhitespaceColumn(r);s===i.startColumn&&s!==t.getLineLastNonWhitespaceColumn(r)&&(e.push({range:bs.fromPositions(new vs(r,s),i.getEndPosition())}),e.push({range:bs.fromPositions(new vs(r,1),i.getEndPosition())}))}}}K3._maxDuration=30,K3._maxRounds=2;class q3{static async create(t,i){if(!i.getOption(117).localityBonus)return q3.None;if(!i.hasModel())return q3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return q3.None;const[r]=await(new K3).provideSelectionRanges(e,[n]);if(0===r.length)return q3.None;const o=await t.computeWordRanges(e.uri,r[0].range);if(!o)return q3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends q3{distance(t,e){if(!n.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const h=o["string"==typeof e.label?e.label:e.label.label];if(a(h))return 2<<20;const c=s(h,bs.fromPositions(t),bs.compareRangesUsingStarts),l=c>=0?h[c]:h[Math.max(0,~c-1)];let u=r.length;for(const t of r){if(!bs.containsRange(t.range,l))break;u-=1}return u}}}}q3.None=new class extends q3{distance(){return 0}};class G3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class Z3{constructor(t,i,e,s,n,r,o=oI.default,h){this.clipboardText=h,this._snippetCompareFn=Z3._compareCompletionItems,this._items=t,this._column=i,this._wordDistance=s,this._options=n,this._refilterKind=1,this._lineContext=e,this._fuzzyScoreOptions=o,"top"===r?this._snippetCompareFn=Z3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=Z3._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(t){this._lineContext.leadingLineContent===t.leadingLineContent&&this._lineContext.characterCountDelta===t.characterCountDelta||(this._refilterKind=this._lineContext.characterCountDelta<t.characterCountDelta&&this._filteredItems?2:1,this._lineContext=t)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const t=new Set;for(const[i,e]of this.getItemsByProvider())e.length>0&&e[0].container.incomplete&&t.add(i);return t}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){0!==this._refilterKind&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const t=[],{leadingLineContent:i,characterCountDelta:e}=this._lineContext;let s="",r="";const o=1===this._refilterKind?this._items:this._filteredItems,h=[],c=!this._options.filterGraceful||o.length>2e3?hI:lI;for(let n=0;n<o.length;n++){const l=o[n];if(l.isInvalid)continue;const a=this._itemsByProvider.get(l.provider);a?a.push(l):this._itemsByProvider.set(l.provider,[l]);const u=l.position.column-l.editStart.column,d=u+e-(l.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),r=s.toLowerCase()),l.word=s,0===d)l.score=rI.Default;else{let t=0;for(;t<u;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)l.score=rI.Default;else if("string"==typeof l.completion.filterText){const i=c(s,r,t,l.completion.filterText,l.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===Jn(l.completion.filterText,l.textLabel)?l.score=i:(l.score=K_(s,r,t,l.textLabel,l.labelLow,0),l.score[0]=i[0])}else{const i=c(s,r,t,l.textLabel,l.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;l.score=i}}l.idx=n,l.distance=this._wordDistance.distance(l.position,l.completion),h.push(l),t.push(l.textLabel.length)}this._filteredItems=h.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?n(t.length-.85,t,((t,i)=>t-i)):0}}static _compareCompletionItems(t,i){return t.score[0]>i.score[0]?-1:t.score[0]<i.score[0]?1:t.distance<i.distance?-1:t.distance>i.distance?1:t.idx<i.idx?-1:t.idx>i.idx?1:0}static _compareCompletionItemsSnippetsDown(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return Z3._compareCompletionItems(t,i)}static _compareCompletionItemsSnippetsUp(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return-1;if(27===i.completion.kind)return 1}return Z3._compareCompletionItems(t,i)}}var J3,Q3=function(t,i){return function(e,s){i(e,s,t)}};class Y3{static shouldAutoTrigger(t){if(!t.hasModel())return!1;const i=t.getModel(),e=t.getPosition();i.tokenization.tokenizeIfCheap(e.lineNumber);const s=i.getWordAtPosition(e);return!(!s||s.endColumn!==e.column&&s.startColumn+1!==e.column||!isNaN(Number(s.word)))}constructor(t,i,e){this.leadingLineContent=t.getLineContent(i.lineNumber).substr(0,i.column-1),this.leadingWord=t.getWordUntilPosition(i),this.lineNumber=i.lineNumber,this.column=i.column,this.triggerOptions=e}}let X3=J3=class{constructor(t,i,e,s,n,r,o,h,c){this._editor=t,this._editorWorkerService=i,this._clipboardService=e,this._telemetryService=s,this._logService=n,this._contextKeyService=r,this._configurationService=o,this._languageFeaturesService=h,this._envService=c,this._toDispose=new Ui,this._triggerCharacterListener=new Ui,this._triggerQuickSuggest=new sc,this._triggerState=void 0,this._completionDisposables=new Ui,this._onDidCancel=new ne,this._onDidTrigger=new ne,this._onDidSuggest=new ne,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new ys(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeModelLanguage((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeConfiguration((()=>{this._updateTriggerCharacters()}))),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange((()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()})));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{l=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{l=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{l||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{l||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){Vi(this._triggerCharacterListener),Vi([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(90)||!this._editor.hasModel()||!this._editor.getOption(120))return;const t=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const e of i.triggerCharacters||[]){let s=t.get(e);s||(s=new Set,s.add(void 0),t.set(e,s)),s.add(i)}const i=i=>{var e;if(!function(t,i){if(!Boolean(i.getContextKeyValue("inlineSuggestionVisible")))return!0;const e=i.getContextKeyValue(m5.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(Y3.shouldAutoTrigger(this._editor))return;if(!i){const t=this._editor.getPosition();i=this._editor.getModel().getLineContent(t.lineNumber).substr(0,t.column-1)}let s="";or(i.charCodeAt(i.length-1))?rr(i.charCodeAt(i.length-2))&&(s=i.substr(i.length-2)):s=i.charAt(i.length-1);const n=t.get(s);if(n){const t=new Map;if(this._completionModel)for(const[i,e]of this._completionModel.getItemsByProvider())n.has(i)||t.set(i,e);this.trigger({auto:!0,triggerKind:1,triggerCharacter:s,retrigger:Boolean(this._completionModel),clipboardText:null===(e=this._completionModel)||void 0===e?void 0:e.clipboardText,completionOptions:{providerFilter:n,providerItemsToReuse:t}})}};this._triggerCharacterListener.add(this._editor.onDidType(i)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd((()=>i())))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(t=!1){var i;void 0!==this._triggerState&&(this._triggerQuickSuggest.cancel(),null===(i=this._requestToken)||void 0===i||i.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:t}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){void 0!==this._triggerState&&(this._editor.hasModel()&&this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.trigger({auto:this._triggerState.auto,retrigger:!0}):this.cancel())}_onCursorChange(t){if(!this._editor.hasModel())return;const i=this._currentSelection;this._currentSelection=this._editor.getSelection(),!t.selection.isEmpty()||0!==t.reason&&3!==t.reason||"keyboard"!==t.source&&"deleteLeft"!==t.source?this.cancel():void 0===this._triggerState&&0===t.reason?(i.containsRange(this._currentSelection)||i.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():void 0!==this._triggerState&&3===t.reason&&this._refilterCompletionItems()}_onCompositionEnd(){void 0===this._triggerState?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){var t;f3.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=F3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!Y3.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),e=this._editor.getOption(88);if(!f3.isAllOff(e)){if(!f3.isAllOn(e)){t.tokenization.tokenizeIfCheap(i.lineNumber);const s=t.tokenization.getLineTokens(i.lineNumber),n=s.getStandardTokenType(s.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if("on"!==f3.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(m5.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(m5.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(89)))}_refilterCompletionItems(){B(this._editor.hasModel()),B(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new Y3(t,i,{...this._triggerState,refilter:!0});this._onNewContext(e)}trigger(t){var i,e,s,n,r,o;if(!this._editor.hasModel())return;const h=this._editor.getModel(),c=new Y3(h,this._editor.getPosition(),t);this.cancel(t.retrigger),this._triggerState=t,this._onDidTrigger.fire({auto:t.auto,shy:null!==(i=t.shy)&&void 0!==i&&i,position:this._editor.getPosition()}),this._context=c;let l={triggerKind:null!==(e=t.triggerKind)&&void 0!==e?e:0};t.triggerCharacter&&(l={triggerKind:1,triggerCharacter:t.triggerCharacter}),this._requestToken=new pe;let a=1;switch(this._editor.getOption(111)){case"top":a=0;break;case"bottom":a=2}const{itemKind:u,showDeprecated:d}=J3._createSuggestFilter(this._editor),f=new c3(a,null!==(n=null===(s=t.completionOptions)||void 0===s?void 0:s.kindFilter)&&void 0!==n?n:u,null===(r=t.completionOptions)||void 0===r?void 0:r.providerFilter,null===(o=t.completionOptions)||void 0===o?void 0:o.providerItemsToReuse,d),g=q3.create(this._editorWorkerService,this._editor),p=a3(this._languageFeaturesService.completionProvider,h,this._editor.getPosition(),f,l,this._requestToken.token);Promise.all([p,g]).then((async([i,e])=>{var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==t?void 0:t.clipboardText;if(!n&&i.needsClipboard&&(n=await this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new Y3(r,this._editor.getPosition(),t),h={...oI.default,firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly};if(this._completionModel=new Z3(i.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(117),this._editor.getOption(111),h,n),this._completionDisposables.add(i.disposable),this._onNewContext(o),this._reportDurationsTelemetry(i.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const t of i.items)t.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${t.provider._debugDisplayName}`,t.completion)})).catch(Li)}_reportDurationsTelemetry(t){this._telemetryGate++%230==0&&setTimeout((()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(t)}),this._logService.debug("suggest.durations.json",t)}))}static _createSuggestFilter(t){const i=new Set;"none"===t.getOption(111)&&i.add(27);const e=t.getOption(117);return e.showMethods||i.add(0),e.showFunctions||i.add(1),e.showConstructors||i.add(2),e.showFields||i.add(3),e.showVariables||i.add(4),e.showClasses||i.add(5),e.showStructs||i.add(6),e.showInterfaces||i.add(7),e.showModules||i.add(8),e.showProperties||i.add(9),e.showEvents||i.add(10),e.showOperators||i.add(11),e.showUnits||i.add(12),e.showValues||i.add(13),e.showConstants||i.add(14),e.showEnums||i.add(15),e.showEnumMembers||i.add(16),e.showKeywords||i.add(17),e.showWords||i.add(18),e.showColors||i.add(19),e.showFiles||i.add(20),e.showReferences||i.add(21),e.showColors||i.add(22),e.showFolders||i.add(23),e.showTypeParameters||i.add(24),e.showSnippets||i.add(27),e.showUsers||i.add(25),e.showIssues||i.add(26),{itemKind:i,showDeprecated:e.showDeprecated}}_onNewContext(t){if(this._context)if(t.lineNumber===this._context.lineNumber)if(Kn(t.leadingLineContent)===Kn(this._context.leadingLineContent)){if(t.column<this._context.column)t.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();else if(this._completionModel)if(0!==t.leadingWord.word.length&&t.leadingWord.startColumn>this._context.leadingWord.startColumn){if(Y3.shouldAutoTrigger(this._editor)&&this._context){const t=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:t}})}}else if(t.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&0!==t.leadingWord.word.length){const t=new Map,i=new Set;for(const[e,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(e):t.set(e,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const i=this._completionModel.lineContext;let e=!1;if(this._completionModel.lineContext={leadingLineContent:t.leadingLineContent,characterCountDelta:t.column-this._context.column},0===this._completionModel.items.length){const s=Y3.shouldAutoTrigger(this._editor);if(!this._context)return void this.cancel();if(s&&this._context.leadingWord.endColumn<t.leadingWord.startColumn)return void this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});if(this._context.triggerOptions.auto)return void this.cancel();if(this._completionModel.lineContext=i,e=this._completionModel.items.length>0,e&&0===t.leadingWord.word.length)return void this.cancel()}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:t.triggerOptions,isFrozen:e})}}else this.cancel();else this.cancel()}};X3=J3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q3(1,iB),Q3(2,nH),Q3(3,Th),Q3(4,Rh),Q3(5,th),Q3(6,rd),Q3(7,op),Q3(8,JT)],X3);class t6{constructor(t,i){this._disposables=new Ui,this._lastOvertyped=[],this._locked=!1,this._disposables.add(t.onWillType((()=>{if(this._locked||!t.hasModel())return;const i=t.getSelections(),e=i.length;let s=!1;for(let t=0;t<e;t++)if(!i[t].isEmpty()){s=!0;break}if(!s)return void(0!==this._lastOvertyped.length&&(this._lastOvertyped.length=0));this._lastOvertyped=[];const n=t.getModel();for(let t=0;t<e;t++){const e=i[t];if(n.getValueLengthInRange(e)>t6._maxSelectionLength)return;this._lastOvertyped[t]={value:n.getValueInRange(e),multiline:e.startLineNumber!==e.endLineNumber}}}))),this._disposables.add(i.onDidTrigger((()=>{this._locked=!0}))),this._disposables.add(i.onDidCancel((()=>{this._locked=!1})))}getLastOvertypedInfo(t){if(t>=0&&t<this._lastOvertyped.length)return this._lastOvertyped[t]}dispose(){this._disposables.dispose()}}t6._maxSelectionLength=51200;var i6=function(t,i){return function(e,s){i(e,s,t)}};class e6 extends FN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=Q(0,"{0} ({1})",this._action.label,e6.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let s6=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Ui,this.element=xa(t,Fa(".suggest-status-bar"));const r=t=>t instanceof Mh?e.createInstance(e6,t,void 0):void 0;this._leftActions=new IN(this.element,{actionViewItemProvider:r}),this._rightActions=new IN(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const t=this._menuService.createMenu(this._menuId,this._contextKeyService),i=()=>{const i=[],e=[];for(const[s,n]of t.getActions())"left"===s?i.push(...n):e.push(...n);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(e)};this._menuDisposables.add(t.onDidChange((()=>i()))),this._menuDisposables.add(t)}hide(){this._menuDisposables.clear()}};s6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([i6(2,io),i6(3,xh),i6(4,th)],s6);function n6(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let r6=class{constructor(t,i){this._editor=t,this._onDidClose=new ne,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ne,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Ui,this._renderDisposeable=new Ui,this._borderWidth=1,this._size=new ql(330,0),this.domNode=Fa(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(GZ,{editor:t}),this._body=Fa(".body"),this._scrollbar=new pk(this._body,{alwaysConsumeMouseWheel:!0}),xa(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=xa(this._body,Fa(".header")),this._close=xa(this._header,Fa("span"+go.asCSSSelector(xs.close))),this._close.title=Q(0,"Close"),this._type=xa(this._header,Fa("p.type")),this._docs=xa(this._body,Fa("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(50),e=i.getMassagedFontFamily(),s=t.get(118)||i.fontSize,n=t.get(119)||i.lineHeight,r=i.fontWeight,o=`${n}px`;this.domNode.style.fontSize=`${s}px`,this.domNode.style.lineHeight=""+n/s,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=i.fontFeatureSettings,this._type.style.fontFamily=e,this._close.style.height=o,this._close.style.width=o}getLayoutInfo(){const t=this._editor.getOption(119)||this._editor.getOption(50).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=Q(0,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,2*this.getLayoutInfo().lineHeight),this._onDidChangeContents.fire(this)}renderItem(t,i){var e,s;this._renderDisposeable.clear();let{detail:n,documentation:r}=t.completion;if(i){let i="";i+=`score: ${t.score[0]}\n`,i+=`prefix: ${null!==(e=t.word)&&void 0!==e?e:"(no prefix)"}\n`,i+=`word: ${t.completion.filterText?t.completion.filterText+" (filterText)":t.textLabel}\n`,i+=`distance: ${t.distance} (localityBonus-setting)\n`,i+=`index: ${t.idx}, based on ${t.completion.sortText&&`sortText: "${t.completion.sortText}"`||"label"}\n`,i+=`commit_chars: ${null===(s=t.completion.commitCharacters)||void 0===s?void 0:s.join("")}\n`,r=(new bI).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||n6(t)){if(this.domNode.classList.remove("no-docs","no-type"),n){const t=n.length>1e5?`${n.substr(0,1e5)}…`:n;this._type.textContent=t,this._type.title=t,Ta(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Ol(this._type),this._type.title="",Ra(this._type),this.domNode.classList.add("no-type");if(Ol(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Ol(this._docs);const t=this._markdownRenderer.render(r);this._docs.appendChild(t.element),this._renderDisposeable.add(t),this._renderDisposeable.add(this._markdownRenderer.onDidRenderAsync((()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)})))}this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=t=>{t.preventDefault(),t.stopPropagation()},this._close.onclick=t=>{t.preventDefault(),t.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}else this.clearContents()}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get size(){return this._size}layout(t,i){const e=new ql(t,i);ql.equals(e,this._size)||(this._size=e,function(t,i,e){"number"==typeof i&&(t.style.width=`${i}px`),"number"==typeof e&&(t.style.height=`${e}px`)}(this.domNode,t,i)),this._scrollbar.scanDomNode()}scrollDown(t=8){this._body.scrollTop+=t}scrollUp(t=8){this._body.scrollTop-=t}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(t){this._borderWidth=t}get borderWidth(){return this._borderWidth}};r6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,io)],r6);class o6{constructor(t,i){let e,s;this.widget=t,this._editor=i,this._disposables=new Ui,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new hX,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(t.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let n=0,r=0;this._disposables.add(this._resizable.onDidWillResize((()=>{e=this._topLeft,s=this._resizable.size}))),this._disposables.add(this._resizable.onDidResize((t=>{if(e&&s){this.widget.layout(t.dimension.width,t.dimension.height);let i=!1;t.west&&(r=s.width-t.dimension.width,i=!0),t.north&&(n=s.height-t.dimension.height,i=!0),i&&this._applyTopLeft({top:e.top+n,left:e.left+r})}t.done&&(e=void 0,s=void 0,n=0,r=0,this._userSize=t.dimension)}))),this._disposables.add(this.widget.onDidChangeContents((()=>{var t;this._anchorBox&&this._placeAtAnchor(this._anchorBox,null!==(t=this._userSize)&&void 0!==t?t:this.widget.size,this._preferAlignAtTop)})))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return null}show(){this._added||(this._editor.addOverlayWidget(this),this.getDomNode().style.position="fixed",this._added=!0)}hide(t=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),t&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(t,i){var e;const s=t.getBoundingClientRect();this._anchorBox=s,this._preferAlignAtTop=i,this._placeAtAnchor(this._anchorBox,null!==(e=this._userSize)&&void 0!==e?e:this.widget.size,i)}_placeAtAnchor(t,i,e){var s;const n=Ul(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new ql(220,2*r.lineHeight),h=t.top,c=function(){const e=n.width-(t.left+t.width+r.borderWidth+r.horizontalPadding),s=-r.borderWidth+t.left+t.width,c=new ql(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),l=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ql(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ql(t.width-r.borderHeight,n.height-t.top-t.height-r.verticalPadding);return{top:s,left:e,fit:h.height-i.height,maxSizeBottom:h,maxSizeTop:h,minSize:o.with(h.width)}}()],a=null!==(s=l.find((t=>t.fit>=0)))&&void 0!==s?s:l.sort(((t,i)=>i.fit-t.fit))[0],u=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(a.maxSizeTop.height,a.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=a.maxSizeTop.height?(d=!0,p=a.maxSizeTop):(d=!1,p=a.maxSizeBottom):f<=a.maxSizeBottom.height?(d=!1,p=a.maxSizeBottom):(d=!0,p=a.maxSizeTop),this._applyTopLeft({left:a.left,top:d?a.top:u-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,a===c,d,a!==c),this._resizable.minSize=a.minSize,this._resizable.maxSize=p,this._resizable.layout(f,Math.min(p.width,i.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(t){this._topLeft=t,this.getDomNode().style.left=`${this._topLeft.left}px`,this.getDomNode().style.top=`${this._topLeft.top}px`}}var h6;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(h6||(h6={}));const c6=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function l6(t,i,e,s){const n=s===h6.ROOT_FOLDER?["rootfolder-icon"]:s===h6.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===dl.data)r=uA.parseMetaData(e).get(uA.META_DATA_LABEL);else{const t=e.path.match(c6);t?(r=a6(t[2].toLowerCase()),t[1]&&n.push(`${a6(t[1].toLowerCase())}-name-dir-icon`)):r=a6(e.authority.toLowerCase())}if(s===h6.ROOT_FOLDER)n.push(`${r}-root-name-folder-icon`);else if(s===h6.FOLDER)n.push(`${r}-name-folder-icon`);else{if(r){if(n.push(`${r}-name-file-icon`),n.push("name-file-icon"),r.length<=255){const t=r.split(".");for(let i=1;i<t.length;i++)n.push(`${t.slice(i).join(".")}-ext-file-icon`)}n.push("ext-file-icon")}const s=function(t,i,e){if(!e)return null;let s=null;if(e.scheme===dl.data){const t=uA.parseMetaData(e).get(uA.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==Ld?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${a6(s)}-lang-file-icon`)}}return n}function a6(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var u6,d6=function(t,i){return function(e,s){i(e,s,t)}};function f6(t){return`suggest-aria-id:${t}`}const g6=AV("suggest-more-info",xs.chevronRight,Q(0,"Icon for more information in the suggest widget.")),p6=new((u6=class{extract(t,i){if(t.textLabel.match(u6._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(u6._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=u6._regexRelaxed.exec(t.completion.documentation);if(e&&(0===e.index||e.index+e[0].length===t.completion.documentation.length))return i[0]=e[0],!0}return!1}})._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,u6._regexStrict=new RegExp(`^${u6._regexRelaxed.source}$`,"i"),u6);let m6=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ne,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Ui,e=t;e.classList.add("show-file-icons");const s=xa(t,Fa(".icon")),n=xa(s,Fa("span.colorspan")),r=xa(t,Fa(".contents")),o=xa(r,Fa(".main")),h=xa(o,Fa(".icon-label.codicon")),c=xa(o,Fa("span.left")),l=xa(o,Fa("span.right")),a=new Tj(c,{supportHighlights:!0,supportIcons:!0});i.add(a);const u=xa(c,Fa("span.signature-label")),d=xa(c,Fa("span.qualifier-label")),f=xa(l,Fa("span.details-label")),g=xa(l,Fa("span.readMore"+go.asCSSSelector(g6)));g.title=Q(0,"Read More");const p=()=>{const t=this._editor.getOptions(),i=t.get(50),n=i.getMassagedFontFamily(),r=i.fontFeatureSettings,h=t.get(118)||i.fontSize,c=t.get(119)||i.lineHeight,l=i.fontWeight,a=`${c}px`,u=`${i.letterSpacing}px`;e.style.fontSize=`${h}px`,e.style.fontWeight=l,e.style.letterSpacing=u,o.style.fontFamily=n,o.style.fontFeatureSettings=r,o.style.lineHeight=a,s.style.height=a,s.style.width=a,g.style.height=a,g.style.width=a};return p(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(118)||t.hasChanged(119))&&p()}))),{root:e,left:c,right:l,icon:s,colorspan:n,iconLabel:a,iconContainer:h,parametersLabel:u,qualifierLabel:d,detailsLabel:f,readMore:g,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=f6(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:q_(t.score)},r=[];if(19===s.kind&&p6.extract(t,r))e.icon.className="icon customcolor",e.iconContainer.className="icon hide",e.colorspan.style.backgroundColor=r[0];else if(20===s.kind&&this._themeService.getFileIconTheme().hasFileIcons){e.icon.className="icon hide",e.iconContainer.className="icon hide";const i=l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:t.textLabel}),h6.FILE),r=l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:s.detail}),h6.FILE);n.extraClasses=i.length>r.length?i:r}else 23===s.kind&&this._themeService.getFileIconTheme().hasFolderIcons?(e.icon.className="icon hide",e.iconContainer.className="icon hide",n.extraClasses=[l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:t.textLabel}),h6.FOLDER),l6(this._modelService,this._languageService,hs.from({scheme:"fake",path:s.detail}),h6.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...go.asClassNameArray(Ls.toIcon(s.kind))));s.tags&&s.tags.indexOf(1)>=0&&(n.extraClasses=(n.extraClasses||[]).concat(["deprecated"]),n.matches=[]),e.iconLabel.setLabel(t.textLabel,void 0,n),"string"==typeof s.label?(e.parametersLabel.textContent="",e.detailsLabel.textContent=w6(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=w6(s.label.detail||""),e.detailsLabel.textContent=w6(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Ta(e.detailsLabel):Ra(e.detailsLabel),n6(t)?(e.right.classList.add("can-expand-details"),Ta(e.readMore),e.readMore.onmousedown=t=>{t.stopPropagation(),t.preventDefault()},e.readMore.onclick=t=>{t.stopPropagation(),t.preventDefault(),this._onDidToggleDetails.fire()}):(e.right.classList.remove("can-expand-details"),Ra(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function w6(t){return t.replace(/\r\n|\r|\n/g,"")}m6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([d6(1,no),d6(2,ud),d6(3,Nk)],m6);var v6,b6=function(t,i){return function(e,s){i(e,s,t)}};Jm("editorSuggestWidget.background",{dark:Zw,light:Zw,hcDark:Zw,hcLight:Zw},Q(0,"Background color of the suggest widget.")),Jm("editorSuggestWidget.border",{dark:Qw,light:Qw,hcDark:Qw,hcLight:Qw},Q(0,"Border color of the suggest widget."));const y6=Jm("editorSuggestWidget.foreground",{dark:Gw,light:Gw,hcDark:Gw,hcLight:Gw},Q(0,"Foreground color of the suggest widget."));Jm("editorSuggestWidget.selectedForeground",{dark:ab,light:ab,hcDark:ab,hcLight:ab},Q(0,"Foreground color of the selected entry in the suggest widget.")),Jm("editorSuggestWidget.selectedIconForeground",{dark:ub,light:ub,hcDark:ub,hcLight:ub},Q(0,"Icon foreground color of the selected entry in the suggest widget."));const k6=Jm("editorSuggestWidget.selectedBackground",{dark:db,light:db,hcDark:db,hcLight:db},Q(0,"Background color of the selected entry in the suggest widget."));Jm("editorSuggestWidget.highlightForeground",{dark:Gv,light:Gv,hcDark:Gv,hcLight:Gv},Q(0,"Color of the match highlights in the suggest widget.")),Jm("editorSuggestWidget.focusHighlightForeground",{dark:Zv,light:Zv,hcDark:Zv,hcLight:Zv},Q(0,"Color of the match highlights in the suggest widget when an item is focused.")),Jm("editorSuggestWidgetStatus.foreground",{dark:Gb(y6,.5),light:Gb(y6,.5),hcDark:Gb(y6,.5),hcLight:Gb(y6,.5)},Q(0,"Foreground color of the suggest widget status."));class C6{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof LQ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ql.is(t))return ql.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let S6=v6=class{constructor(t,i,e,s,n){this.editor=t,this._storageService=i,this._state=0,this._isAuto=!1,this._pendingLayout=new qi,this._pendingShowDetails=new qi,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new sc,this._disposables=new Ui,this._onDidSelect=new oe,this._onDidFocus=new oe,this._onDidHide=new ne,this._onDidShow=new ne,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ne,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new hX,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new x6(this,t),this._persistedSize=new C6(i,t);class r{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let o;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),o=new r(this._persistedSize.restore(),this.element.size)}))),this._disposables.add(this.element.onDidResize((t=>{var i,e,s,n;if(this._resize(t.dimension.width,t.dimension.height),o&&(o.persistHeight=o.persistHeight||!!t.north||!!t.south,o.persistWidth=o.persistWidth||!!t.east||!!t.west),t.done){if(o){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),h=Math.round(t/2);let{width:c,height:l}=this.element.size;(!o.persistHeight||Math.abs(o.currentSize.height-l)<=h)&&(l=null!==(e=null===(i=o.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!o.persistWidth||Math.abs(o.currentSize.width-c)<=h)&&(c=null!==(n=null===(s=o.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ql(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=xa(this.element.domNode,Fa(".message")),this._listElement=xa(this.element.domNode,Fa(".tree"));const h=this._disposables.add(n.createInstance(r6,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new o6(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(m6,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new KP("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>Q(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:e,description:s}=t.completion.label;e&&s?i=Q(0,"{0} {1}, {2}",i,e,s):e?i=Q(0,"{0} {1}",i,e):s&&(i=Q(0,"{0}, {1}",i,s))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:e,detail:s}=t.completion;return Q(0,"{0}, docs: {1}",i,Nn("{0}{1}",s||"",e?"string"==typeof e?e:e.value:""))}}}),this._list.style(kN({listInactiveFocusBackground:k6,listInactiveFocusOutline:ew})),this._status=n.createInstance(s6,this.element.domNode,o3);const a=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);a(),this._disposables.add(s.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(s.getColorTheme()),this._disposables.add(this._list.onMouseDown((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onTap((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onDidChangeSelection((t=>this._onListSelection(t)))),this._disposables.add(this._list.onDidChangeFocus((t=>this._onListFocus(t)))),this._disposables.add(this.editor.onDidChangeCursorSelection((()=>this._onCursorSelectionChanged()))),this._disposables.add(this.editor.onDidChangeConfiguration((t=>{t.hasChanged(117)&&(a(),c())}))),this._ctxSuggestWidgetVisible=r3.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=r3.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=r3.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=r3.HasFocusedSuggestion.bindTo(e),this._disposables.add(Nl(this._details.widget.domNode,"keydown",(t=>{this._onDetailsKeydown.fire(t)}))),this._disposables.add(this.editor.onMouseDown((t=>this._onEditorMouseDown(t))))}dispose(){var t;this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),null===(t=this._loadingTimeout)||void 0===t||t.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(t){this._details.widget.domNode.contains(t.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(t.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){0!==this._state&&this._contentWidget.layout()}_onListMouseDownOrTap(t){void 0!==t.element&&void 0!==t.index&&(t.browserEvent.preventDefault(),t.browserEvent.stopPropagation(),this._select(t.element,t.index))}_onListSelection(t){t.elements.length&&this._select(t.elements[0],t.indexes[0])}_select(t,i){const e=this._completionModel;e&&(this._onDidSelect.fire({item:t,index:i,model:e}),this.editor.focus())}_onThemeChange(t){this._details.widget.borderWidth=Ey(t.type)?2:1}_onListFocus(t){var i;if(this._ignoreFocusEvents)return;if(!t.elements.length)return this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),void this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const e=t.elements[0],s=t.indexes[0];e!==this._focusedItem&&(null===(i=this._currentSuggestionDetails)||void 0===i||i.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=e,this._list.reveal(s),this._currentSuggestionDetails=Zh((async t=>{const i=ic((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose()));try{return await e.resolve(t)}finally{i.dispose(),s.dispose()}})),this._currentSuggestionDetails.then((()=>{s>=this._list.length||e!==this._list.element(s)||(this._ignoreFocusEvents=!0,this._list.splice(s,1,[e]),this._list.setFocus([s]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:f6(s)}))})).catch(Li)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(t){if(this._state!==t)switch(this._state=t,this.element.domNode.classList.toggle("frozen",4===t),this.element.domNode.classList.remove("message"),t){case 0:Ra(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=v6.LOADING_MESSAGE,Ra(this._listElement,this._status.element),Ta(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Sm(v6.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=v6.NO_SUGGESTIONS_MESSAGE,Ra(this._listElement,this._status.element),Ta(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Sm(v6.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Ra(this._messageElement),Ta(this._listElement,this._status.element),this._show();break;case 5:Ra(this._messageElement),Ta(this._listElement,this._status.element),this._details.show(),this._show()}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet((()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)}),100)}showTriggered(t,i){0===this._state&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!t,this._isAuto||(this._loadingTimeout=ic((()=>this._setState(1)),i)))}showSuggestions(t,i,e,s,n){var r,o;if(this._contentWidget.setPosition(this.editor.getPosition()),null===(r=this._loadingTimeout)||void 0===r||r.dispose(),null===(o=this._currentSuggestionDetails)||void 0===o||o.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==t&&(this._completionModel=t),e&&2!==this._state&&0!==this._state)return void this._setState(4);const h=this._completionModel.items.length,c=0===h;if(this._ctxSuggestWidgetMultipleSuggestions.set(h>1),c)return this._setState(s?0:2),void(this._completionModel=void 0);this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(e?4:3),this._list.reveal(i,0),this._list.setFocus(n?[]:[i])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=Wl(Al(this.element.domNode),(()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")}))}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(0!==this._state&&2!==this._state&&1!==this._state&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){5===this._state?(this._setState(3),this._details.widget.domNode.classList.remove("focused")):3===this._state&&this._isDetailsVisible()&&(this._setState(5),this._details.widget.domNode.classList.add("focused"))}toggleDetails(){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):!n6(this._list.getFocusedElements()[0])&&!this._explainMode||3!==this._state&&5!==this._state&&4!==this._state||(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this.showDetails(!1))}showDetails(t){this._pendingShowDetails.value=Wl(Al(this.element.domNode),(()=>{this._pendingShowDetails.clear(),this._details.show(),t?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._positionDetails(),this.editor.focus(),this.element.domNode.classList.add("shows-details")}))}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this.showDetails(!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){var t;this._pendingLayout.clear(),this._pendingShowDetails.clear(),null===(t=this._loadingTimeout)||void 0===t||t.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const i=this._persistedSize.restore(),e=Math.ceil(4.3*this.getLayoutInfo().itemHeight);i&&i.height<e&&this._persistedSize.store(i.with(void 0,e))}isFrozen(){return 4===this._state}_afterRender(t){null!==t?2!==this._state&&1!==this._state&&(this._isDetailsVisible()&&this._details.show(),this._positionDetails()):this._isDetailsVisible()&&this._details.hide()}_layout(t){var i,e,s;if(!this.editor.hasModel())return;if(!this.editor.getDomNode())return;const n=Ul(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();t||(t=r.defaultSize);let o=t.height,h=t.width;if(this._status.element.style.height=`${r.itemHeight}px`,2===this._state||1===this._state)o=r.itemHeight+r.borderHeight,h=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new ql(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const l=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,a=r.statusBarHeight+this._list.contentHeight+r.borderHeight,u=r.itemHeight+r.statusBarHeight,d=Zl(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,a),p=d.top+f.top-r.verticalPadding,m=Math.min(p,a);let w=Math.min(Math.max(m,g)+r.borderHeight,a);o===(null===(i=this._cappedHeight)||void 0===i?void 0:i.capped)&&(o=this._cappedHeight.wanted),o<u&&(o=u),o>w&&(o=w),o>g||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),w=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),w=g),this.element.preferredSize=new ql(l,r.defaultSize.height),this.element.maxSize=new ql(c,w),this.element.minSize=new ql(220,u),this._cappedHeight=o===a?{wanted:null!==(s=null===(e=this._cappedHeight)||void 0===e?void 0:e.wanted)&&void 0!==s?s:t.height,capped:o}:void 0}this._resize(h,o)}_resize(t,i){const{width:e,height:s}=this.element.maxSize;t=Math.min(e,t),i=Math.min(s,i);const{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(i-n,t),this._listElement.style.height=i-n+"px",this.element.layout(i,t),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var t;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,2===(null===(t=this._contentWidget.getPosition())||void 0===t?void 0:t.preference[0]))}getLayoutInfo(){const t=this.editor.getOption(50),i=qT(this.editor.getOption(119)||t.lineHeight,8,1e3),e=this.editor.getOption(117).showStatusBar&&2!==this._state&&1!==this._state?i:0,s=this._details.widget.borderWidth,n=2*s;return{itemHeight:i,statusBarHeight:e,borderWidth:s,borderHeight:n,typicalHalfwidthCharacterWidth:t.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new ql(430,e+12*i+n)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(t){this._storageService.store("expandSuggestionDocs",t,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};S6.LOADING_MESSAGE=Q(0,"Loading..."),S6.NO_SUGGESTIONS_MESSAGE=Q(0,"No suggestions."),S6=v6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([b6(1,aN),b6(2,th),b6(3,Nk),b6(4,io)],S6);class x6{constructor(t,i){this._widget=t,this._editor=i,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return!this._hidden&&this._position&&this._preference?{position:this._position,preference:[this._preference]}:null}beforeRender(){const{height:t,width:i}=this._widget.element.size,{borderWidth:e,horizontalPadding:s}=this._widget.getLayoutInfo();return new ql(i+2*e+s,t+2*e)}afterRender(t){this._widget._afterRender(t)}setPreference(t){this._preferenceLocked||(this._preference=t)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(t){this._position=t}}var D6,E6=function(t,i){return function(e,s){i(e,s,t)}};class A6{constructor(t,i){if(this._model=t,this._position=i,t.getLineMaxColumn(i.lineNumber)!==i.column){const e=t.getOffsetAt(i),s=t.getPositionAt(e+1);this._marker=t.deltaDecorations([],[{range:bs.fromPositions(i,s),options:{description:"suggest-line-suffix",stickiness:1}}])}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.deltaDecorations(this._marker,[])}delta(t){if(this._model.isDisposed()||this._position.lineNumber!==t.lineNumber)return 0;if(this._marker){const i=this._model.getDecorationRange(this._marker[0]);return this._model.getOffsetAt(i.getStartPosition())-this._model.getOffsetAt(t)}return this._model.getLineMaxColumn(t.lineNumber)-t.column}}let M6=D6=class{static get(t){return t.getContribution(D6.ID)}constructor(t,i,e,s,n,r,o){this._memoryService=i,this._commandService=e,this._contextKeyService=s,this._instantiationService=n,this._logService=r,this._telemetryService=o,this._lineSuffix=new qi,this._toDispose=new Ui,this._selectors=new L6((t=>t.priority)),this._onWillInsertSuggestItem=new ne,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(X3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=r3.InsertMode.bindTo(s);h.set(t.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger((()=>h.set(t.getOption(117).insertMode)))),this.widget=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>{const t=this._instantiationService.createInstance(S6,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new U3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=r3.MakesTextEdit.bindTo(this._contextKeyService),s=r3.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=r3.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(zi((()=>{e.reset(),s.reset(),n.reset()}))),this._toDispose.add(t.onDidFocus((({item:t})=>{const i=this.editor.getPosition(),r=t.editStart.column,o=i.column;let h=!0;"smart"!==this.editor.getOption(1)||2!==this.model.state||t.completion.additionalTextEdits||4&t.completion.insertTextRules||o-r!==t.completion.insertText.length||(h=this.editor.getModel().getValueInRange({startLineNumber:i.lineNumber,startColumn:r,endLineNumber:i.lineNumber,endColumn:o})!==t.completion.insertText),e.set(h),s.set(!vs.equals(t.editInsertEnd,t.editReplaceEnd)),n.set(Boolean(t.provider.resolveCompletionItem)||Boolean(t.completion.documentation)||t.completion.detail!==t.completion.label)}))),this._toDispose.add(t.onDetailsKeyDown((t=>{t.toKeyCodeChord().equals(new ch(!0,!1,!1,!1,33))||pt&&t.toKeyCodeChord().equals(new ch(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>this._toDispose.add(new t6(this.editor,this.model))))),this._alternatives=this._toDispose.add(new $l(Al(t.getDomNode()),(()=>this._toDispose.add(new z3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(V3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new A6(this.editor.getModel(),t.position)}))),this._toDispose.add(this.model.onDidSuggest((t=>{if(t.triggerOptions.shy)return;let i=-1;for(const e of this._selectors.itemsOrderedByPriorityDesc)if(i=e.select(this.editor.getModel(),this.editor.getPosition(),t.completionModel.items),-1!==i)break;-1===i&&(i=0);let e=!1;if(t.triggerOptions.auto){const i=this.editor.getOption(117);"never"===i.selectionMode||"always"===i.selectionMode?e="never"===i.selectionMode:"whenTriggerCharacter"===i.selectionMode?e=1!==t.triggerOptions.triggerKind:"whenQuickSuggestion"===i.selectionMode&&(e=1===t.triggerOptions.triggerKind&&!t.triggerOptions.refilter)}this.widget.value.showSuggestions(t.completionModel,i,t.isFrozen,t.triggerOptions.auto,e)}))),this._toDispose.add(this.model.onDidCancel((t=>{t.retrigger||this.widget.value.hideWidget()}))),this._toDispose.add(this.editor.onDidBlurEditorWidget((()=>{this.model.cancel(),this.model.clear()})));const c=r3.AcceptSuggestionsOnEnter.bindTo(s),l=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>l()))),l()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(t,i){if(!t||!t.item)return this._alternatives.value.reset(),this.model.cancel(),void this.model.clear();if(!this.editor.hasModel())return;const e=F3.get(this.editor);if(!e)return;this._onWillInsertSuggestItem.fire({item:t.item});const s=this.editor.getModel(),n=s.getAlternativeVersionId(),{item:r}=t,o=[],h=new pe;1&i||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,Boolean(8&i));this._memoryService.memorize(s,this.editor.getPosition(),r);const l=r.isResolved;let a=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=$z.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>QR.replaceMove(bs.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!l){const t=new Yi;let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=bs.getEndPosition(i.range);e&&!vs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let l=!1;const a=this.editor.onWillType((()=>{a.dispose(),l=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return;if(e&&r.completion.additionalTextEdits.some((t=>vs.isBefore(e,bs.getStartPosition(t.range)))))return!1;l&&this.editor.pushUndoStop();const t=$z.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>QR.replaceMove(bs.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!l&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),u=!0===i?1:!1===i?0:-2})).finally((()=>{n.dispose(),a.dispose()})))}let{insertText:d}=r.completion;if(4&r.completion.insertTextRules||(d=V5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===F6.id)this.model.trigger({auto:!0,retrigger:!0});else{const t=new Yi;o.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch((t=>{r.completion.extensionId?Fi(t):Li(t)})).finally((()=>{a=t.elapsed()})))}4&i&&this._alternatives.value.set(t,(t=>{for(h.cancel();s.canUndo();){n!==s.getAlternativeVersionId()&&s.undo(),this._insertSuggestion(t,3|(8&i?8:0));break}})),this._alertCompletionItem(r),Promise.all(o).finally((()=>{this._reportSuggestionAcceptedTelemetry(r,s,l,a,u),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e,s,n){var r,o,h;0!==Math.floor(100*Math.random())&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:null!==(o=null===(r=t.extensionId)||void 0===r?void 0:r.value)&&void 0!==o?o:"unknown",providerId:null!==(h=t.provider._debugDisplayName)&&void 0!==h?h:"unknown",kind:t.completion.kind,basenameHash:bl(eA(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:sA(i.uri),resolveInfo:t.provider.resolveCompletionItem?e?1:0:-1,resolveDuration:t.resolveDuration,commandDuration:s,additionalEditsAsync:n})}getOverwriteInfo(t,i){B(this.editor.hasModel());let e="replace"===this.editor.getOption(117).insertMode;i&&(e=!e);const s=(e?t.editReplaceEnd.column:t.editInsertEnd.column)-t.position.column;return{overwriteBefore:t.position.column-t.editStart.column+(this.editor.getPosition().column-t.position.column),overwriteAfter:s+(this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0)}}_alertCompletionItem(t){u(t.completion.additionalTextEdits)&&Cm(Q(0,"Accepting '{0}' made {1} additional edits",t.textLabel,t.completion.additionalTextEdits.length))}triggerSuggest(t,i,e){this.editor.hasModel()&&(this.model.trigger({auto:null!=i&&i,completionOptions:{providerFilter:t,kindFilter:e?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(t){if(!this.editor.hasModel())return;const i=this.editor.getPosition(),e=()=>{i.equals(this.editor.getPosition())&&this._commandService.executeCommand(t.fallback)},s=t=>{if(4&t.completion.insertTextRules||t.completion.additionalTextEdits)return!0;const i=this.editor.getPosition(),e=t.editStart.column,s=i.column;return s-e!==t.completion.insertText.length||this.editor.getModel().getValueInRange({startLineNumber:i.lineNumber,startColumn:e,endLineNumber:i.lineNumber,endColumn:s})!==t.completion.insertText};Xi.once(this.model.onDidTrigger)((()=>{const t=[];Xi.any(this.model.onDidTrigger,this.model.onDidCancel)((()=>{Vi(t),e()}),void 0,t),this.model.onDidSuggest((({completionModel:i})=>{if(Vi(t),0===i.items.length)return void e();const n=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),i.items),r=i.items[n];s(r)?(this.editor.pushUndoStop(),this._insertSuggestion({index:n,item:r,model:i},7)):e()}),void 0,t)})),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(i,0),this.editor.focus()}acceptSelectedSuggestion(t,i){const e=this.widget.value.getFocusedItem();let s=0;t&&(s|=4),i&&(s|=8),this._insertSuggestion(e,s)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.value.forceRenderingAbove()}stopForceRenderingAbove(){this.widget.isInitialized&&this.widget.value.stopForceRenderingAbove()}registerSelector(t){return this._selectors.register(t)}};M6.ID="editor.contrib.suggestController",M6=D6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([E6(1,W3),E6(2,po),E6(3,th),E6(4,io),E6(5,Rh),E6(6,Th)],M6);class L6{constructor(t){this.prioritySelector=t,this._items=new Array}register(t){if(-1!==this._items.indexOf(t))throw new Error("Value is already registered");return this._items.push(t),this._items.sort(((t,i)=>this.prioritySelector(i)-this.prioritySelector(t))),{dispose:()=>{const i=this._items.indexOf(t);i>=0&&this._items.splice(i,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class F6 extends Ga{constructor(){super({id:F6.id,label:Q(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Oo.and(PS.writable,PS.hasCompletionItemProvider,r3.Visible.toNegated()),kbOpts:{kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=M6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}F6.id="editor.action.triggerSuggest",iu(M6.ID,M6,2),Xa(F6);const T6=190,R6=qa.bindToContribution(M6.get);Ya(new R6({id:"acceptSelectedSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Oo.and(r3.Visible,PS.textInputFocus),weight:T6},{primary:3,kbExpr:Oo.and(r3.Visible,PS.textInputFocus,r3.AcceptSuggestionsOnEnter,r3.MakesTextEdit),weight:T6}],menuOpts:[{menuId:o3,title:Q(0,"Insert"),group:"left",order:1,when:r3.HasInsertAndReplaceRange.toNegated()},{menuId:o3,title:Q(0,"Insert"),group:"left",order:1,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("insert"))},{menuId:o3,title:Q(0,"Replace"),group:"left",order:1,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("replace"))}]})),Ya(new R6({id:"acceptAlternativeSelectedSuggestion",precondition:Oo.and(r3.Visible,PS.textInputFocus,r3.HasFocusedSuggestion),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:o3,group:"left",order:2,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("insert")),title:Q(0,"Replace")},{menuId:o3,group:"left",order:2,when:Oo.and(r3.HasInsertAndReplaceRange,r3.InsertMode.isEqualTo("replace")),title:Q(0,"Insert")}]})),mo.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),Ya(new R6({id:"hideSuggestWidget",precondition:r3.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:9,secondary:[1033]}})),Ya(new R6({id:"selectNextSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),Ya(new R6({id:"selectNextPageSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:12,secondary:[2060]}})),Ya(new R6({id:"selectLastSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),Ya(new R6({id:"selectPrevSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),Ya(new R6({id:"selectPrevPageSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:11,secondary:[2059]}})),Ya(new R6({id:"selectFirstSuggestion",precondition:Oo.and(r3.Visible,Oo.or(r3.MultipleSuggestions,r3.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),Ya(new R6({id:"focusSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),Ya(new R6({id:"focusAndAcceptSuggestion",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),Ya(new R6({id:"toggleSuggestionDetails",precondition:Oo.and(r3.Visible,r3.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:o3,group:"right",order:1,when:Oo.and(r3.DetailsVisible,r3.CanResolve),title:Q(0,"show less")},{menuId:o3,group:"right",order:1,when:Oo.and(r3.DetailsVisible.toNegated(),r3.CanResolve),title:Q(0,"show more")}]})),Ya(new R6({id:"toggleExplainMode",precondition:r3.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),Ya(new R6({id:"toggleSuggestionFocus",precondition:r3.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2570,mac:{primary:778}}})),Ya(new R6({id:"insertBestCompletion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),V3.AtEnd,r3.Visible.toNegated(),z3.OtherSuggestions.toNegated(),F3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(F(i)?{fallback:"tab",...i}:{fallback:"tab"})},kbOpts:{weight:T6,primary:2}})),Ya(new R6({id:"insertNextSuggestion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),z3.OtherSuggestions,r3.Visible.toNegated(),F3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:2}})),Ya(new R6({id:"insertPrevSuggestion",precondition:Oo.and(PS.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),z3.OtherSuggestions,r3.Visible.toNegated(),F3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:T6,kbExpr:PS.textInputFocus,primary:1026}})),Xa(class extends Ga{constructor(){super({id:"editor.action.resetSuggestSize",label:Q(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=M6.get(i))||void 0===e||e.resetWidgetSize()}});class O6 extends Ki{get selectedItem(){return this._selectedItem}constructor(t,i,e,s){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.onWillAccept=s,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=gz(this,void 0),this._register(t.onKeyDown((t=>{t.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))}))),this._register(t.onKeyUp((t=>{t.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))})));const n=M6.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(t,i,e)=>{var s;nz((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(s=this.suggestControllerPreselector())||void 0===s?void 0:s.removeCommonPrefix(r);if(!o)return-1;const h=vs.lift(i),c=Zf(e.map(((t,i)=>{const e=_6.fromSuggestion(n,r,h,t,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(r);return{index:i,valid:o.augments(e),prefixLength:e.text.length,suggestItem:t}})).filter((t=>t&&t.valid&&t.prefixLength>0)),S((t=>t.prefixLength),x));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(n.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(n.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(n.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Xi.once(n.model.onDidTrigger)((()=>{i()}))),this._register(n.onWillInsertSuggestItem((t=>{const i=this.editor.getPosition(),e=this.editor.getModel();if(!i||!e)return;const s=_6.fromSuggestion(n,e,i,t.item,this.isShiftKeyPressed);this.onWillAccept(s)})))}this.update(this._isActive)}update(t){const i=this.getSuggestItemInfo();this._isActive===t&&function(t,i){return t===i||!(!t||!i)&&t.equals(i)}(this._currentSuggestItemInfo,i)||(this._isActive=t,this._currentSuggestItemInfo=i,nz((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=M6.get(this.editor);if(!t||!this.isSuggestWidgetVisible)return;const i=t.widget.value.getFocusedItem(),e=this.editor.getPosition(),s=this.editor.getModel();return i&&e&&s?_6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=M6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=M6.get(this.editor);null==t||t.forceRenderingAbove()}}class _6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new V5).parse(r);t.children.length<100&&E3.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new _6(bs.fromPositions(e.delta(0,-h.overwriteBefore),e.delta(0,Math.max(h.overwriteAfter,0))),r,s.completion.kind,o)}constructor(t,i,e,s){this.range=t,this.insertText=i,this.completionItemKind=e,this.isSnippetText=s}equals(t){return this.range.equalsRange(t.range)&&this.insertText===t.insertText&&this.completionItemKind===t.completionItemKind&&this.isSnippetText===t.isSnippetText}toSelectedSuggestionInfo(){return new Os(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new G5(this.range,this.insertText)}}var I6,P6=function(t,i){return function(e,s){i(e,s,t)}};let N6=I6=class extends Ki{static get(t){return t.getContribution(I6.ID)}constructor(t,i,e,s,n,r,o,h,c){super(),this.editor=t,this._instantiationService=i,this._contextKeyService=e,this._configurationService=s,this._commandService=n,this._debounceService=r,this._languageFeaturesService=o,this._audioCueService=h,this._keybindingService=c,this.model=mz("inlineCompletionModel",void 0),this._textModelVersionId=gz(this,-1),this._cursorPosition=gz(this,new vs(1,1)),this._suggestWidgetAdaptor=this._register(new O6(this.editor,(()=>{var t,i;return null===(i=null===(t=this.model.get())||void 0===t?void 0:t.selectedInlineCompletion.get())||void 0===i?void 0:i.toSingleTextEdit(void 0)}),(t=>this.updateObservables(t,R3.Other)),(t=>{nz((i=>{var e;this.updateObservables(i,R3.Other),null===(e=this.model.get())||void 0===e||e.handleSuggestAccepted(t)}))}))),this._enabled=Tz(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(62).enabled)),this._ghostTextWidget=this._register(this._instantiationService.createInstance(A5,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:Lz(0),targetTextModel:this.model.map((t=>null==t?void 0:t.textModel))})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._playAudioCueSignal=Iz(this),this._isReadonly=Tz(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(90))),this._textModel=Tz(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this._textModelIfWritable=bz((t=>this._isReadonly.read(t)?void 0:this._textModel.read(t))),this._register(new m5(this._contextKeyService,this.model)),this._register(xz((e=>{const s=this._textModelIfWritable.read(e);nz((e=>{if(this.model.set(void 0,e),this.updateObservables(e,R3.Other),s){const n=i.createInstance(_3,s,this._suggestWidgetAdaptor.selectedItem,this._cursorPosition,this._textModelVersionId,this._debounceValue,Tz(t.onDidChangeConfiguration,(()=>t.getOption(117).preview)),Tz(t.onDidChangeConfiguration,(()=>t.getOption(117).previewMode)),Tz(t.onDidChangeConfiguration,(()=>t.getOption(62).mode)),this._enabled);this.model.set(n,e)}}))})));const l=t=>{var i;return t.isUndoing?R3.Undo:t.isRedoing?R3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?R3.AcceptWord:R3.Other};let a;this._register(t.onDidChangeModelContent((t=>nz((i=>this.updateObservables(i,l(t))))))),this._register(t.onDidChangeCursorPosition((t=>nz((i=>{var e;this.updateObservables(i,R3.Other),3!==t.reason&&"api"!==t.source||null===(e=this.model.get())||void 0===e||e.stop(i)}))))),this._register(t.onDidType((()=>nz((t=>{var i;this.updateObservables(t,R3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this._commandService.onDidExecuteCommand((i=>{new Set([US.Tab.id,US.DeleteLeft.id,US.DeleteRight.id,u0,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&nz((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(62).keepOnBlur||y0.dropDownVisible||nz((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(xz((t=>{var i;const e=null===(i=this.model.read(t))||void 0===i?void 0:i.state.read(t);(null==e?void 0:e.suggestItem)?e.ghostText.lineCount>=2&&this._suggestWidgetAdaptor.forceRenderingAbove():this._suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(zi((()=>{this._suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(Ez({handleChange:t=>(t.didChange(this._playAudioCueSignal)&&(a=void 0),!0)},(async t=>{this._playAudioCueSignal.read(t);const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.inlineCompletion){if(e.inlineCompletion.semanticId!==a){a=e.inlineCompletion.semanticId;const t=i.textModel.getLineContent(e.ghostText.lineNumber);this._audioCueService.playAudioCue(LH.inlineSuggestion).then((()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(e.ghostText.renderForScreenReader(t))}))}}else a=void 0}))),this._register(new w0(this.editor,this.model,this._instantiationService)),this._register(this._configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}))),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})}playAudioCue(t){this._playAudioCueSignal.trigger(t)}provideScreenReaderUpdate(t){const i=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),e=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let s;!i&&e&&this.editor.getOption(147)&&(s=Q(0,"Inspect this in the accessible view ({0})",e.getAriaLabel())),Cm(s?t+", "+s:t)}updateObservables(t,i){var e,s;const n=this.editor.getModel();this._textModelVersionId.set(null!==(e=null==n?void 0:n.getVersionId())&&void 0!==e?e:-1,t,i),this._cursorPosition.set(null!==(s=this.editor.getPosition())&&void 0!==s?s:new vs(1,1),t)}shouldShowHoverAt(t){var i;const e=null===(i=this.model.get())||void 0===i?void 0:i.ghostText.get();return!!e&&e.parts.some((i=>t.containsPosition(new vs(e.lineNumber,i.column))))}shouldShowHoverAtViewZone(t){return this._ghostTextWidget.ownsViewZone(t)}};N6.ID="editor.contrib.inlineCompletionsController",N6=I6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P6(1,io),P6(2,th),P6(3,rd),P6(4,po),P6(5,YT),P6(6,op),P6(7,EH),P6(8,HC)],N6);class B6 extends Ga{constructor(){super({id:B6.ID,label:Q(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(t,i){var e;const s=N6.get(i);null===(e=null==s?void 0:s.model.get())||void 0===e||e.next()}}B6.ID=f0;class $6 extends Ga{constructor(){super({id:$6.ID,label:Q(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(t,i){var e;const s=N6.get(i);null===(e=null==s?void 0:s.model.get())||void 0===e||e.previous()}}$6.ID=d0;class W6 extends Ga{constructor(){super({id:W6.ID,label:Q(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:m5.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}async run(t,i){const e=N6.get(i);nz((t=>{var i;null===(i=null==e?void 0:e.model.get())||void 0===i||i.stop(t)}))}}W6.ID="editor.action.inlineSuggest.hide";class j6 extends Lh{constructor(){super({id:j6.ID,title:Q(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:Sh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Oo.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(t,i){const e=t.get(rd),s=e.getValue("editor.inlineSuggest.showToolbar");e.updateValue("editor.inlineSuggest.showToolbar","always"===s?"onHover":"always")}}j6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var V6=function(t,i){return function(e,s){i(e,s,t)}};class H6{constructor(t,i,e){this.owner=t,this.range=i,this.controller=e}isValidForHoverAnchor(t){return 1===t.type&&this.range.startColumn<=t.range.startColumn&&this.range.endColumn>=t.range.endColumn}}let z6=class{constructor(t,i,e,s,n,r){this._editor=t,this._languageService=i,this._openerService=e,this.accessibilityService=s,this._instantiationService=n,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(t){const i=N6.get(this._editor);if(!i)return null;const e=t.target;if(8===e.type){const s=e.detail;if(i.shouldShowHoverAtViewZone(s.viewZoneId))return new rX(1e3,this,bs.fromPositions(this._editor.getModel().validatePosition(s.positionBefore||s.position)),t.event.posx,t.event.posy,!1)}return 7===e.type&&i.shouldShowHoverAt(e.range)||6===e.type&&e.detail.mightBeForeignElement&&i.shouldShowHoverAt(e.range)?new rX(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("onHover"!==this._editor.getOption(62).showToolbar)return[];const e=N6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new H6(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Ui,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(y0,this._editor,!1,Lz(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]})));return t.fragment.appendChild(r.getDomNode()),n.triggerExplicitly(),e.add(r),e}renderScreenReaderText(t,i,e){const s=Fa,n=s("div.hover-row.markdown-hover"),r=xa(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new GZ({editor:this._editor},this._languageService,this._openerService));e.add(xz((s=>{var n;const h=null===(n=i.controller.model.read(s))||void 0===n?void 0:n.ghostText.read(s);if(h){const i=this._editor.getModel().getLineContent(h.lineNumber);(i=>{e.add(o.onDidRenderAsync((()=>{r.className="hover-contents code-hover-contents",t.onContentsChanged()})));const s=Q(0,"Suggestion:"),n=e.add(o.render((new bI).appendText(s).appendCodeblock("text",i)));r.replaceChildren(n.element)})(h.renderForScreenReader(i))}else Ea(r)}))),t.fragment.appendChild(n)}};function U6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function K6(t,i,e){t=t<0?0:t;let s="";if(!e){const e=Math.floor(t/i);t%=i;for(let t=0;t<e;t++)s+="\t"}for(let i=0;i<t;i++)s+=" ";return s}z6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([V6(1,ud),V6(2,ZN),V6(3,Om),V6(4,io),V6(5,Th)],z6),iu(N6.ID,N6,3),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:Q(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:PS.writable})}async run(t,i){const e=N6.get(i);await async function(t){const i=new hz(t,void 0);try{await t(i)}finally{i.finish()}}((async t=>{var i;await(null===(i=null==e?void 0:e.model.get())||void 0===i?void 0:i.triggerExplicitly(t)),null==e||e.playAudioCue(t)}))}}),Xa(B6),Xa($6),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:Q(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Oo.and(PS.writable,m5.inlineSuggestionVisible)},menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept Word"),group:"primary",order:2}]})}async run(t,i){var e;const s=N6.get(i);await(null===(e=null==s?void 0:s.model.get())||void 0===e?void 0:e.acceptNextWord(s.editor))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:Q(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Oo.and(PS.writable,m5.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept Line"),group:"secondary",order:2}]})}async run(t,i){var e;const s=N6.get(i);await(null===(e=null==s?void 0:s.model.get())||void 0===e?void 0:e.acceptNextLine(s.editor))}}),Xa(class extends Ga{constructor(){super({id:u0,label:Q(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:m5.inlineSuggestionVisible,menuOpts:[{menuId:Sh.InlineSuggestionToolbar,title:Q(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Oo.and(m5.inlineSuggestionVisible,PS.tabMovesFocus.toNegated(),m5.inlineSuggestionHasIndentationLessThanTabSize,r3.Visible.toNegated(),PS.hoverFocused.toNegated())}})}async run(t,i){var e;const s=N6.get(i);s&&(null===(e=s.model.get())||void 0===e||e.accept(s.editor),s.editor.focus())}}),Xa(W6),Fh(j6),oX.register(z6);function q6(t,i,e,s,n){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return[];const r=i.getLanguageConfiguration(t.getLanguageId()).indentationRules;if(!r)return[];for(s=Math.min(s,t.getLineCount());e<=s&&r.unIndentedLinePattern;){const i=t.getLineContent(e);if(!r.unIndentedLinePattern.test(i))break;e++}if(e>s-1)return[];const{tabSize:o,indentSize:h,insertSpaces:c}=t.getOptions(),l=(t,i)=>SS.shiftIndent(t,t.length+(i=i||1),o,h,c),a=(t,i)=>SS.unshiftIndent(t,t.length+(i=i||1),o,h,c),u=[];let d;const f=t.getLineContent(e);let g=f;if(null!=n){d=n;const t=Kn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=a(d),g=d+f.substring(t.length)),f!==g&&u.push(QR.replaceMove(new ys(e,1,e,t.length+1),GC(d,h,c)))}else d=Kn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=l(p),d=l(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=l(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=Kn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=a(p),d=a(d)),s!==p&&u.push(QR.replaceMove(new ys(i,1,i,s.length+1),GC(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=l(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?l(p):d)}return u}class G6 extends Ga{constructor(){super({id:G6.ID,label:Q(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:PS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new n9(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}G6.ID="editor.action.indentationToSpaces";class Z6 extends Ga{constructor(){super({id:Z6.ID,label:Q(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:PS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new r9(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}Z6.ID="editor.action.indentationToTabs";class J6 extends Ga{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(mj),s=t.get(no),n=i.getModel();if(!n)return;const r=s.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget),o=n.getOptions(),h=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===r.tabSize&&t===o.tabSize?Q(0,"Configured Tab Size"):t===r.tabSize?Q(0,"Default Tab Size"):t===o.tabSize?Q(0,"Current Tab Size"):void 0}))),c=Math.min(n.getOptions().tabSize-1,7);setTimeout((()=>{e.pick(h,{placeHolder:Q(0,"Select Tab Size for Current File"),activeItem:h[c]}).then((t=>{if(t&&n&&!n.isDisposed()){const i=parseInt(t.label,10);n.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class Q6 extends J6{constructor(){super(!1,!1,{id:Q6.ID,label:Q(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}Q6.ID="editor.action.indentUsingTabs";class Y6 extends J6{constructor(){super(!0,!1,{id:Y6.ID,label:Q(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}Y6.ID="editor.action.indentUsingSpaces";class X6 extends J6{constructor(){super(!0,!0,{id:X6.ID,label:Q(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}X6.ID="editor.action.changeTabDisplaySize";class t9 extends Ga{constructor(){super({id:t9.ID,label:Q(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(no),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}t9.ID="editor.action.detectIndentation";class i9{constructor(t,i){this._initialSelection=i,this._edits=[],this._selectionId=null;for(const i of t)i.range&&"string"==typeof i.text&&this._edits.push(i)}getEditOperations(t,i){for(const t of this._edits)i.addEditOperation(bs.lift(t.range),t.text);let e=!1;Array.isArray(this._edits)&&1===this._edits.length&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(e=!0,this._selectionId=i.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(e=!0,this._selectionId=i.trackSelection(this._initialSelection,!1))),e||(this._selectionId=i.trackSelection(this._initialSelection))}computeCursorState(t,i){return i.getTrackedSelection(this._selectionId)}}let e9=class{constructor(t,i){this.editor=t,this._languageConfigurationService=i,this.callOnDispose=new Ui,this.callOnModel=new Ui,this.callOnDispose.add(t.onDidChangeConfiguration((()=>this.update()))),this.callOnDispose.add(t.onDidChangeModel((()=>this.update()))),this.callOnDispose.add(t.onDidChangeModelLanguage((()=>this.update())))}update(){this.callOnModel.clear(),this.editor.getOption(12)<4||this.editor.getOption(55)||this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste((({range:t})=>{this.trigger(t)})))}trigger(t){const i=this.editor.getSelections();if(null===i||i.length>1)return;const e=this.editor.getModel();if(!e)return;if(!e.tokenization.isCheapToTokenize(t.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>SS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>SS.unshiftIndent(t,t.length+1,n,r,o)};let l=t.startLineNumber;for(;l<=t.endLineNumber&&this.shouldIgnoreLine(e,l);)l++;if(l>t.endLineNumber)return;let a=e.getLineContent(l);if(!/\S/.test(a.substring(0,t.startColumn-1))){const t=AS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=Kn(a),s=U6(t,n);if(s!==U6(i,n)){const t=K6(s,n,o);h.push({range:new bs(l,1,l,i.length+1),text:t}),a=t+a.substr(i.length)}else{const t=MS(e,l,this._languageConfigurationService);if(0===t||8===t)return}}}const u=l;for(;l<t.endLineNumber&&!/\S/.test(e.getLineContent(l+1));)l++;if(l!==t.endLineNumber){const i=AS(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===u?a:e.getLineContent(t)},e.getLanguageId(),l+1,c,this._languageConfigurationService);if(null!==i){const s=U6(i,n),r=U6(Kn(e.getLineContent(l+1)),n);if(s!==r){const i=s-r;for(let s=l+1;s<=t.endLineNumber;s++){const t=Kn(e.getLineContent(s)),r=K6(U6(t,n)+i,n,o);r!==t&&h.push({range:new bs(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new i9(h,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",t),this.editor.pushUndoStop()}}shouldIgnoreLine(t,i){t.tokenization.forceTokenization(i);const e=t.getLineFirstNonWhitespaceColumn(i);if(0===e)return!0;const s=t.tokenization.getLineTokens(i);if(s.getCount()>0){const t=s.findTokenIndexAtOffset(e);if(t>=0&&1===s.getStandardTokenType(t))return!0}return!1}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};function s9(t,i,e,s){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return;let n="";for(let t=0;t<e;t++)n+=" ";const r=new RegExp(n,"gi");for(let e=1,o=t.getLineCount();e<=o;e++){let o=t.getLineFirstNonWhitespaceColumn(e);if(0===o&&(o=t.getLineMaxColumn(e)),1===o)continue;const h=new bs(e,1,e,o),c=t.getValueInRange(h),l=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,l)}}e9.ID="editor.contrib.autoIndentOnPaste",e9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Nd)],e9);class n9{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),s9(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class r9{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),s9(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}iu(e9.ID,e9,2),Xa(G6),Xa(Z6),Xa(Q6),Xa(Y6),Xa(X6),Xa(t9),Xa(class extends Ga{constructor(){super({id:"editor.action.reindentlines",label:Q(0,"Reindent Lines"),alias:"Reindent Lines",precondition:PS.writable})}run(t,i){const e=t.get(Nd),s=i.getModel();if(!s)return;const n=q6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.reindentselectedlines",label:Q(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:PS.writable})}run(t,i){const e=t.get(Nd),s=i.getModel();if(!s)return;const n=i.getSelections();if(null===n)return;const r=[];for(const t of n){let i=t.startLineNumber,n=t.endLineNumber;if(i!==n&&1===t.endColumn&&n--,1===i){if(i===n)continue}else i--;const o=q6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});class o9{constructor(t,i){this.range=t,this.direction=i}}class h9{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new h9(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}async resolve(t){if("function"==typeof this.provider.resolveInlayHint){if(this._currentResolve){if(await this._currentResolve,t.isCancellationRequested)return;return this.resolve(t)}this._isResolved||(this._currentResolve=this._doResolve(t).finally((()=>this._currentResolve=void 0))),await this._currentResolve}}async _doResolve(t){var i,e;try{const s=await Promise.resolve(this.provider.resolveInlayHint(this.hint,t));this.hint.tooltip=null!==(i=null==s?void 0:s.tooltip)&&void 0!==i?i:this.hint.tooltip,this.hint.label=null!==(e=null==s?void 0:s.label)&&void 0!==e?e:this.hint.label,this._isResolved=!0}catch(t){Fi(t),this._isResolved=!1}}}class c9{static async create(t,i,e,s){const n=[],r=t.ordered(i).reverse().map((t=>e.map((async e=>{try{const r=await t.provideInlayHints(i,e,s);(null==r?void 0:r.hints.length)&&n.push([r,t])}catch(t){Fi(t)}}))));if(await Promise.all(r.flat()),s.isCancellationRequested||i.isDisposed())throw new _i;return new c9(e,n,i)}constructor(t,i,e){this._disposables=new Ui,this.ranges=t,this.provider=new Set;const s=[];for(const[t,n]of i){this._disposables.add(t),this.provider.add(n);for(const i of t.hints){const t=e.validatePosition(i.position);let r="before";const o=c9._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=bs.fromPositions(o.getStartPosition(),t),r="after"):(h=bs.fromPositions(t,o.getEndPosition()),r="before"),s.push(new h9(i,new o9(h,r),n))}}this.items=s.sort(((t,i)=>vs.compare(t.hint.position,i.hint.position)))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(t,i){const e=i.lineNumber,s=t.getWordAtPosition(i);if(s)return new bs(e,s.startColumn,e,s.endColumn);t.tokenization.tokenizeIfCheap(e);const n=t.tokenization.getLineTokens(e),r=i.column-1,o=n.findTokenIndexAtOffset(r);let h=n.getStartOffset(o),c=n.getEndOffset(o);return c-h==1&&(h===r&&o>1?(h=n.getStartOffset(o-1),c=n.getEndOffset(o-1)):c===r&&o<n.getCount()-1&&(h=n.getStartOffset(o+1),c=n.getEndOffset(o+1))),new bs(e,h+1,e,c+1)}}async function l9(t,i,e,s){var n;const r=t.get(ro),o=t.get(qO),h=t.get(po),c=t.get(io),l=t.get(VF);if(await s.item.resolve(fe.None),!s.part.location)return;const a=s.part.location,u=[],d=new Set(Eh.getMenuItems(Sh.EditorContext).map((t=>Ch(t)?t.command.id:G0())));for(const t of HY.all())d.has(t.desc.id)&&u.push(new oo(t.desc.id,Mh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(async()=>{const e=await r.createModelReference(a.uri);try{const n=new VY(e.object.textEditorModel,bs.getStartPosition(a.range)),r=s.item.anchor.range;await c.invokeFunction(t.runEditorCommand.bind(t),i,n,r)}finally{e.dispose()}})));if(s.part.command){const{command:t}=s.part;u.push(new co),u.push(new oo(t.id,t.title,void 0,!0,(async()=>{var i;try{await h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){l.notify({severity:jF.Error,source:s.item.provider.displayName,message:t})}})))}const f=i.getOption(126);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=Zl(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>u,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}async function a9(t,i,e,s){const n=t.get(ro),r=await n.createModelReference(s.uri);await e.invokeWithinContext((async t=>{const n=i.hasSideBySideModifier,o=t.get(th),h=$Q.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new zY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new VY(r.object.textEditorModel,bs.getStartPosition(s.range)),bs.lift(s.range))})),r.dispose()}var u9,d9=function(t,i){return function(e,s){i(e,s,t)}};class f9{constructor(){this._entries=new Mg(50)}get(t){const i=f9._key(t);return this._entries.get(i)}set(t,i){const e=f9._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const g9=eo("IInlayHintsCache");gd(g9,f9,1);class p9{constructor(t,i){this.item=t,this.index=i}get part(){const t=this.item.hint.label;return"string"==typeof t?{label:t}:t[this.index]}}class m9{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let w9=u9=class{static get(t){var i;return null!==(i=t.getContribution(u9.ID))&&void 0!==i?i:void 0}constructor(t,i,e,s,n,r,o){this._editor=t,this._languageFeaturesService=i,this._inlayHintsCache=s,this._commandService=n,this._notificationService=r,this._instaService=o,this._disposables=new Ui,this._sessionDisposables=new Ui,this._decorationsMetadata=new Map,this._ruleFactory=new uy(this._editor),this._activeRenderMode=0,this._debounceInfo=e.for(i.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(i.inlayHintsProvider.onDidChange((()=>this._update()))),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(139)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(139);if("off"===t.enabled)return;const i=this._editor.getModel();if(!i||!this._languageFeaturesService.inlayHintsProvider.has(i))return;const e=this._inlayHintsCache.get(i);let s;e&&this._updateHintsDecorators([i.getFullModelRange()],e),this._sessionDisposables.add(zi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new rc((async()=>{const t=Date.now();null==s||s.dispose(!0),s=new pe;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const e=s.token,o=await c9.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),e);if(r.delay=this._debounceInfo.update(i,Date.now()-t),e.isCancellationRequested)return void o.dispose();for(const t of o.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(o),this._updateHintsDecorators(o.ranges,o.items),this._cacheHintsForFastRestore(i)}catch(t){Li(t)}finally{s.dispose(),e.dispose()}}),this._debounceInfo.get(i));if(this._sessionDisposables.add(r),this._sessionDisposables.add(zi((()=>null==s?void 0:s.dispose(!0)))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange((t=>{!t.scrollTopChanged&&r.isScheduled()||r.schedule()}))),this._sessionDisposables.add(this._editor.onDidChangeModelContent((()=>{const t=Math.max(r.delay,1250);r.schedule(t)}))),"on"===t.enabled)this._activeRenderMode=0;else{let i,e;"onUnlessPressed"===t.enabled?(i=0,e=1):(i=1,e=0),this._activeRenderMode=i,this._sessionDisposables.add($a.getInstance().event((t=>{if(!this._editor.hasModel())return;const s=t.altKey&&t.ctrlKey&&!t.shiftKey&&!t.metaKey?e:i;if(s!==this._activeRenderMode){this._activeRenderMode=s;const t=this._editor.getModel(),i=this._copyInlayHintsWithCurrentAnchor(t);this._updateHintsDecorators([t.getFullModelRange()],i),r.schedule(0)}})))}this._sessionDisposables.add(this._installDblClickGesture((()=>r.schedule(0)))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const t=new Ui,i=t.add(new AQ(this._editor)),e=new Ui;return t.add(e),t.add(i.onMouseMoveOrRelevantKeyDown((t=>{const[i]=t,s=this._getInlayHintLabelPart(i),n=this._editor.getModel();if(!s||!n)return void e.clear();const r=new pe;e.add(zi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new m9(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new bs(o,1,o,n.getLineMaxColumn(o)),c=this._getInlineHintsForRange(h);this._updateHintsDecorators([h],c),e.add(zi((()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([h],c)})))}))),t.add(i.onCancel((()=>e.clear()))),t.add(i.onExecute((async t=>{const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(a9,t,this._editor,e.location):Ps.is(e.command)&&await this._invokeCommand(e.command,i.item)}}))),t}_getInlineHintsForRange(t){const i=new Set;for(const e of this._decorationsMetadata.values())t.containsRange(e.item.anchor.range)&&i.add(e.item);return Array.from(i)}_installDblClickGesture(t){return this._editor.onMouseUp((async i=>{if(2!==i.event.detail)return;const e=this._getInlayHintLabelPart(i);if(e&&(i.event.preventDefault(),await e.item.resolve(fe.None),u(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>QR.replace(bs.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))}_installContextMenu(){return this._editor.onContextMenu((async t=>{if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&await this._instaService.invokeFunction(l9,this._editor,t.event.target,i)}))}_getInlayHintLabelPart(t){var i;if(6!==t.target.type)return;const e=null===(i=t.target.detail.injectedText)||void 0===i?void 0:i.options;return e instanceof lL&&(null==e?void 0:e.attachedData)instanceof p9?e.attachedData:void 0}async _invokeCommand(t,i){var e;try{await this._commandService.executeCommand(t.id,...null!==(e=t.arguments)&&void 0!==e?e:[])}catch(t){this._notificationService.notify({severity:jF.Error,source:i.provider.displayName,message:t})}}_cacheHintsForFastRestore(t){const i=this._copyInlayHintsWithCurrentAnchor(t);this._inlayHintsCache.set(t,i)}_copyInlayHintsWithCurrentAnchor(t){const i=new Map;for(const[e,s]of this._decorationsMetadata){if(i.has(s.item))continue;const n=t.getDecorationRange(e);if(n){const t=new o9(n,s.item.anchor.direction),e=s.item.with({anchor:t});i.set(s.item,e)}}return Array.from(i.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),e=[];for(const s of i.sort(bs.compareRangesUsingStarts)){const i=t.validateRange(new bs(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&bs.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=bs.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(t,i){var e,s;const n=[],r=(t,i,e,s,r)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:r};n.push({item:t,classNameRef:i,decoration:{range:t.anchor.range,options:{description:"InlayHint",showIfCollapsed:t.anchor.range.isEmpty(),collapseOnReplaceEdit:!t.anchor.range.isEmpty(),stickiness:0,[t.anchor.direction]:0===this._activeRenderMode?o:void 0}}})},o=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(h/3|0)+"px",display:"inline-block"});r(t,e," ",i?Cf.Right:Cf.None)},{fontSize:h,fontFamily:c,padding:l,isUniform:a}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,c);for(const t of i){t.hint.paddingLeft&&o(t,!1);const i="string"==typeof t.hint.label?[{label:t.hint.label}]:t.hint.label;for(let s=0;s<i.length;s++){const n=i[s],o=0===s,c=s===i.length-1,f={fontSize:`${h}px`,fontFamily:`var(${d}), ${xi.fontFamily}`,verticalAlign:a?"baseline":"middle",unicodeBidi:"isolate"};u(t.hint.textEdits)&&(f.cursor="default"),this._fillInColors(f,t.hint),(n.command||n.location)&&(null===(e=this._activeInlayHintPart)||void 0===e?void 0:e.part.item)===t&&this._activeInlayHintPart.part.index===s&&(f.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(f.color=Bk(yv),f.cursor="pointer")),l&&(o&&c?(f.padding=`1px ${0|Math.max(1,h/4)}px`,f.borderRadius=(h/4|0)+"px"):o?(f.padding=`1px 0 1px ${0|Math.max(1,h/4)}px`,f.borderRadius=`${h/4|0}px 0 0 ${h/4|0}px`):c?(f.padding=`1px ${0|Math.max(1,h/4)}px 1px 0`,f.borderRadius=`0 ${h/4|0}px ${h/4|0}px 0`):f.padding="1px 0 1px 0"),r(t,this._ruleFactory.createClassNameRef(f),n.label.replace(/[ \t]/g," "),c&&!t.hint.paddingRight?Cf.Right:Cf.None,new p9(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>u9._MAX_DECORATORS)break}const f=[];for(const i of t)for(const{id:t}of null!==(s=this._editor.getDecorationsInRange(i))&&void 0!==s?s:[]){const i=this._decorationsMetadata.get(t);i&&(f.push(t),i.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const g=$z.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,n.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],n[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===Ns.Parameter?(t.backgroundColor=Bk(Ev),t.color=Bk(Dv)):i.kind===Ns.Type?(t.backgroundColor=Bk(xv),t.color=Bk(Sv)):(t.backgroundColor=Bk(Cv),t.color=Bk(kv))}_getLayoutInfo(){const t=this._editor.getOption(139),i=t.padding,e=this._editor.getOption(52),s=this._editor.getOption(49);let n=t.fontSize;(!n||n<5||n>e)&&(n=e);const r=t.fontFamily||s;return{fontSize:n,fontFamily:r,padding:i,isUniform:!i&&r===s&&n===e}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const t of this._decorationsMetadata.values())t.classNameRef.dispose();this._decorationsMetadata.clear()}};w9.ID="editor.contrib.InlayHints",w9._MAX_DECORATORS=1500,w9=u9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([d9(1,op),d9(2,YT),d9(3,g9),d9(4,po),d9(5,VF),d9(6,io)],w9),mo.registerCommand("_executeInlayHintProvider",(async(t,...i)=>{const[e,s]=i;B(hs.isUri(e)),B(bs.isIRange(s));const{inlayHintsProvider:n}=t.get(op),r=await t.get(ro).createModelReference(e);try{const t=await c9.create(n,r.object.textEditorModel,[bs.lift(s)],fe.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}));var v9=function(t,i){return function(e,s){i(e,s,t)}};class b9 extends rX{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let y9=class extends FX{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!w9.get(this._editor))return null;if(6!==t.target.type)return null;const e=null===(i=t.target.detail.injectedText)||void 0===i?void 0:i.options;return e instanceof lL&&e.attachedData instanceof p9?new b9(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof b9?new dc((async i=>{const{part:s}=t;if(await s.item.resolve(e),e.isCancellationRequested)return;let n,r;if("string"==typeof s.item.hint.tooltip?n=(new bI).appendText(s.item.hint.tooltip):s.item.hint.tooltip&&(n=s.item.hint.tooltip),n&&i.emitOne(new LX(this,t.range,[n],!1,0)),u(s.item.hint.textEdits)&&i.emitOne(new LX(this,t.range,[(new bI).appendText(Q(0,"Double-click to insert"))],!1,10001)),"string"==typeof s.part.tooltip?r=(new bI).appendText(s.part.tooltip):s.part.tooltip&&(r=s.part.tooltip),r&&i.emitOne(new LX(this,t.range,[r],!1,1)),s.part.location||s.part.command){let e;const n=Q(0,"altKey"===this._editor.getOption(77)?pt?"cmd + click":"ctrl + click":pt?"option + click":"alt + click");s.part.location&&s.part.command?e=(new bI).appendText(Q(0,"Go to Definition ({0}), right click for more",n)):s.part.location?e=(new bI).appendText(Q(0,"Go to Definition ({0})",n)):s.part.command&&(e=new bI(`[${Q(0,"Execute Command")}](${o=s.part.command,hs.from({scheme:dl.command,path:o.id,query:o.arguments&&encodeURIComponent(JSON.stringify(o.arguments))}).toString()} "${s.part.command.title}") (${n})`,{isTrusted:!0})),e&&i.emitOne(new LX(this,t.range,[e],!1,1e4))}var o;const h=await this._resolveInlayHintLabelPartHover(s,e);for await(const t of h)i.emitOne(t)})):dc.EMPTY}async _resolveInlayHintLabelPartHover(t,i){if(!t.part.location)return dc.EMPTY;const{uri:e,range:s}=t.part.location,n=await this._resolverService.createModelReference(e);try{const e=n.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(e)?EX(this._languageFeaturesService.hoverProvider,e,new vs(s.startLineNumber,s.startColumn),i).filter((t=>!yI(t.hover.contents))).map((i=>new LX(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):dc.EMPTY}finally{n.dispose()}}};y9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([v9(1,ud),v9(2,ZN),v9(3,rd),v9(4,ro),v9(5,op)],y9),iu(w9.ID,w9,1),oX.register(y9);class k9{constructor(t,i,e){this._editRange=t,this._originalSelection=i,this._text=e}getEditOperations(t,i){i.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(t,i){const e=i.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ys(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new ys(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}var C9;let S9=C9=class{static get(t){return t.getContribution(C9.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(t,i){var e;null===(e=this.currentRequest)||void 0===e||e.cancel();const s=this.editor.getSelection(),n=this.editor.getModel();if(!n||!s)return;let r=s;if(r.startLineNumber!==r.endLineNumber)return;const o=new oq(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=Zh((()=>this.editorWorkerService.navigateValueSet(h,r,i))),this.currentRequest.then((i=>{var e;if(!i||!i.range||!i.value)return;if(!o.validate(this.editor))return;const s=bs.lift(i.range);let n=i.range;const h=i.value.length-(r.endColumn-r.startColumn);n={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.startColumn+i.value.length},h>1&&(r=new ys(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+h-1));const c=new k9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:C9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=tc(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Li)})).catch(Li)):Promise.resolve(void 0)}};S9.ID="editor.contrib.inPlaceReplaceController",S9.DECORATION=aL.register({description:"in-place-replace",className:"valueSetReplacement"}),S9=C9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,iB)],S9),iu(S9.ID,S9,4),Xa(class extends Ga{constructor(){super({id:"editor.action.inPlaceReplace.up",label:Q(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=S9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.inPlaceReplace.down",label:Q(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=S9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),Xa(class extends Ga{constructor(){super({id:"expandLineSelection",label:Q(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:PS.textInputFocus,primary:2090}})}run(t,i,e){if(e=e||{},!i.hasModel())return;const s=i._getViewModel();s.model.pushStackElement(),s.setCursorStates(e.source,3,wS.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class x9{constructor(t,i){this._selection=t,this._cursors=i,this._selectionId=null}getEditOperations(t,i){const e=function(t,i){i.sort(((t,i)=>t.lineNumber===i.lineNumber?t.column-i.column:t.lineNumber-i.lineNumber));for(let t=i.length-2;t>=0;t--)i[t].lineNumber===i[t+1].lineNumber&&i.splice(t,1);const e=[];let s=0,n=0;const r=i.length;for(let o=1,h=t.getLineCount();o<=h;o++){const h=t.getLineContent(o),c=h.length+1;let l=0;if(n<r&&i[n].lineNumber===o&&(l=i[n].column,n++,l===c))continue;if(0===h.length)continue;const a=qn(h);let u=0;if(-1===a)u=1;else{if(a===h.length-1)continue;u=a+2}u=Math.max(l,u),e[s++]=QR.delete(new bs(o,u,o,c))}return e}(t,this._cursors);for(let t=0,s=e.length;t<s;t++){const s=e[t];i.addEditOperation(s.range,s.text)}this._selectionId=i.trackSelection(this._selection)}computeCursorState(t,i){return i.getTrackedSelection(this._selectionId)}}class D9{constructor(t,i,e){this._selection=t,this._isCopyingDown=i,this._noop=e||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(t,i){let e=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,e.startLineNumber<e.endLineNumber&&1===e.endColumn&&(this._endLineNumberDelta=1,e=e.setEndPosition(e.endLineNumber-1,t.getLineMaxColumn(e.endLineNumber-1)));const s=[];for(let i=e.startLineNumber;i<=e.endLineNumber;i++)s.push(t.getLineContent(i));const n=s.join("\n");""===n&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?i.addEditOperation(new bs(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new bs(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new bs(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber,t.getLineMaxColumn(e.endLineNumber)),"\n"+n),this._selectionId=i.trackSelection(e),this._selectionDirection=this._selection.getDirection()}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);if(0!==this._startLineNumberDelta||0!==this._endLineNumberDelta){let t=e.startLineNumber,i=e.startColumn,s=e.endLineNumber,n=e.endColumn;0!==this._startLineNumberDelta&&(t+=this._startLineNumberDelta,i=1),0!==this._endLineNumberDelta&&(s+=this._endLineNumberDelta,n=1),e=ys.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let E9=class{constructor(t,i,e,s){this._languageConfigurationService=s,this._selection=t,this._isMovingDown=i,this._autoIndent=e,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(t,i){const e=t.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===e)return void(this._selectionId=i.trackSelection(this._selection));if(!this._isMovingDown&&1===this._selection.startLineNumber)return void(this._selectionId=i.trackSelection(this._selection));this._moveEndPositionDown=!1;let s=this._selection;s.startLineNumber<s.endLineNumber&&1===s.endColumn&&(this._moveEndPositionDown=!0,s=s.setEndPosition(s.endLineNumber-1,t.getLineMaxColumn(s.endLineNumber-1)));const{tabSize:n,indentSize:r,insertSpaces:o}=t.getOptions(),h=this.buildIndentConverter(n,r,o),c={tokenization:{getLineTokens:i=>t.tokenization.getLineTokens(i),getLanguageId:()=>t.getLanguageId(),getLanguageIdAtPosition:(i,e)=>t.getLanguageIdAtPosition(i,e)},getLineContent:null};if(s.startLineNumber===s.endLineNumber&&1===t.getLineMaxColumn(s.startLineNumber)){const e=s.startLineNumber,n=this._isMovingDown?e+1:e-1;1===t.getLineMaxColumn(n)?i.addEditOperation(new bs(1,1,1,1),null):(i.addEditOperation(new bs(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new bs(n,1,n,t.getLineMaxColumn(n)),null)),s=new ys(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new bs(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let l=r;if(this.shouldAutoIndent(t,s)){const a=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==a){const i=K6(a+U6(Kn(t.getLineContent(e)),n),n,o);l=i+this.trimStart(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=AS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=Kn(t.getLineContent(e)),h=U6(i,n);if(h!==U6(s,n)){const t=K6(h,n,o);l=t+this.trimStart(r)}}}i.addEditOperation(new bs(s.startLineNumber,1,s.startLineNumber,1),l+"\n");const u=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,l);if(null!==u)0!==u&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,u);else{c.getLineContent=i=>i===s.startLineNumber?l:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=AS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=Kn(t.getLineContent(s.startLineNumber)),h=U6(r,n),c=U6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new bs(s.startLineNumber,1,s.startLineNumber,1),l+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new bs(e,1,e+1,1),null),i.addEditOperation(new bs(s.endLineNumber,t.getLineMaxColumn(s.endLineNumber),s.endLineNumber,t.getLineMaxColumn(s.endLineNumber)),"\n"+r),this.shouldAutoIndent(t,s)){c.getLineContent=i=>t.getLineContent(i===e?s.startLineNumber:i);const r=this.matchEnterRule(t,h,n,s.startLineNumber,s.startLineNumber-2);if(null!==r)0!==r&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,r);else{const r=AS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=Kn(t.getLineContent(s.startLineNumber)),h=U6(r,n),c=U6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}}this._selectionId=i.trackSelection(s)}buildIndentConverter(t,i,e){return{shiftIndent:s=>SS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>SS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Su.None||n.indentAction===Su.Indent?r=n.indentation+n.appendText:n.indentAction===Su.IndentOutdent?r=n.indentation:n.indentAction===Su.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimStart(o).indexOf(this.trimStart(r))>=0){const n=Kn(t.getLineContent(s));let o=Kn(r);const h=MS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),U6(o,e)-U6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(qn(r)>=0){const r=t.getLineMaxColumn(n),o=bS(this._autoIndent,t,new bs(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(qn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=bS(this._autoIndent,t,new bs(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}}matchEnterRule(t,i,e,s,n,r){let o=n;for(;o>=1;){let i;if(i=o===n&&void 0!==r?r:t.getLineContent(o),qn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=bS(this._autoIndent,t,new bs(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimStart(t){return t.replace(/^\s+/,"")}shouldAutoIndent(t,i){if(this._autoIndent<4)return!1;if(!t.tokenization.isCheapToTokenize(i.startLineNumber))return!1;const e=t.getLanguageIdAtPosition(i.startLineNumber,1);return e===t.getLanguageIdAtPosition(i.endLineNumber,1)&&null!==this._languageConfigurationService.getLanguageConfiguration(e).indentRulesSupport}getIndentEditsOfMovingBlock(t,i,e,s,n,r){for(let o=e.startLineNumber;o<=e.endLineNumber;o++){const h=Kn(t.getLineContent(o)),c=K6(U6(h,s)+r,s,n);c!==h&&(i.addEditOperation(new bs(o,1,o,h.length+1),c),o===e.endLineNumber&&e.endColumn<=h.length+1&&""===c&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&e.startLineNumber<e.endLineNumber&&(e=e.setEndPosition(e.endLineNumber,2)),e}};E9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,Nd)],E9);class A9{static getCollator(){return A9._COLLATOR||(A9._COLLATOR=new Intl.Collator),A9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=M9(t,i,e);return s?QR.replace(new bs(s.startLineNumber,1,s.endLineNumber,t.getLineMaxColumn(s.endLineNumber)),s.after.join("\n")):null}(t,this.selection,this.descending);e&&i.addEditOperation(e.range,e.text),this.selectionId=i.trackSelection(this.selection)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}static canRun(t,i,e){if(null===t)return!1;const s=M9(t,i,e);if(!s)return!1;for(let t=0,i=s.before.length;t<i;t++)if(s.before[t]!==s.after[t])return!0;return!1}}function M9(t,i,e){const s=i.startLineNumber;let n=i.endLineNumber;if(1===i.endColumn&&n--,s>=n)return null;const r=[];for(let i=s;i<=n;i++)r.push(t.getLineContent(i));let o=r.slice(0);return o.sort(A9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}A9._COLLATOR=null;class L9 extends Ga{constructor(t,i){super(i),this.down=t}run(t,i){if(!i.hasModel())return;const e=i.getSelections().map(((t,i)=>({selection:t,index:i,ignore:!1})));e.sort(((t,i)=>bs.compareRangesUsingStarts(t.selection,i.selection)));let s=e[0];for(let t=1;t<e.length;t++){const i=e[t];s.selection.endLineNumber===i.selection.startLineNumber&&(s.index<i.index?i.ignore=!0:(s.ignore=!0,s=i))}const n=[];for(const t of e)n.push(new D9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class F9 extends Ga{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(Nd),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new E9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class T9 extends Ga{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!A9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new A9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class R9 extends Ga{constructor(){super({id:R9.ID,label:Q(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:Ae(2089,2102),weight:100}})}run(t,i,e){let s=[];"auto-save"===e.reason&&(s=(i.getSelections()||[]).map((t=>new vs(t.positionLineNumber,t.positionColumn))));const n=i.getSelection();if(null===n)return;const r=new x9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}R9.ID="editor.action.trimTrailingWhitespace";class O9 extends Ga{run(t,i){if(!i.hasModel())return;const e=i.getSelection(),s=this._getRangesToDelete(i),n=[];for(let t=0,i=s.length-1;t<i;t++){const i=s[t],e=s[t+1];null===bs.intersectRanges(i,e)?n.push(i):s[t+1]=bs.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>QR.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class _9 extends Ga{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(129),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new bs(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(QR.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(QR.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class I9{constructor(t,i){this._pattern=t,this._flags=i,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(t){}}return this._actual}isSupported(){return null!==this.get()}}class P9 extends _9{constructor(){super({id:"editor.action.transformToTitlecase",label:Q(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:PS.writable})}_modifyText(t,i){const e=P9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}P9.titleBoundary=new I9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class N9 extends _9{constructor(){super({id:"editor.action.transformToSnakecase",label:Q(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:PS.writable})}_modifyText(t,i){const e=N9.caseBoundary.get(),s=N9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}N9.caseBoundary=new I9("(\\p{Ll})(\\p{Lu})","gmu"),N9.singleLetters=new I9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class B9 extends _9{constructor(){super({id:"editor.action.transformToCamelcase",label:Q(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:PS.writable})}_modifyText(t,i){const e=B9.wordBoundary.get();if(!e)return t;const s=t.split(e);return s.shift()+s.map((t=>t.substring(0,1).toLocaleUpperCase()+t.substring(1))).join("")}}B9.wordBoundary=new I9("[_\\s-]","gm");class $9 extends _9{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:Q(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:PS.writable})}_modifyText(t,i){const e=$9.caseBoundary.get(),s=$9.singleLetters.get(),n=$9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}$9.caseBoundary=new I9("(\\p{Ll})(\\p{Lu})","gmu"),$9.singleLetters=new I9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),$9.underscoreBoundary=new I9("(\\S)(_)(\\S)","gm"),Xa(class extends L9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:Q(0,"Copy Line Up"),alias:"Copy Line Up",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"&&Copy Line Up"),order:1}})}}),Xa(class extends L9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:Q(0,"Copy Line Down"),alias:"Copy Line Down",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Co&&py Line Down"),order:2}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.duplicateSelection",label:Q(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:PS.writable,menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"&&Duplicate Selection"),order:5}})}run(t,i,e){if(!i.hasModel())return;const s=[],n=i.getSelections(),r=i.getModel();for(const t of n)if(t.isEmpty())s.push(new D9(t,!0));else{const i=new ys(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new hS(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),Xa(class extends F9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:Q(0,"Move Line Up"),alias:"Move Line Up",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Mo&&ve Line Up"),order:3}})}}),Xa(class extends F9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:Q(0,"Move Line Down"),alias:"Move Line Down",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"2_line",title:Q(0,"Move &&Line Down"),order:4}})}}),Xa(class extends T9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:Q(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:PS.writable})}}),Xa(class extends T9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:Q(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:PS.writable})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.removeDuplicateLines",label:Q(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:PS.writable})}run(t,i){if(!i.hasModel())return;const e=i.getModel();if(1===e.getLineCount()&&1===e.getLineMaxColumn(1))return;const s=[],n=[];let r=0;for(const t of i.getSelections()){const i=new Set,o=[];for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const t=e.getLineContent(s);i.has(t)||(o.push(t),i.add(t))}const h=new ys(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,l=new ys(c,1,c+o.length-1,o[o.length-1].length);s.push(QR.replace(h,o.join("\n"))),n.push(l),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),Xa(R9),Xa(class extends Ga{constructor(){super({id:"editor.action.deleteLines",label:Q(0,"Delete Line"),alias:"Delete Line",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:3113,weight:100}})}run(t,i){if(!i.hasModel())return;const e=this._getLinesToRemove(i),s=i.getModel();if(1===s.getLineCount()&&1===s.getLineMaxColumn(1))return;let n=0;const r=[],o=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];let h=i.startLineNumber,c=i.endLineNumber,l=1,a=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,a=1):h>1&&(h-=1,l=s.getLineMaxColumn(h)),r.push(QR.replace(new ys(h,l,c,a),"")),o.push(new ys(h-n,i.positionColumn,h-n,i.positionColumn)),n+=i.endLineNumber-i.startLineNumber+1}i.pushUndoStop(),i.executeEdits(this.id,r,o),i.pushUndoStop()}_getLinesToRemove(t){const i=t.getSelections().map((t=>{let i=t.endLineNumber;return t.startLineNumber<t.endLineNumber&&1===t.endColumn&&(i-=1),{startLineNumber:t.startLineNumber,selectionStartColumn:t.selectionStartColumn,endLineNumber:i,positionColumn:t.positionColumn}}));i.sort(((t,i)=>t.startLineNumber===i.startLineNumber?t.endLineNumber-i.endLineNumber:t.startLineNumber-i.startLineNumber));const e=[];let s=i[0];for(let t=1;t<i.length;t++)s.endLineNumber+1>=i[t].startLineNumber?s.endLineNumber=i[t].endLineNumber:(e.push(s),s=i[t]);return e.push(s),e}}),Xa(class extends Ga{constructor(){super({id:"editor.action.indentLines",label:Q(0,"Indent Line"),alias:"Indent Line",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.outdentLines",label:Q(0,"Outdent Line"),alias:"Outdent Line",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2140,weight:100}})}run(t,i){US.Outdent.runEditorCommand(t,i,null)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertLineBefore",label:Q(0,"Insert Line Above"),alias:"Insert Line Above",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertLineAfter",label:Q(0,"Insert Line Below"),alias:"Insert Line Below",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,LS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),Xa(class extends O9{constructor(){super({id:"deleteAllLeft",label:Q(0,"Delete All Left"),alias:"Delete All Left",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(t,i){let e=null;const s=[];let n=0;return i.forEach((i=>{let r;if(1===i.endColumn&&n>0){const t=i.startLineNumber-n;r=new ys(t,i.startColumn,t,i.startColumn)}else r=new ys(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn);n+=i.endLineNumber-i.startLineNumber,i.intersectRanges(t)?e=r:s.push(r)})),e&&s.unshift(e),s}_getRangesToDelete(t){const i=t.getSelections();if(null===i)return[];let e=i;const s=t.getModel();return null===s?[]:(e.sort(bs.compareRangesUsingStarts),e=e.map((t=>{if(t.isEmpty()){if(1===t.startColumn){const i=Math.max(1,t.startLineNumber-1),e=1===t.startLineNumber?1:s.getLineLength(i)+1;return new bs(i,e,t.startLineNumber,1)}return new bs(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new bs(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),Xa(class extends O9{constructor(){super({id:"deleteAllRight",label:Q(0,"Delete All Right"),alias:"Delete All Right",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(t,i){let e=null;const s=[];for(let n=0,r=i.length,o=0;n<r;n++){const r=i[n],h=new ys(r.startLineNumber-o,r.startColumn,r.startLineNumber-o,r.startColumn);r.intersectRanges(t)?e=h:s.push(h)}return e&&s.unshift(e),s}_getRangesToDelete(t){const i=t.getModel();if(null===i)return[];const e=t.getSelections();if(null===e)return[];const s=e.map((t=>{if(t.isEmpty()){const e=i.getLineMaxColumn(t.startLineNumber);return t.startColumn===e?new bs(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new bs(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(bs.compareRangesUsingStarts),s}}),Xa(class extends Ga{constructor(){super({id:"editor.action.joinLines",label:Q(0,"Join Lines"),alias:"Join Lines",precondition:PS.writable,kbOpts:{kbExpr:PS.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(t,i){const e=i.getSelections();if(null===e)return;let s=i.getSelection();if(null===s)return;e.sort(bs.compareRangesUsingStarts);const n=[],r=e.reduce(((t,i)=>t.isEmpty()?t.endLineNumber===i.startLineNumber?(s.equalsSelection(t)&&(s=i),i):i.startLineNumber>t.endLineNumber+1?(n.push(t),i):new ys(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new ys(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let l=s,a=0;for(let t=0,i=n.length;t<i;t++){const i=n[t],e=i.startLineNumber,r=1;let u,d,f=0;const g=o.getLineLength(i.endLineNumber)-i.endColumn;if(i.isEmpty()||i.startLineNumber===i.endLineNumber){const t=i.getStartPosition();t.lineNumber<o.getLineCount()?(u=e+1,d=o.getLineMaxColumn(u)):(u=t.lineNumber,d=o.getLineMaxColumn(t.lineNumber))}else u=i.endLineNumber,d=o.getLineMaxColumn(u);let p=o.getLineContent(e);for(let t=e+1;t<=u;t++){const i=o.getLineContent(t),e=o.getLineFirstNonWhitespaceColumn(t);if(e>=1){let t=!0;""===p&&(t=!1),!t||" "!==p.charAt(p.length-1)&&"\t"!==p.charAt(p.length-1)||(t=!1,p=p.replace(/[\s\uFEFF\xA0]+$/g," "));const s=i.substr(e-1);p+=(t?" ":"")+s,f=t?s.length+1:s.length}else f=0}const m=new bs(e,r,u,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(QR.replace(m,p)),t=new ys(m.startLineNumber-a,p.length-f+1,e-a,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(QR.replace(m,p)),t=new ys(i.startLineNumber-a,i.startColumn,i.endLineNumber-a,i.endColumn)):(h.push(QR.replace(m,p)),t=new ys(i.startLineNumber-a,i.startColumn,i.startLineNumber-a,p.length-g)),null!==bs.intersectRanges(m,s)?l=t:c.push(t)}a+=m.endLineNumber-m.startLineNumber}c.unshift(l),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),Xa(class extends Ga{constructor(){super({id:"editor.action.transpose",label:Q(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:PS.writable})}run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!i.isEmpty())continue;const r=i.getStartPosition(),o=s.getLineMaxColumn(r.lineNumber);if(r.column>=o){if(r.lineNumber===s.getLineCount())continue;const t=new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new oS(new ys(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new aS(t,i,new ys(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),Xa(class extends _9{constructor(){super({id:"editor.action.transformToUppercase",label:Q(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:PS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),Xa(class extends _9{constructor(){super({id:"editor.action.transformToLowercase",label:Q(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:PS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),N9.caseBoundary.isSupported()&&N9.singleLetters.isSupported()&&Xa(N9),B9.wordBoundary.isSupported()&&Xa(B9),P9.titleBoundary.isSupported()&&Xa(P9),$9.isSupported()&&Xa($9);var W9,j9=function(t,i){return function(e,s){i(e,s,t)}};const V9=new Xo("LinkedEditingInputVisible",!1);let H9=W9=class extends Ki{static get(t){return t.getContribution(W9.ID)}constructor(t,i,e,s,n){super(),this.languageConfigurationService=s,this._syncRangesToken=0,this._localToDispose=this._register(new Ui),this._editor=t,this._providers=e.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=V9.bindTo(i),this._debounceInformation=n.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new Ui),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequest=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel((()=>this.reinitialize(!0)))),this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(69)||t.hasChanged(92))&&this.reinitialize(!1)}))),this._register(this._providers.onDidChange((()=>this.reinitialize(!1)))),this._register(this._editor.onDidChangeModelLanguage((()=>this.reinitialize(!0)))),this.reinitialize(!0)}reinitialize(t){const i=this._editor.getModel(),e=null!==i&&(this._editor.getOption(69)||this._editor.getOption(92))&&this._providers.has(i);if(e===this._enabled&&!t)return;if(this._enabled=e,this.clearRanges(),this._localToDispose.clear(),!e||null===i)return;this._localToDispose.add(Xi.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new Yh(this._debounceInformation.get(i)),n=()=>{var t;this._rangeUpdateTriggerPromise=s.trigger((()=>this.updateRanges()),null!==(t=this._debounceDuration)&&void 0!==t?t:this._debounceInformation.get(i))},r=new Yh(0),o=t=>{this._rangeSyncTriggerPromise=r.trigger((()=>this._syncRanges(t)))};this._localToDispose.add(this._editor.onDidChangeCursorPosition((()=>{n()}))),this._localToDispose.add(this._editor.onDidChangeModelContent((t=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const i=this._currentDecorations.getRange(0);if(i&&t.changes.every((t=>i.intersectRanges(t.range))))return void o(this._syncRangesToken)}n()}))),this._localToDispose.add({dispose:()=>{s.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(t){if(!this._editor.hasModel()||t!==this._syncRangesToken||0===this._currentDecorations.length)return;const i=this._editor.getModel(),e=this._currentDecorations.getRange(0);if(!e||e.startLineNumber!==e.endLineNumber)return this.clearRanges();const s=i.getValueInRange(e);if(this._currentWordPattern){const t=s.match(this._currentWordPattern);if((t?t[0].length:0)!==s.length)return this.clearRanges()}const n=[];for(let t=1,e=this._currentDecorations.length;t<e;t++){const e=this._currentDecorations.getRange(t);if(e)if(e.startLineNumber!==e.endLineNumber)n.push({range:e,text:s});else{let t=i.getValueInRange(e),r=s,o=e.startColumn,h=e.endColumn;const c=sr(t,r);o+=c,t=t.substr(c),r=r.substr(c);const l=nr(t,r);h-=l,t=t.substr(0,t.length-l),r=r.substr(0,r.length-l),o===h&&0===r.length||n.push({range:new bs(e.startLineNumber,o,e.endLineNumber,h),text:r})}}if(0!==n.length)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const t=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",n),this._editor._getViewModel().setPrevEditOperationType(t)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequest&&(this._currentRequest.cancel(),this._currentRequest=null,this._currentRequestPosition=null)}async updateRanges(t=!1){if(!this._editor.hasModel())return void this.clearRanges();const i=this._editor.getPosition();if(!this._enabled&&!t||this._editor.getSelections().length>1)return void this.clearRanges();const e=this._editor.getModel(),s=e.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===s){if(i.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(i))return}}this.clearRanges(),this._currentRequestPosition=i,this._currentRequestModelVersion=s;const n=Zh((async t=>{try{const r=new Yi(!1),o=await z9(this._providers,e,i,t);if(this._debounceInformation.update(e,r.elapsed()),n!==this._currentRequest)return;if(this._currentRequest=null,s!==e.getVersionId())return;let h=[];(null==o?void 0:o.ranges)&&(h=o.ranges),this._currentWordPattern=(null==o?void 0:o.wordPattern)||this._languageWordPattern;let c=!1;for(let t=0,e=h.length;t<e;t++)if(bs.containsPosition(h[t],i)){if(c=!0,0!==t){const i=h[t];h.splice(t,1),h.unshift(i)}break}if(!c)return void this.clearRanges();const l=h.map((t=>({range:t,options:W9.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Li(t),this._currentRequest!==n&&this._currentRequest||this.clearRanges()}}));return this._currentRequest=n,n}};function z9(t,i,e,s){return ec(t.ordered(i).map((t=>async()=>{try{return await t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Fi(t)}})),(t=>!!t&&u(null==t?void 0:t.ranges)))}H9.ID="editor.contrib.linkedEditing",H9.DECORATION=aL.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),H9=W9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j9(1,th),j9(2,op),j9(3,Nd),j9(4,YT)],H9),Ya(new(qa.bindToContribution(H9.get))({id:"cancelLinkedEditingInput",precondition:V9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:PS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Jm("editor.linkedEditingBackground",{dark:Gg.fromHex("#f00").transparent(.3),light:Gg.fromHex("#f00").transparent(.3),hcDark:Gg.fromHex("#f00").transparent(.3),hcLight:Gg.white},Q(0,"Background color when the editor auto renames on type.")),Qa("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(op);return z9(s,i,e,fe.None)})),iu(H9.ID,H9,1),Xa(class extends Ga{constructor(){super({id:"editor.action.linkedEditing",label:Q(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Oo.and(PS.writable,PS.hasRenameProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(so),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return hs.isUri(s)&&vs.isIPosition(n)?e.openCodeEditor({resource:s},e.getActiveCodeEditor()).then((t=>{t&&(t.setPosition(n),t.invokeWithinContext((i=>(this.reportTelemetry(i,t),this.run(i,t)))))}),Li):super.runCommand(t,i)}run(t,i){const e=H9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});class U9{constructor(t,i){this._link=t,this._provider=i}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(t){return this._link.url?this._link.url:"function"==typeof this._provider.resolveLink?Promise.resolve(this._provider.resolveLink(this._link,t)).then((i=>(this._link=i||this._link,this._link.url?this.resolve(t):Promise.reject(new Error("missing"))))):Promise.reject(new Error("missing"))}}class K9{constructor(t){this._disposables=new Ui;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new U9(t,s)));i=K9._union(i,t),ji(e)&&this._disposables.add(e)}this.links=i}dispose(){this._disposables.dispose(),this.links.length=0}static _union(t,i){const e=[];let s,n,r,o;for(s=0,r=0,n=t.length,o=i.length;s<n&&r<o;){const n=t[s],o=i[r];bs.areIntersectingOrTouching(n.range,o.range)?s++:bs.compareRangesUsingStarts(n.range,o.range)<0?(e.push(n),s++):(e.push(o),r++)}for(;s<n;s++)e.push(t[s]);for(;r<o;r++)e.push(i[r]);return e}}function q9(t,i,e){const s=[],n=t.ordered(i).reverse().map(((t,n)=>Promise.resolve(t.provideLinks(i,e)).then((i=>{i&&(s[n]=[i,t])}),Fi)));return Promise.all(n).then((()=>{const t=new K9(c(s));return e.isCancellationRequested?(t.dispose(),new K9([])):t}))}mo.registerCommand("_executeLinkProvider",(async(t,...i)=>{let[e,s]=i;B(e instanceof hs),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(op),r=t.get(no).getModel(e);if(!r)return[];const o=await q9(n,r,fe.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)await o.links[t].resolve(fe.None);const h=o.links.slice(0);return o.dispose(),h}));var G9,Z9=function(t,i){return function(e,s){i(e,s,t)}};let J9=G9=class extends Ki{static get(t){return t.getContribution(G9.ID)}constructor(t,i,e,s,n){super(),this.editor=t,this.openerService=i,this.notificationService=e,this.languageFeaturesService=s,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=n.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new rc((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new AQ(t));this._register(r.onMouseMoveOrRelevantKeyDown((([t,i])=>{this._onEditorMouseMove(t,i)}))),this._register(r.onExecute((t=>{this.onEditorMouseUp(t)}))),this._register(r.onCancel((()=>{this.cleanUpActiveLinkDecoration()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(70)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))}))),this._register(t.onDidChangeModelContent((()=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))}))),this._register(t.onDidChangeModel((()=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)}))),this._register(t.onDidChangeModelLanguage((()=>{this.stop(),this.computeLinks.schedule(0)}))),this._register(this.providers.onDidChange((()=>{this.stop(),this.computeLinks.schedule(0)}))),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(70))return;const t=this.editor.getModel();if(!t.isTooLargeForSyncing()&&this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Zh((i=>q9(this.providers,t,i)));try{const i=new Yi(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(t,i.elapsed()),t.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Li(t)}finally{this.computePromise=null}}}updateDecorations(t){const i="altKey"===this.editor.getOption(77),e=[],s=Object.keys(this.currentOccurrences);for(const t of s)e.push(this.currentOccurrences[t].decorationId);const n=[];if(t)for(const e of t)n.push(X9.decoration(e,i));this.editor.changeDecorations((i=>{const s=i.deltaDecorations(e,n);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let i=0,e=s.length;i<e;i++){const e=new X9(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(77);if(this.isEnabled(t,i)){this.cleanUpActiveLinkDecoration();const i=this.getLinkOccurrence(t.target.position);i&&this.editor.changeDecorations((t=>{i.activate(t,e),this.activeLinkDecorationId=i.decorationId}))}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const t="altKey"===this.editor.getOption(77);if(this.activeLinkDecorationId){const i=this.currentOccurrences[this.activeLinkDecorationId];i&&this.editor.changeDecorations((e=>{i.deactivate(e,t)})),this.activeLinkDecorationId=null}}onEditorMouseUp(t){if(!this.isEnabled(t))return;const i=this.getLinkOccurrence(t.target.position);i&&this.openLinkOccurrence(i,t.hasSideBySideModifier,!0)}openLinkOccurrence(t,i,e=!1){if(!this.openerService)return;const{link:s}=t;s.resolve(fe.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===dl.file&&t.startsWith(`${dl.file}:`)){const e=hs.parse(t);if(e.scheme===dl.file){const s=YE(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=rA(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:e,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(Q(0,"Failed to open this link because it is not well-formed: {0}",s.url.toString())):"missing"===i?this.notificationService.warn(Q(0,"Failed to open this link because its target is missing.")):Li(t)}))}getLinkOccurrence(t){if(!this.editor.hasModel()||!t)return null;const i=this.editor.getModel().getDecorationsInRange({startLineNumber:t.lineNumber,startColumn:t.column,endLineNumber:t.lineNumber,endColumn:t.column},0,!0);for(const t of i){const i=this.currentOccurrences[t.id];if(i)return i}return null}isEnabled(t,i){return Boolean(6===t.target.type&&(t.hasTriggerModifier||i&&i.keyCodeIsTriggerKey))}stop(){var t;this.computeLinks.cancel(),this.activeLinksList&&(null===(t=this.activeLinksList)||void 0===t||t.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};J9.ID="editor.linkDetector",J9=G9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Z9(1,ZN),Z9(2,VF),Z9(3,op),Z9(4,YT)],J9);const Q9=aL.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),Y9=aL.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"});class X9{static decoration(t,i){return{range:t.range,options:X9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s={...e?Y9:Q9};return s.hoverMessage=function(t,i){const e=t.url&&/^command:/i.test(t.url.toString()),s=t.tooltip?t.tooltip:Q(0,e?"Execute command":"Follow link"),n=Q(0,i?pt?"cmd + click":"ctrl + click":pt?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const e=t.url.toString().match(/^command:([^?#]+)/);e&&(i=Q(0,"Execute command {0}",e[1]))}return new bI("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),s,i).appendMarkdown(` (${n})`)}return(new bI).appendText(`${s} (${n})`)}(t,i),s}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,X9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,X9._getOptions(this.link,i,!1))}}iu(J9.ID,J9,1),Xa(class extends Ga{constructor(){super({id:"editor.action.openLink",label:Q(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=J9.get(i);if(!e)return;if(!i.hasModel())return;const s=i.getSelections();for(const t of s){const i=e.getLinkOccurrence(t.getEndPosition());i&&e.openLinkOccurrence(i,!1)}}});class t7 extends Ki{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(116);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}t7.ID="editor.contrib.longLinesHelper",iu(t7.ID,t7,2);const i7=Jm("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},Q(0,"Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);Jm("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},Q(0,"Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0),Jm("editor.wordHighlightTextBackground",{light:i7,dark:i7,hcDark:i7,hcLight:i7},Q(0,"Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const e7=Jm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:ew,hcLight:ew},Q(0,"Border color of a symbol during read-access, like reading a variable."));Jm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:ew,hcLight:ew},Q(0,"Border color of a symbol during write-access, like writing to a variable.")),Jm("editor.wordHighlightTextBorder",{light:e7,dark:e7,hcDark:e7,hcLight:e7},Q(0,"Border color of a textual occurrence for a symbol."));const s7=Jm("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},Q(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),n7=Jm("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},Q(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),r7=Jm("editorOverviewRuler.wordHighlightTextForeground",{dark:_b,light:_b,hcDark:_b,hcLight:_b},Q(0,"Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),o7=aL.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Bk(n7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),h7=aL.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Bk(r7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),c7=aL.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Bk(_b),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}}),l7=aL.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),a7=aL.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Bk(s7),position:bf.Center},minimap:{color:Bk(Pb),position:kf.Inline}});function u7(t){return t?l7:c7}Vk(((t,i)=>{const e=t.getColor(uv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var d7;function f7(t,i){const e=i.filter((i=>!t.find((t=>t.equals(i)))));if(e.length>=1){const t=e.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");Sm(Q(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class g7{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class p7{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new p7(t,i,!1,e.searchString,e.wholeWord,e.matchCase,null);let s,n,r=!1;const o=t.getSelections();1===o.length&&o[0].isEmpty()?(r=!0,s=!0,n=!0):(s=e.wholeWord,n=e.matchCase);const h=t.getSelection();let c,l=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,l=new ys(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new p7(t,i,r,c,s,n,l)}constructor(t,i,e,s,n,r,o){this._editor=t,this.findController=i,this.isDisconnectedFromFindController=e,this.searchText=s,this.wholeWord=n,this.matchCase=r,this.currentMatch=o}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.concat(t),t,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.slice(0,i.length-1).concat(t),t,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findNextMatch(this.searchText,i.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ys(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const t=this._getPreviousMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.concat(t),t,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const t=this._getPreviousMatch();if(!t)return null;const i=this._editor.getSelections();return new g7(i.slice(0,i.length-1).concat(t),t,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findPreviousMatch(this.searchText,i.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ys(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}selectAll(t){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();return this._editor.getModel().findMatches(this.searchText,t||!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1,1073741824)}}class m7 extends Ki{static get(t){return t.getContribution(m7.ID)}constructor(t){super(),this._sessionDispose=this._register(new Ui),this._editor=t,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(t){if(!this._session){const i=p7.create(this._editor,t);if(!i)return;this._session=i;const e={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(e.wholeWordOverride=1,e.matchCaseOverride=1,e.isRegexOverride=2),t.getState().change(e,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection((()=>{this._ignoreSelectionChange||this._endSession()}))),this._sessionDispose.add(this._editor.onDidBlurEditorText((()=>{this._endSession()}))),this._sessionDispose.add(t.getState().onFindReplaceStateChange((t=>{(t.matchCase||t.wholeWord)&&this._endSession()})))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const t={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(t,!1)}this._session=null}_setSelections(t){this._ignoreSelectionChange=!0,this._editor.setSelections(t),this._ignoreSelectionChange=!1}_expandEmptyToWord(t,i){if(!i.isEmpty())return i;const e=this._editor.getConfiguredWordAtPosition(i.getStartPosition());return e?new ys(i.startLineNumber,e.startColumn,i.startLineNumber,e.endColumn):i}_applySessionResult(t){t&&(this._setSelections(t.selections),t.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(t.revealRange,t.revealScrollType))}getSession(t){return this._session}addSelectionToNextFindMatch(t){if(this._editor.hasModel()){if(!this._session){const i=this._editor.getSelections();if(i.length>1){const e=t.getState().matchCase;if(!y7(this._editor.getModel(),i,e)){const t=this._editor.getModel(),e=[];for(let s=0,n=i.length;s<n;s++)e[s]=this._expandEmptyToWord(t,i[s]);return void this._editor.setSelections(e)}}}this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(t){if(!this._editor.hasModel())return;let i=null;const e=t.getState();if(e.isRevealed&&e.searchString.length>0&&e.isRegex){i=this._editor.getModel().findMatches(e.searchString,!e.searchScope||e.searchScope,e.isRegex,e.matchCase,e.wholeWord?this._editor.getOption(129):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(t),!this._session)return;i=this._session.selectAll(e.searchScope)}if(i.length>0){const t=this._editor.getSelection();for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s.range.intersectRanges(t)){i[e]=i[0],i[0]=s;break}}this._setSelections(i.map((t=>new ys(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}m7.ID="editor.contrib.multiCursorController";class w7 extends Ga{run(t,i){const e=m7.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=m4.get(i);if(r)this._run(e,r);else{const s=t.get(io).createInstance(m4,i);this._run(e,s),s.dispose()}f7(n,s.getCursorStates())}}}class v7{constructor(t,i,e,s,n){this._model=t,this._searchText=i,this._matchCase=e,this._wordSeparators=s,this._modelVersionId=this._model.getVersionId(),this._cachedFindMatches=null,n&&this._model===n._model&&this._searchText===n._searchText&&this._matchCase===n._matchCase&&this._wordSeparators===n._wordSeparators&&this._modelVersionId===n._modelVersionId&&(this._cachedFindMatches=n._cachedFindMatches)}findMatches(){return null===this._cachedFindMatches&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map((t=>t.range)),this._cachedFindMatches.sort(bs.compareRangesUsingStarts)),this._cachedFindMatches}}let b7=d7=class extends Ki{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(107),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new rc((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(107)}))),this._register(t.onDidChangeCursorSelection((t=>{this._isEnabled&&(t.selection.isEmpty()?3===t.reason?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())}))),this._register(t.onDidChangeModel((()=>{this._setState(null)}))),this._register(t.onDidChangeModelContent((()=>{this._isEnabled&&this.updateSoon.schedule()})));const e=m4.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(d7._createState(this.state,this._isEnabled,this.editor))}static _createState(t,i,e){if(!i)return null;if(!e.hasModel())return null;const s=e.getSelection();if(s.startLineNumber!==s.endLineNumber)return null;const n=m7.get(e);if(!n)return null;const r=m4.get(e);if(!r)return null;let o=n.getSession(r);if(!o){const t=e.getSelections();if(t.length>1){const i=r.getState().matchCase;if(!y7(e.getModel(),t,i))return null}o=p7.create(e,r)}if(!o)return null;if(o.currentMatch)return null;if(/^[ \t]+$/.test(o.searchText))return null;if(o.searchText.length>200)return null;const h=r.getState(),c=h.matchCase;if(h.isRevealed){let t=h.searchString;c||(t=t.toLowerCase());let i=o.searchText;if(c||(i=i.toLowerCase()),t===i&&o.matchCase===h.matchCase&&o.wholeWord===h.wholeWord&&!h.isRegex)return null}return new v7(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(129):null,t)}_setState(t){if(this.state=t,!this.state)return void this._decorations.clear();if(!this.editor.hasModel())return;const i=this.editor.getModel();if(i.isTooLargeForTokenization())return;const e=this.state.findMatches(),s=this.editor.getSelections();s.sort(bs.compareRangesUsingStarts);const n=[];for(let t=0,i=0,r=e.length,o=s.length;t<r;){const r=e[t];if(i>=o)n.push(r),t++;else{const e=bs.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&bs.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r="off"!==this.editor.getOption(80),o=this._languageFeaturesService.documentHighlightProvider.has(i)&&r,h=n.map((t=>({range:t,options:u7(o)})));this._decorations.set(h)}dispose(){this._setState(null),super.dispose()}};function y7(t,i,e){const s=k7(t,i[0],!e);for(let n=1,r=i.length;n<r;n++){const r=i[n];if(r.isEmpty())return!1;if(s!==k7(t,r,!e))return!1}return!0}function k7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}b7.ID="editor.contrib.selectionHighlighter",b7=d7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,op)],b7),iu(m7.ID,m7,4),iu(b7.ID,b7,1),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorAbove",label:Q(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"&&Add Cursor Above"),order:2}})}run(t,i,e){if(!i.hasModel())return;let s=!0;e&&!1===e.logicalLine&&(s=!1);const n=i._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const r=n.getCursorStates();n.setCursorStates(e.source,3,wS.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorBelow",label:Q(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"A&&dd Cursor Below"),order:3}})}run(t,i,e){if(!i.hasModel())return;let s=!0;e&&!1===e.logicalLine&&(s=!1);const n=i._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const r=n.getCursorStates();n.setCursorStates(e.source,3,wS.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:Q(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(t,i,e){if(!t.isEmpty()){for(let s=t.startLineNumber;s<t.endLineNumber;s++){const t=i.getLineMaxColumn(s);e.push(new ys(s,t,s,t))}t.endColumn>1&&e.push(new ys(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn))}}run(t,i){if(!i.hasModel())return;const e=i.getModel(),s=i.getSelections(),n=i._getViewModel(),r=n.getCursorStates(),o=[];s.forEach((t=>this.getCursorsForSelection(t,e,o))),o.length>0&&i.setSelections(o),f7(r,n.getCursorStates())}}),Xa(class extends w7{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:Q(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2082,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:Q(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:Q(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:Ae(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:Q(0,"Move Last Selection To Previous Find Match"),alias:"Move Last Selection To Previous Find Match",precondition:void 0})}_run(t,i){t.moveSelectionToPreviousFindMatch(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.selectHighlights",label:Q(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:3114,weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"3_multi",title:Q(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),Xa(class extends w7{constructor(){super({id:"editor.action.changeAll",label:Q(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Oo.and(PS.writable,PS.editorTextFocus),kbOpts:{kbExpr:PS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),Xa(class extends Ga{constructor(){super({id:"editor.action.addCursorsToBottom",label:Q(0,"Add Cursors To Bottom"),alias:"Add Cursors To Bottom",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getSelections(),s=i.getModel().getLineCount(),n=[];for(let t=e[0].startLineNumber;t<=s;t++)n.push(new ys(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),f7(o,r.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.addCursorsToTop",label:Q(0,"Add Cursors To Top"),alias:"Add Cursors To Top",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getSelections(),s=[];for(let t=e[0].startLineNumber;t>=1;t--)s.push(new ys(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),f7(r,n.getCursorStates())}}),Xa(class extends Ga{constructor(){super({id:"editor.action.focusNextCursor",label:Q(0,"Focus Next Cursor"),metadata:{description:Q(0,"Focuses the next cursor"),args:[]},alias:"Focus Next Cursor",precondition:void 0})}run(t,i,e){if(!i.hasModel())return;const s=i._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const n=Array.from(s.getCursorStates()),r=n.shift();r&&(n.push(r),s.setCursorStates(e.source,3,n),s.revealPrimaryCursor(e.source,!0),f7(n,s.getCursorStates()))}}),Xa(class extends Ga{constructor(){super({id:"editor.action.focusPreviousCursor",label:Q(0,"Focus Previous Cursor"),metadata:{description:Q(0,"Focuses the previous cursor"),args:[]},alias:"Focus Previous Cursor",precondition:void 0})}run(t,i,e){if(!i.hasModel())return;const s=i._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const n=Array.from(s.getCursorStates()),r=n.pop();r&&(n.unshift(r),s.setCursorStates(e.source,3,n),s.revealPrimaryCursor(e.source,!0),f7(n,s.getCursorStates()))}});const C7={Visible:new Xo("parameterHintsVisible",!1),MultipleSignatures:new Xo("parameterHintsMultipleSignatures",!1)};async function S7(t,i,e,s,n){const r=t.ordered(i);for(const t of r)try{const r=await t.provideSignatureHelp(i,e,n,s);if(r)return r}catch(t){Fi(t)}}var x7;mo.registerCommand("_executeSignatureHelpProvider",(async(t,...i)=>{const[e,s,n]=i;B(hs.isUri(e)),B(vs.isIPosition(s)),B("string"==typeof n||!n);const r=t.get(op),o=await t.get(ro).createModelReference(e);try{const t=await S7(r.signatureHelpProvider,o.object.textEditorModel,vs.lift(s),{triggerKind:Ts.Invoke,isRetrigger:!1,triggerCharacter:n},fe.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}})),function(t){t.Default={type:0},t.Pending=class{constructor(t,i){this.request=t,this.previouslyActiveHints=i,this.type=2}},t.Active=class{constructor(t){this.hints=t,this.type=1}}}(x7||(x7={}));class D7 extends Ki{constructor(t,i,e=D7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ne),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=x7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new qi),this.triggerChars=new af,this.retriggerChars=new af,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new Yh(e),this._register(this.editor.onDidBlurEditorWidget((()=>this.cancel()))),this._register(this.editor.onDidChangeConfiguration((()=>this.onEditorConfigurationChange()))),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeModelLanguage((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeCursorSelection((t=>this.onCursorChange(t)))),this._register(this.editor.onDidChangeModelContent((()=>this.onModelContentChange()))),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType((t=>this.onDidType(t)))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(t){2===this._state.type&&this._state.request.cancel(),this._state=t}cancel(t=!1){this.state=x7.Default,this.throttledDelayer.cancel(),t||this._onChangedHints.fire(void 0)}trigger(t,i){const e=this.editor.getModel();if(!e||!this.providers.has(e))return;const s=++this.triggerId;this._pendingTriggers.push(t),this.throttledDelayer.trigger((()=>this.doTrigger(s)),i).catch(Li)}next(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=i%t==t-1,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?0:i+1):this.cancel()}previous(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=0===i,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new x7.Active({...this.state.hints,activeSignature:t}),this._onChangedHints.fire(this.state.hints))}async doTrigger(t){const i=1===this.state.type||2===this.state.type,e=this.getLastActiveHints();if(this.cancel(!0),0===this._pendingTriggers.length)return!1;const s=this._pendingTriggers.reduce(E7);this._pendingTriggers=[];const n={triggerKind:s.triggerKind,triggerCharacter:s.triggerCharacter,isRetrigger:i,activeSignatureHelp:e};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),o=this.editor.getPosition();this.state=new x7.Pending(Zh((t=>S7(this.providers,r,o,n,t))),e);try{const i=await this.state.request;return t!==this.triggerId?(null==i||i.dispose(),!1):i&&i.value.signatures&&0!==i.value.signatures.length?(this.state=new x7.Active(i.value),this._lastSignatureHelpResult.value=i,this._onChangedHints.fire(this.state.hints),!0):(null==i||i.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1)}catch(i){return t===this.triggerId&&(this.state=x7.Default),Li(i),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return 1===this.state.type||2===this.state.type||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const t=this.editor.getModel();if(t)for(const i of this.providers.ordered(t)){for(const t of i.signatureHelpTriggerCharacters||[])if(t.length){const i=t.charCodeAt(0);this.triggerChars.add(i),this.retriggerChars.add(i)}for(const t of i.signatureHelpRetriggerCharacters||[])t.length&&this.retriggerChars.add(t.charCodeAt(0))}}onDidType(t){if(!this.triggerOnType)return;const i=t.length-1,e=t.charCodeAt(i);(this.triggerChars.has(e)||this.isTriggered&&this.retriggerChars.has(e))&&this.trigger({triggerKind:Ts.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ts.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ts.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(85).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function E7(t,i){switch(i.triggerKind){case Ts.Invoke:return i;case Ts.ContentChange:return t;default:return i}}D7.DEFAULT_DELAY=120;var A7,M7=function(t,i){return function(e,s){i(e,s,t)}};const L7=Fa,F7=AV("parameter-hints-next",xs.chevronDown,Q(0,"Icon for show next parameter hint.")),T7=AV("parameter-hints-previous",xs.chevronUp,Q(0,"Icon for show previous parameter hint."));let R7=A7=class extends Ki{constructor(t,i,e,s,n){super(),this.editor=t,this.model=i,this.renderDisposeables=this._register(new Ui),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new GZ({editor:t},n,s)),this.keyVisible=C7.Visible.bindTo(e),this.keyMultipleSignatures=C7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=L7(".editor-widget.parameter-hints-widget"),i=xa(t,L7(".phwrapper"));i.tabIndex=-1;const e=xa(i,L7(".controls")),s=xa(e,L7(".button"+go.asCSSSelector(T7))),n=xa(e,L7(".overloads")),r=xa(e,L7(".button"+go.asCSSSelector(F7)));this._register(Il(s,"click",(t=>{ka(t),this.previous()}))),this._register(Il(r,"click",(t=>{ka(t),this.next()})));const o=L7(".body"),h=new pk(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=xa(o,L7(".signature")),l=xa(o,L7(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:l,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const a=()=>{if(!this.domNodes)return;const t=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};a(),this._register(Xi.chain(this.editor.onDidChangeConfiguration.bind(this.editor),(t=>t.filter((t=>t.hasChanged(50)))))(a)),this._register(this.editor.onDidLayoutChange((()=>this.updateMaxHeight()))),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout((()=>{var t;null===(t=this.domNodes)||void 0===t||t.element.classList.add("visible")}),100),this.editor.layoutContentWidget(this))}hide(){var t;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,null===(t=this.domNodes)||void 0===t||t.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(t){var i;if(this.renderDisposeables.clear(),!this.domNodes)return;const e=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",e),this.keyMultipleSignatures.set(e),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const s=t.signatures[t.activeSignature];if(!s)return;const n=xa(this.domNodes.signature,L7(".code")),r=this.editor.getOption(50);n.style.fontSize=`${r.fontSize}px`,n.style.fontFamily=r.fontFamily;const o=null!==(i=s.activeParameter)&&void 0!==i?i:t.activeParameter;s.parameters.length>0?this.renderParameters(n,s,o):xa(n,L7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=L7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}xa(this.domNodes.docs,L7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)xa(this.domNodes.docs,L7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);xa(this.domNodes.docs,t.element)}const c=this.hasDocs(s,h);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,h){let t="";const i=s.parameters[o];t=Array.isArray(i.label)?s.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),s.documentation&&(t+="string"==typeof s.documentation?`, ${s.documentation}`:`, ${s.documentation.value}`),this.announcedLabel!==t&&(Cm(Q(0,"{0}, hint",t)),this.announcedLabel=t)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(t){const i=this.renderDisposeables.add(this.markdownRenderer.render(t,{asyncRenderCallback:()=>{var t;null===(t=this.domNodes)||void 0===t||t.scrollbar.scanDomNode()}}));return i.element.classList.add("markdown-docs"),i}hasDocs(t,i){return!!(i&&"string"==typeof i.documentation&&$(i.documentation).length>0||i&&"object"==typeof i.documentation&&$(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&$(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&$(t.documentation.value).length>0)}renderParameters(t,i,e){const[s,n]=this.getParameterLabelOffsets(i,e),r=document.createElement("span");r.textContent=i.label.substring(0,s);const o=document.createElement("span");o.textContent=i.label.substring(s,n),o.className="parameter active";const h=document.createElement("span");h.textContent=i.label.substring(n),xa(t,r,o,h)}getParameterLabelOffsets(t,i){const e=t.parameters[i];if(e){if(Array.isArray(e.label))return e.label;if(e.label.length){const i=new RegExp(`(\\W|^)${$n(e.label)}(?=\\W|$)`,"g");i.test(t.label);const s=i.lastIndex-e.label.length;return s>=0?[s,i.lastIndex]:[0,0]}return[0,0]}return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return A7.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}};R7.ID="editor.widget.parameterHintsWidget",R7=A7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M7(2,th),M7(3,ZN),M7(4,ud)],R7),Jm("editorHoverWidget.highlightForeground",{dark:Gv,light:Gv,hcDark:Gv,hcLight:Gv},Q(0,"Foreground color of the active item in the parameter hint."));var O7,_7=function(t,i){return function(e,s){i(e,s,t)}};let I7=O7=class extends Ki{static get(t){return t.getContribution(O7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new D7(t,e.signatureHelpProvider)),this._register(this.model.onChangedHints((t=>{var i;t?(this.widget.value.show(),this.widget.value.render(t)):null===(i=this.widget.rawValue)||void 0===i||i.hide()}))),this.widget=new On((()=>this._register(i.createInstance(R7,this.editor,this.model))))}cancel(){this.model.cancel()}previous(){var t;null===(t=this.widget.rawValue)||void 0===t||t.previous()}next(){var t;null===(t=this.widget.rawValue)||void 0===t||t.next()}trigger(t){this.model.trigger(t,0)}};I7.ID="editor.controller.parameterHints",I7=O7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([_7(1,io),_7(2,op)],I7),iu(I7.ID,I7,2),Xa(class extends Ga{constructor(){super({id:"editor.action.triggerParameterHints",label:Q(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:PS.hasSignatureHelpProvider,kbOpts:{kbExpr:PS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=I7.get(i);null==e||e.trigger({triggerKind:Ts.Invoke})}});const P7=qa.bindToContribution(I7.get);Ya(new P7({id:"closeParameterHints",precondition:C7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:PS.focus,primary:9,secondary:[1033]}})),Ya(new P7({id:"showPrevParameterHint",precondition:Oo.and(C7.Visible,C7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:PS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),Ya(new P7({id:"showNextParameterHint",precondition:Oo.and(C7.Visible,C7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:PS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var N7=function(t,i){return function(e,s){i(e,s,t)}};const B7=new Xo("renameInputVisible",!1,Q(0,"Whether the rename input widget is visible"));let $7=class{constructor(t,i,e,s,n){this._editor=t,this._acceptKeybindings=i,this._themeService=e,this._keybindingService=s,this._disposables=new Ui,this.allowEditorOverflow=!0,this._visibleContextKey=B7.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._disposables.add(e.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",Q(0,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._input),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(t){var i,e,s,n;if(!this._input||!this._domNode)return;const r=t.getColor(nw),o=t.getColor(rw);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Zw))&&void 0!==i?i:""),this._domNode.style.boxShadow=r?` 0 0 8px 2px ${r}`:"",this._domNode.style.border=o?`1px solid ${o}`:"",this._domNode.style.color=String(null!==(e=t.getColor(hw))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(ow))&&void 0!==s?s:"");const h=t.getColor(cw);this._input.style.borderWidth=h?"1px":"0px",this._input.style.borderStyle=h?"solid":"none",this._input.style.borderColor=null!==(n=null==h?void 0:h.toString())&&void 0!==n?n:"none"}_updateFont(){if(!this._input||!this._label)return;const t=this._editor.getOption(50);this._input.style.fontFamily=t.fontFamily,this._input.style.fontWeight=t.fontWeight,this._input.style.fontSize=`${t.fontSize}px`,this._label.style.fontSize=.8*t.fontSize+"px"}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}beforeRender(){var t,i;const[e,s]=this._acceptKeybindings;return this._label.innerText=Q(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(e))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(s))||void 0===i?void 0:i.getLabel()),null}afterRender(t){t||this.cancelInput(!0)}acceptInput(t){var i;null===(i=this._currentAcceptInput)||void 0===i||i.call(this,t)}cancelInput(t){var i;null===(i=this._currentCancelInput)||void 0===i||i.call(this,t)}getInput(t,i,e,s,n,r){this._domNode.classList.toggle("preview",n),this._position=new vs(t.startLineNumber,t.startColumn),this._input.value=i,this._input.setAttribute("selectionStart",e.toString()),this._input.setAttribute("selectionEnd",s.toString()),this._input.size=Math.max(1.1*(t.endColumn-t.startColumn),20);const o=new Ui;return new Promise((t=>{this._currentCancelInput=i=>(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,t(i),!0),this._currentAcceptInput=e=>{0!==this._input.value.trim().length&&this._input.value!==i?(this._currentAcceptInput=void 0,this._currentCancelInput=void 0,t({newName:this._input.value,wantsPreview:n&&e})):this.cancelInput(!0)},o.add(r.onCancellationRequested((()=>this.cancelInput(!0)))),o.add(this._editor.onDidBlurEditorWidget((()=>{var t;return this.cancelInput(!(null===(t=this._domNode)||void 0===t?void 0:t.ownerDocument.hasFocus()))}))),this._show()})).finally((()=>{o.dispose(),this._hide()}))}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout((()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))}),100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};$7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([N7(2,Nk),N7(3,HC),N7(4,th)],$7);var W7,j7=function(t,i){return function(e,s){i(e,s,t)}};class V7{constructor(t,i,e){this.model=t,this.position=i,this._providerRenameIdx=0,this._providers=e.ordered(t)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(t){const i=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const e=this._providers[this._providerRenameIdx];if(!e.resolveRenameLocation)break;const s=await e.resolveRenameLocation(this.model,this.position,t);if(s){if(!s.rejectReason)return s;i.push(s.rejectReason)}}this._providerRenameIdx=0;const e=this.model.getWordAtPosition(this.position);return e?{range:new bs(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:bs.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}async provideRenameEdits(t,i){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}async _provideRenameEdits(t,i,e,s){const n=this._providers[i];if(!n)return{edits:[],rejectReason:e.join("\n")};const r=await n.provideRenameEdits(this.model,this.position,t,s);return r?r.rejectReason?this._provideRenameEdits(t,i+1,e.concat(r.rejectReason),s):r:this._provideRenameEdits(t,i+1,e.concat(Q(0,"No result.")),s)}}let H7=W7=class{static get(t){return t.getContribution(W7.ID)}constructor(t,i,e,s,n,r,o,h){this.editor=t,this._instaService=i,this._notificationService=e,this._bulkEditService=s,this._progressService=n,this._logService=r,this._configService=o,this._languageFeaturesService=h,this._disposableStore=new Ui,this._cts=new pe,this._renameInputField=this._disposableStore.add(this._instaService.createInstance($7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){var t,i;if(this._cts.dispose(!0),this._cts=new pe,!this.editor.hasModel())return;const e=this.editor.getPosition(),s=new V7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new hq(this.editor,5,void 0,this._cts.token);let r;try{const t=s.resolveRenameLocation(n.token);this._progressService.showWhile(t,250),r=await t}catch(i){return void(null===(t=XZ.get(this.editor))||void 0===t||t.showMessage(i||Q(0,"An unknown error occurred while resolving rename location"),e))}finally{n.dispose()}if(!r)return;if(r.rejectReason)return void(null===(i=XZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new hq(this.editor,5,r.range,this._cts.token),h=this.editor.getSelection();let c=0,l=r.text.length;bs.isEmpty(h)||bs.spansMultipleLines(h)||!bs.containsRange(r.range,h)||(c=Math.max(0,h.startColumn-r.range.startColumn),l=Math.min(r.range.endColumn,h.endColumn)-r.range.startColumn);const a=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameInputField.getInput(r.range,r.text,c,l,a,o.token);if("boolean"==typeof u)return u&&this.editor.focus(),void o.dispose();this.editor.focus();const d=Jh(s.provideRenameEdits(u.newName,o.token),o.token).then((async t=>{t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(bs.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:u.wantsPreview,label:Q(0,"Renaming '{0}' to '{1}'",null==r?void 0:r.text,u.newName),code:"undoredo.rename",quotableLabel:Q(0,"Renaming {0} to {1}",null==r?void 0:r.text,u.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&Cm(Q(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,u.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(Q(0,"Rename failed to apply edits")),this._logService.error(t)}))))}),(t=>{this._notificationService.error(Q(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{o.dispose()}));return this._progressService.showWhile(d,250),d}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};H7.ID="editor.contrib.renameController",H7=W7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j7(1,io),j7(2,VF),j7(3,jR),j7(4,DO),j7(5,Rh),j7(6,np),j7(7,op)],H7),iu(H7.ID,H7,4),Xa(class extends Ga{constructor(){super({id:"editor.action.rename",label:Q(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Oo.and(PS.writable,PS.hasRenameProvider),kbOpts:{kbExpr:PS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(so),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return hs.isUri(s)&&vs.isIPosition(n)?e.openCodeEditor({resource:s},e.getActiveCodeEditor()).then((t=>{t&&(t.setPosition(n),t.invokeWithinContext((i=>(this.reportTelemetry(i,t),this.run(i,t)))))}),Li):super.runCommand(t,i)}run(t,i){const e=H7.get(i);return e?e.run():Promise.resolve()}});const z7=qa.bindToContribution(H7.get);function U7(t){const i=new Uint32Array(function(t){let i=0;if(i+=2,"full"===t.type)i+=1+t.data.length;else{i+=1,i+=3*t.deltas.length;for(const e of t.deltas)e.data&&(i+=e.data.length)}return i}(t));let e=0;if(i[e++]=t.id,"full"===t.type)i[e++]=1,i[e++]=t.data.length,i.set(t.data,e),e+=t.data.length;else{i[e++]=2,i[e++]=t.deltas.length;for(const s of t.deltas)i[e++]=s.start,i[e++]=s.deleteCount,s.data?(i[e++]=s.data.length,i.set(s.data,e),e+=s.data.length):i[e++]=0}return function(t){const i=new Uint8Array(t.buffer,t.byteOffset,4*t.length);return Lt()||function(t){for(let i=0,e=t.length;i<e;i+=4){const e=t[i+0],s=t[i+1],n=t[i+2];t[i+0]=t[i+3],t[i+1]=n,t[i+2]=s,t[i+3]=e}}(i),Pu.wrap(i)}(i)}function K7(t){return t&&!!t.data}function q7(t){return t&&Array.isArray(t.edits)}Ya(new z7({id:"acceptRenameInput",precondition:B7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:3}})),Ya(new z7({id:"acceptRenameInputWithPreview",precondition:Oo.and(B7,Oo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Oo.and(PS.focus,Oo.not("isComposing")),primary:1027}})),Ya(new z7({id:"cancelRenameInput",precondition:B7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:PS.focus,primary:9,secondary:[1033]}})),Qa("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get(op);return async function(t,i,e,s){const n=new V7(i,e,t),r=await n.resolveRenameLocation(fe.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,fe.None)}(r,i,e,n)})),Qa("_executePrepareRename",(async function(t,i,e){const{renameProvider:s}=t.get(op),n=new V7(i,e,s),r=await n.resolveRenameLocation(fe.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r})),mh.as(bd).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:Q(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});class G7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function Z7(t,i){return t.has(i)}async function J7(t,i,e,s,n){const r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}(t,i),o=await Promise.all(r.map((async t=>{let r,o=null;try{r=await t.provideDocumentSemanticTokens(i,t===e?s:null,n)}catch(t){o=t,r=null}return r&&(K7(r)||q7(r))||(r=null),new G7(t,r,o)})));for(const t of o){if(t.error)throw t.error;if(t.tokens)return t}return o.length>0?o[0]:null}class Q7{constructor(t,i){this.provider=t,this.tokens=i}}function Y7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}async function X7(t,i,e,s){const n=Y7(t,i),r=await Promise.all(n.map((async t=>{let n;try{n=await t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Fi(t),n=null}return n&&K7(n)||(n=null),new Q7(t,n)})));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}mo.registerCommand("_provideDocumentSemanticTokensLegend",(async(t,...i)=>{const[e]=i;B(e instanceof hs);const s=t.get(no).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(op),r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:null}(n,s);return r?r[0].getLegend():t.get(po).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})),mo.registerCommand("_provideDocumentSemanticTokens",(async(t,...i)=>{const[e]=i;B(e instanceof hs);const s=t.get(no).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(op);if(!Z7(n,s))return t.get(po).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=await J7(n,s,null,null,fe.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!K7(h))return;const c=U7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})),mo.registerCommand("_provideDocumentRangeSemanticTokensLegend",(async(t,...i)=>{const[e,s]=i;B(e instanceof hs);const n=t.get(no).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(op),o=Y7(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!bs.isIRange(s))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),o[0].getLegend();const h=await X7(r,n,bs.lift(s),fe.None);return h?h.provider.getLegend():void 0})),mo.registerCommand("_provideDocumentRangeSemanticTokens",(async(t,...i)=>{const[e,s]=i;B(e instanceof hs),B(bs.isIRange(s));const n=t.get(no).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(op),o=await X7(r,n,bs.lift(s),fe.None);return o&&o.tokens?U7({id:0,type:"full",data:o.tokens.data}):void 0}));const t8="editor.semanticHighlighting";function i8(t,i,e){var s;const n=null===(s=e.getValue(t8,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var e8,s8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},n8=function(t,i){return function(e,s){i(e,s,t)}};let r8=class extends Ki{constructor(t,i,e,s,n,r){super(),this._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new o8(i,t,e,n,r)},h=(t,i)=>{i.dispose(),delete this._watchers[t.uri.toString()]},c=()=>{for(const t of i.getModels()){const i=this._watchers[t.uri.toString()];i8(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{i8(t,e,s)&&o(t)}))),this._register(i.onModelRemoved((t=>{const i=this._watchers[t.uri.toString()];i&&h(t,i)}))),this._register(s.onDidChangeConfiguration((t=>{t.affectsConfiguration(t8)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};r8=s8([n8(0,uR),n8(1,no),n8(2,Nk),n8(3,rd),n8(4,YT),n8(5,op)],r8);let o8=e8=class extends Ki{constructor(t,i,e,s,n){super(),this._semanticTokensStylingService=i,this._isDisposed=!1,this._model=t,this._provider=n.documentSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentSemanticTokens",{min:e8.REQUEST_MIN_DELAY,max:e8.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new rc((()=>this._fetchDocumentSemanticTokensNow()),e8.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeAttached((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeLanguage((()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)})));const r=()=>{Vi(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const i of this._provider.all(t))"function"==typeof i.onDidChange&&this._documentProvidersChangeListeners.push(i.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};r(),this._register(this._provider.onDidChange((()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(e.onDidColorThemeChange((()=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),Vi(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!Z7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new pe,i=J7(this._provider,this._model,this._currentDocumentResponse?this._currentDocumentResponse.provider:null,this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,t.token);this._currentDocumentRequestCancellationTokenSource=t,this._providersChangedDuringRequest=!1;const e=[],s=this._model.onDidChangeContent((t=>{e.push(t)})),n=new Yi(!1);i.then((t=>{if(this._debounceInformation.update(this._model,n.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),t){const{provider:i,tokens:s}=t,n=this._semanticTokensStylingService.getStyling(i);this._setDocumentSemanticTokens(i,s||null,n,e)}else this._setDocumentSemanticTokens(null,null,null,e)}),(t=>{t&&(Oi(t)||"string"==typeof t.message&&-1!==t.message.indexOf("busy"))||Li(t),this._currentDocumentRequestCancellationTokenSource=null,s.dispose(),(e.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))}))}static _copy(t,i,e,s,n){n=Math.min(n,e.length-s,t.length-i);for(let r=0;r<n;r++)e[s+r]=t[i+r]}_setDocumentSemanticTokens(t,i,e,s){const n=this._currentDocumentResponse,r=()=>{(s.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed)t&&i&&t.releaseDocumentSemanticTokens(i.resultId);else if(t&&e){if(!i)return this._model.tokenization.setSemanticTokens(null,!0),void r();if(q7(i)){if(!n)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===i.edits.length)i={resultId:i.resultId,data:n.data};else{let t=0;for(const e of i.edits)t+=(e.data?e.data.length:0)-e.deleteCount;const s=n.data,r=new Uint32Array(s.length+t);let o=s.length,h=r.length;for(let t=i.edits.length-1;t>=0;t--){const c=i.edits[t];if(c.start>s.length)return e.warnInvalidEditStart(n.resultId,i.resultId,t,c.start,s.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=o-(c.start+c.deleteCount);l>0&&(e8._copy(s,o-l,r,h-l,l),h-=l),c.data&&(e8._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&e8._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(K7(i)){this._currentDocumentResponse=new h8(t,i.resultId,i.data);const n=cR(i,e,this._model.getLanguageId());if(s.length>0)for(const t of s)for(const i of n)for(const e of t.changes)i.applyEdit(e.range,e.text);this._model.tokenization.setSemanticTokens(n,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}else this._model.tokenization.setSemanticTokens(null,!1)}};o8.REQUEST_MIN_DELAY=300,o8.REQUEST_MAX_DELAY=2e3,o8=e8=s8([n8(1,uR),n8(2,Nk),n8(3,YT),n8(4,op)],o8);class h8{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}RH(r8);var c8=function(t,i){return function(e,s){i(e,s,t)}};let l8=class extends Ki{constructor(t,i,e,s,n,r){super(),this._semanticTokensStylingService=i,this._themeService=e,this._configurationService=s,this._editor=t,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new rc((()=>this._tokenizeViewportNow()),100)),this._outstandingRequests=[];const o=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange((()=>{o()}))),this._register(this._editor.onDidChangeModel((()=>{this._cancelAll(),o()}))),this._register(this._editor.onDidChangeModelContent((()=>{this._cancelAll(),o()}))),this._register(this._provider.onDidChange((()=>{this._cancelAll(),o()}))),this._register(this._configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration(t8)&&(this._cancelAll(),o())}))),this._register(this._themeService.onDidColorThemeChange((()=>{this._cancelAll(),o()}))),o()}_cancelAll(){for(const t of this._outstandingRequests)t.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(t){for(let i=0,e=this._outstandingRequests.length;i<e;i++)if(this._outstandingRequests[i]===t)return void this._outstandingRequests.splice(i,1)}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const t=this._editor.getModel();if(t.tokenization.hasCompleteSemanticTokens())return;if(!i8(t,this._themeService,this._configurationService))return void(t.tokenization.hasSomeSemanticTokens()&&t.tokenization.setSemanticTokens(null,!1));if(!function(t,i){return t.has(i)}(this._provider,t))return void(t.tokenization.hasSomeSemanticTokens()&&t.tokenization.setSemanticTokens(null,!1));const i=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(i.map((i=>this._requestRange(t,i))))}_requestRange(t,i){const e=t.getVersionId(),s=Zh((e=>Promise.resolve(X7(this._provider,t,i,e)))),n=new Yi(!1);return s.then((s=>{if(this._debounceInformation.update(t,n.elapsed()),!s||!s.tokens||t.isDisposed()||t.getVersionId()!==e)return;const{provider:r,tokens:o}=s,h=this._semanticTokensStylingService.getStyling(r);t.tokenization.setPartialSemanticTokens(i,cR(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};l8.ID="editor.contrib.viewportSemanticTokens",l8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([c8(1,uR),c8(2,Nk),c8(3,rd),c8(4,YT),c8(5,op)],l8),iu(l8.ID,l8,1);class a8{constructor(t=!0){this.selectSubwords=t}provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),this.selectSubwords&&this._addInWordRanges(i,t,s),this._addWordRanges(i,t,s),this._addWhitespaceLine(i,t,s),i.push({range:t.getFullModelRange()})}return e}_addInWordRanges(t,i,e){const s=i.getWordAtPosition(e);if(!s)return;const{word:n,startColumn:r}=s,o=e.column-r;let h=o,c=o,l=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(Xn(t)&&tr(l))break;l=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(tr(t)&&Xn(l))break;if(95===t||45===t)break;l=t}h<c&&t.push({range:new bs(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new bs(e.lineNumber,s.startColumn,e.lineNumber,s.endColumn)})}_addWhitespaceLine(t,i,e){i.getLineLength(e.lineNumber)>0&&0===i.getLineFirstNonWhitespaceColumn(e.lineNumber)&&0===i.getLineLastNonWhitespaceColumn(e.lineNumber)&&t.push({range:new bs(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var u8;class d8{constructor(t,i){this.index=t,this.ranges=i}mov(t){const i=this.index+(t?1:-1);if(i<0||i>=this.ranges.length)return this;const e=new d8(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let f8=u8=class{static get(t){return t.getContribution(u8.ID)}constructor(t,i){this._editor=t,this._languageFeaturesService=i,this._ignoreSelection=!1}dispose(){var t;null===(t=this._selectionListener)||void 0===t||t.dispose()}async run(t){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||await p8(this._languageFeaturesService.selectionRangeProvider,s,i.map((t=>t.getPosition())),this._editor.getOption(112),fe.None).then((t=>{var s;if(u(t)&&t.length===i.length&&this._editor.hasModel()&&e(this._editor.getSelections(),i,((t,i)=>t.equalsSelection(i)))){for(let e=0;e<t.length;e++)t[e]=t[e].filter((t=>t.containsPosition(i[e].getStartPosition())&&t.containsPosition(i[e].getEndPosition()))),t[e].unshift(i[e]);this._state=t.map((t=>new d8(0,t))),null===(s=this._selectionListener)||void 0===s||s.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition((()=>{var t;this._ignoreSelection||(null===(t=this._selectionListener)||void 0===t||t.dispose(),this._state=void 0)}))}})),!this._state)return;this._state=this._state.map((i=>i.mov(t)));const n=this._state.map((t=>ys.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}};f8.ID="editor.contrib.smartSelectController",f8=u8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,op)],f8);class g8 extends Ga{constructor(t,i){super(i),this._forward=t}async run(t,i){const e=f8.get(i);e&&await e.run(this._forward)}}async function p8(t,i,e,s,n){const r=t.all(i).concat(new a8(s.selectSubwords));1===r.length&&r.unshift(new K3);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(u(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])bs.isIRange(s.range)&&bs.containsPosition(s.range,e[i])&&h[i].push(bs.lift(s.range))}}),Fi));return await Promise.all(o),h.map((t=>{if(0===t.length)return[];t.sort(((t,i)=>vs.isBefore(t.getStartPosition(),i.getStartPosition())?1:vs.isBefore(i.getStartPosition(),t.getStartPosition())||vs.isBefore(t.getEndPosition(),i.getEndPosition())?-1:vs.isBefore(i.getEndPosition(),t.getEndPosition())?1:0));const e=[];let n;for(const i of t)(!n||bs.containsRange(i,n)&&!bs.equalsRange(i,n))&&(e.push(i),n=i);if(!s.selectLeadingAndTrailingWhitespace)return e;const r=[e[0]];for(let t=1;t<e.length;t++){const s=e[t-1],n=e[t];if(n.startLineNumber!==s.startLineNumber||n.endLineNumber!==s.endLineNumber){const t=new bs(s.startLineNumber,i.getLineFirstNonWhitespaceColumn(s.startLineNumber),s.endLineNumber,i.getLineLastNonWhitespaceColumn(s.endLineNumber));t.containsRange(s)&&!t.equalsRange(s)&&n.containsRange(t)&&!n.equalsRange(t)&&r.push(t);const e=new bs(s.startLineNumber,1,s.endLineNumber,i.getLineMaxColumn(s.endLineNumber));e.containsRange(s)&&!e.equalsRange(t)&&n.containsRange(e)&&!n.equalsRange(e)&&r.push(e)}r.push(n)}return r}))}mo.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),iu(f8.ID,f8,4),Xa(class extends g8{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:Q(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"1_basic",title:Q(0,"&&Expand Selection"),order:2}})}}),Xa(class extends g8{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:Q(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:PS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Sh.MenubarSelectionMenu,group:"1_basic",title:Q(0,"&&Shrink Selection"),order:3}})}}),mo.registerCommand("_executeSelectionRangeProvider",(async function(t,...i){const[e,s]=i;B(hs.isUri(e));const n=t.get(op).selectionRangeProvider,r=await t.get(ro).createModelReference(e);try{return p8(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},fe.None)}finally{r.dispose()}}));const m8=Object.freeze({View:{value:Q(0,"View"),original:"View"},Help:{value:Q(0,"Help"),original:"Help"},Test:{value:Q(0,"Test"),original:"Test"},File:{value:Q(0,"File"),original:"File"},Preferences:{value:Q(0,"Preferences"),original:"Preferences"},Developer:{value:Q(0,"Developer"),original:"Developer"}});class w8{constructor(t,i,e,s=null){this.startLineNumbers=t,this.endLineNumbers=i,this.lastLineRelativePosition=e,this.showEndForLine=s}equals(t){return!!t&&this.lastLineRelativePosition===t.lastLineRelativePosition&&this.showEndForLine===t.showEndForLine&&e(this.startLineNumbers,t.startLineNumbers)&&e(this.endLineNumbers,t.endLineNumbers)}}const v8=bu("stickyScrollViewLayer",{createHTML:t=>t}),b8="data-sticky-line-index",y8="data-sticky-is-line",k8="data-sticky-is-folding-icon";class C8 extends Ki{constructor(t){super(),this._editor=t,this._foldingIconStore=new Ui,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof LQ),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const i=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&i(),t.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))}))),this._register(this._editor.onDidScrollChange((t=>{t.scrollLeftChanged&&i(),t.scrollWidthChanged&&this._updateWidgetWidth()}))),this._register(this._editor.onDidChangeModel((()=>{i(),this._updateWidgetWidth()}))),this._register(this._foldingIconStore),i(),this._register(this._editor.onDidLayoutChange((()=>{this._updateWidgetWidth()}))),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(t){return this._stickyLines.find((i=>i.lineNumber===t))}getCurrentLines(){return this._lineNumbers}setState(t,i,e=1/0){if((!this._previousState&&!t||this._previousState&&this._previousState.equals(t))&&e===1/0)return;this._previousState=t;const s=this._stickyLines;if(this._clearStickyWidget(),t&&this._editor._getViewModel()){if(t.startLineNumbers.length*this._lineHeight+t.lastLineRelativePosition>0){this._lastLineRelativePosition=t.lastLineRelativePosition;const i=[...t.startLineNumbers];null!==t.showEndForLine&&(i[t.showEndForLine]=t.endLineNumbers[t.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(s,i,e)}}_updateWidgetWidth(){const t=this._editor.getLayoutInfo();this._lineNumbersDomNode.style.width=`${t.contentLeft}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",this._editor.getScrollWidth()-t.verticalScrollbarWidth+"px"),this._rootDomNode.style.width=t.width-t.verticalScrollbarWidth+"px"}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),Ol(this._lineNumbersDomNode),Ol(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(t){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${t?.5:0}s`)}_setFoldingIconsVisibility(t){for(const i of this._stickyLines){const e=i.foldingIcon;e&&e.setVisible(!!t||e.isCollapsed)}}async _renderRootNode(t,i,e=1/0){const s=this._editor.getLayoutInfo();for(const[n,r]of this._lineNumbers.entries()){const o=t[n],h=r>=e||(null==o?void 0:o.lineNumber)!==r?this._renderChildNode(n,r,i,s):this._updateTopAndZIndexOfStickyLine(o);h&&(this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),this._stickyLines.push(h))}i&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const n=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;0!==n?(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${n}px`,this._linesDomNodeScrollable.style.height=`${n}px`,this._rootDomNode.style.height=`${n}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)):this._clearStickyWidget()}_setFoldingHoverListeners(){"mouseover"===this._editor.getOption(109)&&(this._foldingIconStore.add(Il(this._lineNumbersDomNode,ya.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Il(this._lineNumbersDomNode,ya.MOUSE_LEAVE,(()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)}))))}_renderChildNode(t,i,e,s){const n=this._editor._getViewModel();if(!n)return;const r=n.coordinatesConverter.convertModelPositionToViewPosition(new vs(i,1)).lineNumber,o=n.getViewLineRenderingData(r),h=this._editor.getOption(67);let c;try{c=xp.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new Fp(!0,!0,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,0,o.tokens,c,o.tabSize,o.startVisibleColumn,1,1,1,500,"none",!0,!0,null),a=new Uu(2e3),u=_p(l,a);let d;d=v8?v8.createHTML(a.build()):a.build();const f=document.createElement("span");f.setAttribute(b8,String(t)),f.setAttribute(y8,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${i}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=d;const g=document.createElement("span");g.setAttribute(b8,String(t)),g.setAttribute("data-sticky-is-line-number",""),g.className="sticky-line-number",g.style.lineHeight=`${this._lineHeight}px`,g.style.width=`${s.contentLeft}px`;const p=document.createElement("span");1===h.renderType||3===h.renderType&&i%10==0?p.innerText=i.toString():2===h.renderType&&(p.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),p.className="sticky-line-number-inner",p.style.lineHeight=`${this._lineHeight}px`,p.style.width=`${s.lineNumbersWidth}px`,p.style.paddingLeft=`${s.lineNumbersLeft}px`,g.appendChild(p);const m=this._renderFoldingIconForLine(e,i);m&&g.appendChild(m.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(p),g.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const w=new S8(t,i,f,g,m,u.characterMapping);return this._updateTopAndZIndexOfStickyLine(w)}_updateTopAndZIndexOfStickyLine(t){var i;const e=t.index,s=t.lineDomNode,n=t.lineNumberDomNode,r=e===this._lineNumbers.length-1;s.style.zIndex=r?"0":"1",n.style.zIndex=r?"0":"1";const o=`${e*this._lineHeight+this._lastLineRelativePosition+((null===(i=t.foldingIcon)||void 0===i?void 0:i.isCollapsed)?1:0)}px`,h=e*this._lineHeight+"px";return s.style.top=r?o:h,n.style.top=r?o:h,t}_renderFoldingIconForLine(t,i){const e=this._editor.getOption(109);if(!t||"never"===e)return;const s=t.regions,n=s.findRange(i),r=s.getStartLineNumber(n);if(i!==r)return;const o=s.isCollapsed(n),h=new x8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(k8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=Py(i.characterMapping,t,0);return new vs(i.lineNumber,e)}getLineNumberFromChildDomNode(t){var i,e;return null!==(e=null===(i=this._getRenderedStickyLineFromChildDomNode(t))||void 0===i?void 0:i.lineNumber)&&void 0!==e?e:null}_getRenderedStickyLineFromChildDomNode(t){const i=this.getLineIndexFromChildDomNode(t);return null===i||i<0||i>=this._stickyLines.length?null:this._stickyLines[i]}getLineIndexFromChildDomNode(t){const i=this._getAttributeValue(t,b8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,y8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,k8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class S8{constructor(t,i,e,s,n,r){this.index=t,this.lineNumber=i,this.lineDomNode=e,this.lineNumberDomNode=s,this.foldingIcon=n,this.characterMapping=r}}class x8{constructor(t,i,e,s){this.isCollapsed=t,this.foldingStartLine=i,this.foldingEndLine=e,this.dimension=s,this.domNode=document.createElement("div"),this.domNode.style.width=`${s}px`,this.domNode.style.height=`${s}px`,this.domNode.className=go.asClassName(t?V4:j4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class D8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class E8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class A8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var M8,L8,F8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},T8=function(t,i){return function(e,s){i(e,s,t)}};!function(t){t.OUTLINE_MODEL="outlineModel",t.FOLDING_PROVIDER_MODEL="foldingProviderModel",t.INDENTATION_MODEL="indentationModel"}(M8||(M8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(L8||(L8={}));let R8=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Yh(300)),this._updateOperation=this._register(new Ui);const n=new _8(e),r=new N8(this._editor,e),o=new P8(this._editor,i);switch(s){case M8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case M8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case M8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(t,i,e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger((async()=>{for(const s of this._modelProviders){const{statusPromise:n,modelPromise:r}=s.computeStickyModel(t,i,e);this._modelPromise=r;const o=await n;if(this._modelPromise!==r)return null;switch(o){case L8.CANCELED:return this._updateOperation.clear(),null;case L8.VALID:return s.stickyModel}}return null})).catch((t=>(Li(t),null)))}};R8=F8([T8(1,Nd),T8(2,op)],R8);class O8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,L8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=Zh((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?L8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),L8.VALID):this._invalid())).then(void 0,(t=>(Li(t),L8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let _8=class extends O8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return f5.create(this._languageFeaturesService.documentSymbolProvider,t,e)}createStickyModel(t,i,e,s){var n;const{stickyOutlineElement:r,providerID:o}=this._stickyModelFromOutlineModel(s,null===(n=this._stickyModel)||void 0===n?void 0:n.outlineProviderId);return new A8(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(It.first(t.children.values())instanceof d5){const s=It.find(t.children.values(),(t=>t.id===i));if(s)e=s.children;else{let s,n="",r=-1;for(const[i,e]of t.children.entries()){const t=this._findSumOfRangesOfGroup(e);t>r&&(s=e,r=t,n=e.id)}i=n,e=s.children}}else e=t.children;const s=[],n=Array.from(e.values()).sort(((t,i)=>{const e=new D8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new D8(i.symbol.range.startLineNumber,i.symbol.range.endLineNumber);return this._comparator(e,s)}));for(const t of n)s.push(this._stickyModelFromOutlineElement(t,t.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new E8(void 0,s,void 0),providerID:i}}_stickyModelFromOutlineElement(t,i){const e=[];for(const s of t.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==i)e.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const t of s.children.values())e.push(this._stickyModelFromOutlineElement(t,s.symbol.selectionRange.startLineNumber));e.sort(((t,i)=>this._comparator(t.range,i.range)));const s=new D8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new E8(s,e,void 0)}_comparator(t,i){return t.startLineNumber!==i.startLineNumber?t.startLineNumber-i.startLineNumber:i.endLineNumber-t.endLineNumber}_findSumOfRangesOfGroup(t){let i=0;for(const e of t.children.values())i+=this._findSumOfRangesOfGroup(e);return t instanceof u5?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};_8=F8([T8(0,op)],_8);class I8 extends O8{constructor(t){super(),this._foldingLimitReporter=new t5(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new A8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new E8(void 0,[],void 0);for(let n=0;n<i;n++){const i=t.getParentIndex(n);let r;r=-1!==i?e[i]:s;const o=new E8(new D8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let P8=class extends I8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new N4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};P8=F8([T8(1,Nd)],P8);let N8=class extends I8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return X4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=X4.getFoldingRangeProviders(this._languageFeaturesService,t);return new G4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};N8=F8([T8(1,op)],N8);var B8=function(t,i){return function(e,s){i(e,s,t)}};class $8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let W8=class extends Ki{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._register(new ne),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=this._register(new Ui),this._updateSoon=this._register(new rc((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&this.readConfiguration()}))),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new R8(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel((()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()}))),this._sessionStore.add(this._editor.onDidChangeHiddenAreas((()=>this.update()))),this._sessionStore.add(this._editor.onDidChangeModelContent((()=>this._updateSoon.schedule()))),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>this.update()))),this.update())}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}async update(){var t;null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new pe,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(t){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization())return void(this._model=null);const i=this._editor.getModel(),e=i.getVersionId(),s=await this._stickyModelProvider.update(i,e,t);t.isCancellationRequested||(this._model=s)}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,n,r){if(0===i.children.length)return;let o=r;const h=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&h.push(e.range.startLineNumber)}const c=this.updateIndex(s(h,t.startLineNumber,((t,i)=>t-i))),l=this.updateIndex(s(h,t.startLineNumber+n,((t,i)=>t-i)));for(let s=c;s<=l;s++){const h=i.children[s];if(!h)return;if(h.range){const i=h.range.startLineNumber,s=h.range.endLineNumber;t.startLineNumber<=s+1&&i-1<=t.endLineNumber&&i!==o&&(o=i,e.push(new $8(i,s-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n,r)}}getCandidateStickyLinesIntersecting(t){var i,e;if(!(null===(i=this._model)||void 0===i?void 0:i.element))return[];let s=[];this.getCandidateStickyLinesIntersectingFromStickyModel(t,this._model.element,s,0,-1);const n=null===(e=this._editor._getViewModel())||void 0===e?void 0:e.getHiddenAreas();if(n)for(const t of n)s=s.filter((i=>!(i.startLineNumber>=t.startLineNumber&&i.endLineNumber<=t.endLineNumber+1)));return s}};W8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([B8(1,op),B8(2,Nd)],W8);var j8,V8=function(t,i){return function(e,s){i(e,s,t)}};let H8=j8=class extends Ki{constructor(t,i,e,s,n,r,o){super(),this._editor=t,this._contextMenuService=i,this._languageFeaturesService=e,this._instaService=s,this._contextKeyService=o,this._sessionStore=new Ui,this._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new C8(this._editor),this._stickyLineCandidateProvider=new W8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new w8([],[],0),this._readConfiguration();const h=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(114)||t.hasChanged(72)||t.hasChanged(66)||t.hasChanged(109))&&this._readConfiguration()}))),this._register(Il(h,ya.CONTEXT_MENU,(async t=>{this._onContextMenu(Al(h),t)}))),this._stickyScrollFocusedContextKey=PS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=PS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Sa(h));this._register(c.onDidBlur((()=>{!1===this._positionRevealed&&0===h.clientHeight?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(c.onDidFocus((()=>{this.focus()}))),this._registerMouseListeners(),this._register(Il(h,ya.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(j8.ID)}_disposeFocusStickyScrollStore(){var t;this._stickyScrollFocusedContextKey.set(!1),null===(t=this._focusDisposableStore)||void 0===t||t.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown)return this._onMouseDown=!1,void this._editor.focus();!0!==this._stickyScrollFocusedContextKey.get()&&(this._focused=!0,this._focusDisposableStore=new Ui,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(t){this._focusedStickyElementIndex=t?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._reveaInEditor(t,(()=>this._editor.revealPosition(t)))}_revealLineInCenterIfOutsideViewport(t){this._reveaInEditor(t,(()=>this._editor.revealLineInCenterIfOutsideViewport(t.lineNumber,0)))}_reveaInEditor(t,i){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,i(),this._editor.setSelection(bs.fromPositions(t)),this._editor.focus()}_registerMouseListeners(){const t=this._register(new Ui),i=this._register(new AQ(this._editor,{extractLineNumberFromMouseEvent:t=>{const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);return i?i.lineNumber:0}})),e=t=>{if(!this._editor.hasModel())return null;if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return null;const i=t.target.element;if(!i||i.innerText!==i.innerHTML)return null;const e=this._stickyScrollWidget.getEditorPositionFromNode(i);return e?{range:new bs(e.lineNumber,e.column,e.lineNumber,e.column+i.innerText.length),textElement:i}:null},s=this._stickyScrollWidget.getDomNode();this._register(Nl(s,ya.CLICK,(t=>{if(t.ctrlKey||t.altKey||t.metaKey)return;if(!t.leftButton)return;if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i)return;const e=new vs(this._endLineNumbers[i],1);return void this._revealLineInCenterIfOutsideViewport(e)}if(this._stickyScrollWidget.isInFoldingIconDomNode(t.target)){const i=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);return void this._toggleFoldingRegionForLine(i)}if(!this._stickyScrollWidget.isInStickyLine(t.target))return;let i=this._stickyScrollWidget.getEditorPositionFromNode(t.target);if(!i){const e=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);if(null===e)return;i=new vs(e,1)}this._revealPosition(i)}))),this._register(Nl(s,ya.MOUSE_MOVE,(t=>{if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i||null!==this._showEndForLine&&this._showEndForLine===i)return;return this._showEndForLine=i,void this._renderStickyScroll()}null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(Il(s,ya.MOUSE_LEAVE,(()=>{null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(i.onMouseMoveOrRelevantKeyDown((([i,s])=>{const n=e(i);if(!n||!i.hasTriggerModifier||!this._editor.hasModel())return void t.clear();const{range:r,textElement:o}=n;if(r.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===o.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=r,t.clear();const h=new pe;let c;t.add(zi((()=>h.dispose(!0)))),MY(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new vs(r.startLineNumber,r.startColumn+1),h.token).then((i=>{if(!h.token.isCancellationRequested)if(0!==i.length){this._candidateDefinitionsLength=i.length;const e=o;c!==e?(t.clear(),c=e,c.style.textDecoration="underline",t.add(zi((()=>{c.style.textDecoration="none"})))):c||(c=e,c.style.textDecoration="underline",t.add(zi((()=>{c.style.textDecoration="none"}))))}else t.clear()}))}))),this._register(i.onCancel((()=>{t.clear()}))),this._register(i.onExecute((async t=>{if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return;const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);i&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:i.lineNumber,column:1})),this._instaService.invokeFunction(a9,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))}_onContextMenu(t,i){const e=new Uh(t,i);this._contextMenuService.showContextMenu({menuId:Sh.StickyScrollContext,getAnchor:()=>e})}_toggleFoldingRegionForLine(t){if(!this._foldingModel||null===t)return;const i=this._stickyScrollWidget.getStickyLineForLine(t),e=null==i?void 0:i.foldingIcon;if(!e)return;L4(this._foldingModel,Number.MAX_VALUE,[t]),e.isCollapsed=!e.isCollapsed;const s=this._editor.getTopForLineNumber(e.isCollapsed?e.foldingEndLine:e.foldingStartLine)-this._editor.getOption(66)*i.index+1;this._editor.setScrollTop(s),this._renderStickyScroll(t)}_readConfiguration(){const t=this._editor.getOption(114);if(!1===t.enabled)return this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),void(this._enabled=!1);t.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._sessionStore.add(this._editor.onDidLayoutChange((()=>this._onDidResize()))),this._sessionStore.add(this._editor.onDidChangeModelTokens((t=>this._onTokensChange(t)))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll((()=>{this._showEndForLine=null,this._renderStickyScroll()}))),this._enabled=!0),2===this._editor.getOption(67).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>{this._showEndForLine=null,this._renderStickyScroll(-1)})))}_needsUpdate(t){const i=this._stickyScrollWidget.getCurrentLines();for(const e of i)for(const i of t.ranges)if(e>=i.fromLineNumber&&e<=i.toLineNumber)return!0;return!1}_onTokensChange(t){this._needsUpdate(t)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(.25*t)}async _renderStickyScroll(t=1/0){var i,e;const s=this._editor.getModel();if(!s||s.isTooLargeForTokenization())return this._foldingModel=null,void this._stickyScrollWidget.setState(void 0,null,t);const n=this._stickyLineCandidateProvider.getVersionId();if(void 0===n||n===s.getVersionId())if(this._foldingModel=null!==(e=await(null===(i=X4.get(this._editor))||void 0===i?void 0:i.getFoldingModel()))&&void 0!==e?e:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.startLineNumbers.length)),this._focused)if(-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,-1!==this._focusedStickyElementIndex&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const i=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),0===this._stickyScrollWidget.lineNumberCount?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(i)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}else this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t)}findScrollWidgetState(){const t=this._editor.getOption(66),i=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=[],o=this._editor.getVisibleRanges();if(0!==o.length){const h=new D8(o[0].startLineNumber,o[o.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(h);for(const o of c){const h=o.startLineNumber,c=o.endLineNumber,l=o.nestingDepth;if(c-h>0){const o=(l-1)*t,a=l*t,u=this._editor.getBottomForLineNumber(h)-e,d=this._editor.getTopForLineNumber(c)-e,f=this._editor.getBottomForLineNumber(c)-e;if(o>d&&o<=f){n.push(h),r.push(c+1),s=f-a;break}if(a>u&&a<=f&&(n.push(h),r.push(c+1)),n.length===i)break}}}return this._endLineNumbers=r,new w8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};H8.ID="store.contrib.stickyScrollController",H8=j8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([V8(1,qO),V8(2,op),V8(3,io),V8(4,Nd),V8(5,YT),V8(6,th)],H8);const z8=100;iu(H8.ID,H8,1),Fh(class extends Lh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:Q(0,"Toggle Sticky Scroll"),mnemonicTitle:Q(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:m8.View,toggled:{condition:Oo.equals("config.editor.stickyScroll.enabled",!0),title:Q(0,"Sticky Scroll"),mnemonicTitle:Q(0,"&&Sticky Scroll")},menu:[{id:Sh.CommandPalette},{id:Sh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:Sh.StickyScrollContext}]})}async run(t){const i=t.get(rd),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}}),Fh(class extends Ja{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:Q(0,"Focus Sticky Scroll"),mnemonicTitle:Q(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Oo.and(Oo.has("config.editor.stickyScroll.enabled"),PS.stickyScrollVisible),menu:[{id:Sh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focus()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:Q(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:16}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focusPrevious()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:Q(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:18}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.focusNext()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:Q(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:3}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.goToFocused()}}),Fh(class extends Ja{constructor(){super({id:"editor.action.selectEditor",title:{value:Q(0,"Select Editor"),original:"Select Editor"},precondition:PS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:z8,primary:9}})}runEditorCommand(t,i){var e;null===(e=H8.get(i))||void 0===e||e.selectEditor()}});var U8,K8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},q8=function(t,i){return function(e,s){i(e,s,t)}};class G8{constructor(t,i,e,s,n,r){this.range=t,this.insertText=i,this.filterText=e,this.additionalTextEdits=s,this.command=n,this.completion=r}}let Z8=class extends Gi{constructor(t,i,e,s,n,r){super(n.disposable),this.model=t,this.line=i,this.word=e,this.completionModel=s,this._suggestMemoryService=r}canBeReused(t,i,e){return this.model===t&&this.line===i&&this.word.word.length>0&&this.word.startColumn===e.startColumn&&this.word.endColumn<e.endColumn&&0===this.completionModel.getIncompleteProvider().size}get items(){var t;const i=[],{items:e}=this.completionModel,s=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},e),n=It.slice(e,s),r=It.slice(e,0,s);let o=5;for(const e of It.concat(n,r)){if(e.score===rI.Default)continue;const s=new bs(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new G8(s,e.completion.insertTextRules&&4&e.completion.insertTextRules?{snippet:e.completion.insertText}:e.completion.insertText,null!==(t=e.filterTextLow)&&void 0!==t?t:e.labelLow,e.completion.additionalTextEdits,e.completion.command,e)),o-- >=0&&e.resolve(fe.None)}return i}};Z8=K8([q8(5,W3)],Z8);let J8=class{constructor(t,i,e,s){this._getEditorOption=t,this._languageFeatureService=i,this._clipboardService=e,this._suggestMemoryService=s}async provideInlineCompletions(t,i,e,s){var n;if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(88,t);if(f3.isAllOff(r))return;t.tokenization.tokenizeIfCheap(i.lineNumber);const o=t.tokenization.getLineTokens(i.lineNumber),h=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(i.column-1-1,0)));if("inline"!==f3.valueFor(r,h))return;let c,l,a=t.getWordAtPosition(i);if((null==a?void 0:a.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==a?void 0:a.word)&&!c)return;if(a||(a=t.getWordUntilPosition(i)),a.endColumn!==i.column)return;const u=t.getValueInRange(new bs(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,a))){const t=new G3(u,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=await a3(this._languageFeatureService.completionProvider,t,i,new c3(void 0,void 0,null==c?void 0:c.providers),c&&{triggerKind:1,triggerCharacter:c.ch},s);let n;e.needsClipboard&&(n=await this._clipboardService.readText());const r=new Z3(e.items,i.column,new G3(u,0),q3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new Z8(t,i.lineNumber,a,r,e,this._suggestMemoryService)}return this._lastResult=l,l}handleItemDidShow(t,i){i.completion.resolve(fe.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(bs.fromPositions({lineNumber:i.lineNumber,column:i.column-1},i)),n=new Set;for(const i of this._languageFeatureService.completionProvider.all(t))(null===(e=i.triggerCharacters)||void 0===e?void 0:e.includes(s))&&n.add(i);if(0!==n.size)return{providers:n,ch:s}}};J8=K8([q8(1,op),q8(2,nH),q8(3,W3)],J8);let Q8=U8=class{constructor(t,i,e,s){if(1==++U8._counter){const n=s.createInstance(J8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));U8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--U8._counter&&(null===(t=U8._disposable)||void 0===t||t.dispose(),U8._disposable=void 0)}};Q8._counter=0,Q8=U8=K8([q8(1,op),q8(2,so),q8(3,io)],Q8),iu("suggest.inlineCompletionsProvider",Q8,0),Xa(class extends Ga{constructor(){super({id:"editor.action.forceRetokenize",label:Q(0,"Developer: Force Retokenize"),alias:"Developer: Force Retokenize",precondition:void 0})}run(t,i){if(!i.hasModel())return;const e=i.getModel();e.tokenization.resetTokenization();const s=new Yi;e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class Y8 extends Lh{constructor(){super({id:Y8.ID,title:{value:Q(0,"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!Rm.getTabFocusMode();Rm.setTabFocusMode(t),Cm(Q(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}Y8.ID="editor.action.toggleTabFocusMode",Fh(Y8);let X8=class extends Ki{get enabled(){return this._enabled}set enabled(t){t?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=t}constructor(t,i,e={},s){var n;super(),this._link=i,this._enabled=!0,this.el=xa(t,Fa("a.monaco-link",{tabIndex:null!==(n=i.tabIndex)&&void 0!==n?n:0,href:i.href,title:i.title},i.label)),this.el.setAttribute("role","button");const r=this._register(new kk(this.el,"click")),o=this._register(new kk(this.el,"keypress")),h=Xi.chain(o.event,(t=>t.map((t=>new jh(t))).filter((t=>3===t.keyCode)))),c=this._register(new kk(this.el,Hm.Tap)).event;this._register(zm.addTarget(this.el));const l=Xi.any(r.event,h,c);this._register(l((t=>{this.enabled&&(ka(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};X8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,ZN)],X8);var ttt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},itt=function(t,i){return function(e,s){i(e,s,t)}};let ett=class extends Ki{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(stt))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(t){this.banner.show({...t,onClose:()=>{var i;this.hide(),null===(i=t.onClose)||void 0===i||i.call(t)}}),this._editor.setBanner(this.banner.element,26)}};ett=ttt([itt(1,io)],ett);let stt=class extends Ki{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(GZ,{}),this.element=Fa("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(t){return t.ariaLabel?t.ariaLabel:"string"==typeof t.message?t.message:void 0}getBannerMessage(t){if("string"==typeof t){const i=Fa("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Ol(this.element)}show(t){Ol(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=xa(this.element,Fa("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Fa(`div${go.asCSSSelector(t.icon)}`));const s=xa(this.element,Fa("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=xa(this.element,Fa("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(X8,this.messageActionsContainer,{...i,tabIndex:-1},{}));const n=xa(this.element,Fa("div.action-container"));this.actionBar=this._register(new IN(n)),this.actionBar.push(this._register(new oo("banner.close","Close Banner",go.asClassName(RV),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};stt=ttt([itt(0,io)],stt);var ntt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},rtt=function(t,i){return function(e,s){i(e,s,t)}};const ott=AV("extensions-warning-message",xs.warning,Q(0,"Icon shown with a warning message in the extensions editor."));let htt=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=e,this._highlighter=null,this._bannerClosed=!1,this._updateState=t=>{if(t&&t.hasMore){if(this._bannerClosed)return;const i=Math.max(t.ambiguousCharacterCount,t.nonBasicAsciiCharacterCount,t.invisibleCharacterCount);let e;if(t.nonBasicAsciiCharacterCount>=i)e={message:Q(0,"This document contains many non-basic ASCII unicode characters"),command:new btt};else if(t.ambiguousCharacterCount>=i)e={message:Q(0,"This document contains many ambiguous unicode characters"),command:new wtt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:Q(0,"This document contains many invisible unicode characters"),command:new vtt}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:ott,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(ett,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(124),this._register(e.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(124)&&(this._options=t.getOption(124),this._updateHighlighter())}))),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const t=function(t,i){return{nonBasicASCII:i.nonBasicASCII===pi?!t:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===pi?!t:i.includeComments,includeStrings:i.includeStrings===pi?!t:i.includeStrings,allowedCharacters:i.allowedCharacters,allowedLocales:i.allowedLocales}}(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([t.nonBasicASCII,t.ambiguousCharacters,t.invisibleCharacters].every((t=>!1===t)))return;const i={nonBasicASCII:t.nonBasicASCII,ambiguousCharacters:t.ambiguousCharacters,invisibleCharacters:t.invisibleCharacters,includeComments:t.includeComments,includeStrings:t.includeStrings,allowedCodePoints:Object.keys(t.allowedCharacters).map((t=>t.codePointAt(0))),allowedLocales:Object.keys(t.allowedLocales).map((t=>"_os"===t?(new Intl.NumberFormat).resolvedOptions().locale:"_vscode"===t?St:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new ctt(this._editor,i,this._updateState,this._editorWorkerService):new ltt(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};htt.ID="editor.contrib.unicodeHighlighter",htt=ntt([rtt(1,iB),rtt(2,UO),rtt(3,io)],htt);let ctt=class extends Ki{constructor(t,i,e,s){super(),this._editor=t,this._options=i,this._updateState=e,this._editorWorkerService=s,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new rc((()=>this._update()),250)),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void this._decorations.clear();const t=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then((i=>{if(this._model.isDisposed())return;if(this._model.getVersionId()!==t)return;this._updateState(i);const e=[];if(!i.hasMore)for(const t of i.ranges)e.push({range:t,options:gtt.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return pF(i,t)?{reason:ftt(i.getValueInRange(t.range),this._options),inComment:mF(i,t),inString:wF(i,t)}:null}};ctt=ntt([rtt(3,iB)],ctt);class ltt extends Ki{constructor(t,i,e){super(),this._editor=t,this._options=i,this._updateState=e,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new rc((()=>this._update()),250)),this._register(this._editor.onDidLayoutChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidScrollChange((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeHiddenAreas((()=>{this._updateSoon.schedule()}))),this._register(this._editor.onDidChangeModelContent((()=>{this._updateSoon.schedule()}))),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII())return void this._decorations.clear();const t=this._editor.getVisibleRanges(),i=[],e={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const i of t){const t=Nf.computeUnicodeHighlights(this._model,this._options,i);for(const i of t.ranges)e.ranges.push(i);e.ambiguousCharacterCount+=e.ambiguousCharacterCount,e.invisibleCharacterCount+=e.invisibleCharacterCount,e.nonBasicAsciiCharacterCount+=e.nonBasicAsciiCharacterCount,e.hasMore=e.hasMore||t.hasMore}if(!e.hasMore)for(const t of e.ranges)i.push({range:t,options:gtt.instance.getDecorationFromOptions(this._options)});this._updateState(e),this._decorations.set(i)}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel(),e=i.getValueInRange(t.range);return pF(i,t)?{reason:ftt(e,this._options),inComment:mF(i,t),inString:wF(i,t)}:null}}let att=class{constructor(t,i,e){this._editor=t,this._languageService=i,this._openerService=e,this.hoverOrdinal=5}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=this._editor.getContribution(htt.ID);if(!s)return[];const n=[],r=new Set;let o=300;for(const t of i){const i=s.getDecorationInfo(t);if(!i)continue;const h=e.getValueInRange(t.range).codePointAt(0),c=dtt(h);let l;switch(i.reason.kind){case 0:l=mr(i.reason.confusableWith)?Q(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,dtt(i.reason.confusableWith.codePointAt(0))):Q(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,dtt(i.reason.confusableWith.codePointAt(0)));break;case 1:l=Q(0,"The character {0} is invisible.",c);break;case 2:l=Q(0,"The character {0} is not a basic ASCII character.",c)}if(r.has(l))continue;r.add(l);const a={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},u=Q(0,"Adjust settings"),d=`command:${ytt.ID}?${encodeURIComponent(JSON.stringify(a))}`,f=new bI("",!0).appendMarkdown(l).appendText(" ").appendLink(d,u);n.push(new LX(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return TX(t,i,this._editor,this._languageService,this._openerService)}};function utt(t){return`U+${t.toString(16).padStart(4,"0")}`}function dtt(t){let i=`\`${utt(t)}\``;return Mr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function ftt(t,i){return Nf.computeUnicodeHighlightReason(t,i)}att=ntt([rtt(1,ud),rtt(2,ZN)],att);class gtt{constructor(){this.map=new Map}getDecorationFromOptions(t){return this.getDecoration(!t.includeComments,!t.includeStrings)}getDecoration(t,i){const e=`${t}${i}`;let s=this.map.get(e);return s||(s=aL.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:t,hideInStringTokens:i}),this.map.set(e,s)),s}}gtt.instance=new gtt;class ptt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=Q(0,"Disable Highlight In Comments")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(yi,!1,2)}}class mtt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=Q(0,"Disable Highlight In Strings")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(ki,!1,2)}}class wtt extends Ga{constructor(){super({id:wtt.ID,label:Q(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Ambiguous Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(bi,!1,2)}}wtt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class vtt extends Ga{constructor(){super({id:vtt.ID,label:Q(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Invisible Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(wi,!1,2)}}vtt.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class btt extends Ga{constructor(){super({id:btt.ID,label:Q(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=Q(0,"Disable Non ASCII Highlight")}async run(t,i,e){const s=null==t?void 0:t.get(rd);s&&this.runAction(s)}async runAction(t){await t.updateValue(vi,!1,2)}}btt.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class ytt extends Ga{constructor(){super({id:ytt.ID,label:Q(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}async run(t,i,e){const{codePoint:s,reason:n,inString:r,inComment:o}=e,h=String.fromCodePoint(s),c=t.get(mj),l=t.get(rd),a=[];if(0===n.kind)for(const t of n.notAmbiguousInLocales)a.push({label:Q(0,'Allow unicode characters that are more common in the language "{0}".',t),run:async()=>{ktt(l,[t])}});if(a.push({label:function(t){return Mr.isInvisibleCharacter(t)?Q(0,"Exclude {0} (invisible character) from being highlighted",utt(t)):Q(0,"Exclude {0} from being highlighted",`${utt(t)} "${h}"`)}(s),run:()=>async function(t,i){const e=t.getValue(mi);let s;s="object"==typeof e&&e?e:{};for(const t of i)s[String.fromCodePoint(t)]=!0;await t.updateValue(mi,s,2)}(l,[s])}),o){const t=new ptt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(r){const t=new mtt;a.push({label:t.label,run:async()=>t.runAction(l)})}if(0===n.kind){const t=new wtt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(1===n.kind){const t=new vtt;a.push({label:t.label,run:async()=>t.runAction(l)})}else if(2===n.kind){const t=new btt;a.push({label:t.label,run:async()=>t.runAction(l)})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(n);const u=await c.pick(a,{title:Q(0,"Configure Unicode Highlight Options")});u&&await u.run()}}async function ktt(t,i){var e;const s=null===(e=t.inspect(Ci).user)||void 0===e?void 0:e.value;let n;n="object"==typeof s&&s?Object.assign({},s):{};for(const t of i)n[t]=!0;await t.updateValue(Ci,n,2)}ytt.ID="editor.action.unicodeHighlight.showExcludeOptions",Xa(wtt),Xa(vtt),Xa(btt),Xa(ytt),iu(htt.ID,htt,1),oX.register(att);var Ctt=function(t,i){return function(e,s){i(e,s,t)}};const Stt="ignoreUnusualLineTerminators";let xtt=class extends Ki{constructor(t,i,e){super(),this._editor=t,this._dialogService=i,this._codeEditorService=e,this._isPresentingDialog=!1,this._config=this._editor.getOption(125),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if("off"===this._config)return;if(!this._editor.hasModel())return;const t=this._editor.getModel();if(!t.mightContainUnusualLineTerminators())return;const i=function(t,i){return t.getModelProperty(i.uri,Stt)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(90))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let e;try{this._isPresentingDialog=!0,e=await this._dialogService.confirm({title:Q(0,"Unusual Line Terminators"),message:Q(0,"Detected unusual line terminators"),detail:Q(0,"The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",eA(t.uri)),primaryButton:Q(0,"&&Remove Unusual Line Terminators"),cancelButton:Q(0,"Ignore")})}finally{this._isPresentingDialog=!1}e.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,Stt,!0)}(this._codeEditorService,t)}};xtt.ID="editor.contrib.unusualLineTerminatorsDetector",xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Ctt(1,_T),Ctt(2,so)],xtt),iu(xtt.ID,xtt,1);var Dtt,Ett,Att=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},Mtt=function(t,i){return function(e,s){i(e,s,t)}};const Ltt=new Xo("hasWordHighlights",!1);function Ftt(t,i,e,s){return ec(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Fi))),u).then((t=>{if(t){const e=new Eg;return e.set(i.uri,t),e}return new Eg}))}class Ttt{constructor(t,i,e){this._model=t,this._selection=i,this._wordSeparators=e,this._wordRange=this._getCurrentWordRange(t,i),this._result=null}get result(){return this._result||(this._result=Zh((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new bs(i.startLineNumber,e.startColumn,i.startLineNumber,e.endColumn):null}isValid(t,i,e){const s=i.startLineNumber,n=i.startColumn,r=i.endColumn,o=this._getCurrentWordRange(t,i);let h=Boolean(this._wordRange&&this._wordRange.equalsRange(o));for(let t=0,i=e.length;!h&&t<i;t++){const i=e.getRange(t);i&&i.startLineNumber===s&&i.startColumn<=n&&i.endColumn>=r&&(h=!0)}return h}cancel(){this.result.cancel()}}class Rtt extends Ttt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return Ftt(this._providers,t,i.getPosition(),s).then((t=>t||new Eg))}}class Ott extends Ttt{constructor(t,i,e,s,n){super(t,i,e),this._providers=s,this._otherModels=n}_compute(t,i,e,s){return function(t,i,e,s,n,r){return ec(t.ordered(i).map((t=>()=>{const s=r.filter((i=>PR(t.selector,i.uri,i.getLanguageId(),!0,void 0,void 0)>0));return Promise.resolve(t.provideMultiDocumentHighlights(i,e,s,n)).then(void 0,Fi)})),(t=>t instanceof Eg&&t.size>0))}(this._providers,t,i.getPosition(),0,s,this._otherModels).then((t=>t||new Eg))}}class _tt extends Ttt{constructor(t,i,e,s,n){super(t,i,s),this._otherModels=n,this._selectionIsEmpty=i.isEmpty(),this._word=e}_compute(t,i,e,s){return tc(250,s).then((()=>{const s=new Eg;let n;if(n=this._word?this._word:t.getWordAtPosition(i.getPosition()),!n)return new Eg;const r=[t,...this._otherModels];for(const t of r){if(t.isDisposed())continue;const i=t.findMatches(n.word,!0,!1,!0,e,!1).map((t=>({range:t.range,kind:Rs.Text})));i&&s.set(t.uri,i)}return s}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}Qa("_executeDocumentHighlights",(async(t,i,e)=>{const s=t.get(op),n=await Ftt(s.documentHighlightProvider,i,e,fe.None);return null==n?void 0:n.get(i.uri)}));let Itt=Dtt=class{constructor(t,i,e,s,n){this.toUnhook=new Ui,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Eg,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=t,this.providers=i,this.multiDocumentProviders=e,this.codeEditorService=n,this._hasWordHighlights=Ltt.bindTo(s),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),this.model=this.editor.getModel(),this.toUnhook.add(t.onDidChangeCursorPosition((t=>{this._ignorePositionChangeEvent||"off"!==this.occurrencesHighlight&&this._onPositionChanged(t)}))),this.toUnhook.add(t.onDidChangeModelContent((()=>{this._stopAll()}))),this.toUnhook.add(t.onDidChangeModel((t=>{!t.newModelUrl&&t.oldModelUrl?this._stopSingular():Dtt.query&&this._run()}))),this.toUnhook.add(t.onDidChangeConfiguration((()=>{const t=this.editor.getOption(80);this.occurrencesHighlight!==t&&(this.occurrencesHighlight=t,this._stopAll())}))),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,Dtt.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(){"off"!==this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(bs.compareRangesUsingStarts)}moveNext(){const t=this._getSortedHighlights(),i=t.findIndex((t=>t.containsPosition(this.editor.getPosition()))),e=(i+1)%t.length,s=t[e];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(s.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(s);const i=this._getWord();i&&Cm(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const t=this._getSortedHighlights(),i=t.findIndex((t=>t.containsPosition(this.editor.getPosition()))),e=(i-1+t.length)%t.length,s=t[e];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(s.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(s);const i=this._getWord();i&&Cm(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const t=Dtt.storedDecorations.get(this.editor.getModel().uri);t&&(this.editor.removeDecorations(t),Dtt.storedDecorations.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(){const t=this.codeEditorService.listCodeEditors();for(const i of t){if(!i.hasModel())continue;const t=Dtt.storedDecorations.get(i.getModel().uri);if(!t)continue;i.removeDecorations(t),Dtt.storedDecorations.delete(i.getModel().uri);const e=Ptt.get(i);(null==e?void 0:e.wordHighlighter)&&e.wordHighlighter.decorations.length>0&&(e.wordHighlighter.decorations.clear(),e.wordHighlighter._hasWordHighlights.set(!1))}}_stopSingular(){var t,i,e,s;this._removeSingleDecorations(),this.editor.hasWidgetFocus()&&((null===(t=this.editor.getModel())||void 0===t?void 0:t.uri.scheme)!==dl.vscodeNotebookCell&&(null===(e=null===(i=Dtt.query)||void 0===i?void 0:i.modelInfo)||void 0===e?void 0:e.model.uri.scheme)!==dl.vscodeNotebookCell?(Dtt.query=null,this._run()):(null===(s=Dtt.query)||void 0===s?void 0:s.modelInfo)&&(Dtt.query.modelInfo=null)),-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),null!==this.workerRequest&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(){this._removeAllDecorations(),-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1),null!==this.workerRequest&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(t){var i;"off"===this.occurrencesHighlight||3!==t.reason&&(null===(i=this.editor.getModel())||void 0===i?void 0:i.uri.scheme)!==dl.vscodeNotebookCell?this._stopAll():this._run()}_getWord(){const t=this.editor.getSelection(),i=t.startLineNumber,e=t.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:i,column:e})}getOtherModelsToHighlight(t){if(!t)return[];if(t.uri.scheme===dl.vscodeNotebookCell){const i=[],e=this.codeEditorService.listCodeEditors();for(const s of e){const e=s.getModel();e&&e!==t&&e.uri.scheme===dl.vscodeNotebookCell&&i.push(e)}return i}const i=[],e=this.codeEditorService.listCodeEditors();for(const s of e){if(!aq(s))continue;const e=s.getModel();e&&t===e.modified&&i.push(e.modified)}if(i.length)return i;if("singleFile"===this.occurrencesHighlight)return[];for(const s of e){const e=s.getModel();e&&e!==t&&i.push(e)}return i}_run(){var t,i;let e;if(this.editor.hasWidgetFocus()){const t=this.editor.getSelection();if(!t||t.startLineNumber!==t.endLineNumber)return void this._stopAll();const i=t.startColumn,s=t.endColumn,n=this._getWord();if(!n||n.startColumn>i||n.endColumn<s)return Dtt.query=null,void this._stopAll();e=this.workerRequest&&this.workerRequest.isValid(this.model,t,this.decorations),Dtt.query={modelInfo:{model:this.model,selection:t},word:n}}else if(null===Dtt.query)return;if(this.lastCursorPositionChangeTime=(new Date).getTime(),e)this.workerRequestCompleted&&-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const e=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel()),n=!((Dtt.query.modelInfo||!Dtt.query.word)&&(null===(t=Dtt.query.modelInfo)||void 0===t?void 0:t.model.uri)===this.model.uri);this.workerRequest=Dtt.query.modelInfo&&Dtt.query.modelInfo.model.uri===this.model.uri?this.computeWithModel(Dtt.query.modelInfo.model,Dtt.query.modelInfo.selection,Dtt.query.word,s):this.computeWithModel(this.model,this.editor.getSelection(),n?Dtt.query.word:null,s),null===(i=this.workerRequest)||void 0===i||i.result.then((t=>{e===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=t||[],this._beginRenderDecorations())}),Li)}}computeWithModel(t,i,e,s){return s.length?function(t,i,e,s,n,r){return t.has(i)?new Ott(i,e,n,t,r):new _tt(i,e,s,n,r)}(this.multiDocumentProviders,t,i,e,this.editor.getOption(129),s):function(t,i,e,s,n){return t.has(i)?new Rtt(i,e,n,t):new _tt(i,e,s,n,[])}(this.providers,t,i,e,this.editor.getOption(129))}_beginRenderDecorations(){const t=(new Date).getTime(),i=this.lastCursorPositionChangeTime+250;t>=i?(this.renderDecorationsTimer=-1,this.renderDecorations()):this.renderDecorationsTimer=setTimeout((()=>{this.renderDecorations()}),i-t)}renderDecorations(){var t,i,e;this.renderDecorationsTimer=-1;const s=this.codeEditorService.listCodeEditors();for(const r of s){const s=Ptt.get(r);if(!s)continue;const o=[],h=null===(t=r.getModel())||void 0===t?void 0:t.uri;if(h&&this.workerRequestValue.has(h)){const t=Dtt.storedDecorations.get(h),c=this.workerRequestValue.get(h);if(c)for(const t of c)o.push({range:t.range,options:(n=t.kind,n===Rs.Write?o7:n===Rs.Text?h7:a7)});let l=[];r.changeDecorations((i=>{l=i.deltaDecorations(null!=t?t:[],o)})),Dtt.storedDecorations=Dtt.storedDecorations.set(h,l),o.length>0&&(null===(i=s.wordHighlighter)||void 0===i||i.decorations.set(o),null===(e=s.wordHighlighter)||void 0===e||e._hasWordHighlights.set(!0))}}var n}dispose(){this._stopSingular(),this.toUnhook.dispose()}};Itt.storedDecorations=new Eg,Itt.query=null,Itt=Dtt=Att([Mtt(4,so)],Itt);let Ptt=Ett=class extends Ki{static get(t){return t.getContribution(Ett.ID)}constructor(t,i,e,s){super(),this._wordHighlighter=null;const n=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this._wordHighlighter=new Itt(t,e.documentHighlightProvider,e.multiDocumentHighlightProvider,i,s))};this._register(t.onDidChangeModel((()=>{this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),n()}))),n()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!(!this._wordHighlighter||!this._wordHighlighter.hasDecorations())}moveNext(){var t;null===(t=this._wordHighlighter)||void 0===t||t.moveNext()}moveBack(){var t;null===(t=this._wordHighlighter)||void 0===t||t.moveBack()}restoreViewState(t){this._wordHighlighter&&t&&this._wordHighlighter.restore()}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};Ptt.ID="editor.contrib.wordHighlighter",Ptt=Ett=Att([Mtt(1,th),Mtt(2,op),Mtt(3,so)],Ptt);class Ntt extends Ga{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=Ptt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}iu(Ptt.ID,Ptt,0),Xa(class extends Ntt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:Q(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:Ltt,kbOpts:{kbExpr:PS.editorTextFocus,primary:65,weight:100}})}}),Xa(class extends Ntt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:Q(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:Ltt,kbOpts:{kbExpr:PS.editorTextFocus,primary:1089,weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"editor.action.wordHighlight.trigger",label:Q(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:Ltt.toNegated(),kbOpts:{kbExpr:PS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=Ptt.get(i);s&&s.restoreViewState(!0)}});class Btt extends qa{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=vf(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=new vs(t.positionLineNumber,t.positionColumn),e=this._move(s,n,i,this._wordNavigationType);return this._moveTo(t,e,this._inSelectionMode)}));if(n.pushStackElement(),i._getViewModel().setCursorStates("moveWordCommand",3,r.map((t=>XC.fromModelSelection(t)))),1===r.length){const t=new vs(r[0].positionLineNumber,r[0].positionColumn);i.revealPosition(t,0)}}_moveTo(t,i,e){return e?new ys(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new ys(i.lineNumber,i.column,i.lineNumber,i.column)}}class $tt extends Btt{_move(t,i,e,s){return gS.moveWordLeft(t,i,e,s)}}class Wtt extends Btt{_move(t,i,e,s){return gS.moveWordRight(t,i,e,s)}}class jtt extends qa{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(Nd);if(!i.hasModel())return;const n=vf(i.getOption(129)),r=i.getModel(),o=i.getSelections(),h=i.getOption(6),c=i.getOption(11),l=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),a=i._getViewModel(),u=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(9),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:l,autoClosedCharacters:a.getCursorAutoClosedCharacters()},this._wordNavigationType);return new oS(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,u),i.pushUndoStop()}}class Vtt extends jtt{_delete(t,i){return gS.deleteWordLeft(t,i)||new bs(1,1,1,1)}}class Htt extends jtt{_delete(t,i){const e=gS.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new bs(s,n,s,n)}}Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),Ya(new class extends $tt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),Ya(new class extends Wtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PS.textInputFocus,null===(t=Oo.and(_m,eW))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends $tt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Wtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(vf(Ai.wordSeparators.defaultValue),i,e,s)}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:PS.writable})}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:PS.writable})}}),Ya(new class extends Vtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:PS.writable})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:PS.writable})}}),Ya(new class extends Htt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),Xa(class extends Ga{constructor(){super({id:"deleteInsideWord",precondition:PS.writable,label:Q(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=vf(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=gS.deleteInsideWord(s,n,t);return new oS(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class ztt extends Btt{_move(t,i,e,s){return pS.moveWordPartLeft(t,i,e)}}mo.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),mo.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Utt extends Btt{_move(t,i,e,s){return pS.moveWordPartRight(t,i,e)}}Ya(new class extends jtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return pS.deleteWordPartLeft(t)||new bs(1,1,1,1)}}),Ya(new class extends jtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:PS.writable,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=pS.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new bs(s,n,s,n)}}),Ya(new class extends ztt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),Ya(new class extends ztt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),Ya(new class extends Utt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),Ya(new class extends Utt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:PS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Ktt extends Ki{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=XZ.get(this.editor);if(t&&this.editor.hasModel()){let i=this.editor.getOptions().get(91);i||(i=new bI(Q(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"))),t.showMessage(i,this.editor.getPosition())}}}Ktt.ID="editor.contrib.readOnlyMessageController",iu(Ktt.ID,Ktt,2);class qtt extends Ki{constructor(t){super(),this.editor=t,this.widget=null,yt&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(90);!this.widget&&t?this.widget=new Gtt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}qtt.ID="editor.contrib.iPadShowKeyboard";class Gtt extends Ki{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Il(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Il(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Gtt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Gtt.ID="editor.contrib.ShowKeyboardWidget",iu(qtt.ID,qtt,3);var Ztt,Jtt=function(t,i){return function(e,s){i(e,s,t)}};let Qtt=Ztt=class extends Ki{static get(t){return t.getContribution(Ztt.ID)}constructor(t,i,e){super(),this._editor=t,this._languageService=e,this._widget=null,this._register(this._editor.onDidChangeModel((()=>this.stop()))),this._register(this._editor.onDidChangeModelLanguage((()=>this.stop()))),this._register(Ws.onDidChange((()=>this.stop()))),this._register(this._editor.onKeyUp((t=>9===t.keyCode&&this.stop())))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new Ytt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Qtt.ID="editor.contrib.inspectTokens",Qtt=Ztt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Jtt(1,zV),Jtt(2,ud)],Qtt);class Ytt extends Ki{constructor(t,i){super(),this.allowEditorOverflow=!0,this._editor=t,this._languageService=i,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=function(t,i){const e=Ws.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>vp,tokenize:(t,e,s)=>bp(i,s),tokenizeEncoded:(t,i,e)=>yp(s,e)}}(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition((()=>this._compute(this._editor.getPosition())))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return Ytt._ID}_compute(t){const i=this._getTokensAtLine(t.lineNumber);let e=0;for(let s=i.tokens1.length-1;s>=0;s--)if(t.column-1>=i.tokens1[s].offset){e=s;break}let s=0;for(let e=i.tokens2.length>>>1;e>=0;e--)if(t.column-1>=i.tokens2[e<<1]){s=e;break}const n=this._model.getLineContent(t.lineNumber);let r="";e<i.tokens1.length&&(r=n.substring(i.tokens1[e].offset,e+1<i.tokens1.length?i.tokens1[e+1].offset:n.length)),Ea(this._domNode,Fa("h2.tm-token",void 0,function(t){let i="";for(let e=0,s=t.length;e<s;e++){const s=t.charCodeAt(e);switch(s){case 9:i+="→";break;case 32:i+="·";break;default:i+=String.fromCharCode(s)}}return i}(r),Fa("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),xa(this._domNode,Fa("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;xa(this._domNode,Fa("table.tm-metadata-table",void 0,Fa("tbody",void 0,Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"language"),Fa("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"token type"),Fa("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"font style"),Fa("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"foreground"),Fa("td.tm-metadata-value",void 0,`${o?Gg.Format.CSS.formatHex(o.foreground):"-?-"}`)),Fa("tr",void 0,Fa("td.tm-metadata-key",void 0,"background"),Fa("td.tm-metadata-value",void 0,`${o?Gg.Format.CSS.formatHex(o.background):"-?-"}`))))),xa(this._domNode,Fa("hr.tokens-inspect-separator")),e<i.tokens1.length&&xa(this._domNode,Fa("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ws.getColorMap(),e=kp.getLanguageId(t),s=kp.getTokenType(t),n=kp.getFontStyle(t),r=kp.getForeground(t),o=kp.getBackground(t);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(e),tokenType:s,fontStyle:n,foreground:i[r],background:i[o]}}_tokenTypeToString(t){switch(t){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(t){let i="";return 1&t&&(i+="italic "),2&t&&(i+="bold "),4&t&&(i+="underline "),8&t&&(i+="strikethrough "),0===i.length&&(i="---"),i}_getTokensAtLine(t){const i=this._getStateBeforeLine(t),e=this._tokenizationSupport.tokenize(this._model.getLineContent(t),!0,i),s=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(t),!0,i);return{startState:i,tokens1:e.tokens,tokens2:s.tokens,endState:e.endState}}_getStateBeforeLine(t){let i=this._tokenizationSupport.getInitialState();for(let e=1;e<t;e++)i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,i).endState;return i}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}}Ytt._ID="editor.contrib.inspectTokensWidget",iu(Qtt.ID,Qtt,4),Xa(class extends Ga{constructor(){super({id:"editor.action.inspectTokens",label:NO.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=Qtt.get(i);null==e||e.launch()}});var Xtt,tit=function(t,i){return function(e,s){i(e,s,t)}};let iit=Xtt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=mh.as(dj)}provide(t){const i=new Ui;return i.add(t.onDidAccept((()=>{const[i]=t.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),i.add(t.onDidChangeValue((t=>{const i=this.registry.getQuickAccessProvider(t.substr(Xtt.PREFIX.length));i&&i.prefix&&i.prefix!==Xtt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Xtt.PREFIX)),i}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort(((t,i)=>t.prefix.localeCompare(i.prefix))).flatMap((t=>this.createPicks(t)))}createPicks(t){return t.helpEntries.map((i=>{const e=i.prefix||t.prefix,s=e||"…";return{prefix:e,label:s,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:Q(0,"{0}, {1}",s,i.description),description:i.description}}))}};iit.PREFIX="?",iit=Xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tit(0,mj),tit(1,HC)],iit),mh.as(dj).registerQuickAccessProvider({ctor:iit,prefix:"",helpEntries:[{description:$O.helpQuickAccessActionLabel}]});class eit{constructor(t){this.options=t,this.rangeHighlightDecorationId=void 0}provide(t,i){var e;const s=new Ui;t.canAcceptInBackground=!!(null===(e=this.options)||void 0===e?void 0:e.canAcceptInBackground),t.matchOnLabel=t.matchOnDescription=t.matchOnDetail=t.sortByLabel=!1;const n=s.add(new qi);return n.value=this.doProvide(t,i),s.add(this.onDidActiveTextEditorControlChange((()=>{n.value=void 0,n.value=this.doProvide(t,i)}))),s}doProvide(t,i){var e;const s=new Ui,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const r={editor:n},o=uq(n);if(o){let t=null!==(e=n.saveViewState())&&void 0!==e?e:void 0;s.add(o.onDidChangeCursorPosition((()=>{var i;t=null!==(i=n.saveViewState())&&void 0!==i?i:void 0}))),r.restoreViewState=()=>{t&&n===this.activeTextEditorControl&&n.restoreViewState(t)},s.add(Wi(i.onCancellationRequested)((()=>{var t;return null===(t=r.restoreViewState)||void 0===t?void 0:t.call(r)})))}s.add(zi((()=>this.clearDecorations(n)))),s.add(this.provideWithTextEditor(r,t,i))}else s.add(this.provideWithoutTextEditor(t,i));return s}canProvideWithTextEditor(t){return!0}gotoLocation({editor:t},i){t.setSelection(i.range),t.revealRangeInCenter(i.range,0),i.preserveFocus||t.focus();const e=t.getModel();e&&"getLineContent"in e&&Sm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return aq(t)?null===(i=t.getModel())||void 0===i?void 0:i.modified:t.getModel()}addDecorations(t,i){t.changeDecorations((t=>{const e=[];this.rangeHighlightDecorationId&&(e.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),e.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:i,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:Bk(mC),position:bf.Full}}}],[n,r]=t.deltaDecorations(e,s);this.rangeHighlightDecorationId={rangeHighlightId:n,overviewRulerDecorationId:r}}))}clearDecorations(t){const i=this.rangeHighlightDecorationId;i&&(t.changeDecorations((t=>{t.deltaDecorations([i.overviewRulerDecorationId,i.rangeHighlightId],[])})),this.rangeHighlightDecorationId=void 0)}}class sit extends eit{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=Q(0,"Open a text editor first to go to a line.");return t.items=[{label:i}],t.ariaLabel=i,Ki.None}provideWithTextEditor(t,i,e){const s=t.editor,n=new Ui;n.add(i.onDidAccept((e=>{const[n]=i.selectedItems;if(n){if(!this.isValidLineNumber(s,n.lineNumber))return;this.gotoLocation(t,{range:this.toRange(n.lineNumber,n.column),keyMods:i.keyMods,preserveFocus:e.inBackground}),e.inBackground||i.hide()}})));const r=()=>{const t=this.parsePosition(s,i.value.trim().substr(sit.PREFIX.length)),e=this.getPickLabel(s,t.lineNumber,t.column);if(i.items=[{lineNumber:t.lineNumber,column:t.column,label:e}],i.ariaLabel=e,!this.isValidLineNumber(s,t.lineNumber))return void this.clearDecorations(s);const n=this.toRange(t.lineNumber,t.column);s.revealRangeInCenter(n,0),this.addDecorations(s,n)};r(),n.add(i.onDidChangeValue((()=>r())));const o=uq(s);return o&&2===o.getOptions().get(67).renderType&&(o.updateOptions({lineNumbers:"on"}),n.add(zi((()=>o.updateOptions({lineNumbers:"relative"}))))),n}toRange(t=1,i=1){return{startLineNumber:t,startColumn:i,endLineNumber:t,endColumn:i}}parsePosition(t,i){const e=i.split(/,|:|#/).map((t=>parseInt(t,10))).filter((t=>!isNaN(t))),s=this.lineCount(t)+1;return{lineNumber:e[0]>0?e[0]:s+e[0],column:e[1]}}getPickLabel(t,i,e){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,e)?Q(0,"Go to line {0} and character {1}.",i,e):Q(0,"Go to line {0}.",i);const s=t.getPosition()||{lineNumber:1,column:1},n=this.lineCount(t);return n>1?Q(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",s.lineNumber,s.column,n):Q(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",s.lineNumber,s.column)}isValidLineNumber(t,i){return!(!i||"number"!=typeof i)&&i>0&&i<=this.lineCount(t)}isValidColumn(t,i,e){if(!e||"number"!=typeof e)return!1;const s=this.getModel(t);if(!s)return!1;const n={lineNumber:i,column:e};return s.validatePosition(n).equals(n)}lineCount(t){var i,e;return null!==(e=null===(i=this.getModel(t))||void 0===i?void 0:i.getLineCount())&&void 0!==e?e:0}}sit.PREFIX=":";let nit=class extends sit{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Xi.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};nit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(0,so)],nit);class rit extends Ga{constructor(){super({id:rit.ID,label:BO.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(mj).quickAccess.show(nit.PREFIX)}}rit.ID="editor.action.gotoLine",Xa(rit),mh.as(dj).registerQuickAccessProvider({ctor:nit,prefix:nit.PREFIX,helpEntries:[{description:BO.gotoLineActionLabel,commandId:rit.ID}]});const oit=[void 0,[]];function hit(t,i,e=0,s=0){return i.values&&i.values.length>1?function(t,i,e,s){let n=0;const r=[];for(const o of i){const[i,h]=cit(t,o,e,s);if("number"!=typeof i)return oit;n+=i,r.push(...h)}return[n,lit(r)]}(t,i.values,e,s):cit(t,i,e,s)}function cit(t,i,e,s){const n=hI(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],q_(n)]:oit}function lit(t){const i=t.sort(((t,i)=>t.start-i.start)),e=[];let s;for(const t of i)!s||((n=s).end<(r=t).start||r.end<n.start)?(s=t,e.push(t)):(s.start=Math.min(s.start,t.start),s.end=Math.max(s.end,t.end));var n,r;return e}function ait(t){return t.startsWith('"')&&t.endsWith('"')}Object.freeze({score:0});const uit=" ";function dit(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=fit(t),r=e.indexOf(ts)>=0,o=ait(t);let h;const c=t.split(uit);if(c.length>1)for(const t of c){const i=ait(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=fit(t);s&&(h||(h=[]),h.push({original:t,originalLowercase:t.toLowerCase(),pathNormalized:e,normalized:s,normalizedLowercase:n,expectContiguousMatch:i}))}return{original:t,originalLowercase:i,pathNormalized:e,normalized:s,normalizedLowercase:n,values:h,containsPathSeparator:r,expectContiguousMatch:o}}function fit(t){let i;i=t.replace(gt?/\//g:/\\/g,ts);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function git(t){return Array.isArray(t)?dit(t.map((t=>t.original)).join(uit)):dit(t.original)}var pit,mit=function(t,i){return function(e,s){i(e,s,t)}};let wit=pit=class extends eit{constructor(t,i,e=Object.create(null)){super(e),this._languageFeaturesService=t,this._outlineModelService=i,this.options=e,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(t){return this.provideLabelPick(t,Q(0,"To go to a symbol, first open a text editor with symbol information.")),Ki.None}provideWithTextEditor(t,i,e){const s=this.getModel(t.editor);return s?this._languageFeaturesService.documentSymbolProvider.has(s)?this.doProvideWithEditorSymbols(t,s,i,e):this.doProvideWithoutEditorSymbols(t,s,i,e):Ki.None}doProvideWithoutEditorSymbols(t,i,e,s){const n=new Ui;return this.provideLabelPick(e,Q(0,"The active text editor does not provide symbol information.")),(async()=>{await this.waitForLanguageSymbolRegistry(i,n)&&!s.isCancellationRequested&&n.add(this.doProvideWithEditorSymbols(t,i,e,s))})(),n}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}async waitForLanguageSymbolRegistry(t,i){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new ac,s=i.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>{this._languageFeaturesService.documentSymbolProvider.has(t)&&(s.dispose(),e.complete(!0))})));return i.add(zi((()=>e.complete(!1)))),e.p}doProvideWithEditorSymbols(t,i,e,s){var n;const r=t.editor,o=new Ui;o.add(e.onDidAccept((i=>{const[s]=e.selectedItems;s&&s.range&&(this.gotoLocation(t,{range:s.range.selection,keyMods:e.keyMods,preserveFocus:i.inBackground}),i.inBackground||e.hide())}))),o.add(e.onDidTriggerItemButton((({item:i})=>{i&&i.range&&(this.gotoLocation(t,{range:i.range.selection,keyMods:e.keyMods,forceSideBySide:!0}),e.hide())})));const h=this.getDocumentSymbols(i,s);let c;const l=async t=>{null==c||c.dispose(!0),e.busy=!1,c=new pe(s),e.busy=!0;try{const i=dit(e.value.substr(pit.PREFIX.length).trim()),n=await this.doGetSymbolPicks(h,i,void 0,c.token);if(s.isCancellationRequested)return;if(n.length>0){if(e.items=n,t&&0===i.original.length){const i=zf(n,(i=>Boolean("separator"!==i.type&&i.range&&bs.containsPosition(i.range.decoration,t))));i&&(e.activeItems=[i])}}else this.provideLabelPick(e,Q(0,i.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{s.isCancellationRequested||(e.busy=!1)}};return o.add(e.onDidChangeValue((()=>l(void 0)))),l(null===(n=r.getSelection())||void 0===n?void 0:n.getPosition()),o.add(e.onDidChangeActive((()=>{const[t]=e.activeItems;t&&t.range&&(r.revealRangeInCenter(t.range.selection,0),this.addDecorations(r,t.range.decoration))}))),o}async doGetSymbolPicks(t,i,e,s){var n,r;const o=await t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(pit.SCOPE_PREFIX),c=h?1:0;let l,a,u;i.values&&i.values.length>1?(l=git(i.values[0]),a=git(i.values.slice(1))):l=i;const d=null===(r=null===(n=this.options)||void 0===n?void 0:n.openSideBySideDirection)||void 0===r?void 0:r.call(n);d&&(u=[{iconClass:go.asClassName("right"===d?xs.splitHorizontal:xs.splitVertical),tooltip:Q(0,"right"===d?"Open to the Side":"Open to the Bottom")}]);const f=[];for(let v=0;v<o.length;v++){const b=o[v],y=Wn(b.name),k=`$(${Is.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==e?void 0:e.extraContainerLabel)&&(A=A?`${e.extraContainerLabel} • ${A}`:e.extraContainerLabel),i.original.length>c){let L=!1;if(l!==i&&([S,x]=hit(k,{...i,values:void 0},c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=hit(k,l,c,C),"number"!=typeof S))continue;if(!L&&a){if(A&&a.original.length>0&&([D,E]=hit(A,a)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const M=b.tags&&b.tags.indexOf(1)>=0;f.push({index:v,kind:b.kind,score:S,label:k,ariaLabel:(g=b.name,p=b.kind,Q(0,"{0} ({1})",g,_s[p])),description:A,highlights:M?void 0:{label:x,description:E},range:{selection:bs.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:M,buttons:u})}var g,p;const m=f.sort(((t,i)=>h?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let w=[];if(h){let F,T,R=0;function O(){T&&"number"==typeof F&&R>0&&(T.label=Nn(bit[F]||vit,R))}for(const _ of m)F!==_.kind?(O(),F=_.kind,R=1,T={type:"separator"},w.push(T)):R++,w.push(_);O()}else m.length>0&&(w=[{label:Q(0,"symbols ({0})",f.length),type:"separator"},...m]);return w}compareByScore(t,i){if("number"!=typeof t.score&&"number"==typeof i.score)return 1;if("number"==typeof t.score&&"number"!=typeof i.score)return-1;if("number"==typeof t.score&&"number"==typeof i.score){if(t.score>i.score)return-1;if(t.score<i.score)return 1}return t.index<i.index?-1:t.index>i.index?1:0}compareByKindAndScore(t,i){const e=(bit[t.kind]||vit).localeCompare(bit[i.kind]||vit);return 0===e?this.compareByScore(t,i):e}async getDocumentSymbols(t,i){const e=await this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}};wit.PREFIX="@",wit.SCOPE_PREFIX=":",wit.PREFIX_BY_CATEGORY=`${pit.PREFIX}${pit.SCOPE_PREFIX}`,wit=pit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([mit(0,op),mit(1,g5)],wit);const vit=Q(0,"properties ({0})"),bit={5:Q(0,"methods ({0})"),11:Q(0,"functions ({0})"),8:Q(0,"constructors ({0})"),12:Q(0,"variables ({0})"),4:Q(0,"classes ({0})"),22:Q(0,"structs ({0})"),23:Q(0,"events ({0})"),24:Q(0,"operators ({0})"),10:Q(0,"interfaces ({0})"),2:Q(0,"namespaces ({0})"),3:Q(0,"packages ({0})"),25:Q(0,"type parameters ({0})"),1:Q(0,"modules ({0})"),6:Q(0,"properties ({0})"),9:Q(0,"enumerations ({0})"),21:Q(0,"enumeration members ({0})"),14:Q(0,"strings ({0})"),0:Q(0,"files ({0})"),17:Q(0,"arrays ({0})"),15:Q(0,"numbers ({0})"),16:Q(0,"booleans ({0})"),18:Q(0,"objects ({0})"),19:Q(0,"keys ({0})"),7:Q(0,"fields ({0})"),13:Q(0,"constants ({0})")};var yit=function(t,i){return function(e,s){i(e,s,t)}};let kit=class extends wit{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Xi.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};kit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([yit(0,so),yit(1,op),yit(2,g5)],kit);class Cit extends Ga{constructor(){super({id:Cit.ID,label:jO.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:PS.hasDocumentSymbolProvider,kbOpts:{kbExpr:PS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(mj).quickAccess.show(wit.PREFIX,{itemActivation:pj.NONE})}}function Sit(t,i){return i&&(t.stack||t.stacktrace)?Q(0,"{0}: {1}",Dit(t),xit(t.stack)||xit(t.stacktrace)):Dit(t)}function xit(t){return Array.isArray(t)?t.join("\n"):t}function Dit(t){return"ERR_UNC_HOST_NOT_ALLOWED"===t.code?`${t.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:"string"==typeof t.code&&"number"==typeof t.errno&&"string"==typeof t.syscall?Q(0,"A system error occurred ({0})",t.message):t.message||Q(0,"An unknown error occurred. Please consult the log for more details.")}function Eit(t=null,i=!1){if(!t)return Q(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const e=c(t),s=Eit(e[0],i);return e.length>1?Q(0,"{0} ({1} errors in total)",s,e.length):s}if(L(t))return t;if(t.detail){const e=t.detail;if(e.error)return Sit(e.error,i);if(e.exception)return Sit(e.exception,i)}return t.stack?Sit(t,i):t.message?t.message:Q(0,"An unknown error occurred. Please consult the log for more details.")}Cit.ID="editor.action.quickOutline",Xa(Cit),mh.as(dj).registerQuickAccessProvider({ctor:kit,prefix:wit.PREFIX,helpEntries:[{description:jO.quickOutlineActionLabel,prefix:wit.PREFIX,commandId:Cit.ID},{description:jO.quickOutlineByCategoryActionLabel,prefix:wit.PREFIX_BY_CATEGORY}]});class Ait{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(t,i){const e=this.computeEmbedding(t),s=new Map,n=[];for(const[t,r]of this.documents){if(i.isCancellationRequested)return[];for(const i of r.chunks){const r=this.computeSimilarityScore(i,e,s);r>0&&n.push({key:t,score:r})}}return n}static termFrequencies(t){return function(t){var i;const e=new Map;for(const s of t)e.set(s,(null!==(i=e.get(s))&&void 0!==i?i:0)+1);return e}(Ait.splitTerms(t))}static*splitTerms(t){const i=t=>t.toLowerCase();for(const[e]of t.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield i(e);const t=e.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(t.length>1)for(const e of t)e.length>2&&/\p{Letter}{3,}/gu.test(e)&&(yield i(e))}}updateDocuments(t){var i;for(const{key:i}of t)this.deleteDocument(i);for(const e of t){const t=[];for(const s of e.textChunks){const e=Ait.termFrequencies(s);for(const t of e.keys())this.chunkOccurrences.set(t,(null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0)+1);t.push({text:s,tf:e})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(t){const i=this.documents.get(t);if(i){this.documents.delete(t),this.chunkCount-=i.chunks.length;for(const t of i.chunks)for(const i of t.tf.keys()){const t=this.chunkOccurrences.get(i);if("number"==typeof t){const e=t-1;e<=0?this.chunkOccurrences.delete(i):this.chunkOccurrences.set(i,e)}}}}computeSimilarityScore(t,i,e){let s=0;for(const[n,r]of Object.entries(i)){const i=t.tf.get(n);if(!i)continue;let o=e.get(n);"number"!=typeof o&&(o=this.computeIdf(n),e.set(n,o)),s+=i*o*r}return s}computeEmbedding(t){const i=Ait.termFrequencies(t);return this.computeTfidf(i)}computeIdf(t){var i;const e=null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(t){const i=Object.create(null);for(const[e,s]of t){const t=this.computeIdf(e);t>0&&(i[e]=s*t)}return i}}var Mit;function Lit(t){return Array.isArray(t.items)}function Fit(t){return!!t.picks&&t.additionalPicks instanceof Promise}!function(t){t[t.NO_ACTION=0]="NO_ACTION",t[t.CLOSE_PICKER=1]="CLOSE_PICKER",t[t.REFRESH_PICKER=2]="REFRESH_PICKER",t[t.REMOVE_ITEM=3]="REMOVE_ITEM"}(Mit||(Mit={}));class Tit extends Ki{constructor(t,i){super(),this.prefix=t,this.options=i}provide(t,i,e){var s;const n=new Ui;let r;t.canAcceptInBackground=!!(null===(s=this.options)||void 0===s?void 0:s.canAcceptInBackground),t.matchOnLabel=t.matchOnDescription=t.matchOnDetail=t.sortByLabel=!1;const o=n.add(new qi),h=async()=>{const s=o.value=new Ui;null==r||r.dispose(!0),t.busy=!1,r=new pe(i);const n=r.token,h=t.value.substr(this.prefix.length).trim(),c=this._getPicks(h,s,n,e),l=(i,e)=>{var s;let n,r;if(Lit(i)?(n=i.items,r=i.active):n=i,0===n.length){if(e)return!1;(h.length>0||t.hideInput)&&(null===(s=this.options)||void 0===s?void 0:s.noResultsPick)&&(n=W(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},a=async i=>{let e=!1,s=!1;await Promise.all([(async()=>{"number"==typeof i.mergeDelay&&(await tc(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})(),(async()=>{t.busy=!0;try{const s=await i.additionalPicks;if(n.isCancellationRequested)return;let r,o,h,c;if(Lit(i.picks)?(r=i.picks.items,o=i.picks.active):r=i.picks,Lit(s)?(h=s.items,c=s.active):h=s,h.length>0||!e){let i;if(!o&&!c){const e=t.activeItems[0];e&&-1!==r.indexOf(e)&&(i=e)}l({items:[...r,...h],active:o||c||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})()])};if(null===c);else if(Fit(c))await a(c);else if(c instanceof Promise){t.busy=!0;try{const t=await c;if(n.isCancellationRequested)return;Fit(t)?await a(t):l(t)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)};return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((async({button:e,item:s})=>{var n,r;if("function"==typeof s.trigger){const o=null!==(r=null===(n=s.buttons)||void 0===n?void 0:n.indexOf(e))&&void 0!==r?r:-1;if(o>=0){const e=s.trigger(o,t.keyMods),n="number"==typeof e?e:await e;if(i.isCancellationRequested)return;switch(n){case Mit.NO_ACTION:break;case Mit.CLOSE_PICKER:t.hide();break;case Mit.REFRESH_PICKER:h();break;case Mit.REMOVE_ITEM:{const i=t.items.indexOf(s);if(-1!==i){const e=t.items.slice(),s=e.splice(i,1),n=t.activeItems.filter((t=>t!==s[0])),r=t.keepScrollPosition;t.keepScrollPosition=!0,t.items=e,n&&(t.activeItems=n),t.keepScrollPosition=r}break}}}}}))),n}}var Rit,Oit,_it=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},Iit=function(t,i){return function(e,s){i(e,s,t)}};let Pit=Rit=class extends Tit{constructor(t,i,e,s,n,r){super(Rit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Nit)),this.options=t}async _getPicks(t,i,e,s){var n,r,o,h;const c=await this.getCommandPicks(e);if(e.isCancellationRequested)return[];const l=Wi((()=>{const i=new Ait;return i.updateDocuments(c.map((t=>({key:t.commandId,textChunks:[this.getTfIdfChunk(t)]})))),function(t){var i,e;const s=t.slice(0);s.sort(((t,i)=>i.score-t.score));const n=null!==(e=null===(i=s[0])||void 0===i?void 0:i.score)&&void 0!==e?e:0;if(n>0)for(const t of s)t.score/=n;return s}(i.calculateScores(t,e)).filter((t=>t.score>Rit.TFIDF_THRESHOLD)).slice(0,Rit.TFIDF_MAX_RESULTS)})),a=[];for(const i of c){const s=null!==(n=Rit.WORD_FILTER(t,i.label))&&void 0!==n?n:void 0,o=i.commandAlias&&null!==(r=Rit.WORD_FILTER(t,i.commandAlias))&&void 0!==r?r:void 0;if(s||o)i.highlights={label:s,detail:this.options.showAlias?o:void 0},a.push(i);else if(t===i.commandId)a.push(i);else if(t.length>=3){const t=l();if(e.isCancellationRequested)return[];const s=t.find((t=>t.key===i.commandId));s&&(i.tfIdfScore=s.score,a.push(i))}}const u=new Map;for(const t of a){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}a.sort(((t,i)=>{if(t.tfIdfScore&&i.tfIdfScore)return t.tfIdfScore===i.tfIdfScore?t.label.localeCompare(i.label):i.tfIdfScore-t.tfIdfScore;if(t.tfIdfScore)return 1;if(i.tfIdfScore)return-1;const e=this.commandsHistory.peek(t.commandId),s=this.commandsHistory.peek(i.commandId);if(e&&s)return e>s?-1:1;if(e)return-1;if(s)return 1;if(this.options.suggestedCommandIds){const e=this.options.suggestedCommandIds.has(t.commandId),s=this.options.suggestedCommandIds.has(i.commandId);if(e&&s)return 0;if(e)return-1;if(s)return 1}return t.label.localeCompare(i.label)}));const d=[];let f=!1,g=!0,p=!!this.options.suggestedCommandIds;for(let t=0;t<a.length;t++){const i=a[t];0===t&&this.commandsHistory.peek(i.commandId)&&(d.push({type:"separator",label:Q(0,"recently used")}),f=!0),g&&void 0!==i.tfIdfScore&&(d.push({type:"separator",label:Q(0,"similar commands")}),g=!1),p&&void 0===i.tfIdfScore&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(d.push({type:"separator",label:Q(0,"commonly used")}),f=!0,p=!1),!f||void 0!==i.tfIdfScore||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(d.push({type:"separator",label:Q(0,"other commands")}),f=!1),d.push(this.toCommandPick(i,s))}return this.hasAdditionalCommandPicks(t,e)?{picks:d,additionalPicks:(async()=>{var i;const n=await this.getAdditionalCommandPicks(c,a,t,e);if(e.isCancellationRequested)return[];const r=n.map((t=>this.toCommandPick(t,s)));return g&&"separator"!==(null===(i=r[0])||void 0===i?void 0:i.type)&&r.unshift({type:"separator",label:Q(0,"similar commands")}),r})()}:d}toCommandPick(t,i){if("separator"===t.type)return t;const e=this.keybindingService.lookupKeybinding(t.commandId),s=e?Q(0,"{0}, {1}",t.label,e.getAriaLabel()):t.label;return{...t,ariaLabel:s,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:e,accept:async()=>{var e,s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(e=null==i?void 0:i.from)&&void 0!==e?e:"quick open"});try{(null===(s=t.args)||void 0===s?void 0:s.length)?await this.commandService.executeCommand(t.commandId,...t.args):await this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(Q(0,"Command '{0}' resulted in an error",t.label),Eit(i))}}}}getTfIdfChunk({label:t,commandAlias:i,commandDescription:e}){let s=t;return i&&i!==t&&(s+=` - ${i}`),e&&e.value!==t&&(s+=` - ${e.value===e.original?e.value:`${e.value} (${e.original})`}`),s}};Pit.PREFIX=">",Pit.TFIDF_THRESHOLD=.5,Pit.TFIDF_MAX_RESULTS=5,Pit.WORD_FILTER=b_(y_,(function(t,i,e=!1){if(!i||0===i.length)return null;let s=null,n=0;for(t=t.toLowerCase(),i=i.toLowerCase();n<i.length&&(s=$_(t,i,0,n,e),null===s);)n=W_(i,n+1);return s}),C_),Pit=Rit=_it([Iit(1,io),Iit(2,HC),Iit(3,po),Iit(4,Th),Iit(5,_T)],Pit);let Nit=Oit=class extends Ki{constructor(t,i){super(),this.storageService=t,this.configurationService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration((t=>this.updateConfiguration(t)))),this._register(this.storageService.onWillSaveState((t=>{t.reason===uN.SHUTDOWN&&this.saveState()})))}updateConfiguration(t){t&&!t.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Oit.getConfiguredCommandHistoryLength(this.configurationService),Oit.cache&&Oit.cache.limit!==this.configuredCommandsHistoryLength&&(Oit.cache.limit=this.configuredCommandsHistoryLength,Oit.hasChanges=!0))}load(){const t=this.storageService.get(Oit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=Oit.cache=new Mg(this.configuredCommandsHistoryLength,1);if(i){let t;t=i.usesLRU?i.entries:i.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>e.set(t.key,t.value)))}Oit.counter=this.storageService.getNumber(Oit.PREF_KEY_COUNTER,0,Oit.counter)}push(t){Oit.cache&&(Oit.cache.set(t,Oit.counter++),Oit.hasChanges=!0)}peek(t){var i;return null===(i=Oit.cache)||void 0===i?void 0:i.peek(t)}saveState(){if(!Oit.cache)return;if(!Oit.hasChanges)return;const t={usesLRU:!0,entries:[]};Oit.cache.forEach(((i,e)=>t.entries.push({key:e,value:i}))),this.storageService.store(Oit.PREF_KEY_CACHE,JSON.stringify(t),0,0),this.storageService.store(Oit.PREF_KEY_COUNTER,Oit.counter,0,0),Oit.hasChanges=!1}static getConfiguredCommandHistoryLength(t){var i,e;const s=null===(e=null===(i=t.getValue().workbench)||void 0===i?void 0:i.commandPalette)||void 0===e?void 0:e.history;return"number"==typeof s?s:Oit.DEFAULT_COMMANDS_HISTORY_LENGTH}};Nit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Nit.PREF_KEY_CACHE="commandPalette.mru.cache",Nit.PREF_KEY_COUNTER="commandPalette.mru.counter",Nit.counter=1,Nit.hasChanges=!1,Nit=Oit=_it([Iit(0,aN),Iit(1,rd)],Nit);class Bit extends Pit{constructor(t,i,e,s,n,r){super(t,i,e,s,n,r)}getCodeEditorCommandPicks(){const t=this.activeTextEditorControl;if(!t)return[];const i=[];for(const e of t.getSupportedActions())i.push({commandId:e.id,commandAlias:e.alias,label:pI(e.label)||e.id});return i}}var $it=function(t,i){return function(e,s){i(e,s,t)}};let Wit=class extends Bit{get activeTextEditorControl(){var t;return null!==(t=this.codeEditorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};Wit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$it(0,io),$it(1,so),$it(2,HC),$it(3,po),$it(4,Th),$it(5,_T)],Wit);class jit extends Ga{constructor(){super({id:jit.ID,label:WO.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:PS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(mj).quickAccess.show(Wit.PREFIX)}}jit.ID="editor.action.quickCommand",Xa(jit),mh.as(dj).registerQuickAccessProvider({ctor:Wit,prefix:Wit.PREFIX,helpEntries:[{description:WO.quickCommandHelp,commandId:jit.ID}]});var Vit=function(t,i){return function(e,s){i(e,s,t)}};let Hit=class extends bY{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Hit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Vit(1,th),Vit(2,so),Vit(3,VF),Vit(4,io),Vit(5,aN),Vit(6,rd)],Hit),iu(bY.ID,Hit,4),Xa(class extends Ga{constructor(){super({id:"editor.action.toggleHighContrast",label:HO.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(zV),s=e.getColorTheme();Ey(s.type)?(e.setTheme(this._originalThemeName||(Ay(s.type)?IV:_V)),this._originalThemeName=null):(e.setTheme(Ay(s.type)?PV:NV),this._originalThemeName=s.themeName)}});var zit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Uit(t,i,e){return t(e={path:i,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},e.exports),e.exports}var Kit=Uit((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,l,a,u,d,f,g,p,m,w,v,b,y,k,C,S,x,D,E,A,M,L;Object.defineProperty(i,"__esModule",{value:!0}),i.TextDocument=i.EOL=i.WorkspaceFolder=i.InlineCompletionContext=i.SelectedCompletionInfo=i.InlineCompletionTriggerKind=i.InlineCompletionList=i.InlineCompletionItem=i.StringValue=i.InlayHint=i.InlayHintLabelPart=i.InlayHintKind=i.InlineValueContext=i.InlineValueEvaluatableExpression=i.InlineValueVariableLookup=i.InlineValueText=i.SemanticTokens=i.SemanticTokenModifiers=i.SemanticTokenTypes=i.SelectionRange=i.DocumentLink=i.FormattingOptions=i.CodeLens=i.CodeAction=i.CodeActionContext=i.CodeActionTriggerKind=i.CodeActionKind=i.DocumentSymbol=i.WorkspaceSymbol=i.SymbolInformation=i.SymbolTag=i.SymbolKind=i.DocumentHighlight=i.DocumentHighlightKind=i.SignatureInformation=i.ParameterInformation=i.Hover=i.MarkedString=i.CompletionList=i.CompletionItem=i.CompletionItemLabelDetails=i.InsertTextMode=i.InsertReplaceEdit=i.CompletionItemTag=i.InsertTextFormat=i.CompletionItemKind=i.MarkupContent=i.MarkupKind=i.TextDocumentItem=i.OptionalVersionedTextDocumentIdentifier=i.VersionedTextDocumentIdentifier=i.TextDocumentIdentifier=i.WorkspaceChange=i.WorkspaceEdit=i.DeleteFile=i.RenameFile=i.CreateFile=i.TextDocumentEdit=i.AnnotatedTextEdit=i.ChangeAnnotationIdentifier=i.ChangeAnnotation=i.TextEdit=i.Command=i.Diagnostic=i.CodeDescription=i.DiagnosticTag=i.DiagnosticSeverity=i.DiagnosticRelatedInformation=i.FoldingRange=i.FoldingRangeKind=i.ColorPresentation=i.ColorInformation=i.Color=i.LocationLink=i.Location=i.Range=i.Position=i.uinteger=i.integer=i.URI=i.DocumentUri=void 0,function(t){t.is=function(t){return"string"==typeof t}}(e||(i.DocumentUri=e={})),function(t){t.is=function(t){return"string"==typeof t}}(s||(i.URI=s={})),function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(n||(i.integer=n={})),function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(r||(i.uinteger=r={})),function(t){t.create=function(t,i){return t===Number.MAX_VALUE&&(t=r.MAX_VALUE),i===Number.MAX_VALUE&&(i=r.MAX_VALUE),{line:t,character:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.uinteger(i.line)&&Ft.uinteger(i.character)}}(o||(i.Position=o={})),function(t){t.create=function(t,i,e,s){if(Ft.uinteger(t)&&Ft.uinteger(i)&&Ft.uinteger(e)&&Ft.uinteger(s))return{start:o.create(t,i),end:o.create(e,s)};if(o.is(t)&&o.is(i))return{start:t,end:i};throw new Error("Range#create called with invalid arguments[".concat(t,", ").concat(i,", ").concat(e,", ").concat(s,"]"))},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&o.is(i.start)&&o.is(i.end)}}(h||(i.Range=h={})),function(t){t.create=function(t,i){return{uri:t,range:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.range)&&(Ft.string(i.uri)||Ft.undefined(i.uri))}}(c||(i.Location=c={})),function(t){t.create=function(t,i,e,s){return{targetUri:t,targetRange:i,targetSelectionRange:e,originSelectionRange:s}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.targetRange)&&Ft.string(i.targetUri)&&h.is(i.targetSelectionRange)&&(h.is(i.originSelectionRange)||Ft.undefined(i.originSelectionRange))}}(l||(i.LocationLink=l={})),function(t){t.create=function(t,i,e,s){return{red:t,green:i,blue:e,alpha:s}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.numberRange(i.red,0,1)&&Ft.numberRange(i.green,0,1)&&Ft.numberRange(i.blue,0,1)&&Ft.numberRange(i.alpha,0,1)}}(a||(i.Color=a={})),function(t){t.create=function(t,i){return{range:t,color:i}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&h.is(i.range)&&a.is(i.color)}}(u||(i.ColorInformation=u={})),function(t){t.create=function(t,i,e){return{label:t,textEdit:i,additionalTextEdits:e}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.label)&&(Ft.undefined(i.textEdit)||k.is(i))&&(Ft.undefined(i.additionalTextEdits)||Ft.typedArray(i.additionalTextEdits,k.is))}}(d||(i.ColorPresentation=d={})),function(t){t.Comment="comment",t.Imports="imports",t.Region="region"}(f||(i.FoldingRangeKind=f={})),function(t){t.create=function(t,i,e,s,n,r){var o={startLine:t,endLine:i};return Ft.defined(e)&&(o.startCharacter=e),Ft.defined(s)&&(o.endCharacter=s),Ft.defined(n)&&(o.kind=n),Ft.defined(r)&&(o.collapsedText=r),o},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.uinteger(i.startLine)&&Ft.uinteger(i.startLine)&&(Ft.undefined(i.startCharacter)||Ft.uinteger(i.startCharacter))&&(Ft.undefined(i.endCharacter)||Ft.uinteger(i.endCharacter))&&(Ft.undefined(i.kind)||Ft.string(i.kind))}}(g||(i.FoldingRange=g={})),function(t){t.create=function(t,i){return{location:t,message:i}},t.is=function(t){var i=t;return Ft.defined(i)&&c.is(i.location)&&Ft.string(i.message)}}(p||(i.DiagnosticRelatedInformation=p={})),function(t){t.Error=1,t.Warning=2,t.Information=3,t.Hint=4}(m||(i.DiagnosticSeverity=m={})),function(t){t.Unnecessary=1,t.Deprecated=2}(w||(i.DiagnosticTag=w={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.href)}}(v||(i.CodeDescription=v={})),function(t){t.create=function(t,i,e,s,n,r){var o={range:t,message:i};return Ft.defined(e)&&(o.severity=e),Ft.defined(s)&&(o.code=s),Ft.defined(n)&&(o.source=n),Ft.defined(r)&&(o.relatedInformation=r),o},t.is=function(t){var i,e=t;return Ft.defined(e)&&h.is(e.range)&&Ft.string(e.message)&&(Ft.number(e.severity)||Ft.undefined(e.severity))&&(Ft.integer(e.code)||Ft.string(e.code)||Ft.undefined(e.code))&&(Ft.undefined(e.codeDescription)||Ft.string(null===(i=e.codeDescription)||void 0===i?void 0:i.href))&&(Ft.string(e.source)||Ft.undefined(e.source))&&(Ft.undefined(e.relatedInformation)||Ft.typedArray(e.relatedInformation,p.is))}}(b||(i.Diagnostic=b={})),function(t){t.create=function(t,i){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];var n={title:t,command:i};return Ft.defined(e)&&e.length>0&&(n.arguments=e),n},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.title)&&Ft.string(i.command)}}(y||(i.Command=y={})),function(t){t.replace=function(t,i){return{range:t,newText:i}},t.insert=function(t,i){return{range:{start:t,end:t},newText:i}},t.del=function(t){return{range:t,newText:""}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.newText)&&h.is(i.range)}}(k||(i.TextEdit=k={})),function(t){t.create=function(t,i,e){var s={label:t};return void 0!==i&&(s.needsConfirmation=i),void 0!==e&&(s.description=e),s},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&Ft.string(i.label)&&(Ft.boolean(i.needsConfirmation)||void 0===i.needsConfirmation)&&(Ft.string(i.description)||void 0===i.description)}}(C||(i.ChangeAnnotation=C={})),function(t){t.is=function(t){return Ft.string(t)}}(S||(i.ChangeAnnotationIdentifier=S={})),function(t){t.replace=function(t,i,e){return{range:t,newText:i,annotationId:e}},t.insert=function(t,i,e){return{range:{start:t,end:t},newText:i,annotationId:e}},t.del=function(t,i){return{range:t,newText:"",annotationId:i}},t.is=function(t){var i=t;return k.is(i)&&(C.is(i.annotationId)||S.is(i.annotationId))}}(x||(i.AnnotatedTextEdit=x={})),function(t){t.create=function(t,i){return{textDocument:t,edits:i}},t.is=function(t){var i=t;return Ft.defined(i)&&R.is(i.textDocument)&&Array.isArray(i.edits)}}(D||(i.TextDocumentEdit=D={})),function(t){t.create=function(t,i,e){var s={kind:"create",uri:t};return void 0===i||void 0===i.overwrite&&void 0===i.ignoreIfExists||(s.options=i),void 0!==e&&(s.annotationId=e),s},t.is=function(t){var i=t;return i&&"create"===i.kind&&Ft.string(i.uri)&&(void 0===i.options||(void 0===i.options.overwrite||Ft.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ft.boolean(i.options.ignoreIfExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(E||(i.CreateFile=E={})),function(t){t.create=function(t,i,e,s){var n={kind:"rename",oldUri:t,newUri:i};return void 0===e||void 0===e.overwrite&&void 0===e.ignoreIfExists||(n.options=e),void 0!==s&&(n.annotationId=s),n},t.is=function(t){var i=t;return i&&"rename"===i.kind&&Ft.string(i.oldUri)&&Ft.string(i.newUri)&&(void 0===i.options||(void 0===i.options.overwrite||Ft.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ft.boolean(i.options.ignoreIfExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(A||(i.RenameFile=A={})),function(t){t.create=function(t,i,e){var s={kind:"delete",uri:t};return void 0===i||void 0===i.recursive&&void 0===i.ignoreIfNotExists||(s.options=i),void 0!==e&&(s.annotationId=e),s},t.is=function(t){var i=t;return i&&"delete"===i.kind&&Ft.string(i.uri)&&(void 0===i.options||(void 0===i.options.recursive||Ft.boolean(i.options.recursive))&&(void 0===i.options.ignoreIfNotExists||Ft.boolean(i.options.ignoreIfNotExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(M||(i.DeleteFile=M={})),function(t){t.is=function(t){return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every((function(t){return Ft.string(t.kind)?E.is(t)||A.is(t)||M.is(t):D.is(t)})))}}(L||(i.WorkspaceEdit=L={}));var F,T,R,O,_,I,P,N,B,$,W,j,V,H,z,U,K,q,G,Z,J,Q,Y,X,tt,it,et,st,nt,rt,ot,ht,ct,lt,at,ut,dt,ft,gt,pt,mt,wt,vt,bt,yt,kt,Ct,St,xt,Dt,Et,At=function(){function t(t,i){this.edits=t,this.changeAnnotations=i}return t.prototype.insert=function(t,i,e){var s,n;if(void 0===e?s=k.insert(t,i):S.is(e)?(n=e,s=x.insert(t,i,e)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(e),s=x.insert(t,i,n)),this.edits.push(s),void 0!==n)return n},t.prototype.replace=function(t,i,e){var s,n;if(void 0===e?s=k.replace(t,i):S.is(e)?(n=e,s=x.replace(t,i,e)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(e),s=x.replace(t,i,n)),this.edits.push(s),void 0!==n)return n},t.prototype.delete=function(t,i){var e,s;if(void 0===i?e=k.del(t):S.is(i)?(s=i,e=x.del(t,i)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(i),e=x.del(t,s)),this.edits.push(e),void 0!==s)return s},t.prototype.add=function(t){this.edits.push(t)},t.prototype.all=function(){return this.edits},t.prototype.clear=function(){this.edits.splice(0,this.edits.length)},t.prototype.assertChangeAnnotations=function(t){if(void 0===t)throw new Error("Text edit change is not configured to manage change annotations.")},t}(),Mt=function(){function t(t){this._annotations=void 0===t?Object.create(null):t,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(t,i){var e;if(S.is(t)?e=t:(e=this.nextId(),i=t),void 0!==this._annotations[e])throw new Error("Id ".concat(e," is already in use."));if(void 0===i)throw new Error("No annotation provided for id ".concat(e));return this._annotations[e]=i,this._size++,e},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),Lt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Mt(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach((function(t){if(D.is(t)){var e=new At(t.edits,i._changeAnnotations);i._textEditChanges[t.textDocument.uri]=e}}))):t.changes&&Object.keys(t.changes).forEach((function(e){var s=new At(t.changes[e]);i._textEditChanges[e]=s}))):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(this._workspaceEdit.changeAnnotations=0===this._changeAnnotations.size?void 0:this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(t){if(R.is(t)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var i={uri:t.uri,version:t.version};return(e=this._textEditChanges[i.uri])||(this._workspaceEdit.documentChanges.push({textDocument:i,edits:s=[]}),e=new At(s,this._changeAnnotations),this._textEditChanges[i.uri]=e),e}if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var e,s;return(e=this._textEditChanges[t])||(this._workspaceEdit.changes[t]=s=[],e=new At(s),this._textEditChanges[t]=e),e},t.prototype.initDocumentChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new Mt,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=E.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=E.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t.prototype.renameFile=function(t,i,e,s){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n,r,o;if(C.is(e)||S.is(e)?n=e:s=e,void 0===n?r=A.create(t,i,s):(o=S.is(n)?n:this._changeAnnotations.manage(n),r=A.create(t,i,s,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},t.prototype.deleteFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=M.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=M.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Lt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)}}(F||(i.TextDocumentIdentifier=F={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&Ft.integer(i.version)}}(T||(i.VersionedTextDocumentIdentifier=T={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&(null===i.version||Ft.integer(i.version))}}(R||(i.OptionalVersionedTextDocumentIdentifier=R={})),function(t){t.create=function(t,i,e,s){return{uri:t,languageId:i,version:e,text:s}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.string(i.uri)&&Ft.string(i.languageId)&&Ft.integer(i.version)&&Ft.string(i.text)}}(O||(i.TextDocumentItem=O={})),function(t){t.PlainText="plaintext",t.Markdown="markdown",t.is=function(i){return i===t.PlainText||i===t.Markdown}}(_||(i.MarkupKind=_={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(t)&&_.is(i.kind)&&Ft.string(i.value)}}(I||(i.MarkupContent=I={})),function(t){t.Text=1,t.Method=2,t.Function=3,t.Constructor=4,t.Field=5,t.Variable=6,t.Class=7,t.Interface=8,t.Module=9,t.Property=10,t.Unit=11,t.Value=12,t.Enum=13,t.Keyword=14,t.Snippet=15,t.Color=16,t.File=17,t.Reference=18,t.Folder=19,t.EnumMember=20,t.Constant=21,t.Struct=22,t.Event=23,t.Operator=24,t.TypeParameter=25}(P||(i.CompletionItemKind=P={})),function(t){t.PlainText=1,t.Snippet=2}(N||(i.InsertTextFormat=N={})),function(t){t.Deprecated=1}(B||(i.CompletionItemTag=B={})),function(t){t.create=function(t,i,e){return{newText:t,insert:i,replace:e}},t.is=function(t){var i=t;return i&&Ft.string(i.newText)&&h.is(i.insert)&&h.is(i.replace)}}($||(i.InsertReplaceEdit=$={})),function(t){t.asIs=1,t.adjustIndentation=2}(W||(i.InsertTextMode=W={})),function(t){t.is=function(t){var i=t;return i&&(Ft.string(i.detail)||void 0===i.detail)&&(Ft.string(i.description)||void 0===i.description)}}(j||(i.CompletionItemLabelDetails=j={})),function(t){t.create=function(t){return{label:t}}}(V||(i.CompletionItem=V={})),function(t){t.create=function(t,i){return{items:t||[],isIncomplete:!!i}}}(H||(i.CompletionList=H={})),function(t){t.fromPlainText=function(t){return t.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},t.is=function(t){var i=t;return Ft.string(i)||Ft.objectLiteral(i)&&Ft.string(i.language)&&Ft.string(i.value)}}(z||(i.MarkedString=z={})),function(t){t.is=function(t){var i=t;return!!i&&Ft.objectLiteral(i)&&(I.is(i.contents)||z.is(i.contents)||Ft.typedArray(i.contents,z.is))&&(void 0===t.range||h.is(t.range))}}(U||(i.Hover=U={})),function(t){t.create=function(t,i){return i?{label:t,documentation:i}:{label:t}}}(K||(i.ParameterInformation=K={})),function(t){t.create=function(t,i){for(var e=[],s=2;s<arguments.length;s++)e[s-2]=arguments[s];var n={label:t};return Ft.defined(i)&&(n.documentation=i),n.parameters=Ft.defined(e)?e:[],n}}(q||(i.SignatureInformation=q={})),function(t){t.Text=1,t.Read=2,t.Write=3}(G||(i.DocumentHighlightKind=G={})),function(t){t.create=function(t,i){var e={range:t};return Ft.number(i)&&(e.kind=i),e}}(Z||(i.DocumentHighlight=Z={})),function(t){t.File=1,t.Module=2,t.Namespace=3,t.Package=4,t.Class=5,t.Method=6,t.Property=7,t.Field=8,t.Constructor=9,t.Enum=10,t.Interface=11,t.Function=12,t.Variable=13,t.Constant=14,t.String=15,t.Number=16,t.Boolean=17,t.Array=18,t.Object=19,t.Key=20,t.Null=21,t.EnumMember=22,t.Struct=23,t.Event=24,t.Operator=25,t.TypeParameter=26}(J||(i.SymbolKind=J={})),function(t){t.Deprecated=1}(Q||(i.SymbolTag=Q={})),function(t){t.create=function(t,i,e,s,n){var r={name:t,kind:i,location:{uri:s,range:e}};return n&&(r.containerName=n),r}}(Y||(i.SymbolInformation=Y={})),function(t){t.create=function(t,i,e,s){return void 0!==s?{name:t,kind:i,location:{uri:e,range:s}}:{name:t,kind:i,location:{uri:e}}}}(X||(i.WorkspaceSymbol=X={})),function(t){t.create=function(t,i,e,s,n,r){var o={name:t,detail:i,kind:e,range:s,selectionRange:n};return void 0!==r&&(o.children=r),o},t.is=function(t){var i=t;return i&&Ft.string(i.name)&&Ft.number(i.kind)&&h.is(i.range)&&h.is(i.selectionRange)&&(void 0===i.detail||Ft.string(i.detail))&&(void 0===i.deprecated||Ft.boolean(i.deprecated))&&(void 0===i.children||Array.isArray(i.children))&&(void 0===i.tags||Array.isArray(i.tags))}}(tt||(i.DocumentSymbol=tt={})),function(t){t.Empty="",t.QuickFix="quickfix",t.Refactor="refactor",t.RefactorExtract="refactor.extract",t.RefactorInline="refactor.inline",t.RefactorRewrite="refactor.rewrite",t.Source="source",t.SourceOrganizeImports="source.organizeImports",t.SourceFixAll="source.fixAll"}(it||(i.CodeActionKind=it={})),function(t){t.Invoked=1,t.Automatic=2}(et||(i.CodeActionTriggerKind=et={})),function(t){t.create=function(t,i,e){var s={diagnostics:t};return null!=i&&(s.only=i),null!=e&&(s.triggerKind=e),s},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.typedArray(i.diagnostics,b.is)&&(void 0===i.only||Ft.typedArray(i.only,Ft.string))&&(void 0===i.triggerKind||i.triggerKind===et.Invoked||i.triggerKind===et.Automatic)}}(st||(i.CodeActionContext=st={})),function(t){t.create=function(t,i,e){var s={title:t},n=!0;return"string"==typeof i?(n=!1,s.kind=i):y.is(i)?s.command=i:s.edit=i,n&&void 0!==e&&(s.kind=e),s},t.is=function(t){var i=t;return i&&Ft.string(i.title)&&(void 0===i.diagnostics||Ft.typedArray(i.diagnostics,b.is))&&(void 0===i.kind||Ft.string(i.kind))&&(void 0!==i.edit||void 0!==i.command)&&(void 0===i.command||y.is(i.command))&&(void 0===i.isPreferred||Ft.boolean(i.isPreferred))&&(void 0===i.edit||L.is(i.edit))}}(nt||(i.CodeAction=nt={})),function(t){t.create=function(t,i){var e={range:t};return Ft.defined(i)&&(e.data=i),e},t.is=function(t){var i=t;return Ft.defined(i)&&h.is(i.range)&&(Ft.undefined(i.command)||y.is(i.command))}}(rt||(i.CodeLens=rt={})),function(t){t.create=function(t,i){return{tabSize:t,insertSpaces:i}},t.is=function(t){var i=t;return Ft.defined(i)&&Ft.uinteger(i.tabSize)&&Ft.boolean(i.insertSpaces)}}(ot||(i.FormattingOptions=ot={})),function(t){t.create=function(t,i,e){return{range:t,target:i,data:e}},t.is=function(t){var i=t;return Ft.defined(i)&&h.is(i.range)&&(Ft.undefined(i.target)||Ft.string(i.target))}}(ht||(i.DocumentLink=ht={})),function(t){t.create=function(t,i){return{range:t,parent:i}},t.is=function(i){var e=i;return Ft.objectLiteral(e)&&h.is(e.range)&&(void 0===e.parent||t.is(e.parent))}}(ct||(i.SelectionRange=ct={})),function(t){t.namespace="namespace",t.type="type",t.class="class",t.enum="enum",t.interface="interface",t.struct="struct",t.typeParameter="typeParameter",t.parameter="parameter",t.variable="variable",t.property="property",t.enumMember="enumMember",t.event="event",t.function="function",t.method="method",t.macro="macro",t.keyword="keyword",t.modifier="modifier",t.comment="comment",t.string="string",t.number="number",t.regexp="regexp",t.operator="operator",t.decorator="decorator"}(lt||(i.SemanticTokenTypes=lt={})),function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"}(at||(i.SemanticTokenModifiers=at={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&(void 0===i.resultId||"string"==typeof i.resultId)&&Array.isArray(i.data)&&(0===i.data.length||"number"==typeof i.data[0])}}(ut||(i.SemanticTokens=ut={})),function(t){t.create=function(t,i){return{range:t,text:i}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&Ft.string(i.text)}}(dt||(i.InlineValueText=dt={})),function(t){t.create=function(t,i,e){return{range:t,variableName:i,caseSensitiveLookup:e}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&Ft.boolean(i.caseSensitiveLookup)&&(Ft.string(i.variableName)||void 0===i.variableName)}}(ft||(i.InlineValueVariableLookup=ft={})),function(t){t.create=function(t,i){return{range:t,expression:i}},t.is=function(t){var i=t;return null!=i&&h.is(i.range)&&(Ft.string(i.expression)||void 0===i.expression)}}(gt||(i.InlineValueEvaluatableExpression=gt={})),function(t){t.create=function(t,i){return{frameId:t,stoppedLocation:i}},t.is=function(t){return Ft.defined(t)&&h.is(t.stoppedLocation)}}(pt||(i.InlineValueContext=pt={})),function(t){t.Type=1,t.Parameter=2,t.is=function(t){return 1===t||2===t}}(mt||(i.InlayHintKind=mt={})),function(t){t.create=function(t){return{value:t}},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&(void 0===i.tooltip||Ft.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.location||c.is(i.location))&&(void 0===i.command||y.is(i.command))}}(wt||(i.InlayHintLabelPart=wt={})),function(t){t.create=function(t,i,e){var s={position:t,label:i};return void 0!==e&&(s.kind=e),s},t.is=function(t){var i=t;return Ft.objectLiteral(i)&&o.is(i.position)&&(Ft.string(i.label)||Ft.typedArray(i.label,wt.is))&&(void 0===i.kind||mt.is(i.kind))&&void 0===i.textEdits||Ft.typedArray(i.textEdits,k.is)&&(void 0===i.tooltip||Ft.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.paddingLeft||Ft.boolean(i.paddingLeft))&&(void 0===i.paddingRight||Ft.boolean(i.paddingRight))}}(vt||(i.InlayHint=vt={})),function(t){t.createSnippet=function(t){return{kind:"snippet",value:t}}}(bt||(i.StringValue=bt={})),function(t){t.create=function(t,i,e,s){return{insertText:t,filterText:i,range:e,command:s}}}(yt||(i.InlineCompletionItem=yt={})),function(t){t.create=function(t){return{items:t}}}(kt||(i.InlineCompletionList=kt={})),function(t){t.Invoked=0,t.Automatic=1}(Ct||(i.InlineCompletionTriggerKind=Ct={})),function(t){t.create=function(t,i){return{range:t,text:i}}}(St||(i.SelectedCompletionInfo=St={})),function(t){t.create=function(t,i){return{triggerKind:t,selectedCompletionInfo:i}}}(xt||(i.InlineCompletionContext=xt={})),function(t){t.is=function(t){var i=t;return Ft.objectLiteral(i)&&s.is(i.uri)&&Ft.string(i.name)}}(Dt||(i.WorkspaceFolder=Dt={})),i.EOL=["\n","\r\n","\r"],function(t){function i(t,e){if(t.length<=1)return t;var s=t.length/2|0,n=t.slice(0,s),r=t.slice(s);i(n,e),i(r,e);for(var o=0,h=0,c=0;o<n.length&&h<r.length;){var l=e(n[o],r[h]);t[c++]=l<=0?n[o++]:r[h++]}for(;o<n.length;)t[c++]=n[o++];for(;h<r.length;)t[c++]=r[h++];return t}t.create=function(t,i,e,s){return new Tt(t,i,e,s)},t.is=function(t){var i=t;return!!(Ft.defined(i)&&Ft.string(i.uri)&&(Ft.undefined(i.languageId)||Ft.string(i.languageId))&&Ft.uinteger(i.lineCount)&&Ft.func(i.getText)&&Ft.func(i.positionAt)&&Ft.func(i.offsetAt))},t.applyEdits=function(t,e){for(var s=t.getText(),n=i(e,(function(t,i){var e=t.range.start.line-i.range.start.line;return 0===e?t.range.start.character-i.range.start.character:e})),r=s.length,o=n.length-1;o>=0;o--){var h=n[o],c=t.offsetAt(h.range.start),l=t.offsetAt(h.range.end);if(!(l<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(l,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var Ft,Tt=function(){function t(t,i,e,s){this._uri=t,this._languageId=i,this._version=e,this._content=s,this._lineOffsets=void 0}return Object.defineProperty(t.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),t.prototype.getText=function(t){if(t){var i=this.offsetAt(t.start),e=this.offsetAt(t.end);return this._content.substring(i,e)}return this._content},t.prototype.update=function(t,i){this._content=t.text,this._version=i,this._lineOffsets=void 0},t.prototype.getLineOffsets=function(){if(void 0===this._lineOffsets){for(var t=[],i=this._content,e=!0,s=0;s<i.length;s++){e&&(t.push(s),e=!1);var n=i.charAt(s);e="\r"===n||"\n"===n,"\r"===n&&s+1<i.length&&"\n"===i.charAt(s+1)&&s++}e&&i.length>0&&t.push(i.length),this._lineOffsets=t}return this._lineOffsets},t.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var i=this.getLineOffsets(),e=0,s=i.length;if(0===s)return o.create(0,t);for(;e<s;){var n=Math.floor((e+s)/2);i[n]>t?s=n:e=n+1}var r=e-1;return o.create(r,t-i[r])},t.prototype.offsetAt=function(t){var i=this.getLineOffsets();if(t.line>=i.length)return this._content.length;if(t.line<0)return 0;var e=i[t.line];return Math.max(Math.min(e+t.character,t.line+1<i.length?i[t.line+1]:this._content.length),e)},Object.defineProperty(t.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),t}();!function(t){var i=Object.prototype.toString;t.defined=function(t){return void 0!==t},t.undefined=function(t){return void 0===t},t.boolean=function(t){return!0===t||!1===t},t.string=function(t){return"[object String]"===i.call(t)},t.number=function(t){return"[object Number]"===i.call(t)},t.numberRange=function(t,e,s){return"[object Number]"===i.call(t)&&e<=t&&t<=s},t.integer=function(t){return"[object Number]"===i.call(t)&&-2147483648<=t&&t<=2147483647},t.uinteger=function(t){return"[object Number]"===i.call(t)&&0<=t&&t<=2147483647},t.func=function(t){return"[object Function]"===i.call(t)},t.objectLiteral=function(t){return null!==t&&"object"==typeof t},t.typedArray=function(t,i){return Array.isArray(t)&&t.every(i)}}(Ft||(Ft={}))}(0,i),void 0!==e&&(t.exports=e)}));const qit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Git(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Zit(){return qit?Git("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Jit(){return qit?Git("esri/request"):(await import("@arcgis/core/request.js")).default}async function Qit(t){return new(await async function(){return qit?Git("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function Yit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Xit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function tet(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")&&"fields"in t&&"function"==typeof t.queryFeatures}function iet(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function eet(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function set(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function net(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function ret(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function oet(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var het=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function cet(t,i){let e=t;for(;e;){if(e===i)return!0;if(!e.parentNode)return!1;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1}function aet(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)cet(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function uet(t,i){let e=t;for(;e;){let t=e.closest(i);if(t)return t;let s=e.getRootNode();if(s===document)return null;e=s.host}return null}function det(t){let i=uet(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function fet(t,i=""){if(!function(t){return t.nodeType===Node.ELEMENT_NODE}(t))return!1;if(t.matches(i))return setTimeout((()=>t?.setFocus()),0),!0;for(let e=0;e<t.children.length;e++)if(fet(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(fet(e.children[t],i))return!0;return!1}function get(t,i){if(!t?.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void fet(t,i);let e=new MutationObserver((()=>{e.disconnect(),fet(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function pet(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function met(){return[pet(2),pet(1),pet(1),pet(1),pet(3)].join("-")}var wet=new Set(["ar","bg","bs","ca","cs","da","de","el","en","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nl","nb","pl","pt-BR","pt-PT","ro","ru","sk","sl","sr","sv","th","tr","uk","vi","zh-CN","zh-HK","zh-TW"]),vet=new Map;async function bet(t,i,e=""){let s=`${i}/${e}${t}.json`;if(vet.has(s))return vet.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return vet.set(s,t),t}if("en"===t)return void vet.set(s,void 0);let r=await bet("en",i,e);return vet.set(s,r),r}catch{return void vet.set(s,void 0)}}var yet=new WeakMap,ket=new WeakMap,Cet=new WeakMap;async function xet(t,i,e){ket.set(t,i),yet.set(t,aet(t._hostElement,["lang"],(()=>{Eet(t,e)}))),await Eet(t,e)}function Det(t){yet.get(t)?.disconnect(),yet.delete(t),ket.delete(t)}async function Eet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return uet(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator.language||"en");if(wet.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:wet.has(e)?e:"en"}}(t._hostElement);if(e===t._lang&&s===t._t9nLocale||(e!==t._lang&&(t._lang=e),s===t._t9nLocale))return;let n=Cet.get(t);if(!n){let i=ket.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await bet(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function Aet(t,i){return new Array(i+1).join(t)}function Met(t){let i='"',e="'";t.includes(i)&&!t.includes(e)&&(e='"',i="'");let s=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${e})+)`,"gu");t=t.replace(s,((t,i,s,n)=>i+s+Aet(e,n.length/2)));let n=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${i}+)`,"gu");return t=t.replace(n,((t,e,s,n)=>e+s+Aet(`\\${i}`,n.length))),i+t+i}function Let(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu,"\\$&"):"^.*$";return new RegExp(i,"i")}function Fet(t,i={}){return(t??"").replace(/\{(.*?)\}/gu,((t,e)=>i[e]??t))}function Tet(t){return`${t??""}`}function Ret(t){return null!==t}function Oet(t){return void 0!==t}function _et(t,i,e=!1){if(!t||!i)return!1;let s=new URL(t),n=new URL(i);return!(!e&&s.protocol!==n.protocol||null==s.host||null==n.host)&&s.host.toLowerCase()===n.host.toLowerCase()&&s.port===n.port}function Iet(t){try{return new URL(t),!0}catch{return!1}}function Pet(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=Let(e);return t.filter((t=>{if(s){const i=s(t);if(null!==i||void 0!==i)return i}return n.some((i=>r.test(`${t[i]??""}`)))}))}function Net(t){switch(t.type){case"oid":case"global-id":case"guid":return"key";case"small-integer":case"big-integer":case"integer":case"single":case"double":case"long":return"number";case"string":return"string";case"date":return"date-time";case"date-only":return"calendar";case"time-only":return"clock";case"timestamp-offset":return"time-zone";default:return"cube"}}function Bet(t){return(t??[]).filter((t=>{switch(t.type){case"string":case"small-integer":case"integer":case"big-integer":case"single":case"double":case"long":case"date":case"date-only":case"time-only":case"timestamp-offset":case"oid":case"guid":case"global-id":return!0;default:return!1}}))}function $et(t,i){if(!t)return"";const e=i.split(".");let s=e.shift(),n=t;for(;n&&s;)n=n[s],s=e.shift();return"string"==typeof n?n:i}function Wet(t){return!!t?.typeIdField}function jet(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Wet(t)){if(i.name===t.typeIdField)return-1;if(e.name===t.typeIdField)return 1}return i.name.localeCompare(e.name,"en",{sensitivity:"base"})}}function Vet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new Qet({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new tst(t,e,s)}const Het=/^[a-z_$][a-z0-9_$]*$/giu;function zet(t,i=!0){return t.match(Het)?`${i?".":""}${t}`:`["${t}"]`}function Uet(t,i){return t?`${t}${zet(i)}`:i}async function Ket(t){if(!t)return null;let i=null;return i=Yit(t)||Xit(t)||net(t)?t:await Qit(t),i?(e=i,"function"==typeof e?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null);var e}function qet(t,i){return t.filter((t=>("Feature Layer"===t.type||"Table"===t.type)&&(t.capabilities?t.capabilities.toLowerCase().split(",").map((t=>t.trim())):[]).includes(i)))}async function Get(t,i=Kit.CompletionItemKind.Variable){if(!t)return[];const e=await Promise.all(t.map((async t=>{switch(t.type){case"dictionary":return await async function(t,i){const{name:e,dictionaryVariables:s}=t,n=t.getDescription(),r=s.reduce(((t,i)=>{""!==t&&(t+=" \n \n"),t+=`**${i.name}** \n${i.type}`;const e=i.getDescription();return e&&(t+=` \n${e}`),t}),n??"");return{name:e,description:n,type:"dictionary",properties:await Get(s,Kit.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:r}}}}(t,i);case"feature":return await async function(t,i){const e=await t.loadSource(),{name:s}=t,n=t.getDescription(),r={label:s,detail:s,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],l=[];return Bet(e.fields).forEach((t=>{let i=`**${t.name}** \n${t.type}`;t.description&&(i+=` \n'${t.description}`),h&&(h+=" \n \n"),h+=`**${t.name}** (${t.alias??t.name}) \n${t.type}`,t.description&&(h+=` \n'${t.description}`);const e=function(t){switch(t.type){case"small-integer":case"integer":case"big-integer":case"single":case"double":case"long":case"oid":return"number";case"global-id":case"guid":case"string":default:return"text";case"date":return"date";case"date-only":return"dateOnly";case"time-only":return"time"}}(t),s=zet(t.name,!1);if(c.push({name:t.name,description:t.alias||t.name,type:e,completion:{label:t.name,detail:t.alias||t.name,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:Kit.CompletionItemKind.Field,documentation:{kind:"markdown",value:i}}}),!t.alias||t.alias.toLowerCase()===t.name.toLowerCase())return;let n=`**${t.alias}** \n${t.type}`;t.description&&(n+=` \n'${t.description}`),l.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:Kit.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...l],r.documentation={kind:"markdown",value:h},o}(t,i);default:return function(t,i){const{name:e,type:s}=t,n=t.getDescription();return{name:e,description:n,type:s,completion:{label:e,detail:e,insertText:e,insertTextMode:Kit.InsertTextMode.asIs,insertTextFormat:Kit.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class Zet{constructor(t,i,e){this._profile=t,this._label=i,this.description=e,this.filterDescription=!1}getLabel(){return null==this._label?"":"string"==typeof this._label?Tet(this._label):Fet(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:Fet(this._profile?.intlStrings[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Jet extends Zet{constructor(t){super(t.profile,t.label,t.description??t.declaration?.description),this.declaration=t.declaration??{},this.name=t.declaration?.name??"",this.snippet=t.snippet||"",this.nonInteractive=t.nonInteractive??!1,this.filterDescription=t.filterDescription??!1,this.icon=t.icon}}class Qet extends Jet{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t.declaration?.type??"text"}getDescription(){return null==this.description?$et(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class Yet extends Jet{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?$et(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Xet extends Jet{constructor(t){super(t),this.isCollection=!0,this._loaded=!0,this.variables=[]}get loaded(){return this._loaded}async loadSource(){}get informationUrl(){return null}get informationType(){return""}}class tst extends Zet{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class ist extends Xet{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new tst(this._profile,this.snippet,this.dictionaryVariables)])}loadPropertyDeclarations(t){this.dictionaryVariables=this.createVariableInstances(t),this.variables=this.dictionaryVariables}createVariableInstances(t){if(!Array.isArray(t))return[];const i=[];return t.forEach((t=>{const e=this.createVariableInstance(t);e&&i.push(e)})),i}createVariableInstance(t){const i=Uet(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new Qet({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new sst({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new nst({profile:this._profile,declaration:t,label:i,snippet:i},[new Qet({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new rst({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new ist({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new Yet({profile:this._profile,declaration:t,label:i,snippet:i});default:return console.error("Invalid profile variable",t),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}class est extends Xet{constructor(t,i){super(t),this.relationshipsProperties=i,this._source=null,this._loaded=!1,this._definition=t.declaration?.definition}get title(){return this._source?.title??""}get url(){return this._definition?.url??""}get informationUrl(){if(!this.loaded)return null;const t=this._source?.url;return t?`${t}/${this._source?.layerId??""}`:null}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return Ret(this._loadPromise)&&Oet(this._loadPromise)||(this._loadPromise=this._loadSource()),await this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Uet(this.snippet,t.name):t.name;return new Qet({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Net(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if(i=this._source,"function"!=typeof i?.getFieldDomain)return null;var i;const e="feature"===this.type?Uet(this.snippet,t.name):t.name,s=new ist({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:"form-dropdown"}),n=new tst(this._profile,t.alias??t.name,[new Qet({profile:this._profile,label:e,description:"",snippet:e})]);if(s.variables=[n],Wet(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Vet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new Qet({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new tst(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return s.variables.push(i),s}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;n.variables.push(new Qet({profile:this._profile,label:i,description:"",snippet:i}))}if(Wet(this._source)&&!this._source.types.every((i=>"inherited"===i.domains[t.name].type))){const i=function(t,i,e){const s=[];return i.forEach((i=>{let n=i.domains[e.name];if(!n)return;if("inherited"===n.type)return void(n=e.domain);const r=Vet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new ist({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new tst(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(s.variables.push(i),s):null}const r=Vet(this._profile,this._source.getFieldDomain(t.name),{code:"domainvalues"});return r?(s.variables.push(r),s):null}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;const t=this._source;if(i=t,!Array.isArray(i?.relationships)||"string"!=typeof i?.url)return null;var i;const e=new tst(this._profile,{code:"relationships"}),s=await Promise.all(t.relationships.map((async i=>{const e=await async function(t,i){if(!i)return null;const e=await Qit({url:`${t.url}/${i.relatedTableId}`});return await e.load(),e}(t,i);if(!tet(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new nst({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new Qet({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(Ret),e.variables.length?e:null}}class sst extends est{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return Yit(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await Ket(this._definition),!this._source)throw new Error("Invalid definition");const i=Yit(this._source)?this._source.title:"";this.variables.push(new tst(this._profile,i,[new Qet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const e=new tst(this._profile,{code:"values"});if(this.variables.push(e),t=this._source,"boolean"==typeof t?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,i=new Qet({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});e.variables.push(i)}this._source.fields.sort(jet(this._source)).forEach((t=>{e.variables.push(this._getFieldProperty(t))}));const s=await this._getRelationshipsProperty();s&&this.variables.push(s)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}var t;return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class nst extends est{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return Yit(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await Ket(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new tst(this._profile,this.title,this.featureSetSnippets));const t=new tst(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(jet(this._source)).map((t=>this._getFieldProperty(t)));const i=await this._getRelationshipsProperty();i&&this.variables.push(i)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class rst extends Xet{constructor(t){super(t),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=t.declaration?.definition}get informationUrl(){return this.loaded&&this._featureSetCollections&&"string"!=typeof this._featureSetCollections.source?(t=this._featureSetCollections.source.portalItem)?`${t.portal.url}/home/item.html?id=${t.id}`:"":null;var t}get informationType(){return this.loaded&&this._featureSetCollections?"string"!=typeof this._featureSetCollections.source?this._profile?.intlStrings.webmap??"webmap":this._profile?.intlStrings.featureservice??"featureservice":""}async loadSource(){return Ret(this._loadPromise)&&Oet(this._loadPromise)||(this._loadPromise=this._loadSource()),await this._loadPromise}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");const t="string"==typeof this._featureSetCollections.source?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:this._featureSetCollections.source.portalItem.title??"Untitled map"}},i=new tst(this._profile,t,[new Qet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new tst(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new tst(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(i,e,s)}catch(t){console.error("Loading issue",t,this),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?iet(this._definition)?await this._featureSetCollectionFromWebMap(this._definition):Yit(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):eet(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):ret(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=iet(t)?t:await async function(t){return new(await async function(){return qit?Git("esri/WebMap"):(await import("@arcgis/core/WebMap.js")).default}())(t)}({portalItem:t});return await i.loadAll(),await Promise.all(i.tables.map((async t=>await t.load()))),{layers:this._convertWebMapLayersToVariables(i.layers),tables:this._convertWebMapLayersToVariables(i.tables,!0),source:i}}async _featureSetCollectionFromPortalItem(t){const i=await async function(t){return new(await async function(){return qit?Git("esri/portal/PortalItem"):(await import("@arcgis/core/portal/PortalItem.js")).default}())(t)}(t);switch(await i.load(),i.type){case"Web Map":return await this._featureSetCollectionFromWebMap(i);case"Feature Service":return await this._featureSetCollectionFromUrl(i.url);default:return console.error("Unsupported portal item",t),null}}async _featureSetCollectionFromUrl(t){t=(t=(t=t.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer")).replace(/\/mapserver\/[0-9]*/iu,"/MapServer")).split("?")[0];const i=await async function(t){t+="/layers";const i=await Jit(),e=await i(t,{responseType:"json",query:{f:"json"}}),s={layers:e.data?.layers??[],tables:e.data?.tables??[]},n=t.endsWith("MapServer/layers")?"data":"query";return{layers:qet(s.layers,n),tables:qet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await Qit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await Qit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),[n,r]=await Promise.all([e,s]);return{layers:n,tables:r,source:t}}_convertWebMapLayersToVariables(t,i=!1){const e=[];return t.toArray().reverse().forEach((t=>{var s;if(tet(t))e.push(this._createFeatureSetVariable(t,!0));else if((s=t)&&"object"==typeof s&&"string"==typeof s.declaredClass&&"esri.layers.GroupLayer"===s.declaredClass){const s=i?this._convertWebMapLayersToVariables(t.allTables,!0):this._convertWebMapLayersToVariables(t.allLayers);e.push(...s)}})),e}_createFeatureSetVariable(t,i=!1){return new nst({profile:this._profile,declaration:{definition:t},label:t.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(t,i))}_makeFeatureSetSnippets(t,i=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(i){const i=`FeatureSetById(${this.snippet}, "${t.id}")`,e=`FeatureSetByName(${this.snippet}, "${t.title}")`;return[new Qet({profile:this._profile,label:i,description:"",snippet:i}),new Qet({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new Qet({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class ost extends ist{constructor(t,i,e="en"){super({profile:null,declaration:{properties:[]}}),this.definition=t,this.intlStrings=i,this.locale=e,this.variables=[],this._profile=this,this.loadPropertyDeclarations(t?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}async toLSProfile(){const{apiVersion:t,bundles:i,hiddenApiItems:e}=this.definition??{};return{apiVersion:t,bundles:i,variables:await Get(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function hst(t){return tet(t)||Xit(t)||ret(t)||net(t)||set(t)}async function cst(i="en"){const e=lst.get(i);if(e)return e;if(!wet.has(i))return await cst("en");try{const e=await fetch(t(`./assets/arcade-language/profiles/arcade-profiles.t9n.${i}.json`));return e.ok?function(t,i){const e=new Map;return i.forEach((t=>{e.set(t.id,t)})),lst.set(t,e),e}(i,await e.json()):"en"===i?null:await cst("en")}catch{return null}}const lst=new Map;function ast(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(ast):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function ust(t,i="en"){if(!oet(t))return;const e=await async function(t,i="en"){const e=await cst(i);return e?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};var n;return e.variables.forEach((i=>{if(t.disabledVariables?.includes(i.name))return;const e=t.definitions[i.name];switch(i.type){case"dictionary":return s.variables.push(ast({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return Yit(n=e)||Xit(n)||ret(n)||net(n)||set(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return hst(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return eet(t)||iet(t)||hst(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(ast(i))}var n})),n=t,Array.isArray(n?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const dst={locale:"en"},fst=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new xq,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new xq,this._onDidModelContextChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onModelContextDidChange(){return this._onModelContextDidChange.event}get languageId(){return this._languageId}get languageOptions(){return this._languageOptions}_fireModelContextDidChange(t){-1===this._onDidModelContextChangeTimeout&&(this._onDidModelContextChangeTimeout=window.setTimeout((()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(t)}),0))}_getApiKey(t){return Oq.isUri(t)||(t=Oq.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){oet(e)&&(e=await ust(e,s.locale));const n=await bet(s.locale,t("./assets/arcade-language/t9n"),"profile.t9n.");if(!n)throw new Error(`Failed to load the language bundle for ${s.locale}`);this.disposeEditorProfileForModel(i);const r=this._getApiKey(i),o=new ost(e,n);this._profileMap.set(r,o);const h=await o.toLSProfile();this.updateApiContextForModel(i,{locale:s.locale,profile:h,snippets:s.snippets})}disposeEditorProfileForModel(t){const i=this._getApiKey(t);this._profileMap.delete(i)}disposeApiContextForModel(t){const i=this._getApiKey(t);this._apiContextMap.delete(i)&&this._fireModelContextDidChange(i)}getEditorProfileForModel(t){return this._profileMap.get(this._getApiKey(t))}getApiContextForModel(t){return this._apiContextMap.get(this._getApiKey(t))??dst}updateApiContextForModel(t,i){const e=this._getApiKey(t),s=this._apiContextMap.get(e)??{};this._apiContextMap.set(e,{...s,...i}),this._fireModelContextDidChange(e)}setLanguageOptions(t={}){this._languageOptions.assetsPath!==t.assetsPath&&(this._languageOptions={...this._languageOptions,...t},this._onDidChange.fire(this))}},gst={setProfileForModel:fst.setProfileForModel.bind(fst)};export{det as $,Det as B,Fet as D,xq as E,met as F,Tet as G,zV as I,Dq as K,Tq as M,Let as Q,Mq as R,YH as S,aet as T,Oq as U,xet as W,gst as a,zit as b,Uit as c,fst as d,Iq as e,Pet as f,bV as g,Zit as h,Jit as i,get as j,het as k,Pq as l,Eq as m,Iet as n,Bq as o,KG as p,Met as q,Kit as r,Bet as s,_et as t}
|