@arcgis/coding-components 4.28.0-beta.37 → 4.28.0-beta.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
  2. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.en.json +7 -7
  3. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.en.json +13 -13
  4. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.en.json +6 -6
  5. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.en.json +8 -8
  6. package/dist/arcgis-coding-components/index.esm.js +1 -1
  7. package/dist/arcgis-coding-components/{p-f3fdbeaf.js → p-27d03fb2.js} +1 -1
  8. package/dist/arcgis-coding-components/{p-1afb1520.entry.js → p-2c5583d5.entry.js} +1 -1
  9. package/dist/arcgis-coding-components/{p-b4da9834.js → p-3eb641a2.js} +1 -1
  10. package/dist/arcgis-coding-components/{p-659edbd6.js → p-5fe913f0.js} +1 -1
  11. package/dist/arcgis-coding-components/{p-dd869b96.js → p-683e3dd4.js} +1 -1
  12. package/dist/arcgis-coding-components/{p-6f11971b.js → p-74e0738d.js} +1 -1
  13. package/dist/arcgis-coding-components/{p-d06922b9.js → p-7fb19e9b.js} +1 -1
  14. package/dist/arcgis-coding-components/{p-3af6d9c9.js → p-96c3ebcb.js} +1 -1
  15. package/dist/arcgis-coding-components/{p-85a52c0c.js → p-a152b643.js} +1 -1
  16. package/dist/arcgis-coding-components/{p-4d3db1b0.js → p-a388e974.js} +7 -7
  17. package/dist/cjs/{arcade-defaults-970ec5c1.js → arcade-defaults-55c18abe.js} +7 -7
  18. package/dist/cjs/{arcade-mode-c6a3b170.js → arcade-mode-bd1630dd.js} +1 -1
  19. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +2 -2
  20. package/dist/cjs/{cssMode-c342f082.js → cssMode-73d4ac47.js} +1 -1
  21. package/dist/cjs/{html-9077ef37.js → html-da599f39.js} +1 -1
  22. package/dist/cjs/{htmlMode-d8465240.js → htmlMode-6f0883d3.js} +1 -1
  23. package/dist/cjs/index.cjs.js +1 -1
  24. package/dist/cjs/{javascript-7b74878f.js → javascript-92268a2f.js} +2 -2
  25. package/dist/cjs/{jsonMode-5d4d7d37.js → jsonMode-110ef3c9.js} +1 -1
  26. package/dist/cjs/{tsMode-f989c389.js → tsMode-8cb72aa2.js} +1 -1
  27. package/dist/cjs/{typescript-16065111.js → typescript-edaad128.js} +1 -1
  28. package/dist/esm/{arcade-defaults-86bf04ed.js → arcade-defaults-ac486973.js} +7 -7
  29. package/dist/esm/{arcade-mode-a5fd2446.js → arcade-mode-fc719356.js} +1 -1
  30. package/dist/esm/arcgis-arcade-api_6.entry.js +2 -2
  31. package/dist/esm/{cssMode-b190bc7f.js → cssMode-f452e699.js} +1 -1
  32. package/dist/esm/{html-0749d9b9.js → html-7c0b7520.js} +1 -1
  33. package/dist/esm/{htmlMode-d714b14b.js → htmlMode-200a28b3.js} +1 -1
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/{javascript-49d5a953.js → javascript-44a7aba3.js} +2 -2
  36. package/dist/esm/{jsonMode-f36dbe4d.js → jsonMode-fb784fa5.js} +1 -1
  37. package/dist/esm/{tsMode-fe00e707.js → tsMode-890f3141.js} +1 -1
  38. package/dist/esm/{typescript-d133c2e9.js → typescript-4b8bacca.js} +1 -1
  39. package/package.json +7 -7
@@ -18,45 +18,45 @@ import{g as t}from"./p-0fa0a06d.js";let i="undefined"!=typeof document&&document
18
18
  * Released under the MIT license
19
19
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
20
20
  *-----------------------------------------------------------------------------*/
21
- _z({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-659edbd6.js")}),
21
+ _z({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-5fe913f0.js")}),
22
22
  /*!-----------------------------------------------------------------------------
23
23
  * Copyright (c) Microsoft Corporation. All rights reserved.
24
24
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
25
25
  * Released under the MIT license
26
26
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
27
27
  *-----------------------------------------------------------------------------*/
28
- _z({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-d06922b9.js")}),
28
+ _z({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-7fb19e9b.js")}),
29
29
  /*!-----------------------------------------------------------------------------
30
30
  * Copyright (c) Microsoft Corporation. All rights reserved.
31
31
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
32
32
  * Released under the MIT license
33
33
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
34
34
  *-----------------------------------------------------------------------------*/
35
- _z({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-85a52c0c.js")});
35
+ _z({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-a152b643.js")});
36
36
  /*!-----------------------------------------------------------------------------
37
37
  * Copyright (c) Microsoft Corporation. All rights reserved.
38
38
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
39
39
  * Released under the MIT license
40
40
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
41
41
  *-----------------------------------------------------------------------------*/
42
- var Iz=Object.defineProperty,Pz=Object.getOwnPropertyDescriptor,Nz=Object.getOwnPropertyNames,Bz=Object.prototype.hasOwnProperty,$z=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Nz(i))Bz.call(t,n)||n===e||Iz(t,n,{get:()=>i[n],enumerable:!(s=Pz(i,n))||s.enumerable});return t},jz={};((t,i)=>{$z(jz,i,"default")})(0,xz);var Wz=class{_onDidChange=new jz.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)}},Vz={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}},Hz={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},zz=new Wz("css",Vz,Hz),Uz=new Wz("scss",Vz,Hz),Kz=new Wz("less",Vz,Hz);function qz(){return import("./p-3af6d9c9.js")}jz.languages.css={cssDefaults:zz,lessDefaults:Kz,scssDefaults:Uz},jz.languages.onLanguage("less",(()=>{qz().then((t=>t.setupMode(Kz)))})),jz.languages.onLanguage("scss",(()=>{qz().then((t=>t.setupMode(Uz)))})),jz.languages.onLanguage("css",(()=>{qz().then((t=>t.setupMode(zz)))}));
42
+ var Iz=Object.defineProperty,Pz=Object.getOwnPropertyDescriptor,Nz=Object.getOwnPropertyNames,Bz=Object.prototype.hasOwnProperty,$z=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Nz(i))Bz.call(t,n)||n===e||Iz(t,n,{get:()=>i[n],enumerable:!(s=Pz(i,n))||s.enumerable});return t},jz={};((t,i)=>{$z(jz,i,"default")})(0,xz);var Wz=class{_onDidChange=new jz.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)}},Vz={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}},Hz={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},zz=new Wz("css",Vz,Hz),Uz=new Wz("scss",Vz,Hz),Kz=new Wz("less",Vz,Hz);function qz(){return import("./p-96c3ebcb.js")}jz.languages.css={cssDefaults:zz,lessDefaults:Kz,scssDefaults:Uz},jz.languages.onLanguage("less",(()=>{qz().then((t=>t.setupMode(Kz)))})),jz.languages.onLanguage("scss",(()=>{qz().then((t=>t.setupMode(Uz)))})),jz.languages.onLanguage("css",(()=>{qz().then((t=>t.setupMode(zz)))}));
43
43
  /*!-----------------------------------------------------------------------------
44
44
  * Copyright (c) Microsoft Corporation. All rights reserved.
45
45
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
46
46
  * Released under the MIT license
47
47
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
48
48
  *-----------------------------------------------------------------------------*/
49
- var Gz=Object.defineProperty,Zz=Object.getOwnPropertyDescriptor,Jz=Object.getOwnPropertyNames,Qz=Object.prototype.hasOwnProperty,Yz=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Jz(i))Qz.call(t,n)||n===e||Gz(t,n,{get:()=>i[n],enumerable:!(s=Zz(i,n))||s.enumerable});return t},Xz={};((t,i)=>{Yz(Xz,i,"default")})(0,xz);var tU={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 iU(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===eU,documentFormattingEdits:t===eU,documentRangeFormattingEdits:t===eU}}var eU="html",sU="handlebars",nU="razor",rU=lU(eU,tU,iU(eU)),oU=rU.defaults,hU=lU(sU,tU,iU(sU)),cU=hU.defaults,uU=lU(nU,tU,iU(nU));function lU(t,i=tU,e=iU(t)){const s=new class{_onDidChange=new Xz.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)}}(t,i,e);let n;const r=Xz.languages.onLanguage(t,(async()=>{n=(await import("./p-b4da9834.js")).setupMode(s)}));return{defaults:s,dispose(){r.dispose(),n?.dispose(),n=void 0}}}
49
+ var Gz=Object.defineProperty,Zz=Object.getOwnPropertyDescriptor,Jz=Object.getOwnPropertyNames,Qz=Object.prototype.hasOwnProperty,Yz=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Jz(i))Qz.call(t,n)||n===e||Gz(t,n,{get:()=>i[n],enumerable:!(s=Zz(i,n))||s.enumerable});return t},Xz={};((t,i)=>{Yz(Xz,i,"default")})(0,xz);var tU={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 iU(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===eU,documentFormattingEdits:t===eU,documentRangeFormattingEdits:t===eU}}var eU="html",sU="handlebars",nU="razor",rU=lU(eU,tU,iU(eU)),oU=rU.defaults,hU=lU(sU,tU,iU(sU)),cU=hU.defaults,uU=lU(nU,tU,iU(nU));function lU(t,i=tU,e=iU(t)){const s=new class{_onDidChange=new Xz.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)}}(t,i,e);let n;const r=Xz.languages.onLanguage(t,(async()=>{n=(await import("./p-3eb641a2.js")).setupMode(s)}));return{defaults:s,dispose(){r.dispose(),n?.dispose(),n=void 0}}}
50
50
  /*!-----------------------------------------------------------------------------
51
51
  * Copyright (c) Microsoft Corporation. All rights reserved.
52
52
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
53
53
  * Released under the MIT license
54
54
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
55
- *-----------------------------------------------------------------------------*/Xz.languages.html={htmlDefaults:oU,razorDefaults:uU.defaults,handlebarDefaults:cU,htmlLanguageService:rU,handlebarLanguageService:hU,razorLanguageService:uU,registerHTMLLanguageService:lU};var aU=Object.defineProperty,dU=Object.getOwnPropertyDescriptor,fU=Object.getOwnPropertyNames,gU=Object.prototype.hasOwnProperty,pU=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of fU(i))gU.call(t,n)||n===e||aU(t,n,{get:()=>i[n],enumerable:!(s=dU(i,n))||s.enumerable});return t},mU={};((t,i)=>{pU(mU,i,"default")})(0,xz);var vU=new class{_onDidChange=new mU.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});mU.languages.json={jsonDefaults:vU},mU.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),mU.languages.onLanguage("json",(()=>{import("./p-6f11971b.js").then((t=>t.setupMode(vU)))}));
55
+ *-----------------------------------------------------------------------------*/Xz.languages.html={htmlDefaults:oU,razorDefaults:uU.defaults,handlebarDefaults:cU,htmlLanguageService:rU,handlebarLanguageService:hU,razorLanguageService:uU,registerHTMLLanguageService:lU};var aU=Object.defineProperty,dU=Object.getOwnPropertyDescriptor,fU=Object.getOwnPropertyNames,gU=Object.prototype.hasOwnProperty,pU=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of fU(i))gU.call(t,n)||n===e||aU(t,n,{get:()=>i[n],enumerable:!(s=dU(i,n))||s.enumerable});return t},mU={};((t,i)=>{pU(mU,i,"default")})(0,xz);var vU=new class{_onDidChange=new mU.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});mU.languages.json={jsonDefaults:vU},mU.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),mU.languages.onLanguage("json",(()=>{import("./p-74e0738d.js").then((t=>t.setupMode(vU)))}));
56
56
  /*!-----------------------------------------------------------------------------
57
57
  * Copyright (c) Microsoft Corporation. All rights reserved.
58
58
  * Version: 0.39.0(ff3621a3fa6389873be5412d17554294ea1b0941)
59
59
  * Released under the MIT license
60
60
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
61
61
  *-----------------------------------------------------------------------------*/
62
- var wU=Object.defineProperty,bU=Object.getOwnPropertyDescriptor,yU=Object.getOwnPropertyNames,kU=Object.prototype.hasOwnProperty,CU=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of yU(i))kU.call(t,n)||n===e||wU(t,n,{get:()=>i[n],enumerable:!(s=bU(i,n))||s.enumerable});return t},SU={};((t,i)=>{CU(SU,i,"default")})(0,xz);var xU=(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))(xU||{}),DU=(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))(DU||{}),EU=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(EU||{}),AU=(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))(AU||{}),LU=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(LU||{}),MU=class{_onDidChange=new SU.Emitter;_onDidExtraLibsChange=new SU.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)}},OU={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},FU=new MU({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},OU),TU=new MU({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},OU);function RU(){return import("./p-f3fdbeaf.js")}SU.languages.typescript={ModuleKind:xU,JsxEmit:DU,NewLineKind:EU,ScriptTarget:AU,ModuleResolutionKind:LU,typescriptVersion:"5.0.2",typescriptDefaults:FU,javascriptDefaults:TU,getTypeScriptWorker:()=>RU().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>RU().then((t=>t.getJavaScriptWorker()))},SU.languages.onLanguage("typescript",(()=>RU().then((t=>t.setupTypeScript(FU))))),SU.languages.onLanguage("javascript",(()=>RU().then((t=>t.setupJavaScript(TU)))));var _U=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const IU=new Jo("selectionAnchorSet",!1);let PU=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=IU.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(bs.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new MF).appendText(e(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),Yg(e(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(bs.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()}};PU.ID="editor.contrib.selectionAnchorController",PU=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,Qo)],PU),$p(PU.ID,PU,4),Np(class extends Tp{constructor(){super({id:"editor.action.setSelectionAnchor",label:e(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2080),weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.setSelectionAnchor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToSelectionAnchor",label:e(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:IU})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:e(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:IU,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2089),weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:e(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:IU,kbOpts:{kbExpr:PC.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const NU=fm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},e(0,"Overview ruler marker color for matching brackets."));class BU{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class $U extends Hi{static get(t){return t.getContribution($U.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new lu((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(69),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(69)&&(this._matchBrackets=this._editor.getOption(69),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 bs(n.lineNumber,n.column,n.lineNumber,n.column):new bs(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(ws.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 bs(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 u=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<u&&s[c].position.isBefore(e);)c++;if(c<u&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=$U._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=$U._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new BU(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}$U.ID="editor.contrib.bracketMatchingController",$U._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=sL.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Xy(NU),position:uh.Center}}),$U._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=sL.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),$p($U.ID,$U,1),Np(class extends Tp{constructor(){super({id:"editor.action.selectToBracket",label:e(0,"Select to Bracket"),alias:"Select to Bracket",precondition:void 0,description:{description:"Select to Bracket",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=$U.get(i))||void 0===s||s.selectToBracket(n)}}),Np(class extends Tp{constructor(){super({id:"editor.action.jumpToBracket",label:e(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=$U.get(i))||void 0===e||e.jumpToBracket()}}),Np(class extends Tp{constructor(){super({id:"editor.action.removeBrackets",label:e(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=$U.get(i))||void 0===e||e.removeBrackets(this.id)}}),Cp.appendMenuItem(bp.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:e(0,"Go to &&Bracket")},order:2});class jU{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 ws(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ws(e,n,e,n),o)}else{const r=new ws(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ws(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new bs(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new bs(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class WU extends Tp{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 jU(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}Np(class extends WU{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:e(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:PC.writable})}}),Np(class extends WU{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:e(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:PC.writable})}}),Np(class extends Tp{constructor(){super({id:"editor.action.transposeLetters",label:e(0,"Transpose Letters"),alias:"Transpose Letters",precondition:PC.writable,kbOpts:{kbExpr:PC.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():fC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=fC.leftPosition(e,o),c=fC.leftPosition(e,h),u=e.getValueInRange(ws.fromPositions(c,h)),l=e.getValueInRange(ws.fromPositions(h,o)),a=ws.fromPositions(c,o);s.push(new hC(a,l+u))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const VU="9_cutcopypaste",HU=k||document.queryCommandSupported("cut"),zU=k||document.queryCommandSupported("copy"),UU=void 0!==navigator.clipboard&&!Rr||document.queryCommandSupported("paste");function KU(t){return t.register(),t}const qU=HU?KU(new Mp({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:k?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"Cu&&t"),order:1},{menuId:bp.EditorContext,group:VU,title:e(0,"Cut"),when:PC.writable,order:1},{menuId:bp.CommandPalette,group:"",title:e(0,"Cut"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Cut"),when:PC.writable,order:1}]})):void 0,GU=zU?KU(new Mp({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:k?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"&&Copy"),order:2},{menuId:bp.EditorContext,group:VU,title:e(0,"Copy"),order:2},{menuId:bp.CommandPalette,group:"",title:e(0,"Copy"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Copy"),order:2}]})):void 0;Cp.appendMenuItem(bp.MenubarEditMenu,{submenu:bp.MenubarCopy,title:{value:e(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextCopy,title:{value:e(0,"Copy As"),original:"Copy As"},group:VU,order:3}),Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Oo.and(Oo.notEquals("resourceScheme","output"),PC.editorTextFocus)}),Cp.appendMenuItem(bp.EditorTitleContext,{submenu:bp.EditorTitleContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1}),Cp.appendMenuItem(bp.ExplorerContext,{submenu:bp.ExplorerContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1});const ZU=UU?KU(new Mp({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:k?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"&&Paste"),order:4},{menuId:bp.EditorContext,group:VU,title:e(0,"Paste"),when:PC.writable,order:4},{menuId:bp.CommandPalette,group:"",title:e(0,"Paste"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Paste"),when:PC.writable,order:4}]})):void 0;function JU(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(ro).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(35),s=e.getSelection();return s&&s.isEmpty()&&!t||document.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(document.execCommand(i),!0))))}JU(qU,"cut"),JU(GU,"copy"),ZU&&(ZU.addImplementation(1e4,"code-editor",(t=>{const i=t.get(ro),e=t.get(VR),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!document.execCommand("paste")&&C)||(n=void 0,r=void 0,h=function*(){const t=yield e.readText();if(""!==t){const i=Hy.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(35)&&!!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})}},new((o=void 0)||(o=Promise))((function(t,i){function e(t){try{c(h.next(t))}catch(t){i(t)}}function s(t){try{c(h.throw(t))}catch(t){i(t)}}function c(i){var n;i.done?t(i.value):(n=i.value,n instanceof o?n:new o((function(t){t(n)}))).then(e,s)}c((h=h.apply(n,r||[])).next())}))));var n,r,o,h})),ZU.addImplementation(0,"generic-dom",(()=>(document.execCommand("paste"),!0)))),zU&&Np(class extends Tp{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:e(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(35)&&i.getSelection().isEmpty()||(Vy.forceCopyWithSyntaxHighlighting=!0,i.focus(),document.execCommand("copy"),Vy.forceCopyWithSyntaxHighlighting=!1))}});var QU;class YU{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+YU.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new YU(this.value+YU.sep+t)}}function XU(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}YU.sep=".",YU.None=new YU("@@none@@"),YU.Empty=new YU(""),YU.QuickFix=new YU("quickfix"),YU.Refactor=new YU("refactor"),YU.RefactorExtract=YU.Refactor.append("extract"),YU.RefactorInline=YU.Refactor.append("inline"),YU.RefactorMove=YU.Refactor.append("move"),YU.RefactorRewrite=YU.Refactor.append("rewrite"),YU.Source=new YU("source"),YU.SourceOrganizeImports=YU.Source.append("organizeImports"),YU.SourceFixAll=YU.Source.append("fixAll"),YU.SurroundWith=YU.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"}(QU||(QU={}));class tK{static fromUser(t,i){return t&&"object"==typeof t?new tK(tK.getKindFromUser(t,i.kind),tK.getApplyFromUser(t,i.apply),tK.getPreferredUser(t)):new tK(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 YU(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 iK{constructor(t,i){this.action=t,this.provider=i}resolve(t){var i,e,s,n,r;return e=this,s=void 0,r=function*(){if((null===(i=this.provider)||void 0===i?void 0:i.resolveCodeAction)&&!this.action.edit){let i;try{i=yield this.provider.resolveCodeAction(this.action,t)}catch(t){Ai(t)}i&&(this.action.edit=i.edit)}return this},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}))}}var eK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const sK="editor.action.codeAction",nK="editor.action.quickFix",rK="editor.action.autoFix",oK="editor.action.refactor",hK="editor.action.sourceAction",cK="editor.action.organizeImports",uK="editor.action.fixAll";class lK extends Hi{static codeActionsPreferredComparator(t,i){return t.isPreferred&&!i.isPreferred?-1:!t.isPreferred&&i.isPreferred?1:0}static codeActionsComparator({action:t},{action:i}){return et(t.diagnostics)?et(i.diagnostics)?lK.codeActionsPreferredComparator(t,i):-1:et(i.diagnostics)?1:lK.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(lK.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&YU.QuickFix.contains(new YU(t.kind))&&!!t.isPreferred))}}const aK={actions:[],documentation:void 0};function dK(t,i,e,s,n,r){var o;return eK(this,void 0,void 0,(function*(){const h=s.filter||{},c={only:null===(o=h.include)||void 0===o?void 0:o.value,trigger:s.type},u=new KH(i,r),l=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=>XU(i,e,t.include)))||!t.includeSourceActions&&YU.Source.contains(i))}(e,new YU(t))))))}(t,i,h),a=new Vi,d=l.map((t=>eK(this,void 0,void 0,(function*(){try{n.report(t);const s=yield t.provideCodeActions(i,e,c,u.token);if(s&&a.add(s),u.token.isCancellationRequested)return aK;const r=((null==s?void 0:s.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new YU(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>XU(e,i,t.include)))||!t.includeSourceActions&&e&&YU.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(h,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new YU(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 YU(t.kind)))return i.command}(t,r,h.include);return{actions:r.map((i=>new iK(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),aK}})))),f=t.onDidChange((()=>{G(t.all(i),l)||u.cancel()}));try{const e=yield Promise.all(d),n=e.map((t=>t.actions)).flat(),r=[...X(e.map((t=>t.documentation))),...fK(t,i,s,n)];return new lK(n,r,a)}finally{f.dispose(),u.dispose()}}))}function*fK(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 gK;function pK(t,i,s,n,r=fe.None){var o;return eK(this,void 0,void 0,(function*(){const h=t.get(TI),c=t.get(dp),u=t.get(Ap),l=t.get(IM);if(u.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:s}),yield i.resolve(r),!r.isCancellationRequested){if((null===(o=i.action.edit)||void 0===o?void 0:o.edits.length)&&!(yield h.apply(i.action.edit,{editor:null==n?void 0:n.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:s!==gK.OnSave,showPreview:null==n?void 0:n.preview})).isApplied)return;if(i.action.command)try{yield c.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:e(0,"An unknown error occurred while applying the code action"))}}}))}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(gK||(gK={})),fp.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return eK(this,void 0,void 0,(function*(){if(!(i instanceof os))throw Ti();const{codeActionProvider:r}=t.get(ka),o=t.get(Zc).getModel(i);if(!o)throw Ti();const h=bs.isISelection(e)?bs.liftSelection(e):ws.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ti();const c="string"==typeof s?new YU(s):void 0,u=yield dK(r,o,h,{type:1,triggerAction:QU.Default,filter:{includeSourceActions:!0,include:c}},KR.None,fe.None),l=[],a=Math.min(u.validActions.length,"number"==typeof n?n:0);for(let t=0;t<a;t++)l.push(u.validActions[t].resolve(fe.None));try{return yield Promise.all(l),u.validActions.map((t=>t.action))}finally{setTimeout((()=>u.dispose()),100)}}))}));let mK=class t{constructor(t){this.keybindingService=t}getResolver(){const i=new On((()=>this.keybindingService.getKeybindings().filter((i=>t.codeActionCommands.indexOf(i.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===cK?i={kind:YU.SourceOrganizeImports.value}:t.command===uK&&(i={kind:YU.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},tK.fromUser(i,{kind:YU.None,apply:"never"}))}))));return t=>{if(t.kind){const e=this.bestKeybindingForCodeAction(t,i.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new YU(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)}};mK.codeActionCommands=[oK,sK,hK,cK,uK],mK=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,eP)],mK),fm("symbolIcon.arrayForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.booleanForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.colorForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.constantForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.fileForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.folderForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.keyForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.keywordForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.moduleForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.namespaceForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.nullForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.numberForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.objectForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.operatorForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.packageForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.propertyForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.referenceForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.snippetForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.stringForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.structForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.textForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.typeParameterForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.unitForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const vK=Object.freeze({kind:YU.Empty,title:e(0,"More Actions...")}),wK=Object.freeze([{kind:YU.QuickFix,title:e(0,"Quick Fix...")},{kind:YU.RefactorExtract,title:e(0,"Extract..."),icon:Ss.wrench},{kind:YU.RefactorInline,title:e(0,"Inline..."),icon:Ss.wrench},{kind:YU.RefactorRewrite,title:e(0,"Rewrite..."),icon:Ss.wrench},{kind:YU.RefactorMove,title:e(0,"Move..."),icon:Ss.wrench},{kind:YU.SurroundWith,title:e(0,"Surround With..."),icon:Ss.symbolSnippet},{kind:YU.Source,title:e(0,"Source Action..."),icon:Ss.symbolFile},vK]);var bK;!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}}}(bK||(bK={}));let yK=class t extends Hi{constructor(t,i){var e;super(),this._editor=t,this._onClick=this._register(new ee),this.onClick=this._onClick.event,this._state=bK.Hidden,this._domNode=Rg("div.lightBulbWidget"),this._register(hm.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(function(t,i,e){return Zf(t,x&&Ad?xg.POINTER_DOWN:xg.MOUSE_DOWN,i,e)}(this._domNode,Jf((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=og(this._domNode),s=this._editor.getOption(64);let n=Math.floor(s/3);null!==this.state.widgetPosition.position&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(n+=s),this._onClick.fire({x:t.posx,y:i+e+n,actions:this.state.actions,trigger:this.state.trigger})})),e)),this._register(Zf(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(62)&&!this._editor.getOption(62).enabled&&this.hide()}))),this._register(Qi.runAndSubscribe(i.onDidUpdateKeybindings,(()=>{var t,e;this._preferredKbLabel=Rt(null===(t=i.lookupKeybinding(rK))||void 0===t?void 0:t.getLabel()),this._quickFixKbLabel=Rt(null===(e=i.lookupKeybinding(nK))||void 0===e?void 0:e.getLabel()),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(i,e,s){if(i.validActions.length<=0)return this.hide();const n=this._editor.getOptions();if(!n.get(62).enabled)return this.hide();const r=this._editor.getModel();if(!r)return this.hide();const{lineNumber:o,column:h}=r.validatePosition(s),c=r.getOptions().tabSize,u=n.get(48),l=kS(r.getLineContent(o),c),a=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let d=o;if(!(u.spaceWidth*l>22))if(o>1&&!a(o-1))d-=1;else if(a(o+1)){if(h*u.spaceWidth<22)return this.hide()}else d+=1;this.state=new bK.Showing(i,e,s,{position:{lineNumber:d,column:1},preference:t._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==bK.Hidden&&(this.state=bK.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(t){this._state=t,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){1===this.state.type&&this.state.actions.hasAutoFix&&(this._domNode.classList.remove(...np.asClassNameArray(Ss.lightBulb)),this._domNode.classList.add(...np.asClassNameArray(Ss.lightbulbAutofix)),this._preferredKbLabel)?this.title=e(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...np.asClassNameArray(Ss.lightbulbAutofix)),this._domNode.classList.add(...np.asClassNameArray(Ss.lightBulb)),this.title=this._quickFixKbLabel?e(0,"Show Code Actions ({0})",this._quickFixKbLabel):e(0,"Show Code Actions"))}set title(t){this._domNode.title=t}};yK.ID="editor.contrib.lightbulbWidget",yK._posPref=[0],yK=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,eP)],yK);let kK=class t{static get(i){return i.getContribution(t.ID)}constructor(i,e){this._messageWidget=new zi,this._messageListeners=new Vi,this._editor=i,this._visible=t.MESSAGE_VISIBLE.bindTo(e)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;Yg(t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._messageWidget.value=new CK(this._editor,i,t),this._messageListeners.add(this._editor.onDidBlurEditorText((()=>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(new cu((()=>this.closeMessage()),3e3)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new ws(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(CK.fadeOut(this._messageWidget.value))}};kK.ID="editor.contrib.messageController",kK.MESSAGE_VISIBLE=new Jo("messageVisible",!1,e(0,"Whether the editor is currently showing an inline message")),kK=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,Qo)],kK),Pp(new(Fp.bindToContribution(kK.get))({id:"leaveEditorMessage",precondition:kK.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class CK{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");r.classList.add("message"),r.textContent=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)}}$p(kK.ID,kK,4);var SK=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},xK=function(t,i){return function(e,s){i(e,s,t)}};const DK="acceptSelectedCodeAction",EK="previewSelectedCodeAction";class AK{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 LK=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 dW(t,O)}}renderElement(t,i,s){var n,r,o;if((null===(n=t.group)||void 0===n?void 0:n.icon)?(s.icon.className=np.asClassName(t.group.icon),t.group.icon.color&&(s.icon.style.color=lm(t.group.icon.color.id))):(s.icon.className=np.asClassName(Ss.lightBulb),s.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;s.text.textContent=TK(t.label),s.keybinding.set(t.keybinding),function(t,...i){t?_g(...i):Ig(...i)}(!!t.keybinding,s.keybinding.element);const h=null===(r=this._keybindingService.lookupKeybinding(DK))||void 0===r?void 0:r.getLabel(),c=null===(o=this._keybindingService.lookupKeybinding(EK))||void 0===o?void 0:o.getLabel();s.container.classList.toggle("option-disabled",t.disabled),s.container.title=t.disabled?t.label:h&&c?this._supportsPreview?e(0,"{0} to apply, {1} to preview",h,c):e(0,"{0} to apply",h):""}disposeTemplate(t){}};LK=SK([xK(1,eP)],LK);class MK extends UIEvent{constructor(){super("acceptSelectedAction")}}class OK extends UIEvent{constructor(){super("previewSelectedAction")}}let FK=class extends Hi{constructor(t,i,s,n,r,o){super(),this._delegate=n,this._contextViewService=r,this._keybindingService=o,this._actionLineHeight=24,this._headerLineHeight=26,this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new uR(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new LK(i,this._keybindingService),new AK],{keyboardSupport:!1,accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?TK(null==t?void 0:t.label):"";return t.disabled&&(i=e(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>e(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(vN),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this._list.domFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=s,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._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);const s=this._allMenuItems.map(((t,i)=>{const e=document.getElementById(this._list.getElementID(i));if(e){e.style.width="auto";const t=e.getBoundingClientRect().width;return e.style.width="",t}return 0})),n=Math.max(...s,t),r=Math.min(e,.7*document.body.clientHeight);return this._list.layout(r,n),this.domNode.style.height=`${r}px`,this._list.domFocus(),n}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 OK:new MK;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 OK):this._list.setSelection([])}onListHover(t){this._list.setFocus("number"==typeof t.index?[t.index]:[])}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function TK(t){return t.replace(/\r\n|\r|\n/g," ")}FK=SK([xK(4,HR),xK(5,eP)],FK);var RK=function(t,i){return function(e,s){i(e,s,t)}};const _K={Visible:new Jo("codeActionMenuVisible",!1,e(0,"Whether the action widget list is visible"))},IK=no("actionWidgetService");let PK=class extends Hi{get isVisible(){return _K.Visible.getValue(this._contextKeyService)||!1}constructor(t,i,e){super(),this._contextViewService=t,this._contextKeyService=i,this._instantiationService=e,this._list=this._register(new zi)}show(t,i,e,s,n,r,o){const h=_K.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(FK,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 Vi,o=document.createElement("div"),h=t.appendChild(o);h.classList.add("context-view-block"),r.add(Zf(h,xg.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),u=t.appendChild(c);u.classList.add("context-view-pointerBlock"),r.add(Zf(u,xg.POINTER_MOVE,(()=>u.remove()))),r.add(Zf(u,xg.MOUSE_DOWN,(()=>u.remove())));let l=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),l=t.getContainer().offsetWidth)}const a=null===(s=this._list.value)||void 0===s?void 0:s.layout(l);n.style.width=`${a}px`;const d=r.add(Ag(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Rg(t),s=new kR(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)}};PK=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}([RK(0,HR),RK(1,Qo),RK(2,eo)],PK),lc(IK,PK,1);const NK=1100;Ep(class extends Dp{constructor(){super({id:"hideCodeActionWidget",title:{value:e(0,"Hide action widget"),original:"Hide action widget"},precondition:_K.Visible,keybinding:{weight:NK,primary:9,secondary:[1033]}})}run(t){t.get(IK).hide()}}),Ep(class extends Dp{constructor(){super({id:"selectPrevCodeAction",title:{value:e(0,"Select previous action"),original:"Select previous action"},precondition:_K.Visible,keybinding:{weight:NK,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(IK);i instanceof PK&&i.focusPrevious()}}),Ep(class extends Dp{constructor(){super({id:"selectNextCodeAction",title:{value:e(0,"Select next action"),original:"Select next action"},precondition:_K.Visible,keybinding:{weight:NK,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(IK);i instanceof PK&&i.focusNext()}}),Ep(class extends Dp{constructor(){super({id:DK,title:{value:e(0,"Accept selected action"),original:"Accept selected action"},precondition:_K.Visible,keybinding:{weight:NK,primary:3,secondary:[2137]}})}run(t){const i=t.get(IK);i instanceof PK&&i.acceptSelected()}}),Ep(class extends Dp{constructor(){super({id:EK,title:{value:e(0,"Preview selected action"),original:"Preview selected action"},precondition:_K.Visible,keybinding:{weight:NK,primary:2051}})}run(t){const i=t.get(IK);i instanceof PK&&i.acceptSelected(!0)}});var BK,$K=function(t,i,e,s){if("a"===e&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?t!==i||!s:!i.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?s:"a"===e?s.call(t):s?s.value:i.get(t)};const jK=new Jo("supportedCodeAction","");class WK extends Hi{constructor(t,i,e,s=250){super(),this._editor=t,this._markerService=i,this._signalChange=e,this._delay=s,this._autoTriggerTimer=this._register(new cu),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=>GD(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:QU.Default})}),this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),e=this._editor.getSelection();if(e.isEmpty()&&2===t.type){const{lineNumber:t,column:s}=e.getPosition(),n=i.getLineContent(t);if(0===n.length)return;if(1===s){if(/\s/.test(n[0]))return}else if(s===i.getLineMaxColumn(t)){if(/\s/.test(n[n.length-1]))return}else if(/\s/.test(n[s-2])&&/\s/.test(n[s-1]))return}return e}}var VK;!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 HK;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(VK||(VK={}));const HK=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class zK extends Hi{constructor(t,i,e,s,n){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._codeActionOracle=this._register(new zi),this._state=VK.Empty,this._onDidChangeState=this._register(new ee),this.onDidChangeState=this._onDidChangeState.event,BK.set(this,!1),this._supportedCodeActions=jK.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(){$K(this,BK,"f")||(function(t,i,e,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?t!==i||!n:!i.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?n.call(t,e):n?n.value=e:i.set(t,e)}(this,BK,!0,"f"),super.dispose(),this.setState(VK.Empty,!0))}_update(){if($K(this,BK,"f"))return;this._codeActionOracle.value=void 0,this.setState(VK.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(88)){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 WK(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(VK.Empty);const s=tu((e=>dK(this._registry,t,i.selection,i.trigger,KR.None,e)));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(s,250)),this.setState(new VK.Triggered(i.trigger,i.selection.getStartPosition(),s))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:QU.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||$K(this,BK,"f")||this._onDidChangeState.fire(t))}}BK=new WeakMap;var UK,KK=function(t,i){return function(e,s){i(e,s,t)}},qK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let GK=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n,r,o,h,c,u){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=u,this._activeCodeActions=this._register(new zi),this._showDisabled=!1,UK.set(this,!1),this._editor=t,this._model=this._register(new zK(this._editor,n.codeActionProvider,i,e,r)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new On((()=>{const t=this._editor.getContribution(yK.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(mK),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){(function(t,i,e,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?t!==i||!n:!i.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?n.call(t,e):n?n.value=e:i.set(t,e)})(this,UK,!0,"f"),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=kK.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)}_applyCodeAction(t,i,e){return qK(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction(pK,t,gK.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:QU.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return qK(this,void 0,void 0,(function*(){if(1!==t.type)return void(null===(i=this._lightBulbWidget.rawValue)||void 0===i||i.hide());let c;try{c=yield t.actions}catch(t){return void Ei(t)}if(!function(t,i,e,s){if("a"===e&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?t!==i||!s:!i.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?s:"a"===e?s.call(t):s?s.value:i.get(t)}(this,UK,"f"))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(),yield 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=kK.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=kK.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}showCodeActionList(t,i,e){return qK(this,void 0,void 0,(function*(){const s=this._editor.getDomNode();if(!s)return;const n=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!n.length)return;const r=vs.isIPosition(i)?this.toCoords(i):i,o={onSelect:(t,i)=>qK(this,void 0,void 0,(function*(){this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide()})),onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>({kind:"action",item:t,group:vK,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title})));const s=wK.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new YU(i.action.kind):YU.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)n.push({kind:"action",item:i,group:t.group,label:i.action.title,disabled:!!i.action.disabled,keybinding:e(i.action)})}return n}(n,this._shouldShowHeaders(),this._resolver.getResolver()),o,r,s,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=og(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,s){if(s.fromLightbulb)return[];const n=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 s.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:e(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,s))}:{id:"showMoreActions",label:e(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,s))}),n}};function ZK(t){return Oo.regex(jK.keys()[0],new RegExp("(\\s|^)"+In(t.value)+"\\b"))}UK=new WeakMap,GK.ID="editor.contrib.codeActionController",GK=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}([KK(1,tB),KK(2,Qo),KK(3,eo),KK(4,ka),KK(5,qR),KK(6,dp),KK(7,ic),KK(8,IK),KK(9,eo)],GK);const JK={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:e(0,"Kind of the code action to run.")},apply:{type:"string",description:e(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[e(0,"Always apply the first returned code action."),e(0,"Apply the first returned code action if it is the only one."),e(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:e(0,"Controls if only preferred code actions should be returned.")}}};function QK(t,i,e,s,n=QU.Default){if(t.hasModel()){const r=GK.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}$p(GK.ID,GK,3),$p(yK.ID,yK,4),Np(class extends Tp{constructor(){super({id:nK,label:e(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),kbOpts:{kbExpr:PC.textInputFocus,primary:2137,weight:100}})}run(t,i){return QK(i,e(0,"No code actions available"),void 0,void 0,QU.QuickFix)}}),Np(class extends Tp{constructor(){super({id:oK,label:e(0,"Refactor..."),alias:"Refactor...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),kbOpts:{kbExpr:PC.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Oo.and(PC.writable,ZK(YU.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:JK}]}})}run(t,i,s){const n=tK.fromUser(s,{kind:YU.Refactor,apply:"never"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",s.kind):e(0,n.preferred?"No preferred refactorings available":"No refactorings available"),{include:YU.Refactor.contains(n.kind)?n.kind:YU.None,onlyIncludePreferredActions:n.preferred},n.apply,QU.Refactor)}}),Np(class extends Tp{constructor(){super({id:hK,label:e(0,"Source Action..."),alias:"Source Action...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Oo.and(PC.writable,ZK(YU.Source))},description:{description:"Source Action...",args:[{name:"args",schema:JK}]}})}run(t,i,s){const n=tK.fromUser(s,{kind:YU.Source,apply:"never"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",s.kind):e(0,n.preferred?"No preferred source actions available":"No source actions available"),{include:YU.Source.contains(n.kind)?n.kind:YU.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,QU.SourceAction)}}),Np(class extends Tp{constructor(){super({id:cK,label:e(0,"Organize Imports"),alias:"Organize Imports",precondition:Oo.and(PC.writable,ZK(YU.SourceOrganizeImports)),kbOpts:{kbExpr:PC.textInputFocus,primary:1581,weight:100}})}run(t,i){return QK(i,e(0,"No organize imports action available"),{include:YU.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",QU.OrganizeImports)}}),Np(class extends Tp{constructor(){super({id:rK,label:e(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Oo.and(PC.writable,ZK(YU.QuickFix)),kbOpts:{kbExpr:PC.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return QK(i,e(0,"No auto fixes available"),{include:YU.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",QU.AutoFix)}}),Np(class extends Tp{constructor(){super({id:uK,label:e(0,"Fix All"),alias:"Fix All",precondition:Oo.and(PC.writable,ZK(YU.SourceFixAll))})}run(t,i){return QK(i,e(0,"No fix all action available"),{include:YU.SourceFixAll,includeSourceActions:!0},"ifSingle",QU.FixAll)}}),Pp(new class extends Fp{constructor(){super({id:sK,precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:JK}]}})}runEditorCommand(t,i,s){const n=tK.fromUser(s,{kind:YU.Empty,apply:"ifSingle"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",s.kind):e(0,n.preferred?"No preferred code actions available":"No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}),dc.as(mc).registerConfiguration(Object.assign(Object.assign({},PI),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:e(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}}));var YK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class XK{constructor(){this.lenses=[],this._disposables=new Vi}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})}}function tq(t,i,e){return YK(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new XK,o=s.map(((t,s)=>YK(this,void 0,void 0,(function*(){n.set(t,s);try{const s=yield Promise.resolve(t.provideCodeLenses(i,e));s&&r.add(s,t)}catch(t){Ai(t)}}))));return yield 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}))}fp.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;Mt(os.isUri(e)),Mt("number"==typeof s||!s);const{codeLensProvider:n}=t.get(ka),r=t.get(Zc).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return tq(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 iq=no("ICodeLensCache");class eq{constructor(t,i){this.lineCount=t,this.data=i}}let sq=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new TO(20,.75),au((()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Ni(t.onWillSaveState)((e=>{e.reason===cN.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 XK;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new eq(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 ws(t,1,t,11)});const n=new XK;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new eq(e.lineCount,n))}}catch(t){}}};sq=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,hN)],sq),lc(iq,sq,1);class nq{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 rq{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+rq._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=UF(n.command.title.trim());n.command.id?(e.push(Rg("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Rg("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Rg("span",void 0," | "))}}s?(Mg(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Mg(this._domNode,Rg("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}}rq._idPool=0;class oq{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 hq=sL.register({collapseOnReplaceEdit:!0,description:"codelens"});class cq{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:hq},(t=>this._decorationIds[i]=t)),o=o?ws.plusRange(o,t.symbol.range):ws.lift(t.symbol.range)})),this._viewZone=new nq(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 rq(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||ws.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:hq},(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 uq=function(t,i){return function(e,s){i(e,s,t)}};let lq=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 Vi,this._localToDispose=new Vi,this._lenses=[],this._oldCodeLensModels=new Vi,this._provideCodeLensDebounce=e.for(i.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=e.for(i.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new lu((()=>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(48)||t.hasChanged(17)||t.hasChanged(16))&&this._updateLensStyle(),t.hasChanged(15)&&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(64)/this._editor.getOption(50));let i=this._editor.getOption(17);return(!i||i<5)&&(i=.9*this._editor.getOption(50)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(16),s=this._editor.getOption(48),{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",ki.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(15))return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&this._localToDispose.add(ou((()=>{const e=this._codeLensCache.get(t);i===e&&(this._codeLensCache.delete(t),this._onModelChange())}),3e4)));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 lu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=tu((i=>tq(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()}),Ei)}),this._provideCodeLensDebounce.get(t));this._localToDispose.add(e),this._localToDispose.add(Wi((()=>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 oq;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.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(Wi((()=>{if(this._editor.getModel()){const t=_F.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 oq;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=_F.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new oq;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 cq(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 cq(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=tu((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}),Ai)));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=>{Ei(t),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}))}getModel(){return this._currentCodeLensModel}};lq.ID="css.editor.codeLens",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}([uq(1,ka),uq(2,z_),uq(3,dp),uq(4,IM),uq(5,iq)],lq),$p(lq.ID,lq,1),Np(class extends Tp{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:PC.hasCodeLensProvider,label:e(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return e=this,s=void 0,r=function*(){if(!i.hasModel())return;const e=t.get(Kj),s=t.get(dp),n=t.get(IM),r=i.getSelection().positionLineNumber,o=i.getContribution(lq.ID);if(!o)return;const h=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 u=yield e.pick(c,{canPickMany:!1});if(u){if(h.isDisposed)return yield s.executeCommand(this.id);try{yield s.executeCommand(u.command.id,...u.command.arguments||[])}catch(t){n.error(t)}}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}});var aq=function(t,i){return function(e,s){i(e,s,t)}};class dq{constructor(t,i){this._editorWorkerClient=new Fa(t,!1,"editorWorkerService",i)}provideDocumentColors(t,i){return e=this,s=void 0,r=function*(){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new ea(new Xl(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?ea.Format.CSS.formatRGB(o):ea.Format.CSS.formatRGBA(o),c=r?ea.Format.CSS.formatHSL(o):ea.Format.CSS.formatHSLA(o),u=r?ea.Format.CSS.formatHex(o):ea.Format.CSS.formatHexA(o),l=[];return l.push({label:h,textEdit:{range:s,text:h}}),l.push({label:c,textEdit:{range:s,text:c}}),l.push({label:u,textEdit:{range:s,text:u}}),l}}let fq=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new dq(t,i)))}};fq=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}([aq(0,Zc),aq(1,_c),aq(2,ka)],fq),ZV(fq);var gq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function pq(t,i,e,s=!0){return gq(this,void 0,void 0,(function*(){return yq(new vq,t,i,e,s)}))}function mq(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class vq{constructor(){}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const n=yield t.provideDocumentColors(i,e);if(Array.isArray(n))for(const i of n)s.push({colorInfo:i,provider:t});return Array.isArray(n)}))}}class wq{constructor(){}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const n=yield 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 bq{constructor(t){this.colorInfo=t}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const e=yield t.provideColorPresentations(i,this.colorInfo,fe.None);return Array.isArray(e)&&s.push(...e),Array.isArray(e)}))}}function yq(t,i,e,s,n){return gq(this,void 0,void 0,(function*(){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 dq)r=n;else try{(yield t.compute(n,e,s,h))&&(o=!0)}catch(t){Ai(t)}}return o?h:r&&n?(yield t.compute(r,e,s,h),h):[]}))}function kq(t,i){const{colorProvider:e}=t.get(ka),s=t.get(Zc).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(ic).getValue("editor.defaultColorDecorators",{resource:i})}}fp.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof os))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=kq(t,e);return yq(new wq,n,s,fe.None,r)})),fp.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof os&&Array.isArray(e)&&4===e.length&&ws.isIRange(r)))throw Ti();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=kq(t,n),[u,l,a,d]=e;return yq(new bq({range:r,color:{red:u,green:l,blue:a,alpha:d}}),h,o,fe.None,c)}));var Cq=function(t,i){return function(e,s){i(e,s,t)}},Sq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const xq=Object.create({});let Dq=class t extends Hi{constructor(i,e,s,n){super(),this._editor=i,this._configurationService=e,this._languageFeaturesService=s,this._localToDispose=this._register(new Vi),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new Lb(this._editor),this._decoratorLimitReporter=new Eq,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=n.for(s.colorProvider,"Document Colors",{min:t.RECOMPUTE_TIME}),this._register(i.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(i.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(s.colorProvider.onDidChange((()=>this.updateColors()))),this._register(i.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(142);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(19),s=t.hasChanged(142);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(142),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(18)}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 cu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return Sq(this,void 0,void 0,(function*(){this._computePromise=tu((t=>Sq(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Ji(!1),s=yield pq(this._languageFeaturesService.colorProvider,i,t,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(i,e.elapsed()),s}))));try{const t=yield this._computePromise;this.updateDecorations(t),this.updateColorDecorators(t),this._computePromise=null}catch(t){Ei(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:sL.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(19);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 Xl(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:xq}}})}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(ws.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)}};Dq.ID="editor.contrib.colorDetector",Dq.RECOMPUTE_TIME=1e3,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}([Cq(1,ic),Cq(2,ka),Cq(3,z_)],Dq);class Eq{constructor(){this._onDidChange=new ee,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}$p(Dq.ID,Dq,1);class Aq{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 ee,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ee,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ee,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 Lq=Rg;class Mq extends Hi{constructor(t,i,s,n=!1){super(),this.model=i,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Lq(".colorpicker-header"),Lg(t,this._domNode),this._pickedColorNode=Lg(this._domNode,Lq(".picked-color"));const r=e(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",r),this._originalColorNode=Lg(this._domNode,Lq(".original-color")),this._originalColorNode.style.backgroundColor=ea.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=s.getColorTheme().getColor(Iv)||ea.white,this._register(s.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Iv)||ea.white}))),this._register(Zf(this._pickedColorNode,xg.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Zf(this._originalColorNode,xg.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=ea.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 Oq(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=ea.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorNode.textContent=this.model.presentation?this.model.presentation.label:"",this._pickedColorNode.prepend(Lq(".codicon.codicon-color-mode"))}}class Oq extends Hi{constructor(t){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Lg(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Lg(this._button,i),Lg(i,Lq(".button"+np.asCSSSelector(SR("color-picker-close",Ss.close,e(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class Fq extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=Lq(".colorpicker-body"),Lg(t,this._domNode),this._saturationBox=new Tq(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 _q(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 Iq(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 Pq(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 ea(new ia(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new ea(new ia(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new ea(new ia(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 Tq extends Hi{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ee,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Lq(".saturation-wrap"),Lg(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Lg(this._domNode,this._canvas),this.selection=Lq(".saturation-selection"),Lg(this._domNode,this.selection),this.layout(),this._register(Zf(this._domNode,xg.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 cm);const i=og(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=Zf(document,xg.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 ea(new ia(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=ea.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(){this.monitor&&this.monitor.isMonitoring()||this.paint()}}class Rq extends Hi{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ee,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=Lg(t,Lq(".standalone-strip")),this.overlay=Lg(this.domNode,Lq(".standalone-overlay"))):(this.domNode=Lg(t,Lq(".strip")),this.overlay=Lg(this.domNode,Lq(".overlay"))),this.slider=Lg(this.domNode,Lq(".slider")),this.slider.style.top="0px",this._register(Zf(this.domNode,xg.POINTER_DOWN,(t=>this.onPointerDown(t)))),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new cm),e=og(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=Zf(document,xg.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 _q extends Rq{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){const{r:i,g:e,b:s}=t.rgba,n=new ea(new Xl(i,e,s,1)),r=new ea(new Xl(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class Iq extends Rq{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class Pq extends Hi{constructor(t){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=Lg(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 Nq extends gy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Or.onDidChange((()=>this.layout())));const r=Lq(".colorpicker-widget");t.appendChild(r),this.header=this._register(new Mq(r,this.model,s,n)),this.body=this._register(new Fq(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var Bq=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},$q=function(t,i){return function(e,s){i(e,s,t)}},jq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class Wq{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 Vq=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return pu.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=Dq.get(this._editor);if(!t)return[];for(const e of i){if(!t.isColorDecoration(e))continue;const i=t.getColorData(e.range.getStartPosition());if(i)return[yield Uq(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return Kq(this,this._editor,this._themeService,i,t)}};Vq=Bq([$q(1,Yy)],Vq);class Hq{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let zq=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!Dq.get(this._editor))return null;const s=yield pq(e,this._editor.getModel(),fe.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;ws.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:yield Uq(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=t.model;let e=new ws(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(yield Gq(this._editor.getModel(),i,this._color,e,t),e=qq(this._editor,e,i))}))}renderHoverParts(t,i){return Kq(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function Uq(t,i,e,s){return jq(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,u=new Xl(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),l=new ea(u),a=yield mq(i,e,s,fe.None),d=new Aq(l,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(l,n),t instanceof Vq?new Wq(t,ws.lift(e.range),d,s):new Hq(t,ws.lift(e.range),d,s)}))}function Kq(t,i,e,s,n){if(0===s.length||!i.hasModel())return Hi.None;const r=new Vi,o=s[0],h=i.getModel(),c=o.model,u=r.add(new Nq(n.fragment,c,i.getOption(138),e,t instanceof zq));n.setColorPicker(u);let l=new ws(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof zq){const i=s[0].model.color;t.color=i,Gq(h,c,i,l,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>jq(this,void 0,void 0,(function*(){yield Gq(h,c,t,l,o),l=qq(i,l,c,n)})))));return r.add(c.onDidChangeColor((t=>{Gq(h,c,t,l,o)}))),r}function qq(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new ws(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}function Gq(t,i,e,s,n){return jq(this,void 0,void 0,(function*(){const r=yield mq(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 Zq(t,i){return!!t[i]}zq=Bq([$q(1,Yy)],zq);class Jq{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=Zq(t.event,i.triggerModifier),this.hasSideBySideModifier=Zq(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class Qq{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=Zq(t,i.triggerModifier)}}class Yq{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 Xq(t){return"altKey"===t?b?new Yq(57,"metaKey",6,"altKey"):new Yq(5,"ctrlKey",6,"altKey"):b?new Yq(6,"altKey",57,"metaKey"):new Yq(6,"altKey",5,"ctrlKey")}class tG extends Hi{constructor(t,i){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ee),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ee),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ee),this.onCancel=this._onCancel.event,this._editor=t,this._alwaysFireExecuteOnMouseUp=i,this._opts=Xq(this._editor.getOption(75)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(75)){const t=Xq(this._editor.getOption(75));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 Jq(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new Jq(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new Jq(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new Qq(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new Qq(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=t.target.position?t.target.position.lineNumber:0}_onEditorMouseUp(t){(this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===(t.target.position?t.target.position.lineNumber:0)||this._alwaysFireExecuteOnMouseUp)&&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 iG=function(t,i){return function(e,s){i(e,s,t)}};let eG=class extends oO{constructor(t,i,e,s,n,r,o,h,c,u,l,a,d){super(t,Object.assign(Object.assign({},s.getRawOptions()),{overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()}),e,n,r,o,h,c,u,l,a,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){Bt(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};eG=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}([iG(4,eo),iG(5,ro),iG(6,dp),iG(7,Qo),iG(8,Yy),iG(9,IM),iG(10,sh),iG(11,_c),iG(12,ka)],eG);const sG=new ea(new Xl(0,122,204)),nG={showArrow:!0,showFrame:!0,className:"",frameColor:sG,arrowColor:sG,keepEditorSelection:!1};class rG{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 oG{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class hG{constructor(t){this._editor=t,this._ruleName=hG._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Cg(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(){Cg(this._ruleName),kg(`.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:ws.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}hG._IdGenerator=new qF(".arrow-decoration-");class cG{constructor(t,i={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Vi,this.container=null,this._isShowing=!1,this.editor=t,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=_t(i),Bt(this.options,nG,!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 hG(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=ws.isIRange(t)?ws.lift(t):ws.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:sL.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(64);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(64);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 rG(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 oG("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 u=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,n),this.options.keepEditorSelection||this.editor.setSelection(t);const l=this.editor.getModel();if(l){const i=l.validateRange(new ws(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===l.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 EO(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(64),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 uG=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},lG=function(t,i){return function(e,s){i(e,s,t)}};const aG=no("IPeekViewService");var dG;lc(aG,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 Jo("inReferenceSearchEditor",!0,e(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(dG||(dG={}));let fG=class{constructor(t,i){t instanceof eG&&dG.inPeekEditor.bindTo(i)}dispose(){}};fG.ID="editor.contrib.referenceController",fG=uG([lG(1,Qo)],fG),$p(fG.ID,fG,0);const gG={headerBackgroundColor:ea.white,primaryHeadingColor:ea.fromHex("#333333"),secondaryHeadingColor:ea.fromHex("#6c6c6cb3")};let pG=class extends cG{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,Bt(this.options,gG,!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=Rg(".head"),this._bodyElement=Rg(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Rg(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Qf(this._titleElement,"click",(t=>this._onTitleClick(t)))),Lg(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Rg("span.filename"),this._secondaryHeading=Rg("span.dirname"),this._metaHeading=Rg("span.meta"),Lg(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const s=Rg(".peekview-actions");Lg(this._headElement,s);const n=this._getActionBarOptions();this._actionbarWidget=new kR(s,n),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new op("peekview.close",e(0,"Close"),np.asClassName(Ss.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:TN.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:Kf(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,_g(this._metaHeading)):Ig(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(64)),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`)}};pG=uG([lG(2,eo)],pG);const mG=fm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view title area.")),vG=fm("peekViewTitleLabel.foreground",{dark:ea.white,light:ea.black,hcDark:ea.white,hcLight:av},e(0,"Color of the peek view title.")),wG=fm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},e(0,"Color of the peek view title info.")),bG=fm("peekView.border",{dark:hv,light:hv,hcDark:wm,hcLight:wm},e(0,"Color of the peek view borders and arrow.")),yG=fm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view result list."));fm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:ea.white,hcLight:av},e(0,"Foreground color for line nodes in the peek view result list.")),fm("peekViewResult.fileForeground",{dark:ea.white,light:"#1E1E1E",hcDark:ea.white,hcLight:av},e(0,"Foreground color for file nodes in the peek view result list.")),fm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},e(0,"Background color of the selected entry in the peek view result list.")),fm("peekViewResult.selectionForeground",{dark:ea.white,light:"#6C6C6C",hcDark:ea.white,hcLight:av},e(0,"Foreground color of the selected entry in the peek view result list."));const kG=fm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view editor."));fm("peekViewEditorGutter.background",{dark:kG,light:kG,hcDark:kG,hcLight:kG},e(0,"Background color of the gutter in the peek view editor.")),fm("peekViewEditorStickyScroll.background",{dark:kG,light:kG,hcDark:kG,hcLight:kG},e(0,"Background color of sticky scroll in the peek view editor.")),fm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},e(0,"Match highlight color in the peek view result list.")),fm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},e(0,"Match highlight color in the peek view editor.")),fm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:bm,hcLight:bm},e(0,"Match highlight border in the peek view editor."));class CG{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=GF.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?e(0,"{0} in {1} on line {2} at column {3}",i.value,JD(this.uri),this.range.startLineNumber,this.range.startColumn):e(0,"in {0} on line {1} at column {2}",JD(this.uri),this.range.startLineNumber,this.range.startColumn)}}class SG{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 ws(s,h.startColumn,s,n),u=new ws(r,o,r,1073741824),l=e.getValueInRange(c).replace(/^\s+/,""),a=e.getValueInRange(t);return{value:l+a+e.getValueInRange(u).replace(/\s+$/,""),highlight:{start:l.length,end:l.length+a.length}}}}class xG{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new OO}dispose(){$i(this._previews.values()),this._previews.clear()}getPreview(t){return this._previews.get(t.uri)}get ariaMessage(){const t=this.children.length;return 1===t?e(0,"1 symbol in {0}, full path {1}",JD(this.uri),this.uri.fsPath):e(0,"{0} symbols in {1}, full path {2}",t,JD(this.uri),this.uri.fsPath)}resolve(t){return i=this,e=void 0,n=function*(){if(0!==this._previews.size)return this;for(const i of this.children)if(!this._previews.has(i.uri))try{const e=yield t.createModelReference(i.uri);this._previews.set(i.uri,new SG(e))}catch(t){Ei(t)}return this},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}}class DG{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ee,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(DG._compareReferences);for(const i of t)if(s&&qD.isEqual(s.uri,i.uri,!0)||(s=new xG(this,i.uri),this.groups.push(s)),0===s.children.length||0!==DG._compareReferences(i,s.children[s.children.length-1])){const t=new CG(e===i,s,i,(t=>this._onDidChangeReferenceRange.fire(t)));this.references.push(t),s.children.push(t)}}dispose(){$i(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new DG(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?e(0,"No results found"):1===this.references.length?e(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?e(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):e(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:tr(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()&&ws.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 qD.compare(t.uri,i.uri)||ws.compareRangesUsingStarts(t.range,i.range)}}var EG=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},AG=function(t,i){return function(e,s){i(e,s,t)}};let LG=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof DG||t instanceof xG}getChildren(t){if(t instanceof DG)return t.groups;if(t instanceof xG)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};LG=EG([AG(0,ep)],LG);class MG{getHeight(){return 23}getTemplateId(t){return t instanceof xG?RG.id:IG.id}}let OG=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof CG){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return JD(t.uri)}};OG=EG([AG(0,eP)],OG);class FG{getId(t){return t instanceof CG?t.id:t.uri}}let TG=class extends Hi{constructor(t,i){super(),this._labelService=i;const e=document.createElement("div");e.classList.add("reference-file"),this.file=this._register(new hW(e,{supportHighlights:!0})),this.badge=new Jj(Lg(e,Rg(".count")),{},mN),t.appendChild(e)}set(t,i){const s=YD(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(s,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const n=t.children.length;this.badge.setCount(n),this.badge.setTitleFormat(e(0,n>1?"{0} references":"{0} reference",n))}};TG=EG([AG(1,fP)],TG);let RG=class t{constructor(i){this._instantiationService=i,this.templateId=t.id}renderTemplate(t){return this._instantiationService.createInstance(TG,t)}renderElement(t,i,e){e.set(t.element,sF(t.filterData))}disposeTemplate(t){t.dispose()}};RG.id="FileReferencesRenderer",RG=EG([AG(0,eo)],RG);class _G{constructor(t){this.label=new rW(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&&!pF.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,sF(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${JD(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class IG{constructor(){this.templateId=IG.id}renderTemplate(t){return new _G(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}IG.id="OneReferenceRenderer";class PG{getWidgetAriaLabel(){return e(0,"References")}getAriaLabel(t){return t.ariaMessage}}var NG=function(t,i){return function(e,s){i(e,s,t)}},BG=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class $G{constructor(t,i){this._editor=t,this._model=i,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Vi,this._callOnModelChange=new Vi,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:$G.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;ws.equalsRange(n,s.range)||((ws.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()}}$G.DecorationOptions=sL.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class jG{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 WG extends Ij{}let VG=class extends pG{constructor(t,i,e,s,n,r,o,h,c,u,l,a){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=u,this._languageService=l,this._languageConfigurationService=a,this._disposeOnNewModel=new Vi,this._callOnDispose=new Vi,this._onDidSelectReference=new ee,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ng(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(),$i(this._preview),$i(this._previewNotAvailableMessage),$i(this._tree),$i(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(t){const i=t.getColor(bG)||ea.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(mG)||ea.transparent,primaryHeadingColor:t.getColor(vG),secondaryHeadingColor:t.getColor(wG)})}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=Lg(t,Rg("div.messages")),Ig(this._messageContainer),this._splitView=new yB(t,{orientation:1}),this._previewContainer=Lg(t,Rg("div.preview.inline")),this._preview=this._instantiationService.createInstance(eG,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Ig(this._previewContainer),this._previewNotAvailableMessage=new qA(e(0,"no preview available"),Ec,qA.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Lg(t,Rg("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new PG,keyboardNavigationLabelProvider:this._instantiationService.createInstance(OG),identityProvider:new FG,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:yG}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Qf(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(WG,"ReferencesWidget",this._treeContainer,new MG,[this._instantiationService.createInstance(RG),this._instantiationService.createInstance(IG)],this._instantiationService.createInstance(LG),i),this._splitView.addView({onDidChange:Qi.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},bB.Distribute),this._splitView.addView({onDidChange:Qi.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)}},bB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const s=(t,i)=>{t instanceof CG&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{s(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Ig(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ng(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=e(0,"No results"),_g(this._messageContainer),Promise.resolve(void 0)):(Ig(this._messageContainer),this._decorationsManager=new $G(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"),_g(this._treeContainer),_g(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 CG?t:t instanceof xG&&t.children.length>0?t.children[0]:void 0}revealReference(t){return BG(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return BG(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==Wf.inMemory?this.setTitle(ZD(t.uri),this._uriLabel.getUriLabel(YD(t.uri))):this.setTitle(e(0,"References"));const s=this._textModelResolverService.createModelReference(t.uri);this._tree.getInput()===t.parent||(i&&this._tree.reveal(t.parent),yield this._tree.expand(t.parent)),this._tree.reveal(t);const n=yield s;if(!this._model)return void n.dispose();$i(this._previewModelReference);const r=n.object;if(r){const i=this._preview.getModel()===r.textEditorModel?0:1,e=ws.lift(t.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(r.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}))}};VG=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}([NG(3,Yy),NG(4,ep),NG(5,eo),NG(6,aG),NG(7,fP),NG(8,BA),NG(9,eP),NG(10,hc),NG(11,_c)],VG);var HG=function(t,i){return function(e,s){i(e,s,t)}},zG=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const UG=new Jo("referenceSearchVisible",!1,e(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let KG=class t{static get(i){return i.getContribution(t.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 Vi,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=UG.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,s){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&t.containsPosition(n))return;this._peekMode=s,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const r="peekViewLayout",o=jG.fromJSON(this._storageService.get(r,0,"{}"));this._widget=this._instantiationService.createInstance(VG,this._editor,this._defaultTreeKeyboardSupport,o),this._widget.setTitle(e(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(r,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:e}=t;if(i)switch(e){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":s?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const h=++this._requestIdPool;i.then((i=>{var s;if(h===this._requestIdPool&&this._widget)return null===(s=this._model)||void 0===s||s.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":e(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,s=new vs(t.startLineNumber,t.startColumn),n=this._model.nearestReference(i,s);if(n)return this._widget.setSelection(n).then((()=>{this._widget&&"editor"===this._editor.getOption(84)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}goToNextOrPreviousReference(t){return zG(this,void 0,void 0,(function*(){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();yield this._widget.setSelection(s),yield this._gotoReference(s,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}))}revealReference(t){return zG(this,void 0,void 0,(function*(){this._editor.hasModel()&&this._model&&this._widget&&(yield 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(i,e){var s;null===(s=this._widget)||void 0===s||s.hide(),this._ignoreModelChangeEvent=!0;const n=ws.lift(i.range).collapseToStart();return this._editorService.openCodeEditor({resource:i.uri,options:{selection:n,selectionSource:"code.jump",pinned:e}},this._editor).then((i=>{var e;if(this._ignoreModelChangeEvent=!1,i&&this._widget)if(this._editor===i)this._widget.show(n),this._widget.focusOnReferenceTree();else{const s=t.get(i),r=this._model.clone();this.closeWidget(),i.focus(),null==s||s.toggleWidget(n,tu((()=>Promise.resolve(r))),null!==(e=this._peekMode)&&void 0!==e&&e)}else this.closeWidget()}),(t=>{this._ignoreModelChangeEvent=!1,Ei(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 qG(t,i){const e=function(t){const i=t.get(ro).getFocusedCodeEditor();return i instanceof eG?i.getParentEditor():i}(t);if(!e)return;const s=KG.get(e);s&&i(s)}KG.ID="editor.contrib.referencesController",KG=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}([HG(2,Qo),HG(3,ro),HG(4,IM),HG(5,eo),HG(6,hN),HG(7,ic)],KG),pp.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ae(2089,60),when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),pp.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),pp.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),fp.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),fp.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),fp.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),fp.registerCommand("closeReferenceSearch",(t=>qG(t,(t=>t.closeWidget())))),pp.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Oo.and(dG.inPeekEditor,Oo.not("config.editor.stablePeek"))}),pp.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Oo.and(UG,Oo.not("config.editor.stablePeek"))}),pp.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Oo.and(UG,q$,X$.negate(),ij.negate()),handler(t){var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.revealReference(e[0])))}}),pp.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Oo.and(UG,q$,X$.negate(),ij.negate()),handler(t){var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.openReference(e[0],!0,!0)))}}),fp.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.openReference(e[0],!1,!0)))}));var GG=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},ZG=function(t,i){return function(e,s){i(e,s,t)}};const JG=new Jo("hasSymbols",!1,e(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),QG=no("ISymbolNavigationService");let YG=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=JG.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 XG(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(GD(t.uri,e.uri))n=!0,r=r||ws.containsPosition(t.range,s);else if(n)break;n&&r||this.reset()}));this._currentState=ji(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:ws.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"),s=i?e(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):e(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(s)}};YG=GG([ZG(0,Qo),ZG(1,ro),ZG(2,IM),ZG(3,eP)],YG),lc(QG,YG,1),Pp(new class extends Fp{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:JG,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(QG).revealNext(i)}}),pp.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:JG,primary:9,handler(t){t.get(QG).reset()}});let XG=class{constructor(t){this._listener=new Map,this._disposables=new Vi,this._onDidChange=new ee,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(),$i(this._listener.values())}_onDidAddEditor(t){this._listener.set(t,ji(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)}};XG=GG([ZG(0,ro)],XG);var tZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function iZ(t,i,e,s){return tZ(this,void 0,void 0,(function*(){const n=e.ordered(t).map((e=>Promise.resolve(s(e,t,i)).then(void 0,(t=>{Ai(t)}))));return X((yield Promise.all(n)).flat())}))}function eZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function sZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function nZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function rZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function oZ(t,i,e,s,n){return iZ(i,e,t,((t,i,e)=>tZ(this,void 0,void 0,(function*(){const r=yield t.provideReferences(i,e,{includeDeclaration:!0},n);if(!s||!r||2!==r.length)return r;const o=yield t.provideReferences(i,e,{includeDeclaration:!1},n);return o&&1===o.length?o:r}))))}function hZ(t){return tZ(this,void 0,void 0,(function*(){const i=yield t(),e=new DG(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}Ip("_executeDefinitionProvider",((t,i,e)=>{const s=eZ(t.get(ka).definitionProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeTypeDefinitionProvider",((t,i,e)=>{const s=rZ(t.get(ka).typeDefinitionProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeDeclarationProvider",((t,i,e)=>{const s=sZ(t.get(ka).declarationProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeReferenceProvider",((t,i,e)=>{const s=oZ(t.get(ka).referenceProvider,i,e,!1,fe.None);return hZ((()=>s))})),Ip("_executeImplementationProvider",((t,i,e)=>{const s=nZ(t.get(ka).implementationProvider,i,e,fe.None);return hZ((()=>s))}));var cZ,uZ,lZ,aZ,dZ,fZ,gZ,pZ,mZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextPeek,title:e(0,"Peek"),group:"navigation",order:100});class vZ{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof vZ||!(!vs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class wZ extends _p{static all(){return wZ._allSymbolNavigationCommands.values()}static _patchConfig(t){const i=Object.assign(Object.assign({},t),{f1:!0});if(i.menu)for(const e of B.wrap(i.menu))e.id!==bp.EditorContext&&e.id!==bp.EditorContextPeek||(e.when=Oo.and(t.precondition,e.when));return i}constructor(t,i){super(wZ._patchConfig(i)),this.configuration=t,wZ._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(IM),r=t.get(ro),o=t.get(qR),h=t.get(QG),c=t.get(ka),u=t.get(eo),l=i.getModel(),a=i.getPosition(),d=vZ.is(e)?e:new vZ(l,a),f=new UH(i,5),g=iu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>mZ(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(Yg(t.ariaMessage),t.referenceAt(l.uri,a)){const t=this._getAlternativeCommand(i);!wZ._activeAlternativeCommands.has(t)&&wZ._allSymbolNavigationCommands.has(t)&&(o=wZ._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=l.getWordAtPosition(a);null===(n=kK.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);wZ._activeAlternativeCommands.add(this.desc.id),u.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{wZ._activeAlternativeCommands.delete(this.desc.id)}))))}}))),(t=>{n.error(t)})).finally((()=>{f.dispose()}));return o.showWhile(g,250),g}_onResult(t,i,e,s,n){return mZ(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof eG||!(this.configuration.openInPeek||"peek"===r&&s.references.length>1)){const o=s.firstReference(),h=s.references.length>1&&"gotoAndPeek"===r,c=yield 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)}))}_openReference(t,i,e,s,n){return mZ(this,void 0,void 0,(function*(){let r;var o;if((o=e)&&os.isUri(o.uri)&&ws.isIRange(o.range)&&(ws.isIRange(o.originSelectionRange)||ws.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=yield i.openCodeEditor({resource:e.uri,options:{selection:ws.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=KG.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),tu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}wZ._allSymbolNavigationCommands=new Map,wZ._activeAlternativeCommands=new Set;class bZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield eZ(t.definitionProvider,i,s,n),e(0,"Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No definition found for '{0}'",t.word):e(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(56).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(56).multipleDefinitions}}const yZ=C&&!Wr()?2118:70;Ep(((cZ=class t extends bZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:e(0,"Go to &&Definition")},precondition:Oo.and(PC.hasDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:yZ,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.1},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),fp.registerCommandAlias("editor.action.goToDeclaration",t.id)}}).id="editor.action.revealDefinition",cZ)),Ep(((uZ=class t extends bZ{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Oo.and(PC.hasDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:Ae(2089,yZ),weight:100}}),fp.registerCommandAlias("editor.action.openDeclarationToTheSide",t.id)}}).id="editor.action.revealDefinitionAside",uZ)),Ep(((lZ=class t extends bZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.id,title:{value:e(0,"Peek Definition"),original:"Peek Definition"},precondition:Oo.and(PC.hasDefinitionProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:bp.EditorContextPeek,group:"peek",order:2}}),fp.registerCommandAlias("editor.action.previewDeclaration",t.id)}}).id="editor.action.peekDefinition",lZ));class kZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield sZ(t.declarationProvider,i,s,n),e(0,"Declarations"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No declaration found for '{0}'",t.word):e(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(56).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(56).multipleDeclarations}}Ep(((aZ=class t extends kZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:e(0,"Go to &&Declaration")},precondition:Oo.and(PC.hasDeclarationProvider,PC.isInWalkThroughSnippet.toNegated()),menu:[{id:bp.EditorContext,group:"navigation",order:1.3},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No declaration found for '{0}'",t.word):e(0,"No declaration found")}}).id="editor.action.revealDeclaration",aZ)),Ep(class extends kZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:e(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Oo.and(PC.hasDeclarationProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:3}})}});class CZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield rZ(t.typeDefinitionProvider,i,s,n),e(0,"Type Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No type definition found for '{0}'",t.word):e(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(56).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(56).multipleTypeDefinitions}}Ep(((dZ=class t extends CZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.ID,title:{value:e(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:e(0,"Go to &&Type Definition")},precondition:Oo.and(PC.hasTypeDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:0,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.4},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",dZ)),Ep(((fZ=class t extends CZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.ID,title:{value:e(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Oo.and(PC.hasTypeDefinitionProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",fZ));class SZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield nZ(t.implementationProvider,i,s,n),e(0,"Implementations"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No implementation found for '{0}'",t.word):e(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(56).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(56).multipleImplementations}}Ep(((gZ=class t extends SZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.ID,title:{value:e(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:e(0,"Go to &&Implementations")},precondition:Oo.and(PC.hasImplementationProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:2118,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.45},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",gZ)),Ep(((pZ=class t extends SZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.ID,title:{value:e(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Oo.and(PC.hasImplementationProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:3142,weight:100},menu:{id:bp.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",pZ));class xZ extends wZ{_getNoResultFoundMessage(t){return t?e(0,"No references found for '{0}'",t.word):e(0,"No references found")}_getAlternativeCommand(t){return t.getOption(56).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(56).multipleReferences}}Ep(class extends xZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:e(0,"Go to References"),original:"Go to References",mnemonicTitle:e(0,"Go to &&References")},precondition:Oo.and(PC.hasReferenceProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:1094,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.45},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield oZ(t.referenceProvider,i,s,!0,n),e(0,"References"))}))}}),Ep(class extends xZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:e(0,"Peek References"),original:"Peek References"},precondition:Oo.and(PC.hasReferenceProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield oZ(t.referenceProvider,i,s,!1,n),e(0,"References"))}))}});class DZ extends wZ{constructor(t,i,s){super(t,{id:"editor.action.goToLocation",title:{value:e(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Oo.and(dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=s}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(this._references,e(0,"Locations"))}))}_getNoResultFoundMessage(t){return t&&e(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(56).multipleReferences}_getAlternativeCommand(){return""}}fp.registerCommand({id:"editor.action.goToLocations",description:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:os},{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:(t,i,e,s,n,r,o)=>mZ(void 0,void 0,void 0,(function*(){Mt(os.isUri(i)),Mt(vs.isIPosition(e)),Mt(Array.isArray(s)),Mt(void 0===n||"string"==typeof n),Mt(void 0===o||"boolean"==typeof o);const h=t.get(ro),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(qH(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends DZ{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(eo).invokeFunction(i.run.bind(i),c)}))}))}),fp.registerCommand({id:"editor.action.peekLocations",description:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:os},{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:(t,i,e,s,n)=>mZ(void 0,void 0,void 0,(function*(){t.get(dp).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),fp.registerCommand({id:"editor.action.findReferences",handler:(t,i,s)=>{Mt(os.isUri(i)),Mt(vs.isIPosition(s));const n=t.get(ka),r=t.get(ro);return r.openCodeEditor({resource:i},r.getFocusedCodeEditor()).then((t=>{if(!qH(t)||!t.hasModel())return;const i=KG.get(t);if(!i)return;const r=tu((i=>oZ(n.referenceProvider,t.getModel(),vs.lift(s),!1,i).then((t=>new DG(t,e(0,"References")))))),o=new ws(s.lineNumber,s.column,s.lineNumber,s.column);return Promise.resolve(i.toggleWidget(o,r,!1))}))}}),fp.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var EZ=function(t,i){return function(e,s){i(e,s,t)}},AZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let LZ=class t{constructor(t,i,e,s){this.textModelResolverService=i,this.languageService=e,this.languageFeaturesService=s,this.toUnhook=new Vi,this.toUnhookForKeyboard=new Vi,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=t,this.linkDecorations=this.editor.createDecorationsCollection();const n=new tG(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,Rt(i))}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Ei(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(i){return i.getContribution(t.ID)}startFindDefinitionFromCursor(t){return AZ(this,void 0,void 0,(function*(){yield 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())}startFindDefinition(t){var i;return AZ(this,void 0,void 0,(function*(){this.toUnhookForKeyboard.clear();const s=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!s)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===s.startColumn&&this.currentWordAtPosition.endColumn===s.endColumn&&this.currentWordAtPosition.word===s.word)return;this.currentWordAtPosition=s;const n=new zH(this.editor,15);let r;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=tu((i=>this.findDefinition(t,i)));try{r=yield this.previousPromise}catch(t){return void Ei(t)}if(!r||!r.length||!n.validate(this.editor))return void this.removeLinkDecorations();const o=r[0].originSelectionRange?ws.lift(r[0].originSelectionRange):new ws(t.lineNumber,s.startColumn,t.lineNumber,s.endColumn);if(r.length>1){let t=o;for(const{originSelectionRange:i}of r)i&&(t=ws.plusRange(t,i));this.addDecoration(t,(new MF).appendText(e(0,"Click to show {0} definitions.",r.length)))}else{const t=r[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),r=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(o,n?(new MF).appendCodeblock(r||"",n):void 0),i.dispose()}))}}))}getPreviewValue(i,e,s){let n=s.range;return n.endLineNumber-n.startLineNumber>=t.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(i,e)),this.stripIndentationFromPreviewRange(i,e,n)}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(i,e){const s=i.getLineFirstNonWhitespaceColumn(e),n=Math.min(i.getLineCount(),e+t.MAX_SOURCE_PREVIEW_LINES);let r=e+1;for(;r<n&&s!==i.getLineFirstNonWhitespaceColumn(r);r++);return new ws(e,1,r+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 eL)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?eZ(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(85)&&!this.isInPeekEditor(t);return new bZ({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Qo);return dG.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};LZ.ID="editor.contrib.gotodefinitionatposition",LZ.MAX_SOURCE_PREVIEW_LINES=8,LZ=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}([EZ(1,ep),EZ(2,hc),EZ(3,ka)],LZ),$p(LZ.ID,LZ,2);const MZ=Rg;class OZ extends Hi{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 Fy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class FZ extends Hi{static render(t,i,e){return new FZ(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Lg(t,MZ("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Lg(this.actionContainer,MZ("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Lg(this.action,MZ(`span.icon.${i.iconClass}`)),Lg(this.action,MZ("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Zf(this.actionContainer,xg.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Zf(this.actionContainer,xg.KEY_DOWN,(t=>{const e=new Pd(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 TZ{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class RZ extends Hi{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new lu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new lu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new lu((()=>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(58).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 mu(i,(t=>Qc(this,void 0,void 0,(function*(){var s,n,r;const o=i.token.onCancellationRequested((()=>{o.dispose(),i.dispose(),t.reject(new Fi)}));try{try{for(var h,c=!0,u=Yc(e);!(s=(h=yield u.next()).done);c=!0){if(c=!1,i.token.isCancellationRequested)return;t.emitOne(h.value)}}catch(t){n={error:t}}finally{try{c||s||!(r=u.return)||(yield r.call(u))}finally{if(n)throw n.error}}o.dispose(),i.dispose()}catch(e){o.dispose(),i.dispose(),t.reject(e)}}))))}((t=>this._computer.computeAsync(t))),(()=>{var t,i,e,s;t=this,i=void 0,s=function*(){var t,i,e,s;try{try{for(var n,r=!0,o=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,e=t[Symbol.asyncIterator];return e?e.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(e){i[e]=t[e]&&function(i){return new Promise((function(s,n){!function(t,i,e,s){Promise.resolve(s).then((function(i){t({value:i,done:e})}),i)}(s,n,(i=t[e](i)).done,i.value)}))}}}(this._asyncIterable);!(t=(n=yield o.next()).done);r=!0)r=!1,(s=n.value)&&(this._result.push(s),this._fireResult())}catch(t){i={error:t}}finally{try{r||t||!(e=o.return)||(yield e.call(o))}finally{if(i)throw i.error}}this._asyncIterableDone=!0,3!==this._state&&4!==this._state||this._setState(0)}catch(t){Ei(t)}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))})()):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 TZ(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 _Z{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 IZ{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 PZ=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class NZ{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=NZ._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(NZ.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(NZ.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(NZ.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(NZ.isVariableCharacter(s)||NZ.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===NZ._table[s]&&!NZ.isDigitCharacter(s)&&!NZ.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}NZ._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class BZ{constructor(){this._children=[]}appendChild(t){return t instanceof $Z&&this._children[this._children.length-1]instanceof $Z?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 qZ)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class $Z extends BZ{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new $Z(this.value)}}class jZ extends BZ{}class WZ extends jZ{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 VZ?this._children[0]:void 0}clone(){const t=new WZ(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class VZ extends BZ{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof $Z&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new VZ;return this.options.forEach(t.appendChild,t),t}}class HZ extends BZ{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 zZ&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof zZ){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new HZ;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 zZ extends BZ{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 zZ(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class UZ extends jZ{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 $Z(i)],!0)}clone(){const t=new UZ(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function KZ(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class qZ extends BZ{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof WZ&&(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 KZ([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof WZ&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof UZ&&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 qZ;return this._children=this.children.map((t=>t.clone())),t}walk(t){KZ(this.children,t)}}class GZ{constructor(){this._scanner=new NZ,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 qZ;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 WZ&&(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 WZ(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof WZ&&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 WZ(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 $Z(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 WZ(Number(i)):new UZ(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 WZ(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new $Z("${"+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 VZ;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 $Z(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 UZ(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 $Z("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new HZ;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 $Z(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 zZ(Number(s))),!0;if(this._accept(4))return t.appendChild(new zZ(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 zZ(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new zZ(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new zZ(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 zZ(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new zZ(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new $Z(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}const ZZ=e(0,"input"),JZ=e(0,"Preserve Case");class QZ extends xB{constructor(t){super({icon:Ss.preserveCase,title:JZ+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class YZ extends gy{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ee),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ee),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ee),this._onInput=this._register(new ee),this._onKeyUp=this._register(new ee),this._onPreserveCaseKeyDown=this._register(new ee),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||ZZ;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 IB(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 QZ(Object.assign({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 u=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=u.indexOf(document.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%u.length:t.equals(15)&&(e=0===i?u.length-1:i-1),t.equals(9)?(u[i].blur(),this.inputBox.focus()):e>=0&&u[e].focus(),Dg(t,!0)}}}));const l=document.createElement("div");l.className="controls",l.style.display=this._showOptionButtons?"block":"none",l.appendChild(this.preserveCase.domNode),this.domNode.appendChild(l),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 XZ=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},tJ=function(t,i){return function(e,s){i(e,s,t)}};const iJ=new Jo("suggestWidgetVisible",!1,e(0,"Whether suggestion are visible")),eJ="historyNavigationWidgetFocus",sJ="historyNavigationForwardsEnabled",nJ="historyNavigationBackwardsEnabled";let rJ;const oJ=[];function hJ(t,i){if(oJ.includes(i))throw new Error("Cannot register the same widget multiple times");oJ.push(i);const e=new Vi,s=new Jo(eJ,!1).bindTo(t),n=new Jo(sJ,!0).bindTo(t),r=new Jo(nJ,!0).bindTo(t),o=()=>{s.set(!0),rJ=i},h=()=>{s.set(!1),rJ===i&&(rJ=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{oJ.splice(oJ.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let cJ=class extends NB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(hJ(n,this.inputBox))}};cJ=XZ([tJ(3,Qo)],cJ);let uJ=class extends YZ{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(hJ(r,this.inputBox))}};uJ=XZ([tJ(3,Qo)],uJ),pp.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Oo.and(Oo.has(eJ),Oo.equals(nJ,!0),iJ.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==rJ||rJ.showPreviousValue()}}),pp.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Oo.and(Oo.has(eJ),Oo.equals(sJ,!0),iJ.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==rJ||rJ.showNextValue()}});var lJ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const aJ={Visible:iJ,HasFocusedSuggestion:new Jo("suggestWidgetHasFocusedSuggestion",!1,e(0,"Whether any suggestion is focused")),DetailsVisible:new Jo("suggestWidgetDetailsVisible",!1,e(0,"Whether suggestion details are visible")),MultipleSuggestions:new Jo("suggestWidgetMultipleSuggestions",!1,e(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Jo("suggestionMakesTextEdit",!0,e(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Jo("acceptSuggestionOnEnter",!0,e(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Jo("suggestionHasInsertAndReplaceRange",!1,e(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Jo("suggestionInsertMode",void 0,{type:"string",description:e(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Jo("suggestionCanResolve",!1,e(0,"Whether the current suggestion supports to resolve further details"))},dJ=new bp("suggestWidgetStatusBar");class fJ{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=pF.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,ws.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||ws.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||ws.spansMultipleLines(i.range.insert)||ws.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._isResolved=!0)}get isResolved(){return!!this._isResolved}resolve(t){return lJ(this,void 0,void 0,(function*(){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._isResolved=!1}));this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._isResolved=!0,i.dispose()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._isResolved=!1)}))}return this._resolveCache}))}}class gJ{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}}gJ.default=new gJ;class pJ{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function mJ(t,i,e,s=gJ.default,n={triggerKind:0},r=fe.None){return lJ(this,void 0,void 0,(function*(){const o=new Ji(!0);e=e.clone();const h=i.getWordAtPosition(e),c=h?new ws(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):ws.fromPositions(e),u={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},l=[],a=new Vi,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=u),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=GZ.guessNeedsClipboard(n.insertText)),l.push(new fJ(e,n,i,t)),c=!0}return Bi(i)&&a.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=(()=>lJ(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>lJ(this,void 0,void 0,(function*(){if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>l.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Ji(!0),h=yield o.provideCompletionItems(i,e,n,r);t=g(o,h,s)||t}catch(t){Ai(t)}}))))),t||r.isCancellationRequested)break}return yield p,r.isCancellationRequested?(a.dispose(),Promise.reject(new Fi)):new pJ(l.sort(wJ.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function vJ(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 wJ=new Map;wJ.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 vJ(t,i)})),wJ.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 vJ(t,i)})),wJ.set(1,vJ),fp.registerCommand("_executeCompletionItemProvider",((t,...i)=>lJ(void 0,void 0,void 0,(function*(){const[e,s,n,r]=i;Mt(os.isUri(e)),Mt(vs.isIPosition(s)),Mt("string"==typeof n||!n),Mt("number"==typeof r||!r);const{completionProvider:o}=t.get(ka),h=yield t.get(ep).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield mJ(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 yield Promise.all(i),t}finally{setTimeout((()=>c.disposable.dispose()),100)}}finally{h.dispose()}}))));class bJ{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}}}var yJ=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},kJ=function(t,i){return function(e,s){i(e,s,t)}};const CJ=Rg;let SJ=class t extends Hi{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._widget=this._register(this._instantiationService.createInstance(AJ,this._editor)),this._currentResult=null,this._participants=[];for(const t of PZ.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new MJ(this._editor,this._participants),this._hoverOperation=this._register(new RZ(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 xJ(this._computer.anchor,i,t.isComplete))}))),this._register(Qf(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register($s.onDidChange((()=>{this._widget.position&&this._currentResult&&(this._widget.clear(),this._setCurrentResult(this._currentResult))})))}maybeShowAt(t){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 _Z(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(48).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new _Z(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 _Z(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(58).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)}isColorPickerVisible(){return this._widget.isColorPickerVisible}isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}isVisible(){return this._widget.isVisible}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(i,e){const{showAtPosition:s,showAtSecondaryPosition:n,highlightRange:r}=t.computeHoverRanges(this._editor,i.range,e),o=new Vi,h=o.add(new LJ(this._keybindingService)),c=document.createDocumentFragment();let u=null;const l={fragment:c,statusBar:h,setColorPicker:t=>u=t,onContentsChanged:()=>this._widget.onContentsChanged(),hide:()=>this.hide()};for(const t of this._participants){const i=e.filter((i=>i.owner===t));i.length>0&&o.add(t.renderHoverParts(l,i))}const a=e.some((t=>t.isBeforeContent));if(h.hasContent&&c.appendChild(h.hoverElement),c.hasChildNodes()){if(r){const i=this._editor.createDecorationsCollection();i.set([{range:r,options:t._DECORATION_OPTIONS}]),o.add(Wi((()=>{i.clear()})))}this._widget.showAt(c,new EJ(u,s,n,this._editor.getOption(58).above,this._computer.shouldFocus,this._computer.source,a,i.initialMousePosX,i.initialMousePosY,o))}else o.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=ws.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()}escape(){this._widget.escape()}};SJ._DECORATION_OPTIONS=sL.register({description:"content-hover-highlight",className:"hoverHighlight"}),SJ=yJ([kJ(1,eo),kJ(2,eP)],SJ);class xJ{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 DJ(this,this.anchor,i,this.isComplete)}}class DJ extends xJ{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class EJ{constructor(t,i,e,s,n,r,o,h,c,u){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=u,this.closestMouseDistance=void 0}}let AJ=class t extends Hi{get position(){var t,i;return null!==(i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition)&&void 0!==i?i:null}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}constructor(t,i){super(),this._editor=t,this._contextKeyService=i,this.allowEditorOverflow=!0,this._hoverVisibleKey=PC.hoverVisible.bindTo(this._contextKeyService),this._hoverFocusedKey=PC.hoverFocused.bindTo(this._contextKeyService),this._hover=this._register(new OZ),this._focusTracker=this._register(Ag(this.getDomNode())),this._horizontalScrollingBy=30,this._visibleData=null,this._register(this._editor.onDidLayoutChange((()=>this._layout()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&this._updateFont()}))),this._setVisibleData(null),this._layout(),this._editor.addContentWidget(this),this._register(this._focusTracker.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(this._focusTracker.onDidBlur((()=>{this._hoverFocusedKey.set(!1)})))}dispose(){this._editor.removeContentWidget(this),this._visibleData&&this._visibleData.disposables.dispose(),super.dispose()}getId(){return t.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){if(!this._visibleData)return null;let t=this._visibleData.preferAbove;return!t&&this._contextKeyService.getContextKeyValue(aJ.Visible.key)&&(t=!0),{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,preference:t?[1,2]:[2,1],positionAffinity:this._visibleData.isBeforeContent?3:void 0}}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=og(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=OJ(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=OJ(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))}_setVisibleData(t){this._visibleData&&this._visibleData.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!this._visibleData),this._hover.containerDomNode.classList.toggle("hidden",!this._visibleData)}_layout(){const t=Math.max(this._editor.getLayoutInfo().height/4,250),{fontSize:i,lineHeight:e}=this._editor.getOption(48);this._hover.contentsDomNode.style.fontSize=`${i}px`,this._hover.contentsDomNode.style.lineHeight=""+e/i,this._hover.contentsDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.style.maxWidth=`${Math.max(.66*this._editor.getLayoutInfo().width,500)}px`}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}showAt(t,i){var e;this._setVisibleData(i),this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._hover.contentsDomNode.style.paddingBottom="",this._updateFont(),this.onContentsChanged(),this._editor.render(),this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(e=i.colorPicker)||void 0===e||e.layout()}hide(){if(this._visibleData){const t=this._visibleData.stoleFocus;this._setVisibleData(null),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}}onContentsChanged(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged();const t=this._hover.scrollbar.getScrollDimensions();if(t.scrollWidth>t.width){const t=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingBottom!==t&&(this._hover.contentsDomNode.style.paddingBottom=t,this._editor.layoutContentWidget(this),this._hover.onContentsChanged())}}clear(){this._hover.contentsDomNode.textContent=""}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(48);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(48);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-this._horizontalScrollingBy})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+this._horizontalScrollingBy})}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})}escape(){this._editor.focus()}};AJ.ID="editor.contrib.contentHoverWidget",AJ=yJ([kJ(1,Qo)],AJ);let LJ=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=CJ("div.hover-row.status-bar"),this.actionsElement=Lg(this.hoverElement,CJ("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(FZ.render(this.actionsElement,t,e))}append(t){const i=Lg(this.actionsElement,t);return this._hasContent=!0,i}};LJ=yJ([kJ(0,eP)],LJ);class MJ{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 pu.EMPTY;const e=MJ._getLineDecorations(this._editor,i);return pu.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):pu.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=MJ._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return X(i)}}function OJ(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)}var FJ=function(t,i){return function(e,s){i(e,s,t)}},TJ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let RJ=class t{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ee,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(t,i,e){if(!t)return{element:document.createElement("span"),dispose:()=>{}};const s=new Vi,n=s.add(iT(t,Object.assign(Object.assign({},this._getRenderOptions(t,s)),i),e));return n.element.classList.add("rendered-markdown"),{element:n.element,dispose:()=>s.dispose()}}_getRenderOptions(i,e){return{codeBlockRenderer:(i,e)=>TJ(this,void 0,void 0,(function*(){var s,n,r;let o;i?o=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(o=null===(s=this._options.editor.getModel())||void 0===s?void 0:s.getLanguageId()),o||(o=Ec);const h=yield function(t,i,e){return s=this,n=void 0,o=function*(){if(!e)return tM(i,t.languageIdCodec,YL);const s=yield $s.getOrCreate(e);return tM(i,t.languageIdCodec,s||YL)},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o}(this._languageService,e,o),c=document.createElement("span");return c.innerHTML=null!==(r=null===(n=t._ttpTokenizer)||void 0===n?void 0:n.createHTML(h))&&void 0!==r?r:h,this._options.editor?Kr(c,this._options.editor.getOption(48)):this._options.codeBlockFontFamily&&(c.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(c.style.fontSize=this._options.codeBlockFontSize),c})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:t=>function(t,i,e){return TJ(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:_J(e)})}catch(t){return Ei(t),!1}}))}(this._openerService,t,i.isTrusted),disposables:e}}}};function _J(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}RJ._ttpTokenizer=Lu("tokenizeToString",{createHTML:t=>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}([FJ(1,hc),FJ(2,W_)],RJ);const IJ=Rg;class PJ extends Hi{constructor(t,i,e){super(),this._renderDisposeables=this._register(new Vi),this._editor=t,this._isVisible=!1,this._messages=[],this._hover=this._register(new OZ),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new RJ({editor:this._editor},i,e)),this._computer=new NJ(this._editor),this._hoverOperation=this._register(new RZ(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(48)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return PJ.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=IJ("div.hover-row.markdown-hover"),s=Lg(i,IJ("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(64),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`}}PJ.ID="editor.contrib.modesGlyphHoverWidget";class NJ{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&&!OF(i)&&e.push(...at(i).map(t))}return e}}class BJ{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function $J(t,i,e,s){const n=t.ordered(i).map(((t,n)=>function(t,i,e,s,n){return r=this,o=void 0,c=function*(){try{const r=yield 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 BJ(t,r,i)}catch(t){Ai(t)}},new((h=void 0)||(h=Promise))((function(t,i){function e(t){try{n(c.next(t))}catch(t){i(t)}}function s(t){try{n(c.throw(t))}catch(t){i(t)}}function n(i){var n;i.done?t(i.value):(n=i.value,n instanceof h?n:new h((function(t){t(n)}))).then(e,s)}n((c=c.apply(r,o||[])).next())}));var r,o,h,c}(t,n,i,e,s)));return pu.fromPromises(n).coalesce()}Ip("_executeHoverProvider",((t,i,e)=>function(t,i,e){return $J(t,i,e,fe.None).map((t=>t.hover)).toPromise()}(t.get(ka).hoverProvider,i,e)));var jJ=function(t,i){return function(e,s){i(e,s,t)}};const WJ=Rg;class VJ{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 HJ=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 VJ(this,t.range,[(new MF).appendText(e(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const s=this._editor.getModel(),n=t.range.startLineNumber,r=s.getLineMaxColumn(n),o=[];let h=1e3;const c=s.getLineLength(n),u=s.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(113),a=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:u});let d=!1;l>=0&&c>l&&t.range.startColumn>=l&&(d=!0,o.push(new VJ(this,t.range,[{value:e(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,h++))),!d&&"number"==typeof a&&c>=a&&o.push(new VJ(this,t.range,[{value:e(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,h++));let f=!1;for(const e of i){const i=e.range.startLineNumber===n?e.range.startColumn:1,s=e.range.endLineNumber===n?e.range.endColumn:r,c=e.options.hoverMessage;if(!c||OF(c))continue;e.options.beforeContentClassName&&(f=!0);const u=new ws(t.range.startLineNumber,i,t.range.startLineNumber,s);o.push(new VJ(this,u,at(c),f,h++))}return o}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return pu.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return pu.EMPTY;const n=new vs(t.range.startLineNumber,t.range.startColumn);return $J(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!OF(t.hover.contents))).map((i=>{const e=i.hover.range?ws.lift(i.hover.range):t.range;return new VJ(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return zJ(t,i,this._editor,this._languageService,this._openerService)}};function zJ(t,i,e,s,n){i.sort(((t,i)=>t.ordinal-i.ordinal));const r=new Vi;for(const o of i)for(const i of o.contents){if(OF(i))continue;const o=WJ("div.hover-row.markdown-hover"),h=Lg(o,WJ("div.hover-contents")),c=r.add(new RJ({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const u=r.add(c.render(i));h.appendChild(u.element),t.fragment.appendChild(o)}return r}HJ=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}([jJ(1,hc),jJ(2,W_),jJ(3,ic),jJ(4,ka)],HJ);var UJ=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},KJ=function(t,i){return function(e,s){i(e,s,t)}};class qJ{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let GJ=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._dispoables=new Vi,this._markers=[],this._nextIdx=-1,os.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=Un(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?ws.compareRangesUsingStarts(t,i)||YN.compare(t.severity,i.severity):YN.compare(t.severity,i.severity)||ws.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:os.isUri(t)?t:void 0,severities:YN.Error|YN.Warning|YN.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 qJ(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let s=!1,n=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));n<0&&(n=Z(this._markers,{resource:t.uri},((t,i)=>Un(t.resource.toString(),i.resource.toString()))),n<0&&(n=~n));for(let e=n;e<this._markers.length;e++){let n=ws.lift(this._markers[e]);if(n.isEmpty()){const i=t.getWordAtPosition(n.getStartPosition());i&&(n=new ws(n.startLineNumber,i.startColumn,n.startLineNumber,i.endColumn))}if(i&&(n.containsPosition(i)||i.isBeforeOrEqual(n.getStartPosition()))){this._nextIdx=e,s=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}s||(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(ws.containsPosition(this._markers[e],i))return new qJ(this._markers[e],e+1,this._markers.length)}};GJ=UJ([KJ(1,tB),KJ(2,ic)],GJ);const ZJ=no("IMarkerNavigationService");let JJ=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new j}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new GJ(t,this._markerService,this._configService)}};var QJ;JJ=UJ([KJ(0,tB),KJ(1,ic)],JJ),lc(ZJ,JJ,1),function(t){t.className=function(t){switch(t){case RM.Ignore:return"severity-ignore "+np.asClassName(Ss.info);case RM.Info:return np.asClassName(Ss.info);case RM.Warning:return np.asClassName(Ss.warning);case RM.Error:return np.asClassName(Ss.error);default:return""}}}(QJ||(QJ={}));var YJ=function(t,i){return function(e,s){i(e,s,t)}};class XJ{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 Vi,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(Qf(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new My(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(){$i(this._disposables)}update(t){const{source:i,message:e,relatedInformation:s,code:n}=t;let r=((null==i?void 0:i.length)||0)+"()".length;n&&(r+="string"==typeof n?n.length:n.value.length);const o=Wn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Kf(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=Rg("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()},Lg(this._codeLink,Rg("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Kf(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),et(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(64))}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(48),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:u,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 YN.Error:i=e(0,"Error");break;case YN.Warning:i=e(0,"Warning");break;case YN.Info:i=e(0,"Info");break;case YN.Hint:i=e(0,"Hint")}let s=e(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const n=this._editor.getModel();return n&&t.startLineNumber<=n.getLineCount()&&t.startLineNumber>=1&&(s=`${n.getLineContent(t.startLineNumber)}, ${s}`),s}}let tQ=class t extends pG{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 Vi,this._onDidSelectRelatedInformation=new ee,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=YN.Warning,this._backgroundColor=ea.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(lQ);let i=nQ,e=rQ;this._severity===YN.Warning?(i=oQ,e=hQ):this._severity===YN.Info&&(i=cQ,e=uQ);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(vG),secondaryHeadingColor:t.getColor(wG)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(i){super._fillHead(i),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const e=[],s=this._menuService.createMenu(t.TitleMenu,this._contextKeyService);EN(s,void 0,e),this._actionbarWidget.push(e,{label:!1,icon:!0,index:0}),s.dispose()}_fillTitleIcon(t){this._icon=Lg(t,Rg(""))}_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 XJ(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,s){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const n=ws.lift(t),r=this.editor.getPosition(),o=r&&n.containsPosition(r)?r:n.getStartPosition();super.show(o,this.computeRequiredHeight());const h=this.editor.getModel();if(h){const t=e(0,s>1?"{0} of {1} problems":"{0} of {1} problem",i,s);this.setTitle(JD(h.uri),t)}this._icon.className=`codicon ${QJ.className(YN.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(o,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()}};tQ.TitleMenu=new bp("gotoErrorTitleMenu"),tQ=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}([YJ(1,Yy),YJ(2,W_),YJ(3,yp),YJ(4,eo),YJ(5,Qo),YJ(6,fP)],tQ);const iQ=db(sv,nv),eQ=db(rv,ov),sQ=db(hv,cv),nQ=fm("editorMarkerNavigationError.background",{dark:iQ,light:iQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget error color.")),rQ=fm("editorMarkerNavigationError.headerBackground",{dark:ab(nQ,.1),light:ab(nQ,.1),hcDark:null,hcLight:null},e(0,"Editor marker navigation widget error heading background.")),oQ=fm("editorMarkerNavigationWarning.background",{dark:eQ,light:eQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget warning color.")),hQ=fm("editorMarkerNavigationWarning.headerBackground",{dark:ab(oQ,.1),light:ab(oQ,.1),hcDark:"#0C141F",hcLight:ab(oQ,.2)},e(0,"Editor marker navigation widget warning heading background.")),cQ=fm("editorMarkerNavigationInfo.background",{dark:sQ,light:sQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget info color.")),uQ=fm("editorMarkerNavigationInfo.headerBackground",{dark:ab(cQ,.1),light:ab(cQ,.1),hcDark:null,hcLight:null},e(0,"Editor marker navigation widget info heading background.")),lQ=fm("editorMarkerNavigation.background",{dark:lv,light:lv,hcDark:lv,hcLight:lv},e(0,"Editor marker navigation widget background."));var aQ=function(t,i){return function(e,s){i(e,s,t)}},dQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let fQ=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){this._markerNavigationService=i,this._contextKeyService=e,this._editorService=s,this._instantiationService=n,this._sessionDispoables=new Vi,this._editor=t,this._widgetVisible=vQ.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(tQ,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)&&ws.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:ws.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)}}nagivate(i,e){var s,n;return dQ(this,void 0,void 0,(function*(){if(this._editor.hasModel()){const r=this._getOrCreateModel(e?void 0:this._editor.getModel().uri);if(r.move(i,this._editor.getModel(),this._editor.getPosition()),!r.selected)return;if(r.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const o=yield this._editorService.openCodeEditor({resource:r.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:r.selected.marker}},this._editor);o&&(null===(s=t.get(o))||void 0===s||s.close(),null===(n=t.get(o))||void 0===n||n.nagivate(i,e))}else this._widget.showAtMarker(r.selected.marker,r.selected.index,r.selected.total)}}))}};fQ.ID="editor.contrib.markerController",fQ=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}([aQ(1,ZJ),aQ(2,Qo),aQ(3,ro),aQ(4,eo)],fQ);class gQ extends Tp{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return dQ(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=fQ.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class pQ extends gQ{constructor(){super(!0,!1,{id:pQ.ID,label:pQ.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:578,weight:100},menuOpts:{menuId:tQ.TitleMenu,title:pQ.LABEL,icon:SR("marker-navigation-next",Ss.arrowDown,e(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}pQ.ID="editor.action.marker.next",pQ.LABEL=e(0,"Go to Next Problem (Error, Warning, Info)");class mQ extends gQ{constructor(){super(!1,!1,{id:mQ.ID,label:mQ.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:1602,weight:100},menuOpts:{menuId:tQ.TitleMenu,title:mQ.LABEL,icon:SR("marker-navigation-previous",Ss.arrowUp,e(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}mQ.ID="editor.action.marker.prev",mQ.LABEL=e(0,"Go to Previous Problem (Error, Warning, Info)"),$p(fQ.ID,fQ,4),Np(pQ),Np(mQ),Np(class extends gQ{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:e(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:PC.focus,primary:66,weight:100},menuOpts:{menuId:bp.MenubarGoMenu,title:e(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),Np(class extends gQ{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:e(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:PC.focus,primary:1090,weight:100},menuOpts:{menuId:bp.MenubarGoMenu,title:e(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const vQ=new Jo("markersNavigationVisible",!1);Pp(new(Fp.bindToContribution(fQ.get))({id:"closeMarkersNavigation",precondition:vQ,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:PC.focus,primary:9,secondary:[1033]}}));var wQ=function(t,i){return function(e,s){i(e,s,t)}};const bQ=Rg;class yQ{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 kQ={type:1,filter:{include:YU.QuickFix},triggerAction:QU.QuickFixHover};let CQ,SQ=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 u=new ws(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new yQ(this,u,c))}return r}renderHoverParts(t,i){if(!i.length)return Hi.None;const e=new Vi;i.forEach((i=>t.fragment.appendChild(this.renderMarkerHover(i,e))));const s=1===i.length?i[0]:i.sort(((t,i)=>YN.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=bQ("div.hover-row"),s=Lg(e,bQ("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Lg(s,bQ("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=bQ("span");n&&(Lg(t,bQ("span")).innerText=n);const e=Lg(t,bQ("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Zf(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Lg(e,bQ("span")).innerText=o.value;const r=Lg(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Lg(s,bQ("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(et(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=Lg(s,bQ("div"));o.style.marginTop="8px";const h=Lg(o,bQ("a"));h.innerText=`${JD(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Zf(h,"click",(t=>{t.stopPropagation(),t.preventDefault(),this._openerService&&this._openerService.open(e,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:n,startColumn:r}}}).catch(Ei)})));const c=Lg(o,bQ("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,s){if(i.marker.severity!==YN.Error&&i.marker.severity!==YN.Warning&&i.marker.severity!==YN.Info||t.statusBar.addAction({label:e(0,"View Problem"),commandId:pQ.ID,run:()=>{var e;t.hide(),null===(e=fQ.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(88)){const n=t.statusBar.append(bQ("div"));this.recentMarkerCodeActionsInfo&&(XN.makeKey(this.recentMarkerCodeActionsInfo.marker)===XN.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=e(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const r=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Hi.None:s.add(ou((()=>n.textContent=e(0,"Checking for quick fixes...")),200));n.textContent||(n.textContent=String.fromCharCode(160));const o=this.getCodeActions(i.marker);s.add(Wi((()=>o.cancel()))),o.then((o=>{if(r.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:o.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return o.dispose(),void(n.textContent=e(0,"No quick fixes available"));n.style.display="none";let h=!1;s.add(Wi((()=>{h||o.dispose()}))),t.statusBar.addAction({label:e(0,"Quick Fix..."),commandId:nK,run:i=>{h=!0;const e=GK.get(this._editor),s=og(i);t.hide(),null==e||e.showCodeActions(kQ,o,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return tu((i=>dK(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ws(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),kQ,KR.None,i)))}};SQ=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}([wQ(1,ip),wQ(2,W_),wQ(3,ka)],SQ);class xQ{get TChange(){return null}reportChanges(){this.get()}read(t){return t?t.readObservable(this):this.get()}map(t){return CQ((()=>{const i=MQ(t);return void 0!==i?i:`${this.debugName} (mapped)`}),(i=>t(this.read(i),i)))}}class DQ extends xQ{constructor(){super(...arguments),this.observers=new Set}addObserver(t){const i=this.observers.size;this.observers.add(t),0===i&&this.onFirstObserverAdded()}removeObserver(t){this.observers.delete(t)&&0===this.observers.size&&this.onLastObserverRemoved()}onFirstObserverAdded(){}onLastObserverRemoved(){}}function EQ(t,i){const e=new LQ(t,i);try{void 0,t(e)}finally{e.finish(),void 0}}function AQ(t,i,e){t?i(t):EQ(i,e)}class LQ{constructor(t,i){this.fn=t,this._getDebugName=i,this.updatingObservers=[]}getDebugName(){return this._getDebugName?this._getDebugName():MQ(this.fn)}updateObserver(t,i){this.updatingObservers.push({observer:t,observable:i}),t.beginUpdate(i)}finish(){const t=this.updatingObservers;this.updatingObservers=null;for(const{observer:i,observable:e}of t)i.endUpdate(e)}}function MQ(t){const i=t.toString(),e=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i),s=e?e[1]:void 0;return null==s?void 0:s.trim()}function OQ(t,i){return new FQ(t,i)}class FQ extends DQ{constructor(t,i){super(),this.debugName=t,this._value=i}get(){return this._value}set(t,i,e){if(this._value===t)return;let s;i||(i=s=new LQ((()=>{}),(()=>`Setting ${this.debugName}`)));try{this._setValue(t),void 0;for(const t of this.observers)i.updateObserver(t,this),t.handleChange(this,e)}finally{s&&s.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(t){this._value=t}}function TQ(t,i){return new RQ(t,i)}class RQ extends FQ{_setValue(t){this._value!==t&&(this._value&&this._value.dispose(),this._value=t)}dispose(){var t;null===(t=this._value)||void 0===t||t.dispose()}}function _Q(t,i){return new IQ(t,i,void 0,void 0)}!function(t){CQ=t}(_Q);class IQ extends DQ{get debugName(){return"function"==typeof this._debugName?this._debugName():this._debugName}constructor(t,i,e,s){var n;super(),this._debugName=t,this.computeFn=i,this.createChangeSummary=e,this._handleChange=s,this.state=0,this.value=void 0,this.updateCount=0,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=void 0,this.changeSummary=null===(n=this.createChangeSummary)||void 0===n?void 0:n.call(this)}onLastObserverRemoved(){this.state=0,this.value=void 0;for(const t of this.dependencies)t.removeObserver(this);this.dependencies.clear()}get(){var t;if(0===this.observers.size){const i=this.computeFn(this,null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this));return this.onLastObserverRemoved(),i}do{if(1===this.state){this.state=3;for(const t of this.dependencies)if(t.reportChanges(),2===this.state)break}this._recomputeIfNeeded()}while(3!==this.state);return this.value}_recomputeIfNeeded(){var t;if(3===this.state)return;const i=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=i;const e=0!==this.state,s=this.value;this.state=3;const n=this.changeSummary;this.changeSummary=null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this);try{this.value=this.computeFn(this,n)}finally{for(const t of this.dependenciesToBeRemoved)t.removeObserver(this);this.dependenciesToBeRemoved.clear()}const r=e&&s!==this.value;if(void 0,r)for(const t of this.observers)t.handleChange(this,void 0)}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(t){this.updateCount++;const i=1===this.updateCount;if(3===this.state&&(this.state=1,!i))for(const t of this.observers)t.handlePossibleChange(this);if(i)for(const t of this.observers)t.beginUpdate(this)}endUpdate(t){if(this.updateCount--,0===this.updateCount){const t=[...this.observers];for(const i of t)i.endUpdate(this)}if(this.updateCount<0)throw new Pi}handlePossibleChange(t){if(3===this.state&&this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)){this.state=1;for(const t of this.observers)t.handlePossibleChange(this)}}handleChange(t,i){if(this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)){const e=!this._handleChange||this._handleChange({changedObservable:t,change:i,didChange:i=>i===t},this.changeSummary),s=3===this.state;if(e&&(1===this.state||s)&&(this.state=2,s))for(const t of this.observers)t.handlePossibleChange(this)}}readObservable(t){t.addObserver(this);const i=t.get();return this.dependencies.add(t),this.dependenciesToBeRemoved.delete(t),i}addObserver(t){const i=!this.observers.has(t)&&this.updateCount>0;super.addObserver(t),i&&t.beginUpdate(this)}removeObserver(t){const i=this.observers.has(t)&&this.updateCount>0;super.removeObserver(t),i&&t.endUpdate(this)}}function PQ(t,i){return new NQ(t,i,void 0,void 0)}class NQ{constructor(t,i,e,s){var n;this.debugName=t,this.runFn=i,this.createChangeSummary=e,this._handleChange=s,this.state=2,this.updateCount=0,this.disposed=!1,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=null===(n=this.createChangeSummary)||void 0===n?void 0:n.call(this),this._runIfNeeded()}dispose(){this.disposed=!0;for(const t of this.dependencies)t.removeObserver(this);this.dependencies.clear()}_runIfNeeded(){var t;if(3===this.state)return;const i=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=i,this.state=3;try{const i=this.changeSummary;this.changeSummary=null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this),this.runFn(this,i)}finally{for(const t of this.dependenciesToBeRemoved)t.removeObserver(this);this.dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(){3===this.state&&(this.state=1),this.updateCount++}endUpdate(){if(1===this.updateCount)do{if(1===this.state){this.state=3;for(const t of this.dependencies)if(t.reportChanges(),2===this.state)break}this._runIfNeeded()}while(3!==this.state);this.updateCount--,co((()=>this.updateCount>=0))}handlePossibleChange(t){3===this.state&&this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)&&(this.state=1)}handleChange(t,i){this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)&&(!this._handleChange||this._handleChange({changedObservable:t,change:i,didChange:i=>i===t},this.changeSummary))&&(this.state=2)}readObservable(t){if(this.disposed)return t.get();t.addObserver(this);const i=t.get();return this.dependencies.add(t),this.dependenciesToBeRemoved.delete(t),i}}function BQ(t){return new $Q(t)}!function(t){t.Observer=NQ}(PQ||(PQ={}));class $Q extends xQ{constructor(t){super(),this.value=t}get debugName(){return this.toString()}get(){return this.value}addObserver(t){}removeObserver(t){}toString(){return`Const: ${this.value}`}}function jQ(t,i){return new WQ(t,i)}class WQ extends DQ{constructor(t,i){super(),this.event=t,this.getValue=i,this.hasValue=!1,this.handleEvent=t=>{const i=this.getValue(t),e=!this.hasValue||this.value!==i;e&&(this.value=i,this.hasValue&&EQ((t=>{for(const i of this.observers)t.updateObserver(i,this),i.handleChange(this,void 0)}),(()=>{const t=this.getDebugName();return"Event fired"+(t?`: ${t}`:"")})),this.hasValue=!0)}}getDebugName(){return MQ(this.getValue)}get debugName(){const t=this.getDebugName();return"From Event"+(t?`: ${t}`:"")}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0,this.hasValue=!1,this.value=void 0}get(){return this.subscription?(this.hasValue||this.handleEvent(void 0),this.value):this.getValue(void 0)}}!function(t){t.Observer=WQ}(jQ||(jQ={}));class VQ extends DQ{constructor(t,i){super(),this.debugName=t,this.event=i,this.handleEvent=()=>{EQ((t=>{for(const i of this.observers)t.updateObserver(i,this),i.handleChange(this,void 0)}),(()=>this.debugName))}}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}class HQ extends DQ{constructor(t){super(),this.debugName=t}trigger(t,i){if(t)for(const e of this.observers)t.updateObserver(e,this),e.handleChange(this,i);else EQ((t=>{this.trigger(t,i)}),(()=>`Trigger signal ${this.debugName}`))}get(){}}class zQ{constructor(t){this.forceRecompute=t,this.counter=0}beginUpdate(t){this.counter++}endUpdate(t){this.counter--,0===this.counter&&this.forceRecompute&&t.reportChanges()}handlePossibleChange(t){}handleChange(t,i){}}const UQ="editor.action.inlineSuggest.commit",KQ="editor.action.inlineSuggest.showPrevious",qQ="editor.action.inlineSuggest.showNext";class GQ extends Hi{constructor(t,i,e={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new ue),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=new Vi,this.options=e,this.lookupKeybindings="function"==typeof this.options.getKeyBinding,this.toggleMenuAction=this._register(new ZQ((()=>{var t;return null===(t=this.toggleMenuActionViewItem)||void 0===t?void 0:t.show()}),e.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",t.appendChild(this.element),this.actionBar=this._register(new kR(this.element,{orientation:e.orientation,ariaLabel:e.ariaLabel,actionRunner:e.actionRunner,allowContextMenu:e.allowContextMenu,actionViewItemProvider:(t,s)=>{var n;if(t.id===ZQ.ID)return this.toggleMenuActionViewItem=new tN(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:np.asClassNameArray(null!==(n=e.moreIcon)&&void 0!==n?n:Ss.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(e.actionViewItemProvider){const i=e.actionViewItemProvider(t,s);if(i)return i}if(t instanceof up){const e=new tN(t,t.actions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:t.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement});return e.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(e),this.disposables.add(this._onDidChangeDropdownVisibility.add(e.onDidChangeVisibility)),e}}}))}set actionRunner(t){this.actionBar.actionRunner=t}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(t){return this.actionBar.getAction(t)}setActions(t,i){this.clear();const e=t?t.slice(0):[];this.hasSecondaryActions=!!(i&&i.length>0),this.hasSecondaryActions&&i&&(this.toggleMenuAction.menuActions=i.slice(0),e.push(this.toggleMenuAction)),e.forEach((t=>{this.actionBar.push(t,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(t)})}))}getKeybindingLabel(t){var i,e;const s=this.lookupKeybindings?null===(e=(i=this.options).getKeyBinding)||void 0===e?void 0:e.call(i,t):void 0;return Rt(null==s?void 0:s.getLabel())}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),super.dispose()}}class ZQ extends op{constructor(t,i){i=i||e(0,"More Actions..."),super(ZQ.ID,i,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=t}run(){return t=this,i=void 0,s=function*(){this.toggleDropdownMenu()},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}get menuActions(){return this._menuActions}set menuActions(t){this._menuActions=t}}ZQ.ID="toolbar.toggle.more";var JQ=function(t,i){return function(e,s){i(e,s,t)}};let QQ=class extends GQ{constructor(t,i,e,s,n,r,o){super(t,n,Object.assign(Object.assign({getKeyBinding:t=>{var i;return null!==(i=r.lookupKeybinding(t.id))&&void 0!==i?i:void 0}},i),{allowContextMenu:!0})),this._options=i,this._menuService=e,this._contextKeyService=s,this._contextMenuService=n,this._sessionDisposables=this._store.add(new Vi),(null==i?void 0:i.telemetrySource)&&this._store.add(this.actionBar.onDidRun((t=>o.publicLog2("workbenchActionExecuted",{id:t.action.id,from:i.telemetrySource}))))}setActions(t,i=[],s){var n,r,o;this._sessionDisposables.clear();const h=t.slice(),c=i.slice(),u=[];let l=0;const a=[];let d=!1;if(-1!==(null===(n=this._options)||void 0===n?void 0:n.hiddenItemStrategy))for(let t=0;t<h.length;t++){const i=h[t];(i instanceof xp||i instanceof Sp)&&i.hideActions&&(u.push(i.hideActions.toggle),i.hideActions.toggle.checked&&l++,i.hideActions.isHidden&&(d=!0,h[t]=void 0,0!==(null===(r=this._options)||void 0===r?void 0:r.hiddenItemStrategy)&&(a[t]=i)))}if(void 0!==(null===(o=this._options)||void 0===o?void 0:o.maxNumberOfItems)){let t=0;for(let i=0;i<h.length;i++){const e=h[i];e&&++t>=this._options.maxNumberOfItems&&(h[i]=void 0,a[i]=e)}}tt(h),tt(a),super.setActions(h,cp.join(a,c)),u.length>0&&this._sessionDisposables.add(Zf(this.getElement(),"contextmenu",(t=>{var i,n,r,o;const h=this.getItemAction(t.target);if(!h)return;t.preventDefault(),t.stopPropagation();let c,a=!1;if(1===l&&0===(null===(i=this._options)||void 0===i?void 0:i.hiddenItemStrategy)){a=!0;for(let t=0;t<u.length;t++)if(u[t].checked){u[t]=ap({id:h.id,label:h.label,checked:!0,enabled:!1,run(){}});break}}if(!a&&(h instanceof xp||h instanceof Sp)){if(!h.hideActions)return;c=h.hideActions.hide}else c=ap({id:"label",label:e(0,"Hide"),enabled:!1,run(){}});const f=cp.join([c],u);(null===(n=this._options)||void 0===n?void 0:n.resetMenu)&&!s&&(s=[this._options.resetMenu]),d&&s&&(f.push(new cp),f.push(ap({id:"resetThisMenu",label:e(0,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(s)}))),this._contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>f,menuId:null===(r=this._options)||void 0===r?void 0:r.contextMenu,menuActionOptions:Object.assign({renderShortTitle:!0},null===(o=this._options)||void 0===o?void 0:o.menuOptions),contextKeyService:this._contextKeyService})})))}};QQ=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}([JQ(2,yp),JQ(3,Qo),JQ(4,zR),JQ(5,eP),JQ(6,Ap)],QQ);var YQ=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},XQ=function(t,i){return function(e,s){i(e,s,t)}};let tY=class extends Hi{constructor(t,i,e){var s;super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=jQ(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(60).showToolbar)),this.sessionPosition=void 0,this.position=_Q("position",(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((s=(i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(sY,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(Wi((()=>t.removeContentWidget(n)))),e.add(PQ("request explicit",(t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Ds.Explicit&&s.triggerExplicitly()})))},function(t,i){const e=new Vi,s=PQ(i,(i=>{e.clear(),t(i,e)}));return Wi((()=>{s.dispose(),e.dispose()}))}(s,"setup content widget")))}};tY=YQ([XQ(2,eo)],tY);const iY=SR("inline-suggestion-hints-next",Ss.chevronRight,e(0,"Icon for show next parameter hint.")),eY=SR("inline-suggestion-hints-previous",Ss.chevronLeft,e(0,"Icon for show previous parameter hint."));let sY=class t extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,s){const n=new op(t,i,s,!0,(()=>this._commandService.executeCommand(t))),r=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let o=i;return r&&(o=e(0,"{0} ({1})",i,r.getLabel())),n.tooltip=o,n}constructor(i,s,n,r,o,h,c,u,l,a,d){super(),this.editor=i,this.withBorder=s,this._position=n,this._currentSuggestionIdx=r,this._suggestionCount=o,this._extraCommands=h,this._commandService=c,this.keybindingService=l,this._contextKeyService=a,this._menuService=d,this.id="InlineSuggestionHintsContentWidget"+t.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Ug("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Ug("div",{style:{display:"flex"}},[Ug("div@actionBar",{className:"custom-actions"}),Ug("div@toolBar")])]),this.previousAction=this.createCommandAction(KQ,e(0,"Previous"),np.asClassName(eY)),this.availableSuggestionCountAction=new op("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(qQ,e(0,"Next"),np.asClassName(iY)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(bp.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new lu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new lu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[];const f=this._register(new kR(this.nodes.actionBar));f.push(this.previousAction,{icon:!0,label:!1}),f.push(this.availableSuggestionCountAction),f.push(this.nextAction,{icon:!0,label:!1}),this.toolBar=this._register(u.createInstance(rY,this.nodes.toolBar,bp.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>t instanceof xp?u.createInstance(nY,t,void 0):void 0,telemetrySource:"InlineSuggestionToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility((i=>{t._dropDownVisible=i}))),this._register(PQ("update position",(t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(PQ("counts",(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(PQ("extra commands",(t=>{const i=this._extraCommands.read(t);if(G(this.lastCommands,i))return;this.lastCommands=i;const e=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 xp&&e.push(t);e.length>0&&e.unshift(new cp),this.toolBar.setAdditionalSecondaryActions(e)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};sY._dropDownVisible=!1,sY.id=0,sY=YQ([XQ(6,dp),XQ(7,eo),XQ(8,eP),XQ(9,Qo),XQ(10,yp)],sY);class nY extends LN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Ug("div.keybinding").root;new dW(i,O,Object.assign({disableTitle:!0},aW)).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let rY=class extends QQ{constructor(t,i,e,s,n,r,o,h){super(t,Object.assign({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._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];EN(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),this.setActions(h,c)}setAdditionalSecondaryActions(t){G(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};rY=YQ([XQ(3,yp),XQ(4,Qo),XQ(5,zR),XQ(6,eP),XQ(7,Ap)],rY);var oY=function(t,i){return function(e,s){i(e,s,t)}};let hY=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Vi,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._hookEvents(),this._didChangeConfigurationHandler=this._editor.onDidChangeConfiguration((t=>{t.hasChanged(58)&&(this._unhookEvents(),this._hookEvents())}))}_hookEvents(){const t=this._editor.getOption(58);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,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._hideWidgets()))),this._toUnhook.add(this._editor.onDidScrollChange((t=>this._onEditorScrollChanged(t))))}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(t){(t.scrollTopChanged||t.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(t){this._isMouseDown=!0;const i=t.target;9!==i.type||i.detail!==AJ.ID?12===i.type&&i.detail===PJ.ID||(12!==i.type&&(this._hoverClicked=!1),this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i;(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_onEditorMouseMove(t){var i,e,s,n,r,o,h,c;const u=t.target;if((!this._isMouseDown||!this._hoverClicked)&&(!this._isHoverSticky||9!==u.type||u.detail!==AJ.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!==u.type||u.detail!==AJ.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible()))&&!(this._isHoverSticky&&12===u.type&&u.detail===PJ.ID||this._isHoverSticky&&(null===(o=this._contentWidget)||void 0===o?void 0:o.isVisibleFromKeyboard()))){if(this._isHoverEnabled)return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(h=this._glyphWidget)||void 0===h||h.hide()):2===u.type&&u.position?(null===(c=this._contentWidget)||void 0===c||c.hide(),this._glyphWidget||(this._glyphWidget=new PJ(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(u.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())||sY.dropDownVisible||(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(SJ,this._editor)),this._contentWidget}isColorPickerVisible(){var t;return(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible())||!1}showContentHover(t,i,e,s){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()}escape(){var t;null===(t=this._contentWidget)||void 0===t||t.escape()}isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible()}dispose(){var t,i;this._unhookEvents(),this._toUnhook.dispose(),this._didChangeConfigurationHandler.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};hY.ID="editor.contrib.hover",hY=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}([oY(1,eo),oY(2,W_),oY(3,hc),oY(4,eP)],hY),$p(hY.ID,hY,2),Np(class extends Tp{constructor(){super({id:"editor.action.showHover",label:e(0,"Show or Focus Hover"),description:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if when triggered with the keyboard, the hover should take focus immediately.",type:"boolean",default:!1}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=hY.get(i);if(!s)return;const n=i.getPosition(),r=new ws(n.lineNumber,n.column,n.lineNumber,n.column),o=2===i.getOption(2)||!!(null==e?void 0:e.focus);s.isHoverVisible()?s.focus():s.showContentHover(r,1,1,o)}}),Np(class extends Tp{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:e(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=hY.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new ws(s.lineNumber,s.column,s.lineNumber,s.column),r=LZ.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollUpHover",label:e(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:16,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollUp()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollDownHover",label:e(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:18,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollDown()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollLeftHover",label:e(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:15,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollLeft()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollRightHover",label:e(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:17,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollRight()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pageUpHover",label:e(0,"Page Up Hover"),alias:"Page Up Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=hY.get(i);e&&e.pageUp()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pageDownHover",label:e(0,"Page Down Hover"),alias:"Page Down Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=hY.get(i);e&&e.pageDown()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToTopHover",label:e(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=hY.get(i);e&&e.goToTop()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToBottomHover",label:e(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=hY.get(i);e&&e.goToBottom()}}),Np(class extends Tp{constructor(){super({id:"editor.action.escapeFocusHover",label:e(0,"Escape Focus Hover"),alias:"Escape Focus Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:9,weight:100}})}run(t,i){const e=hY.get(i);e&&e.escape()}}),PZ.register(HJ),PZ.register(SQ),sk(((t,i)=>{const e=t.getColor(Pv);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 cY extends Hi{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=t.target;if(6!==i.type)return;if(!i.detail.injectedText)return;if(i.detail.injectedText.options.attachedData!==xq)return;if(!i.range)return;const e=this._editor.getContribution(hY.ID);if(e&&!e.isColorPickerVisible()){const t=new ws(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);e.showContentHover(t,1,0,!1)}}}cY.ID="editor.contrib.colorContribution",$p(cY.ID,cY,2),PZ.register(Vq);var uY=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},lY=function(t,i){return function(e,s){i(e,s,t)}},aY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let dY=class t extends Hi{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=PC.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=PC.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 fY(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(i){return i.getContribution(t.ID)}};dY.ID="editor.contrib.standaloneColorPickerController",dY=uY([lY(1,Qo),lY(2,Zc),lY(3,eP),lY(4,eo),lY(5,ka),lY(6,_c)],dY),$p(dY.ID,dY,1);let fY=class t extends Hi{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.body=document.createElement("div"),this._position=void 0,this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(zq,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().viewState.position;const u=this._editor.getSelection(),l=u?{startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},a=this._register(Ag(this.body));this._register(a.onDidBlur((()=>{this.hide()}))),this._register(a.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(l),this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return t.ID}getDomNode(){return this.body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(58).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()}_start(t){return aY(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new gY(i.result,i.foundInEditor))}))}_computeAsync(t){return aY(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;const i={range:t,color:{red:0,green:0,blue:0,alpha:1}},e=yield this._standaloneColorPickerParticipant.createColorHover(i,new dq(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 LJ(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 u=s.header;u.pickedColorNode.style.width=o+8+"px",u.originalColorNode.style.width=h+"px";const l=s.header.closeButton;null==l||l.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};fY.ID="editor.contrib.standaloneColorPickerWidget",fY=uY([lY(3,eo),lY(4,Zc),lY(5,eP),lY(6,ka),lY(7,_c)],fY);class gY{constructor(t,i){this.value=t,this.foundInEditor=i}}Np(class extends Tp{constructor(){super({id:"editor.action.hideColorPicker",label:e(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:PC.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=dY.get(i))||void 0===e||e.hide()}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:e(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:PC.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=dY.get(i))||void 0===e||e.insertColor()}}),Ep(class extends _p{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:e(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:e(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:bp.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=dY.get(i))||void 0===e||e.showOrFocus()}});class pY{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,u=t.endColumn,l=n.getLineContent(o),a=n.getLineContent(c);let d,f=l.lastIndexOf(i,h-1+i.length),g=a.indexOf(e,u-1-e.length);if(-1!==f&&-1!==g)if(o===c)l.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=l.substring(f+i.length),s=a.substring(0,g);(t.indexOf(e)>=0||s.indexOf(e)>=0)&&(f=-1,g=-1)}-1!==f&&-1!==g?(s&&f+i.length<l.length&&32===l.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===a.charCodeAt(g-1)&&(e=" "+e,g-=1),d=pY._createRemoveBlockCommentOperations(new ws(o,f+i.length+1,c,g+1),i,e)):(d=pY._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 ws.isEmpty(t)?s.push(WI.delete(new ws(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(WI.delete(new ws(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(WI.delete(new ws(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return ws.isEmpty(t)?n.push(WI.replace(new ws(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(WI.insert(new vs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(WI.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 bs(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 bs(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class mY{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,u=!0;c=0===t||1!==t;for(let h=0,l=s.length;h<l;h++){const l=s[h],a=n+h;if(a===n&&o){l.ignore=!0;continue}const d=e.getLineContent(a),f=Vn(d);if(-1!==f){if(u=!1,l.ignore=!1,l.commentStrOffset=f,c&&!pY._haystackHasNeedleAtOffset(d,l.commentStr,f)&&(0===t?c=!1:1===t||(l.ignore=!0)),c&&i){const t=f+l.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(l.commentStrLength+=1)}}else l.ignore=r,l.commentStrOffset=d.length}if(0===t&&u){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=mY._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:mY._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=mY._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(mY._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),ws.isEmpty(n[e].range)&&ws.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?pY._createRemoveBlockCommentOperations(new ws(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=Vn(i);-1===s&&(s=i.length),h=pY._createAddBlockCommentOperations(new ws(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=pY._createAddBlockCommentOperations(new ws(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 ws(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=mY._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 bs(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(WI.delete(new ws(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(WI.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=mY.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 u=0;for(n=0,r=i[h].commentStrOffset;u<o&&n<r;n++)u=mY.nextVisibleColumn(u,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=u>o?n-1:n}}}class vY extends Tp{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(_c);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(21),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>ws.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 mY(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}Np(class extends vY{constructor(){super(0,{id:"editor.action.commentLine",label:e(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"5_insert",title:e(0,"&&Toggle Line Comment"),order:1}})}}),Np(class extends vY{constructor(){super(1,{id:"editor.action.addCommentLine",label:e(0,"Add Line Comment"),alias:"Add Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2081),weight:100}})}}),Np(class extends vY{constructor(){super(2,{id:"editor.action.removeCommentLine",label:e(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2099),weight:100}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.blockComment",label:e(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"5_insert",title:e(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(_c);if(!i.hasModel())return;const s=i.getOption(21),n=[],r=i.getSelections();for(const t of r)n.push(new pY(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var wY=function(t,i){return function(e,s){i(e,s,t)}};let bY=class t{static get(i){return i.getContribution(t.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 Vi,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&&mg(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(22)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(22))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({x:t.event.posx-1,width:2,y:t.event.posy-1,height:2});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={x:t.event.posx-1,width:2,y:t.event.posy-1,height:2}),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(22))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?bp.SimpleEditorContext:bp.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 Sp){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new up(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new cp)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(58);if(this._editor.updateOptions({hover:{enabled:!1}}),!i){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),e=og(this._editor.getDomNode());i={x:e.left+t.left,y:e.top+t.top+t.height}}const s=this._editor.getOption(123)&&!x;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new vR(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new vR(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===DP)return;const i=this._editor.getOption(70);let s=0;const n=t=>({id:"menu-action-"+ ++s,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),r=(t,i,e,r,o)=>{if(!i)return n({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(e,t)},c=[];for(const t of o)c.push(n({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new up("menu-action-"+ ++s,t,i,void 0))(t,c)},o=[];o.push(n({label:e(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),o.push(new cp),o.push(n({label:e(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),o.push(r(e(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:e(0,"Proportional"),value:"proportional"},{label:e(0,"Fill"),value:"fill"},{label:e(0,"Fit"),value:"fit"}])),o.push(r(e(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:e(0,"Mouse Over"),value:"mouseover"},{label:e(0,"Always"),value:"always"}]));const h=this._editor.getOption(123)&&!x;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:h?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>o,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};bY.ID="editor.contrib.contextmenu",bY=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(1,zR),wY(2,HR),wY(3,Qo),wY(4,eP),wY(5,yp),wY(6,ic),wY(7,yP)],bY),$p(bY.ID,bY,2),Np(class extends Tp{constructor(){super({id:"editor.action.showContextMenu",label:e(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=bY.get(i))||void 0===e||e.showContextMenu()}});class yY{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 kY{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class CY extends Hi{static get(t){return t.getContribution(CY.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 yY(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new kY(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 kY(new yY(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 kY(new yY(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}}CY.ID="editor.contrib.cursorUndoRedoController",$p(CY.ID,CY,0),Np(class extends Tp{constructor(){super({id:"cursorUndo",label:e(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=CY.get(i))||void 0===s||s.cursorUndo()}}),Np(class extends Tp{constructor(){super({id:"cursorRedo",label:e(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=CY.get(i))||void 0===s||s.cursorRedo()}});class SY{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 ws(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 bs(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 bs(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 bs(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 bs(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 bs(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 xY(t){return b?t.altKey:t.ctrlKey}class DY extends Hi{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(33)&&!this._editor.getOption(20)&&(xY(t)&&(this._modifierPressed=!0),this._mouseDown&&xY(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(33)&&!this._editor.getOption(20)&&(xY(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===DY.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]}xY(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 bs(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new bs(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(xY(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(DY.ID,new SY(this._dragSelection,i,xY(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 ws(t.lineNumber,t.column,t.lineNumber,t.column),options:DY._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()}}DY.ID="editor.contrib.dragAndDrop",DY.TRIGGER_KEY_VALUE=b?6:5,DY._DECORATION_OPTIONS=sL.register({description:"dnd-target",className:"dnd-target"}),$p(DY.ID,DY,2);const EY=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}}();var AY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function LY(t){return{asString:()=>AY(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class MY{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 B.some(this,(([t,i])=>i.asFile()))&&i.push("files"),FY(OY(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 OY(t)}}function OY(t){return t.toLowerCase()}function FY(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 TY=Object.freeze({create:t=>st(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>TY.split(t).filter((t=>!t.startsWith("#")))});dc.add("workbench.contributions.dragAndDrop",new class{});class RY{constructor(){}static getInstance(){return RY.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}RY.INSTANCE=new RY;function _Y(t){const i=new MY;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,LY(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,IY(s))}}return i}function IY(t){const i=t.path?os.parse(t.path):void 0;return function(t,i,e){const s={id:EY(),name:t,uri:i,data:e};return{asString:()=>AY(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>{return i=this,e=void 0,n=function*(){return new Uint8Array(yield t.arrayBuffer())},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}))}const PY=Object.freeze(["CodeEditors","CodeFiles",IF.RESOURCES,IF.INTERNAL_URI_LIST]);function NY(t,i=!1){const e=_Y(t),s=e.get(IF.INTERNAL_URI_LIST);if(s)e.replace(fc.uriList,s);else if(i||!e.has(fc.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?os.file(e).toString():os.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(fc.uriList,LY(TY.create(i)))}for(const t of PY)e.delete(t);return e}const BY=sL.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class $Y extends Hi{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=Rg(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Rg("span.icon");this.domNode.append(i),i.classList.add(...np.asClassNameArray(Ss.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(64);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(64))&&e()}))),this._register(Zf(this.domNode,xg.CLICK,(()=>{this.delegate.cancel()})))}getId(){return $Y.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)}}$Y.baseId="editor.widget.inlineProgressWidget";let jY=class extends Hi{constructor(t,i,e){super(),this.id=t,this._editor=i,this._instantiationService=e,this._showDelay=500,this._showPromise=this._register(new zi),this._currentWidget=new zi,this._operationIdPool=0,this._currentDecorations=i.createDecorationsCollection()}showWhile(t,i,e){return s=this,n=void 0,o=function*(){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=ou((()=>{const s=ws.fromPositions(t);this._currentDecorations.set([{range:s,options:BY}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance($Y,this.id,this._editor,s,i,e))}),this._showDelay);try{return yield e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};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}([function(t,i){return function(e,s){i(e,s,t)}}(2,eo)],jY);var WY=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},VY=function(t,i){return function(e,s){i(e,s,t)}},HY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let zY=class t extends Hi{constructor(t,i,e,s,n,r,o,h,c,u){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(Wi((()=>this.visibleContext.reset()))),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Wi((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition((t=>{n.containsPosition(t.position)||this.dispose()}))),this._register(Qi.runAndSubscribe(u.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=Rg(".post-edit-widget"),this.button=this._register(new Zj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Zf(this.domNode,xg.CLICK,(()=>this.showSelector())))}getId(){return t.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=og(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>ap({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};zY.baseId="editor.widget.postEditWidget",zY=WY([VY(7,zR),VY(8,Qo),VY(9,eP)],zY);let UY=class extends Hi{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 zi),this._register(Qi.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}applyEditAndShowIfNeeded(t,i,e,s){var n,r;return HY(this,void 0,void 0,(function*(){const o=this._editor.getModel();if(!o||!t.length)return;const h=i.allEdits[i.activeEditIndex];if(!h)return;const c={edits:[...t.map((t=>new _I(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0}))),...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},u=t[0],l=o.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);let a,d;try{a=yield this._bulkEditService.apply(c,{editor:this._editor,token:s}),d=o.getDecorationRange(l[0])}finally{o.deltaDecorations(l,[])}e&&a.isApplied&&i.allEdits.length>1&&this.show(null!=d?d:u,i,(n=>HY(this,void 0,void 0,(function*(){const r=this._editor.getModel();r&&(yield 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(zY,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()}};UY=WY([VY(4,eo),VY(5,TI)],UY);var KY=function(t,i){return function(e,s){i(e,s,t)}},qY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const GY="editor.changePasteType",ZY=new Jo("pasteWidgetVisible",!1,e(0,"Whether the paste widget is showing")),JY="application/vnd.code.copyMetadata";let QY=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,s,n,r,o,h){super(),this._bulkEditService=s,this._clipboardService=n,this._languageFeaturesService=r,this._quickInputService=o,this._progressService=h,this._editor=t;const c=t.getContainerDomNode();this._register(Zf(c,"copy",(t=>this.handleCopy(t)))),this._register(Zf(c,"cut",(t=>this.handleCopy(t)))),this._register(Zf(c,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new jY("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(UY,"pasteIntoEditor",t,ZY,{id:GY,label:e(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},document.execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(82).enabled&&!this._editor.getOption(88)}handleCopy(t){var i,e;if(!t.clipboardData||!this._editor.hasTextFocus()||!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(35);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new ws(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const c=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,w),u={multicursorText:Array.isArray(c)?c:null,pasteOnNewLine:h,mode:null},l=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!l.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:u});const a=_Y(t.clipboardData),d=l.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),f=EY();this.setCopyMetadata(t.clipboardData,{id:f,providerCopyMimeTypes:d,defaultPastePayload:u});const g=tu((t=>qY(this,void 0,void 0,(function*(){const i=X(yield Promise.all(l.map((i=>qY(this,void 0,void 0,(function*(){try{return yield i.prepareDocumentPaste(s,o,a,t)}catch(t){return void console.error(t)}}))))));i.reverse();for(const t of i)for(const[i,e]of t)a.replace(i,e);return a}))));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:f,dataTransferPromise:g}}handlePaste(t){var i,e;return qY(this,void 0,void 0,(function*(){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.clipboardData),o=NY(t.clipboardData);o.delete(JY);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],fc.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>{return i=h,FY(OY(t),i.map(OY));var i}))}));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,s,n){const r=tu((e=>qY(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new UH(o,3,void 0,e);try{if(yield this.mergeInDataFromCopy(s,n,c.token),c.token.isCancellationRequested)return;const e=t.filter((t=>YY(t,s)));if(!e.length||1===e.length&&"text"===e[0].id)return void(yield this.applyDefaultPasteHandler(s,n,c.token));const u=yield this.getPasteEdits(e,s,h,i,c.token);if(c.token.isCancellationRequested)return;if(u.length){const t="afterPaste"===o.getOption(82).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:u},t,c.token)}yield this.applyDefaultPasteHandler(s,n,c.token)}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}))));this._pasteProgressManager.showWhile(i[0].getEndPosition(),e(0,"Running paste handlers. Click to cancel"),r),this._currentPasteOperation=r}showPasteAsPick(t,i,s,n,r){const o=tu((h=>qY(this,void 0,void 0,(function*(){const c=this._editor;if(!c.hasModel())return;const u=c.getModel(),l=new UH(c,3,void 0,h);try{if(yield this.mergeInDataFromCopy(n,r,l.token),l.token.isCancellationRequested)return;const h=i.filter((t=>YY(t,n))),c=yield this.getPasteEdits(h,n,u,s,l.token);if(l.token.isCancellationRequested)return;if(!c.length)return;let a;if("string"==typeof t)a=c.find((i=>i.id===t));else{const t=yield this._quickInputService.pick(c.map((t=>({label:t.label,description:t.id,detail:t.detail,edit:t}))),{placeHolder:e(0,"Select Paste Action")});a=null==t?void 0:t.edit}if(!a)return;const d=function(t,i,e){var s,n;return{edits:[...i.map((i=>new _I(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:[]]}}(u.uri,s,a);yield this._bulkEditService.apply(d,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===o&&(this._currentPasteOperation=void 0)}}))));this._progressService.withProgress({location:10,title:e(0,"Running paste handlers")},(()=>o))}setCopyMetadata(t,i){t.setData(JY,JSON.stringify(i))}fetchCopyMetadata(t){const i=t.getData(JY);if(i)try{return JSON.parse(i)}catch(t){return}}mergeInDataFromCopy(t,i,e){var s;return qY(this,void 0,void 0,(function*(){if((null==i?void 0:i.id)&&(null===(s=this._currentCopyOperation)||void 0===s?void 0:s.handle)===i.id){const i=yield this._currentCopyOperation.dataTransferPromise;if(e.isCancellationRequested)return;for(const[e,s]of i)t.replace(e,s)}if(!t.has(fc.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(fc.uriList,LY(TY.create(i)))}}))}getPasteEdits(t,i,e,s,n){return qY(this,void 0,void 0,(function*(){const r=yield iu(Promise.all(t.map((t=>{var r;try{return null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n)}catch(t){return void console.error(t)}}))).then(X),n);return null==r||r.sort(((t,i)=>i.priority-t.priority)),null!=r?r:[]}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return qY(this,void 0,void 0,(function*(){const o=null!==(s=t.get(fc.text))&&void 0!==s?s:t.get("text");if(!o)return;const h=yield 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 YY(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}QY.ID="editor.contrib.copyPasteActionController",QY=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}([KY(1,eo),KY(2,TI),KY(3,VR),KY(4,ka),KY(5,Kj),KY(6,UR)],QY);var XY=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},tX=function(t,i){return function(e,s){i(e,s,t)}},iX=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const eX=e(0,"Built-in");class sX{provideDocumentPasteEdits(t,i,e,s){return iX(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{id:this.id,insertText:t.insertText,label:t.label,detail:t.detail,priority:t.priority}:void 0}))}provideDocumentOnDropEdits(t,i,e,s){return iX(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{id:this.id,insertText:t.insertText,label:t.label,priority:t.priority}:void 0}))}}class nX extends sX{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[fc.text],this.pasteMimeTypes=[fc.text]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const i=t.get(fc.text);if(!i)return;if(t.has(fc.uriList))return;const s=yield i.asString();return{id:this.id,priority:0,label:e(0,"Insert Plain Text"),detail:eX,insertText:s}}))}}class rX extends sX{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[fc.uriList],this.pasteMimeTypes=[fc.uriList]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const s=yield hX(t);if(!s.length||i.isCancellationRequested)return;let n=0;const r=s.map((({uri:t,originalText:i})=>t.scheme===Wf.file?t.fsPath:(n++,i))).join(" ");let o;return o=e(0,n>0?s.length>1?"Insert Uris":"Insert Uri":s.length>1?"Insert Paths":"Insert Path"),{id:this.id,priority:0,insertText:r,label:o,detail:eX}}))}}let oX=class extends sX{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[fc.uriList],this.pasteMimeTypes=[fc.uriList]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const s=yield hX(t);if(!s.length||i.isCancellationRequested)return;const n=X(s.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?iE(i.uri,t):void 0})));return n.length?{id:this.id,priority:0,insertText:n.join(" "),label:e(0,s.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:eX}:void 0}))}};function hX(t){return iX(this,void 0,void 0,(function*(){const i=t.get(fc.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of TY.parse(e))try{s.push({uri:os.parse(t),originalText:t})}catch(t){}return s}))}oX=XY([tX(0,yP)],oX);let cX=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new nX)),this._register(t.documentOnDropEditProvider.register("*",new rX)),this._register(t.documentOnDropEditProvider.register("*",new oX(i)))}};cX=XY([tX(0,ka),tX(1,yP)],cX);let uX=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new nX)),this._register(t.documentPasteEditProvider.register("*",new rX)),this._register(t.documentPasteEditProvider.register("*",new oX(i)))}};uX=XY([tX(0,ka),tX(1,yP)],uX),$p(QY.ID,QY,0),ZV(uX),Pp(new class extends Fp{constructor(){super({id:GY,precondition:ZY,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=QY.get(i))||void 0===s?void 0:s.changePasteType()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pasteAs",label:e(0,"Paste As..."),alias:"Paste As...",precondition:void 0,description:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:e(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=QY.get(i))||void 0===s?void 0:s.pasteAs(n)}});class lX{constructor(t){this.identifier=t}}const aX=no("treeViewsDndService");lc(aX,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 dX=function(t,i){return function(e,s){i(e,s,t)}},fX=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const gX="editor.changeDropType",pX=new Jo("dropWidgetVisible",!1,e(0,"Whether the drop widget is showing"));let mX=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,s,n){super(),this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=RY.getInstance(),this._dropProgressManager=this._register(i.createInstance(jY,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(UY,"dropIntoEditor",t,pX,{id:gX,label:e(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}onDropIntoEditor(t,i,s){var n;return fX(this,void 0,void 0,(function*(){if(!s.dataTransfer||!t.hasModel())return;null===(n=this._currentOperation)||void 0===n||n.cancel(),t.focus(),t.setPosition(i);const r=tu((e=>fX(this,void 0,void 0,(function*(){const n=new UH(t,1,void 0,e);try{const o=yield this.extractDataTransferData(s);if(0===o.size||n.token.isCancellationRequested)return;const h=t.getModel();if(!h)return;const c=this._languageFeaturesService.documentOnDropEditProvider.ordered(h).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>o.matches(t))))),u=yield this.getDropEdits(c,h,i,o,n);if(n.token.isCancellationRequested)return;if(u.length){const s="afterDrop"===t.getOption(34).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ws.fromPositions(i)],{activeEditIndex:0,allEdits:u},s,e)}}finally{n.dispose(),this._currentOperation===r&&(this._currentOperation=void 0)}}))));this._dropProgressManager.showWhile(i,e(0,"Running drop handlers. Click to cancel"),r),this._currentOperation=r}))}getDropEdits(t,i,e,s,n){return fX(this,void 0,void 0,(function*(){const r=yield iu(Promise.all(t.map((t=>t.provideDocumentOnDropEdits(i,e,s,n.token)))),n.token),o=X(null!=r?r:[]);return o.sort(((t,i)=>i.priority-t.priority)),o}))}extractDataTransferData(t){return fX(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new MY;const i=NY(t.dataTransfer);if(this.treeItemsTransfer.hasData(lX.prototype)){const t=this.treeItemsTransfer.getData(lX.prototype);if(Array.isArray(t))for(const e of t){const t=yield this._treeViewsDragAndDropService.removeDragOperationTransfer(e.identifier);if(t)for(const[e,s]of t)i.replace(e,s)}}return i}))}};mX.ID="editor.contrib.dropIntoEditorController",mX=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(1,eo),dX(2,ka),dX(3,aX)],mX),$p(mX.ID,mX,2),Pp(new class extends Fp{constructor(){super({id:gX,precondition:pX,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=mX.get(i))||void 0===s||s.changeDropType()}}),ZV(cX);class vX{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===vX._FIND_MATCH_DECORATION||i===vX._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,vX._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,vX._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 ws(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,vX._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=vX._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=vX._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 ws(o,1,h,1),options:vX._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ws(o,1,h,1),options:vX._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,vX._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}}vX._CURRENT_FIND_MATCH_DECORATION=sL.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:Xy(Qw),position:uh.Center},minimap:{color:Xy(Xw),position:ah.Inline}}),vX._FIND_MATCH_DECORATION=sL.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:Xy(Qw),position:uh.Center},minimap:{color:Xy(Xw),position:ah.Inline}}),vX._FIND_MATCH_NO_OVERVIEW_DECORATION=sL.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),vX._FIND_MATCH_ONLY_OVERVIEW_DECORATION=sL.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Xy(Qw),position:uh.Center}}),vX._RANGE_HIGHLIGHT_DECORATION=sL.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),vX._FIND_SCOPE_DECORATION=sL.register({description:"find-scope",className:"findScope",isWholeLine:!0});class wX{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)=>ws.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 bX(t,i){if(t&&""!==t[0]){const e=yX(t,i,"-"),s=yX(t,i,"_");return e&&!s?kX(t,i,"-"):!e&&s?kX(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 yX(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function kX(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=bX([n[i]],t)+e})),r.slice(0,-1)}class CX{constructor(t){this.staticValue=t,this.kind=0}}class SX{constructor(t){this.pieces=t,this.kind=1}}class xX{static fromStaticValue(t){return new xX([DX.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 CX(t[0].staticValue):new SX(t):new CX("")}buildReplaceString(t,i){if(0===this._state.kind)return i?bX(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=xX._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 DX{static staticValue(t){return new DX(t,-1,null)}static caseOps(t,i){return new DX(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class EX{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++]=DX.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=DX.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=DX.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new xX(this._result)}}const AX=new Jo("findWidgetVisible",!1);AX.toNegated();const LX=new Jo("findInputFocussed",!1),MX=new Jo("replaceInputFocussed",!1),OX={primary:545,mac:{primary:2593}},FX={primary:565,mac:{primary:2613}},TX={primary:560,mac:{primary:2608}},RX={primary:554,mac:{primary:2602}},_X={primary:558,mac:{primary:2606}},IX="editor.action.nextMatchFindAction",PX="editor.action.previousMatchFindAction",NX="closeFindWidget",BX="toggleFindCaseSensitive",$X="toggleFindWholeWord",jX="toggleFindRegex",WX="toggleFindInSelection",VX="togglePreserveCase",HX="editor.action.replaceOne",zX="editor.action.replaceAll",UX=19999;class KX{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new cu,this._decorations=new vX(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new lu((()=>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,$i(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 ws(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,UX);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=J(s.map((t=>t.range)),(t=>ws.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(39).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()<UX){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=KX._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(126):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(126):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()<UX){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=KX._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 u=new vs(o,h),l=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):null,i);return e&&l&&l.range.isEmpty()&&l.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),l=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):null,i)),l?s||r.containsRange(l.range)?l:this._getNextMatch(l.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 xX(null);const i=[],e=new EX(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):xX.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 hC(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=>KX._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(126):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=UX?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new ul(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):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 aC(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 wX(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 bs(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 qX extends gy{constructor(t,i,e){super(),this._hideSoon=this._register(new lu((()=>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:lm(Em),inputActiveOptionForeground:lm(Lm),inputActiveOptionBackground:lm(Am)};this.caseSensitive=this._register(new LB(Object.assign({appendTitle:this._keybindingLabelFor(BX),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 MB(Object.assign({appendTitle:this._keybindingLabelFor($X),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 OB(Object.assign({appendTitle:this._keybindingLabelFor(jX),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(Zf(this._domNode,xg.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Zf(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 qX.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 GX(t,i){return 1===t||2!==t&&i}qX.ID="editor.contrib.findOptionsWidget";class ZX extends Hi{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return GX(this._isRegexOverride,this._isRegex)}get wholeWord(){return GX(this._wholeWordOverride,this._wholeWord)}get matchCase(){return GX(this._matchCaseOverride,this._matchCase)}get preserveCase(){return GX(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 ee),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&&(ws.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,u=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=>!ws.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),u!==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>=UX}}function JX(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())}const QX=SR("find-selection",Ss.selection,e(0,"Icon for 'Find in Selection' in the editor find widget.")),YX=SR("find-collapsed",Ss.chevronRight,e(0,"Icon to indicate that the editor find widget is collapsed.")),XX=SR("find-expanded",Ss.chevronDown,e(0,"Icon to indicate that the editor find widget is expanded.")),t0=SR("find-replace",Ss.replace,e(0,"Icon for 'Replace' in the editor find widget.")),i0=SR("find-replace-all",Ss.replaceAll,e(0,"Icon for 'Replace All' in the editor find widget.")),e0=SR("find-previous-match",Ss.arrowUp,e(0,"Icon for 'Find Previous' in the editor find widget.")),s0=SR("find-next-match",Ss.arrowDown,e(0,"Icon for 'Find Next' in the editor find widget.")),n0=e(0,"Find"),r0=e(0,"Find"),o0=e(0,"Previous Match"),h0=e(0,"Next Match"),c0=e(0,"Find in Selection"),u0=e(0,"Close"),l0=e(0,"Replace"),a0=e(0,"Replace"),d0=e(0,"Replace"),f0=e(0,"Replace All"),g0=e(0,"Toggle Replace"),p0=e(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",UX),m0=e(0,"{0} of {1}"),v0=e(0,"No results"),w0=419;let b0=69;const y0="ctrlEnterReplaceAll.windows.donotask",k0=b?256:2048;class C0{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function S0(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function x0(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class D0 extends gy{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(y0,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new su(500),this._register(Wi((()=>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(88)&&(this._codeEditor.getOption(88)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(140)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(39)){const t=this._codeEditor.getOption(39).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(39).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new C0(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>{return t=this,i=void 0,s=function*(){if(this._isVisible){const t=yield this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}))),this._findInputFocused=LX.bindTo(r),this._findFocusTracker=this._register(Ag(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=MX.bindTo(r),this._replaceFocusTracker=this._register(Ag(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(39).addExtraSpaceOnTop&&(this._viewZone=new C0(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 D0.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(88)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=hg(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,Ei)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){let t;if(this._matchesCount.style.minWidth=b0+"px",this._matchesCount.title=this._state.matchesCount>=UX?p0:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=UX&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Rn(m0,e,i)}else t=v0;this._matchesCount.appendChild(document.createTextNode(t)),Yg(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),b0=Math.max(b0,this._matchesCount.clientWidth)}_getAriaLabel(t,i,s){if(t===v0)return""===s?e(0,"{0} found",t):e(0,"{0} found for '{1}'",t,s);if(i){const n=e(0,"{0} found for '{1}', at {2}",t,s,i.startLineNumber+":"+i.startColumn),r=this._codeEditor.getModel();return r&&i.startLineNumber<=r.getLineCount()&&i.startLineNumber>=1?`${r.getLineContent(i.startLineNumber)}, ${n}`:n}return e(0,"{0} found for '{1}'",t,s)}_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(88);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(39).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(39).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=og(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=rg(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(39).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(39).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new C0(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(81).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(!qf(this._domNode))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&&hg(this._domNode)>w0)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=hg(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-b0>=i&&(r=!0),447+e-b0>=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=hg(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||ws.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|k0)?(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)?S0(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?x0(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|k0)?(this._keybindingService.dispatchEvent(t,t.target)||(w&&k&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(e(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(y0,!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)?S0(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?x0(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 cJ(null,this._contextViewProvider,{width:221,label:n0,placeholder:r0,appendCaseSensitiveLabel:this._keybindingLabelFor(BX),appendWholeWordsLabel:this._keybindingLabelFor($X),appendRegexLabel:this._keybindingLabelFor(jX),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:()=>JX(this._keybindingService),inputBoxStyles:gN,toggleStyles:fN},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()}))),y&&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 E0({label:o0+this._keybindingLabelFor(PX),icon:e0,onTrigger:()=>{Ot(this._codeEditor.getAction(PX)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new E0({label:h0+this._keybindingLabelFor(IX),icon:s0,onTrigger:()=>{Ot(this._codeEditor.getAction(IX)).run().then(void 0,Ei)}}));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 xB({icon:QX,title:c0+this._keybindingLabelFor(WX),isChecked:!1,inputActiveOptionBackground:lm(Am),inputActiveOptionBorder:lm(Em),inputActiveOptionForeground:lm(Lm)})),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 E0({label:u0+this._keybindingLabelFor(NX),icon:LR,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())}})),i.appendChild(this._closeBtn.domNode),this._replaceInput=this._register(new uJ(null,void 0,{label:l0,placeholder:a0,appendPreserveCaseLabel:this._keybindingLabelFor(VX),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>JX(this._keybindingService),inputBoxStyles:gN,toggleStyles:fN},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 E0({label:d0+this._keybindingLabelFor(HX),icon:t0,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new E0({label:f0+this._keybindingLabelFor(zX),icon:i0,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 E0({label:g0,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=hg(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.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(e),this._resizeSash=new EO(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=w0;this._register(this._resizeSash.onDidStart((()=>{n=hg(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<w0||i>(parseFloat(ig(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=hg(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=hg(this._domNode);if(t<w0)return;let i=w0;if(!this._resized||t===w0){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=hg(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}D0.ID="editor.contrib.findWidget";class E0 extends gy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+np.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(...np.asClassNameArray(YX)),this._domNode.classList.add(...np.asClassNameArray(XX))):(this._domNode.classList.remove(...np.asClassNameArray(XX)),this._domNode.classList.add(...np.asClassNameArray(YX)))}}sk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(Ov)),e(".currentFindMatch",t.getColor(Mv)),e(".findScope",t.getColor(Fv)),e(".find-widget",t.getColor(dv));const s=t.getColor(km);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(Cm);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(Rv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Hb(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Tv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(_v);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${Hb(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(wm);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const u=t.getColor(fv);u&&i.addRule(`.monaco-editor .find-widget { color: ${u}; }`);const l=t.getColor(pm);l&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${l}; }`);const a=t.getColor(pv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(gv);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(Bw);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(vm);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var 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},L0=function(t,i){return function(e,s){i(e,s,t)}},M0=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function O0(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 F0=class t extends Hi{get editor(){return this._editor}static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s){super(),this._editor=t,this._findWidgetVisible=AX.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._updateHistoryDelayer=new su(500),this._state=this._register(new ZX),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(39).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!!LX.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=In(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}_start(t,i){return M0(this,void 0,void 0,(function*(){if(this.disposeModel(),!this._editor.hasModel())return;const e=Object.assign(Object.assign({},i),{isRevealed:!0});if("single"===t.seedSearchStringFromSelection){const i=O0(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?In(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=O0(this._editor,t.seedSearchStringFromSelection);i&&(e.searchString=i)}if(!e.searchString&&t.seedSearchStringFromGlobalClipboard){const t=yield 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 KX(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(){return!!this._model&&(this._model.replaceAll(),!0)}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}getGlobalBufferTerm(){return M0(this,void 0,void 0,(function*(){return this._editor.getOption(39).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}))}setGlobalBufferTerm(t){this._editor.getOption(39).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};F0.ID="editor.contrib.findController",F0=A0([L0(1,Qo),L0(2,hN),L0(3,VR)],F0);let T0=class extends F0{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._notificationService=r,this._widget=null,this._findOptionsWidget=null}_start(t,i){const e=Object.create(null,{_start:{get:()=>super._start}});return M0(this,void 0,void 0,(function*(){this._widget||this._createFindWidget();const s=this._editor.getSelection();let n=!1;switch(this._editor.getOption(39).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":n=!!s&&s.startLineNumber!==s.endLineNumber}t.updateSearchScope=t.updateSearchScope||n,yield e._start.call(this,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 D0(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new qX(this._editor,this._state,this._keybindingService))}};T0=A0([L0(1,HR),L0(2,Qo),L0(3,eP),L0(4,Yy),L0(5,IM),L0(6,hN),L0(7,VR)],T0),Bp(new Rp({id:"actions.find",label:e(0,"Find"),alias:"Find",precondition:Oo.or(PC.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"3_find",title:e(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=F0.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(39).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop})}));const R0={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:e(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:e(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:e(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:e(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 _0 extends Tp{run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);t&&!this._run(t)&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),this._run(t))}))}}class I0 extends Tp{run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);if(!t)return;const e=O0(i,"single",!1);e&&t.setSearchString(e),this._run(t)||(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),this._run(t))}))}}Bp(new Rp({id:"editor.action.startFindReplaceAction",label:e(0,"Replace"),alias:"Replace",precondition:Oo.or(PC.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"3_find",title:e(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(88))return!1;const e=F0.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(39).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(39).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop})})),$p(F0.ID,T0,0),Np(class extends Tp{constructor(){super({id:"editor.actions.findWithArgs",label:e(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:R0})}run(t,i,e){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);if(t){const s=e?{searchString:e.searchString,replaceString:e.replaceString,isReplaceRevealed:void 0!==e.replaceString,isRegex:e.isRegex,wholeWord:e.matchWholeWord,matchCase:e.isCaseSensitive,preserveCase:e.preserveCase}:{};yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(39).loop},s),t.setGlobalBufferTerm(t.getState().searchString)}}))}}),Np(class extends Tp{constructor(){super({id:"actions.findWithSelection",label:e(0,"Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);t&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),t.setGlobalBufferTerm(t.getState().searchString))}))}}),Np(class extends _0{constructor(){super({id:IX,label:e(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:PC.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Oo.and(PC.focus,LX),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),Np(class extends _0{constructor(){super({id:PX,label:e(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:PC.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Oo.and(PC.focus,LX),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToMatchFindAction",label:e(0,"Go to Match..."),alias:"Go to Match...",precondition:AX}),this._highlightDecorations=[]}run(t,i,s){const n=F0.get(i);if(!n)return;const r=n.getState().matchesCount;if(r<1)return void t.get(IM).notify({severity:_M.Warning,message:e(0,"No matches. Try searching for something else.")});const o=t.get(Kj).createInputBox();o.placeholder=e(0,"Type a number to go to a specific match (between 1 and {0})",r);const h=t=>{const i=parseInt(t);if(isNaN(i))return;const e=n.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},c=t=>{const s=h(t);if("number"==typeof s){o.validationMessage=void 0,n.goToMatch(s);const t=n.getState().currentMatch;t&&this.addDecorations(i,t)}else o.validationMessage=e(0,"Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(i)};o.onDidChangeValue((t=>{c(t)})),o.onDidAccept((()=>{const t=h(o.value);"number"==typeof t?(n.goToMatch(t),o.hide()):o.validationMessage=e(0,"Please type a number between 1 and {0}",n.getState().matchesCount)})),o.onDidHide((()=>{this.clearDecorations(i),o.dispose()})),o.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:Xy(bk),position:uh.Full}}}])}))}}),Np(class extends I0{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:e(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),Np(class extends I0{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:e(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const P0=Fp.bindToContribution(F0.get);Pp(new P0({id:NX,precondition:AX,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:9,secondary:[1033]}})),Pp(new P0({id:BX,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:PC.focus,primary:OX.primary,mac:OX.mac,win:OX.win,linux:OX.linux}})),Pp(new P0({id:$X,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:PC.focus,primary:FX.primary,mac:FX.mac,win:FX.win,linux:FX.linux}})),Pp(new P0({id:jX,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:PC.focus,primary:TX.primary,mac:TX.mac,win:TX.win,linux:TX.linux}})),Pp(new P0({id:WX,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:PC.focus,primary:RX.primary,mac:RX.mac,win:RX.win,linux:RX.linux}})),Pp(new P0({id:VX,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:PC.focus,primary:_X.primary,mac:_X.mac,win:_X.win,linux:_X.linux}})),Pp(new P0({id:HX,precondition:AX,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:PC.focus,primary:3094}})),Pp(new P0({id:HX,precondition:AX,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,MX),primary:3}})),Pp(new P0({id:zX,precondition:AX,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:PC.focus,primary:2563}})),Pp(new P0({id:zX,precondition:AX,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,MX),primary:void 0,mac:{primary:2051}}})),Pp(new P0({id:"editor.action.selectAllMatches",precondition:AX,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:PC.focus,primary:515}}));const N0={0:" ",1:"u",2:"r"},B0=16777215,$0=4278190080;class j0{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 W0{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 j0(t.length),this._userDefinedStates=new j0(t.length),this._recoveredStates=new j0(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>B0||n>B0)throw new Error("startLineNumber or endLineNumber must not exceed "+B0);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]&B0}getEndLineNumber(t){return this._endIndexes[t]&B0}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 V0(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&$0)>>>24)+((this._endIndexes[t]&$0)>>>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]=`[${N0[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&B0,endLineNumber:this._endIndexes[t]&B0,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 W0(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),u=r(0);const l=[];let a,d=0;const f=[];for(;c||u;){let t;if(u&&(!c||c.startLineNumber>=u.startLineNumber))c&&c.startLineNumber===u.startLineNumber?(1===u.source?t=u:(t=c,t.isCollapsed=u.isCollapsed&&c.endLineNumber===u.endLineNumber,t.source=0),c=n(++o)):(t=u,u.isCollapsed&&0===u.source&&(t.source=2)),u=r(++h);else{let i=h,e=u;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(;a&&a.endLineNumber<t.startLineNumber;)a=l.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!a||a.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,a&&l.push(a),a=t)}}return f}}class V0{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 H0{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ee,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new W0(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(W0.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=W0.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(W0.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=W0.sanitizeAndMerge(this._regions,s,n);this.updatePost(W0.fromFoldRanges(r))}_getLinesChecksum(t,i){return Ru(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 z0(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 U0(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 K0(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 q0(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 G0(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 Z0{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ee,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!==Ex(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 ws(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!==J0(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=J0(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 J0(t,i){const e=J(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class Q0{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=X0){const n=t.getOptions().tabSize,r=new Y0(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=kS(s,n);let u,l=h[h.length-1];if(-1!==c){if(o&&(u=s.match(o))){if(!u[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,l=h[t],r.insertFirst(e,l.line,c),l.line=e,l.indent=c,l.endAbove=e;continue}}}if(l.indent>c){do{h.pop(),l=h[h.length-1]}while(l.indent>c);const t=l.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}l.indent===c?l.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(l.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class Y0{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>B0||i>B0)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 W0(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 u=this._startIndexes[h],l=kS(t.getLineContent(u),n);(l<s||l===s&&e++<i)&&(r[c]=u,o[c]=this._endIndexes[h],c++)}return new W0(r,o)}}}const X0={limit:5e3,update:()=>{}},t1=fm("editor.foldBackground",{light:ab(Dv,.3),dark:ab(Dv,.3),hcDark:null,hcLight:null},e(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);fm("editorGutter.foldingControlForeground",{dark:mm,light:mm,hcDark:mm,hcLight:mm},e(0,"Color of the folding control in the editor gutter."));const i1=SR("folding-expanded",Ss.chevronDown,e(0,"Icon for expanded ranges in the editor glyph margin.")),e1=SR("folding-collapsed",Ss.chevronRight,e(0,"Icon for collapsed ranges in the editor glyph margin.")),s1=SR("folding-manual-collapsed",e1,e(0,"Icon for manually collapsed ranges in the editor glyph margin.")),n1=SR("folding-manual-expanded",i1,e(0,"Icon for manually expanded ranges in the editor glyph margin.")),r1={color:Xy(t1),position:ah.Inline};class o1{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?o1.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?o1.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:o1.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:o1.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?o1.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:o1.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?o1.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:o1.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?o1.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:o1.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?o1.MANUALLY_EXPANDED_VISUAL_DECORATION:o1.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}o1.COLLAPSED_VISUAL_DECORATION=sL.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:np.asClassName(e1)}),o1.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=sL.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(e1)}),o1.MANUALLY_COLLAPSED_VISUAL_DECORATION=sL.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:np.asClassName(s1)}),o1.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=sL.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(s1)}),o1.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),o1.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0}),o1.EXPANDED_VISUAL_DECORATION=sL.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+np.asClassName(i1)}),o1.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=sL.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(i1)}),o1.MANUALLY_EXPANDED_VISUAL_DECORATION=sL.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+np.asClassName(n1)}),o1.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=sL.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(n1)}),o1.NO_CONTROLS_EXPANDED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),o1.HIDDEN_RANGE_DECORATION=sL.register({description:"folding-hidden-range-decoration",stickiness:1});const h1={};class c1{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 Vi,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,h1,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})}}),Ai)));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 u1(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 u1{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>B0||i>B0)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 W0(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 W0(s,n,r)}}}var l1=function(t,i){return function(e,s){i(e,s,t)}};const a1=new Jo("foldingEnabled",!1);let d1=class t extends Hi{static get(i){return i.getContribution(t.ID)}static getFoldingRangeProviders(i,e){var s,n;const r=i.foldingRangeProvider.ordered(e);return null!==(n=null===(s=t._foldingRangeSelector)||void 0===s?void 0:s.call(t,r,e))&&void 0!==n?n:r}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Vi),this.editor=t,this._foldingLimitReporter=new f1(t);const o=this.editor.getOptions();this._isEnabled=o.get(41),this._useFoldingProviders="indentation"!==o.get(42),this._unfoldOnClickAfterEndOfLine=o.get(46),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(44),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 o1(t),this.foldingDecorationProvider.showFoldingControls=o.get(106),this.foldingDecorationProvider.showFoldingHighlights=o.get(43),this.foldingEnabled=a1.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(41)&&(this._isEnabled=this.editor.getOptions().get(41),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(45)&&this.onModelChanged(),t.hasChanged(106)||t.hasChanged(43)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(106),this.foldingDecorationProvider.showFoldingHighlights=t.get(43),this.triggerFoldingModelChanged()}t.hasChanged(42)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(42),this.onFoldingStrategyChanged()),t.hasChanged(46)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(46)),t.hasChanged(44)&&(this._foldingImportsByDefault=this.editor.getOptions().get(44))}))),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 H0(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new Z0(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new su(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new lu((()=>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(i){if(this.rangeProvider)return this.rangeProvider;const e=new Q0(i,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=e,this._useFoldingProviders&&this.foldingModel){const s=t.getFoldingRangeProviders(this.languageFeaturesService,i);s.length>0&&(this.rangeProvider=new c1(i,s,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,e))}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 Ji(!0),e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=tu((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Ns.Imports.value,!0);t&&(s=_F.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=>(Ei(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,Ei)}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<5)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)}};d1.ID="editor.contrib.folding",d1=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}([l1(1,Qo),l1(2,_c),l1(3,IM),l1(4,z_),l1(5,ka)],d1);class f1{constructor(t){this.editor=t,this._onDidChange=new ee,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(45)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class g1 extends Tp{runEditorCommand(t,i,e){const s=t.get(_c),n=d1.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 p1(t){if(!Et(t)){if(!kt(t))return!1;const i=t;if(!Et(i.levels)&&!St(i.levels))return!1;if(!Et(i.direction)&&!yt(i.direction))return!1;if(!(Et(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(St)))return!1}return!0}class m1 extends g1{getFoldingLevel(){return parseInt(this.id.substr(m1.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))}}m1.ID_PREFIX="editor.foldLevel",m1.ID=t=>m1.ID_PREFIX+t,$p(d1.ID,d1,0),Np(class extends g1{constructor(){super({id:"editor.unfold",label:e(0,"Unfold"),alias:"Unfold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},description:{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:p1,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?U0(i,!1,n,r):z0(i,!1,n,r)}}),Np(class extends g1{constructor(){super({id:"editor.unfoldRecursively",label:e(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2142),weight:100}})}invoke(t,i,e,s){z0(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.fold",label:e(0,"Fold"),alias:"Fold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},description:{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:p1,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?U0(i,!0,r||1,n):z0(i,!0,r||1,n)}}),Np(class extends g1{constructor(){super({id:"editor.foldRecursively",label:e(0,"Fold Recursively"),alias:"Fold Recursively",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);z0(i,!0,Number.MAX_VALUE,s)}}),Np(class extends g1{constructor(){super({id:"editor.foldAll",label:e(0,"Fold All"),alias:"Fold All",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2069),weight:100}})}invoke(t,i,e){z0(i,!0)}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAll",label:e(0,"Unfold All"),alias:"Unfold All",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2088),weight:100}})}invoke(t,i,e){z0(i,!1)}}),Np(class extends g1{constructor(){super({id:"editor.foldAllBlockComments",label:e(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&q0(i,new RegExp("^\\s*"+In(s.blockCommentStartToken)),!0)}}}),Np(class extends g1{constructor(){super({id:"editor.foldAllMarkerRegions",label:e(0,"Fold All Regions"),alias:"Fold All Regions",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&q0(i,new RegExp(s.markers.start),!0)}}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:e(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&q0(i,new RegExp(s.markers.start),!1)}}}),Np(class extends g1{constructor(){super({id:"editor.foldAllExcept",label:e(0,"Fold All Regions Except Selected"),alias:"Fold All Regions Except Selected",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2136),weight:100}})}invoke(t,i,e){K0(i,!0,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAllExcept",label:e(0,"Unfold All Regions Except Selected"),alias:"Unfold All Regions Except Selected",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2134),weight:100}})}invoke(t,i,e){K0(i,!1,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.toggleFold",label:e(0,"Toggle Fold"),alias:"Toggle Fold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2090),weight:100}})}invoke(t,i,e){!function(t,i,e){const s=[];for(const i of e){const e=t.getRegionAtLine(i);if(e){s.push(e),0}}t.toggleCollapseState(s)}(i,0,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.gotoParentFold",label:e(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.gotoPreviousFold",label:e(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.gotoNextFold",label:e(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:e(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:a1,kbOpts:{kbExpr:PC.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=W0.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(W0.fromFoldRanges(t))}}}}),Np(class extends g1{constructor(){super({id:"editor.removeManualFoldingRanges",label:e(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:a1,kbOpts:{kbExpr:PC.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++)v1=new m1({id:m1.ID(t),label:e(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2048|21+t),weight:100}}),Wp.INSTANCE.registerEditorAction(v1);var v1;fp.registerCommand("_executeFoldingRangeProvider",(function(t,...i){return e=this,s=void 0,r=function*(){const[e]=i;if(!(e instanceof os))throw Ti();const s=t.get(ka),n=t.get(Zc).getModel(e);if(!n)throw Ti();const r=t.get(ic);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(_c),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},u=new Q0(n,o,c);let l=u;if("indentation"!==h){const t=d1.getFoldingRangeProviders(s,n);t.length&&(l=new c1(n,t,(()=>{}),c,u))}const a=yield l.compute(fe.None),d=[];try{if(a)for(let t=0;t<a.length;t++){const i=a.getType(t);d.push({start:a.getStartLineNumber(t),end:a.getEndLineNumber(t),kind:i?Ns.fromValue(i):void 0})}return d}finally{l.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r})),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomIn",label:e(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Zr.setZoomLevel(Zr.getZoomLevel()+1)}}),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomOut",label:e(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Zr.setZoomLevel(Zr.getZoomLevel()-1)}}),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomReset",label:e(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Zr.setZoomLevel(0)}});var w1=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},b1=function(t,i){return function(e,s){i(e,s,t)}},y1=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let k1=class{constructor(t,i,e){this._editor=t,this._languageFeaturesService=i,this._workerService=e,this._disposables=new Vi,this._sessionDisposables=new Vi,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(54)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(54))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 tl;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()}));hz(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||et(t)&&(JH.execute(this._editor,t,!0),tz(t))})).finally((()=>{n.dispose()}))}};k1.ID="editor.contrib.autoFormat",k1=w1([b1(1,ka),b1(2,$R)],k1);let C1=class{constructor(t,i,e){this.editor=t,this._languageFeaturesService=i,this._instantiationService=e,this._callOnDispose=new Vi,this._callOnModel=new Vi,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(53)&&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(sz,this.editor,t,2,KR.None,fe.None).catch(Ei))}};C1.ID="editor.contrib.formatOnPaste",C1=w1([b1(1,ka),b1(2,eo)],C1),$p(k1.ID,k1,2),$p(C1.ID,C1,2),Np(class extends Tp{constructor(){super({id:"editor.action.formatDocument",label:e(0,"Format Document"),alias:"Format Document",precondition:Oo.and(PC.notInCompositeEditor,PC.writable,PC.hasDocumentFormattingProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return y1(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(eo),s=t.get(qR);yield s.showWhile(e.invokeFunction(rz,i,1,KR.None,fe.None),250)}}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.formatSelection",label:e(0,"Format Selection"),alias:"Format Selection",precondition:Oo.and(PC.writable,PC.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2084),weight:100},contextMenuOpts:{when:PC.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return y1(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(eo),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new ws(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(qR);yield r.showWhile(e.invokeFunction(sz,i,n,1,KR.None,fe.None),250)}))}}),fp.registerCommand("editor.action.format",(t=>y1(void 0,void 0,void 0,(function*(){const i=t.get(ro).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(dp);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var S1=function(t,i){return function(e,s){i(e,s,t)}};class x1{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 D1 extends x1{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class E1 extends x1{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class A1 extends x1{static create(t,i,e){const s=new pe(e),n=new A1(i.uri),r=t.ordered(i),o=r.map(((t,e)=>{var r;const o=x1.findId(`provider_${e}`,n),h=new E1(o,n,null!==(r=t.displayName)&&void 0!==r?r:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,s.token)).then((t=>{for(const i of t||[])A1._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{x1.empty(t)?t.remove():n._groups.set(o,t)}))})),h=t.onDidChange((()=>{G(t.ordered(i),r)||s.cancel()}));return Promise.all(o).then((()=>s.token.isCancellationRequested&&!e.isCancellationRequested?A1.create(t,i,e):n._compact())).finally((()=>{h.dispose()}))}static _makeOutlineElement(t,i){const e=x1.findId(t,i),s=new D1(e,i,t);if(t.children)for(const i of t.children)A1._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=B.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 D1?t.push(i.symbol):t.push(...B.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>ws.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return A1._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>vs.compare(ws.getStartPosition(t.range),ws.getStartPosition(i.range))||vs.compare(ws.getEndPosition(i.range),ws.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&&A1._flattenDocumentSymbols(t,s.children,s.name)}}const L1=no("IOutlineModelService");let M1=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new TO(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()}getOrCreate(t,i){return e=this,s=void 0,r=function*(){const e=this._languageFeaturesService.documentSymbolProvider,s=e.ordered(t);let n=this._cache.get(t.id);if(!n||n.versionId!==t.getVersionId()||!G(n.provider,s)){const i=new pe;n={versionId:t.getVersionId(),provider:s,promiseCnt:0,source:i,promise:A1.create(e,t,i.token),model:void 0},this._cache.set(t.id,n);const r=Date.now();n.promise.then((i=>{n.model=i,this._debounceInformation.update(t,Date.now()-r)})).catch((()=>{this._cache.delete(t.id)}))}if(n.model)return n.model;n.promiseCnt+=1;const r=i.onCancellationRequested((()=>{0==--n.promiseCnt&&(n.source.cancel(),this._cache.delete(t.id))}));try{return yield n.promise}finally{r.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}};M1=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(0,ka),S1(1,z_),S1(2,Zc)],M1),lc(L1,M1,1);fp.registerCommand("_executeDocumentSymbolProvider",(function(t,...i){return e=this,s=void 0,r=function*(){const[e]=i;Mt(os.isUri(e));const s=t.get(L1),n=t.get(ep),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,fe.None)).getTopLevelSymbols()}finally{r.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}));class O1 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=O1.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=O1.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=O1.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=O1.suppressSuggestions.bindTo(this.contextKeyService),this._register(PQ("update context key: inlineCompletionVisible, suppressSuggestions",(t=>{const i=this.model.read(t),e=null==i?void 0:i.selectedInlineCompletion.read(t),s=null==i?void 0:i.ghostText.read(t),n=null==i?void 0:i.selectedSuggestItem.read(t);this.inlineCompletionVisible.set(void 0===n&&void 0!==s&&!s.isEmpty()),s&&e&&this.suppressSuggestions.set(e.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(PQ("update context key: inlineCompletionSuggestsIndentation, inlineCompletionSuggestsIndentationLessThanTabSize",(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=Vn(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=Xb.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}O1.inlineSuggestionVisible=new Jo("inlineSuggestionVisible",!1,e(0,"Whether an inline suggestion is visible")),O1.inlineSuggestionHasIndentation=new Jo("inlineSuggestionHasIndentation",!1,e(0,"Whether the inline suggestion starts with whitespace")),O1.inlineSuggestionHasIndentationLessThanTabSize=new Jo("inlineSuggestionHasIndentationLessThanTabSize",!0,e(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),O1.suppressSuggestions=new Jo("inlineSuggestionSuppressSuggestions",void 0,e(0,"Whether suggestions should be suppressed for the current suggestion"));class F1{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 T1=[];class R1{constructor(t,i){if(this.startColumn=t,this.endColumnExclusive=i,t>i)throw new Pi(`startColumn ${t} cannot be after endColumnExclusive ${i}`)}toRange(t){return new ws(t,this.startColumn,t,this.endColumnExclusive)}}function _1(t,i){return new vs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function I1(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new vs(i,e)}class P1{constructor(t,i){this.lineNumber=t,this.parts=i}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new F1(t),s=i.map((t=>{const i=ws.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 N1{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}}class B1{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new N1(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))}}let $1=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=OQ("isDisposed",!1),this.currentTextModel=jQ(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=_Q("uiState",(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 B1?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 Pa(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 Pa(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,u=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(u,t.column-1)],void 0),i.length>0&&(o(i,"ghost-text"),void 0===c&&t.column<=h.length&&(c=t.column)),u=t.column-1}void 0!==c&&o([h.substring(u)],void 0);const l=void 0!==c?new R1(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:l,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=_Q("decorations",(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:ws.fromPositions(new vs(i.lineNumber,t.column)),options:{description:"ghost-text",after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:dh.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new j1(this.editor,this.languageService.languageIdCodec,_Q("lines",(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(Wi((()=>{this.isDisposed.set(!0,void 0)}))),this._register(function(t,i){const e=new Vi,s=t.createDecorationsCollection();return e.add(PQ(`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}};$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}([function(t,i){return function(e,s){i(e,s,t)}}(2,hc)],$1);class j1 extends Hi{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){var s;super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=("editorOptionChanged",s=Qi.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(31)||t.hasChanged(113)||t.hasChanged(95)||t.hasChanged(90)||t.hasChanged(49)||t.hasChanged(48)||t.hasChanged(64))),new VQ("editorOptionChanged",s)),this._register(PQ("update view zone",(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(31),o=s.get(113),h=s.get(90),c=s.get(49),u=s.get(48),l=s.get(64),a=new Wh(1e4);a.appendString('<div class="suggest-preview-text">');for(let t=0,s=e.length;t<s;t++){const s=e[t],d=s.content;a.appendString('<div class="view-line'),a.appendString('" style="top:'),a.appendString(String(t*l)),a.appendString('px;width:1000000px;">');const f=fr(d),g=ar(d),p=_a.createEmpty(d,n);Ka(new Va(u.isMonospace&&!r,u.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,o,"none",h,c!==oi.OFF,null),a),a.appendString("</div>")}a.appendString("</div>"),Kr(t,u);const d=a.build(),f=W1?W1.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 W1=Lu("editorGhostText",{createHTML:t=>t});class V1{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=tr(s,this.text),r=_1(this.range.getStartPosition(),I1(s.substring(0,n))),o=this.text.substring(n),h=ws.fromPositions(r,this.range.getEndPosition());return new V1(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=Hn(r).length;if(n.range.startColumn-1<=o){const t=Hn(n.text).length,i=r.substring(n.range.startColumn-1,o),e=ws.fromPositions(n.range.getStartPosition().delta(0,i.length),n.range.getEndPosition()),s=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new V1(e,s)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==H1?void 0:H1.originalValue)===t&&(null==H1?void 0:H1.newValue)===i)return null==H1?void 0:H1.changes;{let e=U1(t,i,!0);if(e){const s=z1(e);if(s>0){const n=U1(t,i,!1);n&&z1(n)<s&&(e=n)}}return H1={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const u=n.range.startLineNumber,l=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 a=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,a)),h=n.text.substring(t.modifiedStart,o),c=n.text.substring(o,Math.max(t.modifiedStart,r));if(h.length>0){const t=Wn(h);l.push(new N1(s,t,!1))}if(c.length>0){const t=Wn(c);l.push(new N1(s,t,!0))}}return new P1(u,l)}}let H1;function z1(t){let i=0;for(const e of t)i+=e.originalLength;return i}function U1(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 Ku({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}class K1{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}}var q1=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class G1{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 Z1{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 J1{static from(t,i,e,s,n){let r,o,h=t.range?ws.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=Q1(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new ws(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=Q1(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new ws(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new GZ).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof $Z?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else ho();return new J1(r,t.command,h,r,o,t.additionalTextEdits||T1,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 J1(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 Q1(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 Jx,s=new gD(e,(t=>i.getLanguageConfiguration(t))),n=kD(new lD(new K1([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=Ix(e,i.openingBracket.length),i.child&&(t(i.child,e),e=Ix(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=Ix(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,Ix(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=Ix(e,s.length)}(n,0),r}(o,s);return h}var Y1=function(t,i){return function(e,s){i(e,s,t)}};let X1=class extends Hi{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 zi),this.inlineCompletions=TQ("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TQ("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new t2(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,u=(()=>{return s=this,n=void 0,l=function*(){var s;if((h||i.triggerKind===Ds.Automatic)&&(yield(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,u=yield function(t,i,e,s,n=fe.None,r){return q1(this,void 0,void 0,(function*(){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new ws(t.lineNumber,e.startColumn,t.lineNumber,s):ws.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=yield Promise.all(h.map((t=>q1(this,void 0,void 0,(function*(){try{const r=yield t.provideInlineCompletions(e,i,s,n);return{provider:t,completions:r}}catch(t){Ai(t)}return{provider:t,completions:void 0}}))))),u=new Map,l=[];for(const t of c){const i=t.completions;if(!i)continue;const s=new Z1(i,t.provider);l.push(s);for(const t of i.items){const i=J1.from(t,s,o,e,r);u.set(i.hash(),i)}}return new G1(Array.from(u.values()),new Set(u.keys()),l)}))}(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const l=new Date;this._debounceValue.update(this.textModel,l.getTime()-n.getTime());const a=new e2(u,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!u.has(i)&&a.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),EQ((t=>{o.set(a,t)})),!0},new((u=void 0)||(u=Promise))((function(t,i){function e(t){try{o(l.next(t))}catch(t){i(t)}}function r(t){try{o(l.throw(t))}catch(t){i(t)}}function o(i){var s;i.done?t(i.value):(s=i.value,s instanceof u?s:new u((function(t){t(s)}))).then(e,r)}o((l=l.apply(s,n||[])).next())}));var s,n,u,l})(),l=new i2(r,c,u);return this._updateOperation.value=l,u}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()}};X1=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}([Y1(3,ka),Y1(4,_c)],X1);class t2{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===Ds.Automatic||this.context.triggerKind===Ds.Explicit)&&this.versionId===t.versionId;var i,e}}class i2{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class e2{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=_Q("ranges",(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 s2(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[]),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 s2(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class s2{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 V1(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).toLowerCase(),r=s.text.toLowerCase(),o=Math.max(0,i.column-s.range.startColumn);let h=r.substring(0,o),c=r.substring(o),u=n.substring(0,o),l=n.substring(o);const a=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=a&&(u=u.trimStart(),0===u.length&&(l=l.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(u)&&!!NO(l,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 V1(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return n2(this._getUpdatedRange(t)).isBefore(n2(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 n2(t){return t.startLineNumber===t.endLineNumber?new vs(1,1+t.endColumn-t.startColumn):new vs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}function r2(t,i=w){return function(t,i=w){return!!i&&UD(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 o2{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 h2{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=Hn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof $Z&&(s=Hn(Wn(i.value).pop())),!0)));const n=tr(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 c2{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Qe(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Qe(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===Je(this._model.uri.fsPath)?"":this._labelService.getUriLabel(YD(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 u2{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=>!Fn(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let l2=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}};l2=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,_c)],l2);class a2{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 a2.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return a2.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return a2.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return a2.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)}}}a2.dayNames=[e(0,"Sunday"),e(0,"Monday"),e(0,"Tuesday"),e(0,"Wednesday"),e(0,"Thursday"),e(0,"Friday"),e(0,"Saturday")],a2.dayNamesShort=[e(0,"Sun"),e(0,"Mon"),e(0,"Tue"),e(0,"Wed"),e(0,"Thu"),e(0,"Fri"),e(0,"Sat")],a2.monthNames=[e(0,"January"),e(0,"February"),e(0,"March"),e(0,"April"),e(0,"May"),e(0,"June"),e(0,"July"),e(0,"August"),e(0,"September"),e(0,"October"),e(0,"November"),e(0,"December")],a2.monthNamesShort=[e(0,"Jan"),e(0,"Feb"),e(0,"Mar"),e(0,"Apr"),e(0,"May"),e(0,"Jun"),e(0,"Jul"),e(0,"Aug"),e(0,"Sep"),e(0,"Oct"),e(0,"Nov"),e(0,"Dec")];class d2{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:Qe(e)}:CP: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)||kP(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&os.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(kP(t))return Qe(t.uri.path);let i=Qe(t.configPath.path);return i.endsWith(xP)&&(i=i.substr(0,i.length-xP.length-1)),i}_resoveWorkspacePath(t){if(kP(t))return r2(t.uri.fsPath);const i=Qe(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?r2(e):"/"}}class f2{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?EY():void 0}}class g2{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=Y(i.placeholders,WZ.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=ws.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?g2._decor.inactiveFinal:g2._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(WI.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 bs(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?g2._decor.activeFinal:g2._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?g2._decor.activeFinal:g2._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?g2._decor.inactiveFinal:g2._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof WZ){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 VZ,!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=ws.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,g2._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=Y(this._snippet.placeholders,WZ.compareByIndex)}))}}g2._decor={active:sL.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:sL.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:sL.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:sL.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const p2={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let m2=class t{static adjustWhitespace(t,i,e,s,n){const r=Hn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof $Z)||i.parent instanceof VZ)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 $Z(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=bs.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(i,e,s,n,r,o,h,c,u){const l=[],a=[];if(!i.hasModel())return{edits:l,snippets:a};const d=i.getModel(),f=i.invokeWithinContext((t=>t.get(yP))),g=i.invokeWithinContext((t=>new c2(t.get(fP),d))),p=()=>h,m=d.getValueInRange(t.adjustSelection(d,i.getSelection(),s,0)),v=d.getValueInRange(t.adjustSelection(d,i.getSelection(),0,n)),w=d.getLineFirstNonWhitespaceColumn(i.getSelection().positionLineNumber),b=i.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>ws.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:h,idx:y}of b){let k=t.adjustSelection(d,h,s,0),C=t.adjustSelection(d,h,0,n);m!==d.getValueInRange(k)&&(k=h),v!==d.getValueInRange(C)&&(C=h);const S=h.setStartPosition(k.startLineNumber,k.startColumn).setEndPosition(C.endLineNumber,C.endColumn),x=(new GZ).parse(e,!0,r),D=S.getStartPosition(),E=t.adjustWhitespace(d,D,o||y>0&&w!==d.getLineFirstNonWhitespaceColumn(h.positionLineNumber),x);x.resolveVariables(new o2([g,new u2(p,y,b.length,"spread"===i.getOption(76)),new h2(d,h,y,c),new l2(d,h,u),new a2,new d2(f),new f2])),l[y]=WI.replace(S,x.toString()),l[y].identifier={major:y,minor:0},l[y]._isTracked=!0,a[y]=new g2(i,x,E)}return{edits:l,snippets:a}}static createEditsAndSnippetsFromEdits(i,e,s,n,r,o,h){if(!i.hasModel()||0===e.length)return{edits:[],snippets:[]};const c=[],u=i.getModel(),l=new GZ,a=new qZ,d=new o2([i.invokeWithinContext((t=>new c2(t.get(fP),u))),new u2((()=>r),0,i.getSelections().length,"spread"===i.getOption(76)),new h2(u,i.getSelection(),0,o),new l2(u,i.getSelection(),h),new a2,new d2(i.invokeWithinContext((t=>t.get(yP)))),new f2]);e=e.sort(((t,i)=>ws.compareRangesUsingStarts(t.range,i.range)));let f=0;for(let i=0;i<e.length;i++){const{range:s,template:n}=e[i];if(i>0){const t=ws.fromPositions(e[i-1].range.getEndPosition(),s.getStartPosition()),n=new $Z(u.getValueInRange(t));a.appendChild(n),f+=n.value.length}const r=l.parseFragment(n,a);t.adjustWhitespace(u,s.getStartPosition(),!0,a,new Set(r)),a.resolveVariables(d);const o=a.toString(),h=o.slice(f);f=o.length;const g=WI.replace(s,h);g.identifier={major:i,minor:0},g._isTracked=!0,c.push(g)}return l.ensureFinalTabstop(a,s,!0),{edits:c,snippets:[new g2(i,a,"")]}}constructor(t,i,e=p2,s){this._editor=t,this._template=i,this._options=e,this._languageConfigurationService=s,this._templateMerges=[],this._snippets=[]}dispose(){$i(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:i,snippets:e}="string"==typeof this._template?t.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):t.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=e,this._editor.executeEdits("snippet",i,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<e.length;t++)e[t].initialize(i[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):i.map((t=>bs.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=p2){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);const{edits:s,snippets:n}=t.createEditsAndSnippetsFromSelections(this._editor,i,e.overwriteBefore,e.overwriteAfter,!0,e.adjustWhitespace,e.clipboardText,e.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",s,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<n.length;t++)n[t].initialize(i[t].textChange);const e=n[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(n);console.assert(0===n.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>bs.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(ws.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(ws.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(ws.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}};m2=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,_c)],m2);var v2=function(t,i){return function(e,s){i(e,s,t)}};const w2={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let b2=class t{static get(i){return i.getContribution(t.ID)}constructor(i,e,s,n,r){this._editor=i,this._logService=e,this._languageFeaturesService=s,this._languageConfigurationService=r,this._snippetListener=new Vi,this._modelVersionId=-1,this._inSnippet=t.InSnippetMode.bindTo(n),this._hasNextTabstop=t.HasNextTabstop.bindTo(n),this._hasPrevTabstop=t.HasPrevTabstop.bindTo(n)}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?w2:Object.assign(Object.assign({},w2),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 s;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(Mt("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new m2(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(s=this._session)||void 0===s?void 0:s.hasChoice){this._choiceCompletionItemProvider={provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!vs.equals(this._editor.getPosition(),i))return;const{activeChoice:s}=this._session;if(!s||0===s.choice.options.length)return;const n=t.getValueInRange(s.range),r=Boolean(s.choice.options.find((t=>t.value===n))),o=[];for(let t=0;t<s.choice.options.length;t++){const i=s.choice.options[t];o.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:s.range,filterText:r?`${n}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:e(0,"Go to next placeholder...")}})}return{suggestions:o}}};const t=this._languageFeaturesService.completionProvider.register({language:this._editor.getModel().getLanguageId(),pattern:this._editor.getModel().uri.fsPath,scheme:this._editor.getModel().uri.scheme,exclusive:!0},this._choiceCompletionItemProvider);this._snippetListener.add(t)}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(){if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:t}=this._session;t&&this._choiceCompletionItemProvider?this._currentChoice!==t.choice&&(this._currentChoice=t.choice,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._choiceCompletionItemProvider)}))):this._currentChoice=void 0}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())}};b2.ID="snippetController2",b2.InSnippetMode=new Jo("inSnippetMode",!1,e(0,"Whether the editor in current in snippet mode")),b2.HasNextTabstop=new Jo("hasNextTabstop",!1,e(0,"Whether there is a next tab stop when in snippet mode")),b2.HasPrevTabstop=new Jo("hasPrevTabstop",!1,e(0,"Whether there is a previous tab stop when in snippet mode")),b2=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}([v2(1,pa),v2(2,ka),v2(3,Qo),v2(4,_c)],b2),$p(b2.ID,b2,4);const y2=Fp.bindToContribution(b2.get);Pp(new y2({id:"jumpToNextSnippetPlaceholder",precondition:Oo.and(b2.InSnippetMode,b2.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:2}})),Pp(new y2({id:"jumpToPrevSnippetPlaceholder",precondition:Oo.and(b2.InSnippetMode,b2.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:1026}})),Pp(new y2({id:"leaveSnippet",precondition:b2.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:9,secondary:[1033]}})),Pp(new y2({id:"acceptSnippet",precondition:b2.InSnippetMode,handler:t=>t.finish()}));var k2,C2=function(t,i){return function(e,s){i(e,s,t)}},S2=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(k2||(k2={}));let x2=class extends Hi{get isAcceptingPartially(){return this._isAcceptingPartially}get isNavigatingCurrentInlineCompletion(){return this._isNavigatingCurrentInlineCompletion}constructor(t,i,e,s,n,r,o,h,c,u,l,a){let d;var f,g;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=u,this._commandService=l,this._languageConfigurationService=a,this._source=this._register(this._instantiationService.createInstance(X1,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=OQ("isActive",!1),this._forceUpdate=new HQ("forceUpdate"),this._selectedInlineCompletionId=OQ("selectedInlineCompletionId",void 0),this._isAcceptingPartially=!1,this._isNavigatingCurrentInlineCompletion=!1,this._preserveCurrentCompletionReasons=new Set([k2.Redo,k2.Undo,k2.AcceptWord]),this._fetchInlineCompletions=(g=(t,i)=>{if(this._forceUpdate.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();EQ((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)},new IQ("fetch inline completions",g,(f={createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Ds.Automatic}),handleChange:(t,i)=>(t.didChange(this.textModelVersionId)&&this._preserveCurrentCompletionReasons.has(t.change)?i.preserveCurrentCompletion=!0:t.didChange(this._forceUpdate)&&(i.inlineCompletionTriggerKind=t.change),!0)}).createEmptyChangeSummary,f.handleChange)),this._filteredInlineCompletionItems=_Q("filteredInlineCompletionItems",(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=_Q("selectedCachedCompletionIndex",(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=_Q("selectedCachedCompletion",(t=>this._filteredInlineCompletionItems.read(t)[this.selectedInlineCompletionIndex.read(t)])),this.lastTriggerKind=this._source.inlineCompletions.map((t=>null==t?void 0:t.request.context.triggerKind)),this.inlineCompletionsCount=_Q("selectedInlineCompletionsCount",(t=>this.lastTriggerKind.read(t)===Ds.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=_Q("ghostTextAndCompletion",(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=this._source.suggestWidgetInlineCompletions.read(t),r=n?n.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(At),o=s.toSingleTextEdit().removeCommonPrefix(e),h=function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(r,(i=>{let n=i.toSingleTextEdit(t);return n=n.removeCommonPrefix(e,ws.fromPositions(n.range.getStartPosition(),s.range.getEndPosition())),n.augments(o)?{edit:n,completion:i}:void 0}));if(!this._suggestPreviewEnabled.read(t)&&!h)return;const c=null!==(i=null==h?void 0:h.edit)&&void 0!==i?i:o,u=h?h.edit.text.length-o.text.length:0,l=this._suggestPreviewMode.read(t),a=this.cursorPosition.read(t),d=c.computeGhostText(e,l,a,u);return{ghostText:null!=d?d:new P1(c.range.endLineNumber,[]),completion:null==h?void 0:h.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,completion:i,suggestItem:void 0}:void 0}})),this.ghostText=_Q("ghostText",(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(function(t,i){const e=new zQ(i);return t.addObserver(e),t.reportChanges(),Wi((()=>{t.removeObserver(e)}))}(this._fetchInlineCompletions,!0)),this._register(PQ("call handleItemDidShow",(t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.completion;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)}})))}trigger(t){return S2(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return S2(this,void 0,void 0,(function*(){AQ(t,(t=>{this._isActive.set(!0,t),this._forceUpdate.trigger(t,Ds.Explicit)})),yield this._fetchInlineCompletions.get()}))}stop(t){AQ(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_deltaSelectedInlineCompletionIndex(t){return S2(this,void 0,void 0,(function*(){yield this.triggerExplicitly(),this._isNavigatingCurrentInlineCompletion=!0;try{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)}finally{this._isNavigatingCurrentInlineCompletion=!1}}))}next(){return S2(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return S2(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i,e;return S2(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const s=this.ghostText.get(),n=null===(i=this.selectedInlineCompletion.get())||void 0===i?void 0:i.toInlineCompletion(void 0);s&&n&&(t.pushUndoStop(),n.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[WI.replaceMove(n.range,""),...n.additionalTextEdits]),t.setPosition(n.snippetInfo.range.getStartPosition()),null===(e=b2.get(t))||void 0===e||e.insert(n.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[WI.replaceMove(n.range,n.insertText),...n.additionalTextEdits]),n.command&&(yield this._commandService.executeCommand(n.command.id,...n.command.arguments||[]).then(void 0,Ai)),EQ((t=>{this._source.clear(t),this._isActive.set(!1,t)})))}))}acceptNextWord(t){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}))}acceptNextLine(t){this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}_acceptNext(t,i){var e;if(t.getModel()!==this.textModel)throw new Pi;const s=this.ghostText.get(),n=null===(e=this.selectedInlineCompletion.get())||void 0===e?void 0:e.toInlineCompletion(void 0);if(!s||!n)return;if(n.snippetInfo||n.filterText!==n.insertText)return void this.accept(t);if(0===s.parts.length)return;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 u=h.substring(0,c);this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[WI.replace(ws.fromPositions(o),u)]);const i=I1(u);t.setPosition(_1(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ws.fromPositions(n.range.getStartPosition(),_1(o,I1(u))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}};x2=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}([C2(9,eo),C2(10,dp),C2(11,_c)],x2);var D2=function(t,i){return function(e,s){i(e,s,t)}};class E2{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 A2 extends E2{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let L2=class t{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new lu((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===cN.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(i,e){var s;const n=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:i.getLanguageIdAtPosition(e.lineNumber,e.column),resource:i.uri});if((null===(s=this._strategy)||void 0===s?void 0:s.name)!==n){this._saveState();const i=t._strategyCtors.get(n)||A2;this._strategy=new i;try{const i=this._configService.getValue("editor.suggest.shareSuggestSelections"),e=this._storageService.get(`${t._storagePrefix}/${n}`,i?0:1);e&&this._strategy.fromJSON(JSON.parse(e))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const i=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,e=JSON.stringify(this._strategy);this._storageService.store(`${t._storagePrefix}/${this._strategy.name}`,e,i,1)}}};L2._strategyCtors=new Map([["recentlyUsedByPrefix",class extends E2{constructor(){super("recentlyUsedByPrefix"),this._trie=bP.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:xs.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends E2{constructor(){super("recentlyUsed"),this._cache=new TO(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:xs.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",A2]]),L2._storagePrefix="suggest/memories",L2=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}([D2(0,hN),D2(1,ic)],L2);const M2=no("ISuggestMemories");lc(M2,L2,1);let O2=class t{constructor(i,e){this._editor=i,this._enabled=!1,this._ckAtEnd=t.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(119)&&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(119);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)}};O2.AtEnd=new Jo("atEndOfWord",!1),O2=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,Qo)],O2);let F2=class t{constructor(i,e){this._editor=i,this._index=0,this._ckOtherSuggestions=t.OtherSuggestions.bindTo(e)}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:i,index:e},s){0!==i.items.length&&t._moveIndex(!0,i,e)!==e?(this._acceptNext=s,this._model=i,this._index=e,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(i){if(this._model)try{this._ignore=!0,this._index=t._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};F2.OtherSuggestions=new Jo("hasOtherSuggestions",!1),F2=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,Qo)],F2);class T2{constructor(t,i,e,s){this._disposables=new Vi,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||!et(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new tl;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 R2{provideSelectionRanges(t,i){return e=this,s=void 0,r=function*(){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;yield new Promise((i=>R2._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>R2._bracketsLeftYield(e,0,t,s,n,i)))}return e},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=R2._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>R2._maxDuration){setTimeout((()=>R2._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 j,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>=R2._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>R2._maxDuration){setTimeout((()=>R2._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=ws.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=ws.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),R2._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:ws.fromPositions(new vs(s,n),i.getEndPosition())}),e.push({range:ws.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:ws.fromPositions(new vs(r,s),i.getEndPosition())}),e.push({range:ws.fromPositions(new vs(r,1),i.getEndPosition())}))}}}R2._maxDuration=30,R2._maxRounds=2;class _2{static create(t,i){return e=this,s=void 0,r=function*(){if(!i.getOption(114).localityBonus)return _2.None;if(!i.hasModel())return _2.None;const e=i.getModel(),s=i.getPosition();if(!t.canComputeWordRanges(e.uri))return _2.None;const[n]=yield(new R2).provideSelectionRanges(e,[s]);if(0===n.length)return _2.None;const r=yield t.computeWordRanges(e.uri,n[0].range);if(!r)return _2.None;const o=e.getWordUntilPosition(s);return delete r[o.word],new class extends _2{distance(t,e){if(!s.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const o=r["string"==typeof e.label?e.label:e.label.label];if(it(o))return 2<<20;const h=Z(o,ws.fromPositions(t),ws.compareRangesUsingStarts),c=h>=0?o[h]:o[Math.max(0,~h-1)];let u=n.length;for(const t of n){if(!ws.containsRange(t.range,c))break;u-=1}return u}}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}}_2.None=new class extends _2{distance(){return 0}};class I2{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class P2{constructor(t,i,e,s,n,r,o=mF.default,h){this.clipboardText=h,this._snippetCompareFn=P2._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=P2._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=P2._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="",n="";const r=1===this._refilterKind?this._items:this._filteredItems,o=[],h=!this._options.filterGraceful||r.length>2e3?vF:bF;for(let c=0;c<r.length;c++){const u=r[c];if(u.isInvalid)continue;const l=this._itemsByProvider.get(u.provider);l?l.push(u):this._itemsByProvider.set(u.provider,[u]);const a=u.position.column-u.editStart.column,d=a+e-(u.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),n=s.toLowerCase()),u.word=s,0===d)u.score=pF.Default;else{let t=0;for(;t<a;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)u.score=pF.Default;else if("string"==typeof u.completion.filterText){const i=h(s,n,t,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===qn(u.completion.filterText,u.textLabel)?u.score=i:(u.score=eF(s,n,t,u.textLabel,u.labelLow,0),u.score[0]=i[0])}else{const i=h(s,n,t,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;u.score=i}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),o.push(u),t.push(u.textLabel.length)}this._filteredItems=o.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?Q(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 P2._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 P2._compareCompletionItems(t,i)}}var N2=function(t,i){return function(e,s){i(e,s,t)}};class B2{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 $2=class t{constructor(t,i,e,s,n,r,o,h){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._toDispose=new Vi,this._triggerCharacterListener=new Vi,this._triggerQuickSuggest=new cu,this._triggerState=void 0,this._completionDisposables=new Vi,this._onDidCancel=new ee,this._onDidTrigger=new ee,this._onDidSuggest=new ee,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new bs(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 c=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{c=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{c=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{c||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{c||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){$i(this._triggerCharacterListener),$i([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(88)||!this._editor.hasModel()||!this._editor.getOption(117))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(O1.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(60).suppressSuggestions}(this._editor,this._contextKeyService))return;if(B2.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="";sr(i.charCodeAt(i.length-1))?er(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;bJ.isAllOff(this._editor.getOption(86))||this._editor.getOption(114).snippetsPreventQuickSuggestions&&(null===(t=b2.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!B2.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(86);if(!bJ.isAllOff(e)){if(!bJ.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"!==bJ.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(O1.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(O1.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(60).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(87)))}_refilterCompletionItems(){Mt(this._editor.hasModel()),Mt(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new B2(t,i,Object.assign(Object.assign({},this._triggerState),{refilter:!0}));this._onNewContext(e)}trigger(i){var e,s,n,r,o,h;if(!this._editor.hasModel())return;const c=this._editor.getModel(),u=new B2(c,this._editor.getPosition(),i);this.cancel(i.retrigger),this._triggerState=i,this._onDidTrigger.fire({auto:i.auto,shy:null!==(e=i.shy)&&void 0!==e&&e,position:this._editor.getPosition()}),this._context=u;let l={triggerKind:null!==(s=i.triggerKind)&&void 0!==s?s:0};i.triggerCharacter&&(l={triggerKind:1,triggerCharacter:i.triggerCharacter}),this._requestToken=new pe;let a=1;switch(this._editor.getOption(108)){case"top":a=0;break;case"bottom":a=2}const{itemKind:d,showDeprecated:f}=t._createSuggestFilter(this._editor),g=new gJ(a,null!==(r=null===(n=i.completionOptions)||void 0===n?void 0:n.kindFilter)&&void 0!==r?r:d,null===(o=i.completionOptions)||void 0===o?void 0:o.providerFilter,null===(h=i.completionOptions)||void 0===h?void 0:h.providerItemsToReuse,f),p=_2.create(this._editorWorkerService,this._editor),m=mJ(this._languageFeaturesService.completionProvider,c,this._editor.getPosition(),g,l,this._requestToken.token);Promise.all([m,p]).then((([t,e])=>{return s=this,n=void 0,o=function*(){var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==i?void 0:i.clipboardText;if(!n&&t.needsClipboard&&(n=yield this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new B2(r,this._editor.getPosition(),i),h=Object.assign(Object.assign({},mF.default),{firstMatchCanBeWeak:!this._editor.getOption(114).matchOnWordStartOnly});this._completionModel=new P2(t.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(114),this._editor.getOption(108),h,n),this._completionDisposables.add(t.disposable),this._onNewContext(o),this._reportDurationsTelemetry(t.durations)},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o})).catch(Ei)}_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(108)&&i.add(27);const e=t.getOption(114);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(Hn(t.leadingLineContent)===Hn(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(B2.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=B2.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()}};$2=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}([N2(1,$R),N2(2,VR),N2(3,Ap),N2(4,pa),N2(5,Qo),N2(6,ic),N2(7,ka)],$2);class j2{constructor(t,i){this._disposables=new Vi,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)>j2._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()}}j2._maxSelectionLength=51200;var W2=function(t,i){return function(e,s){i(e,s,t)}};class V2 extends LN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=e(0,"{0} ({1})",this._action.label,V2.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let H2=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Lg(t,Rg(".suggest-status-bar"));const r=t=>t instanceof xp?e.createInstance(V2,t,void 0):void 0;this._leftActions=new kR(this.element,{actionViewItemProvider:r}),this._rightActions=new kR(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.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()}};H2=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}([W2(2,eo),W2(3,yp),W2(4,Qo)],H2);class z2{constructor(){let t;this._onDidWillResize=new ee,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ee,this.onDidResize=this._onDidResize.event,this._sashListener=new Vi,this._size=new ng(0,0),this._minSize=new ng(0,0),this._maxSize=new ng(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new EO(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new EO(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new EO(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:wO.North}),this._southSash=new EO(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:wO.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(Qi.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(Qi.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(Qi.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(Qi.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 ng(i,t);ng.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}}function U2(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let K2=class{constructor(t,i){this._editor=t,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ee,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Vi,this._renderDisposeable=new Vi,this._borderWidth=1,this._size=new ng(330,0),this.domNode=Rg(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(RJ,{editor:t}),this._body=Rg(".body"),this._scrollbar=new Fy(this._body,{alwaysConsumeMouseWheel:!0}),Lg(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Lg(this._body,Rg(".header")),this._close=Lg(this._header,Rg("span"+np.asCSSSelector(Ss.close))),this._close.title=e(0,"Close"),this._type=Lg(this._header,Rg("p.type")),this._docs=Lg(this._body,Rg("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(48),e=i.getMassagedFontFamily(),s=t.get(115)||i.fontSize,n=t.get(116)||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(116)||this._editor.getOption(48).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=e(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 MF).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||U2(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,_g(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Kf(this._type),this._type.title="",Ig(this._type),this.domNode.classList.add("no-type");if(Kf(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Kf(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 ng(t,i);ng.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}};K2=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,eo)],K2);class q2{constructor(t,i){let e,s;this.widget=t,this._editor=i,this._disposables=new Vi,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new z2,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=eg(document.body),r=this.widget.getLayoutInfo(),o=new ng(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 ng(e,n.height-t.top-r.borderHeight-r.verticalPadding),u=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:u,minSize:o.with(Math.min(e,o.width))}}(),u=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ng(e,n.height-t.top-r.borderHeight-r.verticalPadding),u=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:u,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ng(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)}}()],l=null!==(s=u.find((t=>t.fit>=0)))&&void 0!==s?s:u.sort(((t,i)=>i.fit-t.fit))[0],a=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(l.maxSizeTop.height,l.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=l.maxSizeTop.height?(d=!0,p=l.maxSizeTop):(d=!1,p=l.maxSizeBottom):f<=l.maxSizeBottom.height?(d=!1,p=l.maxSizeBottom):(d=!0,p=l.maxSizeTop),this._applyTopLeft({left:l.left,top:d?l.top:a-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,l===c,d,l!==c),this._resizable.minSize=l.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 G2;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(G2||(G2={}));const Z2=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function J2(t,i,e,s){const n=s===G2.ROOT_FOLDER?["rootfolder-icon"]:s===G2.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Wf.data)r=rE.parseMetaData(e).get(rE.META_DATA_LABEL);else{const t=e.path.match(Z2);t?(r=Q2(t[2].toLowerCase()),t[1]&&n.push(`${Q2(t[1].toLowerCase())}-name-dir-icon`)):r=Q2(e.authority.toLowerCase())}if(s===G2.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===Wf.data){const t=rE.parseMetaData(e).get(rE.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==Ec?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${Q2(s)}-lang-file-icon`)}}return n}function Q2(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var Y2,X2=function(t,i){return function(e,s){i(e,s,t)}};function t4(t){return`suggest-aria-id:${t}`}const i4=SR("suggest-more-info",Ss.chevronRight,e(0,"Icon for more information in the suggest widget.")),e4=new((Y2=class t{extract(i,e){if(i.textLabel.match(t._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(t._regexStrict))return e[0]=i.completion.detail,!0;if("string"==typeof i.completion.documentation){const s=t._regexRelaxed.exec(i.completion.documentation);if(s&&(0===s.index||s.index+s[0].length===i.completion.documentation.length))return e[0]=s[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*\))/,Y2._regexStrict=new RegExp(`^${Y2._regexRelaxed.source}$`,"i"),Y2);let s4=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ee,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Vi,s=t;s.classList.add("show-file-icons");const n=Lg(t,Rg(".icon")),r=Lg(n,Rg("span.colorspan")),o=Lg(t,Rg(".contents")),h=Lg(o,Rg(".main")),c=Lg(h,Rg(".icon-label.codicon")),u=Lg(h,Rg("span.left")),l=Lg(h,Rg("span.right")),a=new hW(u,{supportHighlights:!0,supportIcons:!0});i.add(a);const d=Lg(u,Rg("span.signature-label")),f=Lg(u,Rg("span.qualifier-label")),g=Lg(l,Rg("span.details-label")),p=Lg(l,Rg("span.readMore"+np.asCSSSelector(i4)));p.title=e(0,"Read More");const m=()=>{const t=this._editor.getOptions(),i=t.get(48),e=i.getMassagedFontFamily(),r=i.fontFeatureSettings,o=t.get(115)||i.fontSize,c=t.get(116)||i.lineHeight,u=i.fontWeight,l=`${c}px`,a=`${i.letterSpacing}px`;s.style.fontSize=`${o}px`,s.style.fontWeight=u,s.style.letterSpacing=a,h.style.fontFamily=e,h.style.fontFeatureSettings=r,h.style.lineHeight=l,n.style.height=l,n.style.width=l,p.style.height=l,p.style.width=l};return m(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(48)||t.hasChanged(115)||t.hasChanged(116))&&m()}))),{root:s,left:u,right:l,icon:n,colorspan:r,iconLabel:a,iconContainer:c,parametersLabel:d,qualifierLabel:f,detailsLabel:g,readMore:p,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=t4(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:sF(t.score)},r=[];if(19===s.kind&&e4.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=J2(this._modelService,this._languageService,os.from({scheme:"fake",path:t.textLabel}),G2.FILE),r=J2(this._modelService,this._languageService,os.from({scheme:"fake",path:s.detail}),G2.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=[J2(this._modelService,this._languageService,os.from({scheme:"fake",path:t.textLabel}),G2.FOLDER),J2(this._modelService,this._languageService,os.from({scheme:"fake",path:s.detail}),G2.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...np.asClassNameArray(xs.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=n4(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=n4(s.label.detail||""),e.detailsLabel.textContent=n4(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(114).showInlineDetails?_g(e.detailsLabel):Ig(e.detailsLabel),U2(t)?(e.right.classList.add("can-expand-details"),_g(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"),Ig(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function n4(t){return t.replace(/\r\n|\r|\n/g,"")}s4=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(1,Zc),X2(2,hc),X2(3,Yy)],s4);var r4=function(t,i){return function(e,s){i(e,s,t)}};fm("editorSuggestWidget.background",{dark:dv,light:dv,hcDark:dv,hcLight:dv},e(0,"Background color of the suggest widget.")),fm("editorSuggestWidget.border",{dark:gv,light:gv,hcDark:gv,hcLight:gv},e(0,"Border color of the suggest widget."));const o4=fm("editorSuggestWidget.foreground",{dark:av,light:av,hcDark:av,hcLight:av},e(0,"Foreground color of the suggest widget."));fm("editorSuggestWidget.selectedForeground",{dark:Lw,light:Lw,hcDark:Lw,hcLight:Lw},e(0,"Foreground color of the selected entry in the suggest widget.")),fm("editorSuggestWidget.selectedIconForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},e(0,"Icon foreground color of the selected entry in the suggest widget."));const h4=fm("editorSuggestWidget.selectedBackground",{dark:Ow,light:Ow,hcDark:Ow,hcLight:Ow},e(0,"Background color of the selected entry in the suggest widget."));fm("editorSuggestWidget.highlightForeground",{dark:dw,light:dw,hcDark:dw,hcLight:dw},e(0,"Color of the match highlights in the suggest widget.")),fm("editorSuggestWidget.focusHighlightForeground",{dark:fw,light:fw,hcDark:fw,hcLight:fw},e(0,"Color of the match highlights in the suggest widget when an item is focused.")),fm("editorSuggestWidgetStatus.foreground",{dark:ab(o4,.5),light:ab(o4,.5),hcDark:ab(o4,.5),hcLight:ab(o4,.5)},e(0,"Foreground color of the suggest widget status."));class c4{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof eG}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ng.is(t))return ng.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let u4=class t{constructor(t,i,s,n,r){this.editor=t,this._storageService=i,this._state=0,this._isAuto=!1,this._pendingLayout=new zi,this._pendingShowDetails=new zi,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new cu,this._disposables=new Vi,this._onDidSelect=new oe,this._onDidFocus=new oe,this._onDidHide=new ee,this._onDidShow=new ee,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ee,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new z2,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new l4(this,t),this._persistedSize=new c4(i,t);class o{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let h;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),h=new o(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),h&&(h.persistHeight=h.persistHeight||!!t.north||!!t.south,h.persistWidth=h.persistWidth||!!t.east||!!t.west),t.done){if(h){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),o=Math.round(t/2);let{width:c,height:u}=this.element.size;(!h.persistHeight||Math.abs(h.currentSize.height-u)<=o)&&(u=null!==(e=null===(i=h.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!h.persistWidth||Math.abs(h.currentSize.width-c)<=o)&&(c=null!==(n=null===(s=h.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ng(c,u))}this._contentWidget.unlockPreference(),h=void 0}}))),this._messageElement=Lg(this.element.domNode,Rg(".message")),this._listElement=Lg(this.element.domNode,Rg(".tree"));const c=r.createInstance(K2,this.editor);c.onDidClose(this.toggleDetails,this,this._disposables),this._details=new q2(c,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(114).showIcons);u();const l=r.createInstance(s4,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new uR("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>e(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:s,description:n}=t.completion.label;s&&n?i=e(0,"{0}{1}, {2}",i,s,n):s?i=e(0,"{0}{1}",i,s):n&&(i=e(0,"{0}, {1}",i,n))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:s,detail:n}=t.completion;return e(0,"{0}, docs: {1}",i,Rn("{0}{1}",n||"",s?"string"==typeof s?s:s.value:""))}}}),this._list.style(wN({listInactiveFocusBackground:h4,listInactiveFocusOutline:bm})),this._status=r.createInstance(H2,this.element.domNode,dJ);const a=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(114).showStatusBar);a(),this._disposables.add(n.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(n.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(114)&&(a(),u())}))),this._ctxSuggestWidgetVisible=aJ.Visible.bindTo(s),this._ctxSuggestWidgetDetailsVisible=aJ.DetailsVisible.bindTo(s),this._ctxSuggestWidgetMultipleSuggestions=aJ.MultipleSuggestions.bindTo(s),this._ctxSuggestWidgetHasFocusedSuggestion=aJ.HasFocusedSuggestion.bindTo(s),this._disposables.add(Qf(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=Hb(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=tu((t=>{return i=this,s=void 0,r=function*(){const i=ou((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose())),n=yield e.resolve(t);return i.dispose(),s.dispose(),n},new((n=void 0)||(n=Promise))((function(t,e){function o(t){try{c(r.next(t))}catch(t){e(t)}}function h(t){try{c(r.throw(t))}catch(t){e(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(i,s||[])).next())}));var i,s,n,r})),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:t4(s)}))})).catch(Ei)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(i){if(this._state!==i)switch(this._state=i,this.element.domNode.classList.toggle("frozen",4===i),this.element.domNode.classList.remove("message"),i){case 0:Ig(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=t.LOADING_MESSAGE,Ig(this._listElement,this._status.element),_g(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=t.NO_SUGGESTIONS_MESSAGE,Ig(this._listElement,this._status.element),_g(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 3:case 4:Ig(this._messageElement),_g(this._listElement,this._status.element),this._show();break;case 5:Ig(this._messageElement),_g(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=ou((()=>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=Yf((()=>{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")):!U2(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=Yf((()=>{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=eg(document.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 ng(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const u=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,l=r.statusBarHeight+this._list.contentHeight+r.borderHeight,a=r.itemHeight+r.statusBarHeight,d=og(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,l),p=d.top+f.top-r.verticalPadding,m=Math.min(p,l);let v=Math.min(Math.max(m,g)+r.borderHeight,l);o===(null===(i=this._cappedHeight)||void 0===i?void 0:i.capped)&&(o=this._cappedHeight.wanted),o<a&&(o=a),o>v&&(o=v),o>g||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),v=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),v=g),this.element.preferredSize=new ng(u,r.defaultSize.height),this.element.maxSize=new ng(c,v),this.element.minSize=new ng(220,a),this._cappedHeight=o===l?{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(48),i=bT(this.editor.getOption(116)||t.lineHeight,8,1e3),e=this.editor.getOption(114).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 ng(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}};u4.LOADING_MESSAGE=e(0,"Loading..."),u4.NO_SUGGESTIONS_MESSAGE=e(0,"No suggestions."),u4=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}([r4(1,hN),r4(2,Qo),r4(3,Yy),r4(4,eo)],u4);class l4{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 ng(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 a4=function(t,i){return function(e,s){i(e,s,t)}};class d4{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:ws.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 f4=class t{static get(i){return i.getContribution(t.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 zi,this._toDispose=new Vi,this._selectors=new g4((t=>t.priority)),this._telemetryGate=0,this.editor=t,this.model=n.createInstance($2,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=aJ.InsertMode.bindTo(s);h.set(t.getOption(114).insertMode),this.model.onDidTrigger((()=>h.set(t.getOption(114).insertMode))),this.widget=this._toDispose.add(new du((()=>{const t=this._instantiationService.createInstance(u4,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new T2(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=aJ.MakesTextEdit.bindTo(this._contextKeyService),s=aJ.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=aJ.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Wi((()=>{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 Od(!0,!1,!1,!1,33))||b&&t.toKeyCodeChord().equals(new Od(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new du((()=>this._toDispose.add(new j2(this.editor,this.model))))),this._alternatives=this._toDispose.add(new du((()=>this._toDispose.add(new F2(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(O2,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new d4(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(114);"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=aJ.AcceptSuggestionsOnEnter.bindTo(s),u=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>u()))),u()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.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=b2.get(this.editor);if(!e)return;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));if(this._memoryService.memorize(s,this.editor.getPosition(),r),Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=_F.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>WI.replaceMove(ws.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!r.isResolved){const t=new Ji(!0);let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=ws.getEndPosition(i.range);e&&!vs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let u=!1;const l=this.editor.onWillType((()=>{l.dispose(),u=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return!1;if(e&&r.completion.additionalTextEdits.some((t=>vs.isBefore(e,ws.getStartPosition(t.range)))))return!1;u&&this.editor.pushUndoStop();const t=_F.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>WI.replaceMove(ws.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!u&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),n.dispose(),l.dispose()})))}let{insertText:u}=r.completion;4&r.completion.insertTextRules||(u=GZ.escape(u)),this.model.cancel(),e.insert(u,{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&&(r.completion.command.id===p4.id?this.model.trigger({auto:!0,retrigger:!0}):o.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch((t=>{r.completion.extensionId?Ai(t):Ei(t)})))),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,t),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e){var s;if(this._telemetryGate++%100!=0)return;const n=t.extensionId?t.extensionId.value:(null!==(s=e.item.provider._debugDisplayName)&&void 0!==s?s:"unknown").split("(",1)[0].toLowerCase();this._telemetryService.publicLog2("suggest.acceptedSuggestion",{providerId:n,kind:t.completion.kind,basenameHash:Ru(JD(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:QD(i.uri)})}getOverwriteInfo(t,i){Mt(this.editor.hasModel());let e="replace"===this.editor.getOption(114).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){et(t.completion.additionalTextEdits)&&Yg(e(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};Qi.once(this.model.onDidTrigger)((()=>{const t=[];Qi.any(this.model.onDidTrigger,this.model.onDidCancel)((()=>{$i(t),e()}),void 0,t),this.model.onDidSuggest((({completionModel:i})=>{if($i(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)}};f4.ID="editor.contrib.suggestController",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}([a4(1,M2),a4(2,dp),a4(3,Qo),a4(4,eo),a4(5,pa),a4(6,Ap)],f4);class g4{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 p4 extends Tp{constructor(){super({id:p4.id,label:e(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Oo.and(PC.writable,PC.hasCompletionItemProvider,aJ.Visible.toNegated()),kbOpts:{kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=f4.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}p4.id="editor.action.triggerSuggest",$p(f4.ID,f4,2),Np(p4);const m4=190,v4=Fp.bindToContribution(f4.get);Pp(new v4({id:"acceptSelectedSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Oo.and(aJ.Visible,PC.textInputFocus),weight:m4},{primary:3,kbExpr:Oo.and(aJ.Visible,PC.textInputFocus,aJ.AcceptSuggestionsOnEnter,aJ.MakesTextEdit),weight:m4}],menuOpts:[{menuId:dJ,title:e(0,"Insert"),group:"left",order:1,when:aJ.HasInsertAndReplaceRange.toNegated()},{menuId:dJ,title:e(0,"Insert"),group:"left",order:1,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("insert"))},{menuId:dJ,title:e(0,"Replace"),group:"left",order:1,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("replace"))}]})),Pp(new v4({id:"acceptAlternativeSelectedSuggestion",precondition:Oo.and(aJ.Visible,PC.textInputFocus,aJ.HasFocusedSuggestion),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:dJ,group:"left",order:2,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("insert")),title:e(0,"Replace")},{menuId:dJ,group:"left",order:2,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("replace")),title:e(0,"Insert")}]})),fp.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),Pp(new v4({id:"hideSuggestWidget",precondition:aJ.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:9,secondary:[1033]}})),Pp(new v4({id:"selectNextSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),Pp(new v4({id:"selectNextPageSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:12,secondary:[2060]}})),Pp(new v4({id:"selectLastSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),Pp(new v4({id:"selectPrevSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),Pp(new v4({id:"selectPrevPageSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:11,secondary:[2059]}})),Pp(new v4({id:"selectFirstSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),Pp(new v4({id:"focusSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),Pp(new v4({id:"focusAndAcceptSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),Pp(new v4({id:"toggleSuggestionDetails",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:dJ,group:"right",order:1,when:Oo.and(aJ.DetailsVisible,aJ.CanResolve),title:e(0,"show less")},{menuId:dJ,group:"right",order:1,when:Oo.and(aJ.DetailsVisible.toNegated(),aJ.CanResolve),title:e(0,"show more")}]})),Pp(new v4({id:"toggleExplainMode",precondition:aJ.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),Pp(new v4({id:"toggleSuggestionFocus",precondition:aJ.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2570,mac:{primary:778}}})),Pp(new v4({id:"insertBestCompletion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),O2.AtEnd,aJ.Visible.toNegated(),F2.OtherSuggestions.toNegated(),b2.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(kt(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:m4,primary:2}})),Pp(new v4({id:"insertNextSuggestion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),F2.OtherSuggestions,aJ.Visible.toNegated(),b2.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2}})),Pp(new v4({id:"insertPrevSuggestion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),F2.OtherSuggestions,aJ.Visible.toNegated(),b2.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:1026}})),Np(class extends Tp{constructor(){super({id:"editor.action.resetSuggestSize",label:e(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=f4.get(i))||void 0===e||e.resetWidgetSize()}});class w4 extends Hi{get selectedItem(){return this._selectedItem}constructor(t,i,e){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=OQ("suggestWidgetInlineCompletionProvider.selectedItem",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 s=f4.get(this.editor);if(s){this._register(s.registerSelector({priority:100,select:(t,i,e)=>{var n;EQ((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(n=this.suggestControllerPreselector())||void 0===n?void 0:n.removeCommonPrefix(r);if(!o)return-1;const h=vs.lift(i),c=vt(e.map(((t,i)=>{const e=b4.fromSuggestion(s,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)),pt((t=>t.prefixLength),mt));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(s.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(s.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(s.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Qi.once(s.model.onDidTrigger)((()=>{i()})))}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,EQ((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=f4.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?b4.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=f4.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=f4.get(this.editor);null==t||t.forceRenderingAbove()}}class b4{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new GZ).parse(r);t.children.length<100&&m2.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new b4(ws.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 Ps(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new V1(this.range,this.insertText)}}var y4=function(t,i){return function(e,s){i(e,s,t)}};let k4=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n,r,o,h){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.model=TQ("inlineCompletionModel",void 0),this.textModelVersionId=OQ("textModelVersionId",-1),this.cursorPosition=OQ("cursorPosition",new vs(1,1)),this.suggestWidgetAdaptor=this._register(new w4(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,k2.Other)))),this._enabled=jQ(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(60).enabled)),this.ghostTextWidget=this._register(this.instantiationService.createInstance($1,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:BQ(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._register(new O1(this.contextKeyService,this.model)),this._register(Qi.runAndSubscribe(t.onDidChangeModel,(()=>EQ((e=>{this.model.set(void 0,e),this.updateObservables(e,k2.Other);const s=t.getModel();if(s){const n=i.createInstance(x2,s,this.suggestWidgetAdaptor.selectedItem,this.cursorPosition,this.textModelVersionId,this._debounceValue,jQ(t.onDidChangeConfiguration,(()=>t.getOption(114).preview)),jQ(t.onDidChangeConfiguration,(()=>t.getOption(114).previewMode)),jQ(t.onDidChangeConfiguration,(()=>t.getOption(60).mode)),this._enabled);this.model.set(n,e)}})))));const c=t=>{var i;return t.isUndoing?k2.Undo:t.isRedoing?k2.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?k2.AcceptWord:k2.Other};let u;this._register(t.onDidChangeModelContent((t=>EQ((i=>this.updateObservables(i,c(t))))))),this._register(t.onDidChangeCursorPosition((t=>EQ((i=>{var e;this.updateObservables(i,k2.Other),3===t.reason&&(null===(e=this.model.get())||void 0===e||e.stop(i))}))))),this._register(t.onDidType((()=>EQ((t=>{var i;this.updateObservables(t,k2.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([UC.Tab.id,UC.DeleteLeft.id,UC.DeleteRight.id,UQ,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&EQ((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this.configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(60).keepOnBlur||sY.dropDownVisible||EQ((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(PQ("forceRenderingAbove",(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(Wi((()=>{this.suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(PQ("play audio cue & read suggestion",(t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.completion){if(e.completion.semanticId!==u){if(u=e.completion.semanticId,i.isNavigatingCurrentInlineCompletion)return;this.audioCueService.playAudioCue(fo.inlineSuggestion).then((()=>{if(this.editor.getOption(6)){const t=i.textModel.getLineContent(e.ghostText.lineNumber);Yg(e.ghostText.renderForScreenReader(t))}}))}}else u=void 0}))),this._register(new tY(this.editor,this.model,this.instantiationService))}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)}};k4.ID="editor.contrib.inlineCompletionsController",k4=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}([y4(1,eo),y4(2,Qo),y4(3,ic),y4(4,dp),y4(5,z_),y4(6,ka),y4(7,lo)],k4);var C4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class S4 extends Tp{constructor(){super({id:S4.ID,label:e(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}S4.ID=qQ;class x4 extends Tp{constructor(){super({id:x4.ID,label:e(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}x4.ID=KQ;class D4 extends Tp{constructor(){super({id:D4.ID,label:e(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:O1.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return C4(this,void 0,void 0,(function*(){const t=k4.get(i);EQ((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}D4.ID="editor.action.inlineSuggest.hide";class E4 extends Dp{constructor(){super({id:E4.ID,title:e(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:bp.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Oo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return C4(this,void 0,void 0,(function*(){const i=t.get(ic),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}E4.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var A4=function(t,i){return function(e,s){i(e,s,t)}};class L4{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 M4=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=k4.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 IZ(1e3,this,ws.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 IZ(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("always"===this._editor.getOption(60).showToolbar)return[];const e=k4.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new L4(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Vi,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(sY,this._editor,!1,BQ(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,s){const n=Rg,r=n("div.hover-row.markdown-hover"),o=Lg(r,n("div.hover-contents",{"aria-live":"assertive"})),h=s.add(new RJ({editor:this._editor},this._languageService,this._openerService));s.add(PQ("update hover",(n=>{var r;const c=null===(r=i.controller.model.read(n))||void 0===r?void 0:r.ghostText.read(n);if(c){const i=this._editor.getModel().getLineContent(c.lineNumber);(i=>{s.add(h.onDidRenderAsync((()=>{o.className="hover-contents code-hover-contents",t.onContentsChanged()})));const n=e(0,"Suggestion:"),r=s.add(h.render((new MF).appendText(n).appendCodeblock("text",i)));o.replaceChildren(r.element)})(c.renderForScreenReader(i))}else Mg(o)}))),t.fragment.appendChild(r)}};function O4(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function F4(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}M4=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}([A4(1,hc),A4(2,W_),A4(3,sh),A4(4,eo),A4(5,Ap)],M4),$p(k4.ID,k4,3),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:e(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:PC.writable})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),Np(S4),Np(x4),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:e(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065},menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.acceptNextWord(t.editor)}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:e(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.acceptNextLine(t.editor)}))}}),Np(class extends Tp{constructor(){super({id:UQ,label:e(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:O1.inlineSuggestionVisible,menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Oo.and(O1.inlineSuggestionVisible,PC.tabMovesFocus.toNegated(),O1.inlineSuggestionHasIndentationLessThanTabSize)}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),Np(D4),Ep(E4),PZ.register(M4);function T4(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(),u=(t,i)=>SC.shiftIndent(t,t.length+(i=i||1),o,h,c),l=(t,i)=>SC.unshiftIndent(t,t.length+(i=i||1),o,h,c),a=[];let d;const f=t.getLineContent(e);let g=f;if(null!=n){d=n;const t=Hn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=l(d),g=d+f.substring(t.length)),f!==g&&a.push(WI.replaceMove(new bs(e,1,e,t.length+1),Zk(d,h,c)))}else d=Hn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=u(p),d=u(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=u(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=Hn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=l(p),d=l(d)),s!==p&&a.push(WI.replaceMove(new bs(i,1,i,s.length+1),Zk(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=u(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?u(p):d)}return a}class R4 extends Tp{constructor(){super({id:R4.ID,label:e(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:PC.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new H4(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}R4.ID="editor.action.indentationToSpaces";class _4 extends Tp{constructor(){super({id:_4.ID,label:e(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:PC.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new z4(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}_4.ID="editor.action.indentationToTabs";class I4 extends Tp{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const s=t.get(Kj),n=t.get(Zc),r=i.getModel();if(!r)return;const o=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget),h=r.getOptions(),c=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===o.tabSize&&t===h.tabSize?e(0,"Configured Tab Size"):t===o.tabSize?e(0,"Default Tab Size"):t===h.tabSize?e(0,"Current Tab Size"):void 0}))),u=Math.min(r.getOptions().tabSize-1,7);setTimeout((()=>{s.pick(c,{placeHolder:e(0,"Select Tab Size for Current File"),activeItem:c[u]}).then((t=>{if(t&&r&&!r.isDisposed()){const i=parseInt(t.label,10);r.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class P4 extends I4{constructor(){super(!1,!1,{id:P4.ID,label:e(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}P4.ID="editor.action.indentUsingTabs";class N4 extends I4{constructor(){super(!0,!1,{id:N4.ID,label:e(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}N4.ID="editor.action.indentUsingSpaces";class B4 extends I4{constructor(){super(!0,!0,{id:B4.ID,label:e(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}B4.ID="editor.action.changeTabDisplaySize";class $4 extends Tp{constructor(){super({id:$4.ID,label:e(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Zc),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}$4.ID="editor.action.detectIndentation";class j4{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(ws.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 W4=class{constructor(t,i){this.editor=t,this._languageConfigurationService=i,this.callOnDispose=new Vi,this.callOnModel=new Vi,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(10)<4||this.editor.getOption(53)||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(10),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>SC.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>SC.unshiftIndent(t,t.length+1,n,r,o)};let u=t.startLineNumber;for(;u<=t.endLineNumber&&this.shouldIgnoreLine(e,u);)u++;if(u>t.endLineNumber)return;let l=e.getLineContent(u);if(!/\S/.test(l.substring(0,t.startColumn-1))){const t=AC(s,e,e.getLanguageId(),u,c,this._languageConfigurationService);if(null!==t){const i=Hn(l),s=O4(t,n);if(s!==O4(i,n)){const t=F4(s,n,o);h.push({range:new ws(u,1,u,i.length+1),text:t}),l=t+l.substr(i.length)}else{const t=LC(e,u,this._languageConfigurationService);if(0===t||8===t)return}}}const a=u;for(;u<t.endLineNumber&&!/\S/.test(e.getLineContent(u+1));)u++;if(u!==t.endLineNumber){const i=AC(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===a?l:e.getLineContent(t)},e.getLanguageId(),u+1,c,this._languageConfigurationService);if(null!==i){const s=O4(i,n),r=O4(Hn(e.getLineContent(u+1)),n);if(s!==r){const i=s-r;for(let s=u+1;s<=t.endLineNumber;s++){const t=Hn(e.getLineContent(s)),r=F4(O4(t,n)+i,n,o);r!==t&&h.push({range:new ws(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new j4(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 V4(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 ws(e,1,e,o),c=t.getValueInRange(h),u=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,u)}}W4.ID="editor.contrib.autoIndentOnPaste",W4=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,_c)],W4);class H4{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),V4(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class z4{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),V4(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}$p(W4.ID,W4,2),Np(R4),Np(_4),Np(P4),Np(N4),Np(B4),Np($4),Np(class extends Tp{constructor(){super({id:"editor.action.reindentlines",label:e(0,"Reindent Lines"),alias:"Reindent Lines",precondition:PC.writable})}run(t,i){const e=t.get(_c),s=i.getModel();if(!s)return;const n=T4(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),Np(class extends Tp{constructor(){super({id:"editor.action.reindentselectedlines",label:e(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:PC.writable})}run(t,i){const e=t.get(_c),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=T4(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});var U4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class K4{constructor(t,i){this.range=t,this.direction=i}}class q4{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new q4(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return U4(this,void 0,void 0,(function*(){if("function"==typeof this.provider.resolveInlayHint){if(this._currentResolve){if(yield this._currentResolve,t.isCancellationRequested)return;return this.resolve(t)}this._isResolved||(this._currentResolve=this._doResolve(t).finally((()=>this._currentResolve=void 0))),yield this._currentResolve}}))}_doResolve(t){var i,e;return U4(this,void 0,void 0,(function*(){try{const s=yield 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){Ai(t),this._isResolved=!1}}))}}class G4{static create(t,i,e,s){return U4(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>U4(this,void 0,void 0,(function*(){try{const r=yield t.provideInlayHints(i,e,s);(null==r?void 0:r.hints.length)&&n.push([r,t])}catch(t){Ai(t)}}))))));if(yield Promise.all(r.flat()),s.isCancellationRequested||i.isDisposed())throw new Fi;return new G4(e,n,i)}))}constructor(t,i,e){this._disposables=new Vi,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=G4._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=ws.fromPositions(o.getStartPosition(),t),r="after"):(h=ws.fromPositions(t,o.getEndPosition()),r="before"),s.push(new q4(i,new K4(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 ws(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 ws(e,h+1,e,c+1)}}var Z4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function J4(t,i,e,s){var n;return Z4(this,void 0,void 0,(function*(){const r=t.get(ep),o=t.get(zR),h=t.get(dp),c=t.get(eo),u=t.get(IM);if(yield s.item.resolve(fe.None),!s.part.location)return;const l=s.part.location,a=[],d=new Set(Cp.getMenuItems(bp.EditorContext).map((t=>wp(t)?t.command.id:EY())));for(const t of wZ.all())d.has(t.desc.id)&&a.push(new op(t.desc.id,xp.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>Z4(this,void 0,void 0,(function*(){const e=yield r.createModelReference(l.uri);try{const n=new vZ(e.object.textEditorModel,ws.getStartPosition(l.range)),r=s.item.anchor.range;yield c.invokeFunction(t.runEditorCommand.bind(t),i,n,r)}finally{e.dispose()}})))));if(s.part.command){const{command:t}=s.part;a.push(new cp),a.push(new op(t.id,t.title,void 0,!0,(()=>Z4(this,void 0,void 0,(function*(){var i;try{yield h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){u.notify({severity:_M.Error,source:s.item.provider.displayName,message:t})}})))))}const f=i.getOption(123);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=og(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function Q4(t,i,e,s){return Z4(this,void 0,void 0,(function*(){const n=t.get(ep),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>Z4(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Qo),h=dG.inPeekEditor.getValue(o),c=!n&&e.getOption(85)&&!h;return new bZ({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new vZ(r.object.textEditorModel,ws.getStartPosition(s.range)),ws.lift(s.range))})))),r.dispose()}))}var Y4=function(t,i){return function(e,s){i(e,s,t)}},X4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class t5{constructor(){this._entries=new TO(50)}get(t){const i=t5._key(t);return this._entries.get(i)}set(t,i){const e=t5._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const i5=no("IInlayHintsCache");lc(i5,t5,1);class e5{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 s5{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let n5=class t{static get(i){var e;return null!==(e=i.getContribution(t.ID))&&void 0!==e?e: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 Vi,this._sessionDisposables=new Vi,this._decorationsMetadata=new Map,this._ruleFactory=new Lb(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(136)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(136);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(Wi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new lu((()=>X4(this,void 0,void 0,(function*(){const t=Date.now();null==s||s.dispose(!0),s=new pe;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const o=s.token,h=yield G4.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),o);if(r.delay=this._debounceInfo.update(i,Date.now()-t),o.isCancellationRequested)return void h.dispose();for(const t of h.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(h),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(i)}catch(t){Ei(t)}finally{s.dispose(),e.dispose()}}))),this._debounceInfo.get(i));if(this._sessionDisposables.add(r),this._sessionDisposables.add(Wi((()=>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(Vg.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 Vi,i=t.add(new tG(this._editor)),e=new Vi;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(Wi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new s5(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new ws(o,1,o,n.getLineMaxColumn(o)),c=this._getInlineHintsForRange(h);this._updateHintsDecorators([h],c),e.add(Wi((()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([h],c)})))}))),t.add(i.onCancel((()=>e.clear()))),t.add(i.onExecute((t=>X4(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(Q4,t,this._editor,e.location):Ms.is(e.command)&&(yield 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((i=>X4(this,void 0,void 0,(function*(){if(2!==i.event.detail)return;const e=this._getInlayHintLabelPart(i);if(e&&(i.event.preventDefault(),yield e.item.resolve(fe.None),et(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>WI.replace(ws.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>X4(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(J4,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 eL&&(null==e?void 0:e.attachedData)instanceof e5?e.attachedData:void 0}_invokeCommand(t,i){var e;return X4(this,void 0,void 0,(function*(){try{yield this._commandService.executeCommand(t.id,...null!==(e=t.arguments)&&void 0!==e?e:[])}catch(t){this._notificationService.notify({severity:_M.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 K4(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(ws.compareRangesUsingStarts)){const i=t.validateRange(new ws(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&ws.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=ws.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(i,e){var s,n;const r=[],o=(t,i,e,s,n)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:n};r.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}}})},h=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(c/3|0)+"px",display:"inline-block"});o(t,e," ",i?dh.Right:dh.None)},{fontSize:c,fontFamily:u,padding:l,isUniform:a}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,u);for(const i of e){i.hint.paddingLeft&&h(i,!1);const e="string"==typeof i.hint.label?[{label:i.hint.label}]:i.hint.label;for(let t=0;t<e.length;t++){const n=e[t],r=0===t,h=t===e.length-1,u={fontSize:`${c}px`,fontFamily:`var(${d}), ${ki.fontFamily}`,verticalAlign:a?"baseline":"middle",unicodeBidi:"isolate"};et(i.hint.textEdits)&&(u.cursor="default"),this._fillInColors(u,i.hint),(n.command||n.location)&&(null===(s=this._activeInlayHintPart)||void 0===s?void 0:s.part.item)===i&&this._activeInlayHintPart.part.index===t&&(u.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(u.color=Xy(Nv),u.cursor="pointer")),l&&(r&&h?(u.padding=`1px ${0|Math.max(1,c/4)}px`,u.borderRadius=(c/4|0)+"px"):r?(u.padding=`1px 0 1px ${0|Math.max(1,c/4)}px`,u.borderRadius=`${c/4|0}px 0 0 ${c/4|0}px`):h?(u.padding=`1px ${0|Math.max(1,c/4)}px 1px 0`,u.borderRadius=`0 ${c/4|0}px ${c/4|0}px 0`):u.padding="1px 0 1px 0"),o(i,this._ruleFactory.createClassNameRef(u),n.label.replace(/[ \t]/g," "),h&&!i.hint.paddingRight?dh.Right:dh.None,new e5(i,t))}if(i.hint.paddingRight&&h(i,!0),r.length>t._MAX_DECORATORS)break}const f=[];for(const t of i)for(const{id:i}of null!==(n=this._editor.getDecorationsInRange(t))&&void 0!==n?n:[]){const t=this._decorationsMetadata.get(i);t&&(f.push(i),t.classNameRef.dispose(),this._decorationsMetadata.delete(i))}const g=_F.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,r.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],r[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===Os.Parameter?(t.backgroundColor=Xy(Hv),t.color=Xy(Vv)):i.kind===Os.Type?(t.backgroundColor=Xy(Wv),t.color=Xy(jv)):(t.backgroundColor=Xy($v),t.color=Xy(Bv))}_getLayoutInfo(){const t=this._editor.getOption(136),i=t.padding,e=this._editor.getOption(50),s=this._editor.getOption(47);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()}};n5.ID="editor.contrib.InlayHints",n5._MAX_DECORATORS=1500,n5=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}([Y4(1,ka),Y4(2,z_),Y4(3,i5),Y4(4,dp),Y4(5,IM),Y4(6,eo)],n5),fp.registerCommand("_executeInlayHintProvider",((t,...i)=>X4(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(os.isUri(e)),Mt(ws.isIRange(s));const{inlayHintsProvider:n}=t.get(ka),r=yield t.get(ep).createModelReference(e);try{const t=yield G4.create(n,r.object.textEditorModel,[ws.lift(s)],fe.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}))));var r5=function(t,i){return function(e,s){i(e,s,t)}},o5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class h5 extends IZ{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let c5=class extends HJ{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!n5.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 eL&&e.attachedData instanceof e5?new h5(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,s){return t instanceof h5?new pu((i=>o5(this,void 0,void 0,(function*(){var n,r,o;const{part:h}=t;if(yield h.item.resolve(s),s.isCancellationRequested)return;let c,u;if("string"==typeof h.item.hint.tooltip?c=(new MF).appendText(h.item.hint.tooltip):h.item.hint.tooltip&&(c=h.item.hint.tooltip),c&&i.emitOne(new VJ(this,t.range,[c],!1,0)),et(h.item.hint.textEdits)&&i.emitOne(new VJ(this,t.range,[(new MF).appendText(e(0,"Double-click to insert"))],!1,10001)),"string"==typeof h.part.tooltip?u=(new MF).appendText(h.part.tooltip):h.part.tooltip&&(u=h.part.tooltip),u&&i.emitOne(new VJ(this,t.range,[u],!1,1)),h.part.location||h.part.command){let s;const n=e(0,"altKey"===this._editor.getOption(75)?b?"cmd + click":"ctrl + click":b?"option + click":"alt + click");h.part.location&&h.part.command?s=(new MF).appendText(e(0,"Go to Definition ({0}), right click for more",n)):h.part.location?s=(new MF).appendText(e(0,"Go to Definition ({0})",n)):h.part.command&&(s=new MF(`[${e(0,"Execute Command")}](${l=h.part.command,os.from({scheme:Wf.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${h.part.command.title}") (${n})`,{isTrusted:!0})),s&&i.emitOne(new VJ(this,t.range,[s],!1,1e4))}var l;const a=yield this._resolveInlayHintLabelPartHover(h,s);try{for(var d,f=!0,g=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,e=t[Symbol.asyncIterator];return e?e.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(e){i[e]=t[e]&&function(i){return new Promise((function(s,n){!function(t,i,e,s){Promise.resolve(s).then((function(i){t({value:i,done:e})}),i)}(s,n,(i=t[e](i)).done,i.value)}))}}}(a);!(n=(d=yield g.next()).done);f=!0)f=!1,i.emitOne(d.value)}catch(t){r={error:t}}finally{try{f||n||!(o=g.return)||(yield o.call(g))}finally{if(r)throw r.error}}})))):pu.EMPTY}_resolveInlayHintLabelPartHover(t,i){return o5(this,void 0,void 0,(function*(){if(!t.part.location)return pu.EMPTY;const{uri:e,range:s}=t.part.location,n=yield this._resolverService.createModelReference(e);try{const e=n.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(e)?$J(this._languageFeaturesService.hoverProvider,e,new vs(s.startLineNumber,s.startColumn),i).filter((t=>!OF(t.hover.contents))).map((i=>new VJ(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):pu.EMPTY}finally{n.dispose()}}))}};c5=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}([r5(1,hc),r5(2,W_),r5(3,ic),r5(4,ep),r5(5,ka)],c5),$p(n5.ID,n5,1),PZ.register(c5);class u5{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 bs(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new bs(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}let l5=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(i,e){var s;null===(s=this.currentRequest)||void 0===s||s.cancel();const n=this.editor.getSelection(),r=this.editor.getModel();if(!r||!n)return;let o=n;if(o.startLineNumber!==o.endLineNumber)return;const h=new zH(this.editor,5),c=r.uri;return this.editorWorkerService.canNavigateValueSet(c)?(this.currentRequest=tu((()=>this.editorWorkerService.navigateValueSet(c,o,e))),this.currentRequest.then((e=>{var s;if(!e||!e.range||!e.value)return;if(!h.validate(this.editor))return;const n=ws.lift(e.range);let r=e.range;const c=e.value.length-(o.endColumn-o.startColumn);r={startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.startColumn+e.value.length},c>1&&(o=new bs(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+c-1));const u=new u5(n,o,e.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,u),this.editor.pushUndoStop(),this.decorations.set([{range:r,options:t.DECORATION}]),null===(s=this.decorationRemover)||void 0===s||s.cancel(),this.decorationRemover=ru(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};l5.ID="editor.contrib.inPlaceReplaceController",l5.DECORATION=sL.register({description:"in-place-replace",className:"valueSetReplacement"}),l5=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,$R)],l5),$p(l5.ID,l5,4),Np(class extends Tp{constructor(){super({id:"editor.action.inPlaceReplace.up",label:e(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=l5.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),Np(class extends Tp{constructor(){super({id:"editor.action.inPlaceReplace.down",label:e(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=l5.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),Np(class extends Tp{constructor(){super({id:"expandLineSelection",label:e(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:PC.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,wC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class a5{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 u=0;if(n<r&&i[n].lineNumber===o&&(u=i[n].column,n++,u===c))continue;if(0===h.length)continue;const l=zn(h);let a=0;if(-1===l)a=1;else{if(l===h.length-1)continue;a=l+2}a=Math.max(u,a),e[s++]=WI.delete(new ws(o,a,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 d5{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 ws(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new ws(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new ws(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=bs.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let f5=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 ws(1,1,1,1),null):(i.addEditOperation(new ws(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new ws(n,1,n,t.getLineMaxColumn(n)),null)),s=new bs(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new ws(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let u=r;if(this.shouldAutoIndent(t,s)){const l=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==l){const i=F4(l+O4(Hn(t.getLineContent(e)),n),n,o);u=i+this.trimLeft(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=AC(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=Hn(t.getLineContent(e)),h=O4(i,n);if(h!==O4(s,n)){const t=F4(h,n,o);u=t+this.trimLeft(r)}}}i.addEditOperation(new ws(s.startLineNumber,1,s.startLineNumber,1),u+"\n");const a=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,u);if(null!==a)0!==a&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,a);else{c.getLineContent=i=>i===s.startLineNumber?u:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=AC(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=Hn(t.getLineContent(s.startLineNumber)),h=O4(r,n),c=O4(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new ws(s.startLineNumber,1,s.startLineNumber,1),u+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new ws(e,1,e+1,1),null),i.addEditOperation(new ws(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=AC(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=Hn(t.getLineContent(s.startLineNumber)),h=O4(r,n),c=O4(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=>SC.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>SC.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===fh.None||n.indentAction===fh.Indent?r=n.indentation+n.appendText:n.indentAction===fh.IndentOutdent?r=n.indentation:n.indentAction===fh.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimLeft(o).indexOf(this.trimLeft(r))>=0){const n=Hn(t.getLineContent(s));let o=Hn(r);const h=LC(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),O4(o,e)-O4(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(zn(r)>=0){const r=t.getLineMaxColumn(n),o=yC(this._autoIndent,t,new ws(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(zn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=yC(this._autoIndent,t,new ws(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),zn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=yC(this._autoIndent,t,new ws(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimLeft(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=Hn(t.getLineContent(o)),c=F4(O4(h,s)+r,s,n);c!==h&&(i.addEditOperation(new ws(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}};f5=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,_c)],f5);class g5{static getCollator(){return g5._COLLATOR||(g5._COLLATOR=new Intl.Collator),g5._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=p5(t,i,e);return s?WI.replace(new ws(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=p5(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 p5(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(g5.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}g5._COLLATOR=null;class m5 extends Tp{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)=>ws.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 d5(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class v5 extends Tp{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(_c),s=[],n=i.getSelections()||[],r=i.getOption(10);for(const t of n)s.push(new f5(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class w5 extends Tp{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!g5.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new g5(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class b5 extends Tp{constructor(){super({id:b5.ID,label:e(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:PC.writable,kbOpts:{kbExpr:PC.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 a5(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}b5.ID="editor.action.trimTrailingWhitespace";class y5 extends Tp{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===ws.intersectRanges(i,e)?n.push(i):s[t+1]=ws.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>WI.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class k5 extends Tp{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(126),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new ws(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(WI.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(WI.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class C5{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 S5 extends k5{constructor(){super({id:"editor.action.transformToTitlecase",label:e(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:PC.writable})}_modifyText(t,i){const e=S5.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}S5.titleBoundary=new C5("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class x5 extends k5{constructor(){super({id:"editor.action.transformToSnakecase",label:e(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:PC.writable})}_modifyText(t,i){const e=x5.caseBoundary.get(),s=x5.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}x5.caseBoundary=new C5("(\\p{Ll})(\\p{Lu})","gmu"),x5.singleLetters=new C5("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class D5 extends k5{constructor(){super({id:"editor.action.transformToCamelcase",label:e(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:PC.writable})}_modifyText(t,i){const e=D5.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("")}}D5.wordBoundary=new C5("[_\\s-]","gm");class E5 extends k5{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:e(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:PC.writable})}_modifyText(t,i){const e=E5.caseBoundary.get(),s=E5.singleLetters.get(),n=E5.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}E5.caseBoundary=new C5("(\\p{Ll})(\\p{Lu})","gmu"),E5.singleLetters=new C5("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),E5.underscoreBoundary=new C5("(\\S)(_)(\\S)","gm"),Np(class extends m5{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:e(0,"Copy Line Up"),alias:"Copy Line Up",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"&&Copy Line Up"),order:1}})}}),Np(class extends m5{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:e(0,"Copy Line Down"),alias:"Copy Line Down",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Co&&py Line Down"),order:2}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.duplicateSelection",label:e(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:PC.writable,menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(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 d5(t,!0));else{const i=new bs(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new cC(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),Np(class extends v5{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:e(0,"Move Line Up"),alias:"Move Line Up",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Mo&&ve Line Up"),order:3}})}}),Np(class extends v5{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:e(0,"Move Line Down"),alias:"Move Line Down",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Move &&Line Down"),order:4}})}}),Np(class extends w5{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:e(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:PC.writable})}}),Np(class extends w5{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:e(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:PC.writable})}}),Np(class extends Tp{constructor(){super({id:"editor.action.removeDuplicateLines",label:e(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:PC.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 bs(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,u=new bs(c,1,c+o.length-1,o[o.length-1].length);s.push(WI.replace(h,o.join("\n"))),n.push(u),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),Np(b5),Np(class extends Tp{constructor(){super({id:"editor.action.deleteLines",label:e(0,"Delete Line"),alias:"Delete Line",precondition:PC.writable,kbOpts:{kbExpr:PC.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,u=1,l=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,l=1):h>1&&(h-=1,u=s.getLineMaxColumn(h)),r.push(WI.replace(new bs(h,u,c,l),"")),o.push(new bs(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}}),Np(class extends Tp{constructor(){super({id:"editor.action.indentLines",label:e(0,"Indent Line"),alias:"Indent Line",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),Np(class extends Tp{constructor(){super({id:"editor.action.outdentLines",label:e(0,"Outdent Line"),alias:"Outdent Line",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2140,weight:100}})}run(t,i){UC.Outdent.runEditorCommand(t,i,null)}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertLineBefore",label:e(0,"Insert Line Above"),alias:"Insert Line Above",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertLineAfter",label:e(0,"Insert Line Below"),alias:"Insert Line Below",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),Np(class extends y5{constructor(){super({id:"deleteAllLeft",label:e(0,"Delete All Left"),alias:"Delete All Left",precondition:PC.writable,kbOpts:{kbExpr:PC.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 bs(t,i.startColumn,t,i.startColumn)}else r=new bs(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(ws.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.getLineContent(i).length+1;return new ws(i,e,t.startLineNumber,1)}return new ws(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new ws(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),Np(class extends y5{constructor(){super({id:"deleteAllRight",label:e(0,"Delete All Right"),alias:"Delete All Right",precondition:PC.writable,kbOpts:{kbExpr:PC.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 bs(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 ws(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new ws(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(ws.compareRangesUsingStarts),s}}),Np(class extends Tp{constructor(){super({id:"editor.action.joinLines",label:e(0,"Join Lines"),alias:"Join Lines",precondition:PC.writable,kbOpts:{kbExpr:PC.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(ws.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 bs(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new bs(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let u=s,l=0;for(let t=0,i=n.length;t<i;t++){const i=n[t],e=i.startLineNumber,r=1;let a,d,f=0;const g=o.getLineContent(i.endLineNumber).length-i.endColumn;if(i.isEmpty()||i.startLineNumber===i.endLineNumber){const t=i.getStartPosition();t.lineNumber<o.getLineCount()?(a=e+1,d=o.getLineMaxColumn(a)):(a=t.lineNumber,d=o.getLineMaxColumn(t.lineNumber))}else a=i.endLineNumber,d=o.getLineMaxColumn(a);let p=o.getLineContent(e);for(let t=e+1;t<=a;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 ws(e,r,a,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(WI.replace(m,p)),t=new bs(m.startLineNumber-l,p.length-f+1,e-l,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(WI.replace(m,p)),t=new bs(i.startLineNumber-l,i.startColumn,i.endLineNumber-l,i.endColumn)):(h.push(WI.replace(m,p)),t=new bs(i.startLineNumber-l,i.startColumn,i.startLineNumber-l,p.length-g)),null!==ws.intersectRanges(m,s)?u=t:c.push(t)}l+=m.endLineNumber-m.startLineNumber}c.unshift(u),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),Np(class extends Tp{constructor(){super({id:"editor.action.transpose",label:e(0,"Transpose characters around the cursor"),alias:"Transpose characters around the cursor",precondition:PC.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 ws(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new hC(new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new ws(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new aC(t,i,new bs(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),Np(class extends k5{constructor(){super({id:"editor.action.transformToUppercase",label:e(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:PC.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),Np(class extends k5{constructor(){super({id:"editor.action.transformToLowercase",label:e(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:PC.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),x5.caseBoundary.isSupported()&&x5.singleLetters.isSupported()&&Np(x5),D5.wordBoundary.isSupported()&&Np(D5),S5.titleBoundary.isSupported()&&Np(S5),E5.isSupported()&&Np(E5);var A5=function(t,i){return function(e,s){i(e,s,t)}},L5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const M5=new Jo("LinkedEditingInputVisible",!1);let O5=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){super(),this.languageConfigurationService=s,this._syncRangesToken=0,this._localToDispose=this._register(new Vi),this._editor=t,this._providers=e.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=M5.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 Vi),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(67)||t.hasChanged(89))&&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(67)||this._editor.getOption(89))&&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(Qi.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new su(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 su(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=tr(t,r);o+=c,t=t.substr(c),r=r.substr(c);const u=ir(t,r);h-=u,t=t.substr(0,t.length-u),r=r.substr(0,r.length-u),o===h&&0===r.length||n.push({range:new ws(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)}updateRanges(i=!1){return L5(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return void this.clearRanges();const e=this._editor.getPosition();if(!this._enabled&&!i||this._editor.getSelections().length>1)return void this.clearRanges();const s=this._editor.getModel(),n=s.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(e.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(e))return}}this.clearRanges(),this._currentRequestPosition=e,this._currentRequestModelVersion=n;const r=tu((i=>L5(this,void 0,void 0,(function*(){try{const o=new Ji(!1),h=yield F5(this._providers,s,e,i);if(this._debounceInformation.update(s,o.elapsed()),r!==this._currentRequest)return;if(this._currentRequest=null,n!==s.getVersionId())return;let c=[];(null==h?void 0:h.ranges)&&(c=h.ranges),this._currentWordPattern=(null==h?void 0:h.wordPattern)||this._languageWordPattern;let u=!1;for(let t=0,i=c.length;t<i;t++)if(ws.containsPosition(c[t],e)){if(u=!0,0!==t){const i=c[t];c.splice(t,1),c.unshift(i)}break}if(!u)return void this.clearRanges();const l=c.map((i=>({range:i,options:t.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Ei(t),this._currentRequest!==r&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=r,r}))}};function F5(t,i,e,s){return hu(t.ordered(i).map((t=>()=>L5(this,void 0,void 0,(function*(){try{return yield t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Ai(t)}})))),(t=>!!t&&et(null==t?void 0:t.ranges)))}O5.ID="editor.contrib.linkedEditing",O5.DECORATION=sL.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),O5=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}([A5(1,Qo),A5(2,ka),A5(3,_c),A5(4,z_)],O5),Pp(new(Fp.bindToContribution(O5.get))({id:"cancelLinkedEditingInput",precondition:M5,handler:t=>t.clearRanges(),kbOpts:{kbExpr:PC.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),fm("editor.linkedEditingBackground",{dark:ea.fromHex("#f00").transparent(.3),light:ea.fromHex("#f00").transparent(.3),hcDark:ea.fromHex("#f00").transparent(.3),hcLight:ea.white},e(0,"Background color when the editor auto renames on type.")),Ip("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(ka);return F5(s,i,e,fe.None)})),$p(O5.ID,O5,1),Np(class extends Tp{constructor(){super({id:"editor.action.linkedEditing",label:e(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Oo.and(PC.writable,PC.hasRenameProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(ro),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return os.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)))))}),Ei):super.runCommand(t,i)}run(t,i){const e=O5.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var T5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class R5{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}resolve(t){return T5(this,void 0,void 0,(function*(){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 _5{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new R5(t,s)));i=_5._union(i,t),Bi(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];ws.areIntersectingOrTouching(n.range,o.range)?s++:ws.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 I5(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])}),Ai)));return Promise.all(n).then((()=>{const t=new _5(X(s));return e.isCancellationRequested?(t.dispose(),new _5([])):t}))}fp.registerCommand("_executeLinkProvider",((t,...i)=>T5(void 0,void 0,void 0,(function*(){let[e,s]=i;Mt(e instanceof os),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(ka),r=t.get(Zc).getModel(e);if(!r)return[];const o=yield I5(n,r,fe.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)yield o.links[t].resolve(fe.None);const h=o.links.slice(0);return o.dispose(),h}))));var P5=function(t,i){return function(e,s){i(e,s,t)}};let N5=class t extends Hi{static get(i){return i.getContribution(t.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 lu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new tG(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(68)&&(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)}computeLinksNow(){return t=this,i=void 0,s=function*(){if(!this.editor.hasModel()||!this.editor.getOption(68))return;const t=this.editor.getModel();if(this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=tu((i=>I5(this.providers,t,i)));try{const i=new Ji(!1);if(this.activeLinksList=yield this.computePromise,this.debounceInformation.update(t,i.elapsed()),t.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Ei(t)}finally{this.computePromise=null}}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}updateDecorations(t){const i="altKey"===this.editor.getOption(75),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($5.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 $5(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(75);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(75);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,s=!1){if(!this.openerService)return;const{link:n}=t;n.resolve(fe.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===Wf.file&&t.startsWith(`${Wf.file}:`)){const e=os.parse(t);if(e.scheme===Wf.file){const s=KD(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=XD(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:s,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(e(0,"Failed to open this link because it is not well-formed: {0}",n.url.toString())):"missing"===i?this.notificationService.warn(e(0,"Failed to open this link because its target is missing.")):Ei(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()}};N5.ID="editor.linkDetector",N5=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}([P5(1,W_),P5(2,IM),P5(3,ka),P5(4,z_)],N5);const B5={general:sL.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:sL.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class $5{static decoration(t,i){return{range:t.range,options:$5._getOptions(t,i,!1)}}static _getOptions(t,i,s){const n=Object.assign({},s?B5.active:B5.general);return n.hoverMessage=function(t,i){const s=t.url&&/^command:/i.test(t.url.toString()),n=t.tooltip?t.tooltip:e(0,s?"Execute command":"Follow link"),r=e(0,i?b?"cmd + click":"ctrl + click":b?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const s=t.url.toString().match(/^command:([^?#]+)/);s&&(i=e(0,"Execute command {0}",s[1]))}return new MF("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),n,i).appendMarkdown(` (${r})`)}return(new MF).appendText(`${n} (${r})`)}(t,i),n}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,$5._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,$5._getOptions(this.link,i,!1))}}$p(N5.ID,N5,1),Np(class extends Tp{constructor(){super({id:"editor.action.openLink",label:e(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=N5.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 j5 extends Hi{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(113);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}j5.ID="editor.contrib.longLinesHelper",$p(j5.ID,j5,2);const W5=fm("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},e(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);fm("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},e(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),fm("editor.wordHighlightTextBackground",{light:W5,dark:W5,hcDark:W5,hcLight:W5},e(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 V5=fm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:bm,hcLight:bm},e(0,"Border color of a symbol during read-access, like reading a variable."));fm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:bm,hcLight:bm},e(0,"Border color of a symbol during write-access, like writing to a variable.")),fm("editor.wordHighlightTextBorder",{light:V5,dark:V5,hcDark:V5,hcLight:V5},e(0,"Border color of a textual occurrence for a symbol."));const H5=fm("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},e(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),z5=fm("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},e(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),U5=fm("editorOverviewRuler.wordHighlightTextForeground",{dark:Yw,light:Yw,hcDark:Yw,hcLight:Yw},e(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),K5=sL.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Xy(z5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),q5=sL.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Xy(U5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),G5=sL.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Xy(Yw),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),Z5=sL.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),J5=sL.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Xy(H5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}});function Q5(t){return t?Z5:G5}sk(((t,i)=>{const e=t.getColor(Lv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));function Y5(t,i){const s=i.filter((i=>!t.find((t=>t.equals(i)))));if(s.length>=1){const t=s.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");Xg(e(0,1===s.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class X5{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class t3{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new t3(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,u=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,u=new bs(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new t3(t,i,r,c,s,n,u)}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 X5(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 X5(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(126):null,!1);return e?new bs(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 X5(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 X5(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(126):null,!1);return e?new bs(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(126):null,!1,1073741824)}}class i3 extends Hi{static get(t){return t.getContribution(i3.ID)}constructor(t){super(),this._sessionDispose=this._register(new Vi),this._editor=t,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(t){if(!this._session){const i=t3.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 bs(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(!r3(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(126):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 bs(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}i3.ID="editor.contrib.multiCursorController";class e3 extends Tp{run(t,i){const e=i3.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=F0.get(i);if(r)this._run(e,r);else{const s=t.get(eo).createInstance(F0,i);this._run(e,s),s.dispose()}Y5(n,s.getCursorStates())}}}class s3{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(ws.compareRangesUsingStarts)),this._cachedFindMatches}}let n3=class t extends Hi{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(104),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new lu((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(104)}))),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=F0.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(t._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=i3.get(e);if(!n)return null;const r=F0.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(!r3(e.getModel(),t,i))return null}o=t3.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 s3(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(126):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(ws.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=ws.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&ws.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r=this._languageFeaturesService.documentHighlightProvider.has(i)&&this.editor.getOption(78),o=n.map((t=>({range:t,options:Q5(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function r3(t,i,e){const s=o3(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!==o3(t,r,!e))return!1}return!0}function o3(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}n3.ID="editor.contrib.selectionHighlighter",n3=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,ka)],n3),$p(i3.ID,i3,4),$p(n3.ID,n3,1),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorAbove",label:e(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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,wC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorBelow",label:e(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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,wC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:e(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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 bs(s,t,s,t))}t.endColumn>1&&e.push(new bs(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),Y5(r,n.getCursorStates())}}),Np(class extends e3{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:e(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2082,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:e(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:e(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:Ae(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:e(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)}}),Np(class extends e3{constructor(){super({id:"editor.action.selectHighlights",label:e(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:3114,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.changeAll",label:e(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Oo.and(PC.writable,PC.editorTextFocus),kbOpts:{kbExpr:PC.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),Np(class extends Tp{constructor(){super({id:"editor.action.addCursorsToBottom",label:e(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 bs(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),Y5(o,r.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.addCursorsToTop",label:e(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 bs(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.focusNextCursor",label:e(0,"Focus Next Cursor"),description:{description:e(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),Y5(n,s.getCursorStates()))}}),Np(class extends Tp{constructor(){super({id:"editor.action.focusPreviousCursor",label:e(0,"Focus Previous Cursor"),description:{description:e(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),Y5(n,s.getCursorStates()))}});var h3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const c3={Visible:new Jo("parameterHintsVisible",!1),MultipleSignatures:new Jo("parameterHintsMultipleSignatures",!1)};function u3(t,i,e,s,n){return h3(this,void 0,void 0,(function*(){const r=t.ordered(i);for(const t of r)try{const r=yield t.provideSignatureHelp(i,e,n,s);if(r)return r}catch(t){Ai(t)}}))}fp.registerCommand("_executeSignatureHelpProvider",((t,...i)=>h3(void 0,void 0,void 0,(function*(){const[e,s,n]=i;Mt(os.isUri(e)),Mt(vs.isIPosition(s)),Mt("string"==typeof n||!n);const r=t.get(ka),o=yield t.get(ep).createModelReference(e);try{const t=yield u3(r.signatureHelpProvider,o.object.textEditorModel,vs.lift(s),{triggerKind:Es.Invoke,isRetrigger:!1,triggerCharacter:n},fe.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}}))));var l3;!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}}}(l3||(l3={}));class a3 extends Hi{constructor(t,i,e=a3.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ee),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=l3.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new tl,this.retriggerChars=new tl,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new su(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=l3.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(Ei)}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(83).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(83).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new l3.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:t})),this._onChangedHints.fire(this.state.hints))}doTrigger(t){return i=this,e=void 0,n=function*(){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(d3);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 l3.Pending(tu((t=>u3(this.providers,r,o,n,t))),e);try{const i=yield this.state.request;return t!==this.triggerId?(null==i||i.dispose(),!1):i&&i.value.signatures&&0!==i.value.signatures.length?(this.state=new l3.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=l3.Default),Ei(i),!1}},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}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:Es.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Es.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Es.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(83).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function d3(t,i){switch(i.triggerKind){case Es.Invoke:return i;case Es.ContentChange:return t;default:return i}}a3.DEFAULT_DELAY=120;var f3=function(t,i){return function(e,s){i(e,s,t)}};const g3=Rg,p3=SR("parameter-hints-next",Ss.chevronDown,e(0,"Icon for show next parameter hint.")),m3=SR("parameter-hints-previous",Ss.chevronUp,e(0,"Icon for show previous parameter hint."));let v3=class t extends Hi{constructor(t,i,e,s,n){super(),this.editor=t,this.model=i,this.renderDisposeables=this._register(new Vi),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new RJ({editor:t},n,s)),this.keyVisible=c3.Visible.bindTo(e),this.keyMultipleSignatures=c3.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=g3(".editor-widget.parameter-hints-widget"),i=Lg(t,g3(".phwrapper"));i.tabIndex=-1;const e=Lg(i,g3(".controls")),s=Lg(e,g3(".button"+np.asCSSSelector(m3))),n=Lg(e,g3(".overloads")),r=Lg(e,g3(".button"+np.asCSSSelector(p3)));this._register(Zf(s,"click",(t=>{Dg(t),this.previous()}))),this._register(Zf(r,"click",(t=>{Dg(t),this.next()})));const o=g3(".body"),h=new Fy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Lg(o,g3(".signature")),u=Lg(o,g3(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:u,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const l=()=>{if(!this.domNodes)return;const t=this.editor.getOption(48);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};l(),this._register(Qi.chain(this.editor.onDidChangeConfiguration.bind(this.editor)).filter((t=>t.hasChanged(48))).on(l,null)),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 s=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",s),this.keyMultipleSignatures.set(s),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const n=t.signatures[t.activeSignature];if(!n)return;const r=Lg(this.domNodes.signature,g3(".code")),o=this.editor.getOption(48);r.style.fontSize=`${o.fontSize}px`,r.style.fontFamily=o.fontFamily;const h=null!==(i=n.activeParameter)&&void 0!==i?i:t.activeParameter;n.parameters.length>0?this.renderParameters(r,n,h):Lg(r,g3("span")).textContent=n.label;const c=n.parameters[h];if(null==c?void 0:c.documentation){const t=g3("span.documentation");if("string"==typeof c.documentation)t.textContent=c.documentation;else{const i=this.renderMarkdownDocs(c.documentation);t.appendChild(i.element)}Lg(this.domNodes.docs,g3("p",{},t))}if(void 0===n.documentation);else if("string"==typeof n.documentation)Lg(this.domNodes.docs,g3("p",{},n.documentation));else{const t=this.renderMarkdownDocs(n.documentation);Lg(this.domNodes.docs,t.element)}const u=this.hasDocs(n,c);if(this.domNodes.signature.classList.toggle("has-docs",u),this.domNodes.docs.classList.toggle("empty",!u),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,c){let t="";const i=n.parameters[h];t=Array.isArray(i.label)?n.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),n.documentation&&(t+="string"==typeof n.documentation?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==t&&(Yg(e(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&&Ot(i.documentation).length>0||i&&"object"==typeof i.documentation&&Ot(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&Ot(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&Ot(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),Lg(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|^)${In(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 t.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)}};v3.ID="editor.widget.parameterHintsWidget",v3=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}([f3(2,Qo),f3(3,W_),f3(4,hc)],v3),fm("editorHoverWidget.highlightForeground",{dark:dw,light:dw,hcDark:dw,hcLight:dw},e(0,"Foreground color of the active item in the parameter hint."));var w3=function(t,i){return function(e,s){i(e,s,t)}};let b3=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new a3(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(v3,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)}};b3.ID="editor.controller.parameterHints",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}([w3(1,eo),w3(2,ka)],b3),$p(b3.ID,b3,2),Np(class extends Tp{constructor(){super({id:"editor.action.triggerParameterHints",label:e(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:PC.hasSignatureHelpProvider,kbOpts:{kbExpr:PC.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=b3.get(i);null==e||e.trigger({triggerKind:Es.Invoke})}});const y3=Fp.bindToContribution(b3.get);Pp(new y3({id:"closeParameterHints",precondition:c3.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:PC.focus,primary:9,secondary:[1033]}})),Pp(new y3({id:"showPrevParameterHint",precondition:Oo.and(c3.Visible,c3.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:PC.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),Pp(new y3({id:"showNextParameterHint",precondition:Oo.and(c3.Visible,c3.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:PC.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var k3=function(t,i){return function(e,s){i(e,s,t)}};const C3=new Jo("renameInputVisible",!1,e(0,"Whether the rename input widget is visible"));let S3=class{constructor(t,i,e,s,n){this._editor=t,this._acceptKeybindings=i,this._themeService=e,this._keybindingService=s,this._disposables=new Vi,this.allowEditorOverflow=!0,this._visibleContextKey=C3.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&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",e(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(km),o=t.getColor(Cm);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(dv))&&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(xm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(Sm))&&void 0!==s?s:"");const h=t.getColor(Dm);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(48);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[s,n]=this._acceptKeybindings;return this._label.innerText=e(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(s))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(n))||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 Vi;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((()=>this.cancelInput(!document.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)}};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}([k3(2,Yy),k3(3,eP),k3(4,Qo)],S3);var x3=function(t,i){return function(e,s){i(e,s,t)}},D3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class E3{constructor(t,i,e){this.model=t,this.position=i,this._providerRenameIdx=0,this._providers=e.ordered(t)}hasProvider(){return this._providers.length>0}resolveRenameLocation(t){return D3(this,void 0,void 0,(function*(){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=yield e.resolveRenameLocation(this.model,this.position,t);if(s){if(!s.rejectReason)return s;i.push(s.rejectReason)}}const e=this.model.getWordAtPosition(this.position);return e?{range:new ws(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:ws.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}))}provideRenameEdits(t,i){return D3(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,s,n){return D3(this,void 0,void 0,(function*(){const r=this._providers[i];if(!r)return{edits:[],rejectReason:s.join("\n")};const o=yield r.provideRenameEdits(this.model,this.position,t,n);return o?o.rejectReason?this._provideRenameEdits(t,i+1,s.concat(o.rejectReason),n):o:this._provideRenameEdits(t,i+1,s.concat(e(0,"No result.")),n)}))}}let A3=class t{static get(i){return i.getContribution(t.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 Vi,this._cts=new pe,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(S3,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return D3(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),this._cts=new pe,!this.editor.hasModel())return;const s=this.editor.getPosition(),n=new E3(this.editor.getModel(),s,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;const r=new UH(this.editor,5,void 0,this._cts.token);let o;try{const t=n.resolveRenameLocation(r.token);this._progressService.showWhile(t,250),o=yield t}catch(i){return void(null===(t=kK.get(this.editor))||void 0===t||t.showMessage(i||e(0,"An unknown error occurred while resolving rename location"),s))}finally{r.dispose()}if(!o)return;if(o.rejectReason)return void(null===(i=kK.get(this.editor))||void 0===i||i.showMessage(o.rejectReason,s));if(r.token.isCancellationRequested)return;const h=new UH(this.editor,5,o.range,this._cts.token),c=this.editor.getSelection();let u=0,l=o.text.length;ws.isEmpty(c)||ws.spansMultipleLines(c)||!ws.containsRange(o.range,c)||(u=Math.max(0,c.startColumn-o.range.startColumn),l=Math.min(o.range.endColumn,c.endColumn)-o.range.startColumn);const a=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),d=yield this._renameInputField.getInput(o.range,o.text,u,l,a,h.token);if("boolean"==typeof d)return d&&this.editor.focus(),void h.dispose();this.editor.focus();const f=iu(n.provideRenameEdits(d.newName,h.token),h.token).then((t=>D3(this,void 0,void 0,(function*(){t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(ws.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:d.wantsPreview,label:e(0,"Renaming '{0}' to '{1}'",null==o?void 0:o.text,d.newName),code:"undoredo.rename",quotableLabel:e(0,"Renaming {0} to {1}",null==o?void 0:o.text,d.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&Yg(e(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",o.text,d.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(e(0,"Rename failed to apply edits")),this._logService.error(t)}))))}))),(t=>{this._notificationService.error(e(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{h.dispose()}));return this._progressService.showWhile(f,250),f}))}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};A3.ID="editor.contrib.renameController",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}([x3(1,eo),x3(2,IM),x3(3,TI),x3(4,qR),x3(5,pa),x3(6,fa),x3(7,ka)],A3),$p(A3.ID,A3,4),Np(class extends Tp{constructor(){super({id:"editor.action.rename",label:e(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Oo.and(PC.writable,PC.hasRenameProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(ro),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return os.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)))))}),Ei):super.runCommand(t,i)}run(t,i){const e=A3.get(i);return e?e.run():Promise.resolve()}});const L3=Fp.bindToContribution(A3.get);function M3(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 R()||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),Th.wrap(i)}(i)}Pp(new L3({id:"acceptRenameInput",precondition:C3,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:3}})),Pp(new L3({id:"acceptRenameInputWithPreview",precondition:Oo.and(C3,Oo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:1027}})),Pp(new L3({id:"cancelRenameInput",precondition:C3,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:PC.focus,primary:9,secondary:[1033]}})),Ip("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;Mt("string"==typeof n);const{renameProvider:r}=t.get(ka);return function(t,i,e,s){return D3(this,void 0,void 0,(function*(){const n=new E3(i,e,t),r=yield n.resolveRenameLocation(fe.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,fe.None)}))}(r,i,e,n)})),Ip("_executePrepareRename",(function(t,i,e){return D3(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get(ka),n=new E3(i,e,s),r=yield n.resolveRenameLocation(fe.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),dc.as(mc).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:e(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var O3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function F3(t){return t&&!!t.data}function T3(t){return t&&Array.isArray(t.edits)}class R3{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function _3(t,i){return t.has(i)}function I3(t,i,e,s,n){return O3(this,void 0,void 0,(function*(){const r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}(t,i),o=yield Promise.all(r.map((t=>O3(this,void 0,void 0,(function*(){let r,o=null;try{r=yield t.provideDocumentSemanticTokens(i,t===e?s:null,n)}catch(t){o=t,r=null}return r&&(F3(r)||T3(r))||(r=null),new R3(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 P3{constructor(t,i){this.provider=t,this.tokens=i}}function N3(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function B3(t,i,e,s){return O3(this,void 0,void 0,(function*(){const n=N3(t,i),r=yield Promise.all(n.map((t=>O3(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&F3(n)||(n=null),new P3(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}fp.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e]=i;Mt(e instanceof os);const s=t.get(Zc).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(ka),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(dp).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),fp.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e]=i;Mt(e instanceof os);const s=t.get(Zc).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(ka);if(!_3(n,s))return t.get(dp).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield I3(n,s,null,null,fe.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!F3(h))return;const c=M3({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),fp.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(e instanceof os);const n=t.get(Zc).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(ka),o=N3(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!ws.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=yield B3(r,n,ws.lift(s),fe.None);return h?h.provider.getLegend():void 0})))),fp.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(e instanceof os),Mt(ws.isIRange(s));const n=t.get(Zc).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(ka),o=yield B3(r,n,ws.lift(s),fe.None);return o&&o.tokens?M3({id:0,type:"full",data:o.tokens.data}):void 0}))));const $3="editor.semanticHighlighting";function j3(t,i,e){var s;const n=null===(s=e.getValue($3,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var W3=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},V3=function(t,i){return function(e,s){i(e,s,t)}};let H3=class extends Hi{constructor(t,i,e,s,n,r){super(),this._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new z3(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()];j3(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{j3(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($3)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};H3=W3([V3(0,eI),V3(1,Zc),V3(2,Yy),V3(3,ic),V3(4,z_),V3(5,ka)],H3);let z3=class t extends Hi{constructor(i,e,s,n,r){super(),this._semanticTokensStylingService=e,this._isDisposed=!1,this._model=i,this._provider=r.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:t.REQUEST_MIN_DELAY,max:t.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new lu((()=>this._fetchDocumentSemanticTokensNow()),t.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 o=()=>{$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const t of this._provider.all(i))"function"==typeof t.onDidChange&&this._documentProvidersChangeListeners.push(t.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};o(),this._register(this._provider.onDidChange((()=>{o(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(s.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),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!_3(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new pe,i=I3(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 Ji(!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"))||Ei(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(i,e,s,n){const r=this._currentDocumentResponse,o=()=>{(n.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)i&&e&&i.releaseDocumentSemanticTokens(e.resultId);else if(i&&s){if(!e)return this._model.tokenization.setSemanticTokens(null,!0),void o();if(T3(e)){if(!r)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===e.edits.length)e={resultId:e.resultId,data:r.data};else{let i=0;for(const t of e.edits)i+=(t.data?t.data.length:0)-t.deleteCount;const n=r.data,o=new Uint32Array(n.length+i);let h=n.length,c=o.length;for(let i=e.edits.length-1;i>=0;i--){const u=e.edits[i];if(u.start>n.length)return s.warnInvalidEditStart(r.resultId,e.resultId,i,u.start,n.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=h-(u.start+u.deleteCount);l>0&&(t._copy(n,h-l,o,c-l,l),c-=l),u.data&&(t._copy(u.data,0,o,c-u.data.length,u.data.length),c-=u.data.length),h=u.start}h>0&&t._copy(n,0,o,0,h),e={resultId:e.resultId,data:o}}}if(F3(e)){this._currentDocumentResponse=new U3(i,e.resultId,e.data);const t=X_(e,s,this._model.getLanguageId());if(n.length>0)for(const i of n)for(const e of t)for(const t of i.changes)e.applyEdit(t.range,t.text);this._model.tokenization.setSemanticTokens(t,!0)}else this._model.tokenization.setSemanticTokens(null,!0);o()}else this._model.tokenization.setSemanticTokens(null,!1)}};z3.REQUEST_MIN_DELAY=300,z3.REQUEST_MAX_DELAY=2e3,z3=W3([V3(1,eI),V3(2,Yy),V3(3,z_),V3(4,ka)],z3);class U3{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}ZV(H3);var K3=function(t,i){return function(e,s){i(e,s,t)}};let q3=class extends Hi{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 lu((()=>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($3)&&(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(!j3(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=tu((e=>Promise.resolve(B3(this._provider,t,i,e)))),n=new Ji(!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,X_(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};q3.ID="editor.contrib.viewportSemanticTokens",q3=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}([K3(1,eI),K3(2,Yy),K3(3,ic),K3(4,z_),K3(5,ka)],q3),$p(q3.ID,q3,1);class G3{provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),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,u=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(Jn(t)&&Qn(u))break;u=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(Qn(t)&&Jn(u))break;if(95===t||45===t)break;u=t}h<c&&t.push({range:new ws(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new ws(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 ws(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var Z3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class J3{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 J3(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let Q3=class t{static get(i){return i.getContribution(t.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()}run(t){return Z3(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),e=this._editor.getModel();if(this._state||(yield X3(this._languageFeaturesService.selectionRangeProvider,e,i.map((t=>t.getPosition())),this._editor.getOption(109),fe.None).then((t=>{var e;if(et(t)&&t.length===i.length&&this._editor.hasModel()&&G(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 J3(0,t))),null===(e=this._selectionListener)||void 0===e||e.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 s=this._state.map((t=>bs.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(s)}finally{this._ignoreSelection=!1}}))}};Q3.ID="editor.contrib.smartSelectController",Q3=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,ka)],Q3);class Y3 extends Tp{constructor(t,i){super(i),this._forward=t}run(t,i){return Z3(this,void 0,void 0,(function*(){const t=Q3.get(i);t&&(yield t.run(this._forward))}))}}function X3(t,i,e,s,n){return Z3(this,void 0,void 0,(function*(){const r=t.all(i).concat(new G3);1===r.length&&r.unshift(new R2);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(et(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])ws.isIRange(s.range)&&ws.containsPosition(s.range,e[i])&&h[i].push(ws.lift(s.range))}}),Ai));return yield 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||ws.containsRange(i,n)&&!ws.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 ws(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 ws(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}))}))}fp.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),$p(Q3.ID,Q3,4),Np(class extends Y3{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:e(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"1_basic",title:e(0,"&&Expand Selection"),order:2}})}}),Np(class extends Y3{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:e(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"1_basic",title:e(0,"&&Shrink Selection"),order:3}})}}),fp.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return Z3(this,void 0,void 0,(function*(){const[e,s]=i;Mt(os.isUri(e));const n=t.get(ka).selectionRangeProvider,r=yield t.get(ep).createModelReference(e);try{return X3(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0},fe.None)}finally{r.dispose()}}))}));const t6=Object.freeze({View:{value:e(0,"View"),original:"View"},Help:{value:e(0,"Help"),original:"Help"},Test:{value:e(0,"Test"),original:"Test"},File:{value:e(0,"File"),original:"File"},Preferences:{value:e(0,"Preferences"),original:"Preferences"},Developer:{value:e(0,"Developer"),original:"Developer"}});class i6{constructor(t,i){this.lineNumbers=t,this.lastLineRelativePosition=i}}const e6=Lu("stickyScrollViewLayer",{createHTML:t=>t});class s6 extends Hi{constructor(t){super(),this._editor=t,this._rootDomNode=document.createElement("div"),this._disposableStore=this._register(new Vi),this._lineNumbers=[],this._lastLineRelativePosition=0,this._hoverOnLine=-1,this._hoverOnColumn=-1,this._layoutInfo=this._editor.getLayoutInfo(),this._rootDomNode=document.createElement("div"),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof eG),this._rootDomNode.style.width=this._layoutInfo.width-this._layoutInfo.minimap.minimapCanvasOuterWidth-this._layoutInfo.verticalScrollbarWidth+"px"}get hoverOnLine(){return this._hoverOnLine}get hoverOnColumn(){return this._hoverOnColumn}get lineNumbers(){return this._lineNumbers}getCurrentLines(){return this._lineNumbers}setState(t){Kf(this._rootDomNode),this._disposableStore.clear(),this._lineNumbers.length=0;const i=this._editor.getOption(64);t.lineNumbers.length*i+t.lastLineRelativePosition>0?(this._lastLineRelativePosition=t.lastLineRelativePosition,this._lineNumbers=t.lineNumbers):(this._lastLineRelativePosition=0,this._lineNumbers=[]),this._renderRootNode()}_renderRootNode(){if(!this._editor._getViewModel())return;for(const[t,i]of this._lineNumbers.entries()){const e=this._renderChildNode(t,i);this._rootDomNode.appendChild(e)}const t=this._editor.getOption(64),i=this._lineNumbers.length*t+this._lastLineRelativePosition;this._rootDomNode.style.display=i>0?"block":"none",this._rootDomNode.style.height=i.toString()+"px",this._rootDomNode.setAttribute("role","list"),"left"===this._editor.getOption(70).side&&(this._rootDomNode.style.marginLeft=this._editor.getLayoutInfo().minimap.minimapCanvasOuterWidth+"px")}_renderChildNode(t,i){const e=document.createElement("div"),s=this._editor._getViewModel(),n=s.coordinatesConverter.convertModelPositionToViewPosition(new vs(i,1)).lineNumber,r=s.getViewLineRenderingData(n),o=this._editor.getLayoutInfo(),h=o.width-o.minimap.minimapCanvasOuterWidth-o.verticalScrollbarWidth,c=this._editor.getOption(70).side,u=this._editor.getOption(64),l=this._editor.getOption(65);let a;try{a=Pa.filter(r.inlineDecorations,n,r.minColumn,r.maxColumn)}catch(t){a=[]}const d=new Va(!0,!0,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,0,r.tokens,a,r.tabSize,r.startVisibleColumn,1,1,1,500,"none",!0,!0,null),f=new Wh(2e3);let g;Ka(d,f),g=e6?e6.createHTML(f.build()):f.build();const p=document.createElement("span");p.className="sticky-line",p.classList.add(`stickyLine${i}`),p.style.lineHeight=`${u}px`,p.innerHTML=g;const m=document.createElement("span");m.className="sticky-line",m.style.lineHeight=`${u}px`,"left"===c?m.style.width=o.contentLeft-o.minimap.minimapCanvasOuterWidth+"px":"right"===c&&(m.style.width=`${o.contentLeft}px`);const v=document.createElement("span");return 1===l.renderType||3===l.renderType&&i%10==0?v.innerText=i.toString():2===l.renderType&&(v.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),v.className="sticky-line-number",v.style.lineHeight=`${u}px`,v.style.width=`${o.lineNumbersWidth}px`,"left"===c?v.style.paddingLeft=o.lineNumbersLeft-o.minimap.minimapCanvasOuterWidth+"px":"right"===c&&(v.style.paddingLeft=`${o.lineNumbersLeft}px`),m.appendChild(v),this._editor.applyFontInfo(p),this._editor.applyFontInfo(v),e.appendChild(m),e.appendChild(p),e.className="sticky-line-root",e.setAttribute("role","listitem"),e.tabIndex=0,e.style.lineHeight=`${u}px`,e.style.width=`${h}px`,e.style.height=`${u}px`,e.style.zIndex="0",t===this._lineNumbers.length-1&&(e.style.position="relative",e.style.zIndex="-1",e.style.top=this._lastLineRelativePosition+"px"),this._disposableStore.add(Zf(e,"mouseover",(t=>{if(this._editor.hasModel()){const e=new jd(t).target.innerText;this._hoverOnLine=i,this._hoverOnColumn=this._editor.getModel().getLineContent(i).indexOf(e)+1||-1}}))),e}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}}class n6{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class r6{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class o6{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var h6,c6,u6=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},l6=function(t,i){return function(e,s){i(e,s,t)}},a6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};!function(t){t.OUTLINE_MODEL="outlineModel",t.FOLDING_PROVIDER_MODEL="foldingProviderModel",t.INDENTATION_MODEL="indentationModel"}(h6||(h6={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(c6||(c6={}));let d6=class{constructor(t,i,e,s){this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=new su(300);const n=new g6(e),r=new v6(this._editor,e),o=new m6(this._editor,i);switch(s){case h6.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case h6.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case h6.INDENTATION_MODEL:this._modelProviders.push(o)}this._store=new Vi}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return a6(this,void 0,void 0,(function*(){return this._store.clear(),this._store.add({dispose:()=>{var t;this._cancelModelPromise(),null===(t=this._updateScheduler)||void 0===t||t.cancel()}}),this._cancelModelPromise(),yield this._updateScheduler.trigger((()=>a6(this,void 0,void 0,(function*(){for(const s of this._modelProviders){const{statusPromise:n,modelPromise:r}=s.computeStickyModel(t,i,e);this._modelPromise=r;const o=yield n;if(this._modelPromise!==r)return null;switch(o){case c6.CANCELED:return this._store.clear(),null;case c6.VALID:return s.stickyModel}}return null}))))}))}};d6=u6([l6(1,_c),l6(2,ka)],d6);class f6{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,c6.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=tu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?c6.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),c6.VALID):this._invalid())).then(void 0,(t=>(Ei(t),c6.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let g6=class extends f6{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return A1.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 o6(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(B.first(t.children.values())instanceof E1){const s=B.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 n6(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new n6(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 r6(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 n6(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new r6(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 D1?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};g6=u6([l6(0,ka)],g6);class p6 extends f6{constructor(t){super(),this._foldingLimitReporter=new f1(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new o6(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new r6(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 r6(new n6(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let m6=class extends p6{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new Q0(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};m6=u6([l6(1,_c)],m6);let v6=class extends p6{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return d1.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=d1.getFoldingRangeProviders(this._languageFeaturesService,t);return new c1(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};v6=u6([l6(1,ka)],v6);var w6=function(t,i){return function(e,s){i(e,s,t)}},b6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class y6{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let k6=class extends Hi{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._store.add(new ee),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=new Vi,this._updateSoon=this._register(new lu((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(111)&&this.readConfiguration()}))),this.readConfiguration()}dispose(){super.dispose(),this._sessionStore.dispose()}readConfiguration(){this._options=this._editor.getOption(111),this._options.enabled?(this._stickyModelProvider=new d6(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel),this._sessionStore.add(this._editor.onDidChangeModel((()=>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()):this._sessionStore.clear()}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}update(){var t;return b6(this,void 0,void 0,(function*(){null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new pe,yield this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}))}updateStickyModel(t){return b6(this,void 0,void 0,(function*(){if(!this._editor.hasModel()||!this._stickyModelProvider)return;const i=this._editor.getModel(),e=i.getVersionId(),s=this._model&&!GD(this._model.uri,i.uri)?setTimeout((()=>{t.isCancellationRequested||(this._model=new o6(i.uri,i.getVersionId(),void 0,void 0),this._onDidChangeStickyScroll.fire())}),75):void 0;this._model=yield this._stickyModelProvider.update(i,e,t),clearTimeout(s)}))}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,s,n){if(0===i.children.length)return;let r=n;const o=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&o.push(e.range.startLineNumber)}const h=this.updateIndex(Z(o,t.startLineNumber,((t,i)=>t-i))),c=this.updateIndex(Z(o,t.startLineNumber+s,((t,i)=>t-i)));for(let o=h;o<=c;o++){const h=i.children[o];if(!h)return;if(h.range){const i=h.range.startLineNumber,n=h.range.endLineNumber;t.startLineNumber<=n+1&&i-1<=t.endLineNumber&&i!==r&&(r=i,e.push(new y6(i,n-1,s+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,s+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,s,n)}}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}};k6=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}([w6(1,ka),w6(2,_c)],k6);var C6=function(t,i){return function(e,s){i(e,s,t)}},S6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let x6=class t extends Hi{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 Vi,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._stickyScrollWidget=new s6(this._editor),this._stickyLineCandidateProvider=new k6(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i6([],0),this._readConfiguration(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(111)&&this._readConfiguration()}))),this._register(Zf(this._stickyScrollWidget.getDomNode(),xg.CONTEXT_MENU,(t=>S6(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=PC.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=PC.stickyScrollVisible.bindTo(this._contextKeyService);const h=this._register(Ag(this._stickyScrollWidget.getDomNode()));this._register(h.onDidBlur((()=>{const t=this._stickyScrollWidget.getDomNode().clientHeight;!1===this._positionRevealed&&0===t?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(h.onDidFocus((()=>{this.focus()}))),this._register(this._createClickLinkGesture()),this._register(Zf(this._stickyScrollWidget.getDomNode(),xg.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(i){return i.getContribution(t.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();if(!0===this._stickyScrollFocusedContextKey.get())return;this._focused=!0,this._focusDisposableStore=new Vi,this._stickyScrollFocusedContextKey.set(!0);const t=this._stickyScrollWidget.getDomNode();t.lastElementChild.focus(),this._stickyElements=t.children,this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1}focusNext(){this._focusedStickyElementIndex<this._stickyElements.length-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._stickyElements.item(this._focusedStickyElementIndex).focus()}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._positionRevealed=!0,this._editor.revealPosition(t),this._editor.setSelection(ws.fromPositions(t)),this._editor.focus()}_createClickLinkGesture(){const t=new Vi,i=new Vi;t.add(i);const e=new tG(this._editor,!0);return t.add(e),t.add(e.onMouseMoveOrRelevantKeyDown((([t,e])=>{if(!this._editor.hasModel()||!t.hasTriggerModifier)return void i.clear();const s=t.target;if(s.detail===this._stickyScrollWidget.getId()&&s.element.innerText===s.element.innerHTML){if(-1===this._stickyScrollWidget.hoverOnColumn)return;const t=this._stickyScrollWidget.hoverOnLine,e=this._stickyScrollWidget.hoverOnColumn,n=new ws(t,e,t,e+s.element.innerText.length);if(n.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===s.element.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=n,i.clear();const r=new pe;let o;i.add(Wi((()=>r.dispose(!0)))),eZ(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new vs(t,e+1),r.token).then((t=>{if(!r.token.isCancellationRequested)if(0!==t.length){this._candidateDefinitionsLength=t.length;const e=s.element;o!==e?(i.clear(),o=e,o.style.textDecoration="underline",i.add(Wi((()=>{o.style.textDecoration="none"})))):o||(o=e,o.style.textDecoration="underline",i.add(Wi((()=>{o.style.textDecoration="none"}))))}else i.clear()}))}else i.clear()}))),t.add(e.onCancel((()=>{i.clear()}))),t.add(e.onExecute((t=>S6(this,void 0,void 0,(function*(){t.target.detail===this._stickyScrollWidget.getId()&&(t.hasTriggerModifier?(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:this._stickyScrollWidget.hoverOnLine,column:1})),this._instaService.invokeFunction(Q4,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})):t.isRightClick||(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:this._stickyScrollWidget.hoverOnLine,column:this._stickyScrollWidget.hoverOnColumn})))}))))),t}_onContextMenu(t){this._contextMenuService.showContextMenu({menuId:bp.StickyScrollContext,getAnchor:()=>t})}_readConfiguration(){const t=this._editor.getOption(111);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((()=>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._renderStickyScroll()))),this._enabled=!0),2===this._editor.getOption(65).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>this._renderStickyScroll())))}_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()}_onDidResize(){const t=this._editor.getLayoutInfo(),i=t.width-t.minimap.minimapCanvasOuterWidth-t.verticalScrollbarWidth;this._stickyScrollWidget.getDomNode().style.width=`${i}px`;const e=t.height/this._editor.getOption(64);this._maxStickyLines=Math.round(.25*e)}_renderStickyScroll(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._stickyLineCandidateProvider.getVersionId();if(void 0===i||i===t.getVersionId())if(this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.lineNumbers.length)),this._focused)if(this._stickyElements=this._stickyScrollWidget.getDomNode().children,-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState),this._focusedStickyElementIndex=this._stickyElements.length-1,-1!==this._focusedStickyElementIndex&&this._stickyElements.item(this._focusedStickyElementIndex).focus();else{const t=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState),0===this._stickyElements.length?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(t)||(this._focusedStickyElementIndex=this._stickyElements.length-1),this._stickyElements.item(this._focusedStickyElementIndex).focus())}else this._stickyScrollWidget.setState(this._widgetState)}findScrollWidgetState(){const t=this._editor.getOption(64),i=Math.min(this._maxStickyLines,this._editor.getOption(111).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=this._editor.getVisibleRanges();if(0!==r.length){const o=new n6(r[0].startLineNumber,r[r.length-1].endLineNumber),h=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(o);for(const r of h){const o=r.startLineNumber,h=r.endLineNumber,c=r.nestingDepth;if(h-o>0){const r=(c-1)*t,u=c*t,l=this._editor.getBottomForLineNumber(o)-e,a=this._editor.getTopForLineNumber(h)-e,d=this._editor.getBottomForLineNumber(h)-e;if(r>a&&r<=d){n.push(o),s=d-u;break}if(u>l&&u<=d&&n.push(o),n.length===i)break}}}return new i6(n,s)}dispose(){super.dispose(),this._sessionStore.dispose()}};x6.ID="store.contrib.stickyScrollController",x6=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}([C6(1,zR),C6(2,ka),C6(3,eo),C6(4,_c),C6(5,z_),C6(6,Qo)],x6);const D6=100;$p(x6.ID,x6,1),Ep(class extends Dp{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:e(0,"Toggle Sticky Scroll"),mnemonicTitle:e(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:t6.View,toggled:{condition:Oo.equals("config.editor.stickyScroll.enabled",!0),title:e(0,"Sticky Scroll"),mnemonicTitle:e(0,"&&Sticky Scroll")},menu:[{id:bp.CommandPalette},{id:bp.MenubarViewMenu,group:"5_editor",order:2},{id:bp.StickyScrollContext}]})}run(t){return i=this,e=void 0,n=function*(){const i=t.get(ic),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}}),Ep(class extends _p{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:e(0,"Focus Sticky Scroll"),mnemonicTitle:e(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Oo.and(Oo.has("config.editor.stickyScroll.enabled"),PC.stickyScrollVisible),menu:[{id:bp.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focus()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:e(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:16}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focusPrevious()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:e(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:18}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focusNext()}}),Ep(class extends _p{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:e(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:3}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.goToFocused()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectEditor",title:{value:e(0,"Select Editor"),original:"Select Editor"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:9}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.selectEditor()}});var E6=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},A6=function(t,i){return function(e,s){i(e,s,t)}};class L6{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 M6=class extends Ui{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=B.slice(e,s),r=B.slice(e,0,s);let o=5;for(const e of B.concat(n,r)){if(e.score===pF.Default)continue;const s=new ws(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new L6(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}};M6=E6([A6(5,M2)],M6);let O6=class{constructor(t,i,e,s){this._getEditorOption=t,this._languageFeatureService=i,this._clipboardService=e,this._suggestMemoryService=s}provideInlineCompletions(t,i,e,s){var n,r,o,h,c;return r=this,o=void 0,c=function*(){if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(86,t);if(bJ.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"!==bJ.valueFor(r,h))return;let c,u,l=t.getWordAtPosition(i);if((null==l?void 0:l.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==l?void 0:l.word)&&!c)return;if(l||(l=t.getWordUntilPosition(i)),l.endColumn!==i.column)return;const a=t.getValueInRange(new ws(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,l))){const t=new I2(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),u=this._lastResult}else{const e=yield mJ(this._languageFeatureService.completionProvider,t,i,new gJ(void 0,void 0,null==c?void 0:c.providers),c&&{triggerKind:1,triggerCharacter:c.ch},s);let n;e.needsClipboard&&(n=yield this._clipboardService.readText());const r=new P2(e.items,i.column,new I2(a,0),_2.None,this._getEditorOption(114,t),this._getEditorOption(108,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);u=new M6(t,i.lineNumber,l,r,e,this._suggestMemoryService)}return this._lastResult=u,u},new((h=void 0)||(h=Promise))((function(t,i){function e(t){try{n(c.next(t))}catch(t){i(t)}}function s(t){try{n(c.throw(t))}catch(t){i(t)}}function n(i){var n;i.done?t(i.value):(n=i.value,n instanceof h?n:new h((function(t){t(n)}))).then(e,s)}n((c=c.apply(r,o||[])).next())}))}handleItemDidShow(t,i){i.completion.resolve(fe.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(ws.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}}};O6=E6([A6(1,ka),A6(2,VR),A6(3,M2)],O6);let F6=class t{constructor(i,e,s,n){if(1==++t._counter){const r=n.createInstance(O6,((t,e)=>{var n;return(null!==(n=s.listCodeEditors().find((t=>t.getModel()===e)))&&void 0!==n?n:i).getOption(t)}));t._disposable=e.inlineCompletionsProvider.register("*",r)}}dispose(){var i;0==--t._counter&&(null===(i=t._disposable)||void 0===i||i.dispose(),t._disposable=void 0)}};F6._counter=0,F6=E6([A6(1,ka),A6(2,ro),A6(3,eo)],F6),$p("suggest.inlineCompletionsProvider",F6,0),Np(class extends Tp{constructor(){super({id:"editor.action.forceRetokenize",label:e(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 Ji(!0);e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class T6 extends Dp{constructor(){super({id:T6.ID,title:{value:e(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(t){const i="terminal"===t.get(Qo).getContextKeyValue("focusedView")?"terminalFocus":"editorFocus",s=!Yp.getTabFocusMode(i);Yp.setTabFocusMode(s,i),Yg(e(0,s?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}T6.ID="editor.action.toggleTabFocusMode",Ep(T6);let R6=class extends Hi{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=Lg(t,Rg("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 Ny(this.el,"click")),o=this._register(new Ny(this.el,"keypress")),h=Qi.chain(o.event).map((t=>new Pd(t))).filter((t=>3===t.keyCode)).event,c=this._register(new Ny(this.el,om.Tap)).event;this._register(hm.addTarget(this.el));const u=Qi.any(r.event,h,c);this._register(u((t=>{this.enabled&&(Dg(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};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)}}(3,W_)],R6);var _6=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=function(t,i){return function(e,s){i(e,s,t)}};let P6=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(N6))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(t){this.banner.show(Object.assign(Object.assign({},t),{onClose:()=>{var i;this.hide(),null===(i=t.onClose)||void 0===i||i.call(t)}})),this._editor.setBanner(this.banner.element,26)}};P6=_6([I6(1,eo)],P6);let N6=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(RJ,{}),this.element=Rg("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=Rg("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Kf(this.element)}show(t){Kf(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Lg(this.element,Rg("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Rg(`div${np.asCSSSelector(t.icon)}`));const s=Lg(this.element,Rg("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Lg(this.element,Rg("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(R6,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Lg(this.element,Rg("div.action-container"));this.actionBar=this._register(new kR(n)),this.actionBar.push(this._register(new op("banner.close","Close Banner",np.asClassName(LR),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};N6=_6([I6(0,eo)],N6);var B6=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},$6=function(t,i){return function(e,s){i(e,s,t)}},j6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const W6=SR("extensions-warning-message",Ss.warning,e(0,"Icon shown with a warning message in the extensions editor."));let V6=class extends Hi{constructor(t,i,s,n){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=s,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 s;if(t.nonBasicAsciiCharacterCount>=i)s={message:e(0,"This document contains many non-basic ASCII unicode characters"),command:new t9};else if(t.ambiguousCharacterCount>=i)s={message:e(0,"This document contains many ambiguous unicode characters"),command:new Y6};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");s={message:e(0,"This document contains many invisible unicode characters"),command:new X6}}this._bannerController.show({id:"unicodeHighlightBanner",message:s.message,icon:W6,actions:[{label:s.command.shortLabel,href:`command:${s.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(P6,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(121),this._register(s.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(121)&&(this._options=t.getOption(121),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===di?!t:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===di?!t:i.includeComments,includeStrings:i.includeStrings===di?!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?A:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new H6(this._editor,i,this._updateState,this._editorWorkerService):new z6(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};V6.ID="editor.contrib.unicodeHighlighter",V6=B6([$6(1,$R),$6(2,IP),$6(3,eo)],V6);let H6=class extends Hi{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 lu((()=>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:Z6.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return cM(i,t)?{reason:G6(i.getValueInRange(t.range),this._options),inComment:uM(i,t),inString:lM(i,t)}:null}};H6=B6([$6(3,$R)],H6);class z6 extends Hi{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 lu((()=>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=pl.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:Z6.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 cM(i,t)?{reason:G6(e,this._options),inComment:uM(i,t),inString:lM(i,t)}:null}}let U6=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 s=this._editor.getModel(),n=this._editor.getContribution(V6.ID);if(!n)return[];const r=[];let o=300;for(const t of i){const i=n.getDecorationInfo(t);if(!i)continue;const h=s.getValueInRange(t.range).codePointAt(0),c=q6(h);let u;switch(i.reason.kind){case 0:u=fr(i.reason.confusableWith)?e(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,q6(i.reason.confusableWith.codePointAt(0))):e(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,q6(i.reason.confusableWith.codePointAt(0)));break;case 1:u=e(0,"The character {0} is invisible.",c);break;case 2:u=e(0,"The character {0} is not a basic ASCII character.",c)}const l={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},a=e(0,"Adjust settings"),d=`command:${i9.ID}?${encodeURIComponent(JSON.stringify(l))}`,f=new MF("",!0).appendMarkdown(u).appendText(" ").appendLink(d,a);r.push(new VJ(this,t.range,[f],!1,o++))}return r}renderHoverParts(t,i){return zJ(t,i,this._editor,this._languageService,this._openerService)}};function K6(t){return`U+${t.toString(16).padStart(4,"0")}`}function q6(t){let i=`\`${K6(t)}\``;return Dr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function G6(t,i){return pl.computeUnicodeHighlightReason(t,i)}U6=B6([$6(1,hc),$6(2,W_)],U6);class Z6{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=sL.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}}Z6.instance=new Z6;class J6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=e(0,"Disable Highlight In Comments")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class Q6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=e(0,"Disable Highlight In Strings")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class Y6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=e(0,"Disable Ambiguous Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}Y6.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class X6 extends Tp{constructor(){super({id:X6.ID,label:e(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=e(0,"Disable Invisible Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}X6.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class t9 extends Tp{constructor(){super({id:t9.ID,label:e(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=e(0,"Disable Non ASCII Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}t9.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class i9 extends Tp{constructor(){super({id:i9.ID,label:e(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(t,i,s){return j6(this,void 0,void 0,(function*(){const{codePoint:i,reason:n,inString:r,inComment:o}=s,h=String.fromCodePoint(i),c=t.get(Kj),u=t.get(ic),l=[];if(0===n.kind)for(const t of n.notAmbiguousInLocales)l.push({label:e(0,'Allow unicode characters that are more common in the language "{0}".',t),run:()=>j6(this,void 0,void 0,(function*(){e9(u,[t])}))});if(l.push({label:function(t){return Dr.isInvisibleCharacter(t)?e(0,"Exclude {0} (invisible character) from being highlighted",K6(t)):e(0,"Exclude {0} from being highlighted",`${K6(t)} "${h}"`)}(i),run:()=>function(t,i){return j6(this,void 0,void 0,(function*(){const e=t.getValue(fi);let s;s="object"==typeof e&&e?e:{};for(const t of i)s[String.fromCodePoint(t)]=!0;yield t.updateValue(fi,s,2)}))}(u,[i])}),o){const t=new J6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(r){const t=new Q6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}if(0===n.kind){const t=new Y6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(1===n.kind){const t=new X6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(2===n.kind){const t=new t9;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(n);const a=yield c.pick(l,{title:e(0,"Configure Unicode Highlight Options")});a&&(yield a.run())}))}}function e9(t,i){var e;return j6(this,void 0,void 0,(function*(){const s=null===(e=t.inspect(bi).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;yield t.updateValue(bi,n,2)}))}i9.ID="editor.action.unicodeHighlight.showExcludeOptions",Np(Y6),Np(X6),Np(t9),Np(i9),$p(V6.ID,V6,1),PZ.register(U6);var s9=function(t,i){return function(e,s){i(e,s,t)}};const n9="ignoreUnusualLineTerminators";let r9=class extends Hi{constructor(t,i,e){super(),this._editor=t,this._dialogService=i,this._codeEditorService=e,this._isPresentingDialog=!1,this._config=this._editor.getOption(122),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(122)&&(this._config=this._editor.getOption(122),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}_checkForUnusualLineTerminators(){return t=this,i=void 0,n=function*(){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,n9)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(88))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let s;try{this._isPresentingDialog=!0,s=yield this._dialogService.confirm({title:e(0,"Unusual Line Terminators"),message:e(0,"Detected unusual line terminators"),detail:e(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`.",JD(t.uri)),primaryButton:e(0,"&&Remove Unusual Line Terminators"),cancelButton:e(0,"Ignore")})}finally{this._isPresentingDialog=!1}s.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,n9,!0)}(this._codeEditorService,t)},new((s=void 0)||(s=Promise))((function(e,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(t){t(i)}))).then(o,h)}c((n=n.apply(t,i||[])).next())}));var t,i,s,n}};r9.ID="editor.contrib.unusualLineTerminatorsDetector",r9=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}([s9(1,A_),s9(2,ro)],r9),$p(r9.ID,r9,1);var o9=function(t,i){return function(e,s){i(e,s,t)}};const h9=new Jo("hasWordHighlights",!1);function c9(t,i,e,s){return hu(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),et)}class u9{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=tu((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new ws(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 l9 extends u9{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return c9(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class a9 extends u9{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return ru(250,s).then((()=>{if(!i.isEmpty())return[];const s=t.getWordAtPosition(i.getPosition());return!s||s.word.length>1e3?[]:t.findMatches(s.word,!0,!1,!0,e,!1).map((t=>({range:t.range,kind:As.Text})))}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}Ip("_executeDocumentHighlights",((t,i,e)=>c9(t.get(ka).documentHighlightProvider,i,e,fe.None)));class d9{constructor(t,i,e){this.toUnhook=new Vi,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=[],this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=t,this.providers=i,this._hasWordHighlights=h9.bindTo(e),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(78),this.model=this.editor.getModel(),this.toUnhook.add(t.onDidChangeCursorPosition((t=>{this._ignorePositionChangeEvent||this.occurrencesHighlight&&this._onPositionChanged(t)}))),this.toUnhook.add(t.onDidChangeModelContent((()=>{this._stopAll()}))),this.toUnhook.add(t.onDidChangeConfiguration((()=>{const t=this.editor.getOption(78);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}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(ws.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&&Yg(`${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&&Yg(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}_removeDecorations(){this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1))}_stopAll(){this._removeDecorations(),-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){this.occurrencesHighlight&&3===t.reason?this._run():this._stopAll()}_getWord(){const t=this.editor.getSelection();return this.model.getWordAtPosition({lineNumber:t.startLineNumber,column:t.startColumn})}_run(){const t=this.editor.getSelection();if(t.startLineNumber!==t.endLineNumber)return void this._stopAll();const i=t.startColumn,e=t.endColumn,s=this._getWord();if(!s||s.startColumn>i||s.endColumn<e)return void this._stopAll();const n=this.workerRequest&&this.workerRequest.isValid(this.model,t,this.decorations);if(this.lastCursorPositionChangeTime=(new Date).getTime(),n)this.workerRequestCompleted&&-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const t=++this.workerRequestTokenId;this.workerRequestCompleted=!1,this.workerRequest=function(t,i,e,s){return t.has(i)?new l9(i,e,s,t):new a9(i,e,s)}(this.providers,this.model,this.editor.getSelection(),this.editor.getOption(126)),this.workerRequest.result.then((i=>{t===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=i||[],this._beginRenderDecorations())}),Ei)}}_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(){this.renderDecorationsTimer=-1;const t=[];for(const e of this.workerRequestValue)e.range&&t.push({range:e.range,options:(i=e.kind,i===As.Write?K5:i===As.Text?q5:J5)});var i;this.decorations.set(t),this._hasWordHighlights.set(this.hasDecorations())}dispose(){this._stopAll(),this.toUnhook.dispose()}}let f9=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e){super(),this.wordHighlighter=null;const s=()=>{t.hasModel()&&(this.wordHighlighter=new d9(t,e.documentHighlightProvider,i))};this._register(t.onDidChangeModel((()=>{this.wordHighlighter&&(this.wordHighlighter.dispose(),this.wordHighlighter=null),s()}))),s()}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()}};f9.ID="editor.contrib.wordHighlighter",f9=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}([o9(1,Qo),o9(2,ka)],f9);class g9 extends Tp{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=f9.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}$p(f9.ID,f9,0),Np(class extends g9{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:e(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:h9,kbOpts:{kbExpr:PC.editorTextFocus,primary:65,weight:100}})}}),Np(class extends g9{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:e(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:h9,kbOpts:{kbExpr:PC.editorTextFocus,primary:1089,weight:100}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.wordHighlight.trigger",label:e(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:h9.toNegated(),kbOpts:{kbExpr:PC.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=f9.get(i);s&&s.restoreViewState(!0)}});class p9 extends Fp{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=cl(i.getOption(126)),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=>tC.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 bs(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new bs(i.lineNumber,i.column,i.lineNumber,i.column)}}class m9 extends p9{_move(t,i,e,s){return pC.moveWordLeft(t,i,e,s)}}class v9 extends p9{_move(t,i,e,s){return pC.moveWordRight(t,i,e,s)}}class w9 extends Fp{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(_c);if(!i.hasModel())return;const n=cl(i.getOption(126)),r=i.getModel(),o=i.getSelections(),h=i.getOption(5),c=i.getOption(9),u=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),l=i._getViewModel(),a=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(7),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:l.getCursorAutoClosedCharacters()},this._wordNavigationType);return new hC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class b9 extends w9{_delete(t,i){return pC.deleteWordLeft(t,i)||new ws(1,1,1,1)}}class y9 extends w9{_delete(t,i){const e=pC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ws(s,n,s,n)}}Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),Pp(new class extends m9{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),Pp(new class extends v9{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),Pp(new class extends v9{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:PC.writable})}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:PC.writable})}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:PC.writable})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:PC.writable})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),Np(class extends Tp{constructor(){super({id:"deleteInsideWord",precondition:PC.writable,label:e(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=cl(i.getOption(126)),n=i.getModel(),r=i.getSelections().map((t=>{const i=pC.deleteInsideWord(s,n,t);return new hC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class k9 extends p9{_move(t,i,e,s){return mC.moveWordPartLeft(t,i,e)}}fp.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),fp.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class C9 extends p9{_move(t,i,e,s){return mC.moveWordPartRight(t,i,e)}}Pp(new class extends w9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return mC.deleteWordPartLeft(t)||new ws(1,1,1,1)}}),Pp(new class extends w9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=mC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ws(s,n,s,n)}}),Pp(new class extends k9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),Pp(new class extends k9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),Pp(new class extends C9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),Pp(new class extends C9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class S9 extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=kK.get(this.editor);t&&this.editor.hasModel()&&t.showMessage(e(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"),this.editor.getPosition())}}S9.ID="editor.contrib.readOnlyMessageController",$p(S9.ID,S9,2);var x9=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=function(t,i){return function(e,s){i(e,s,t)}};const E9=new Jo("accessibilityHelpWidgetVisible",!1);let A9=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i){super(),this._editor=t,this._widget=this._register(i.createInstance(L9,this._editor))}show(){this._widget.show()}hide(){this._widget.hide()}};A9.ID="editor.contrib.accessibilityHelpController",A9=x9([D9(1,eo)],A9);let L9=class t extends gy{constructor(t,i,e,s){super(),this._contextKeyService=i,this._keybindingService=e,this._openerService=s,this._editor=t,this._isVisibleKey=E9.bindTo(this._contextKeyService),this._domNode=Ur(document.createElement("div")),this._domNode.setClassName("accessibilityHelpWidget"),this._domNode.setDisplay("none"),this._domNode.setAttribute("role","dialog"),this._domNode.setAttribute("aria-modal","true"),this._domNode.setAttribute("aria-hidden","true");const n=Lg(this._domNode.domNode,Rg("h1",void 0,EP.accessibilityHelpTitle));n.id="help-dialog-heading",this._domNode.setAttribute("aria-labelledby",n.id),this._contentDomNode=Ur(document.createElement("div")),this._contentDomNode.setAttribute("role","document"),this._contentDomNode.domNode.id="help-dialog-content",this._domNode.appendChild(this._contentDomNode),this._contentDomNode.setAttribute("aria-describedby",this._contentDomNode.domNode.id),this._isVisible=!1,this._register(this._editor.onDidLayoutChange((()=>{this._isVisible&&this._layout()}))),this._register(Qf(this._contentDomNode.domNode,"keydown",(t=>{if(this._isVisible&&(t.equals(2083)&&(Yg(EP.emergencyConfOn),this._editor.updateOptions({accessibilitySupport:"on"}),Kf(this._contentDomNode.domNode),this._buildContent(),this._contentDomNode.domNode.focus(),t.preventDefault(),t.stopPropagation()),t.equals(2086))){Yg(EP.openingDocs);let i=this._editor.getRawOptions().accessibilityHelpUrl;void 0===i&&(i="https://go.microsoft.com/fwlink/?linkid=852450"),this._openerService.open(os.parse(i)),t.preventDefault(),t.stopPropagation()}}))),this.onblur(this._contentDomNode.domNode,(()=>{this.hide()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return t.ID}getDomNode(){return this._domNode.domNode}getPosition(){return{preference:null}}show(){this._isVisible||(this._isVisible=!0,this._isVisibleKey.set(!0),this._layout(),this._domNode.setDisplay("block"),this._domNode.setAttribute("aria-hidden","false"),this._contentDomNode.domNode.tabIndex=0,this._buildContent(),this._contentDomNode.domNode.focus())}_descriptionForCommand(t,i,e){const s=this._keybindingService.lookupKeybinding(t);return s?Rn(i,s.getAriaLabel()):Rn(e,t)}_buildContent(){const t=this._contentDomNode.domNode,i=this._editor.getOptions(),e=this._editor.getSelections();let s=0;if(e){const t=this._editor.getModel();t&&e.forEach((i=>{s+=t.getValueLengthInRange(i)}))}Lg(t,Rg("p",void 0,function(t,i){return t&&0!==t.length?1===t.length?i?Rn(EP.singleSelectionRange,t[0].positionLineNumber,t[0].positionColumn,i):Rn(EP.singleSelection,t[0].positionLineNumber,t[0].positionColumn):i?Rn(EP.multiSelectionRange,t.length,i):t.length>0?Rn(EP.multiSelection,t.length):"":EP.noSelection}(e,s)));Lg(t,Rg("p")).textContent=i.get(59)?i.get(88)?EP.readonlyDiffEditor:EP.editableDiffEditor:i.get(88)?EP.readonlyEditor:EP.editableEditor;const n=Lg(t,Rg("ul")),r=b?EP.changeConfigToOnMac:EP.changeConfigToOnWinLinux;switch(i.get(2)){case 0:Lg(n,Rg("li",void 0,r));break;case 2:Lg(n,Rg("li",void 0,EP.auto_on));break;case 1:Lg(n,Rg("li",void 0,EP.auto_off,r))}i.get(139)?Lg(n,Rg("li",void 0,this._descriptionForCommand(T6.ID,EP.tabFocusModeOnMsg,EP.tabFocusModeOnMsgNoKb))):Lg(n,Rg("li",void 0,this._descriptionForCommand(T6.ID,EP.tabFocusModeOffMsg,EP.tabFocusModeOffMsgNoKb))),Lg(n,Rg("li",void 0,b?EP.openDocMac:EP.openDocWinLinux)),Lg(t,Rg("p",void 0,EP.outroMsg))}hide(){this._isVisible&&(this._isVisible=!1,this._isVisibleKey.reset(),this._domNode.setDisplay("none"),this._domNode.setAttribute("aria-hidden","true"),this._contentDomNode.domNode.tabIndex=-1,Kf(this._contentDomNode.domNode),this._editor.focus())}_layout(){const i=this._editor.getLayoutInfo(),e=Math.max(5,Math.min(t.WIDTH,i.width-40)),s=Math.max(5,Math.min(t.HEIGHT,i.height-40));this._domNode.setWidth(e),this._domNode.setHeight(s);const n=Math.round((i.height-s)/2);this._domNode.setTop(n);const r=Math.round((i.width-e)/2);this._domNode.setLeft(r)}};L9.ID="editor.contrib.accessibilityHelpWidget",L9.WIDTH=500,L9.HEIGHT=300,L9=x9([D9(1,Qo),D9(2,eP),D9(3,W_)],L9),$p(A9.ID,A9,4),Np(class extends Tp{constructor(){super({id:"editor.action.showAccessibilityHelp",label:EP.showAccessibilityHelpAction,alias:"Show Accessibility Help",precondition:void 0,kbOpts:{primary:571,weight:100,linux:{primary:1595,secondary:[571]}}})}run(t,i){const e=A9.get(i);null==e||e.show()}}),Pp(new(Fp.bindToContribution(A9.get))({id:"closeAccessibilityHelp",precondition:E9,handler:t=>t.hide(),kbOpts:{weight:200,kbExpr:PC.focus,primary:9,secondary:[1033]}}));class M9 extends Hi{constructor(t){super(),this.editor=t,this.widget=null,x&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(88);!this.widget&&t?this.widget=new O9(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}M9.ID="editor.contrib.iPadShowKeyboard";class O9 extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Zf(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Zf(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return O9.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}O9.ID="editor.contrib.ShowKeyboardWidget",$p(M9.ID,M9,3);var F9=function(t,i){return function(e,s){i(e,s,t)}};let T9=class t extends Hi{static get(i){return i.getContribution(t.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($s.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 R9(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};T9.ID="editor.contrib.inspectTokens",T9=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}([F9(1,fV),F9(2,hc)],T9);class R9 extends Hi{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=$s.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>Kc,tokenize:(t,e,s)=>qc(i,s),tokenizeEncoded:(t,i,e)=>Gc(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 R9._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)),Mg(this._domNode,Rg("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),Rg("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Lg(this._domNode,Rg("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Lg(this._domNode,Rg("table.tm-metadata-table",void 0,Rg("tbody",void 0,Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"language"),Rg("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"token type"),Rg("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"font style"),Rg("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"foreground"),Rg("td.tm-metadata-value",void 0,`${o?ea.Format.CSS.formatHex(o.foreground):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"background"),Rg("td.tm-metadata-value",void 0,`${o?ea.Format.CSS.formatHex(o.background):"-?-"}`))))),Lg(this._domNode,Rg("hr.tokens-inspect-separator")),e<i.tokens1.length&&Lg(this._domNode,Rg("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=$s.getColorMap(),e=Ra.getLanguageId(t),s=Ra.getTokenType(t),n=Ra.getFontStyle(t),r=Ra.getForeground(t),o=Ra.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]}}}R9._ID="editor.contrib.inspectTokensWidget",$p(T9.ID,T9,4),Np(class extends Tp{constructor(){super({id:"editor.action.inspectTokens",label:AP.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=T9.get(i);null==e||e.launch()}});var _9=function(t,i){return function(e,s){i(e,s,t)}};let I9=class t{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=dc.as(Vj)}provide(i){const e=new Vi;return e.add(i.onDidAccept((()=>{const[t]=i.selectedItems;t&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})}))),e.add(i.onDidChangeValue((i=>{const e=this.registry.getQuickAccessProvider(i.substr(t.PREFIX.length));e&&e.prefix&&e.prefix!==t.PREFIX&&this.quickInputService.quickAccess.show(e.prefix,{preserveValue:!0})}))),i.items=this.getQuickAccessProviders().filter((i=>i.prefix!==t.PREFIX)),e}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 s=i.prefix||t.prefix,n=s||"…";return{prefix:s,label:n,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:e(0,"{0}, {1}",n,i.description),description:i.description}}))}};I9.PREFIX="?",I9=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}([_9(0,Kj),_9(1,eP)],I9),dc.as(Vj).registerQuickAccessProvider({ctor:I9,prefix:"",helpEntries:[{description:MP.helpQuickAccessActionLabel}]});class P9{constructor(t){this.options=t,this.rangeHighlightDecorationId=void 0}provide(t,i){var e;const s=new Vi;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 zi);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){const e=new Vi,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const n={editor:s},r=ZH(s);if(r){let t=Rt(s.saveViewState());e.add(r.onDidChangeCursorPosition((()=>{t=Rt(s.saveViewState())}))),n.restoreViewState=()=>{t&&s===this.activeTextEditorControl&&s.restoreViewState(t)},e.add(Ni(i.onCancellationRequested)((()=>{var t;return null===(t=n.restoreViewState)||void 0===t?void 0:t.call(n)})))}e.add(Wi((()=>this.clearDecorations(s)))),e.add(this.provideWithTextEditor(n,t,i))}else e.add(this.provideWithoutTextEditor(t,i));return e}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&&Yg(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return GH(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:Xy(bk),position:uh.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 N9 extends P9{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=e(0,"Open a text editor first to go to a line.");return t.items=[{label:i}],t.ariaLabel=i,Hi.None}provideWithTextEditor(t,i,e){const s=t.editor,n=new Vi;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(N9.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=ZH(s);return o&&2===o.getOptions().get(65).renderType&&(o.updateOptions({lineNumbers:"on"}),n.add(Wi((()=>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,s){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,s)?e(0,"Go to line {0} and character {1}.",i,s):e(0,"Go to line {0}.",i);const n=t.getPosition()||{lineNumber:1,column:1},r=this.lineCount(t);return r>1?e(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,r):e(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.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}}N9.PREFIX=":";let B9=class extends N9{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Qi.None}get activeTextEditorControl(){return Rt(this.editorService.getFocusedCodeEditor())}};B9=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,ro)],B9);class $9 extends Tp{constructor(){super({id:$9.ID,label:LP.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Kj).quickAccess.show(B9.PREFIX)}}$9.ID="editor.action.gotoLine",Np($9),dc.as(Vj).registerQuickAccessProvider({ctor:B9,prefix:B9.PREFIX,helpEntries:[{description:LP.gotoLineActionLabel,commandId:$9.ID}]});const j9=[void 0,[]];function W9(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]=V9(t,o,e,s);if("number"!=typeof i)return j9;n+=i,r.push(...h)}return[n,H9(r)]}(t,i.values,e,s):V9(t,i,e,s)}function V9(t,i,e,s){const n=vF(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],sF(n)]:j9}function H9(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 z9(t){return t.startsWith('"')&&t.endsWith('"')}function U9(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=K9(t),r=e.indexOf(Xe)>=0,o=z9(t);let h;const c=t.split(" ");if(c.length>1)for(const t of c){const i=z9(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=K9(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 K9(t){let i;i=t.replace(w?/\//g:/\\/g,Xe);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function q9(t){return Array.isArray(t)?U9(t.map((t=>t.original)).join(" ")):U9(t.original)}Object.freeze({score:0});var G9=function(t,i){return function(e,s){i(e,s,t)}},Z9=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let J9=class t extends P9{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,e(0,"To go to a symbol, first open a text editor with symbol information.")),Hi.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):Hi.None}doProvideWithoutEditorSymbols(t,i,s,n){const r=new Vi;return this.provideLabelPick(s,e(0,"The active text editor does not provide symbol information.")),(()=>{Z9(this,void 0,void 0,(function*(){(yield this.waitForLanguageSymbolRegistry(i,r))&&!n.isCancellationRequested&&r.add(this.doProvideWithEditorSymbols(t,i,s,n))}))})(),r}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}waitForLanguageSymbolRegistry(t,i){return Z9(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new fu,s=i.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>{this._languageFeaturesService.documentSymbolProvider.has(t)&&(s.dispose(),e.complete(!0))})));return i.add(Wi((()=>e.complete(!1)))),e.p}))}doProvideWithEditorSymbols(i,s,n,r){var o;const h=i.editor,c=new Vi;c.add(n.onDidAccept((t=>{const[e]=n.selectedItems;e&&e.range&&(this.gotoLocation(i,{range:e.range.selection,keyMods:n.keyMods,preserveFocus:t.inBackground}),t.inBackground||n.hide())}))),c.add(n.onDidTriggerItemButton((({item:t})=>{t&&t.range&&(this.gotoLocation(i,{range:t.range.selection,keyMods:n.keyMods,forceSideBySide:!0}),n.hide())})));const u=this.getDocumentSymbols(s,r);let l;const a=i=>Z9(this,void 0,void 0,(function*(){null==l||l.dispose(!0),n.busy=!1,l=new pe(r),n.busy=!0;try{const s=U9(n.value.substr(t.PREFIX.length).trim()),o=yield this.doGetSymbolPicks(u,s,void 0,l.token);if(r.isCancellationRequested)return;if(o.length>0){if(n.items=o,i&&0===s.original.length){const t=nt(o,(t=>Boolean("separator"!==t.type&&t.range&&ws.containsPosition(t.range.decoration,i))));t&&(n.activeItems=[t])}}else this.provideLabelPick(n,e(0,s.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{r.isCancellationRequested||(n.busy=!1)}}));return c.add(n.onDidChangeValue((()=>a(void 0)))),a(null===(o=h.getSelection())||void 0===o?void 0:o.getPosition()),c.add(n.onDidChangeActive((()=>{const[t]=n.activeItems;t&&t.range&&(h.revealRangeInCenter(t.range.selection,0),this.addDecorations(h,t.range.decoration))}))),c}doGetSymbolPicks(i,s,n,r){var o,h;return Z9(this,void 0,void 0,(function*(){const c=yield i;if(r.isCancellationRequested)return[];const u=0===s.original.indexOf(t.SCOPE_PREFIX),l=u?1:0;let a,d,f;s.values&&s.values.length>1?(a=q9(s.values[0]),d=q9(s.values.slice(1))):a=s;const g=null===(h=null===(o=this.options)||void 0===o?void 0:o.openSideBySideDirection)||void 0===h?void 0:h.call(o);g&&(f=[{iconClass:np.asClassName("right"===g?Ss.splitHorizontal:Ss.splitVertical),tooltip:e(0,"right"===g?"Open to the Side":"Open to the Bottom")}]);const p=[];for(let w=0;w<c.length;w++){const b=c[w],y=Pn(b.name),k=`$(${Ls.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==n?void 0:n.extraContainerLabel)&&(A=A?`${n.extraContainerLabel} • ${A}`:n.extraContainerLabel),s.original.length>l){let M=!1;if(a!==s&&([S,x]=W9(k,Object.assign(Object.assign({},s),{values:void 0}),l,C),"number"==typeof S&&(M=!0)),"number"!=typeof S&&([S,x]=W9(k,a,l,C),"number"!=typeof S))continue;if(!M&&d){if(A&&d.original.length>0&&([D,E]=W9(A,d)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const L=b.tags&&b.tags.indexOf(1)>=0;p.push({index:w,kind:b.kind,score:S,label:k,ariaLabel:y,description:A,highlights:L?void 0:{label:x,description:E},range:{selection:ws.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:L,buttons:f})}const m=p.sort(((t,i)=>u?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let v=[];if(u){let O,F,T=0;function R(){F&&"number"==typeof O&&T>0&&(F.label=Rn(Y9[O]||Q9,T))}for(const _ of m)O!==_.kind?(R(),O=_.kind,T=1,F={type:"separator"},v.push(F)):T++,v.push(_);R()}else m.length>0&&(v=[{label:e(0,"symbols ({0})",p.length),type:"separator"},...m]);return v}))}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=(Y9[t.kind]||Q9).localeCompare(Y9[i.kind]||Q9);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return Z9(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};J9.PREFIX="@",J9.SCOPE_PREFIX=":",J9.PREFIX_BY_CATEGORY=`${J9.PREFIX}${J9.SCOPE_PREFIX}`,J9=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}([G9(0,ka),G9(1,L1)],J9);const Q9=e(0,"properties ({0})"),Y9={5:e(0,"methods ({0})"),11:e(0,"functions ({0})"),8:e(0,"constructors ({0})"),12:e(0,"variables ({0})"),4:e(0,"classes ({0})"),22:e(0,"structs ({0})"),23:e(0,"events ({0})"),24:e(0,"operators ({0})"),10:e(0,"interfaces ({0})"),2:e(0,"namespaces ({0})"),3:e(0,"packages ({0})"),25:e(0,"type parameters ({0})"),1:e(0,"modules ({0})"),6:e(0,"properties ({0})"),9:e(0,"enumerations ({0})"),21:e(0,"enumeration members ({0})"),14:e(0,"strings ({0})"),0:e(0,"files ({0})"),17:e(0,"arrays ({0})"),15:e(0,"numbers ({0})"),16:e(0,"booleans ({0})"),18:e(0,"objects ({0})"),19:e(0,"keys ({0})"),7:e(0,"fields ({0})"),13:e(0,"constants ({0})")};var X9=function(t,i){return function(e,s){i(e,s,t)}};let t7=class extends J9{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Qi.None}get activeTextEditorControl(){return Rt(this.editorService.getFocusedCodeEditor())}};t7=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}([X9(0,ro),X9(1,ka),X9(2,L1)],t7);class i7 extends Tp{constructor(){super({id:i7.ID,label:FP.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:PC.hasDocumentSymbolProvider,kbOpts:{kbExpr:PC.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Kj).quickAccess.show(J9.PREFIX,{itemActivation:Uj.NONE})}}function e7(t,i){return i&&(t.stack||t.stacktrace)?e(0,"{0}: {1}",n7(t),s7(t.stack)||s7(t.stacktrace)):n7(t)}function s7(t){return Array.isArray(t)?t.join("\n"):t}function n7(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?e(0,"A system error occurred ({0})",t.message):t.message||e(0,"An unknown error occurred. Please consult the log for more details.")}function r7(t=null,i=!1){if(!t)return e(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const s=X(t),n=r7(s[0],i);return s.length>1?e(0,"{0} ({1} errors in total)",n,s.length):n}if(yt(t))return t;if(t.detail){const e=t.detail;if(e.error)return e7(e.error,i);if(e.exception)return e7(e.exception,i)}return t.stack?e7(t,i):t.message?t.message:e(0,"An unknown error occurred. Please consult the log for more details.")}i7.ID="editor.action.quickOutline",Np(i7),dc.as(Vj).registerQuickAccessProvider({ctor:t7,prefix:J9.PREFIX,helpEntries:[{description:FP.quickOutlineActionLabel,prefix:J9.PREFIX,commandId:i7.ID},{description:FP.quickOutlineByCategoryActionLabel,prefix:J9.PREFIX_BY_CATEGORY}]});var o7,h7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function c7(t){return Array.isArray(t.items)}function u7(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"}(o7||(o7={}));class l7 extends Hi{constructor(t,i){super(),this.prefix=t,this.options=i}provide(t,i,e){var s;const n=new Vi;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 zi),h=()=>h7(this,void 0,void 0,(function*(){const s=o.value=new Vi;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),u=(i,e)=>{var s;let n,r;if(c7(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=Ft(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},l=i=>h7(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>h7(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield ru(i.mergeDelay),n.isCancellationRequested)||s||(e=u(i.picks,!0))})))(),(()=>h7(this,void 0,void 0,(function*(){t.busy=!0;try{const r=yield i.additionalPicks;if(n.isCancellationRequested)return;let o,h,c,l;if(c7(i.picks)?(o=i.picks.items,h=i.picks.active):o=i.picks,c7(r)?(c=r.items,l=r.active):c=r,c.length>0||!e){let i;if(!h&&!l){const e=t.activeItems[0];e&&-1!==o.indexOf(e)&&(i=e)}u({items:[...o,...c],active:h||l||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(u7(c))yield l(c);else if(c instanceof Promise){t.busy=!0;try{const i=yield c;if(n.isCancellationRequested)return;u7(i)?yield l(i):u(i)}finally{n.isCancellationRequested||(t.busy=!1)}}else u(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((({button:e,item:s})=>h7(this,void 0,void 0,(function*(){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:yield e;if(i.isCancellationRequested)return;switch(n){case o7.NO_ACTION:break;case o7.CLOSE_PICKER:t.hide();break;case o7.REFRESH_PICKER:h();break;case o7.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 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},d7=function(t,i){return function(e,s){i(e,s,t)}},f7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let g7=class t extends l7{constructor(i,e,s,n,r,o){super(t.PREFIX,i),this.instantiationService=e,this.keybindingService=s,this.commandService=n,this.telemetryService=r,this.dialogService=o,this.commandsHistory=this._register(this.instantiationService.createInstance(p7)),this.options=i}_getPicks(i,s,n,r){var o,h;return f7(this,void 0,void 0,(function*(){const s=yield this.getCommandPicks(n);if(n.isCancellationRequested)return[];const c=[];for(const e of s){const s=Rt(t.WORD_FILTER(i,e.label)),n=e.commandAlias?Rt(t.WORD_FILTER(i,e.commandAlias)):void 0;s||n?(e.highlights={label:s,detail:this.options.showAlias?n:void 0},c.push(e)):i===e.commandId&&c.push(e)}const u=new Map;for(const t of c){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}c.sort(((t,i)=>{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 l=[];let a=!1,d=!!this.options.suggestedCommandIds;for(let t=0;t<c.length;t++){const i=c[t];0===t&&this.commandsHistory.peek(i.commandId)&&(l.push({type:"separator",label:e(0,"recently used")}),a=!0),d&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(l.push({type:"separator",label:e(0,"commonly used")}),a=!0,d=!1),!a||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(l.push({type:"separator",label:e(0,"other commands")}),a=!1),l.push(this.toCommandPick(i,r))}return this.hasAdditionalCommandPicks(i,n)?{picks:l,additionalPicks:(()=>f7(this,void 0,void 0,(function*(){const t=yield this.getAdditionalCommandPicks(s,c,i,n);return n.isCancellationRequested?[]:t.map((t=>this.toCommandPick(t,r)))})))()}:l}))}toCommandPick(t,i){if("separator"===t.type)return t;const s=this.keybindingService.lookupKeybinding(t.commandId),n=s?e(0,"{0}, {1}",t.label,s.getAriaLabel()):t.label;return Object.assign(Object.assign({},t),{ariaLabel:n,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:s,accept:()=>f7(this,void 0,void 0,(function*(){var s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(s=null==i?void 0:i.from)&&void 0!==s?s:"quick open"});try{yield this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(e(0,"Command '{0}' resulted in an error",t.label),r7(i))}}))})}};g7.PREFIX=">",g7.WORD_FILTER=RO(_O,(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&&null===(s=JO(t,i,0,n,e));)n=QO(i,n+1);return s}),PO),g7=a7([d7(1,eo),d7(2,eP),d7(3,dp),d7(4,Ap),d7(5,A_)],g7);let p7=class t extends Hi{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))))}updateConfiguration(i){i&&!i.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=t.getConfiguredCommandHistoryLength(this.configurationService),t.cache&&t.cache.limit!==this.configuredCommandsHistoryLength&&(t.cache.limit=this.configuredCommandsHistoryLength,t.saveState(this.storageService)))}load(){const i=this.storageService.get(t.PREF_KEY_CACHE,0);let e;if(i)try{e=JSON.parse(i)}catch(t){}const s=t.cache=new TO(this.configuredCommandsHistoryLength,1);if(e){let t;t=e.usesLRU?e.entries:e.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>s.set(t.key,t.value)))}t.counter=this.storageService.getNumber(t.PREF_KEY_COUNTER,0,t.counter)}push(i){t.cache&&(t.cache.set(i,t.counter++),t.saveState(this.storageService))}peek(i){var e;return null===(e=t.cache)||void 0===e?void 0:e.peek(i)}static saveState(i){if(!t.cache)return;const e={usesLRU:!0,entries:[]};t.cache.forEach(((t,i)=>e.entries.push({key:i,value:t}))),i.store(t.PREF_KEY_CACHE,JSON.stringify(e),0,0),i.store(t.PREF_KEY_COUNTER,t.counter,0,0)}static getConfiguredCommandHistoryLength(i){var e,s;const n=null===(s=null===(e=i.getValue().workbench)||void 0===e?void 0:e.commandPalette)||void 0===s?void 0:s.history;return"number"==typeof n?n:t.DEFAULT_COMMANDS_HISTORY_LENGTH}};p7.DEFAULT_COMMANDS_HISTORY_LENGTH=50,p7.PREF_KEY_CACHE="commandPalette.mru.cache",p7.PREF_KEY_COUNTER="commandPalette.mru.counter",p7.counter=1,p7=a7([d7(0,hN),d7(1,ic)],p7);class m7 extends g7{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:DF(e.label)||e.id});return i}}var v7=function(t,i){return function(e,s){i(e,s,t)}},w7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let b7=class extends m7{get activeTextEditorControl(){return Rt(this.codeEditorService.getFocusedCodeEditor())}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}getCommandPicks(){return w7(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return w7(this,void 0,void 0,(function*(){return[]}))}};b7=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}([v7(0,eo),v7(1,ro),v7(2,eP),v7(3,dp),v7(4,Ap),v7(5,A_)],b7);class y7 extends Tp{constructor(){super({id:y7.ID,label:OP.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Kj).quickAccess.show(b7.PREFIX)}}y7.ID="editor.action.quickCommand",Np(y7),dc.as(Vj).registerQuickAccessProvider({ctor:b7,prefix:b7.PREFIX,helpEntries:[{description:OP.quickCommandHelp,commandId:y7.ID}]});var k7=function(t,i){return function(e,s){i(e,s,t)}};let C7=class extends KG{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};C7=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}([k7(1,Qo),k7(2,ro),k7(3,IM),k7(4,eo),k7(5,hN),k7(6,ic)],C7),$p(KG.ID,C7,4),Np(class extends Tp{constructor(){super({id:"editor.action.toggleHighContrast",label:RP.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(fV),s=e.getColorTheme();Hb(s.type)?(e.setTheme(this._originalThemeName||(zb(s.type)?nV:sV)),this._originalThemeName=null):(e.setTheme(zb(s.type)?rV:oV),this._originalThemeName=s.themeName)}});var S7="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function x7(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 D7=x7((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,u,l,a,d,f,g,p,m,v,w,b,y,k,C,S,x,D,E,A,L,M;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 Ot.objectLiteral(i)&&Ot.uinteger(i.line)&&Ot.uinteger(i.character)}}(o||(i.Position=o={})),function(t){t.create=function(t,i,e,s){if(Ot.uinteger(t)&&Ot.uinteger(i)&&Ot.uinteger(e)&&Ot.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 Ot.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 Ot.objectLiteral(i)&&h.is(i.range)&&(Ot.string(i.uri)||Ot.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 Ot.objectLiteral(i)&&h.is(i.targetRange)&&Ot.string(i.targetUri)&&h.is(i.targetSelectionRange)&&(h.is(i.originSelectionRange)||Ot.undefined(i.originSelectionRange))}}(u||(i.LocationLink=u={})),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 Ot.objectLiteral(i)&&Ot.numberRange(i.red,0,1)&&Ot.numberRange(i.green,0,1)&&Ot.numberRange(i.blue,0,1)&&Ot.numberRange(i.alpha,0,1)}}(l||(i.Color=l={})),function(t){t.create=function(t,i){return{range:t,color:i}},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&h.is(i.range)&&l.is(i.color)}}(a||(i.ColorInformation=a={})),function(t){t.create=function(t,i,e){return{label:t,textEdit:i,additionalTextEdits:e}},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.string(i.label)&&(Ot.undefined(i.textEdit)||k.is(i))&&(Ot.undefined(i.additionalTextEdits)||Ot.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 Ot.defined(e)&&(o.startCharacter=e),Ot.defined(s)&&(o.endCharacter=s),Ot.defined(n)&&(o.kind=n),Ot.defined(r)&&(o.collapsedText=r),o},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.uinteger(i.startLine)&&Ot.uinteger(i.startLine)&&(Ot.undefined(i.startCharacter)||Ot.uinteger(i.startCharacter))&&(Ot.undefined(i.endCharacter)||Ot.uinteger(i.endCharacter))&&(Ot.undefined(i.kind)||Ot.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 Ot.defined(i)&&c.is(i.location)&&Ot.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}(v||(i.DiagnosticTag=v={})),function(t){t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.string(i.href)}}(w||(i.CodeDescription=w={})),function(t){t.create=function(t,i,e,s,n,r){var o={range:t,message:i};return Ot.defined(e)&&(o.severity=e),Ot.defined(s)&&(o.code=s),Ot.defined(n)&&(o.source=n),Ot.defined(r)&&(o.relatedInformation=r),o},t.is=function(t){var i,e=t;return Ot.defined(e)&&h.is(e.range)&&Ot.string(e.message)&&(Ot.number(e.severity)||Ot.undefined(e.severity))&&(Ot.integer(e.code)||Ot.string(e.code)||Ot.undefined(e.code))&&(Ot.undefined(e.codeDescription)||Ot.string(null===(i=e.codeDescription)||void 0===i?void 0:i.href))&&(Ot.string(e.source)||Ot.undefined(e.source))&&(Ot.undefined(e.relatedInformation)||Ot.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 Ot.defined(e)&&e.length>0&&(n.arguments=e),n},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.title)&&Ot.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 Ot.objectLiteral(i)&&Ot.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 Ot.objectLiteral(i)&&Ot.string(i.label)&&(Ot.boolean(i.needsConfirmation)||void 0===i.needsConfirmation)&&(Ot.string(i.description)||void 0===i.description)}}(C||(i.ChangeAnnotation=C={})),function(t){t.is=function(t){return Ot.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 Ot.defined(i)&&T.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&&Ot.string(i.uri)&&(void 0===i.options||(void 0===i.options.overwrite||Ot.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ot.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&&Ot.string(i.oldUri)&&Ot.string(i.newUri)&&(void 0===i.options||(void 0===i.options.overwrite||Ot.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ot.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&&Ot.string(i.uri)&&(void 0===i.options||(void 0===i.options.recursive||Ot.boolean(i.options.recursive))&&(void 0===i.options.ignoreIfNotExists||Ot.boolean(i.options.ignoreIfNotExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(L||(i.DeleteFile=L={})),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 Ot.string(t.kind)?E.is(t)||A.is(t)||L.is(t):D.is(t)})))}}(M||(i.WorkspaceEdit=M={}));var O,F,T,R,_,I,P,N,B,$,j,W,V,H,z,U,K,q,G,Z,J,Q,Y,X,tt,it,et,st,nt,rt,ot,ht,ct,ut,lt,at,dt,ft,gt,pt,mt,vt,wt,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}(),Lt=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}(),Mt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Lt(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(T.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 Lt,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=L.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=L.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Mt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)}}(O||(i.TextDocumentIdentifier=O={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)&&Ot.integer(i.version)}}(F||(i.VersionedTextDocumentIdentifier=F={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)&&(null===i.version||Ot.integer(i.version))}}(T||(i.OptionalVersionedTextDocumentIdentifier=T={})),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 Ot.defined(i)&&Ot.string(i.uri)&&Ot.string(i.languageId)&&Ot.integer(i.version)&&Ot.string(i.text)}}(R||(i.TextDocumentItem=R={})),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 Ot.objectLiteral(t)&&_.is(i.kind)&&Ot.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&&Ot.string(i.newText)&&h.is(i.insert)&&h.is(i.replace)}}($||(i.InsertReplaceEdit=$={})),function(t){t.asIs=1,t.adjustIndentation=2}(j||(i.InsertTextMode=j={})),function(t){t.is=function(t){var i=t;return i&&(Ot.string(i.detail)||void 0===i.detail)&&(Ot.string(i.description)||void 0===i.description)}}(W||(i.CompletionItemLabelDetails=W={})),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 Ot.string(i)||Ot.objectLiteral(i)&&Ot.string(i.language)&&Ot.string(i.value)}}(z||(i.MarkedString=z={})),function(t){t.is=function(t){var i=t;return!!i&&Ot.objectLiteral(i)&&(I.is(i.contents)||z.is(i.contents)||Ot.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 Ot.defined(i)&&(n.documentation=i),n.parameters=Ot.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 Ot.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&&Ot.string(i.name)&&Ot.number(i.kind)&&h.is(i.range)&&h.is(i.selectionRange)&&(void 0===i.detail||Ot.string(i.detail))&&(void 0===i.deprecated||Ot.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 Ot.defined(i)&&Ot.typedArray(i.diagnostics,b.is)&&(void 0===i.only||Ot.typedArray(i.only,Ot.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&&Ot.string(i.title)&&(void 0===i.diagnostics||Ot.typedArray(i.diagnostics,b.is))&&(void 0===i.kind||Ot.string(i.kind))&&(void 0!==i.edit||void 0!==i.command)&&(void 0===i.command||y.is(i.command))&&(void 0===i.isPreferred||Ot.boolean(i.isPreferred))&&(void 0===i.edit||M.is(i.edit))}}(nt||(i.CodeAction=nt={})),function(t){t.create=function(t,i){var e={range:t};return Ot.defined(i)&&(e.data=i),e},t.is=function(t){var i=t;return Ot.defined(i)&&h.is(i.range)&&(Ot.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 Ot.defined(i)&&Ot.uinteger(i.tabSize)&&Ot.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 Ot.defined(i)&&h.is(i.range)&&(Ot.undefined(i.target)||Ot.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 Ot.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"}(ut||(i.SemanticTokenTypes=ut={})),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"}(lt||(i.SemanticTokenModifiers=lt={})),function(t){t.is=function(t){var i=t;return Ot.objectLiteral(i)&&(void 0===i.resultId||"string"==typeof i.resultId)&&Array.isArray(i.data)&&(0===i.data.length||"number"==typeof i.data[0])}}(at||(i.SemanticTokens=at={})),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)&&Ot.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)&&Ot.boolean(i.caseSensitiveLookup)&&(Ot.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)&&(Ot.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 Ot.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 Ot.objectLiteral(i)&&(void 0===i.tooltip||Ot.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.location||c.is(i.location))&&(void 0===i.command||y.is(i.command))}}(vt||(i.InlayHintLabelPart=vt={})),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 Ot.objectLiteral(i)&&o.is(i.position)&&(Ot.string(i.label)||Ot.typedArray(i.label,vt.is))&&(void 0===i.kind||mt.is(i.kind))&&void 0===i.textEdits||Ot.typedArray(i.textEdits,k.is)&&(void 0===i.tooltip||Ot.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.paddingLeft||Ot.boolean(i.paddingLeft))&&(void 0===i.paddingRight||Ot.boolean(i.paddingRight))}}(wt||(i.InlayHint=wt={})),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 Ot.objectLiteral(i)&&s.is(i.uri)&&Ot.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 u=e(n[o],r[h]);t[c++]=u<=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 Ft(t,i,e,s)},t.is=function(t){var i=t;return!!(Ot.defined(i)&&Ot.string(i.uri)&&(Ot.undefined(i.languageId)||Ot.string(i.languageId))&&Ot.uinteger(i.lineCount)&&Ot.func(i.getText)&&Ot.func(i.positionAt)&&Ot.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),u=t.offsetAt(h.range.end);if(!(u<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(u,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var Ot,Ft=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)}}(Ot||(Ot={}))}(0,i),void 0!==e&&(t.exports=e)}));const E7="define"in window&&"function"==typeof window.define&&"amd"in window.define;function A7(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function L7(){return E7?A7("esri/arcade"):await import("@arcgis/core/arcade.js")}async function M7(){return E7?A7("esri/request"):(await import("@arcgis/core/request.js")).default}async function O7(t){return new(await async function(){return E7?A7("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function F7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function T7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function R7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function _7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function I7(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function P7(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function N7(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function B7(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function $7(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var j7=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function W7(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 V7(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)W7(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function H7(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 z7(t){let i=H7(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function U7(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(U7(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(U7(e.children[t],i))return!0;return!1}function K7(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void U7(t,i);let e=new MutationObserver((()=>{e.disconnect(),U7(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function q7(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function G7(){return[q7(2),q7(1),q7(1),q7(1),q7(3)].join("-")}var Z7=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"]),J7=new Map;async function Q7(t,i,e=""){let s=`${i}/${e}${t}.json`;if(J7.has(s))return J7.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return J7.set(s,t),t}if("en"===t)return void J7.set(s,void 0);let r=await Q7("en",i,e);return J7.set(s,r),r}catch{return void J7.set(s,void 0)}}var Y7=new WeakMap,X7=new WeakMap,t8=new WeakMap;async function i8(t,i,e){X7.set(t,i),Y7.set(t,V7(t._hostElt,["lang"],(()=>{s8(t,e)}))),await s8(t,e)}function e8(t){Y7.get(t)?.disconnect(),Y7.delete(t),X7.delete(t)}async function s8(t,i){let e=function(t){let i=function(t,i,e){return H7(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(Z7.has(i))return i;let e=i.slice(0,2);return Z7.has(e)?e:"en"}(t._hostElt);if(e===t._locale)return;let s=t8.get(t);if(!s){let i=X7.get(t)??"",n=t._hostElt.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${n}/t9n`,o=`${n}.t9n.`;t._locale=e,s=await Q7(t._locale,r,o)}t._t9nStrings=s,await(i?.call(t))}function n8(t,i){return new Array(i+1).join(t)}function r8(t){let i='"',e="'";t.indexOf(i)>=0&&t.indexOf(e)<0&&(e='"',i="'");let s=new RegExp("(^|[^\\\\])((?:\\\\{2})*)((?:\\\\"+e+")+)","g");t=t.replace(s,((t,i,s,n)=>i+s+n8(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+n8("\\"+i,n.length))),i+t+i}function o8(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function h8(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function c8(t){return"‎"+(t??"")+"‎"}function u8(t){return null!==t}function l8(t){return void 0!==t}function a8(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 d8(t){try{return new URL(t),!0}catch{return!1}}function f8(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=o8(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 g8(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 p8(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 m8(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 v8(t){return!!t?.typeIdField}function w8(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(v8(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 b8(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new L8({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new F8(t,e,s)}const y8=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function k8(t,i=!0){return t.match(y8)?`${i?".":""}${t}`:`["${t}"]`}function C8(t,i){return t?`${t}${k8(i)}`:i}async function S8(t){if(!t)return null;let i=null;if(F7(t)||T7(t)||N7(t))i=t;else if(i=await O7(t),!R7(i))return console.error("Invalid FeatureSetDefinition",t),null;return i?("function"==typeof i?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null)}function x8(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 D8(t,i=D7.CompletionItemKind.Variable){if(!t)return[];const e=await Promise.all(t.map((async t=>{switch(t.type){case"dictionary":return 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 D8(s,D7.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:r}}}}(t,i);case"feature":return async function(t,i){const e=await t.loadSource(),{name:s}=t,n=t.getDescription(),r={label:s,detail:s,insertText:s,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],u=[];return p8(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=k8(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:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:D7.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}`),u.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:D7.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...u],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:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class E8{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?c8(this._label):h8(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:h8(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class A8 extends E8{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 L8 extends A8{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?m8(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class M8 extends A8{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?m8(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class O8 extends A8{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 F8 extends E8{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class T8 extends O8{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new F8(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=C8(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new L8({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new _8({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new I8({profile:this._profile,declaration:t,label:i,snippet:i},[new L8({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new P8({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new T8({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new M8({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 R8 extends O8{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"}loadSource(){return u8(this._loadPromise)&&l8(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?C8(this.snippet,t.name):t.name;return new L8({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:g8(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if("function"!=typeof this._source?.getFieldDomain)return null;const i="feature"===this.type?C8(this.snippet,t.name):t.name,e=new T8({profile:this._profile,label:i,description:t.alias??t.name,snippet:i,icon:"form-dropdown"}),s=new F8(this._profile,t.alias??t.name,[new L8({profile:this._profile,label:i,description:"",snippet:i})]);if(e.variables=[s],v8(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=b8(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new L8({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new F8(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return e.variables.push(i),e}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;s.variables.push(new L8({profile:this._profile,label:i,description:"",snippet:i}))}if(v8(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=b8(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new T8({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new F8(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(e.variables.push(i),e):null}const n=b8(this._profile,this._source.getFieldDomain?.(t.name),{code:"domainvalues"});return n?(e.variables.push(n),e):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 F8(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=`${t.url}/${i.relatedTableId}`,s=await S8({url:e});return R7(s)?s:null}(t,i);if(!R7(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new I8({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new L8({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(u8),e.variables.length?e:null}}class _8 extends R8{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return F7(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await S8(this._definition),!this._source)throw new Error("Invalid definition");const t=F7(this._source)?this._source.title:"";this.variables.push(new F8(this._profile,t,[new L8({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const i=new F8(this._profile,{code:"values"});if(this.variables.push(i),"boolean"==typeof this._source?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,e=new L8({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});i.variables.push(e)}this._source.fields.sort(w8(this._source)).forEach((t=>{i.variables.push(this._getFieldProperty(t))}));const e=await this._getRelationshipsProperty();e&&this.variables.push(e)}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 I8 extends R8{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return F7(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await S8(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new F8(this._profile,this.title,this.featureSetSnippets));const t=new F8(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(w8(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 P8 extends O8{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 u8(this._loadPromise)&&l8(this._loadPromise)||(this._loadPromise=this._loadSource()),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 F8(this._profile,t,[new L8({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new F8(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new F8(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?_7(this._definition)?this._featureSetCollectionFromWebMap(this._definition):F7(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):I7(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):B7(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=_7(t)?t:await async function(t){return new(await async function(){return E7?A7("esri/WebMap"):(await import("@arcgis/core/WebMap.js")).default}())(t)}({portalItem:t});return await i.loadAll(),await Promise.all(i.tables.map((async t=>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 E7?A7("esri/portal/PortalItem"):(await import("@arcgis/core/portal/PortalItem.js")).default}())(t)}(t);switch(await i.load(),i.type){case"Web Map":return this._featureSetCollectionFromWebMap(i);case"Feature Service":return this._featureSetCollectionFromUrl(i.url);default:return console.error("Unsupported portal item",t),null}}async _featureSetCollectionFromUrl(t){t=(t=(t=t.replace(/\/featureserver\/[0-9]*/i,"/FeatureServer")).replace(/\/mapserver\/[0-9]*/i,"/MapServer")).split("?")[0];const i=await async function(t){t+="/layers";const i=await M7(),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:x8(s.layers,n),tables:x8(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await O7({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await O7({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(R7(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 I8({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 L8({profile:this._profile,label:i,description:"",snippet:i}),new L8({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new L8({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class N8 extends T8{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 D8(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function B8(t){return R7(t)||T7(t)||B7(t)||N7(t)||P7(t)}async function $8(i="en"){const e=j8.get(i);if(e)return e;if(!Z7.has(i))return $8("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)})),j8.set(t,e),e}(i,await e.json()):"en"===i?null:$8("en")}catch(t){return null}}const j8=new Map;function W8(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(W8):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function V8(t,i="en"){if(!$7(t))return;const e=await async function(t,i="en"){return(await $8(i))?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};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(W8({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return F7(n=e)||T7(n)||B7(n)||N7(n)||P7(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return B8(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return I7(t)||_7(t)||B8(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(W8(i))}var n})),Array.isArray(t?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const H8={locale:"en"},z8=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new lz,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new lz,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 bz.isUri(t)||(t=bz.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){$7(e)&&(e=await V8(e,s.locale));const n=await Q7(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 N8(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))??H8}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))}},U8={setProfileForModel:z8.setProfileForModel.bind(z8)};export{i8 as $,h8 as B,z7 as C,d8 as D,lz as E,e8 as F,fV as I,az as K,vz as M,K7 as O,gz as R,mH as S,bz as U,a8 as V,r8 as W,G7 as _,U8 as a,S7 as b,x7 as c,z8 as d,kz as e,f8 as f,QW as g,L7 as h,M7 as i,j7 as j,dz as k,Cz as l,xz as m,D7 as n,V7 as p,c8 as q,p8 as s,FU as t,o8 as z}
62
+ var wU=Object.defineProperty,bU=Object.getOwnPropertyDescriptor,yU=Object.getOwnPropertyNames,kU=Object.prototype.hasOwnProperty,CU=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of yU(i))kU.call(t,n)||n===e||wU(t,n,{get:()=>i[n],enumerable:!(s=bU(i,n))||s.enumerable});return t},SU={};((t,i)=>{CU(SU,i,"default")})(0,xz);var xU=(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))(xU||{}),DU=(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))(DU||{}),EU=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(EU||{}),AU=(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))(AU||{}),LU=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(LU||{}),MU=class{_onDidChange=new SU.Emitter;_onDidExtraLibsChange=new SU.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)}},OU={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},FU=new MU({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},OU),TU=new MU({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},OU);function RU(){return import("./p-27d03fb2.js")}SU.languages.typescript={ModuleKind:xU,JsxEmit:DU,NewLineKind:EU,ScriptTarget:AU,ModuleResolutionKind:LU,typescriptVersion:"5.0.2",typescriptDefaults:FU,javascriptDefaults:TU,getTypeScriptWorker:()=>RU().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>RU().then((t=>t.getJavaScriptWorker()))},SU.languages.onLanguage("typescript",(()=>RU().then((t=>t.setupTypeScript(FU))))),SU.languages.onLanguage("javascript",(()=>RU().then((t=>t.setupJavaScript(TU)))));var _U=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const IU=new Jo("selectionAnchorSet",!1);let PU=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=IU.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(bs.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new MF).appendText(e(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),Yg(e(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(bs.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()}};PU.ID="editor.contrib.selectionAnchorController",PU=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,Qo)],PU),$p(PU.ID,PU,4),Np(class extends Tp{constructor(){super({id:"editor.action.setSelectionAnchor",label:e(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2080),weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.setSelectionAnchor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToSelectionAnchor",label:e(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:IU})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:e(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:IU,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2089),weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:e(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:IU,kbOpts:{kbExpr:PC.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return _U(this,void 0,void 0,(function*(){null===(e=PU.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const NU=fm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},e(0,"Overview ruler marker color for matching brackets."));class BU{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class $U extends Hi{static get(t){return t.getContribution($U.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new lu((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(69),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(69)&&(this._matchBrackets=this._editor.getOption(69),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 bs(n.lineNumber,n.column,n.lineNumber,n.column):new bs(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(ws.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 bs(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 u=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<u&&s[c].position.isBefore(e);)c++;if(c<u&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=$U._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=$U._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new BU(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}$U.ID="editor.contrib.bracketMatchingController",$U._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=sL.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:Xy(NU),position:uh.Center}}),$U._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=sL.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),$p($U.ID,$U,1),Np(class extends Tp{constructor(){super({id:"editor.action.selectToBracket",label:e(0,"Select to Bracket"),alias:"Select to Bracket",precondition:void 0,description:{description:"Select to Bracket",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=$U.get(i))||void 0===s||s.selectToBracket(n)}}),Np(class extends Tp{constructor(){super({id:"editor.action.jumpToBracket",label:e(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=$U.get(i))||void 0===e||e.jumpToBracket()}}),Np(class extends Tp{constructor(){super({id:"editor.action.removeBrackets",label:e(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=$U.get(i))||void 0===e||e.removeBrackets(this.id)}}),Cp.appendMenuItem(bp.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:e(0,"Go to &&Bracket")},order:2});class jU{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 ws(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ws(e,n,e,n),o)}else{const r=new ws(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ws(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new bs(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new bs(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class WU extends Tp{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 jU(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}Np(class extends WU{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:e(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:PC.writable})}}),Np(class extends WU{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:e(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:PC.writable})}}),Np(class extends Tp{constructor(){super({id:"editor.action.transposeLetters",label:e(0,"Transpose Letters"),alias:"Transpose Letters",precondition:PC.writable,kbOpts:{kbExpr:PC.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():fC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=fC.leftPosition(e,o),c=fC.leftPosition(e,h),u=e.getValueInRange(ws.fromPositions(c,h)),l=e.getValueInRange(ws.fromPositions(h,o)),a=ws.fromPositions(c,o);s.push(new hC(a,l+u))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const VU="9_cutcopypaste",HU=k||document.queryCommandSupported("cut"),zU=k||document.queryCommandSupported("copy"),UU=void 0!==navigator.clipboard&&!Rr||document.queryCommandSupported("paste");function KU(t){return t.register(),t}const qU=HU?KU(new Mp({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:k?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"Cu&&t"),order:1},{menuId:bp.EditorContext,group:VU,title:e(0,"Cut"),when:PC.writable,order:1},{menuId:bp.CommandPalette,group:"",title:e(0,"Cut"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Cut"),when:PC.writable,order:1}]})):void 0,GU=zU?KU(new Mp({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:k?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"&&Copy"),order:2},{menuId:bp.EditorContext,group:VU,title:e(0,"Copy"),order:2},{menuId:bp.CommandPalette,group:"",title:e(0,"Copy"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Copy"),order:2}]})):void 0;Cp.appendMenuItem(bp.MenubarEditMenu,{submenu:bp.MenubarCopy,title:{value:e(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextCopy,title:{value:e(0,"Copy As"),original:"Copy As"},group:VU,order:3}),Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Oo.and(Oo.notEquals("resourceScheme","output"),PC.editorTextFocus)}),Cp.appendMenuItem(bp.EditorTitleContext,{submenu:bp.EditorTitleContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1}),Cp.appendMenuItem(bp.ExplorerContext,{submenu:bp.ExplorerContextShare,title:{value:e(0,"Share"),original:"Share"},group:"11_share",order:-1});const ZU=UU?KU(new Mp({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:k?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:bp.MenubarEditMenu,group:"2_ccp",title:e(0,"&&Paste"),order:4},{menuId:bp.EditorContext,group:VU,title:e(0,"Paste"),when:PC.writable,order:4},{menuId:bp.CommandPalette,group:"",title:e(0,"Paste"),order:1},{menuId:bp.SimpleEditorContext,group:VU,title:e(0,"Paste"),when:PC.writable,order:4}]})):void 0;function JU(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(ro).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(35),s=e.getSelection();return s&&s.isEmpty()&&!t||document.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(document.execCommand(i),!0))))}JU(qU,"cut"),JU(GU,"copy"),ZU&&(ZU.addImplementation(1e4,"code-editor",(t=>{const i=t.get(ro),e=t.get(VR),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!document.execCommand("paste")&&C)||(n=void 0,r=void 0,h=function*(){const t=yield e.readText();if(""!==t){const i=Hy.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(35)&&!!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})}},new((o=void 0)||(o=Promise))((function(t,i){function e(t){try{c(h.next(t))}catch(t){i(t)}}function s(t){try{c(h.throw(t))}catch(t){i(t)}}function c(i){var n;i.done?t(i.value):(n=i.value,n instanceof o?n:new o((function(t){t(n)}))).then(e,s)}c((h=h.apply(n,r||[])).next())}))));var n,r,o,h})),ZU.addImplementation(0,"generic-dom",(()=>(document.execCommand("paste"),!0)))),zU&&Np(class extends Tp{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:e(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(35)&&i.getSelection().isEmpty()||(Vy.forceCopyWithSyntaxHighlighting=!0,i.focus(),document.execCommand("copy"),Vy.forceCopyWithSyntaxHighlighting=!1))}});var QU;class YU{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+YU.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new YU(this.value+YU.sep+t)}}function XU(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}YU.sep=".",YU.None=new YU("@@none@@"),YU.Empty=new YU(""),YU.QuickFix=new YU("quickfix"),YU.Refactor=new YU("refactor"),YU.RefactorExtract=YU.Refactor.append("extract"),YU.RefactorInline=YU.Refactor.append("inline"),YU.RefactorMove=YU.Refactor.append("move"),YU.RefactorRewrite=YU.Refactor.append("rewrite"),YU.Source=new YU("source"),YU.SourceOrganizeImports=YU.Source.append("organizeImports"),YU.SourceFixAll=YU.Source.append("fixAll"),YU.SurroundWith=YU.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"}(QU||(QU={}));class tK{static fromUser(t,i){return t&&"object"==typeof t?new tK(tK.getKindFromUser(t,i.kind),tK.getApplyFromUser(t,i.apply),tK.getPreferredUser(t)):new tK(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 YU(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 iK{constructor(t,i){this.action=t,this.provider=i}resolve(t){var i,e,s,n,r;return e=this,s=void 0,r=function*(){if((null===(i=this.provider)||void 0===i?void 0:i.resolveCodeAction)&&!this.action.edit){let i;try{i=yield this.provider.resolveCodeAction(this.action,t)}catch(t){Ai(t)}i&&(this.action.edit=i.edit)}return this},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}))}}var eK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const sK="editor.action.codeAction",nK="editor.action.quickFix",rK="editor.action.autoFix",oK="editor.action.refactor",hK="editor.action.sourceAction",cK="editor.action.organizeImports",uK="editor.action.fixAll";class lK extends Hi{static codeActionsPreferredComparator(t,i){return t.isPreferred&&!i.isPreferred?-1:!t.isPreferred&&i.isPreferred?1:0}static codeActionsComparator({action:t},{action:i}){return et(t.diagnostics)?et(i.diagnostics)?lK.codeActionsPreferredComparator(t,i):-1:et(i.diagnostics)?1:lK.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(lK.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&YU.QuickFix.contains(new YU(t.kind))&&!!t.isPreferred))}}const aK={actions:[],documentation:void 0};function dK(t,i,e,s,n,r){var o;return eK(this,void 0,void 0,(function*(){const h=s.filter||{},c={only:null===(o=h.include)||void 0===o?void 0:o.value,trigger:s.type},u=new KH(i,r),l=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=>XU(i,e,t.include)))||!t.includeSourceActions&&YU.Source.contains(i))}(e,new YU(t))))))}(t,i,h),a=new Vi,d=l.map((t=>eK(this,void 0,void 0,(function*(){try{n.report(t);const s=yield t.provideCodeActions(i,e,c,u.token);if(s&&a.add(s),u.token.isCancellationRequested)return aK;const r=((null==s?void 0:s.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new YU(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>XU(e,i,t.include)))||!t.includeSourceActions&&e&&YU.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(h,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new YU(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 YU(t.kind)))return i.command}(t,r,h.include);return{actions:r.map((i=>new iK(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),aK}})))),f=t.onDidChange((()=>{G(t.all(i),l)||u.cancel()}));try{const e=yield Promise.all(d),n=e.map((t=>t.actions)).flat(),r=[...X(e.map((t=>t.documentation))),...fK(t,i,s,n)];return new lK(n,r,a)}finally{f.dispose(),u.dispose()}}))}function*fK(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 gK;function pK(t,i,s,n,r=fe.None){var o;return eK(this,void 0,void 0,(function*(){const h=t.get(TI),c=t.get(dp),u=t.get(Ap),l=t.get(IM);if(u.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:s}),yield i.resolve(r),!r.isCancellationRequested){if((null===(o=i.action.edit)||void 0===o?void 0:o.edits.length)&&!(yield h.apply(i.action.edit,{editor:null==n?void 0:n.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:s!==gK.OnSave,showPreview:null==n?void 0:n.preview})).isApplied)return;if(i.action.command)try{yield c.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:e(0,"An unknown error occurred while applying the code action"))}}}))}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(gK||(gK={})),fp.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return eK(this,void 0,void 0,(function*(){if(!(i instanceof os))throw Ti();const{codeActionProvider:r}=t.get(ka),o=t.get(Zc).getModel(i);if(!o)throw Ti();const h=bs.isISelection(e)?bs.liftSelection(e):ws.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ti();const c="string"==typeof s?new YU(s):void 0,u=yield dK(r,o,h,{type:1,triggerAction:QU.Default,filter:{includeSourceActions:!0,include:c}},KR.None,fe.None),l=[],a=Math.min(u.validActions.length,"number"==typeof n?n:0);for(let t=0;t<a;t++)l.push(u.validActions[t].resolve(fe.None));try{return yield Promise.all(l),u.validActions.map((t=>t.action))}finally{setTimeout((()=>u.dispose()),100)}}))}));let mK=class t{constructor(t){this.keybindingService=t}getResolver(){const i=new On((()=>this.keybindingService.getKeybindings().filter((i=>t.codeActionCommands.indexOf(i.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===cK?i={kind:YU.SourceOrganizeImports.value}:t.command===uK&&(i={kind:YU.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},tK.fromUser(i,{kind:YU.None,apply:"never"}))}))));return t=>{if(t.kind){const e=this.bestKeybindingForCodeAction(t,i.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new YU(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)}};mK.codeActionCommands=[oK,sK,hK,cK,uK],mK=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,eP)],mK),fm("symbolIcon.arrayForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.booleanForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.colorForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.constantForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.fileForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.folderForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.keyForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.keywordForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.moduleForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.namespaceForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.nullForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.numberForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.objectForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.operatorForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.packageForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.propertyForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.referenceForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.snippetForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.stringForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.structForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.textForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.typeParameterForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.unitForeground",{dark:gm,light:gm,hcDark:gm,hcLight:gm},e(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),fm("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const vK=Object.freeze({kind:YU.Empty,title:e(0,"More Actions...")}),wK=Object.freeze([{kind:YU.QuickFix,title:e(0,"Quick Fix...")},{kind:YU.RefactorExtract,title:e(0,"Extract..."),icon:Ss.wrench},{kind:YU.RefactorInline,title:e(0,"Inline..."),icon:Ss.wrench},{kind:YU.RefactorRewrite,title:e(0,"Rewrite..."),icon:Ss.wrench},{kind:YU.RefactorMove,title:e(0,"Move..."),icon:Ss.wrench},{kind:YU.SurroundWith,title:e(0,"Surround With..."),icon:Ss.symbolSnippet},{kind:YU.Source,title:e(0,"Source Action..."),icon:Ss.symbolFile},vK]);var bK;!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}}}(bK||(bK={}));let yK=class t extends Hi{constructor(t,i){var e;super(),this._editor=t,this._onClick=this._register(new ee),this.onClick=this._onClick.event,this._state=bK.Hidden,this._domNode=Rg("div.lightBulbWidget"),this._register(hm.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(function(t,i,e){return Zf(t,x&&Ad?xg.POINTER_DOWN:xg.MOUSE_DOWN,i,e)}(this._domNode,Jf((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=og(this._domNode),s=this._editor.getOption(64);let n=Math.floor(s/3);null!==this.state.widgetPosition.position&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(n+=s),this._onClick.fire({x:t.posx,y:i+e+n,actions:this.state.actions,trigger:this.state.trigger})})),e)),this._register(Zf(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(62)&&!this._editor.getOption(62).enabled&&this.hide()}))),this._register(Qi.runAndSubscribe(i.onDidUpdateKeybindings,(()=>{var t,e;this._preferredKbLabel=Rt(null===(t=i.lookupKeybinding(rK))||void 0===t?void 0:t.getLabel()),this._quickFixKbLabel=Rt(null===(e=i.lookupKeybinding(nK))||void 0===e?void 0:e.getLabel()),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(i,e,s){if(i.validActions.length<=0)return this.hide();const n=this._editor.getOptions();if(!n.get(62).enabled)return this.hide();const r=this._editor.getModel();if(!r)return this.hide();const{lineNumber:o,column:h}=r.validatePosition(s),c=r.getOptions().tabSize,u=n.get(48),l=kS(r.getLineContent(o),c),a=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let d=o;if(!(u.spaceWidth*l>22))if(o>1&&!a(o-1))d-=1;else if(a(o+1)){if(h*u.spaceWidth<22)return this.hide()}else d+=1;this.state=new bK.Showing(i,e,s,{position:{lineNumber:d,column:1},preference:t._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==bK.Hidden&&(this.state=bK.Hidden,this._editor.layoutContentWidget(this))}get state(){return this._state}set state(t){this._state=t,this._updateLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){1===this.state.type&&this.state.actions.hasAutoFix&&(this._domNode.classList.remove(...np.asClassNameArray(Ss.lightBulb)),this._domNode.classList.add(...np.asClassNameArray(Ss.lightbulbAutofix)),this._preferredKbLabel)?this.title=e(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...np.asClassNameArray(Ss.lightbulbAutofix)),this._domNode.classList.add(...np.asClassNameArray(Ss.lightBulb)),this.title=this._quickFixKbLabel?e(0,"Show Code Actions ({0})",this._quickFixKbLabel):e(0,"Show Code Actions"))}set title(t){this._domNode.title=t}};yK.ID="editor.contrib.lightbulbWidget",yK._posPref=[0],yK=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,eP)],yK);let kK=class t{static get(i){return i.getContribution(t.ID)}constructor(i,e){this._messageWidget=new zi,this._messageListeners=new Vi,this._editor=i,this._visible=t.MESSAGE_VISIBLE.bindTo(e)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;Yg(t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._messageWidget.value=new CK(this._editor,i,t),this._messageListeners.add(this._editor.onDidBlurEditorText((()=>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(new cu((()=>this.closeMessage()),3e3)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new ws(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(CK.fadeOut(this._messageWidget.value))}};kK.ID="editor.contrib.messageController",kK.MESSAGE_VISIBLE=new Jo("messageVisible",!1,e(0,"Whether the editor is currently showing an inline message")),kK=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,Qo)],kK),Pp(new(Fp.bindToContribution(kK.get))({id:"leaveEditorMessage",precondition:kK.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class CK{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");r.classList.add("message"),r.textContent=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)}}$p(kK.ID,kK,4);var SK=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},xK=function(t,i){return function(e,s){i(e,s,t)}};const DK="acceptSelectedCodeAction",EK="previewSelectedCodeAction";class AK{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 LK=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 dW(t,O)}}renderElement(t,i,s){var n,r,o;if((null===(n=t.group)||void 0===n?void 0:n.icon)?(s.icon.className=np.asClassName(t.group.icon),t.group.icon.color&&(s.icon.style.color=lm(t.group.icon.color.id))):(s.icon.className=np.asClassName(Ss.lightBulb),s.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;s.text.textContent=TK(t.label),s.keybinding.set(t.keybinding),function(t,...i){t?_g(...i):Ig(...i)}(!!t.keybinding,s.keybinding.element);const h=null===(r=this._keybindingService.lookupKeybinding(DK))||void 0===r?void 0:r.getLabel(),c=null===(o=this._keybindingService.lookupKeybinding(EK))||void 0===o?void 0:o.getLabel();s.container.classList.toggle("option-disabled",t.disabled),s.container.title=t.disabled?t.label:h&&c?this._supportsPreview?e(0,"{0} to apply, {1} to preview",h,c):e(0,"{0} to apply",h):""}disposeTemplate(t){}};LK=SK([xK(1,eP)],LK);class MK extends UIEvent{constructor(){super("acceptSelectedAction")}}class OK extends UIEvent{constructor(){super("previewSelectedAction")}}let FK=class extends Hi{constructor(t,i,s,n,r,o){super(),this._delegate=n,this._contextViewService=r,this._keybindingService=o,this._actionLineHeight=24,this._headerLineHeight=26,this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new uR(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new LK(i,this._keybindingService),new AK],{keyboardSupport:!1,accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?TK(null==t?void 0:t.label):"";return t.disabled&&(i=e(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>e(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(vN),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this._list.domFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=s,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._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);const s=this._allMenuItems.map(((t,i)=>{const e=document.getElementById(this._list.getElementID(i));if(e){e.style.width="auto";const t=e.getBoundingClientRect().width;return e.style.width="",t}return 0})),n=Math.max(...s,t),r=Math.min(e,.7*document.body.clientHeight);return this._list.layout(r,n),this.domNode.style.height=`${r}px`,this._list.domFocus(),n}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 OK:new MK;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 OK):this._list.setSelection([])}onListHover(t){this._list.setFocus("number"==typeof t.index?[t.index]:[])}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function TK(t){return t.replace(/\r\n|\r|\n/g," ")}FK=SK([xK(4,HR),xK(5,eP)],FK);var RK=function(t,i){return function(e,s){i(e,s,t)}};const _K={Visible:new Jo("codeActionMenuVisible",!1,e(0,"Whether the action widget list is visible"))},IK=no("actionWidgetService");let PK=class extends Hi{get isVisible(){return _K.Visible.getValue(this._contextKeyService)||!1}constructor(t,i,e){super(),this._contextViewService=t,this._contextKeyService=i,this._instantiationService=e,this._list=this._register(new zi)}show(t,i,e,s,n,r,o){const h=_K.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(FK,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 Vi,o=document.createElement("div"),h=t.appendChild(o);h.classList.add("context-view-block"),r.add(Zf(h,xg.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),u=t.appendChild(c);u.classList.add("context-view-pointerBlock"),r.add(Zf(u,xg.POINTER_MOVE,(()=>u.remove()))),r.add(Zf(u,xg.MOUSE_DOWN,(()=>u.remove())));let l=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),l=t.getContainer().offsetWidth)}const a=null===(s=this._list.value)||void 0===s?void 0:s.layout(l);n.style.width=`${a}px`;const d=r.add(Ag(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Rg(t),s=new kR(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)}};PK=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}([RK(0,HR),RK(1,Qo),RK(2,eo)],PK),lc(IK,PK,1);const NK=1100;Ep(class extends Dp{constructor(){super({id:"hideCodeActionWidget",title:{value:e(0,"Hide action widget"),original:"Hide action widget"},precondition:_K.Visible,keybinding:{weight:NK,primary:9,secondary:[1033]}})}run(t){t.get(IK).hide()}}),Ep(class extends Dp{constructor(){super({id:"selectPrevCodeAction",title:{value:e(0,"Select previous action"),original:"Select previous action"},precondition:_K.Visible,keybinding:{weight:NK,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(IK);i instanceof PK&&i.focusPrevious()}}),Ep(class extends Dp{constructor(){super({id:"selectNextCodeAction",title:{value:e(0,"Select next action"),original:"Select next action"},precondition:_K.Visible,keybinding:{weight:NK,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(IK);i instanceof PK&&i.focusNext()}}),Ep(class extends Dp{constructor(){super({id:DK,title:{value:e(0,"Accept selected action"),original:"Accept selected action"},precondition:_K.Visible,keybinding:{weight:NK,primary:3,secondary:[2137]}})}run(t){const i=t.get(IK);i instanceof PK&&i.acceptSelected()}}),Ep(class extends Dp{constructor(){super({id:EK,title:{value:e(0,"Preview selected action"),original:"Preview selected action"},precondition:_K.Visible,keybinding:{weight:NK,primary:2051}})}run(t){const i=t.get(IK);i instanceof PK&&i.acceptSelected(!0)}});var BK,$K=function(t,i,e,s){if("a"===e&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?t!==i||!s:!i.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?s:"a"===e?s.call(t):s?s.value:i.get(t)};const jK=new Jo("supportedCodeAction","");class WK extends Hi{constructor(t,i,e,s=250){super(),this._editor=t,this._markerService=i,this._signalChange=e,this._delay=s,this._autoTriggerTimer=this._register(new cu),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=>GD(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:QU.Default})}),this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),e=this._editor.getSelection();if(e.isEmpty()&&2===t.type){const{lineNumber:t,column:s}=e.getPosition(),n=i.getLineContent(t);if(0===n.length)return;if(1===s){if(/\s/.test(n[0]))return}else if(s===i.getLineMaxColumn(t)){if(/\s/.test(n[n.length-1]))return}else if(/\s/.test(n[s-2])&&/\s/.test(n[s-1]))return}return e}}var VK;!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 HK;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(VK||(VK={}));const HK=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class zK extends Hi{constructor(t,i,e,s,n){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._codeActionOracle=this._register(new zi),this._state=VK.Empty,this._onDidChangeState=this._register(new ee),this.onDidChangeState=this._onDidChangeState.event,BK.set(this,!1),this._supportedCodeActions=jK.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(){$K(this,BK,"f")||(function(t,i,e,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?t!==i||!n:!i.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?n.call(t,e):n?n.value=e:i.set(t,e)}(this,BK,!0,"f"),super.dispose(),this.setState(VK.Empty,!0))}_update(){if($K(this,BK,"f"))return;this._codeActionOracle.value=void 0,this.setState(VK.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(88)){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 WK(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(VK.Empty);const s=tu((e=>dK(this._registry,t,i.selection,i.trigger,KR.None,e)));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(s,250)),this.setState(new VK.Triggered(i.trigger,i.selection.getStartPosition(),s))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:QU.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||$K(this,BK,"f")||this._onDidChangeState.fire(t))}}BK=new WeakMap;var UK,KK=function(t,i){return function(e,s){i(e,s,t)}},qK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let GK=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n,r,o,h,c,u){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=u,this._activeCodeActions=this._register(new zi),this._showDisabled=!1,UK.set(this,!1),this._editor=t,this._model=this._register(new zK(this._editor,n.codeActionProvider,i,e,r)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new On((()=>{const t=this._editor.getContribution(yK.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(mK),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){(function(t,i,e,s,n){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof i?t!==i||!n:!i.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?n.call(t,e):n?n.value=e:i.set(t,e)})(this,UK,!0,"f"),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=kK.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)}_applyCodeAction(t,i,e){return qK(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction(pK,t,gK.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:QU.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return qK(this,void 0,void 0,(function*(){if(1!==t.type)return void(null===(i=this._lightBulbWidget.rawValue)||void 0===i||i.hide());let c;try{c=yield t.actions}catch(t){return void Ei(t)}if(!function(t,i,e,s){if("a"===e&&!s)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof i?t!==i||!s:!i.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===e?s:"a"===e?s.call(t):s?s.value:i.get(t)}(this,UK,"f"))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(),yield 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=kK.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=kK.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}showCodeActionList(t,i,e){return qK(this,void 0,void 0,(function*(){const s=this._editor.getDomNode();if(!s)return;const n=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!n.length)return;const r=vs.isIPosition(i)?this.toCoords(i):i,o={onSelect:(t,i)=>qK(this,void 0,void 0,(function*(){this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide()})),onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>({kind:"action",item:t,group:vK,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title})));const s=wK.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new YU(i.action.kind):YU.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)n.push({kind:"action",item:i,group:t.group,label:i.action.title,disabled:!!i.action.disabled,keybinding:e(i.action)})}return n}(n,this._shouldShowHeaders(),this._resolver.getResolver()),o,r,s,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=og(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,s){if(s.fromLightbulb)return[];const n=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 s.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:e(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,s))}:{id:"showMoreActions",label:e(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,s))}),n}};function ZK(t){return Oo.regex(jK.keys()[0],new RegExp("(\\s|^)"+In(t.value)+"\\b"))}UK=new WeakMap,GK.ID="editor.contrib.codeActionController",GK=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}([KK(1,tB),KK(2,Qo),KK(3,eo),KK(4,ka),KK(5,qR),KK(6,dp),KK(7,ic),KK(8,IK),KK(9,eo)],GK);const JK={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:e(0,"Kind of the code action to run.")},apply:{type:"string",description:e(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[e(0,"Always apply the first returned code action."),e(0,"Apply the first returned code action if it is the only one."),e(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:e(0,"Controls if only preferred code actions should be returned.")}}};function QK(t,i,e,s,n=QU.Default){if(t.hasModel()){const r=GK.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}$p(GK.ID,GK,3),$p(yK.ID,yK,4),Np(class extends Tp{constructor(){super({id:nK,label:e(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),kbOpts:{kbExpr:PC.textInputFocus,primary:2137,weight:100}})}run(t,i){return QK(i,e(0,"No code actions available"),void 0,void 0,QU.QuickFix)}}),Np(class extends Tp{constructor(){super({id:oK,label:e(0,"Refactor..."),alias:"Refactor...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),kbOpts:{kbExpr:PC.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Oo.and(PC.writable,ZK(YU.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:JK}]}})}run(t,i,s){const n=tK.fromUser(s,{kind:YU.Refactor,apply:"never"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",s.kind):e(0,n.preferred?"No preferred refactorings available":"No refactorings available"),{include:YU.Refactor.contains(n.kind)?n.kind:YU.None,onlyIncludePreferredActions:n.preferred},n.apply,QU.Refactor)}}),Np(class extends Tp{constructor(){super({id:hK,label:e(0,"Source Action..."),alias:"Source Action...",precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Oo.and(PC.writable,ZK(YU.Source))},description:{description:"Source Action...",args:[{name:"args",schema:JK}]}})}run(t,i,s){const n=tK.fromUser(s,{kind:YU.Source,apply:"never"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",s.kind):e(0,n.preferred?"No preferred source actions available":"No source actions available"),{include:YU.Source.contains(n.kind)?n.kind:YU.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,QU.SourceAction)}}),Np(class extends Tp{constructor(){super({id:cK,label:e(0,"Organize Imports"),alias:"Organize Imports",precondition:Oo.and(PC.writable,ZK(YU.SourceOrganizeImports)),kbOpts:{kbExpr:PC.textInputFocus,primary:1581,weight:100}})}run(t,i){return QK(i,e(0,"No organize imports action available"),{include:YU.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",QU.OrganizeImports)}}),Np(class extends Tp{constructor(){super({id:rK,label:e(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Oo.and(PC.writable,ZK(YU.QuickFix)),kbOpts:{kbExpr:PC.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return QK(i,e(0,"No auto fixes available"),{include:YU.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",QU.AutoFix)}}),Np(class extends Tp{constructor(){super({id:uK,label:e(0,"Fix All"),alias:"Fix All",precondition:Oo.and(PC.writable,ZK(YU.SourceFixAll))})}run(t,i){return QK(i,e(0,"No fix all action available"),{include:YU.SourceFixAll,includeSourceActions:!0},"ifSingle",QU.FixAll)}}),Pp(new class extends Fp{constructor(){super({id:sK,precondition:Oo.and(PC.writable,PC.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:JK}]}})}runEditorCommand(t,i,s){const n=tK.fromUser(s,{kind:YU.Empty,apply:"ifSingle"});return QK(i,"string"==typeof(null==s?void 0:s.kind)?e(0,n.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",s.kind):e(0,n.preferred?"No preferred code actions available":"No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}),dc.as(mc).registerConfiguration(Object.assign(Object.assign({},PI),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:e(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}}));var YK=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class XK{constructor(){this.lenses=[],this._disposables=new Vi}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})}}function tq(t,i,e){return YK(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new XK,o=s.map(((t,s)=>YK(this,void 0,void 0,(function*(){n.set(t,s);try{const s=yield Promise.resolve(t.provideCodeLenses(i,e));s&&r.add(s,t)}catch(t){Ai(t)}}))));return yield 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}))}fp.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;Mt(os.isUri(e)),Mt("number"==typeof s||!s);const{codeLensProvider:n}=t.get(ka),r=t.get(Zc).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return tq(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 iq=no("ICodeLensCache");class eq{constructor(t,i){this.lineCount=t,this.data=i}}let sq=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new TO(20,.75),au((()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Ni(t.onWillSaveState)((e=>{e.reason===cN.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 XK;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new eq(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 ws(t,1,t,11)});const n=new XK;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new eq(e.lineCount,n))}}catch(t){}}};sq=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,hN)],sq),lc(iq,sq,1);class nq{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 rq{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+rq._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=UF(n.command.title.trim());n.command.id?(e.push(Rg("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Rg("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Rg("span",void 0," | "))}}s?(Mg(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Mg(this._domNode,Rg("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}}rq._idPool=0;class oq{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 hq=sL.register({collapseOnReplaceEdit:!0,description:"codelens"});class cq{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:hq},(t=>this._decorationIds[i]=t)),o=o?ws.plusRange(o,t.symbol.range):ws.lift(t.symbol.range)})),this._viewZone=new nq(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 rq(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||ws.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:hq},(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 uq=function(t,i){return function(e,s){i(e,s,t)}};let lq=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 Vi,this._localToDispose=new Vi,this._lenses=[],this._oldCodeLensModels=new Vi,this._provideCodeLensDebounce=e.for(i.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=e.for(i.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new lu((()=>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(48)||t.hasChanged(17)||t.hasChanged(16))&&this._updateLensStyle(),t.hasChanged(15)&&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(64)/this._editor.getOption(50));let i=this._editor.getOption(17);return(!i||i<5)&&(i=.9*this._editor.getOption(50)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(16),s=this._editor.getOption(48),{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",ki.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(15))return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&this._localToDispose.add(ou((()=>{const e=this._codeLensCache.get(t);i===e&&(this._codeLensCache.delete(t),this._onModelChange())}),3e4)));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 lu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=tu((i=>tq(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()}),Ei)}),this._provideCodeLensDebounce.get(t));this._localToDispose.add(e),this._localToDispose.add(Wi((()=>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 oq;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.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(Wi((()=>{if(this._editor.getModel()){const t=_F.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 oq;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=_F.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new oq;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 cq(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 cq(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=tu((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}),Ai)));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=>{Ei(t),r===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)}))}getModel(){return this._currentCodeLensModel}};lq.ID="css.editor.codeLens",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}([uq(1,ka),uq(2,z_),uq(3,dp),uq(4,IM),uq(5,iq)],lq),$p(lq.ID,lq,1),Np(class extends Tp{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:PC.hasCodeLensProvider,label:e(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return e=this,s=void 0,r=function*(){if(!i.hasModel())return;const e=t.get(Kj),s=t.get(dp),n=t.get(IM),r=i.getSelection().positionLineNumber,o=i.getContribution(lq.ID);if(!o)return;const h=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 u=yield e.pick(c,{canPickMany:!1});if(u){if(h.isDisposed)return yield s.executeCommand(this.id);try{yield s.executeCommand(u.command.id,...u.command.arguments||[])}catch(t){n.error(t)}}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}});var aq=function(t,i){return function(e,s){i(e,s,t)}};class dq{constructor(t,i){this._editorWorkerClient=new Fa(t,!1,"editorWorkerService",i)}provideDocumentColors(t,i){return e=this,s=void 0,r=function*(){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new ea(new Xl(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?ea.Format.CSS.formatRGB(o):ea.Format.CSS.formatRGBA(o),c=r?ea.Format.CSS.formatHSL(o):ea.Format.CSS.formatHSLA(o),u=r?ea.Format.CSS.formatHex(o):ea.Format.CSS.formatHexA(o),l=[];return l.push({label:h,textEdit:{range:s,text:h}}),l.push({label:c,textEdit:{range:s,text:c}}),l.push({label:u,textEdit:{range:s,text:u}}),l}}let fq=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new dq(t,i)))}};fq=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}([aq(0,Zc),aq(1,_c),aq(2,ka)],fq),ZV(fq);var gq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function pq(t,i,e,s=!0){return gq(this,void 0,void 0,(function*(){return yq(new vq,t,i,e,s)}))}function mq(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class vq{constructor(){}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const n=yield t.provideDocumentColors(i,e);if(Array.isArray(n))for(const i of n)s.push({colorInfo:i,provider:t});return Array.isArray(n)}))}}class wq{constructor(){}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const n=yield 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 bq{constructor(t){this.colorInfo=t}compute(t,i,e,s){return gq(this,void 0,void 0,(function*(){const e=yield t.provideColorPresentations(i,this.colorInfo,fe.None);return Array.isArray(e)&&s.push(...e),Array.isArray(e)}))}}function yq(t,i,e,s,n){return gq(this,void 0,void 0,(function*(){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 dq)r=n;else try{(yield t.compute(n,e,s,h))&&(o=!0)}catch(t){Ai(t)}}return o?h:r&&n?(yield t.compute(r,e,s,h),h):[]}))}function kq(t,i){const{colorProvider:e}=t.get(ka),s=t.get(Zc).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(ic).getValue("editor.defaultColorDecorators",{resource:i})}}fp.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof os))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=kq(t,e);return yq(new wq,n,s,fe.None,r)})),fp.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof os&&Array.isArray(e)&&4===e.length&&ws.isIRange(r)))throw Ti();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=kq(t,n),[u,l,a,d]=e;return yq(new bq({range:r,color:{red:u,green:l,blue:a,alpha:d}}),h,o,fe.None,c)}));var Cq=function(t,i){return function(e,s){i(e,s,t)}},Sq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const xq=Object.create({});let Dq=class t extends Hi{constructor(i,e,s,n){super(),this._editor=i,this._configurationService=e,this._languageFeaturesService=s,this._localToDispose=this._register(new Vi),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new Lb(this._editor),this._decoratorLimitReporter=new Eq,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=n.for(s.colorProvider,"Document Colors",{min:t.RECOMPUTE_TIME}),this._register(i.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(i.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(s.colorProvider.onDidChange((()=>this.updateColors()))),this._register(i.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(142);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(19),s=t.hasChanged(142);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(142),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(18)}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 cu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return Sq(this,void 0,void 0,(function*(){this._computePromise=tu((t=>Sq(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Ji(!1),s=yield pq(this._languageFeaturesService.colorProvider,i,t,this._isDefaultColorDecoratorsEnabled);return this._debounceInformation.update(i,e.elapsed()),s}))));try{const t=yield this._computePromise;this.updateDecorations(t),this.updateColorDecorators(t),this._computePromise=null}catch(t){Ei(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:sL.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(19);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 Xl(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:xq}}})}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(ws.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)}};Dq.ID="editor.contrib.colorDetector",Dq.RECOMPUTE_TIME=1e3,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}([Cq(1,ic),Cq(2,ka),Cq(3,z_)],Dq);class Eq{constructor(){this._onDidChange=new ee,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}$p(Dq.ID,Dq,1);class Aq{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 ee,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ee,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ee,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 Lq=Rg;class Mq extends Hi{constructor(t,i,s,n=!1){super(),this.model=i,this.showingStandaloneColorPicker=n,this._closeButton=null,this._domNode=Lq(".colorpicker-header"),Lg(t,this._domNode),this._pickedColorNode=Lg(this._domNode,Lq(".picked-color"));const r=e(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",r),this._originalColorNode=Lg(this._domNode,Lq(".original-color")),this._originalColorNode.style.backgroundColor=ea.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=s.getColorTheme().getColor(Iv)||ea.white,this._register(s.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Iv)||ea.white}))),this._register(Zf(this._pickedColorNode,xg.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Zf(this._originalColorNode,xg.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=ea.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 Oq(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=ea.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorNode.textContent=this.model.presentation?this.model.presentation.label:"",this._pickedColorNode.prepend(Lq(".codicon.codicon-color-mode"))}}class Oq extends Hi{constructor(t){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Lg(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Lg(this._button,i),Lg(i,Lq(".button"+np.asCSSSelector(SR("color-picker-close",Ss.close,e(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class Fq extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=Lq(".colorpicker-body"),Lg(t,this._domNode),this._saturationBox=new Tq(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 _q(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 Iq(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 Pq(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 ea(new ia(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new ea(new ia(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new ea(new ia(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 Tq extends Hi{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ee,this.onColorFlushed=this._onColorFlushed.event,this._domNode=Lq(".saturation-wrap"),Lg(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Lg(this._domNode,this._canvas),this.selection=Lq(".saturation-selection"),Lg(this._domNode,this.selection),this.layout(),this._register(Zf(this._domNode,xg.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 cm);const i=og(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=Zf(document,xg.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 ea(new ia(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=ea.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(){this.monitor&&this.monitor.isMonitoring()||this.paint()}}class Rq extends Hi{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ee,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=Lg(t,Lq(".standalone-strip")),this.overlay=Lg(this.domNode,Lq(".standalone-overlay"))):(this.domNode=Lg(t,Lq(".strip")),this.overlay=Lg(this.domNode,Lq(".overlay"))),this.slider=Lg(this.domNode,Lq(".slider")),this.slider.style.top="0px",this._register(Zf(this.domNode,xg.POINTER_DOWN,(t=>this.onPointerDown(t)))),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new cm),e=og(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=Zf(document,xg.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 _q extends Rq{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){const{r:i,g:e,b:s}=t.rgba,n=new ea(new Xl(i,e,s,1)),r=new ea(new Xl(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class Iq extends Rq{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class Pq extends Hi{constructor(t){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=Lg(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 Nq extends gy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Or.onDidChange((()=>this.layout())));const r=Lq(".colorpicker-widget");t.appendChild(r),this.header=this._register(new Mq(r,this.model,s,n)),this.body=this._register(new Fq(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var Bq=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},$q=function(t,i){return function(e,s){i(e,s,t)}},jq=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class Wq{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 Vq=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return pu.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=Dq.get(this._editor);if(!t)return[];for(const e of i){if(!t.isColorDecoration(e))continue;const i=t.getColorData(e.range.getStartPosition());if(i)return[yield Uq(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return Kq(this,this._editor,this._themeService,i,t)}};Vq=Bq([$q(1,Yy)],Vq);class Hq{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let zq=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!Dq.get(this._editor))return null;const s=yield pq(e,this._editor.getModel(),fe.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;ws.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:yield Uq(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return jq(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=t.model;let e=new ws(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(yield Gq(this._editor.getModel(),i,this._color,e,t),e=qq(this._editor,e,i))}))}renderHoverParts(t,i){return Kq(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function Uq(t,i,e,s){return jq(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,u=new Xl(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),l=new ea(u),a=yield mq(i,e,s,fe.None),d=new Aq(l,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(l,n),t instanceof Vq?new Wq(t,ws.lift(e.range),d,s):new Hq(t,ws.lift(e.range),d,s)}))}function Kq(t,i,e,s,n){if(0===s.length||!i.hasModel())return Hi.None;const r=new Vi,o=s[0],h=i.getModel(),c=o.model,u=r.add(new Nq(n.fragment,c,i.getOption(138),e,t instanceof zq));n.setColorPicker(u);let l=new ws(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof zq){const i=s[0].model.color;t.color=i,Gq(h,c,i,l,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>jq(this,void 0,void 0,(function*(){yield Gq(h,c,t,l,o),l=qq(i,l,c,n)})))));return r.add(c.onDidChangeColor((t=>{Gq(h,c,t,l,o)}))),r}function qq(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new ws(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}function Gq(t,i,e,s,n){return jq(this,void 0,void 0,(function*(){const r=yield mq(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 Zq(t,i){return!!t[i]}zq=Bq([$q(1,Yy)],zq);class Jq{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=Zq(t.event,i.triggerModifier),this.hasSideBySideModifier=Zq(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class Qq{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=Zq(t,i.triggerModifier)}}class Yq{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 Xq(t){return"altKey"===t?b?new Yq(57,"metaKey",6,"altKey"):new Yq(5,"ctrlKey",6,"altKey"):b?new Yq(6,"altKey",57,"metaKey"):new Yq(6,"altKey",5,"ctrlKey")}class tG extends Hi{constructor(t,i){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ee),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ee),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ee),this.onCancel=this._onCancel.event,this._editor=t,this._alwaysFireExecuteOnMouseUp=i,this._opts=Xq(this._editor.getOption(75)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(75)){const t=Xq(this._editor.getOption(75));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 Jq(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new Jq(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new Jq(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new Qq(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new Qq(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=t.target.position?t.target.position.lineNumber:0}_onEditorMouseUp(t){(this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===(t.target.position?t.target.position.lineNumber:0)||this._alwaysFireExecuteOnMouseUp)&&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 iG=function(t,i){return function(e,s){i(e,s,t)}};let eG=class extends oO{constructor(t,i,e,s,n,r,o,h,c,u,l,a,d){super(t,Object.assign(Object.assign({},s.getRawOptions()),{overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()}),e,n,r,o,h,c,u,l,a,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){Bt(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};eG=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}([iG(4,eo),iG(5,ro),iG(6,dp),iG(7,Qo),iG(8,Yy),iG(9,IM),iG(10,sh),iG(11,_c),iG(12,ka)],eG);const sG=new ea(new Xl(0,122,204)),nG={showArrow:!0,showFrame:!0,className:"",frameColor:sG,arrowColor:sG,keepEditorSelection:!1};class rG{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 oG{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class hG{constructor(t){this._editor=t,this._ruleName=hG._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Cg(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(){Cg(this._ruleName),kg(`.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:ws.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}hG._IdGenerator=new qF(".arrow-decoration-");class cG{constructor(t,i={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._viewZone=null,this._disposables=new Vi,this.container=null,this._isShowing=!1,this.editor=t,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=_t(i),Bt(this.options,nG,!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 hG(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=ws.isIRange(t)?ws.lift(t):ws.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:sL.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(64);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(64);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 rG(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 oG("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 u=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=u+"px",this.container.style.overflow="hidden"),this._doLayout(u,n),this.options.keepEditorSelection||this.editor.setSelection(t);const l=this.editor.getModel();if(l){const i=l.validateRange(new ws(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===l.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 EO(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(64),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 uG=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},lG=function(t,i){return function(e,s){i(e,s,t)}};const aG=no("IPeekViewService");var dG;lc(aG,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 Jo("inReferenceSearchEditor",!0,e(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(dG||(dG={}));let fG=class{constructor(t,i){t instanceof eG&&dG.inPeekEditor.bindTo(i)}dispose(){}};fG.ID="editor.contrib.referenceController",fG=uG([lG(1,Qo)],fG),$p(fG.ID,fG,0);const gG={headerBackgroundColor:ea.white,primaryHeadingColor:ea.fromHex("#333333"),secondaryHeadingColor:ea.fromHex("#6c6c6cb3")};let pG=class extends cG{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,Bt(this.options,gG,!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=Rg(".head"),this._bodyElement=Rg(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Rg(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Qf(this._titleElement,"click",(t=>this._onTitleClick(t)))),Lg(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Rg("span.filename"),this._secondaryHeading=Rg("span.dirname"),this._metaHeading=Rg("span.meta"),Lg(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const s=Rg(".peekview-actions");Lg(this._headElement,s);const n=this._getActionBarOptions();this._actionbarWidget=new kR(s,n),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new op("peekview.close",e(0,"Close"),np.asClassName(Ss.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:TN.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:Kf(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,_g(this._metaHeading)):Ig(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(64)),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`)}};pG=uG([lG(2,eo)],pG);const mG=fm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view title area.")),vG=fm("peekViewTitleLabel.foreground",{dark:ea.white,light:ea.black,hcDark:ea.white,hcLight:av},e(0,"Color of the peek view title.")),wG=fm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},e(0,"Color of the peek view title info.")),bG=fm("peekView.border",{dark:hv,light:hv,hcDark:wm,hcLight:wm},e(0,"Color of the peek view borders and arrow.")),yG=fm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view result list."));fm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:ea.white,hcLight:av},e(0,"Foreground color for line nodes in the peek view result list.")),fm("peekViewResult.fileForeground",{dark:ea.white,light:"#1E1E1E",hcDark:ea.white,hcLight:av},e(0,"Foreground color for file nodes in the peek view result list.")),fm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},e(0,"Background color of the selected entry in the peek view result list.")),fm("peekViewResult.selectionForeground",{dark:ea.white,light:"#6C6C6C",hcDark:ea.white,hcLight:av},e(0,"Foreground color of the selected entry in the peek view result list."));const kG=fm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:ea.black,hcLight:ea.white},e(0,"Background color of the peek view editor."));fm("peekViewEditorGutter.background",{dark:kG,light:kG,hcDark:kG,hcLight:kG},e(0,"Background color of the gutter in the peek view editor.")),fm("peekViewEditorStickyScroll.background",{dark:kG,light:kG,hcDark:kG,hcLight:kG},e(0,"Background color of sticky scroll in the peek view editor.")),fm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},e(0,"Match highlight color in the peek view result list.")),fm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},e(0,"Match highlight color in the peek view editor.")),fm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:bm,hcLight:bm},e(0,"Match highlight border in the peek view editor."));class CG{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=GF.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?e(0,"{0} in {1} on line {2} at column {3}",i.value,JD(this.uri),this.range.startLineNumber,this.range.startColumn):e(0,"in {0} on line {1} at column {2}",JD(this.uri),this.range.startLineNumber,this.range.startColumn)}}class SG{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 ws(s,h.startColumn,s,n),u=new ws(r,o,r,1073741824),l=e.getValueInRange(c).replace(/^\s+/,""),a=e.getValueInRange(t);return{value:l+a+e.getValueInRange(u).replace(/\s+$/,""),highlight:{start:l.length,end:l.length+a.length}}}}class xG{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new OO}dispose(){$i(this._previews.values()),this._previews.clear()}getPreview(t){return this._previews.get(t.uri)}get ariaMessage(){const t=this.children.length;return 1===t?e(0,"1 symbol in {0}, full path {1}",JD(this.uri),this.uri.fsPath):e(0,"{0} symbols in {1}, full path {2}",t,JD(this.uri),this.uri.fsPath)}resolve(t){return i=this,e=void 0,n=function*(){if(0!==this._previews.size)return this;for(const i of this.children)if(!this._previews.has(i.uri))try{const e=yield t.createModelReference(i.uri);this._previews.set(i.uri,new SG(e))}catch(t){Ei(t)}return this},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}}class DG{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ee,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(DG._compareReferences);for(const i of t)if(s&&qD.isEqual(s.uri,i.uri,!0)||(s=new xG(this,i.uri),this.groups.push(s)),0===s.children.length||0!==DG._compareReferences(i,s.children[s.children.length-1])){const t=new CG(e===i,s,i,(t=>this._onDidChangeReferenceRange.fire(t)));this.references.push(t),s.children.push(t)}}dispose(){$i(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new DG(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?e(0,"No results found"):1===this.references.length?e(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?e(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):e(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:tr(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()&&ws.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 qD.compare(t.uri,i.uri)||ws.compareRangesUsingStarts(t.range,i.range)}}var EG=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},AG=function(t,i){return function(e,s){i(e,s,t)}};let LG=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof DG||t instanceof xG}getChildren(t){if(t instanceof DG)return t.groups;if(t instanceof xG)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};LG=EG([AG(0,ep)],LG);class MG{getHeight(){return 23}getTemplateId(t){return t instanceof xG?RG.id:IG.id}}let OG=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof CG){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return JD(t.uri)}};OG=EG([AG(0,eP)],OG);class FG{getId(t){return t instanceof CG?t.id:t.uri}}let TG=class extends Hi{constructor(t,i){super(),this._labelService=i;const e=document.createElement("div");e.classList.add("reference-file"),this.file=this._register(new hW(e,{supportHighlights:!0})),this.badge=new Jj(Lg(e,Rg(".count")),{},mN),t.appendChild(e)}set(t,i){const s=YD(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(s,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const n=t.children.length;this.badge.setCount(n),this.badge.setTitleFormat(e(0,n>1?"{0} references":"{0} reference",n))}};TG=EG([AG(1,fP)],TG);let RG=class t{constructor(i){this._instantiationService=i,this.templateId=t.id}renderTemplate(t){return this._instantiationService.createInstance(TG,t)}renderElement(t,i,e){e.set(t.element,sF(t.filterData))}disposeTemplate(t){t.dispose()}};RG.id="FileReferencesRenderer",RG=EG([AG(0,eo)],RG);class _G{constructor(t){this.label=new rW(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&&!pF.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,sF(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${JD(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class IG{constructor(){this.templateId=IG.id}renderTemplate(t){return new _G(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}IG.id="OneReferenceRenderer";class PG{getWidgetAriaLabel(){return e(0,"References")}getAriaLabel(t){return t.ariaMessage}}var NG=function(t,i){return function(e,s){i(e,s,t)}},BG=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class $G{constructor(t,i){this._editor=t,this._model=i,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new Vi,this._callOnModelChange=new Vi,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:$G.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;ws.equalsRange(n,s.range)||((ws.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()}}$G.DecorationOptions=sL.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class jG{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 WG extends Ij{}let VG=class extends pG{constructor(t,i,e,s,n,r,o,h,c,u,l,a){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=u,this._languageService=l,this._languageConfigurationService=a,this._disposeOnNewModel=new Vi,this._callOnDispose=new Vi,this._onDidSelectReference=new ee,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ng(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(),$i(this._preview),$i(this._previewNotAvailableMessage),$i(this._tree),$i(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(t){const i=t.getColor(bG)||ea.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(mG)||ea.transparent,primaryHeadingColor:t.getColor(vG),secondaryHeadingColor:t.getColor(wG)})}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=Lg(t,Rg("div.messages")),Ig(this._messageContainer),this._splitView=new yB(t,{orientation:1}),this._previewContainer=Lg(t,Rg("div.preview.inline")),this._preview=this._instantiationService.createInstance(eG,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!1},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Ig(this._previewContainer),this._previewNotAvailableMessage=new qA(e(0,"no preview available"),Ec,qA.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Lg(t,Rg("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new PG,keyboardNavigationLabelProvider:this._instantiationService.createInstance(OG),identityProvider:new FG,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:yG}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Qf(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(WG,"ReferencesWidget",this._treeContainer,new MG,[this._instantiationService.createInstance(RG),this._instantiationService.createInstance(IG)],this._instantiationService.createInstance(LG),i),this._splitView.addView({onDidChange:Qi.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},bB.Distribute),this._splitView.addView({onDidChange:Qi.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)}},bB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const s=(t,i)=>{t instanceof CG&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{s(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Ig(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ng(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=e(0,"No results"),_g(this._messageContainer),Promise.resolve(void 0)):(Ig(this._messageContainer),this._decorationsManager=new $G(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"),_g(this._treeContainer),_g(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 CG?t:t instanceof xG&&t.children.length>0?t.children[0]:void 0}revealReference(t){return BG(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return BG(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==Wf.inMemory?this.setTitle(ZD(t.uri),this._uriLabel.getUriLabel(YD(t.uri))):this.setTitle(e(0,"References"));const s=this._textModelResolverService.createModelReference(t.uri);this._tree.getInput()===t.parent||(i&&this._tree.reveal(t.parent),yield this._tree.expand(t.parent)),this._tree.reveal(t);const n=yield s;if(!this._model)return void n.dispose();$i(this._previewModelReference);const r=n.object;if(r){const i=this._preview.getModel()===r.textEditorModel?0:1,e=ws.lift(t.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(r.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}))}};VG=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}([NG(3,Yy),NG(4,ep),NG(5,eo),NG(6,aG),NG(7,fP),NG(8,BA),NG(9,eP),NG(10,hc),NG(11,_c)],VG);var HG=function(t,i){return function(e,s){i(e,s,t)}},zG=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const UG=new Jo("referenceSearchVisible",!1,e(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let KG=class t{static get(i){return i.getContribution(t.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 Vi,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=UG.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,s){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&t.containsPosition(n))return;this._peekMode=s,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const r="peekViewLayout",o=jG.fromJSON(this._storageService.get(r,0,"{}"));this._widget=this._instantiationService.createInstance(VG,this._editor,this._defaultTreeKeyboardSupport,o),this._widget.setTitle(e(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(r,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:e}=t;if(i)switch(e){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":s?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const h=++this._requestIdPool;i.then((i=>{var s;if(h===this._requestIdPool&&this._widget)return null===(s=this._model)||void 0===s||s.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":e(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,s=new vs(t.startLineNumber,t.startColumn),n=this._model.nearestReference(i,s);if(n)return this._widget.setSelection(n).then((()=>{this._widget&&"editor"===this._editor.getOption(84)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}goToNextOrPreviousReference(t){return zG(this,void 0,void 0,(function*(){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();yield this._widget.setSelection(s),yield this._gotoReference(s,!1),n?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}))}revealReference(t){return zG(this,void 0,void 0,(function*(){this._editor.hasModel()&&this._model&&this._widget&&(yield 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(i,e){var s;null===(s=this._widget)||void 0===s||s.hide(),this._ignoreModelChangeEvent=!0;const n=ws.lift(i.range).collapseToStart();return this._editorService.openCodeEditor({resource:i.uri,options:{selection:n,selectionSource:"code.jump",pinned:e}},this._editor).then((i=>{var e;if(this._ignoreModelChangeEvent=!1,i&&this._widget)if(this._editor===i)this._widget.show(n),this._widget.focusOnReferenceTree();else{const s=t.get(i),r=this._model.clone();this.closeWidget(),i.focus(),null==s||s.toggleWidget(n,tu((()=>Promise.resolve(r))),null!==(e=this._peekMode)&&void 0!==e&&e)}else this.closeWidget()}),(t=>{this._ignoreModelChangeEvent=!1,Ei(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 qG(t,i){const e=function(t){const i=t.get(ro).getFocusedCodeEditor();return i instanceof eG?i.getParentEditor():i}(t);if(!e)return;const s=KG.get(e);s&&i(s)}KG.ID="editor.contrib.referencesController",KG=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}([HG(2,Qo),HG(3,ro),HG(4,IM),HG(5,eo),HG(6,hN),HG(7,ic)],KG),pp.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ae(2089,60),when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),pp.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),pp.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Oo.or(UG,dG.inPeekEditor),handler(t){qG(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),fp.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),fp.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),fp.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),fp.registerCommand("closeReferenceSearch",(t=>qG(t,(t=>t.closeWidget())))),pp.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Oo.and(dG.inPeekEditor,Oo.not("config.editor.stablePeek"))}),pp.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Oo.and(UG,Oo.not("config.editor.stablePeek"))}),pp.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Oo.and(UG,q$,X$.negate(),ij.negate()),handler(t){var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.revealReference(e[0])))}}),pp.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Oo.and(UG,q$,X$.negate(),ij.negate()),handler(t){var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.openReference(e[0],!0,!0)))}}),fp.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(z$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof CG&&qG(t,(t=>t.openReference(e[0],!1,!0)))}));var GG=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},ZG=function(t,i){return function(e,s){i(e,s,t)}};const JG=new Jo("hasSymbols",!1,e(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),QG=no("ISymbolNavigationService");let YG=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=JG.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 XG(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(GD(t.uri,e.uri))n=!0,r=r||ws.containsPosition(t.range,s);else if(n)break;n&&r||this.reset()}));this._currentState=ji(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:ws.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"),s=i?e(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):e(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(s)}};YG=GG([ZG(0,Qo),ZG(1,ro),ZG(2,IM),ZG(3,eP)],YG),lc(QG,YG,1),Pp(new class extends Fp{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:JG,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(QG).revealNext(i)}}),pp.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:JG,primary:9,handler(t){t.get(QG).reset()}});let XG=class{constructor(t){this._listener=new Map,this._disposables=new Vi,this._onDidChange=new ee,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(),$i(this._listener.values())}_onDidAddEditor(t){this._listener.set(t,ji(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)}};XG=GG([ZG(0,ro)],XG);var tZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function iZ(t,i,e,s){return tZ(this,void 0,void 0,(function*(){const n=e.ordered(t).map((e=>Promise.resolve(s(e,t,i)).then(void 0,(t=>{Ai(t)}))));return X((yield Promise.all(n)).flat())}))}function eZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function sZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function nZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function rZ(t,i,e,s){return iZ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function oZ(t,i,e,s,n){return iZ(i,e,t,((t,i,e)=>tZ(this,void 0,void 0,(function*(){const r=yield t.provideReferences(i,e,{includeDeclaration:!0},n);if(!s||!r||2!==r.length)return r;const o=yield t.provideReferences(i,e,{includeDeclaration:!1},n);return o&&1===o.length?o:r}))))}function hZ(t){return tZ(this,void 0,void 0,(function*(){const i=yield t(),e=new DG(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}Ip("_executeDefinitionProvider",((t,i,e)=>{const s=eZ(t.get(ka).definitionProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeTypeDefinitionProvider",((t,i,e)=>{const s=rZ(t.get(ka).typeDefinitionProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeDeclarationProvider",((t,i,e)=>{const s=sZ(t.get(ka).declarationProvider,i,e,fe.None);return hZ((()=>s))})),Ip("_executeReferenceProvider",((t,i,e)=>{const s=oZ(t.get(ka).referenceProvider,i,e,!1,fe.None);return hZ((()=>s))})),Ip("_executeImplementationProvider",((t,i,e)=>{const s=nZ(t.get(ka).implementationProvider,i,e,fe.None);return hZ((()=>s))}));var cZ,uZ,lZ,aZ,dZ,fZ,gZ,pZ,mZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};Cp.appendMenuItem(bp.EditorContext,{submenu:bp.EditorContextPeek,title:e(0,"Peek"),group:"navigation",order:100});class vZ{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof vZ||!(!vs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class wZ extends _p{static all(){return wZ._allSymbolNavigationCommands.values()}static _patchConfig(t){const i=Object.assign(Object.assign({},t),{f1:!0});if(i.menu)for(const e of B.wrap(i.menu))e.id!==bp.EditorContext&&e.id!==bp.EditorContextPeek||(e.when=Oo.and(t.precondition,e.when));return i}constructor(t,i){super(wZ._patchConfig(i)),this.configuration=t,wZ._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(IM),r=t.get(ro),o=t.get(qR),h=t.get(QG),c=t.get(ka),u=t.get(eo),l=i.getModel(),a=i.getPosition(),d=vZ.is(e)?e:new vZ(l,a),f=new UH(i,5),g=iu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>mZ(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(Yg(t.ariaMessage),t.referenceAt(l.uri,a)){const t=this._getAlternativeCommand(i);!wZ._activeAlternativeCommands.has(t)&&wZ._allSymbolNavigationCommands.has(t)&&(o=wZ._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=l.getWordAtPosition(a);null===(n=kK.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);wZ._activeAlternativeCommands.add(this.desc.id),u.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{wZ._activeAlternativeCommands.delete(this.desc.id)}))))}}))),(t=>{n.error(t)})).finally((()=>{f.dispose()}));return o.showWhile(g,250),g}_onResult(t,i,e,s,n){return mZ(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof eG||!(this.configuration.openInPeek||"peek"===r&&s.references.length>1)){const o=s.firstReference(),h=s.references.length>1&&"gotoAndPeek"===r,c=yield 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)}))}_openReference(t,i,e,s,n){return mZ(this,void 0,void 0,(function*(){let r;var o;if((o=e)&&os.isUri(o.uri)&&ws.isIRange(o.range)&&(ws.isIRange(o.originSelectionRange)||ws.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=yield i.openCodeEditor({resource:e.uri,options:{selection:ws.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=KG.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),tu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}wZ._allSymbolNavigationCommands=new Map,wZ._activeAlternativeCommands=new Set;class bZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield eZ(t.definitionProvider,i,s,n),e(0,"Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No definition found for '{0}'",t.word):e(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(56).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(56).multipleDefinitions}}const yZ=C&&!Wr()?2118:70;Ep(((cZ=class t extends bZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:e(0,"Go to &&Definition")},precondition:Oo.and(PC.hasDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:yZ,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.1},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),fp.registerCommandAlias("editor.action.goToDeclaration",t.id)}}).id="editor.action.revealDefinition",cZ)),Ep(((uZ=class t extends bZ{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Oo.and(PC.hasDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:Ae(2089,yZ),weight:100}}),fp.registerCommandAlias("editor.action.openDeclarationToTheSide",t.id)}}).id="editor.action.revealDefinitionAside",uZ)),Ep(((lZ=class t extends bZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.id,title:{value:e(0,"Peek Definition"),original:"Peek Definition"},precondition:Oo.and(PC.hasDefinitionProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:bp.EditorContextPeek,group:"peek",order:2}}),fp.registerCommandAlias("editor.action.previewDeclaration",t.id)}}).id="editor.action.peekDefinition",lZ));class kZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield sZ(t.declarationProvider,i,s,n),e(0,"Declarations"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No declaration found for '{0}'",t.word):e(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(56).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(56).multipleDeclarations}}Ep(((aZ=class t extends kZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.id,title:{value:e(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:e(0,"Go to &&Declaration")},precondition:Oo.and(PC.hasDeclarationProvider,PC.isInWalkThroughSnippet.toNegated()),menu:[{id:bp.EditorContext,group:"navigation",order:1.3},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No declaration found for '{0}'",t.word):e(0,"No declaration found")}}).id="editor.action.revealDeclaration",aZ)),Ep(class extends kZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:e(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Oo.and(PC.hasDeclarationProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:3}})}});class CZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield rZ(t.typeDefinitionProvider,i,s,n),e(0,"Type Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No type definition found for '{0}'",t.word):e(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(56).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(56).multipleTypeDefinitions}}Ep(((dZ=class t extends CZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.ID,title:{value:e(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:e(0,"Go to &&Type Definition")},precondition:Oo.and(PC.hasTypeDefinitionProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:0,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.4},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",dZ)),Ep(((fZ=class t extends CZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.ID,title:{value:e(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Oo.and(PC.hasTypeDefinitionProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",fZ));class SZ extends wZ{_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield nZ(t.implementationProvider,i,s,n),e(0,"Implementations"))}))}_getNoResultFoundMessage(t){return t&&t.word?e(0,"No implementation found for '{0}'",t.word):e(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(56).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(56).multipleImplementations}}Ep(((gZ=class t extends SZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:t.ID,title:{value:e(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:e(0,"Go to &&Implementations")},precondition:Oo.and(PC.hasImplementationProvider,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:2118,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.45},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",gZ)),Ep(((pZ=class t extends SZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:t.ID,title:{value:e(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Oo.and(PC.hasImplementationProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:3142,weight:100},menu:{id:bp.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",pZ));class xZ extends wZ{_getNoResultFoundMessage(t){return t?e(0,"No references found for '{0}'",t.word):e(0,"No references found")}_getAlternativeCommand(t){return t.getOption(56).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(56).multipleReferences}}Ep(class extends xZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:e(0,"Go to References"),original:"Go to References",mnemonicTitle:e(0,"Go to &&References")},precondition:Oo.and(PC.hasReferenceProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),keybinding:{when:PC.editorTextFocus,primary:1094,weight:100},menu:[{id:bp.EditorContext,group:"navigation",order:1.45},{id:bp.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield oZ(t.referenceProvider,i,s,!0,n),e(0,"References"))}))}}),Ep(class extends xZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:e(0,"Peek References"),original:"Peek References"},precondition:Oo.and(PC.hasReferenceProvider,dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated()),menu:{id:bp.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(yield oZ(t.referenceProvider,i,s,!1,n),e(0,"References"))}))}});class DZ extends wZ{constructor(t,i,s){super(t,{id:"editor.action.goToLocation",title:{value:e(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Oo.and(dG.notInPeekEditor,PC.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=s}_getLocationModel(t,i,s,n){return mZ(this,void 0,void 0,(function*(){return new DG(this._references,e(0,"Locations"))}))}_getNoResultFoundMessage(t){return t&&e(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(56).multipleReferences}_getAlternativeCommand(){return""}}fp.registerCommand({id:"editor.action.goToLocations",description:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:os},{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:(t,i,e,s,n,r,o)=>mZ(void 0,void 0,void 0,(function*(){Mt(os.isUri(i)),Mt(vs.isIPosition(e)),Mt(Array.isArray(s)),Mt(void 0===n||"string"==typeof n),Mt(void 0===o||"boolean"==typeof o);const h=t.get(ro),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(qH(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends DZ{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(eo).invokeFunction(i.run.bind(i),c)}))}))}),fp.registerCommand({id:"editor.action.peekLocations",description:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:os},{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:(t,i,e,s,n)=>mZ(void 0,void 0,void 0,(function*(){t.get(dp).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),fp.registerCommand({id:"editor.action.findReferences",handler:(t,i,s)=>{Mt(os.isUri(i)),Mt(vs.isIPosition(s));const n=t.get(ka),r=t.get(ro);return r.openCodeEditor({resource:i},r.getFocusedCodeEditor()).then((t=>{if(!qH(t)||!t.hasModel())return;const i=KG.get(t);if(!i)return;const r=tu((i=>oZ(n.referenceProvider,t.getModel(),vs.lift(s),!1,i).then((t=>new DG(t,e(0,"References")))))),o=new ws(s.lineNumber,s.column,s.lineNumber,s.column);return Promise.resolve(i.toggleWidget(o,r,!1))}))}}),fp.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var EZ=function(t,i){return function(e,s){i(e,s,t)}},AZ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let LZ=class t{constructor(t,i,e,s){this.textModelResolverService=i,this.languageService=e,this.languageFeaturesService=s,this.toUnhook=new Vi,this.toUnhookForKeyboard=new Vi,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=t,this.linkDecorations=this.editor.createDecorationsCollection();const n=new tG(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,Rt(i))}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Ei(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(i){return i.getContribution(t.ID)}startFindDefinitionFromCursor(t){return AZ(this,void 0,void 0,(function*(){yield 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())}startFindDefinition(t){var i;return AZ(this,void 0,void 0,(function*(){this.toUnhookForKeyboard.clear();const s=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!s)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===s.startColumn&&this.currentWordAtPosition.endColumn===s.endColumn&&this.currentWordAtPosition.word===s.word)return;this.currentWordAtPosition=s;const n=new zH(this.editor,15);let r;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=tu((i=>this.findDefinition(t,i)));try{r=yield this.previousPromise}catch(t){return void Ei(t)}if(!r||!r.length||!n.validate(this.editor))return void this.removeLinkDecorations();const o=r[0].originSelectionRange?ws.lift(r[0].originSelectionRange):new ws(t.lineNumber,s.startColumn,t.lineNumber,s.endColumn);if(r.length>1){let t=o;for(const{originSelectionRange:i}of r)i&&(t=ws.plusRange(t,i));this.addDecoration(t,(new MF).appendText(e(0,"Click to show {0} definitions.",r.length)))}else{const t=r[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),r=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(o,n?(new MF).appendCodeblock(r||"",n):void 0),i.dispose()}))}}))}getPreviewValue(i,e,s){let n=s.range;return n.endLineNumber-n.startLineNumber>=t.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(i,e)),this.stripIndentationFromPreviewRange(i,e,n)}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(i,e){const s=i.getLineFirstNonWhitespaceColumn(e),n=Math.min(i.getLineCount(),e+t.MAX_SOURCE_PREVIEW_LINES);let r=e+1;for(;r<n&&s!==i.getLineFirstNonWhitespaceColumn(r);r++);return new ws(e,1,r+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 eL)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?eZ(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(85)&&!this.isInPeekEditor(t);return new bZ({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Qo);return dG.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};LZ.ID="editor.contrib.gotodefinitionatposition",LZ.MAX_SOURCE_PREVIEW_LINES=8,LZ=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}([EZ(1,ep),EZ(2,hc),EZ(3,ka)],LZ),$p(LZ.ID,LZ,2);const MZ=Rg;class OZ extends Hi{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 Fy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class FZ extends Hi{static render(t,i,e){return new FZ(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Lg(t,MZ("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Lg(this.actionContainer,MZ("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Lg(this.action,MZ(`span.icon.${i.iconClass}`)),Lg(this.action,MZ("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Zf(this.actionContainer,xg.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Zf(this.actionContainer,xg.KEY_DOWN,(t=>{const e=new Pd(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 TZ{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class RZ extends Hi{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new lu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new lu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new lu((()=>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(58).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 mu(i,(t=>Qc(this,void 0,void 0,(function*(){var s,n,r;const o=i.token.onCancellationRequested((()=>{o.dispose(),i.dispose(),t.reject(new Fi)}));try{try{for(var h,c=!0,u=Yc(e);!(s=(h=yield u.next()).done);c=!0){if(c=!1,i.token.isCancellationRequested)return;t.emitOne(h.value)}}catch(t){n={error:t}}finally{try{c||s||!(r=u.return)||(yield r.call(u))}finally{if(n)throw n.error}}o.dispose(),i.dispose()}catch(e){o.dispose(),i.dispose(),t.reject(e)}}))))}((t=>this._computer.computeAsync(t))),(()=>{var t,i,e,s;t=this,i=void 0,s=function*(){var t,i,e,s;try{try{for(var n,r=!0,o=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,e=t[Symbol.asyncIterator];return e?e.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(e){i[e]=t[e]&&function(i){return new Promise((function(s,n){!function(t,i,e,s){Promise.resolve(s).then((function(i){t({value:i,done:e})}),i)}(s,n,(i=t[e](i)).done,i.value)}))}}}(this._asyncIterable);!(t=(n=yield o.next()).done);r=!0)r=!1,(s=n.value)&&(this._result.push(s),this._fireResult())}catch(t){i={error:t}}finally{try{r||t||!(e=o.return)||(yield e.call(o))}finally{if(i)throw i.error}}this._asyncIterableDone=!0,3!==this._state&&4!==this._state||this._setState(0)}catch(t){Ei(t)}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))})()):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 TZ(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 _Z{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 IZ{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 PZ=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class NZ{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=NZ._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(NZ.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(NZ.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(NZ.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(NZ.isVariableCharacter(s)||NZ.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===NZ._table[s]&&!NZ.isDigitCharacter(s)&&!NZ.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}NZ._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class BZ{constructor(){this._children=[]}appendChild(t){return t instanceof $Z&&this._children[this._children.length-1]instanceof $Z?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 qZ)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class $Z extends BZ{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new $Z(this.value)}}class jZ extends BZ{}class WZ extends jZ{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 VZ?this._children[0]:void 0}clone(){const t=new WZ(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class VZ extends BZ{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof $Z&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new VZ;return this.options.forEach(t.appendChild,t),t}}class HZ extends BZ{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 zZ&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof zZ){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new HZ;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 zZ extends BZ{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 zZ(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class UZ extends jZ{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 $Z(i)],!0)}clone(){const t=new UZ(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function KZ(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class qZ extends BZ{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof WZ&&(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 KZ([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof WZ&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof UZ&&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 qZ;return this._children=this.children.map((t=>t.clone())),t}walk(t){KZ(this.children,t)}}class GZ{constructor(){this._scanner=new NZ,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 qZ;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 WZ&&(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 WZ(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof WZ&&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 WZ(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 $Z(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 WZ(Number(i)):new UZ(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 WZ(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new $Z("${"+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 VZ;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 $Z(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 UZ(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 $Z("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new HZ;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 $Z(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 zZ(Number(s))),!0;if(this._accept(4))return t.appendChild(new zZ(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 zZ(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new zZ(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new zZ(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 zZ(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new zZ(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new $Z(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}const ZZ=e(0,"input"),JZ=e(0,"Preserve Case");class QZ extends xB{constructor(t){super({icon:Ss.preserveCase,title:JZ+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class YZ extends gy{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ee),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ee),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ee),this._onInput=this._register(new ee),this._onKeyUp=this._register(new ee),this._onPreserveCaseKeyDown=this._register(new ee),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||ZZ;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 IB(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 QZ(Object.assign({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 u=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=u.indexOf(document.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%u.length:t.equals(15)&&(e=0===i?u.length-1:i-1),t.equals(9)?(u[i].blur(),this.inputBox.focus()):e>=0&&u[e].focus(),Dg(t,!0)}}}));const l=document.createElement("div");l.className="controls",l.style.display=this._showOptionButtons?"block":"none",l.appendChild(this.preserveCase.domNode),this.domNode.appendChild(l),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 XZ=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},tJ=function(t,i){return function(e,s){i(e,s,t)}};const iJ=new Jo("suggestWidgetVisible",!1,e(0,"Whether suggestion are visible")),eJ="historyNavigationWidgetFocus",sJ="historyNavigationForwardsEnabled",nJ="historyNavigationBackwardsEnabled";let rJ;const oJ=[];function hJ(t,i){if(oJ.includes(i))throw new Error("Cannot register the same widget multiple times");oJ.push(i);const e=new Vi,s=new Jo(eJ,!1).bindTo(t),n=new Jo(sJ,!0).bindTo(t),r=new Jo(nJ,!0).bindTo(t),o=()=>{s.set(!0),rJ=i},h=()=>{s.set(!1),rJ===i&&(rJ=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{oJ.splice(oJ.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let cJ=class extends NB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(hJ(n,this.inputBox))}};cJ=XZ([tJ(3,Qo)],cJ);let uJ=class extends YZ{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(hJ(r,this.inputBox))}};uJ=XZ([tJ(3,Qo)],uJ),pp.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Oo.and(Oo.has(eJ),Oo.equals(nJ,!0),iJ.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==rJ||rJ.showPreviousValue()}}),pp.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Oo.and(Oo.has(eJ),Oo.equals(sJ,!0),iJ.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==rJ||rJ.showNextValue()}});var lJ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const aJ={Visible:iJ,HasFocusedSuggestion:new Jo("suggestWidgetHasFocusedSuggestion",!1,e(0,"Whether any suggestion is focused")),DetailsVisible:new Jo("suggestWidgetDetailsVisible",!1,e(0,"Whether suggestion details are visible")),MultipleSuggestions:new Jo("suggestWidgetMultipleSuggestions",!1,e(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Jo("suggestionMakesTextEdit",!0,e(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Jo("acceptSuggestionOnEnter",!0,e(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Jo("suggestionHasInsertAndReplaceRange",!1,e(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Jo("suggestionInsertMode",void 0,{type:"string",description:e(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Jo("suggestionCanResolve",!1,e(0,"Whether the current suggestion supports to resolve further details"))},dJ=new bp("suggestWidgetStatusBar");class fJ{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=pF.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,ws.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||ws.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||ws.spansMultipleLines(i.range.insert)||ws.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._isResolved=!0)}get isResolved(){return!!this._isResolved}resolve(t){return lJ(this,void 0,void 0,(function*(){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._isResolved=!1}));this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._isResolved=!0,i.dispose()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._isResolved=!1)}))}return this._resolveCache}))}}class gJ{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}}gJ.default=new gJ;class pJ{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function mJ(t,i,e,s=gJ.default,n={triggerKind:0},r=fe.None){return lJ(this,void 0,void 0,(function*(){const o=new Ji(!0);e=e.clone();const h=i.getWordAtPosition(e),c=h?new ws(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):ws.fromPositions(e),u={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},l=[],a=new Vi,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=u),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=GZ.guessNeedsClipboard(n.insertText)),l.push(new fJ(e,n,i,t)),c=!0}return Bi(i)&&a.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=(()=>lJ(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>lJ(this,void 0,void 0,(function*(){if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>l.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Ji(!0),h=yield o.provideCompletionItems(i,e,n,r);t=g(o,h,s)||t}catch(t){Ai(t)}}))))),t||r.isCancellationRequested)break}return yield p,r.isCancellationRequested?(a.dispose(),Promise.reject(new Fi)):new pJ(l.sort(wJ.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function vJ(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 wJ=new Map;wJ.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 vJ(t,i)})),wJ.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 vJ(t,i)})),wJ.set(1,vJ),fp.registerCommand("_executeCompletionItemProvider",((t,...i)=>lJ(void 0,void 0,void 0,(function*(){const[e,s,n,r]=i;Mt(os.isUri(e)),Mt(vs.isIPosition(s)),Mt("string"==typeof n||!n),Mt("number"==typeof r||!r);const{completionProvider:o}=t.get(ka),h=yield t.get(ep).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield mJ(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 yield Promise.all(i),t}finally{setTimeout((()=>c.disposable.dispose()),100)}}finally{h.dispose()}}))));class bJ{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}}}var yJ=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},kJ=function(t,i){return function(e,s){i(e,s,t)}};const CJ=Rg;let SJ=class t extends Hi{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._widget=this._register(this._instantiationService.createInstance(AJ,this._editor)),this._currentResult=null,this._participants=[];for(const t of PZ.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new MJ(this._editor,this._participants),this._hoverOperation=this._register(new RZ(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 xJ(this._computer.anchor,i,t.isComplete))}))),this._register(Qf(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register($s.onDidChange((()=>{this._widget.position&&this._currentResult&&(this._widget.clear(),this._setCurrentResult(this._currentResult))})))}maybeShowAt(t){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 _Z(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(48).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new _Z(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 _Z(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(58).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)}isColorPickerVisible(){return this._widget.isColorPickerVisible}isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}isVisible(){return this._widget.isVisible}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(i,e){const{showAtPosition:s,showAtSecondaryPosition:n,highlightRange:r}=t.computeHoverRanges(this._editor,i.range,e),o=new Vi,h=o.add(new LJ(this._keybindingService)),c=document.createDocumentFragment();let u=null;const l={fragment:c,statusBar:h,setColorPicker:t=>u=t,onContentsChanged:()=>this._widget.onContentsChanged(),hide:()=>this.hide()};for(const t of this._participants){const i=e.filter((i=>i.owner===t));i.length>0&&o.add(t.renderHoverParts(l,i))}const a=e.some((t=>t.isBeforeContent));if(h.hasContent&&c.appendChild(h.hoverElement),c.hasChildNodes()){if(r){const i=this._editor.createDecorationsCollection();i.set([{range:r,options:t._DECORATION_OPTIONS}]),o.add(Wi((()=>{i.clear()})))}this._widget.showAt(c,new EJ(u,s,n,this._editor.getOption(58).above,this._computer.shouldFocus,this._computer.source,a,i.initialMousePosX,i.initialMousePosY,o))}else o.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=ws.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()}escape(){this._widget.escape()}};SJ._DECORATION_OPTIONS=sL.register({description:"content-hover-highlight",className:"hoverHighlight"}),SJ=yJ([kJ(1,eo),kJ(2,eP)],SJ);class xJ{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 DJ(this,this.anchor,i,this.isComplete)}}class DJ extends xJ{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class EJ{constructor(t,i,e,s,n,r,o,h,c,u){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=u,this.closestMouseDistance=void 0}}let AJ=class t extends Hi{get position(){var t,i;return null!==(i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition)&&void 0!==i?i:null}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}constructor(t,i){super(),this._editor=t,this._contextKeyService=i,this.allowEditorOverflow=!0,this._hoverVisibleKey=PC.hoverVisible.bindTo(this._contextKeyService),this._hoverFocusedKey=PC.hoverFocused.bindTo(this._contextKeyService),this._hover=this._register(new OZ),this._focusTracker=this._register(Ag(this.getDomNode())),this._horizontalScrollingBy=30,this._visibleData=null,this._register(this._editor.onDidLayoutChange((()=>this._layout()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&this._updateFont()}))),this._setVisibleData(null),this._layout(),this._editor.addContentWidget(this),this._register(this._focusTracker.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(this._focusTracker.onDidBlur((()=>{this._hoverFocusedKey.set(!1)})))}dispose(){this._editor.removeContentWidget(this),this._visibleData&&this._visibleData.disposables.dispose(),super.dispose()}getId(){return t.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){if(!this._visibleData)return null;let t=this._visibleData.preferAbove;return!t&&this._contextKeyService.getContextKeyValue(aJ.Visible.key)&&(t=!0),{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,preference:t?[1,2]:[2,1],positionAffinity:this._visibleData.isBeforeContent?3:void 0}}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=og(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=OJ(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=OJ(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))}_setVisibleData(t){this._visibleData&&this._visibleData.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!this._visibleData),this._hover.containerDomNode.classList.toggle("hidden",!this._visibleData)}_layout(){const t=Math.max(this._editor.getLayoutInfo().height/4,250),{fontSize:i,lineHeight:e}=this._editor.getOption(48);this._hover.contentsDomNode.style.fontSize=`${i}px`,this._hover.contentsDomNode.style.lineHeight=""+e/i,this._hover.contentsDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.style.maxWidth=`${Math.max(.66*this._editor.getLayoutInfo().width,500)}px`}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}showAt(t,i){var e;this._setVisibleData(i),this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._hover.contentsDomNode.style.paddingBottom="",this._updateFont(),this.onContentsChanged(),this._editor.render(),this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(e=i.colorPicker)||void 0===e||e.layout()}hide(){if(this._visibleData){const t=this._visibleData.stoleFocus;this._setVisibleData(null),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}}onContentsChanged(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged();const t=this._hover.scrollbar.getScrollDimensions();if(t.scrollWidth>t.width){const t=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingBottom!==t&&(this._hover.contentsDomNode.style.paddingBottom=t,this._editor.layoutContentWidget(this),this._hover.onContentsChanged())}}clear(){this._hover.contentsDomNode.textContent=""}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(48);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(48);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-this._horizontalScrollingBy})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+this._horizontalScrollingBy})}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})}escape(){this._editor.focus()}};AJ.ID="editor.contrib.contentHoverWidget",AJ=yJ([kJ(1,Qo)],AJ);let LJ=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=CJ("div.hover-row.status-bar"),this.actionsElement=Lg(this.hoverElement,CJ("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(FZ.render(this.actionsElement,t,e))}append(t){const i=Lg(this.actionsElement,t);return this._hasContent=!0,i}};LJ=yJ([kJ(0,eP)],LJ);class MJ{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 pu.EMPTY;const e=MJ._getLineDecorations(this._editor,i);return pu.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):pu.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=MJ._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return X(i)}}function OJ(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)}var FJ=function(t,i){return function(e,s){i(e,s,t)}},TJ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let RJ=class t{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ee,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(t,i,e){if(!t)return{element:document.createElement("span"),dispose:()=>{}};const s=new Vi,n=s.add(iT(t,Object.assign(Object.assign({},this._getRenderOptions(t,s)),i),e));return n.element.classList.add("rendered-markdown"),{element:n.element,dispose:()=>s.dispose()}}_getRenderOptions(i,e){return{codeBlockRenderer:(i,e)=>TJ(this,void 0,void 0,(function*(){var s,n,r;let o;i?o=this._languageService.getLanguageIdByLanguageName(i):this._options.editor&&(o=null===(s=this._options.editor.getModel())||void 0===s?void 0:s.getLanguageId()),o||(o=Ec);const h=yield function(t,i,e){return s=this,n=void 0,o=function*(){if(!e)return tM(i,t.languageIdCodec,YL);const s=yield $s.getOrCreate(e);return tM(i,t.languageIdCodec,s||YL)},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o}(this._languageService,e,o),c=document.createElement("span");return c.innerHTML=null!==(r=null===(n=t._ttpTokenizer)||void 0===n?void 0:n.createHTML(h))&&void 0!==r?r:h,this._options.editor?Kr(c,this._options.editor.getOption(48)):this._options.codeBlockFontFamily&&(c.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(c.style.fontSize=this._options.codeBlockFontSize),c})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:t=>function(t,i,e){return TJ(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:_J(e)})}catch(t){return Ei(t),!1}}))}(this._openerService,t,i.isTrusted),disposables:e}}}};function _J(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}RJ._ttpTokenizer=Lu("tokenizeToString",{createHTML:t=>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}([FJ(1,hc),FJ(2,W_)],RJ);const IJ=Rg;class PJ extends Hi{constructor(t,i,e){super(),this._renderDisposeables=this._register(new Vi),this._editor=t,this._isVisible=!1,this._messages=[],this._hover=this._register(new OZ),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new RJ({editor:this._editor},i,e)),this._computer=new NJ(this._editor),this._hoverOperation=this._register(new RZ(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(48)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return PJ.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=IJ("div.hover-row.markdown-hover"),s=Lg(i,IJ("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(64),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`}}PJ.ID="editor.contrib.modesGlyphHoverWidget";class NJ{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&&!OF(i)&&e.push(...at(i).map(t))}return e}}class BJ{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function $J(t,i,e,s){const n=t.ordered(i).map(((t,n)=>function(t,i,e,s,n){return r=this,o=void 0,c=function*(){try{const r=yield 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 BJ(t,r,i)}catch(t){Ai(t)}},new((h=void 0)||(h=Promise))((function(t,i){function e(t){try{n(c.next(t))}catch(t){i(t)}}function s(t){try{n(c.throw(t))}catch(t){i(t)}}function n(i){var n;i.done?t(i.value):(n=i.value,n instanceof h?n:new h((function(t){t(n)}))).then(e,s)}n((c=c.apply(r,o||[])).next())}));var r,o,h,c}(t,n,i,e,s)));return pu.fromPromises(n).coalesce()}Ip("_executeHoverProvider",((t,i,e)=>function(t,i,e){return $J(t,i,e,fe.None).map((t=>t.hover)).toPromise()}(t.get(ka).hoverProvider,i,e)));var jJ=function(t,i){return function(e,s){i(e,s,t)}};const WJ=Rg;class VJ{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 HJ=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 VJ(this,t.range,[(new MF).appendText(e(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const s=this._editor.getModel(),n=t.range.startLineNumber,r=s.getLineMaxColumn(n),o=[];let h=1e3;const c=s.getLineLength(n),u=s.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(113),a=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:u});let d=!1;l>=0&&c>l&&t.range.startColumn>=l&&(d=!0,o.push(new VJ(this,t.range,[{value:e(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,h++))),!d&&"number"==typeof a&&c>=a&&o.push(new VJ(this,t.range,[{value:e(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,h++));let f=!1;for(const e of i){const i=e.range.startLineNumber===n?e.range.startColumn:1,s=e.range.endLineNumber===n?e.range.endColumn:r,c=e.options.hoverMessage;if(!c||OF(c))continue;e.options.beforeContentClassName&&(f=!0);const u=new ws(t.range.startLineNumber,i,t.range.startLineNumber,s);o.push(new VJ(this,u,at(c),f,h++))}return o}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return pu.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return pu.EMPTY;const n=new vs(t.range.startLineNumber,t.range.startColumn);return $J(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!OF(t.hover.contents))).map((i=>{const e=i.hover.range?ws.lift(i.hover.range):t.range;return new VJ(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return zJ(t,i,this._editor,this._languageService,this._openerService)}};function zJ(t,i,e,s,n){i.sort(((t,i)=>t.ordinal-i.ordinal));const r=new Vi;for(const o of i)for(const i of o.contents){if(OF(i))continue;const o=WJ("div.hover-row.markdown-hover"),h=Lg(o,WJ("div.hover-contents")),c=r.add(new RJ({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const u=r.add(c.render(i));h.appendChild(u.element),t.fragment.appendChild(o)}return r}HJ=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}([jJ(1,hc),jJ(2,W_),jJ(3,ic),jJ(4,ka)],HJ);var UJ=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},KJ=function(t,i){return function(e,s){i(e,s,t)}};class qJ{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let GJ=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._dispoables=new Vi,this._markers=[],this._nextIdx=-1,os.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=Un(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?ws.compareRangesUsingStarts(t,i)||YN.compare(t.severity,i.severity):YN.compare(t.severity,i.severity)||ws.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:os.isUri(t)?t:void 0,severities:YN.Error|YN.Warning|YN.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 qJ(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let s=!1,n=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));n<0&&(n=Z(this._markers,{resource:t.uri},((t,i)=>Un(t.resource.toString(),i.resource.toString()))),n<0&&(n=~n));for(let e=n;e<this._markers.length;e++){let n=ws.lift(this._markers[e]);if(n.isEmpty()){const i=t.getWordAtPosition(n.getStartPosition());i&&(n=new ws(n.startLineNumber,i.startColumn,n.startLineNumber,i.endColumn))}if(i&&(n.containsPosition(i)||i.isBeforeOrEqual(n.getStartPosition()))){this._nextIdx=e,s=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}s||(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(ws.containsPosition(this._markers[e],i))return new qJ(this._markers[e],e+1,this._markers.length)}};GJ=UJ([KJ(1,tB),KJ(2,ic)],GJ);const ZJ=no("IMarkerNavigationService");let JJ=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new j}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new GJ(t,this._markerService,this._configService)}};var QJ;JJ=UJ([KJ(0,tB),KJ(1,ic)],JJ),lc(ZJ,JJ,1),function(t){t.className=function(t){switch(t){case RM.Ignore:return"severity-ignore "+np.asClassName(Ss.info);case RM.Info:return np.asClassName(Ss.info);case RM.Warning:return np.asClassName(Ss.warning);case RM.Error:return np.asClassName(Ss.error);default:return""}}}(QJ||(QJ={}));var YJ=function(t,i){return function(e,s){i(e,s,t)}};class XJ{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 Vi,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(Qf(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new My(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(){$i(this._disposables)}update(t){const{source:i,message:e,relatedInformation:s,code:n}=t;let r=((null==i?void 0:i.length)||0)+"()".length;n&&(r+="string"==typeof n?n.length:n.value.length);const o=Wn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Kf(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=Rg("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()},Lg(this._codeLink,Rg("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Kf(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),et(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(64))}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(48),u=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:u,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 YN.Error:i=e(0,"Error");break;case YN.Warning:i=e(0,"Warning");break;case YN.Info:i=e(0,"Info");break;case YN.Hint:i=e(0,"Hint")}let s=e(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const n=this._editor.getModel();return n&&t.startLineNumber<=n.getLineCount()&&t.startLineNumber>=1&&(s=`${n.getLineContent(t.startLineNumber)}, ${s}`),s}}let tQ=class t extends pG{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 Vi,this._onDidSelectRelatedInformation=new ee,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=YN.Warning,this._backgroundColor=ea.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(lQ);let i=nQ,e=rQ;this._severity===YN.Warning?(i=oQ,e=hQ):this._severity===YN.Info&&(i=cQ,e=uQ);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(vG),secondaryHeadingColor:t.getColor(wG)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(i){super._fillHead(i),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const e=[],s=this._menuService.createMenu(t.TitleMenu,this._contextKeyService);EN(s,void 0,e),this._actionbarWidget.push(e,{label:!1,icon:!0,index:0}),s.dispose()}_fillTitleIcon(t){this._icon=Lg(t,Rg(""))}_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 XJ(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,s){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const n=ws.lift(t),r=this.editor.getPosition(),o=r&&n.containsPosition(r)?r:n.getStartPosition();super.show(o,this.computeRequiredHeight());const h=this.editor.getModel();if(h){const t=e(0,s>1?"{0} of {1} problems":"{0} of {1} problem",i,s);this.setTitle(JD(h.uri),t)}this._icon.className=`codicon ${QJ.className(YN.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(o,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()}};tQ.TitleMenu=new bp("gotoErrorTitleMenu"),tQ=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}([YJ(1,Yy),YJ(2,W_),YJ(3,yp),YJ(4,eo),YJ(5,Qo),YJ(6,fP)],tQ);const iQ=db(sv,nv),eQ=db(rv,ov),sQ=db(hv,cv),nQ=fm("editorMarkerNavigationError.background",{dark:iQ,light:iQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget error color.")),rQ=fm("editorMarkerNavigationError.headerBackground",{dark:ab(nQ,.1),light:ab(nQ,.1),hcDark:null,hcLight:null},e(0,"Editor marker navigation widget error heading background.")),oQ=fm("editorMarkerNavigationWarning.background",{dark:eQ,light:eQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget warning color.")),hQ=fm("editorMarkerNavigationWarning.headerBackground",{dark:ab(oQ,.1),light:ab(oQ,.1),hcDark:"#0C141F",hcLight:ab(oQ,.2)},e(0,"Editor marker navigation widget warning heading background.")),cQ=fm("editorMarkerNavigationInfo.background",{dark:sQ,light:sQ,hcDark:wm,hcLight:wm},e(0,"Editor marker navigation widget info color.")),uQ=fm("editorMarkerNavigationInfo.headerBackground",{dark:ab(cQ,.1),light:ab(cQ,.1),hcDark:null,hcLight:null},e(0,"Editor marker navigation widget info heading background.")),lQ=fm("editorMarkerNavigation.background",{dark:lv,light:lv,hcDark:lv,hcLight:lv},e(0,"Editor marker navigation widget background."));var aQ=function(t,i){return function(e,s){i(e,s,t)}},dQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let fQ=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){this._markerNavigationService=i,this._contextKeyService=e,this._editorService=s,this._instantiationService=n,this._sessionDispoables=new Vi,this._editor=t,this._widgetVisible=vQ.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(tQ,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)&&ws.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:ws.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)}}nagivate(i,e){var s,n;return dQ(this,void 0,void 0,(function*(){if(this._editor.hasModel()){const r=this._getOrCreateModel(e?void 0:this._editor.getModel().uri);if(r.move(i,this._editor.getModel(),this._editor.getPosition()),!r.selected)return;if(r.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const o=yield this._editorService.openCodeEditor({resource:r.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:r.selected.marker}},this._editor);o&&(null===(s=t.get(o))||void 0===s||s.close(),null===(n=t.get(o))||void 0===n||n.nagivate(i,e))}else this._widget.showAtMarker(r.selected.marker,r.selected.index,r.selected.total)}}))}};fQ.ID="editor.contrib.markerController",fQ=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}([aQ(1,ZJ),aQ(2,Qo),aQ(3,ro),aQ(4,eo)],fQ);class gQ extends Tp{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return dQ(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=fQ.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class pQ extends gQ{constructor(){super(!0,!1,{id:pQ.ID,label:pQ.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:578,weight:100},menuOpts:{menuId:tQ.TitleMenu,title:pQ.LABEL,icon:SR("marker-navigation-next",Ss.arrowDown,e(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}pQ.ID="editor.action.marker.next",pQ.LABEL=e(0,"Go to Next Problem (Error, Warning, Info)");class mQ extends gQ{constructor(){super(!1,!1,{id:mQ.ID,label:mQ.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:1602,weight:100},menuOpts:{menuId:tQ.TitleMenu,title:mQ.LABEL,icon:SR("marker-navigation-previous",Ss.arrowUp,e(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}mQ.ID="editor.action.marker.prev",mQ.LABEL=e(0,"Go to Previous Problem (Error, Warning, Info)"),$p(fQ.ID,fQ,4),Np(pQ),Np(mQ),Np(class extends gQ{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:e(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:PC.focus,primary:66,weight:100},menuOpts:{menuId:bp.MenubarGoMenu,title:e(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),Np(class extends gQ{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:e(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:PC.focus,primary:1090,weight:100},menuOpts:{menuId:bp.MenubarGoMenu,title:e(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const vQ=new Jo("markersNavigationVisible",!1);Pp(new(Fp.bindToContribution(fQ.get))({id:"closeMarkersNavigation",precondition:vQ,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:PC.focus,primary:9,secondary:[1033]}}));var wQ=function(t,i){return function(e,s){i(e,s,t)}};const bQ=Rg;class yQ{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 kQ={type:1,filter:{include:YU.QuickFix},triggerAction:QU.QuickFixHover};let CQ,SQ=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 u=new ws(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new yQ(this,u,c))}return r}renderHoverParts(t,i){if(!i.length)return Hi.None;const e=new Vi;i.forEach((i=>t.fragment.appendChild(this.renderMarkerHover(i,e))));const s=1===i.length?i[0]:i.sort(((t,i)=>YN.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=bQ("div.hover-row"),s=Lg(e,bQ("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Lg(s,bQ("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=bQ("span");n&&(Lg(t,bQ("span")).innerText=n);const e=Lg(t,bQ("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Zf(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Lg(e,bQ("span")).innerText=o.value;const r=Lg(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Lg(s,bQ("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(et(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=Lg(s,bQ("div"));o.style.marginTop="8px";const h=Lg(o,bQ("a"));h.innerText=`${JD(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Zf(h,"click",(t=>{t.stopPropagation(),t.preventDefault(),this._openerService&&this._openerService.open(e,{fromUserGesture:!0,editorOptions:{selection:{startLineNumber:n,startColumn:r}}}).catch(Ei)})));const c=Lg(o,bQ("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,s){if(i.marker.severity!==YN.Error&&i.marker.severity!==YN.Warning&&i.marker.severity!==YN.Info||t.statusBar.addAction({label:e(0,"View Problem"),commandId:pQ.ID,run:()=>{var e;t.hide(),null===(e=fQ.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(88)){const n=t.statusBar.append(bQ("div"));this.recentMarkerCodeActionsInfo&&(XN.makeKey(this.recentMarkerCodeActionsInfo.marker)===XN.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=e(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const r=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Hi.None:s.add(ou((()=>n.textContent=e(0,"Checking for quick fixes...")),200));n.textContent||(n.textContent=String.fromCharCode(160));const o=this.getCodeActions(i.marker);s.add(Wi((()=>o.cancel()))),o.then((o=>{if(r.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:o.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return o.dispose(),void(n.textContent=e(0,"No quick fixes available"));n.style.display="none";let h=!1;s.add(Wi((()=>{h||o.dispose()}))),t.statusBar.addAction({label:e(0,"Quick Fix..."),commandId:nK,run:i=>{h=!0;const e=GK.get(this._editor),s=og(i);t.hide(),null==e||e.showCodeActions(kQ,o,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return tu((i=>dK(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ws(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),kQ,KR.None,i)))}};SQ=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}([wQ(1,ip),wQ(2,W_),wQ(3,ka)],SQ);class xQ{get TChange(){return null}reportChanges(){this.get()}read(t){return t?t.readObservable(this):this.get()}map(t){return CQ((()=>{const i=MQ(t);return void 0!==i?i:`${this.debugName} (mapped)`}),(i=>t(this.read(i),i)))}}class DQ extends xQ{constructor(){super(...arguments),this.observers=new Set}addObserver(t){const i=this.observers.size;this.observers.add(t),0===i&&this.onFirstObserverAdded()}removeObserver(t){this.observers.delete(t)&&0===this.observers.size&&this.onLastObserverRemoved()}onFirstObserverAdded(){}onLastObserverRemoved(){}}function EQ(t,i){const e=new LQ(t,i);try{void 0,t(e)}finally{e.finish(),void 0}}function AQ(t,i,e){t?i(t):EQ(i,e)}class LQ{constructor(t,i){this.fn=t,this._getDebugName=i,this.updatingObservers=[]}getDebugName(){return this._getDebugName?this._getDebugName():MQ(this.fn)}updateObserver(t,i){this.updatingObservers.push({observer:t,observable:i}),t.beginUpdate(i)}finish(){const t=this.updatingObservers;this.updatingObservers=null;for(const{observer:i,observable:e}of t)i.endUpdate(e)}}function MQ(t){const i=t.toString(),e=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(i),s=e?e[1]:void 0;return null==s?void 0:s.trim()}function OQ(t,i){return new FQ(t,i)}class FQ extends DQ{constructor(t,i){super(),this.debugName=t,this._value=i}get(){return this._value}set(t,i,e){if(this._value===t)return;let s;i||(i=s=new LQ((()=>{}),(()=>`Setting ${this.debugName}`)));try{this._setValue(t),void 0;for(const t of this.observers)i.updateObserver(t,this),t.handleChange(this,e)}finally{s&&s.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(t){this._value=t}}function TQ(t,i){return new RQ(t,i)}class RQ extends FQ{_setValue(t){this._value!==t&&(this._value&&this._value.dispose(),this._value=t)}dispose(){var t;null===(t=this._value)||void 0===t||t.dispose()}}function _Q(t,i){return new IQ(t,i,void 0,void 0)}!function(t){CQ=t}(_Q);class IQ extends DQ{get debugName(){return"function"==typeof this._debugName?this._debugName():this._debugName}constructor(t,i,e,s){var n;super(),this._debugName=t,this.computeFn=i,this.createChangeSummary=e,this._handleChange=s,this.state=0,this.value=void 0,this.updateCount=0,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=void 0,this.changeSummary=null===(n=this.createChangeSummary)||void 0===n?void 0:n.call(this)}onLastObserverRemoved(){this.state=0,this.value=void 0;for(const t of this.dependencies)t.removeObserver(this);this.dependencies.clear()}get(){var t;if(0===this.observers.size){const i=this.computeFn(this,null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this));return this.onLastObserverRemoved(),i}do{if(1===this.state){this.state=3;for(const t of this.dependencies)if(t.reportChanges(),2===this.state)break}this._recomputeIfNeeded()}while(3!==this.state);return this.value}_recomputeIfNeeded(){var t;if(3===this.state)return;const i=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=i;const e=0!==this.state,s=this.value;this.state=3;const n=this.changeSummary;this.changeSummary=null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this);try{this.value=this.computeFn(this,n)}finally{for(const t of this.dependenciesToBeRemoved)t.removeObserver(this);this.dependenciesToBeRemoved.clear()}const r=e&&s!==this.value;if(void 0,r)for(const t of this.observers)t.handleChange(this,void 0)}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(t){this.updateCount++;const i=1===this.updateCount;if(3===this.state&&(this.state=1,!i))for(const t of this.observers)t.handlePossibleChange(this);if(i)for(const t of this.observers)t.beginUpdate(this)}endUpdate(t){if(this.updateCount--,0===this.updateCount){const t=[...this.observers];for(const i of t)i.endUpdate(this)}if(this.updateCount<0)throw new Pi}handlePossibleChange(t){if(3===this.state&&this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)){this.state=1;for(const t of this.observers)t.handlePossibleChange(this)}}handleChange(t,i){if(this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)){const e=!this._handleChange||this._handleChange({changedObservable:t,change:i,didChange:i=>i===t},this.changeSummary),s=3===this.state;if(e&&(1===this.state||s)&&(this.state=2,s))for(const t of this.observers)t.handlePossibleChange(this)}}readObservable(t){t.addObserver(this);const i=t.get();return this.dependencies.add(t),this.dependenciesToBeRemoved.delete(t),i}addObserver(t){const i=!this.observers.has(t)&&this.updateCount>0;super.addObserver(t),i&&t.beginUpdate(this)}removeObserver(t){const i=this.observers.has(t)&&this.updateCount>0;super.removeObserver(t),i&&t.endUpdate(this)}}function PQ(t,i){return new NQ(t,i,void 0,void 0)}class NQ{constructor(t,i,e,s){var n;this.debugName=t,this.runFn=i,this.createChangeSummary=e,this._handleChange=s,this.state=2,this.updateCount=0,this.disposed=!1,this.dependencies=new Set,this.dependenciesToBeRemoved=new Set,this.changeSummary=null===(n=this.createChangeSummary)||void 0===n?void 0:n.call(this),this._runIfNeeded()}dispose(){this.disposed=!0;for(const t of this.dependencies)t.removeObserver(this);this.dependencies.clear()}_runIfNeeded(){var t;if(3===this.state)return;const i=this.dependenciesToBeRemoved;this.dependenciesToBeRemoved=this.dependencies,this.dependencies=i,this.state=3;try{const i=this.changeSummary;this.changeSummary=null===(t=this.createChangeSummary)||void 0===t?void 0:t.call(this),this.runFn(this,i)}finally{for(const t of this.dependenciesToBeRemoved)t.removeObserver(this);this.dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(){3===this.state&&(this.state=1),this.updateCount++}endUpdate(){if(1===this.updateCount)do{if(1===this.state){this.state=3;for(const t of this.dependencies)if(t.reportChanges(),2===this.state)break}this._runIfNeeded()}while(3!==this.state);this.updateCount--,co((()=>this.updateCount>=0))}handlePossibleChange(t){3===this.state&&this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)&&(this.state=1)}handleChange(t,i){this.dependencies.has(t)&&!this.dependenciesToBeRemoved.has(t)&&(!this._handleChange||this._handleChange({changedObservable:t,change:i,didChange:i=>i===t},this.changeSummary))&&(this.state=2)}readObservable(t){if(this.disposed)return t.get();t.addObserver(this);const i=t.get();return this.dependencies.add(t),this.dependenciesToBeRemoved.delete(t),i}}function BQ(t){return new $Q(t)}!function(t){t.Observer=NQ}(PQ||(PQ={}));class $Q extends xQ{constructor(t){super(),this.value=t}get debugName(){return this.toString()}get(){return this.value}addObserver(t){}removeObserver(t){}toString(){return`Const: ${this.value}`}}function jQ(t,i){return new WQ(t,i)}class WQ extends DQ{constructor(t,i){super(),this.event=t,this.getValue=i,this.hasValue=!1,this.handleEvent=t=>{const i=this.getValue(t),e=!this.hasValue||this.value!==i;e&&(this.value=i,this.hasValue&&EQ((t=>{for(const i of this.observers)t.updateObserver(i,this),i.handleChange(this,void 0)}),(()=>{const t=this.getDebugName();return"Event fired"+(t?`: ${t}`:"")})),this.hasValue=!0)}}getDebugName(){return MQ(this.getValue)}get debugName(){const t=this.getDebugName();return"From Event"+(t?`: ${t}`:"")}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0,this.hasValue=!1,this.value=void 0}get(){return this.subscription?(this.hasValue||this.handleEvent(void 0),this.value):this.getValue(void 0)}}!function(t){t.Observer=WQ}(jQ||(jQ={}));class VQ extends DQ{constructor(t,i){super(),this.debugName=t,this.event=i,this.handleEvent=()=>{EQ((t=>{for(const i of this.observers)t.updateObserver(i,this),i.handleChange(this,void 0)}),(()=>this.debugName))}}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}class HQ extends DQ{constructor(t){super(),this.debugName=t}trigger(t,i){if(t)for(const e of this.observers)t.updateObserver(e,this),e.handleChange(this,i);else EQ((t=>{this.trigger(t,i)}),(()=>`Trigger signal ${this.debugName}`))}get(){}}class zQ{constructor(t){this.forceRecompute=t,this.counter=0}beginUpdate(t){this.counter++}endUpdate(t){this.counter--,0===this.counter&&this.forceRecompute&&t.reportChanges()}handlePossibleChange(t){}handleChange(t,i){}}const UQ="editor.action.inlineSuggest.commit",KQ="editor.action.inlineSuggest.showPrevious",qQ="editor.action.inlineSuggest.showNext";class GQ extends Hi{constructor(t,i,e={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new ue),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=new Vi,this.options=e,this.lookupKeybindings="function"==typeof this.options.getKeyBinding,this.toggleMenuAction=this._register(new ZQ((()=>{var t;return null===(t=this.toggleMenuActionViewItem)||void 0===t?void 0:t.show()}),e.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",t.appendChild(this.element),this.actionBar=this._register(new kR(this.element,{orientation:e.orientation,ariaLabel:e.ariaLabel,actionRunner:e.actionRunner,allowContextMenu:e.allowContextMenu,actionViewItemProvider:(t,s)=>{var n;if(t.id===ZQ.ID)return this.toggleMenuActionViewItem=new tN(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:np.asClassNameArray(null!==(n=e.moreIcon)&&void 0!==n?n:Ss.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(e.actionViewItemProvider){const i=e.actionViewItemProvider(t,s);if(i)return i}if(t instanceof up){const e=new tN(t,t.actions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:t.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement});return e.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(e),this.disposables.add(this._onDidChangeDropdownVisibility.add(e.onDidChangeVisibility)),e}}}))}set actionRunner(t){this.actionBar.actionRunner=t}get actionRunner(){return this.actionBar.actionRunner}getElement(){return this.element}getItemAction(t){return this.actionBar.getAction(t)}setActions(t,i){this.clear();const e=t?t.slice(0):[];this.hasSecondaryActions=!!(i&&i.length>0),this.hasSecondaryActions&&i&&(this.toggleMenuAction.menuActions=i.slice(0),e.push(this.toggleMenuAction)),e.forEach((t=>{this.actionBar.push(t,{icon:!0,label:!1,keybinding:this.getKeybindingLabel(t)})}))}getKeybindingLabel(t){var i,e;const s=this.lookupKeybindings?null===(e=(i=this.options).getKeyBinding)||void 0===e?void 0:e.call(i,t):void 0;return Rt(null==s?void 0:s.getLabel())}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),super.dispose()}}class ZQ extends op{constructor(t,i){i=i||e(0,"More Actions..."),super(ZQ.ID,i,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=t}run(){return t=this,i=void 0,s=function*(){this.toggleDropdownMenu()},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}get menuActions(){return this._menuActions}set menuActions(t){this._menuActions=t}}ZQ.ID="toolbar.toggle.more";var JQ=function(t,i){return function(e,s){i(e,s,t)}};let QQ=class extends GQ{constructor(t,i,e,s,n,r,o){super(t,n,Object.assign(Object.assign({getKeyBinding:t=>{var i;return null!==(i=r.lookupKeybinding(t.id))&&void 0!==i?i:void 0}},i),{allowContextMenu:!0})),this._options=i,this._menuService=e,this._contextKeyService=s,this._contextMenuService=n,this._sessionDisposables=this._store.add(new Vi),(null==i?void 0:i.telemetrySource)&&this._store.add(this.actionBar.onDidRun((t=>o.publicLog2("workbenchActionExecuted",{id:t.action.id,from:i.telemetrySource}))))}setActions(t,i=[],s){var n,r,o;this._sessionDisposables.clear();const h=t.slice(),c=i.slice(),u=[];let l=0;const a=[];let d=!1;if(-1!==(null===(n=this._options)||void 0===n?void 0:n.hiddenItemStrategy))for(let t=0;t<h.length;t++){const i=h[t];(i instanceof xp||i instanceof Sp)&&i.hideActions&&(u.push(i.hideActions.toggle),i.hideActions.toggle.checked&&l++,i.hideActions.isHidden&&(d=!0,h[t]=void 0,0!==(null===(r=this._options)||void 0===r?void 0:r.hiddenItemStrategy)&&(a[t]=i)))}if(void 0!==(null===(o=this._options)||void 0===o?void 0:o.maxNumberOfItems)){let t=0;for(let i=0;i<h.length;i++){const e=h[i];e&&++t>=this._options.maxNumberOfItems&&(h[i]=void 0,a[i]=e)}}tt(h),tt(a),super.setActions(h,cp.join(a,c)),u.length>0&&this._sessionDisposables.add(Zf(this.getElement(),"contextmenu",(t=>{var i,n,r,o;const h=this.getItemAction(t.target);if(!h)return;t.preventDefault(),t.stopPropagation();let c,a=!1;if(1===l&&0===(null===(i=this._options)||void 0===i?void 0:i.hiddenItemStrategy)){a=!0;for(let t=0;t<u.length;t++)if(u[t].checked){u[t]=ap({id:h.id,label:h.label,checked:!0,enabled:!1,run(){}});break}}if(!a&&(h instanceof xp||h instanceof Sp)){if(!h.hideActions)return;c=h.hideActions.hide}else c=ap({id:"label",label:e(0,"Hide"),enabled:!1,run(){}});const f=cp.join([c],u);(null===(n=this._options)||void 0===n?void 0:n.resetMenu)&&!s&&(s=[this._options.resetMenu]),d&&s&&(f.push(new cp),f.push(ap({id:"resetThisMenu",label:e(0,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(s)}))),this._contextMenuService.showContextMenu({getAnchor:()=>t,getActions:()=>f,menuId:null===(r=this._options)||void 0===r?void 0:r.contextMenu,menuActionOptions:Object.assign({renderShortTitle:!0},null===(o=this._options)||void 0===o?void 0:o.menuOptions),contextKeyService:this._contextKeyService})})))}};QQ=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}([JQ(2,yp),JQ(3,Qo),JQ(4,zR),JQ(5,eP),JQ(6,Ap)],QQ);var YQ=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},XQ=function(t,i){return function(e,s){i(e,s,t)}};let tY=class extends Hi{constructor(t,i,e){var s;super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=jQ(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(60).showToolbar)),this.sessionPosition=void 0,this.position=_Q("position",(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((s=(i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(sY,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(Wi((()=>t.removeContentWidget(n)))),e.add(PQ("request explicit",(t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Ds.Explicit&&s.triggerExplicitly()})))},function(t,i){const e=new Vi,s=PQ(i,(i=>{e.clear(),t(i,e)}));return Wi((()=>{s.dispose(),e.dispose()}))}(s,"setup content widget")))}};tY=YQ([XQ(2,eo)],tY);const iY=SR("inline-suggestion-hints-next",Ss.chevronRight,e(0,"Icon for show next parameter hint.")),eY=SR("inline-suggestion-hints-previous",Ss.chevronLeft,e(0,"Icon for show previous parameter hint."));let sY=class t extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,s){const n=new op(t,i,s,!0,(()=>this._commandService.executeCommand(t))),r=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let o=i;return r&&(o=e(0,"{0} ({1})",i,r.getLabel())),n.tooltip=o,n}constructor(i,s,n,r,o,h,c,u,l,a,d){super(),this.editor=i,this.withBorder=s,this._position=n,this._currentSuggestionIdx=r,this._suggestionCount=o,this._extraCommands=h,this._commandService=c,this.keybindingService=l,this._contextKeyService=a,this._menuService=d,this.id="InlineSuggestionHintsContentWidget"+t.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Ug("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Ug("div",{style:{display:"flex"}},[Ug("div@actionBar",{className:"custom-actions"}),Ug("div@toolBar")])]),this.previousAction=this.createCommandAction(KQ,e(0,"Previous"),np.asClassName(eY)),this.availableSuggestionCountAction=new op("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(qQ,e(0,"Next"),np.asClassName(iY)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(bp.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new lu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new lu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[];const f=this._register(new kR(this.nodes.actionBar));f.push(this.previousAction,{icon:!0,label:!1}),f.push(this.availableSuggestionCountAction),f.push(this.nextAction,{icon:!0,label:!1}),this.toolBar=this._register(u.createInstance(rY,this.nodes.toolBar,bp.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>t instanceof xp?u.createInstance(nY,t,void 0):void 0,telemetrySource:"InlineSuggestionToolbar"})),this._register(this.toolBar.onDidChangeDropdownVisibility((i=>{t._dropDownVisible=i}))),this._register(PQ("update position",(t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(PQ("counts",(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(PQ("extra commands",(t=>{const i=this._extraCommands.read(t);if(G(this.lastCommands,i))return;this.lastCommands=i;const e=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 xp&&e.push(t);e.length>0&&e.unshift(new cp),this.toolBar.setAdditionalSecondaryActions(e)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};sY._dropDownVisible=!1,sY.id=0,sY=YQ([XQ(6,dp),XQ(7,eo),XQ(8,eP),XQ(9,Qo),XQ(10,yp)],sY);class nY extends LN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Ug("div.keybinding").root;new dW(i,O,Object.assign({disableTitle:!0},aW)).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let rY=class extends QQ{constructor(t,i,e,s,n,r,o,h){super(t,Object.assign({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._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];EN(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),this.setActions(h,c)}setAdditionalSecondaryActions(t){G(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};rY=YQ([XQ(3,yp),XQ(4,Qo),XQ(5,zR),XQ(6,eP),XQ(7,Ap)],rY);var oY=function(t,i){return function(e,s){i(e,s,t)}};let hY=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Vi,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._hookEvents(),this._didChangeConfigurationHandler=this._editor.onDidChangeConfiguration((t=>{t.hasChanged(58)&&(this._unhookEvents(),this._hookEvents())}))}_hookEvents(){const t=this._editor.getOption(58);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,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._hideWidgets()))),this._toUnhook.add(this._editor.onDidScrollChange((t=>this._onEditorScrollChanged(t))))}_unhookEvents(){this._toUnhook.clear()}_onEditorScrollChanged(t){(t.scrollTopChanged||t.scrollLeftChanged)&&this._hideWidgets()}_onEditorMouseDown(t){this._isMouseDown=!0;const i=t.target;9!==i.type||i.detail!==AJ.ID?12===i.type&&i.detail===PJ.ID||(12!==i.type&&(this._hoverClicked=!1),this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i;(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_onEditorMouseMove(t){var i,e,s,n,r,o,h,c;const u=t.target;if((!this._isMouseDown||!this._hoverClicked)&&(!this._isHoverSticky||9!==u.type||u.detail!==AJ.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!==u.type||u.detail!==AJ.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible()))&&!(this._isHoverSticky&&12===u.type&&u.detail===PJ.ID||this._isHoverSticky&&(null===(o=this._contentWidget)||void 0===o?void 0:o.isVisibleFromKeyboard()))){if(this._isHoverEnabled)return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(h=this._glyphWidget)||void 0===h||h.hide()):2===u.type&&u.position?(null===(c=this._contentWidget)||void 0===c||c.hide(),this._glyphWidget||(this._glyphWidget=new PJ(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(u.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())||sY.dropDownVisible||(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(SJ,this._editor)),this._contentWidget}isColorPickerVisible(){var t;return(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible())||!1}showContentHover(t,i,e,s){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()}escape(){var t;null===(t=this._contentWidget)||void 0===t||t.escape()}isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible()}dispose(){var t,i;this._unhookEvents(),this._toUnhook.dispose(),this._didChangeConfigurationHandler.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};hY.ID="editor.contrib.hover",hY=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}([oY(1,eo),oY(2,W_),oY(3,hc),oY(4,eP)],hY),$p(hY.ID,hY,2),Np(class extends Tp{constructor(){super({id:"editor.action.showHover",label:e(0,"Show or Focus Hover"),description:{description:"Show or Focus Hover",args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if when triggered with the keyboard, the hover should take focus immediately.",type:"boolean",default:!1}}}}]},alias:"Show or Focus Hover",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=hY.get(i);if(!s)return;const n=i.getPosition(),r=new ws(n.lineNumber,n.column,n.lineNumber,n.column),o=2===i.getOption(2)||!!(null==e?void 0:e.focus);s.isHoverVisible()?s.focus():s.showContentHover(r,1,1,o)}}),Np(class extends Tp{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:e(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=hY.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new ws(s.lineNumber,s.column,s.lineNumber,s.column),r=LZ.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollUpHover",label:e(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:16,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollUp()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollDownHover",label:e(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:18,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollDown()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollLeftHover",label:e(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:15,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollLeft()}}),Np(class extends Tp{constructor(){super({id:"editor.action.scrollRightHover",label:e(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:17,weight:100}})}run(t,i){const e=hY.get(i);e&&e.scrollRight()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pageUpHover",label:e(0,"Page Up Hover"),alias:"Page Up Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=hY.get(i);e&&e.pageUp()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pageDownHover",label:e(0,"Page Down Hover"),alias:"Page Down Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=hY.get(i);e&&e.pageDown()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToTopHover",label:e(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=hY.get(i);e&&e.goToTop()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToBottomHover",label:e(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=hY.get(i);e&&e.goToBottom()}}),Np(class extends Tp{constructor(){super({id:"editor.action.escapeFocusHover",label:e(0,"Escape Focus Hover"),alias:"Escape Focus Hover",precondition:PC.hoverFocused,kbOpts:{kbExpr:PC.hoverFocused,primary:9,weight:100}})}run(t,i){const e=hY.get(i);e&&e.escape()}}),PZ.register(HJ),PZ.register(SQ),sk(((t,i)=>{const e=t.getColor(Pv);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 cY extends Hi{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=t.target;if(6!==i.type)return;if(!i.detail.injectedText)return;if(i.detail.injectedText.options.attachedData!==xq)return;if(!i.range)return;const e=this._editor.getContribution(hY.ID);if(e&&!e.isColorPickerVisible()){const t=new ws(i.range.startLineNumber,i.range.startColumn+1,i.range.endLineNumber,i.range.endColumn+1);e.showContentHover(t,1,0,!1)}}}cY.ID="editor.contrib.colorContribution",$p(cY.ID,cY,2),PZ.register(Vq);var uY=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},lY=function(t,i){return function(e,s){i(e,s,t)}},aY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let dY=class t extends Hi{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=PC.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=PC.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 fY(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(i){return i.getContribution(t.ID)}};dY.ID="editor.contrib.standaloneColorPickerController",dY=uY([lY(1,Qo),lY(2,Zc),lY(3,eP),lY(4,eo),lY(5,ka),lY(6,_c)],dY),$p(dY.ID,dY,1);let fY=class t extends Hi{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.body=document.createElement("div"),this._position=void 0,this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(zq,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().viewState.position;const u=this._editor.getSelection(),l=u?{startLineNumber:u.startLineNumber,startColumn:u.startColumn,endLineNumber:u.endLineNumber,endColumn:u.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},a=this._register(Ag(this.body));this._register(a.onDidBlur((()=>{this.hide()}))),this._register(a.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(l),this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return t.ID}getDomNode(){return this.body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(58).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()}_start(t){return aY(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new gY(i.result,i.foundInEditor))}))}_computeAsync(t){return aY(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;const i={range:t,color:{red:0,green:0,blue:0,alpha:1}},e=yield this._standaloneColorPickerParticipant.createColorHover(i,new dq(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 LJ(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 u=s.header;u.pickedColorNode.style.width=o+8+"px",u.originalColorNode.style.width=h+"px";const l=s.header.closeButton;null==l||l.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};fY.ID="editor.contrib.standaloneColorPickerWidget",fY=uY([lY(3,eo),lY(4,Zc),lY(5,eP),lY(6,ka),lY(7,_c)],fY);class gY{constructor(t,i){this.value=t,this.foundInEditor=i}}Np(class extends Tp{constructor(){super({id:"editor.action.hideColorPicker",label:e(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:PC.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=dY.get(i))||void 0===e||e.hide()}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:e(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:PC.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=dY.get(i))||void 0===e||e.insertColor()}}),Ep(class extends _p{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:e(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:e(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:bp.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=dY.get(i))||void 0===e||e.showOrFocus()}});class pY{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,u=t.endColumn,l=n.getLineContent(o),a=n.getLineContent(c);let d,f=l.lastIndexOf(i,h-1+i.length),g=a.indexOf(e,u-1-e.length);if(-1!==f&&-1!==g)if(o===c)l.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=l.substring(f+i.length),s=a.substring(0,g);(t.indexOf(e)>=0||s.indexOf(e)>=0)&&(f=-1,g=-1)}-1!==f&&-1!==g?(s&&f+i.length<l.length&&32===l.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===a.charCodeAt(g-1)&&(e=" "+e,g-=1),d=pY._createRemoveBlockCommentOperations(new ws(o,f+i.length+1,c,g+1),i,e)):(d=pY._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 ws.isEmpty(t)?s.push(WI.delete(new ws(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(WI.delete(new ws(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(WI.delete(new ws(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return ws.isEmpty(t)?n.push(WI.replace(new ws(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(WI.insert(new vs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(WI.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 bs(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 bs(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class mY{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,u=!0;c=0===t||1!==t;for(let h=0,l=s.length;h<l;h++){const l=s[h],a=n+h;if(a===n&&o){l.ignore=!0;continue}const d=e.getLineContent(a),f=Vn(d);if(-1!==f){if(u=!1,l.ignore=!1,l.commentStrOffset=f,c&&!pY._haystackHasNeedleAtOffset(d,l.commentStr,f)&&(0===t?c=!1:1===t||(l.ignore=!0)),c&&i){const t=f+l.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(l.commentStrLength+=1)}}else l.ignore=r,l.commentStrOffset=d.length}if(0===t&&u){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=mY._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:mY._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=mY._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(mY._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),ws.isEmpty(n[e].range)&&ws.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?pY._createRemoveBlockCommentOperations(new ws(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=Vn(i);-1===s&&(s=i.length),h=pY._createAddBlockCommentOperations(new ws(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=pY._createAddBlockCommentOperations(new ws(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 ws(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=mY._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 bs(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(WI.delete(new ws(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(WI.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=mY.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 u=0;for(n=0,r=i[h].commentStrOffset;u<o&&n<r;n++)u=mY.nextVisibleColumn(u,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=u>o?n-1:n}}}class vY extends Tp{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(_c);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(21),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>ws.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 mY(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}Np(class extends vY{constructor(){super(0,{id:"editor.action.commentLine",label:e(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"5_insert",title:e(0,"&&Toggle Line Comment"),order:1}})}}),Np(class extends vY{constructor(){super(1,{id:"editor.action.addCommentLine",label:e(0,"Add Line Comment"),alias:"Add Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2081),weight:100}})}}),Np(class extends vY{constructor(){super(2,{id:"editor.action.removeCommentLine",label:e(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2099),weight:100}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.blockComment",label:e(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"5_insert",title:e(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(_c);if(!i.hasModel())return;const s=i.getOption(21),n=[],r=i.getSelections();for(const t of r)n.push(new pY(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var wY=function(t,i){return function(e,s){i(e,s,t)}};let bY=class t{static get(i){return i.getContribution(t.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 Vi,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&&mg(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(22)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(22))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({x:t.event.posx-1,width:2,y:t.event.posy-1,height:2});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={x:t.event.posx-1,width:2,y:t.event.posy-1,height:2}),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(22))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?bp.SimpleEditorContext:bp.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 Sp){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new up(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new cp)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(58);if(this._editor.updateOptions({hover:{enabled:!1}}),!i){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),e=og(this._editor.getDomNode());i={x:e.left+t.left,y:e.top+t.top+t.height}}const s=this._editor.getOption(123)&&!x;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new vR(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new vR(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===DP)return;const i=this._editor.getOption(70);let s=0;const n=t=>({id:"menu-action-"+ ++s,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),r=(t,i,e,r,o)=>{if(!i)return n({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(e,t)},c=[];for(const t of o)c.push(n({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new up("menu-action-"+ ++s,t,i,void 0))(t,c)},o=[];o.push(n({label:e(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),o.push(new cp),o.push(n({label:e(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),o.push(r(e(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:e(0,"Proportional"),value:"proportional"},{label:e(0,"Fill"),value:"fill"},{label:e(0,"Fit"),value:"fit"}])),o.push(r(e(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:e(0,"Mouse Over"),value:"mouseover"},{label:e(0,"Always"),value:"always"}]));const h=this._editor.getOption(123)&&!x;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:h?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>o,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};bY.ID="editor.contrib.contextmenu",bY=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(1,zR),wY(2,HR),wY(3,Qo),wY(4,eP),wY(5,yp),wY(6,ic),wY(7,yP)],bY),$p(bY.ID,bY,2),Np(class extends Tp{constructor(){super({id:"editor.action.showContextMenu",label:e(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=bY.get(i))||void 0===e||e.showContextMenu()}});class yY{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 kY{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class CY extends Hi{static get(t){return t.getContribution(CY.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 yY(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new kY(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 kY(new yY(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 kY(new yY(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}}CY.ID="editor.contrib.cursorUndoRedoController",$p(CY.ID,CY,0),Np(class extends Tp{constructor(){super({id:"cursorUndo",label:e(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=CY.get(i))||void 0===s||s.cursorUndo()}}),Np(class extends Tp{constructor(){super({id:"cursorRedo",label:e(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=CY.get(i))||void 0===s||s.cursorRedo()}});class SY{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 ws(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 bs(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 bs(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 bs(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 bs(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 bs(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 xY(t){return b?t.altKey:t.ctrlKey}class DY extends Hi{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(33)&&!this._editor.getOption(20)&&(xY(t)&&(this._modifierPressed=!0),this._mouseDown&&xY(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(33)&&!this._editor.getOption(20)&&(xY(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===DY.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]}xY(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 bs(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new bs(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(xY(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(DY.ID,new SY(this._dragSelection,i,xY(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 ws(t.lineNumber,t.column,t.lineNumber,t.column),options:DY._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()}}DY.ID="editor.contrib.dragAndDrop",DY.TRIGGER_KEY_VALUE=b?6:5,DY._DECORATION_OPTIONS=sL.register({description:"dnd-target",className:"dnd-target"}),$p(DY.ID,DY,2);const EY=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}}();var AY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function LY(t){return{asString:()=>AY(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class MY{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 B.some(this,(([t,i])=>i.asFile()))&&i.push("files"),FY(OY(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 OY(t)}}function OY(t){return t.toLowerCase()}function FY(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 TY=Object.freeze({create:t=>st(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>TY.split(t).filter((t=>!t.startsWith("#")))});dc.add("workbench.contributions.dragAndDrop",new class{});class RY{constructor(){}static getInstance(){return RY.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}RY.INSTANCE=new RY;function _Y(t){const i=new MY;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,LY(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,IY(s))}}return i}function IY(t){const i=t.path?os.parse(t.path):void 0;return function(t,i,e){const s={id:EY(),name:t,uri:i,data:e};return{asString:()=>AY(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>{return i=this,e=void 0,n=function*(){return new Uint8Array(yield t.arrayBuffer())},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}))}const PY=Object.freeze(["CodeEditors","CodeFiles",IF.RESOURCES,IF.INTERNAL_URI_LIST]);function NY(t,i=!1){const e=_Y(t),s=e.get(IF.INTERNAL_URI_LIST);if(s)e.replace(fc.uriList,s);else if(i||!e.has(fc.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?os.file(e).toString():os.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(fc.uriList,LY(TY.create(i)))}for(const t of PY)e.delete(t);return e}const BY=sL.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class $Y extends Hi{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=Rg(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Rg("span.icon");this.domNode.append(i),i.classList.add(...np.asClassNameArray(Ss.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(64);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(64))&&e()}))),this._register(Zf(this.domNode,xg.CLICK,(()=>{this.delegate.cancel()})))}getId(){return $Y.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)}}$Y.baseId="editor.widget.inlineProgressWidget";let jY=class extends Hi{constructor(t,i,e){super(),this.id=t,this._editor=i,this._instantiationService=e,this._showDelay=500,this._showPromise=this._register(new zi),this._currentWidget=new zi,this._operationIdPool=0,this._currentDecorations=i.createDecorationsCollection()}showWhile(t,i,e){return s=this,n=void 0,o=function*(){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=ou((()=>{const s=ws.fromPositions(t);this._currentDecorations.set([{range:s,options:BY}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance($Y,this.id,this._editor,s,i,e))}),this._showDelay);try{return yield e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};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}([function(t,i){return function(e,s){i(e,s,t)}}(2,eo)],jY);var WY=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},VY=function(t,i){return function(e,s){i(e,s,t)}},HY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let zY=class t extends Hi{constructor(t,i,e,s,n,r,o,h,c,u){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(Wi((()=>this.visibleContext.reset()))),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Wi((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition((t=>{n.containsPosition(t.position)||this.dispose()}))),this._register(Qi.runAndSubscribe(u.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=Rg(".post-edit-widget"),this.button=this._register(new Zj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Zf(this.domNode,xg.CLICK,(()=>this.showSelector())))}getId(){return t.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=og(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>ap({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};zY.baseId="editor.widget.postEditWidget",zY=WY([VY(7,zR),VY(8,Qo),VY(9,eP)],zY);let UY=class extends Hi{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 zi),this._register(Qi.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}applyEditAndShowIfNeeded(t,i,e,s){var n,r;return HY(this,void 0,void 0,(function*(){const o=this._editor.getModel();if(!o||!t.length)return;const h=i.allEdits[i.activeEditIndex];if(!h)return;const c={edits:[...t.map((t=>new _I(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0}))),...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},u=t[0],l=o.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);let a,d;try{a=yield this._bulkEditService.apply(c,{editor:this._editor,token:s}),d=o.getDecorationRange(l[0])}finally{o.deltaDecorations(l,[])}e&&a.isApplied&&i.allEdits.length>1&&this.show(null!=d?d:u,i,(n=>HY(this,void 0,void 0,(function*(){const r=this._editor.getModel();r&&(yield 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(zY,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()}};UY=WY([VY(4,eo),VY(5,TI)],UY);var KY=function(t,i){return function(e,s){i(e,s,t)}},qY=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const GY="editor.changePasteType",ZY=new Jo("pasteWidgetVisible",!1,e(0,"Whether the paste widget is showing")),JY="application/vnd.code.copyMetadata";let QY=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,s,n,r,o,h){super(),this._bulkEditService=s,this._clipboardService=n,this._languageFeaturesService=r,this._quickInputService=o,this._progressService=h,this._editor=t;const c=t.getContainerDomNode();this._register(Zf(c,"copy",(t=>this.handleCopy(t)))),this._register(Zf(c,"cut",(t=>this.handleCopy(t)))),this._register(Zf(c,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new jY("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(UY,"pasteIntoEditor",t,ZY,{id:GY,label:e(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},document.execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(82).enabled&&!this._editor.getOption(88)}handleCopy(t){var i,e;if(!t.clipboardData||!this._editor.hasTextFocus()||!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(35);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new ws(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const c=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,w),u={multicursorText:Array.isArray(c)?c:null,pasteOnNewLine:h,mode:null},l=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!l.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:u});const a=_Y(t.clipboardData),d=l.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),f=EY();this.setCopyMetadata(t.clipboardData,{id:f,providerCopyMimeTypes:d,defaultPastePayload:u});const g=tu((t=>qY(this,void 0,void 0,(function*(){const i=X(yield Promise.all(l.map((i=>qY(this,void 0,void 0,(function*(){try{return yield i.prepareDocumentPaste(s,o,a,t)}catch(t){return void console.error(t)}}))))));i.reverse();for(const t of i)for(const[i,e]of t)a.replace(i,e);return a}))));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:f,dataTransferPromise:g}}handlePaste(t){var i,e;return qY(this,void 0,void 0,(function*(){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.clipboardData),o=NY(t.clipboardData);o.delete(JY);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],fc.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>{return i=h,FY(OY(t),i.map(OY));var i}))}));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,s,n){const r=tu((e=>qY(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new UH(o,3,void 0,e);try{if(yield this.mergeInDataFromCopy(s,n,c.token),c.token.isCancellationRequested)return;const e=t.filter((t=>YY(t,s)));if(!e.length||1===e.length&&"text"===e[0].id)return void(yield this.applyDefaultPasteHandler(s,n,c.token));const u=yield this.getPasteEdits(e,s,h,i,c.token);if(c.token.isCancellationRequested)return;if(u.length){const t="afterPaste"===o.getOption(82).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:u},t,c.token)}yield this.applyDefaultPasteHandler(s,n,c.token)}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}))));this._pasteProgressManager.showWhile(i[0].getEndPosition(),e(0,"Running paste handlers. Click to cancel"),r),this._currentPasteOperation=r}showPasteAsPick(t,i,s,n,r){const o=tu((h=>qY(this,void 0,void 0,(function*(){const c=this._editor;if(!c.hasModel())return;const u=c.getModel(),l=new UH(c,3,void 0,h);try{if(yield this.mergeInDataFromCopy(n,r,l.token),l.token.isCancellationRequested)return;const h=i.filter((t=>YY(t,n))),c=yield this.getPasteEdits(h,n,u,s,l.token);if(l.token.isCancellationRequested)return;if(!c.length)return;let a;if("string"==typeof t)a=c.find((i=>i.id===t));else{const t=yield this._quickInputService.pick(c.map((t=>({label:t.label,description:t.id,detail:t.detail,edit:t}))),{placeHolder:e(0,"Select Paste Action")});a=null==t?void 0:t.edit}if(!a)return;const d=function(t,i,e){var s,n;return{edits:[...i.map((i=>new _I(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:[]]}}(u.uri,s,a);yield this._bulkEditService.apply(d,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===o&&(this._currentPasteOperation=void 0)}}))));this._progressService.withProgress({location:10,title:e(0,"Running paste handlers")},(()=>o))}setCopyMetadata(t,i){t.setData(JY,JSON.stringify(i))}fetchCopyMetadata(t){const i=t.getData(JY);if(i)try{return JSON.parse(i)}catch(t){return}}mergeInDataFromCopy(t,i,e){var s;return qY(this,void 0,void 0,(function*(){if((null==i?void 0:i.id)&&(null===(s=this._currentCopyOperation)||void 0===s?void 0:s.handle)===i.id){const i=yield this._currentCopyOperation.dataTransferPromise;if(e.isCancellationRequested)return;for(const[e,s]of i)t.replace(e,s)}if(!t.has(fc.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(fc.uriList,LY(TY.create(i)))}}))}getPasteEdits(t,i,e,s,n){return qY(this,void 0,void 0,(function*(){const r=yield iu(Promise.all(t.map((t=>{var r;try{return null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n)}catch(t){return void console.error(t)}}))).then(X),n);return null==r||r.sort(((t,i)=>i.priority-t.priority)),null!=r?r:[]}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return qY(this,void 0,void 0,(function*(){const o=null!==(s=t.get(fc.text))&&void 0!==s?s:t.get("text");if(!o)return;const h=yield 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 YY(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}QY.ID="editor.contrib.copyPasteActionController",QY=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}([KY(1,eo),KY(2,TI),KY(3,VR),KY(4,ka),KY(5,Kj),KY(6,UR)],QY);var XY=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},tX=function(t,i){return function(e,s){i(e,s,t)}},iX=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const eX=e(0,"Built-in");class sX{provideDocumentPasteEdits(t,i,e,s){return iX(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{id:this.id,insertText:t.insertText,label:t.label,detail:t.detail,priority:t.priority}:void 0}))}provideDocumentOnDropEdits(t,i,e,s){return iX(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{id:this.id,insertText:t.insertText,label:t.label,priority:t.priority}:void 0}))}}class nX extends sX{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[fc.text],this.pasteMimeTypes=[fc.text]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const i=t.get(fc.text);if(!i)return;if(t.has(fc.uriList))return;const s=yield i.asString();return{id:this.id,priority:0,label:e(0,"Insert Plain Text"),detail:eX,insertText:s}}))}}class rX extends sX{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[fc.uriList],this.pasteMimeTypes=[fc.uriList]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const s=yield hX(t);if(!s.length||i.isCancellationRequested)return;let n=0;const r=s.map((({uri:t,originalText:i})=>t.scheme===Wf.file?t.fsPath:(n++,i))).join(" ");let o;return o=e(0,n>0?s.length>1?"Insert Uris":"Insert Uri":s.length>1?"Insert Paths":"Insert Path"),{id:this.id,priority:0,insertText:r,label:o,detail:eX}}))}}let oX=class extends sX{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[fc.uriList],this.pasteMimeTypes=[fc.uriList]}getEdit(t,i){return iX(this,void 0,void 0,(function*(){const s=yield hX(t);if(!s.length||i.isCancellationRequested)return;const n=X(s.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?iE(i.uri,t):void 0})));return n.length?{id:this.id,priority:0,insertText:n.join(" "),label:e(0,s.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:eX}:void 0}))}};function hX(t){return iX(this,void 0,void 0,(function*(){const i=t.get(fc.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of TY.parse(e))try{s.push({uri:os.parse(t),originalText:t})}catch(t){}return s}))}oX=XY([tX(0,yP)],oX);let cX=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new nX)),this._register(t.documentOnDropEditProvider.register("*",new rX)),this._register(t.documentOnDropEditProvider.register("*",new oX(i)))}};cX=XY([tX(0,ka),tX(1,yP)],cX);let uX=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new nX)),this._register(t.documentPasteEditProvider.register("*",new rX)),this._register(t.documentPasteEditProvider.register("*",new oX(i)))}};uX=XY([tX(0,ka),tX(1,yP)],uX),$p(QY.ID,QY,0),ZV(uX),Pp(new class extends Fp{constructor(){super({id:GY,precondition:ZY,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=QY.get(i))||void 0===s?void 0:s.changePasteType()}}),Np(class extends Tp{constructor(){super({id:"editor.action.pasteAs",label:e(0,"Paste As..."),alias:"Paste As...",precondition:void 0,description:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:e(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=QY.get(i))||void 0===s?void 0:s.pasteAs(n)}});class lX{constructor(t){this.identifier=t}}const aX=no("treeViewsDndService");lc(aX,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 dX=function(t,i){return function(e,s){i(e,s,t)}},fX=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const gX="editor.changeDropType",pX=new Jo("dropWidgetVisible",!1,e(0,"Whether the drop widget is showing"));let mX=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,s,n){super(),this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=RY.getInstance(),this._dropProgressManager=this._register(i.createInstance(jY,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(UY,"dropIntoEditor",t,pX,{id:gX,label:e(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}onDropIntoEditor(t,i,s){var n;return fX(this,void 0,void 0,(function*(){if(!s.dataTransfer||!t.hasModel())return;null===(n=this._currentOperation)||void 0===n||n.cancel(),t.focus(),t.setPosition(i);const r=tu((e=>fX(this,void 0,void 0,(function*(){const n=new UH(t,1,void 0,e);try{const o=yield this.extractDataTransferData(s);if(0===o.size||n.token.isCancellationRequested)return;const h=t.getModel();if(!h)return;const c=this._languageFeaturesService.documentOnDropEditProvider.ordered(h).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>o.matches(t))))),u=yield this.getDropEdits(c,h,i,o,n);if(n.token.isCancellationRequested)return;if(u.length){const s="afterDrop"===t.getOption(34).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ws.fromPositions(i)],{activeEditIndex:0,allEdits:u},s,e)}}finally{n.dispose(),this._currentOperation===r&&(this._currentOperation=void 0)}}))));this._dropProgressManager.showWhile(i,e(0,"Running drop handlers. Click to cancel"),r),this._currentOperation=r}))}getDropEdits(t,i,e,s,n){return fX(this,void 0,void 0,(function*(){const r=yield iu(Promise.all(t.map((t=>t.provideDocumentOnDropEdits(i,e,s,n.token)))),n.token),o=X(null!=r?r:[]);return o.sort(((t,i)=>i.priority-t.priority)),o}))}extractDataTransferData(t){return fX(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new MY;const i=NY(t.dataTransfer);if(this.treeItemsTransfer.hasData(lX.prototype)){const t=this.treeItemsTransfer.getData(lX.prototype);if(Array.isArray(t))for(const e of t){const t=yield this._treeViewsDragAndDropService.removeDragOperationTransfer(e.identifier);if(t)for(const[e,s]of t)i.replace(e,s)}}return i}))}};mX.ID="editor.contrib.dropIntoEditorController",mX=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(1,eo),dX(2,ka),dX(3,aX)],mX),$p(mX.ID,mX,2),Pp(new class extends Fp{constructor(){super({id:gX,precondition:pX,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=mX.get(i))||void 0===s||s.changeDropType()}}),ZV(cX);class vX{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===vX._FIND_MATCH_DECORATION||i===vX._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,vX._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,vX._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 ws(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,vX._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=vX._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=vX._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 ws(o,1,h,1),options:vX._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ws(o,1,h,1),options:vX._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,vX._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}}vX._CURRENT_FIND_MATCH_DECORATION=sL.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:Xy(Qw),position:uh.Center},minimap:{color:Xy(Xw),position:ah.Inline}}),vX._FIND_MATCH_DECORATION=sL.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:Xy(Qw),position:uh.Center},minimap:{color:Xy(Xw),position:ah.Inline}}),vX._FIND_MATCH_NO_OVERVIEW_DECORATION=sL.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),vX._FIND_MATCH_ONLY_OVERVIEW_DECORATION=sL.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:Xy(Qw),position:uh.Center}}),vX._RANGE_HIGHLIGHT_DECORATION=sL.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),vX._FIND_SCOPE_DECORATION=sL.register({description:"find-scope",className:"findScope",isWholeLine:!0});class wX{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)=>ws.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 bX(t,i){if(t&&""!==t[0]){const e=yX(t,i,"-"),s=yX(t,i,"_");return e&&!s?kX(t,i,"-"):!e&&s?kX(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 yX(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function kX(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=bX([n[i]],t)+e})),r.slice(0,-1)}class CX{constructor(t){this.staticValue=t,this.kind=0}}class SX{constructor(t){this.pieces=t,this.kind=1}}class xX{static fromStaticValue(t){return new xX([DX.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 CX(t[0].staticValue):new SX(t):new CX("")}buildReplaceString(t,i){if(0===this._state.kind)return i?bX(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=xX._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 DX{static staticValue(t){return new DX(t,-1,null)}static caseOps(t,i){return new DX(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class EX{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++]=DX.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=DX.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=DX.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new xX(this._result)}}const AX=new Jo("findWidgetVisible",!1);AX.toNegated();const LX=new Jo("findInputFocussed",!1),MX=new Jo("replaceInputFocussed",!1),OX={primary:545,mac:{primary:2593}},FX={primary:565,mac:{primary:2613}},TX={primary:560,mac:{primary:2608}},RX={primary:554,mac:{primary:2602}},_X={primary:558,mac:{primary:2606}},IX="editor.action.nextMatchFindAction",PX="editor.action.previousMatchFindAction",NX="closeFindWidget",BX="toggleFindCaseSensitive",$X="toggleFindWholeWord",jX="toggleFindRegex",WX="toggleFindInSelection",VX="togglePreserveCase",HX="editor.action.replaceOne",zX="editor.action.replaceAll",UX=19999;class KX{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new cu,this._decorations=new vX(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new lu((()=>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,$i(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 ws(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,UX);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=J(s.map((t=>t.range)),(t=>ws.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(39).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()<UX){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=KX._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(126):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(126):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()<UX){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=KX._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 u=new vs(o,h),l=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):null,i);return e&&l&&l.range.isEmpty()&&l.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),l=c.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):null,i)),l?s||r.containsRange(l.range)?l:this._getNextMatch(l.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 xX(null);const i=[],e=new EX(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):xX.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 hC(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=>KX._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(126):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=UX?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new ul(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(126):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 aC(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 wX(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 bs(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 qX extends gy{constructor(t,i,e){super(),this._hideSoon=this._register(new lu((()=>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:lm(Em),inputActiveOptionForeground:lm(Lm),inputActiveOptionBackground:lm(Am)};this.caseSensitive=this._register(new LB(Object.assign({appendTitle:this._keybindingLabelFor(BX),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 MB(Object.assign({appendTitle:this._keybindingLabelFor($X),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 OB(Object.assign({appendTitle:this._keybindingLabelFor(jX),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(Zf(this._domNode,xg.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Zf(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 qX.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 GX(t,i){return 1===t||2!==t&&i}qX.ID="editor.contrib.findOptionsWidget";class ZX extends Hi{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return GX(this._isRegexOverride,this._isRegex)}get wholeWord(){return GX(this._wholeWordOverride,this._wholeWord)}get matchCase(){return GX(this._matchCaseOverride,this._matchCase)}get preserveCase(){return GX(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 ee),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&&(ws.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,u=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=>!ws.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),u!==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>=UX}}function JX(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())}const QX=SR("find-selection",Ss.selection,e(0,"Icon for 'Find in Selection' in the editor find widget.")),YX=SR("find-collapsed",Ss.chevronRight,e(0,"Icon to indicate that the editor find widget is collapsed.")),XX=SR("find-expanded",Ss.chevronDown,e(0,"Icon to indicate that the editor find widget is expanded.")),t0=SR("find-replace",Ss.replace,e(0,"Icon for 'Replace' in the editor find widget.")),i0=SR("find-replace-all",Ss.replaceAll,e(0,"Icon for 'Replace All' in the editor find widget.")),e0=SR("find-previous-match",Ss.arrowUp,e(0,"Icon for 'Find Previous' in the editor find widget.")),s0=SR("find-next-match",Ss.arrowDown,e(0,"Icon for 'Find Next' in the editor find widget.")),n0=e(0,"Find"),r0=e(0,"Find"),o0=e(0,"Previous Match"),h0=e(0,"Next Match"),c0=e(0,"Find in Selection"),u0=e(0,"Close"),l0=e(0,"Replace"),a0=e(0,"Replace"),d0=e(0,"Replace"),f0=e(0,"Replace All"),g0=e(0,"Toggle Replace"),p0=e(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",UX),m0=e(0,"{0} of {1}"),v0=e(0,"No results"),w0=419;let b0=69;const y0="ctrlEnterReplaceAll.windows.donotask",k0=b?256:2048;class C0{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function S0(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function x0(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class D0 extends gy{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(y0,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new su(500),this._register(Wi((()=>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(88)&&(this._codeEditor.getOption(88)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(140)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(39)){const t=this._codeEditor.getOption(39).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(39).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new C0(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>{return t=this,i=void 0,s=function*(){if(this._isVisible){const t=yield this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}))),this._findInputFocused=LX.bindTo(r),this._findFocusTracker=this._register(Ag(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=MX.bindTo(r),this._replaceFocusTracker=this._register(Ag(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(39).addExtraSpaceOnTop&&(this._viewZone=new C0(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 D0.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(88)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=hg(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,Ei)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){let t;if(this._matchesCount.style.minWidth=b0+"px",this._matchesCount.title=this._state.matchesCount>=UX?p0:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=UX&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Rn(m0,e,i)}else t=v0;this._matchesCount.appendChild(document.createTextNode(t)),Yg(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),b0=Math.max(b0,this._matchesCount.clientWidth)}_getAriaLabel(t,i,s){if(t===v0)return""===s?e(0,"{0} found",t):e(0,"{0} found for '{1}'",t,s);if(i){const n=e(0,"{0} found for '{1}', at {2}",t,s,i.startLineNumber+":"+i.startColumn),r=this._codeEditor.getModel();return r&&i.startLineNumber<=r.getLineCount()&&i.startLineNumber>=1?`${r.getLineContent(i.startLineNumber)}, ${n}`:n}return e(0,"{0} found for '{1}'",t,s)}_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(88);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(39).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(39).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=og(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=rg(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(39).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(39).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new C0(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(81).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(!qf(this._domNode))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&&hg(this._domNode)>w0)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=hg(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-b0>=i&&(r=!0),447+e-b0>=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=hg(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||ws.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|k0)?(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)?S0(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?x0(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|k0)?(this._keybindingService.dispatchEvent(t,t.target)||(w&&k&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(e(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(y0,!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)?S0(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?x0(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 cJ(null,this._contextViewProvider,{width:221,label:n0,placeholder:r0,appendCaseSensitiveLabel:this._keybindingLabelFor(BX),appendWholeWordsLabel:this._keybindingLabelFor($X),appendRegexLabel:this._keybindingLabelFor(jX),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:()=>JX(this._keybindingService),inputBoxStyles:gN,toggleStyles:fN},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()}))),y&&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 E0({label:o0+this._keybindingLabelFor(PX),icon:e0,onTrigger:()=>{Ot(this._codeEditor.getAction(PX)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new E0({label:h0+this._keybindingLabelFor(IX),icon:s0,onTrigger:()=>{Ot(this._codeEditor.getAction(IX)).run().then(void 0,Ei)}}));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 xB({icon:QX,title:c0+this._keybindingLabelFor(WX),isChecked:!1,inputActiveOptionBackground:lm(Am),inputActiveOptionBorder:lm(Em),inputActiveOptionForeground:lm(Lm)})),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 E0({label:u0+this._keybindingLabelFor(NX),icon:LR,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())}})),i.appendChild(this._closeBtn.domNode),this._replaceInput=this._register(new uJ(null,void 0,{label:l0,placeholder:a0,appendPreserveCaseLabel:this._keybindingLabelFor(VX),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>JX(this._keybindingService),inputBoxStyles:gN,toggleStyles:fN},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 E0({label:d0+this._keybindingLabelFor(HX),icon:t0,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new E0({label:f0+this._keybindingLabelFor(zX),icon:i0,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 E0({label:g0,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=hg(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.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(e),this._resizeSash=new EO(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=w0;this._register(this._resizeSash.onDidStart((()=>{n=hg(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<w0||i>(parseFloat(ig(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=hg(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=hg(this._domNode);if(t<w0)return;let i=w0;if(!this._resized||t===w0){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=hg(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}D0.ID="editor.contrib.findWidget";class E0 extends gy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+np.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(...np.asClassNameArray(YX)),this._domNode.classList.add(...np.asClassNameArray(XX))):(this._domNode.classList.remove(...np.asClassNameArray(XX)),this._domNode.classList.add(...np.asClassNameArray(YX)))}}sk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(Ov)),e(".currentFindMatch",t.getColor(Mv)),e(".findScope",t.getColor(Fv)),e(".find-widget",t.getColor(dv));const s=t.getColor(km);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(Cm);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(Rv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${Hb(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Tv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(_v);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${Hb(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(wm);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const u=t.getColor(fv);u&&i.addRule(`.monaco-editor .find-widget { color: ${u}; }`);const l=t.getColor(pm);l&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${l}; }`);const a=t.getColor(pv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(gv);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(Bw);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(vm);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var 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},L0=function(t,i){return function(e,s){i(e,s,t)}},M0=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function O0(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 F0=class t extends Hi{get editor(){return this._editor}static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s){super(),this._editor=t,this._findWidgetVisible=AX.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._updateHistoryDelayer=new su(500),this._state=this._register(new ZX),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(39).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!!LX.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=In(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}_start(t,i){return M0(this,void 0,void 0,(function*(){if(this.disposeModel(),!this._editor.hasModel())return;const e=Object.assign(Object.assign({},i),{isRevealed:!0});if("single"===t.seedSearchStringFromSelection){const i=O0(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?In(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=O0(this._editor,t.seedSearchStringFromSelection);i&&(e.searchString=i)}if(!e.searchString&&t.seedSearchStringFromGlobalClipboard){const t=yield 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 KX(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(){return!!this._model&&(this._model.replaceAll(),!0)}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}getGlobalBufferTerm(){return M0(this,void 0,void 0,(function*(){return this._editor.getOption(39).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}))}setGlobalBufferTerm(t){this._editor.getOption(39).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};F0.ID="editor.contrib.findController",F0=A0([L0(1,Qo),L0(2,hN),L0(3,VR)],F0);let T0=class extends F0{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._notificationService=r,this._widget=null,this._findOptionsWidget=null}_start(t,i){const e=Object.create(null,{_start:{get:()=>super._start}});return M0(this,void 0,void 0,(function*(){this._widget||this._createFindWidget();const s=this._editor.getSelection();let n=!1;switch(this._editor.getOption(39).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":n=!!s&&s.startLineNumber!==s.endLineNumber}t.updateSearchScope=t.updateSearchScope||n,yield e._start.call(this,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 D0(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new qX(this._editor,this._state,this._keybindingService))}};T0=A0([L0(1,HR),L0(2,Qo),L0(3,eP),L0(4,Yy),L0(5,IM),L0(6,hN),L0(7,VR)],T0),Bp(new Rp({id:"actions.find",label:e(0,"Find"),alias:"Find",precondition:Oo.or(PC.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"3_find",title:e(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=F0.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(39).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop})}));const R0={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:e(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:e(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:e(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:e(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 _0 extends Tp{run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);t&&!this._run(t)&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),this._run(t))}))}}class I0 extends Tp{run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);if(!t)return;const e=O0(i,"single",!1);e&&t.setSearchString(e),this._run(t)||(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),this._run(t))}))}}Bp(new Rp({id:"editor.action.startFindReplaceAction",label:e(0,"Replace"),alias:"Replace",precondition:Oo.or(PC.focus,Oo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:bp.MenubarEditMenu,group:"3_find",title:e(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(88))return!1;const e=F0.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(39).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(39).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop})})),$p(F0.ID,T0,0),Np(class extends Tp{constructor(){super({id:"editor.actions.findWithArgs",label:e(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:R0})}run(t,i,e){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);if(t){const s=e?{searchString:e.searchString,replaceString:e.replaceString,isReplaceRevealed:void 0!==e.replaceString,isRegex:e.isRegex,wholeWord:e.matchWholeWord,matchCase:e.isCaseSensitive,preserveCase:e.preserveCase}:{};yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(39).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(39).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(39).loop},s),t.setGlobalBufferTerm(t.getState().searchString)}}))}}),Np(class extends Tp{constructor(){super({id:"actions.findWithSelection",label:e(0,"Find With Selection"),alias:"Find With Selection",precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}run(t,i){return M0(this,void 0,void 0,(function*(){const t=F0.get(i);t&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(39).loop}),t.setGlobalBufferTerm(t.getState().searchString))}))}}),Np(class extends _0{constructor(){super({id:IX,label:e(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:PC.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Oo.and(PC.focus,LX),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),Np(class extends _0{constructor(){super({id:PX,label:e(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:PC.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Oo.and(PC.focus,LX),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),Np(class extends Tp{constructor(){super({id:"editor.action.goToMatchFindAction",label:e(0,"Go to Match..."),alias:"Go to Match...",precondition:AX}),this._highlightDecorations=[]}run(t,i,s){const n=F0.get(i);if(!n)return;const r=n.getState().matchesCount;if(r<1)return void t.get(IM).notify({severity:_M.Warning,message:e(0,"No matches. Try searching for something else.")});const o=t.get(Kj).createInputBox();o.placeholder=e(0,"Type a number to go to a specific match (between 1 and {0})",r);const h=t=>{const i=parseInt(t);if(isNaN(i))return;const e=n.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},c=t=>{const s=h(t);if("number"==typeof s){o.validationMessage=void 0,n.goToMatch(s);const t=n.getState().currentMatch;t&&this.addDecorations(i,t)}else o.validationMessage=e(0,"Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(i)};o.onDidChangeValue((t=>{c(t)})),o.onDidAccept((()=>{const t=h(o.value);"number"==typeof t?(n.goToMatch(t),o.hide()):o.validationMessage=e(0,"Please type a number between 1 and {0}",n.getState().matchesCount)})),o.onDidHide((()=>{this.clearDecorations(i),o.dispose()})),o.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:Xy(bk),position:uh.Full}}}])}))}}),Np(class extends I0{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:e(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),Np(class extends I0{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:e(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const P0=Fp.bindToContribution(F0.get);Pp(new P0({id:NX,precondition:AX,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:9,secondary:[1033]}})),Pp(new P0({id:BX,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:PC.focus,primary:OX.primary,mac:OX.mac,win:OX.win,linux:OX.linux}})),Pp(new P0({id:$X,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:PC.focus,primary:FX.primary,mac:FX.mac,win:FX.win,linux:FX.linux}})),Pp(new P0({id:jX,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:PC.focus,primary:TX.primary,mac:TX.mac,win:TX.win,linux:TX.linux}})),Pp(new P0({id:WX,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:PC.focus,primary:RX.primary,mac:RX.mac,win:RX.win,linux:RX.linux}})),Pp(new P0({id:VX,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:PC.focus,primary:_X.primary,mac:_X.mac,win:_X.win,linux:_X.linux}})),Pp(new P0({id:HX,precondition:AX,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:PC.focus,primary:3094}})),Pp(new P0({id:HX,precondition:AX,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,MX),primary:3}})),Pp(new P0({id:zX,precondition:AX,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:PC.focus,primary:2563}})),Pp(new P0({id:zX,precondition:AX,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Oo.and(PC.focus,MX),primary:void 0,mac:{primary:2051}}})),Pp(new P0({id:"editor.action.selectAllMatches",precondition:AX,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:PC.focus,primary:515}}));const N0={0:" ",1:"u",2:"r"},B0=16777215,$0=4278190080;class j0{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 W0{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 j0(t.length),this._userDefinedStates=new j0(t.length),this._recoveredStates=new j0(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>B0||n>B0)throw new Error("startLineNumber or endLineNumber must not exceed "+B0);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]&B0}getEndLineNumber(t){return this._endIndexes[t]&B0}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 V0(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&$0)>>>24)+((this._endIndexes[t]&$0)>>>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]=`[${N0[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&B0,endLineNumber:this._endIndexes[t]&B0,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 W0(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),u=r(0);const l=[];let a,d=0;const f=[];for(;c||u;){let t;if(u&&(!c||c.startLineNumber>=u.startLineNumber))c&&c.startLineNumber===u.startLineNumber?(1===u.source?t=u:(t=c,t.isCollapsed=u.isCollapsed&&c.endLineNumber===u.endLineNumber,t.source=0),c=n(++o)):(t=u,u.isCollapsed&&0===u.source&&(t.source=2)),u=r(++h);else{let i=h,e=u;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(;a&&a.endLineNumber<t.startLineNumber;)a=l.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!a||a.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,a&&l.push(a),a=t)}}return f}}class V0{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 H0{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ee,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new W0(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(W0.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=W0.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(W0.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=W0.sanitizeAndMerge(this._regions,s,n);this.updatePost(W0.fromFoldRanges(r))}_getLinesChecksum(t,i){return Ru(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 z0(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 U0(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 K0(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 q0(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 G0(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 Z0{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ee,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!==Ex(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 ws(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!==J0(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=J0(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 J0(t,i){const e=J(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class Q0{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=X0){const n=t.getOptions().tabSize,r=new Y0(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=kS(s,n);let u,l=h[h.length-1];if(-1!==c){if(o&&(u=s.match(o))){if(!u[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,l=h[t],r.insertFirst(e,l.line,c),l.line=e,l.indent=c,l.endAbove=e;continue}}}if(l.indent>c){do{h.pop(),l=h[h.length-1]}while(l.indent>c);const t=l.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}l.indent===c?l.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(l.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class Y0{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>B0||i>B0)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 W0(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 u=this._startIndexes[h],l=kS(t.getLineContent(u),n);(l<s||l===s&&e++<i)&&(r[c]=u,o[c]=this._endIndexes[h],c++)}return new W0(r,o)}}}const X0={limit:5e3,update:()=>{}},t1=fm("editor.foldBackground",{light:ab(Dv,.3),dark:ab(Dv,.3),hcDark:null,hcLight:null},e(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);fm("editorGutter.foldingControlForeground",{dark:mm,light:mm,hcDark:mm,hcLight:mm},e(0,"Color of the folding control in the editor gutter."));const i1=SR("folding-expanded",Ss.chevronDown,e(0,"Icon for expanded ranges in the editor glyph margin.")),e1=SR("folding-collapsed",Ss.chevronRight,e(0,"Icon for collapsed ranges in the editor glyph margin.")),s1=SR("folding-manual-collapsed",e1,e(0,"Icon for manually collapsed ranges in the editor glyph margin.")),n1=SR("folding-manual-expanded",i1,e(0,"Icon for manually expanded ranges in the editor glyph margin.")),r1={color:Xy(t1),position:ah.Inline};class o1{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?o1.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?o1.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:o1.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:o1.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?o1.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:o1.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?o1.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:o1.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?o1.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:o1.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?o1.MANUALLY_EXPANDED_VISUAL_DECORATION:o1.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}o1.COLLAPSED_VISUAL_DECORATION=sL.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:np.asClassName(e1)}),o1.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=sL.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(e1)}),o1.MANUALLY_COLLAPSED_VISUAL_DECORATION=sL.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:np.asClassName(s1)}),o1.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=sL.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(s1)}),o1.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),o1.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:r1,isWholeLine:!0}),o1.EXPANDED_VISUAL_DECORATION=sL.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+np.asClassName(i1)}),o1.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=sL.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(i1)}),o1.MANUALLY_EXPANDED_VISUAL_DECORATION=sL.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+np.asClassName(n1)}),o1.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=sL.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:np.asClassName(n1)}),o1.NO_CONTROLS_EXPANDED_RANGE_DECORATION=sL.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),o1.HIDDEN_RANGE_DECORATION=sL.register({description:"folding-hidden-range-decoration",stickiness:1});const h1={};class c1{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 Vi,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,h1,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})}}),Ai)));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 u1(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 u1{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>B0||i>B0)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 W0(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 W0(s,n,r)}}}var l1=function(t,i){return function(e,s){i(e,s,t)}};const a1=new Jo("foldingEnabled",!1);let d1=class t extends Hi{static get(i){return i.getContribution(t.ID)}static getFoldingRangeProviders(i,e){var s,n;const r=i.foldingRangeProvider.ordered(e);return null!==(n=null===(s=t._foldingRangeSelector)||void 0===s?void 0:s.call(t,r,e))&&void 0!==n?n:r}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Vi),this.editor=t,this._foldingLimitReporter=new f1(t);const o=this.editor.getOptions();this._isEnabled=o.get(41),this._useFoldingProviders="indentation"!==o.get(42),this._unfoldOnClickAfterEndOfLine=o.get(46),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(44),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 o1(t),this.foldingDecorationProvider.showFoldingControls=o.get(106),this.foldingDecorationProvider.showFoldingHighlights=o.get(43),this.foldingEnabled=a1.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(41)&&(this._isEnabled=this.editor.getOptions().get(41),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(45)&&this.onModelChanged(),t.hasChanged(106)||t.hasChanged(43)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(106),this.foldingDecorationProvider.showFoldingHighlights=t.get(43),this.triggerFoldingModelChanged()}t.hasChanged(42)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(42),this.onFoldingStrategyChanged()),t.hasChanged(46)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(46)),t.hasChanged(44)&&(this._foldingImportsByDefault=this.editor.getOptions().get(44))}))),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 H0(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new Z0(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new su(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new lu((()=>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(i){if(this.rangeProvider)return this.rangeProvider;const e=new Q0(i,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=e,this._useFoldingProviders&&this.foldingModel){const s=t.getFoldingRangeProviders(this.languageFeaturesService,i);s.length>0&&(this.rangeProvider=new c1(i,s,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,e))}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 Ji(!0),e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=tu((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Ns.Imports.value,!0);t&&(s=_F.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=>(Ei(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,Ei)}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<5)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)}};d1.ID="editor.contrib.folding",d1=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}([l1(1,Qo),l1(2,_c),l1(3,IM),l1(4,z_),l1(5,ka)],d1);class f1{constructor(t){this.editor=t,this._onDidChange=new ee,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(45)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class g1 extends Tp{runEditorCommand(t,i,e){const s=t.get(_c),n=d1.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 p1(t){if(!Et(t)){if(!kt(t))return!1;const i=t;if(!Et(i.levels)&&!St(i.levels))return!1;if(!Et(i.direction)&&!yt(i.direction))return!1;if(!(Et(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(St)))return!1}return!0}class m1 extends g1{getFoldingLevel(){return parseInt(this.id.substr(m1.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))}}m1.ID_PREFIX="editor.foldLevel",m1.ID=t=>m1.ID_PREFIX+t,$p(d1.ID,d1,0),Np(class extends g1{constructor(){super({id:"editor.unfold",label:e(0,"Unfold"),alias:"Unfold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},description:{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:p1,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?U0(i,!1,n,r):z0(i,!1,n,r)}}),Np(class extends g1{constructor(){super({id:"editor.unfoldRecursively",label:e(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2142),weight:100}})}invoke(t,i,e,s){z0(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.fold",label:e(0,"Fold"),alias:"Fold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},description:{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:p1,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?U0(i,!0,r||1,n):z0(i,!0,r||1,n)}}),Np(class extends g1{constructor(){super({id:"editor.foldRecursively",label:e(0,"Fold Recursively"),alias:"Fold Recursively",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);z0(i,!0,Number.MAX_VALUE,s)}}),Np(class extends g1{constructor(){super({id:"editor.foldAll",label:e(0,"Fold All"),alias:"Fold All",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2069),weight:100}})}invoke(t,i,e){z0(i,!0)}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAll",label:e(0,"Unfold All"),alias:"Unfold All",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2088),weight:100}})}invoke(t,i,e){z0(i,!1)}}),Np(class extends g1{constructor(){super({id:"editor.foldAllBlockComments",label:e(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&q0(i,new RegExp("^\\s*"+In(s.blockCommentStartToken)),!0)}}}),Np(class extends g1{constructor(){super({id:"editor.foldAllMarkerRegions",label:e(0,"Fold All Regions"),alias:"Fold All Regions",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&q0(i,new RegExp(s.markers.start),!0)}}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:e(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())G0(i,Ns.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&q0(i,new RegExp(s.markers.start),!1)}}}),Np(class extends g1{constructor(){super({id:"editor.foldAllExcept",label:e(0,"Fold All Regions Except Selected"),alias:"Fold All Regions Except Selected",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2136),weight:100}})}invoke(t,i,e){K0(i,!0,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.unfoldAllExcept",label:e(0,"Unfold All Regions Except Selected"),alias:"Unfold All Regions Except Selected",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2134),weight:100}})}invoke(t,i,e){K0(i,!1,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.toggleFold",label:e(0,"Toggle Fold"),alias:"Toggle Fold",precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2090),weight:100}})}invoke(t,i,e){!function(t,i,e){const s=[];for(const i of e){const e=t.getRegionAtLine(i);if(e){s.push(e),0}}t.toggleCollapseState(s)}(i,0,this.getSelectedLines(e))}}),Np(class extends g1{constructor(){super({id:"editor.gotoParentFold",label:e(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.gotoPreviousFold",label:e(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.gotoNextFold",label:e(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:a1,kbOpts:{kbExpr:PC.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})}}}),Np(class extends g1{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:e(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:a1,kbOpts:{kbExpr:PC.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=W0.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(W0.fromFoldRanges(t))}}}}),Np(class extends g1{constructor(){super({id:"editor.removeManualFoldingRanges",label:e(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:a1,kbOpts:{kbExpr:PC.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++)v1=new m1({id:m1.ID(t),label:e(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:a1,kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2048|21+t),weight:100}}),Wp.INSTANCE.registerEditorAction(v1);var v1;fp.registerCommand("_executeFoldingRangeProvider",(function(t,...i){return e=this,s=void 0,r=function*(){const[e]=i;if(!(e instanceof os))throw Ti();const s=t.get(ka),n=t.get(Zc).getModel(e);if(!n)throw Ti();const r=t.get(ic);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(_c),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},u=new Q0(n,o,c);let l=u;if("indentation"!==h){const t=d1.getFoldingRangeProviders(s,n);t.length&&(l=new c1(n,t,(()=>{}),c,u))}const a=yield l.compute(fe.None),d=[];try{if(a)for(let t=0;t<a.length;t++){const i=a.getType(t);d.push({start:a.getStartLineNumber(t),end:a.getEndLineNumber(t),kind:i?Ns.fromValue(i):void 0})}return d}finally{l.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r})),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomIn",label:e(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Zr.setZoomLevel(Zr.getZoomLevel()+1)}}),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomOut",label:e(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Zr.setZoomLevel(Zr.getZoomLevel()-1)}}),Np(class extends Tp{constructor(){super({id:"editor.action.fontZoomReset",label:e(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Zr.setZoomLevel(0)}});var w1=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},b1=function(t,i){return function(e,s){i(e,s,t)}},y1=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let k1=class{constructor(t,i,e){this._editor=t,this._languageFeaturesService=i,this._workerService=e,this._disposables=new Vi,this._sessionDisposables=new Vi,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(54)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(54))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 tl;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()}));hz(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||et(t)&&(JH.execute(this._editor,t,!0),tz(t))})).finally((()=>{n.dispose()}))}};k1.ID="editor.contrib.autoFormat",k1=w1([b1(1,ka),b1(2,$R)],k1);let C1=class{constructor(t,i,e){this.editor=t,this._languageFeaturesService=i,this._instantiationService=e,this._callOnDispose=new Vi,this._callOnModel=new Vi,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(53)&&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(sz,this.editor,t,2,KR.None,fe.None).catch(Ei))}};C1.ID="editor.contrib.formatOnPaste",C1=w1([b1(1,ka),b1(2,eo)],C1),$p(k1.ID,k1,2),$p(C1.ID,C1,2),Np(class extends Tp{constructor(){super({id:"editor.action.formatDocument",label:e(0,"Format Document"),alias:"Format Document",precondition:Oo.and(PC.notInCompositeEditor,PC.writable,PC.hasDocumentFormattingProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return y1(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(eo),s=t.get(qR);yield s.showWhile(e.invokeFunction(rz,i,1,KR.None,fe.None),250)}}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.formatSelection",label:e(0,"Format Selection"),alias:"Format Selection",precondition:Oo.and(PC.writable,PC.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:Ae(2089,2084),weight:100},contextMenuOpts:{when:PC.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return y1(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(eo),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new ws(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(qR);yield r.showWhile(e.invokeFunction(sz,i,n,1,KR.None,fe.None),250)}))}}),fp.registerCommand("editor.action.format",(t=>y1(void 0,void 0,void 0,(function*(){const i=t.get(ro).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(dp);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var S1=function(t,i){return function(e,s){i(e,s,t)}};class x1{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 D1 extends x1{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class E1 extends x1{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class A1 extends x1{static create(t,i,e){const s=new pe(e),n=new A1(i.uri),r=t.ordered(i),o=r.map(((t,e)=>{var r;const o=x1.findId(`provider_${e}`,n),h=new E1(o,n,null!==(r=t.displayName)&&void 0!==r?r:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,s.token)).then((t=>{for(const i of t||[])A1._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{x1.empty(t)?t.remove():n._groups.set(o,t)}))})),h=t.onDidChange((()=>{G(t.ordered(i),r)||s.cancel()}));return Promise.all(o).then((()=>s.token.isCancellationRequested&&!e.isCancellationRequested?A1.create(t,i,e):n._compact())).finally((()=>{h.dispose()}))}static _makeOutlineElement(t,i){const e=x1.findId(t,i),s=new D1(e,i,t);if(t.children)for(const i of t.children)A1._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=B.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 D1?t.push(i.symbol):t.push(...B.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>ws.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return A1._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>vs.compare(ws.getStartPosition(t.range),ws.getStartPosition(i.range))||vs.compare(ws.getEndPosition(i.range),ws.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&&A1._flattenDocumentSymbols(t,s.children,s.name)}}const L1=no("IOutlineModelService");let M1=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new TO(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()}getOrCreate(t,i){return e=this,s=void 0,r=function*(){const e=this._languageFeaturesService.documentSymbolProvider,s=e.ordered(t);let n=this._cache.get(t.id);if(!n||n.versionId!==t.getVersionId()||!G(n.provider,s)){const i=new pe;n={versionId:t.getVersionId(),provider:s,promiseCnt:0,source:i,promise:A1.create(e,t,i.token),model:void 0},this._cache.set(t.id,n);const r=Date.now();n.promise.then((i=>{n.model=i,this._debounceInformation.update(t,Date.now()-r)})).catch((()=>{this._cache.delete(t.id)}))}if(n.model)return n.model;n.promiseCnt+=1;const r=i.onCancellationRequested((()=>{0==--n.promiseCnt&&(n.source.cancel(),this._cache.delete(t.id))}));try{return yield n.promise}finally{r.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}};M1=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(0,ka),S1(1,z_),S1(2,Zc)],M1),lc(L1,M1,1);fp.registerCommand("_executeDocumentSymbolProvider",(function(t,...i){return e=this,s=void 0,r=function*(){const[e]=i;Mt(os.isUri(e));const s=t.get(L1),n=t.get(ep),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,fe.None)).getTopLevelSymbols()}finally{r.dispose()}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}));class O1 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=O1.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=O1.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=O1.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=O1.suppressSuggestions.bindTo(this.contextKeyService),this._register(PQ("update context key: inlineCompletionVisible, suppressSuggestions",(t=>{const i=this.model.read(t),e=null==i?void 0:i.selectedInlineCompletion.read(t),s=null==i?void 0:i.ghostText.read(t),n=null==i?void 0:i.selectedSuggestItem.read(t);this.inlineCompletionVisible.set(void 0===n&&void 0!==s&&!s.isEmpty()),s&&e&&this.suppressSuggestions.set(e.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(PQ("update context key: inlineCompletionSuggestsIndentation, inlineCompletionSuggestsIndentationLessThanTabSize",(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=Vn(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=Xb.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}O1.inlineSuggestionVisible=new Jo("inlineSuggestionVisible",!1,e(0,"Whether an inline suggestion is visible")),O1.inlineSuggestionHasIndentation=new Jo("inlineSuggestionHasIndentation",!1,e(0,"Whether the inline suggestion starts with whitespace")),O1.inlineSuggestionHasIndentationLessThanTabSize=new Jo("inlineSuggestionHasIndentationLessThanTabSize",!0,e(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),O1.suppressSuggestions=new Jo("inlineSuggestionSuppressSuggestions",void 0,e(0,"Whether suggestions should be suppressed for the current suggestion"));class F1{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 T1=[];class R1{constructor(t,i){if(this.startColumn=t,this.endColumnExclusive=i,t>i)throw new Pi(`startColumn ${t} cannot be after endColumnExclusive ${i}`)}toRange(t){return new ws(t,this.startColumn,t,this.endColumnExclusive)}}function _1(t,i){return new vs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function I1(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new vs(i,e)}class P1{constructor(t,i){this.lineNumber=t,this.parts=i}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new F1(t),s=i.map((t=>{const i=ws.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 N1{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}}class B1{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new N1(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))}}let $1=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=OQ("isDisposed",!1),this.currentTextModel=jQ(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=_Q("uiState",(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 B1?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 Pa(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 Pa(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,u=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(u,t.column-1)],void 0),i.length>0&&(o(i,"ghost-text"),void 0===c&&t.column<=h.length&&(c=t.column)),u=t.column-1}void 0!==c&&o([h.substring(u)],void 0);const l=void 0!==c?new R1(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:l,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=_Q("decorations",(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:ws.fromPositions(new vs(i.lineNumber,t.column)),options:{description:"ghost-text",after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:dh.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new j1(this.editor,this.languageService.languageIdCodec,_Q("lines",(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(Wi((()=>{this.isDisposed.set(!0,void 0)}))),this._register(function(t,i){const e=new Vi,s=t.createDecorationsCollection();return e.add(PQ(`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}};$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}([function(t,i){return function(e,s){i(e,s,t)}}(2,hc)],$1);class j1 extends Hi{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){var s;super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=("editorOptionChanged",s=Qi.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(31)||t.hasChanged(113)||t.hasChanged(95)||t.hasChanged(90)||t.hasChanged(49)||t.hasChanged(48)||t.hasChanged(64))),new VQ("editorOptionChanged",s)),this._register(PQ("update view zone",(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(31),o=s.get(113),h=s.get(90),c=s.get(49),u=s.get(48),l=s.get(64),a=new Wh(1e4);a.appendString('<div class="suggest-preview-text">');for(let t=0,s=e.length;t<s;t++){const s=e[t],d=s.content;a.appendString('<div class="view-line'),a.appendString('" style="top:'),a.appendString(String(t*l)),a.appendString('px;width:1000000px;">');const f=fr(d),g=ar(d),p=_a.createEmpty(d,n);Ka(new Va(u.isMonospace&&!r,u.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,o,"none",h,c!==oi.OFF,null),a),a.appendString("</div>")}a.appendString("</div>"),Kr(t,u);const d=a.build(),f=W1?W1.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 W1=Lu("editorGhostText",{createHTML:t=>t});class V1{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=tr(s,this.text),r=_1(this.range.getStartPosition(),I1(s.substring(0,n))),o=this.text.substring(n),h=ws.fromPositions(r,this.range.getEndPosition());return new V1(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=Hn(r).length;if(n.range.startColumn-1<=o){const t=Hn(n.text).length,i=r.substring(n.range.startColumn-1,o),e=ws.fromPositions(n.range.getStartPosition().delta(0,i.length),n.range.getEndPosition()),s=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new V1(e,s)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==H1?void 0:H1.originalValue)===t&&(null==H1?void 0:H1.newValue)===i)return null==H1?void 0:H1.changes;{let e=U1(t,i,!0);if(e){const s=z1(e);if(s>0){const n=U1(t,i,!1);n&&z1(n)<s&&(e=n)}}return H1={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const u=n.range.startLineNumber,l=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 a=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,a)),h=n.text.substring(t.modifiedStart,o),c=n.text.substring(o,Math.max(t.modifiedStart,r));if(h.length>0){const t=Wn(h);l.push(new N1(s,t,!1))}if(c.length>0){const t=Wn(c);l.push(new N1(s,t,!0))}}return new P1(u,l)}}let H1;function z1(t){let i=0;for(const e of t)i+=e.originalLength;return i}function U1(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 Ku({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}class K1{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}}var q1=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class G1{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 Z1{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 J1{static from(t,i,e,s,n){let r,o,h=t.range?ws.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=Q1(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new ws(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=Q1(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new ws(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new GZ).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof $Z?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else ho();return new J1(r,t.command,h,r,o,t.additionalTextEdits||T1,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 J1(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 Q1(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 Jx,s=new gD(e,(t=>i.getLanguageConfiguration(t))),n=kD(new lD(new K1([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=Ix(e,i.openingBracket.length),i.child&&(t(i.child,e),e=Ix(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=Ix(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,Ix(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=Ix(e,s.length)}(n,0),r}(o,s);return h}var Y1=function(t,i){return function(e,s){i(e,s,t)}};let X1=class extends Hi{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 zi),this.inlineCompletions=TQ("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TQ("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new t2(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,u=(()=>{return s=this,n=void 0,l=function*(){var s;if((h||i.triggerKind===Ds.Automatic)&&(yield(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,u=yield function(t,i,e,s,n=fe.None,r){return q1(this,void 0,void 0,(function*(){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new ws(t.lineNumber,e.startColumn,t.lineNumber,s):ws.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=yield Promise.all(h.map((t=>q1(this,void 0,void 0,(function*(){try{const r=yield t.provideInlineCompletions(e,i,s,n);return{provider:t,completions:r}}catch(t){Ai(t)}return{provider:t,completions:void 0}}))))),u=new Map,l=[];for(const t of c){const i=t.completions;if(!i)continue;const s=new Z1(i,t.provider);l.push(s);for(const t of i.items){const i=J1.from(t,s,o,e,r);u.set(i.hash(),i)}}return new G1(Array.from(u.values()),new Set(u.keys()),l)}))}(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const l=new Date;this._debounceValue.update(this.textModel,l.getTime()-n.getTime());const a=new e2(u,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!u.has(i)&&a.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),EQ((t=>{o.set(a,t)})),!0},new((u=void 0)||(u=Promise))((function(t,i){function e(t){try{o(l.next(t))}catch(t){i(t)}}function r(t){try{o(l.throw(t))}catch(t){i(t)}}function o(i){var s;i.done?t(i.value):(s=i.value,s instanceof u?s:new u((function(t){t(s)}))).then(e,r)}o((l=l.apply(s,n||[])).next())}));var s,n,u,l})(),l=new i2(r,c,u);return this._updateOperation.value=l,u}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()}};X1=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}([Y1(3,ka),Y1(4,_c)],X1);class t2{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===Ds.Automatic||this.context.triggerKind===Ds.Explicit)&&this.versionId===t.versionId;var i,e}}class i2{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class e2{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=_Q("ranges",(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 s2(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[]),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 s2(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class s2{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 V1(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).toLowerCase(),r=s.text.toLowerCase(),o=Math.max(0,i.column-s.range.startColumn);let h=r.substring(0,o),c=r.substring(o),u=n.substring(0,o),l=n.substring(o);const a=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=a&&(u=u.trimStart(),0===u.length&&(l=l.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(u)&&!!NO(l,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 V1(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return n2(this._getUpdatedRange(t)).isBefore(n2(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 n2(t){return t.startLineNumber===t.endLineNumber?new vs(1,1+t.endColumn-t.startColumn):new vs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}function r2(t,i=w){return function(t,i=w){return!!i&&UD(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 o2{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 h2{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=Hn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof $Z&&(s=Hn(Wn(i.value).pop())),!0)));const n=tr(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 c2{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Qe(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Qe(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===Je(this._model.uri.fsPath)?"":this._labelService.getUriLabel(YD(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 u2{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=>!Fn(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let l2=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}};l2=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,_c)],l2);class a2{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 a2.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return a2.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return a2.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return a2.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)}}}a2.dayNames=[e(0,"Sunday"),e(0,"Monday"),e(0,"Tuesday"),e(0,"Wednesday"),e(0,"Thursday"),e(0,"Friday"),e(0,"Saturday")],a2.dayNamesShort=[e(0,"Sun"),e(0,"Mon"),e(0,"Tue"),e(0,"Wed"),e(0,"Thu"),e(0,"Fri"),e(0,"Sat")],a2.monthNames=[e(0,"January"),e(0,"February"),e(0,"March"),e(0,"April"),e(0,"May"),e(0,"June"),e(0,"July"),e(0,"August"),e(0,"September"),e(0,"October"),e(0,"November"),e(0,"December")],a2.monthNamesShort=[e(0,"Jan"),e(0,"Feb"),e(0,"Mar"),e(0,"Apr"),e(0,"May"),e(0,"Jun"),e(0,"Jul"),e(0,"Aug"),e(0,"Sep"),e(0,"Oct"),e(0,"Nov"),e(0,"Dec")];class d2{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:Qe(e)}:CP: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)||kP(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&os.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(kP(t))return Qe(t.uri.path);let i=Qe(t.configPath.path);return i.endsWith(xP)&&(i=i.substr(0,i.length-xP.length-1)),i}_resoveWorkspacePath(t){if(kP(t))return r2(t.uri.fsPath);const i=Qe(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?r2(e):"/"}}class f2{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?EY():void 0}}class g2{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=Y(i.placeholders,WZ.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=ws.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?g2._decor.inactiveFinal:g2._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(WI.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 bs(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?g2._decor.activeFinal:g2._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?g2._decor.activeFinal:g2._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?g2._decor.inactiveFinal:g2._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof WZ){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 VZ,!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=ws.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,g2._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=Y(this._snippet.placeholders,WZ.compareByIndex)}))}}g2._decor={active:sL.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:sL.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:sL.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:sL.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const p2={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let m2=class t{static adjustWhitespace(t,i,e,s,n){const r=Hn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof $Z)||i.parent instanceof VZ)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 $Z(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=bs.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(i,e,s,n,r,o,h,c,u){const l=[],a=[];if(!i.hasModel())return{edits:l,snippets:a};const d=i.getModel(),f=i.invokeWithinContext((t=>t.get(yP))),g=i.invokeWithinContext((t=>new c2(t.get(fP),d))),p=()=>h,m=d.getValueInRange(t.adjustSelection(d,i.getSelection(),s,0)),v=d.getValueInRange(t.adjustSelection(d,i.getSelection(),0,n)),w=d.getLineFirstNonWhitespaceColumn(i.getSelection().positionLineNumber),b=i.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>ws.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:h,idx:y}of b){let k=t.adjustSelection(d,h,s,0),C=t.adjustSelection(d,h,0,n);m!==d.getValueInRange(k)&&(k=h),v!==d.getValueInRange(C)&&(C=h);const S=h.setStartPosition(k.startLineNumber,k.startColumn).setEndPosition(C.endLineNumber,C.endColumn),x=(new GZ).parse(e,!0,r),D=S.getStartPosition(),E=t.adjustWhitespace(d,D,o||y>0&&w!==d.getLineFirstNonWhitespaceColumn(h.positionLineNumber),x);x.resolveVariables(new o2([g,new u2(p,y,b.length,"spread"===i.getOption(76)),new h2(d,h,y,c),new l2(d,h,u),new a2,new d2(f),new f2])),l[y]=WI.replace(S,x.toString()),l[y].identifier={major:y,minor:0},l[y]._isTracked=!0,a[y]=new g2(i,x,E)}return{edits:l,snippets:a}}static createEditsAndSnippetsFromEdits(i,e,s,n,r,o,h){if(!i.hasModel()||0===e.length)return{edits:[],snippets:[]};const c=[],u=i.getModel(),l=new GZ,a=new qZ,d=new o2([i.invokeWithinContext((t=>new c2(t.get(fP),u))),new u2((()=>r),0,i.getSelections().length,"spread"===i.getOption(76)),new h2(u,i.getSelection(),0,o),new l2(u,i.getSelection(),h),new a2,new d2(i.invokeWithinContext((t=>t.get(yP)))),new f2]);e=e.sort(((t,i)=>ws.compareRangesUsingStarts(t.range,i.range)));let f=0;for(let i=0;i<e.length;i++){const{range:s,template:n}=e[i];if(i>0){const t=ws.fromPositions(e[i-1].range.getEndPosition(),s.getStartPosition()),n=new $Z(u.getValueInRange(t));a.appendChild(n),f+=n.value.length}const r=l.parseFragment(n,a);t.adjustWhitespace(u,s.getStartPosition(),!0,a,new Set(r)),a.resolveVariables(d);const o=a.toString(),h=o.slice(f);f=o.length;const g=WI.replace(s,h);g.identifier={major:i,minor:0},g._isTracked=!0,c.push(g)}return l.ensureFinalTabstop(a,s,!0),{edits:c,snippets:[new g2(i,a,"")]}}constructor(t,i,e=p2,s){this._editor=t,this._template=i,this._options=e,this._languageConfigurationService=s,this._templateMerges=[],this._snippets=[]}dispose(){$i(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(){if(!this._editor.hasModel())return;const{edits:i,snippets:e}="string"==typeof this._template?t.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):t.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=e,this._editor.executeEdits("snippet",i,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<e.length;t++)e[t].initialize(i[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):i.map((t=>bs.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(i,e=p2){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,i]);const{edits:s,snippets:n}=t.createEditsAndSnippetsFromSelections(this._editor,i,e.overwriteBefore,e.overwriteAfter,!0,e.adjustWhitespace,e.clipboardText,e.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",s,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<n.length;t++)n[t].initialize(i[t].textChange);const e=n[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(n);console.assert(0===n.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>bs.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(ws.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(ws.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(ws.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}};m2=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,_c)],m2);var v2=function(t,i){return function(e,s){i(e,s,t)}};const w2={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let b2=class t{static get(i){return i.getContribution(t.ID)}constructor(i,e,s,n,r){this._editor=i,this._logService=e,this._languageFeaturesService=s,this._languageConfigurationService=r,this._snippetListener=new Vi,this._modelVersionId=-1,this._inSnippet=t.InSnippetMode.bindTo(n),this._hasNextTabstop=t.HasNextTabstop.bindTo(n),this._hasPrevTabstop=t.HasPrevTabstop.bindTo(n)}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?w2:Object.assign(Object.assign({},w2),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 s;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(Mt("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new m2(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(s=this._session)||void 0===s?void 0:s.hasChoice){this._choiceCompletionItemProvider={provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!vs.equals(this._editor.getPosition(),i))return;const{activeChoice:s}=this._session;if(!s||0===s.choice.options.length)return;const n=t.getValueInRange(s.range),r=Boolean(s.choice.options.find((t=>t.value===n))),o=[];for(let t=0;t<s.choice.options.length;t++){const i=s.choice.options[t];o.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:s.range,filterText:r?`${n}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:e(0,"Go to next placeholder...")}})}return{suggestions:o}}};const t=this._languageFeaturesService.completionProvider.register({language:this._editor.getModel().getLanguageId(),pattern:this._editor.getModel().uri.fsPath,scheme:this._editor.getModel().uri.scheme,exclusive:!0},this._choiceCompletionItemProvider);this._snippetListener.add(t)}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(){if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:t}=this._session;t&&this._choiceCompletionItemProvider?this._currentChoice!==t.choice&&(this._currentChoice=t.choice,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._choiceCompletionItemProvider)}))):this._currentChoice=void 0}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())}};b2.ID="snippetController2",b2.InSnippetMode=new Jo("inSnippetMode",!1,e(0,"Whether the editor in current in snippet mode")),b2.HasNextTabstop=new Jo("hasNextTabstop",!1,e(0,"Whether there is a next tab stop when in snippet mode")),b2.HasPrevTabstop=new Jo("hasPrevTabstop",!1,e(0,"Whether there is a previous tab stop when in snippet mode")),b2=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}([v2(1,pa),v2(2,ka),v2(3,Qo),v2(4,_c)],b2),$p(b2.ID,b2,4);const y2=Fp.bindToContribution(b2.get);Pp(new y2({id:"jumpToNextSnippetPlaceholder",precondition:Oo.and(b2.InSnippetMode,b2.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:2}})),Pp(new y2({id:"jumpToPrevSnippetPlaceholder",precondition:Oo.and(b2.InSnippetMode,b2.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:1026}})),Pp(new y2({id:"leaveSnippet",precondition:b2.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:PC.editorTextFocus,primary:9,secondary:[1033]}})),Pp(new y2({id:"acceptSnippet",precondition:b2.InSnippetMode,handler:t=>t.finish()}));var k2,C2=function(t,i){return function(e,s){i(e,s,t)}},S2=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(k2||(k2={}));let x2=class extends Hi{get isAcceptingPartially(){return this._isAcceptingPartially}get isNavigatingCurrentInlineCompletion(){return this._isNavigatingCurrentInlineCompletion}constructor(t,i,e,s,n,r,o,h,c,u,l,a){let d;var f,g;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=u,this._commandService=l,this._languageConfigurationService=a,this._source=this._register(this._instantiationService.createInstance(X1,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=OQ("isActive",!1),this._forceUpdate=new HQ("forceUpdate"),this._selectedInlineCompletionId=OQ("selectedInlineCompletionId",void 0),this._isAcceptingPartially=!1,this._isNavigatingCurrentInlineCompletion=!1,this._preserveCurrentCompletionReasons=new Set([k2.Redo,k2.Undo,k2.AcceptWord]),this._fetchInlineCompletions=(g=(t,i)=>{if(this._forceUpdate.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();EQ((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)},new IQ("fetch inline completions",g,(f={createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Ds.Automatic}),handleChange:(t,i)=>(t.didChange(this.textModelVersionId)&&this._preserveCurrentCompletionReasons.has(t.change)?i.preserveCurrentCompletion=!0:t.didChange(this._forceUpdate)&&(i.inlineCompletionTriggerKind=t.change),!0)}).createEmptyChangeSummary,f.handleChange)),this._filteredInlineCompletionItems=_Q("filteredInlineCompletionItems",(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=_Q("selectedCachedCompletionIndex",(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=_Q("selectedCachedCompletion",(t=>this._filteredInlineCompletionItems.read(t)[this.selectedInlineCompletionIndex.read(t)])),this.lastTriggerKind=this._source.inlineCompletions.map((t=>null==t?void 0:t.request.context.triggerKind)),this.inlineCompletionsCount=_Q("selectedInlineCompletionsCount",(t=>this.lastTriggerKind.read(t)===Ds.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=_Q("ghostTextAndCompletion",(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=this._source.suggestWidgetInlineCompletions.read(t),r=n?n.inlineCompletions:[this.selectedInlineCompletion.read(t)].filter(At),o=s.toSingleTextEdit().removeCommonPrefix(e),h=function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(r,(i=>{let n=i.toSingleTextEdit(t);return n=n.removeCommonPrefix(e,ws.fromPositions(n.range.getStartPosition(),s.range.getEndPosition())),n.augments(o)?{edit:n,completion:i}:void 0}));if(!this._suggestPreviewEnabled.read(t)&&!h)return;const c=null!==(i=null==h?void 0:h.edit)&&void 0!==i?i:o,u=h?h.edit.text.length-o.text.length:0,l=this._suggestPreviewMode.read(t),a=this.cursorPosition.read(t),d=c.computeGhostText(e,l,a,u);return{ghostText:null!=d?d:new P1(c.range.endLineNumber,[]),completion:null==h?void 0:h.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,completion:i,suggestItem:void 0}:void 0}})),this.ghostText=_Q("ghostText",(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(function(t,i){const e=new zQ(i);return t.addObserver(e),t.reportChanges(),Wi((()=>{t.removeObserver(e)}))}(this._fetchInlineCompletions,!0)),this._register(PQ("call handleItemDidShow",(t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.completion;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)}})))}trigger(t){return S2(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return S2(this,void 0,void 0,(function*(){AQ(t,(t=>{this._isActive.set(!0,t),this._forceUpdate.trigger(t,Ds.Explicit)})),yield this._fetchInlineCompletions.get()}))}stop(t){AQ(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_deltaSelectedInlineCompletionIndex(t){return S2(this,void 0,void 0,(function*(){yield this.triggerExplicitly(),this._isNavigatingCurrentInlineCompletion=!0;try{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)}finally{this._isNavigatingCurrentInlineCompletion=!1}}))}next(){return S2(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return S2(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i,e;return S2(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const s=this.ghostText.get(),n=null===(i=this.selectedInlineCompletion.get())||void 0===i?void 0:i.toInlineCompletion(void 0);s&&n&&(t.pushUndoStop(),n.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[WI.replaceMove(n.range,""),...n.additionalTextEdits]),t.setPosition(n.snippetInfo.range.getStartPosition()),null===(e=b2.get(t))||void 0===e||e.insert(n.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[WI.replaceMove(n.range,n.insertText),...n.additionalTextEdits]),n.command&&(yield this._commandService.executeCommand(n.command.id,...n.command.arguments||[]).then(void 0,Ai)),EQ((t=>{this._source.clear(t),this._isActive.set(!1,t)})))}))}acceptNextWord(t){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}))}acceptNextLine(t){this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}_acceptNext(t,i){var e;if(t.getModel()!==this.textModel)throw new Pi;const s=this.ghostText.get(),n=null===(e=this.selectedInlineCompletion.get())||void 0===e?void 0:e.toInlineCompletion(void 0);if(!s||!n)return;if(n.snippetInfo||n.filterText!==n.insertText)return void this.accept(t);if(0===s.parts.length)return;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 u=h.substring(0,c);this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[WI.replace(ws.fromPositions(o),u)]);const i=I1(u);t.setPosition(_1(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ws.fromPositions(n.range.getStartPosition(),_1(o,I1(u))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}};x2=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}([C2(9,eo),C2(10,dp),C2(11,_c)],x2);var D2=function(t,i){return function(e,s){i(e,s,t)}};class E2{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 A2 extends E2{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let L2=class t{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new lu((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===cN.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(i,e){var s;const n=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:i.getLanguageIdAtPosition(e.lineNumber,e.column),resource:i.uri});if((null===(s=this._strategy)||void 0===s?void 0:s.name)!==n){this._saveState();const i=t._strategyCtors.get(n)||A2;this._strategy=new i;try{const i=this._configService.getValue("editor.suggest.shareSuggestSelections"),e=this._storageService.get(`${t._storagePrefix}/${n}`,i?0:1);e&&this._strategy.fromJSON(JSON.parse(e))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const i=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,e=JSON.stringify(this._strategy);this._storageService.store(`${t._storagePrefix}/${this._strategy.name}`,e,i,1)}}};L2._strategyCtors=new Map([["recentlyUsedByPrefix",class extends E2{constructor(){super("recentlyUsedByPrefix"),this._trie=bP.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:xs.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends E2{constructor(){super("recentlyUsed"),this._cache=new TO(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:xs.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",A2]]),L2._storagePrefix="suggest/memories",L2=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}([D2(0,hN),D2(1,ic)],L2);const M2=no("ISuggestMemories");lc(M2,L2,1);let O2=class t{constructor(i,e){this._editor=i,this._enabled=!1,this._ckAtEnd=t.AtEnd.bindTo(e),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(119)&&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(119);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)}};O2.AtEnd=new Jo("atEndOfWord",!1),O2=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,Qo)],O2);let F2=class t{constructor(i,e){this._editor=i,this._index=0,this._ckOtherSuggestions=t.OtherSuggestions.bindTo(e)}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:i,index:e},s){0!==i.items.length&&t._moveIndex(!0,i,e)!==e?(this._acceptNext=s,this._model=i,this._index=e,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(i){if(this._model)try{this._ignore=!0,this._index=t._moveIndex(i,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};F2.OtherSuggestions=new Jo("hasOtherSuggestions",!1),F2=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,Qo)],F2);class T2{constructor(t,i,e,s){this._disposables=new Vi,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||!et(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new tl;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 R2{provideSelectionRanges(t,i){return e=this,s=void 0,r=function*(){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;yield new Promise((i=>R2._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>R2._bracketsLeftYield(e,0,t,s,n,i)))}return e},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=R2._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>R2._maxDuration){setTimeout((()=>R2._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 j,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>=R2._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>R2._maxDuration){setTimeout((()=>R2._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=ws.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=ws.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),R2._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:ws.fromPositions(new vs(s,n),i.getEndPosition())}),e.push({range:ws.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:ws.fromPositions(new vs(r,s),i.getEndPosition())}),e.push({range:ws.fromPositions(new vs(r,1),i.getEndPosition())}))}}}R2._maxDuration=30,R2._maxRounds=2;class _2{static create(t,i){return e=this,s=void 0,r=function*(){if(!i.getOption(114).localityBonus)return _2.None;if(!i.hasModel())return _2.None;const e=i.getModel(),s=i.getPosition();if(!t.canComputeWordRanges(e.uri))return _2.None;const[n]=yield(new R2).provideSelectionRanges(e,[s]);if(0===n.length)return _2.None;const r=yield t.computeWordRanges(e.uri,n[0].range);if(!r)return _2.None;const o=e.getWordUntilPosition(s);return delete r[o.word],new class extends _2{distance(t,e){if(!s.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const o=r["string"==typeof e.label?e.label:e.label.label];if(it(o))return 2<<20;const h=Z(o,ws.fromPositions(t),ws.compareRangesUsingStarts),c=h>=0?o[h]:o[Math.max(0,~h-1)];let u=n.length;for(const t of n){if(!ws.containsRange(t.range,c))break;u-=1}return u}}},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{c(r.next(t))}catch(t){i(t)}}function h(t){try{c(r.throw(t))}catch(t){i(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(e,s||[])).next())}));var e,s,n,r}}_2.None=new class extends _2{distance(){return 0}};class I2{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class P2{constructor(t,i,e,s,n,r,o=mF.default,h){this.clipboardText=h,this._snippetCompareFn=P2._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=P2._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=P2._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="",n="";const r=1===this._refilterKind?this._items:this._filteredItems,o=[],h=!this._options.filterGraceful||r.length>2e3?vF:bF;for(let c=0;c<r.length;c++){const u=r[c];if(u.isInvalid)continue;const l=this._itemsByProvider.get(u.provider);l?l.push(u):this._itemsByProvider.set(u.provider,[u]);const a=u.position.column-u.editStart.column,d=a+e-(u.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),n=s.toLowerCase()),u.word=s,0===d)u.score=pF.Default;else{let t=0;for(;t<a;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)u.score=pF.Default;else if("string"==typeof u.completion.filterText){const i=h(s,n,t,u.completion.filterText,u.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===qn(u.completion.filterText,u.textLabel)?u.score=i:(u.score=eF(s,n,t,u.textLabel,u.labelLow,0),u.score[0]=i[0])}else{const i=h(s,n,t,u.textLabel,u.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;u.score=i}}u.idx=c,u.distance=this._wordDistance.distance(u.position,u.completion),o.push(u),t.push(u.textLabel.length)}this._filteredItems=o.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?Q(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 P2._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 P2._compareCompletionItems(t,i)}}var N2=function(t,i){return function(e,s){i(e,s,t)}};class B2{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 $2=class t{constructor(t,i,e,s,n,r,o,h){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._toDispose=new Vi,this._triggerCharacterListener=new Vi,this._triggerQuickSuggest=new cu,this._triggerState=void 0,this._completionDisposables=new Vi,this._onDidCancel=new ee,this._onDidTrigger=new ee,this._onDidSuggest=new ee,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new bs(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 c=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{c=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{c=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{c||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{c||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){$i(this._triggerCharacterListener),$i([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(88)||!this._editor.hasModel()||!this._editor.getOption(117))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(O1.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(60).suppressSuggestions}(this._editor,this._contextKeyService))return;if(B2.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="";sr(i.charCodeAt(i.length-1))?er(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;bJ.isAllOff(this._editor.getOption(86))||this._editor.getOption(114).snippetsPreventQuickSuggestions&&(null===(t=b2.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!B2.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(86);if(!bJ.isAllOff(e)){if(!bJ.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"!==bJ.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(O1.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(O1.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(60).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(87)))}_refilterCompletionItems(){Mt(this._editor.hasModel()),Mt(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new B2(t,i,Object.assign(Object.assign({},this._triggerState),{refilter:!0}));this._onNewContext(e)}trigger(i){var e,s,n,r,o,h;if(!this._editor.hasModel())return;const c=this._editor.getModel(),u=new B2(c,this._editor.getPosition(),i);this.cancel(i.retrigger),this._triggerState=i,this._onDidTrigger.fire({auto:i.auto,shy:null!==(e=i.shy)&&void 0!==e&&e,position:this._editor.getPosition()}),this._context=u;let l={triggerKind:null!==(s=i.triggerKind)&&void 0!==s?s:0};i.triggerCharacter&&(l={triggerKind:1,triggerCharacter:i.triggerCharacter}),this._requestToken=new pe;let a=1;switch(this._editor.getOption(108)){case"top":a=0;break;case"bottom":a=2}const{itemKind:d,showDeprecated:f}=t._createSuggestFilter(this._editor),g=new gJ(a,null!==(r=null===(n=i.completionOptions)||void 0===n?void 0:n.kindFilter)&&void 0!==r?r:d,null===(o=i.completionOptions)||void 0===o?void 0:o.providerFilter,null===(h=i.completionOptions)||void 0===h?void 0:h.providerItemsToReuse,f),p=_2.create(this._editorWorkerService,this._editor),m=mJ(this._languageFeaturesService.completionProvider,c,this._editor.getPosition(),g,l,this._requestToken.token);Promise.all([m,p]).then((([t,e])=>{return s=this,n=void 0,o=function*(){var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==i?void 0:i.clipboardText;if(!n&&t.needsClipboard&&(n=yield this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new B2(r,this._editor.getPosition(),i),h=Object.assign(Object.assign({},mF.default),{firstMatchCanBeWeak:!this._editor.getOption(114).matchOnWordStartOnly});this._completionModel=new P2(t.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(114),this._editor.getOption(108),h,n),this._completionDisposables.add(t.disposable),this._onNewContext(o),this._reportDurationsTelemetry(t.durations)},new((r=void 0)||(r=Promise))((function(t,i){function e(t){try{c(o.next(t))}catch(t){i(t)}}function h(t){try{c(o.throw(t))}catch(t){i(t)}}function c(i){var s;i.done?t(i.value):(s=i.value,s instanceof r?s:new r((function(t){t(s)}))).then(e,h)}c((o=o.apply(s,n||[])).next())}));var s,n,r,o})).catch(Ei)}_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(108)&&i.add(27);const e=t.getOption(114);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(Hn(t.leadingLineContent)===Hn(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(B2.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=B2.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()}};$2=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}([N2(1,$R),N2(2,VR),N2(3,Ap),N2(4,pa),N2(5,Qo),N2(6,ic),N2(7,ka)],$2);class j2{constructor(t,i){this._disposables=new Vi,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)>j2._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()}}j2._maxSelectionLength=51200;var W2=function(t,i){return function(e,s){i(e,s,t)}};class V2 extends LN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=e(0,"{0} ({1})",this._action.label,V2.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let H2=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Lg(t,Rg(".suggest-status-bar"));const r=t=>t instanceof xp?e.createInstance(V2,t,void 0):void 0;this._leftActions=new kR(this.element,{actionViewItemProvider:r}),this._rightActions=new kR(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.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()}};H2=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}([W2(2,eo),W2(3,yp),W2(4,Qo)],H2);class z2{constructor(){let t;this._onDidWillResize=new ee,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ee,this.onDidResize=this._onDidResize.event,this._sashListener=new Vi,this._size=new ng(0,0),this._minSize=new ng(0,0),this._maxSize=new ng(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new EO(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new EO(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new EO(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:wO.North}),this._southSash=new EO(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:wO.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(Qi.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(Qi.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(Qi.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(Qi.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 ng(i,t);ng.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}}function U2(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let K2=class{constructor(t,i){this._editor=t,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ee,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Vi,this._renderDisposeable=new Vi,this._borderWidth=1,this._size=new ng(330,0),this.domNode=Rg(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(RJ,{editor:t}),this._body=Rg(".body"),this._scrollbar=new Fy(this._body,{alwaysConsumeMouseWheel:!0}),Lg(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Lg(this._body,Rg(".header")),this._close=Lg(this._header,Rg("span"+np.asCSSSelector(Ss.close))),this._close.title=e(0,"Close"),this._type=Lg(this._header,Rg("p.type")),this._docs=Lg(this._body,Rg("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(48),e=i.getMassagedFontFamily(),s=t.get(115)||i.fontSize,n=t.get(116)||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(116)||this._editor.getOption(48).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=e(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 MF).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||U2(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,_g(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Kf(this._type),this._type.title="",Ig(this._type),this.domNode.classList.add("no-type");if(Kf(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Kf(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 ng(t,i);ng.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}};K2=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,eo)],K2);class q2{constructor(t,i){let e,s;this.widget=t,this._editor=i,this._disposables=new Vi,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new z2,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=eg(document.body),r=this.widget.getLayoutInfo(),o=new ng(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 ng(e,n.height-t.top-r.borderHeight-r.verticalPadding),u=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:u,minSize:o.with(Math.min(e,o.width))}}(),u=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ng(e,n.height-t.top-r.borderHeight-r.verticalPadding),u=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:u,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ng(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)}}()],l=null!==(s=u.find((t=>t.fit>=0)))&&void 0!==s?s:u.sort(((t,i)=>i.fit-t.fit))[0],a=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(l.maxSizeTop.height,l.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=l.maxSizeTop.height?(d=!0,p=l.maxSizeTop):(d=!1,p=l.maxSizeBottom):f<=l.maxSizeBottom.height?(d=!1,p=l.maxSizeBottom):(d=!0,p=l.maxSizeTop),this._applyTopLeft({left:l.left,top:d?l.top:a-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,l===c,d,l!==c),this._resizable.minSize=l.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 G2;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(G2||(G2={}));const Z2=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function J2(t,i,e,s){const n=s===G2.ROOT_FOLDER?["rootfolder-icon"]:s===G2.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Wf.data)r=rE.parseMetaData(e).get(rE.META_DATA_LABEL);else{const t=e.path.match(Z2);t?(r=Q2(t[2].toLowerCase()),t[1]&&n.push(`${Q2(t[1].toLowerCase())}-name-dir-icon`)):r=Q2(e.authority.toLowerCase())}if(s===G2.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===Wf.data){const t=rE.parseMetaData(e).get(rE.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==Ec?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${Q2(s)}-lang-file-icon`)}}return n}function Q2(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var Y2,X2=function(t,i){return function(e,s){i(e,s,t)}};function t4(t){return`suggest-aria-id:${t}`}const i4=SR("suggest-more-info",Ss.chevronRight,e(0,"Icon for more information in the suggest widget.")),e4=new((Y2=class t{extract(i,e){if(i.textLabel.match(t._regexStrict))return e[0]=i.textLabel,!0;if(i.completion.detail&&i.completion.detail.match(t._regexStrict))return e[0]=i.completion.detail,!0;if("string"==typeof i.completion.documentation){const s=t._regexRelaxed.exec(i.completion.documentation);if(s&&(0===s.index||s.index+s[0].length===i.completion.documentation.length))return e[0]=s[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*\))/,Y2._regexStrict=new RegExp(`^${Y2._regexRelaxed.source}$`,"i"),Y2);let s4=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ee,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Vi,s=t;s.classList.add("show-file-icons");const n=Lg(t,Rg(".icon")),r=Lg(n,Rg("span.colorspan")),o=Lg(t,Rg(".contents")),h=Lg(o,Rg(".main")),c=Lg(h,Rg(".icon-label.codicon")),u=Lg(h,Rg("span.left")),l=Lg(h,Rg("span.right")),a=new hW(u,{supportHighlights:!0,supportIcons:!0});i.add(a);const d=Lg(u,Rg("span.signature-label")),f=Lg(u,Rg("span.qualifier-label")),g=Lg(l,Rg("span.details-label")),p=Lg(l,Rg("span.readMore"+np.asCSSSelector(i4)));p.title=e(0,"Read More");const m=()=>{const t=this._editor.getOptions(),i=t.get(48),e=i.getMassagedFontFamily(),r=i.fontFeatureSettings,o=t.get(115)||i.fontSize,c=t.get(116)||i.lineHeight,u=i.fontWeight,l=`${c}px`,a=`${i.letterSpacing}px`;s.style.fontSize=`${o}px`,s.style.fontWeight=u,s.style.letterSpacing=a,h.style.fontFamily=e,h.style.fontFeatureSettings=r,h.style.lineHeight=l,n.style.height=l,n.style.width=l,p.style.height=l,p.style.width=l};return m(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(48)||t.hasChanged(115)||t.hasChanged(116))&&m()}))),{root:s,left:u,right:l,icon:n,colorspan:r,iconLabel:a,iconContainer:c,parametersLabel:d,qualifierLabel:f,detailsLabel:g,readMore:p,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=t4(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:sF(t.score)},r=[];if(19===s.kind&&e4.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=J2(this._modelService,this._languageService,os.from({scheme:"fake",path:t.textLabel}),G2.FILE),r=J2(this._modelService,this._languageService,os.from({scheme:"fake",path:s.detail}),G2.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=[J2(this._modelService,this._languageService,os.from({scheme:"fake",path:t.textLabel}),G2.FOLDER),J2(this._modelService,this._languageService,os.from({scheme:"fake",path:s.detail}),G2.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...np.asClassNameArray(xs.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=n4(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=n4(s.label.detail||""),e.detailsLabel.textContent=n4(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(114).showInlineDetails?_g(e.detailsLabel):Ig(e.detailsLabel),U2(t)?(e.right.classList.add("can-expand-details"),_g(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"),Ig(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function n4(t){return t.replace(/\r\n|\r|\n/g,"")}s4=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(1,Zc),X2(2,hc),X2(3,Yy)],s4);var r4=function(t,i){return function(e,s){i(e,s,t)}};fm("editorSuggestWidget.background",{dark:dv,light:dv,hcDark:dv,hcLight:dv},e(0,"Background color of the suggest widget.")),fm("editorSuggestWidget.border",{dark:gv,light:gv,hcDark:gv,hcLight:gv},e(0,"Border color of the suggest widget."));const o4=fm("editorSuggestWidget.foreground",{dark:av,light:av,hcDark:av,hcLight:av},e(0,"Foreground color of the suggest widget."));fm("editorSuggestWidget.selectedForeground",{dark:Lw,light:Lw,hcDark:Lw,hcLight:Lw},e(0,"Foreground color of the selected entry in the suggest widget.")),fm("editorSuggestWidget.selectedIconForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},e(0,"Icon foreground color of the selected entry in the suggest widget."));const h4=fm("editorSuggestWidget.selectedBackground",{dark:Ow,light:Ow,hcDark:Ow,hcLight:Ow},e(0,"Background color of the selected entry in the suggest widget."));fm("editorSuggestWidget.highlightForeground",{dark:dw,light:dw,hcDark:dw,hcLight:dw},e(0,"Color of the match highlights in the suggest widget.")),fm("editorSuggestWidget.focusHighlightForeground",{dark:fw,light:fw,hcDark:fw,hcLight:fw},e(0,"Color of the match highlights in the suggest widget when an item is focused.")),fm("editorSuggestWidgetStatus.foreground",{dark:ab(o4,.5),light:ab(o4,.5),hcDark:ab(o4,.5),hcLight:ab(o4,.5)},e(0,"Foreground color of the suggest widget status."));class c4{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof eG}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ng.is(t))return ng.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let u4=class t{constructor(t,i,s,n,r){this.editor=t,this._storageService=i,this._state=0,this._isAuto=!1,this._pendingLayout=new zi,this._pendingShowDetails=new zi,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new cu,this._disposables=new Vi,this._onDidSelect=new oe,this._onDidFocus=new oe,this._onDidHide=new ee,this._onDidShow=new ee,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ee,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new z2,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new l4(this,t),this._persistedSize=new c4(i,t);class o{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let h;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),h=new o(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),h&&(h.persistHeight=h.persistHeight||!!t.north||!!t.south,h.persistWidth=h.persistWidth||!!t.east||!!t.west),t.done){if(h){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),o=Math.round(t/2);let{width:c,height:u}=this.element.size;(!h.persistHeight||Math.abs(h.currentSize.height-u)<=o)&&(u=null!==(e=null===(i=h.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!h.persistWidth||Math.abs(h.currentSize.width-c)<=o)&&(c=null!==(n=null===(s=h.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ng(c,u))}this._contentWidget.unlockPreference(),h=void 0}}))),this._messageElement=Lg(this.element.domNode,Rg(".message")),this._listElement=Lg(this.element.domNode,Rg(".tree"));const c=r.createInstance(K2,this.editor);c.onDidClose(this.toggleDetails,this,this._disposables),this._details=new q2(c,this.editor);const u=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(114).showIcons);u();const l=r.createInstance(s4,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new uR("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>e(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:s,description:n}=t.completion.label;s&&n?i=e(0,"{0}{1}, {2}",i,s,n):s?i=e(0,"{0}{1}",i,s):n&&(i=e(0,"{0}, {1}",i,n))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:s,detail:n}=t.completion;return e(0,"{0}, docs: {1}",i,Rn("{0}{1}",n||"",s?"string"==typeof s?s:s.value:""))}}}),this._list.style(wN({listInactiveFocusBackground:h4,listInactiveFocusOutline:bm})),this._status=r.createInstance(H2,this.element.domNode,dJ);const a=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(114).showStatusBar);a(),this._disposables.add(n.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(n.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(114)&&(a(),u())}))),this._ctxSuggestWidgetVisible=aJ.Visible.bindTo(s),this._ctxSuggestWidgetDetailsVisible=aJ.DetailsVisible.bindTo(s),this._ctxSuggestWidgetMultipleSuggestions=aJ.MultipleSuggestions.bindTo(s),this._ctxSuggestWidgetHasFocusedSuggestion=aJ.HasFocusedSuggestion.bindTo(s),this._disposables.add(Qf(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=Hb(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=tu((t=>{return i=this,s=void 0,r=function*(){const i=ou((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose())),n=yield e.resolve(t);return i.dispose(),s.dispose(),n},new((n=void 0)||(n=Promise))((function(t,e){function o(t){try{c(r.next(t))}catch(t){e(t)}}function h(t){try{c(r.throw(t))}catch(t){e(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,h)}c((r=r.apply(i,s||[])).next())}));var i,s,n,r})),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:t4(s)}))})).catch(Ei)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(i){if(this._state!==i)switch(this._state=i,this.element.domNode.classList.toggle("frozen",4===i),this.element.domNode.classList.remove("message"),i){case 0:Ig(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=t.LOADING_MESSAGE,Ig(this._listElement,this._status.element),_g(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=t.NO_SUGGESTIONS_MESSAGE,Ig(this._listElement,this._status.element),_g(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0;break;case 3:case 4:Ig(this._messageElement),_g(this._listElement,this._status.element),this._show();break;case 5:Ig(this._messageElement),_g(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=ou((()=>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=Yf((()=>{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")):!U2(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=Yf((()=>{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=eg(document.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 ng(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const u=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,l=r.statusBarHeight+this._list.contentHeight+r.borderHeight,a=r.itemHeight+r.statusBarHeight,d=og(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,l),p=d.top+f.top-r.verticalPadding,m=Math.min(p,l);let v=Math.min(Math.max(m,g)+r.borderHeight,l);o===(null===(i=this._cappedHeight)||void 0===i?void 0:i.capped)&&(o=this._cappedHeight.wanted),o<a&&(o=a),o>v&&(o=v),o>g||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),v=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),v=g),this.element.preferredSize=new ng(u,r.defaultSize.height),this.element.maxSize=new ng(c,v),this.element.minSize=new ng(220,a),this._cappedHeight=o===l?{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(48),i=bT(this.editor.getOption(116)||t.lineHeight,8,1e3),e=this.editor.getOption(114).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 ng(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}};u4.LOADING_MESSAGE=e(0,"Loading..."),u4.NO_SUGGESTIONS_MESSAGE=e(0,"No suggestions."),u4=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}([r4(1,hN),r4(2,Qo),r4(3,Yy),r4(4,eo)],u4);class l4{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 ng(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 a4=function(t,i){return function(e,s){i(e,s,t)}};class d4{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:ws.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 f4=class t{static get(i){return i.getContribution(t.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 zi,this._toDispose=new Vi,this._selectors=new g4((t=>t.priority)),this._telemetryGate=0,this.editor=t,this.model=n.createInstance($2,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=aJ.InsertMode.bindTo(s);h.set(t.getOption(114).insertMode),this.model.onDidTrigger((()=>h.set(t.getOption(114).insertMode))),this.widget=this._toDispose.add(new du((()=>{const t=this._instantiationService.createInstance(u4,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new T2(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=aJ.MakesTextEdit.bindTo(this._contextKeyService),s=aJ.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=aJ.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Wi((()=>{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 Od(!0,!1,!1,!1,33))||b&&t.toKeyCodeChord().equals(new Od(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new du((()=>this._toDispose.add(new j2(this.editor,this.model))))),this._alternatives=this._toDispose.add(new du((()=>this._toDispose.add(new F2(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(O2,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new d4(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(114);"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=aJ.AcceptSuggestionsOnEnter.bindTo(s),u=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>u()))),u()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.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=b2.get(this.editor);if(!e)return;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));if(this._memoryService.memorize(s,this.editor.getPosition(),r),Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=_F.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>WI.replaceMove(ws.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!r.isResolved){const t=new Ji(!0);let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=ws.getEndPosition(i.range);e&&!vs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let u=!1;const l=this.editor.onWillType((()=>{l.dispose(),u=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return!1;if(e&&r.completion.additionalTextEdits.some((t=>vs.isBefore(e,ws.getStartPosition(t.range)))))return!1;u&&this.editor.pushUndoStop();const t=_F.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>WI.replaceMove(ws.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!u&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),n.dispose(),l.dispose()})))}let{insertText:u}=r.completion;4&r.completion.insertTextRules||(u=GZ.escape(u)),this.model.cancel(),e.insert(u,{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&&(r.completion.command.id===p4.id?this.model.trigger({auto:!0,retrigger:!0}):o.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch((t=>{r.completion.extensionId?Ai(t):Ei(t)})))),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,t),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e){var s;if(this._telemetryGate++%100!=0)return;const n=t.extensionId?t.extensionId.value:(null!==(s=e.item.provider._debugDisplayName)&&void 0!==s?s:"unknown").split("(",1)[0].toLowerCase();this._telemetryService.publicLog2("suggest.acceptedSuggestion",{providerId:n,kind:t.completion.kind,basenameHash:Ru(JD(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:QD(i.uri)})}getOverwriteInfo(t,i){Mt(this.editor.hasModel());let e="replace"===this.editor.getOption(114).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){et(t.completion.additionalTextEdits)&&Yg(e(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};Qi.once(this.model.onDidTrigger)((()=>{const t=[];Qi.any(this.model.onDidTrigger,this.model.onDidCancel)((()=>{$i(t),e()}),void 0,t),this.model.onDidSuggest((({completionModel:i})=>{if($i(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)}};f4.ID="editor.contrib.suggestController",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}([a4(1,M2),a4(2,dp),a4(3,Qo),a4(4,eo),a4(5,pa),a4(6,Ap)],f4);class g4{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 p4 extends Tp{constructor(){super({id:p4.id,label:e(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Oo.and(PC.writable,PC.hasCompletionItemProvider,aJ.Visible.toNegated()),kbOpts:{kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=f4.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}p4.id="editor.action.triggerSuggest",$p(f4.ID,f4,2),Np(p4);const m4=190,v4=Fp.bindToContribution(f4.get);Pp(new v4({id:"acceptSelectedSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Oo.and(aJ.Visible,PC.textInputFocus),weight:m4},{primary:3,kbExpr:Oo.and(aJ.Visible,PC.textInputFocus,aJ.AcceptSuggestionsOnEnter,aJ.MakesTextEdit),weight:m4}],menuOpts:[{menuId:dJ,title:e(0,"Insert"),group:"left",order:1,when:aJ.HasInsertAndReplaceRange.toNegated()},{menuId:dJ,title:e(0,"Insert"),group:"left",order:1,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("insert"))},{menuId:dJ,title:e(0,"Replace"),group:"left",order:1,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("replace"))}]})),Pp(new v4({id:"acceptAlternativeSelectedSuggestion",precondition:Oo.and(aJ.Visible,PC.textInputFocus,aJ.HasFocusedSuggestion),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:dJ,group:"left",order:2,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("insert")),title:e(0,"Replace")},{menuId:dJ,group:"left",order:2,when:Oo.and(aJ.HasInsertAndReplaceRange,aJ.InsertMode.isEqualTo("replace")),title:e(0,"Insert")}]})),fp.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),Pp(new v4({id:"hideSuggestWidget",precondition:aJ.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:9,secondary:[1033]}})),Pp(new v4({id:"selectNextSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),Pp(new v4({id:"selectNextPageSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:12,secondary:[2060]}})),Pp(new v4({id:"selectLastSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),Pp(new v4({id:"selectPrevSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),Pp(new v4({id:"selectPrevPageSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:11,secondary:[2059]}})),Pp(new v4({id:"selectFirstSuggestion",precondition:Oo.and(aJ.Visible,Oo.or(aJ.MultipleSuggestions,aJ.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),Pp(new v4({id:"focusSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),Pp(new v4({id:"focusAndAcceptSuggestion",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),Pp(new v4({id:"toggleSuggestionDetails",precondition:Oo.and(aJ.Visible,aJ.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:dJ,group:"right",order:1,when:Oo.and(aJ.DetailsVisible,aJ.CanResolve),title:e(0,"show less")},{menuId:dJ,group:"right",order:1,when:Oo.and(aJ.DetailsVisible.toNegated(),aJ.CanResolve),title:e(0,"show more")}]})),Pp(new v4({id:"toggleExplainMode",precondition:aJ.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),Pp(new v4({id:"toggleSuggestionFocus",precondition:aJ.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2570,mac:{primary:778}}})),Pp(new v4({id:"insertBestCompletion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),O2.AtEnd,aJ.Visible.toNegated(),F2.OtherSuggestions.toNegated(),b2.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(kt(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:m4,primary:2}})),Pp(new v4({id:"insertNextSuggestion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),F2.OtherSuggestions,aJ.Visible.toNegated(),b2.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:2}})),Pp(new v4({id:"insertPrevSuggestion",precondition:Oo.and(PC.textInputFocus,Oo.equals("config.editor.tabCompletion","on"),F2.OtherSuggestions,aJ.Visible.toNegated(),b2.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:m4,kbExpr:PC.textInputFocus,primary:1026}})),Np(class extends Tp{constructor(){super({id:"editor.action.resetSuggestSize",label:e(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=f4.get(i))||void 0===e||e.resetWidgetSize()}});class w4 extends Hi{get selectedItem(){return this._selectedItem}constructor(t,i,e){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=OQ("suggestWidgetInlineCompletionProvider.selectedItem",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 s=f4.get(this.editor);if(s){this._register(s.registerSelector({priority:100,select:(t,i,e)=>{var n;EQ((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(n=this.suggestControllerPreselector())||void 0===n?void 0:n.removeCommonPrefix(r);if(!o)return-1;const h=vs.lift(i),c=vt(e.map(((t,i)=>{const e=b4.fromSuggestion(s,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)),pt((t=>t.prefixLength),mt));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(s.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(s.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(s.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Qi.once(s.model.onDidTrigger)((()=>{i()})))}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,EQ((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=f4.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?b4.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=f4.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=f4.get(this.editor);null==t||t.forceRenderingAbove()}}class b4{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new GZ).parse(r);t.children.length<100&&m2.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new b4(ws.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 Ps(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new V1(this.range,this.insertText)}}var y4=function(t,i){return function(e,s){i(e,s,t)}};let k4=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n,r,o,h){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.model=TQ("inlineCompletionModel",void 0),this.textModelVersionId=OQ("textModelVersionId",-1),this.cursorPosition=OQ("cursorPosition",new vs(1,1)),this.suggestWidgetAdaptor=this._register(new w4(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,k2.Other)))),this._enabled=jQ(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(60).enabled)),this.ghostTextWidget=this._register(this.instantiationService.createInstance($1,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:BQ(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._register(new O1(this.contextKeyService,this.model)),this._register(Qi.runAndSubscribe(t.onDidChangeModel,(()=>EQ((e=>{this.model.set(void 0,e),this.updateObservables(e,k2.Other);const s=t.getModel();if(s){const n=i.createInstance(x2,s,this.suggestWidgetAdaptor.selectedItem,this.cursorPosition,this.textModelVersionId,this._debounceValue,jQ(t.onDidChangeConfiguration,(()=>t.getOption(114).preview)),jQ(t.onDidChangeConfiguration,(()=>t.getOption(114).previewMode)),jQ(t.onDidChangeConfiguration,(()=>t.getOption(60).mode)),this._enabled);this.model.set(n,e)}})))));const c=t=>{var i;return t.isUndoing?k2.Undo:t.isRedoing?k2.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?k2.AcceptWord:k2.Other};let u;this._register(t.onDidChangeModelContent((t=>EQ((i=>this.updateObservables(i,c(t))))))),this._register(t.onDidChangeCursorPosition((t=>EQ((i=>{var e;this.updateObservables(i,k2.Other),3===t.reason&&(null===(e=this.model.get())||void 0===e||e.stop(i))}))))),this._register(t.onDidType((()=>EQ((t=>{var i;this.updateObservables(t,k2.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([UC.Tab.id,UC.DeleteLeft.id,UC.DeleteRight.id,UQ,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&EQ((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this.configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(60).keepOnBlur||sY.dropDownVisible||EQ((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(PQ("forceRenderingAbove",(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(Wi((()=>{this.suggestWidgetAdaptor.stopForceRenderingAbove()}))),this._register(PQ("play audio cue & read suggestion",(t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.completion){if(e.completion.semanticId!==u){if(u=e.completion.semanticId,i.isNavigatingCurrentInlineCompletion)return;this.audioCueService.playAudioCue(fo.inlineSuggestion).then((()=>{if(this.editor.getOption(6)){const t=i.textModel.getLineContent(e.ghostText.lineNumber);Yg(e.ghostText.renderForScreenReader(t))}}))}}else u=void 0}))),this._register(new tY(this.editor,this.model,this.instantiationService))}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)}};k4.ID="editor.contrib.inlineCompletionsController",k4=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}([y4(1,eo),y4(2,Qo),y4(3,ic),y4(4,dp),y4(5,z_),y4(6,ka),y4(7,lo)],k4);var C4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class S4 extends Tp{constructor(){super({id:S4.ID,label:e(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}S4.ID=qQ;class x4 extends Tp{constructor(){super({id:x4.ID,label:e(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}x4.ID=KQ;class D4 extends Tp{constructor(){super({id:D4.ID,label:e(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:O1.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return C4(this,void 0,void 0,(function*(){const t=k4.get(i);EQ((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}D4.ID="editor.action.inlineSuggest.hide";class E4 extends Dp{constructor(){super({id:E4.ID,title:e(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:bp.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Oo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return C4(this,void 0,void 0,(function*(){const i=t.get(ic),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}E4.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var A4=function(t,i){return function(e,s){i(e,s,t)}};class L4{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 M4=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=k4.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 IZ(1e3,this,ws.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 IZ(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("always"===this._editor.getOption(60).showToolbar)return[];const e=k4.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new L4(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Vi,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(sY,this._editor,!1,BQ(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,s){const n=Rg,r=n("div.hover-row.markdown-hover"),o=Lg(r,n("div.hover-contents",{"aria-live":"assertive"})),h=s.add(new RJ({editor:this._editor},this._languageService,this._openerService));s.add(PQ("update hover",(n=>{var r;const c=null===(r=i.controller.model.read(n))||void 0===r?void 0:r.ghostText.read(n);if(c){const i=this._editor.getModel().getLineContent(c.lineNumber);(i=>{s.add(h.onDidRenderAsync((()=>{o.className="hover-contents code-hover-contents",t.onContentsChanged()})));const n=e(0,"Suggestion:"),r=s.add(h.render((new MF).appendText(n).appendCodeblock("text",i)));o.replaceChildren(r.element)})(c.renderForScreenReader(i))}else Mg(o)}))),t.fragment.appendChild(r)}};function O4(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function F4(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}M4=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}([A4(1,hc),A4(2,W_),A4(3,sh),A4(4,eo),A4(5,Ap)],M4),$p(k4.ID,k4,3),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:e(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:PC.writable})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),Np(S4),Np(x4),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:e(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065},menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.acceptNextWord(t.editor)}))}}),Np(class extends Tp{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:e(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Oo.and(PC.writable,O1.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.acceptNextLine(t.editor)}))}}),Np(class extends Tp{constructor(){super({id:UQ,label:e(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:O1.inlineSuggestionVisible,menuOpts:[{menuId:bp.InlineSuggestionToolbar,title:e(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Oo.and(O1.inlineSuggestionVisible,PC.tabMovesFocus.toNegated(),O1.inlineSuggestionHasIndentationLessThanTabSize)}})}run(t,i){var e;return C4(this,void 0,void 0,(function*(){const t=k4.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),Np(D4),Ep(E4),PZ.register(M4);function T4(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(),u=(t,i)=>SC.shiftIndent(t,t.length+(i=i||1),o,h,c),l=(t,i)=>SC.unshiftIndent(t,t.length+(i=i||1),o,h,c),a=[];let d;const f=t.getLineContent(e);let g=f;if(null!=n){d=n;const t=Hn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=l(d),g=d+f.substring(t.length)),f!==g&&a.push(WI.replaceMove(new bs(e,1,e,t.length+1),Zk(d,h,c)))}else d=Hn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=u(p),d=u(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=u(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=Hn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=l(p),d=l(d)),s!==p&&a.push(WI.replaceMove(new bs(i,1,i,s.length+1),Zk(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=u(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?u(p):d)}return a}class R4 extends Tp{constructor(){super({id:R4.ID,label:e(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:PC.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new H4(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}R4.ID="editor.action.indentationToSpaces";class _4 extends Tp{constructor(){super({id:_4.ID,label:e(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:PC.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new z4(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}_4.ID="editor.action.indentationToTabs";class I4 extends Tp{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const s=t.get(Kj),n=t.get(Zc),r=i.getModel();if(!r)return;const o=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget),h=r.getOptions(),c=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===o.tabSize&&t===h.tabSize?e(0,"Configured Tab Size"):t===o.tabSize?e(0,"Default Tab Size"):t===h.tabSize?e(0,"Current Tab Size"):void 0}))),u=Math.min(r.getOptions().tabSize-1,7);setTimeout((()=>{s.pick(c,{placeHolder:e(0,"Select Tab Size for Current File"),activeItem:c[u]}).then((t=>{if(t&&r&&!r.isDisposed()){const i=parseInt(t.label,10);r.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class P4 extends I4{constructor(){super(!1,!1,{id:P4.ID,label:e(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}P4.ID="editor.action.indentUsingTabs";class N4 extends I4{constructor(){super(!0,!1,{id:N4.ID,label:e(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}N4.ID="editor.action.indentUsingSpaces";class B4 extends I4{constructor(){super(!0,!0,{id:B4.ID,label:e(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}B4.ID="editor.action.changeTabDisplaySize";class $4 extends Tp{constructor(){super({id:$4.ID,label:e(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Zc),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}$4.ID="editor.action.detectIndentation";class j4{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(ws.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 W4=class{constructor(t,i){this.editor=t,this._languageConfigurationService=i,this.callOnDispose=new Vi,this.callOnModel=new Vi,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(10)<4||this.editor.getOption(53)||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(10),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>SC.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>SC.unshiftIndent(t,t.length+1,n,r,o)};let u=t.startLineNumber;for(;u<=t.endLineNumber&&this.shouldIgnoreLine(e,u);)u++;if(u>t.endLineNumber)return;let l=e.getLineContent(u);if(!/\S/.test(l.substring(0,t.startColumn-1))){const t=AC(s,e,e.getLanguageId(),u,c,this._languageConfigurationService);if(null!==t){const i=Hn(l),s=O4(t,n);if(s!==O4(i,n)){const t=F4(s,n,o);h.push({range:new ws(u,1,u,i.length+1),text:t}),l=t+l.substr(i.length)}else{const t=LC(e,u,this._languageConfigurationService);if(0===t||8===t)return}}}const a=u;for(;u<t.endLineNumber&&!/\S/.test(e.getLineContent(u+1));)u++;if(u!==t.endLineNumber){const i=AC(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===a?l:e.getLineContent(t)},e.getLanguageId(),u+1,c,this._languageConfigurationService);if(null!==i){const s=O4(i,n),r=O4(Hn(e.getLineContent(u+1)),n);if(s!==r){const i=s-r;for(let s=u+1;s<=t.endLineNumber;s++){const t=Hn(e.getLineContent(s)),r=F4(O4(t,n)+i,n,o);r!==t&&h.push({range:new ws(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new j4(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 V4(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 ws(e,1,e,o),c=t.getValueInRange(h),u=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,u)}}W4.ID="editor.contrib.autoIndentOnPaste",W4=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,_c)],W4);class H4{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),V4(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class z4{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),V4(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}$p(W4.ID,W4,2),Np(R4),Np(_4),Np(P4),Np(N4),Np(B4),Np($4),Np(class extends Tp{constructor(){super({id:"editor.action.reindentlines",label:e(0,"Reindent Lines"),alias:"Reindent Lines",precondition:PC.writable})}run(t,i){const e=t.get(_c),s=i.getModel();if(!s)return;const n=T4(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),Np(class extends Tp{constructor(){super({id:"editor.action.reindentselectedlines",label:e(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:PC.writable})}run(t,i){const e=t.get(_c),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=T4(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});var U4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class K4{constructor(t,i){this.range=t,this.direction=i}}class q4{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new q4(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return U4(this,void 0,void 0,(function*(){if("function"==typeof this.provider.resolveInlayHint){if(this._currentResolve){if(yield this._currentResolve,t.isCancellationRequested)return;return this.resolve(t)}this._isResolved||(this._currentResolve=this._doResolve(t).finally((()=>this._currentResolve=void 0))),yield this._currentResolve}}))}_doResolve(t){var i,e;return U4(this,void 0,void 0,(function*(){try{const s=yield 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){Ai(t),this._isResolved=!1}}))}}class G4{static create(t,i,e,s){return U4(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>U4(this,void 0,void 0,(function*(){try{const r=yield t.provideInlayHints(i,e,s);(null==r?void 0:r.hints.length)&&n.push([r,t])}catch(t){Ai(t)}}))))));if(yield Promise.all(r.flat()),s.isCancellationRequested||i.isDisposed())throw new Fi;return new G4(e,n,i)}))}constructor(t,i,e){this._disposables=new Vi,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=G4._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=ws.fromPositions(o.getStartPosition(),t),r="after"):(h=ws.fromPositions(t,o.getEndPosition()),r="before"),s.push(new q4(i,new K4(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 ws(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 ws(e,h+1,e,c+1)}}var Z4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function J4(t,i,e,s){var n;return Z4(this,void 0,void 0,(function*(){const r=t.get(ep),o=t.get(zR),h=t.get(dp),c=t.get(eo),u=t.get(IM);if(yield s.item.resolve(fe.None),!s.part.location)return;const l=s.part.location,a=[],d=new Set(Cp.getMenuItems(bp.EditorContext).map((t=>wp(t)?t.command.id:EY())));for(const t of wZ.all())d.has(t.desc.id)&&a.push(new op(t.desc.id,xp.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>Z4(this,void 0,void 0,(function*(){const e=yield r.createModelReference(l.uri);try{const n=new vZ(e.object.textEditorModel,ws.getStartPosition(l.range)),r=s.item.anchor.range;yield c.invokeFunction(t.runEditorCommand.bind(t),i,n,r)}finally{e.dispose()}})))));if(s.part.command){const{command:t}=s.part;a.push(new cp),a.push(new op(t.id,t.title,void 0,!0,(()=>Z4(this,void 0,void 0,(function*(){var i;try{yield h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){u.notify({severity:_M.Error,source:s.item.provider.displayName,message:t})}})))))}const f=i.getOption(123);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=og(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function Q4(t,i,e,s){return Z4(this,void 0,void 0,(function*(){const n=t.get(ep),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>Z4(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Qo),h=dG.inPeekEditor.getValue(o),c=!n&&e.getOption(85)&&!h;return new bZ({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new vZ(r.object.textEditorModel,ws.getStartPosition(s.range)),ws.lift(s.range))})))),r.dispose()}))}var Y4=function(t,i){return function(e,s){i(e,s,t)}},X4=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class t5{constructor(){this._entries=new TO(50)}get(t){const i=t5._key(t);return this._entries.get(i)}set(t,i){const e=t5._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const i5=no("IInlayHintsCache");lc(i5,t5,1);class e5{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 s5{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let n5=class t{static get(i){var e;return null!==(e=i.getContribution(t.ID))&&void 0!==e?e: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 Vi,this._sessionDisposables=new Vi,this._decorationsMetadata=new Map,this._ruleFactory=new Lb(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(136)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(136);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(Wi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new lu((()=>X4(this,void 0,void 0,(function*(){const t=Date.now();null==s||s.dispose(!0),s=new pe;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const o=s.token,h=yield G4.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),o);if(r.delay=this._debounceInfo.update(i,Date.now()-t),o.isCancellationRequested)return void h.dispose();for(const t of h.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(h),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(i)}catch(t){Ei(t)}finally{s.dispose(),e.dispose()}}))),this._debounceInfo.get(i));if(this._sessionDisposables.add(r),this._sessionDisposables.add(Wi((()=>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(Vg.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 Vi,i=t.add(new tG(this._editor)),e=new Vi;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(Wi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new s5(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new ws(o,1,o,n.getLineMaxColumn(o)),c=this._getInlineHintsForRange(h);this._updateHintsDecorators([h],c),e.add(Wi((()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([h],c)})))}))),t.add(i.onCancel((()=>e.clear()))),t.add(i.onExecute((t=>X4(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(Q4,t,this._editor,e.location):Ms.is(e.command)&&(yield 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((i=>X4(this,void 0,void 0,(function*(){if(2!==i.event.detail)return;const e=this._getInlayHintLabelPart(i);if(e&&(i.event.preventDefault(),yield e.item.resolve(fe.None),et(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>WI.replace(ws.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>X4(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(J4,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 eL&&(null==e?void 0:e.attachedData)instanceof e5?e.attachedData:void 0}_invokeCommand(t,i){var e;return X4(this,void 0,void 0,(function*(){try{yield this._commandService.executeCommand(t.id,...null!==(e=t.arguments)&&void 0!==e?e:[])}catch(t){this._notificationService.notify({severity:_M.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 K4(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(ws.compareRangesUsingStarts)){const i=t.validateRange(new ws(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&ws.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=ws.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(i,e){var s,n;const r=[],o=(t,i,e,s,n)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:n};r.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}}})},h=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(c/3|0)+"px",display:"inline-block"});o(t,e," ",i?dh.Right:dh.None)},{fontSize:c,fontFamily:u,padding:l,isUniform:a}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,u);for(const i of e){i.hint.paddingLeft&&h(i,!1);const e="string"==typeof i.hint.label?[{label:i.hint.label}]:i.hint.label;for(let t=0;t<e.length;t++){const n=e[t],r=0===t,h=t===e.length-1,u={fontSize:`${c}px`,fontFamily:`var(${d}), ${ki.fontFamily}`,verticalAlign:a?"baseline":"middle",unicodeBidi:"isolate"};et(i.hint.textEdits)&&(u.cursor="default"),this._fillInColors(u,i.hint),(n.command||n.location)&&(null===(s=this._activeInlayHintPart)||void 0===s?void 0:s.part.item)===i&&this._activeInlayHintPart.part.index===t&&(u.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(u.color=Xy(Nv),u.cursor="pointer")),l&&(r&&h?(u.padding=`1px ${0|Math.max(1,c/4)}px`,u.borderRadius=(c/4|0)+"px"):r?(u.padding=`1px 0 1px ${0|Math.max(1,c/4)}px`,u.borderRadius=`${c/4|0}px 0 0 ${c/4|0}px`):h?(u.padding=`1px ${0|Math.max(1,c/4)}px 1px 0`,u.borderRadius=`0 ${c/4|0}px ${c/4|0}px 0`):u.padding="1px 0 1px 0"),o(i,this._ruleFactory.createClassNameRef(u),n.label.replace(/[ \t]/g," "),h&&!i.hint.paddingRight?dh.Right:dh.None,new e5(i,t))}if(i.hint.paddingRight&&h(i,!0),r.length>t._MAX_DECORATORS)break}const f=[];for(const t of i)for(const{id:i}of null!==(n=this._editor.getDecorationsInRange(t))&&void 0!==n?n:[]){const t=this._decorationsMetadata.get(i);t&&(f.push(i),t.classNameRef.dispose(),this._decorationsMetadata.delete(i))}const g=_F.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,r.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],r[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===Os.Parameter?(t.backgroundColor=Xy(Hv),t.color=Xy(Vv)):i.kind===Os.Type?(t.backgroundColor=Xy(Wv),t.color=Xy(jv)):(t.backgroundColor=Xy($v),t.color=Xy(Bv))}_getLayoutInfo(){const t=this._editor.getOption(136),i=t.padding,e=this._editor.getOption(50),s=this._editor.getOption(47);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()}};n5.ID="editor.contrib.InlayHints",n5._MAX_DECORATORS=1500,n5=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}([Y4(1,ka),Y4(2,z_),Y4(3,i5),Y4(4,dp),Y4(5,IM),Y4(6,eo)],n5),fp.registerCommand("_executeInlayHintProvider",((t,...i)=>X4(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(os.isUri(e)),Mt(ws.isIRange(s));const{inlayHintsProvider:n}=t.get(ka),r=yield t.get(ep).createModelReference(e);try{const t=yield G4.create(n,r.object.textEditorModel,[ws.lift(s)],fe.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}))));var r5=function(t,i){return function(e,s){i(e,s,t)}},o5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class h5 extends IZ{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let c5=class extends HJ{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!n5.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 eL&&e.attachedData instanceof e5?new h5(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,s){return t instanceof h5?new pu((i=>o5(this,void 0,void 0,(function*(){var n,r,o;const{part:h}=t;if(yield h.item.resolve(s),s.isCancellationRequested)return;let c,u;if("string"==typeof h.item.hint.tooltip?c=(new MF).appendText(h.item.hint.tooltip):h.item.hint.tooltip&&(c=h.item.hint.tooltip),c&&i.emitOne(new VJ(this,t.range,[c],!1,0)),et(h.item.hint.textEdits)&&i.emitOne(new VJ(this,t.range,[(new MF).appendText(e(0,"Double-click to insert"))],!1,10001)),"string"==typeof h.part.tooltip?u=(new MF).appendText(h.part.tooltip):h.part.tooltip&&(u=h.part.tooltip),u&&i.emitOne(new VJ(this,t.range,[u],!1,1)),h.part.location||h.part.command){let s;const n=e(0,"altKey"===this._editor.getOption(75)?b?"cmd + click":"ctrl + click":b?"option + click":"alt + click");h.part.location&&h.part.command?s=(new MF).appendText(e(0,"Go to Definition ({0}), right click for more",n)):h.part.location?s=(new MF).appendText(e(0,"Go to Definition ({0})",n)):h.part.command&&(s=new MF(`[${e(0,"Execute Command")}](${l=h.part.command,os.from({scheme:Wf.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${h.part.command.title}") (${n})`,{isTrusted:!0})),s&&i.emitOne(new VJ(this,t.range,[s],!1,1e4))}var l;const a=yield this._resolveInlayHintLabelPartHover(h,s);try{for(var d,f=!0,g=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,e=t[Symbol.asyncIterator];return e?e.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i);function s(e){i[e]=t[e]&&function(i){return new Promise((function(s,n){!function(t,i,e,s){Promise.resolve(s).then((function(i){t({value:i,done:e})}),i)}(s,n,(i=t[e](i)).done,i.value)}))}}}(a);!(n=(d=yield g.next()).done);f=!0)f=!1,i.emitOne(d.value)}catch(t){r={error:t}}finally{try{f||n||!(o=g.return)||(yield o.call(g))}finally{if(r)throw r.error}}})))):pu.EMPTY}_resolveInlayHintLabelPartHover(t,i){return o5(this,void 0,void 0,(function*(){if(!t.part.location)return pu.EMPTY;const{uri:e,range:s}=t.part.location,n=yield this._resolverService.createModelReference(e);try{const e=n.object.textEditorModel;return this._languageFeaturesService.hoverProvider.has(e)?$J(this._languageFeaturesService.hoverProvider,e,new vs(s.startLineNumber,s.startColumn),i).filter((t=>!OF(t.hover.contents))).map((i=>new VJ(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):pu.EMPTY}finally{n.dispose()}}))}};c5=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}([r5(1,hc),r5(2,W_),r5(3,ic),r5(4,ep),r5(5,ka)],c5),$p(n5.ID,n5,1),PZ.register(c5);class u5{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 bs(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new bs(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}let l5=class t{static get(i){return i.getContribution(t.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(i,e){var s;null===(s=this.currentRequest)||void 0===s||s.cancel();const n=this.editor.getSelection(),r=this.editor.getModel();if(!r||!n)return;let o=n;if(o.startLineNumber!==o.endLineNumber)return;const h=new zH(this.editor,5),c=r.uri;return this.editorWorkerService.canNavigateValueSet(c)?(this.currentRequest=tu((()=>this.editorWorkerService.navigateValueSet(c,o,e))),this.currentRequest.then((e=>{var s;if(!e||!e.range||!e.value)return;if(!h.validate(this.editor))return;const n=ws.lift(e.range);let r=e.range;const c=e.value.length-(o.endColumn-o.startColumn);r={startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.startColumn+e.value.length},c>1&&(o=new bs(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+c-1));const u=new u5(n,o,e.value);this.editor.pushUndoStop(),this.editor.executeCommand(i,u),this.editor.pushUndoStop(),this.decorations.set([{range:r,options:t.DECORATION}]),null===(s=this.decorationRemover)||void 0===s||s.cancel(),this.decorationRemover=ru(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};l5.ID="editor.contrib.inPlaceReplaceController",l5.DECORATION=sL.register({description:"in-place-replace",className:"valueSetReplacement"}),l5=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,$R)],l5),$p(l5.ID,l5,4),Np(class extends Tp{constructor(){super({id:"editor.action.inPlaceReplace.up",label:e(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=l5.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),Np(class extends Tp{constructor(){super({id:"editor.action.inPlaceReplace.down",label:e(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=l5.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),Np(class extends Tp{constructor(){super({id:"expandLineSelection",label:e(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:PC.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,wC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class a5{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 u=0;if(n<r&&i[n].lineNumber===o&&(u=i[n].column,n++,u===c))continue;if(0===h.length)continue;const l=zn(h);let a=0;if(-1===l)a=1;else{if(l===h.length-1)continue;a=l+2}a=Math.max(u,a),e[s++]=WI.delete(new ws(o,a,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 d5{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 ws(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new ws(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new ws(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=bs.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let f5=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 ws(1,1,1,1),null):(i.addEditOperation(new ws(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new ws(n,1,n,t.getLineMaxColumn(n)),null)),s=new bs(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new ws(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let u=r;if(this.shouldAutoIndent(t,s)){const l=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==l){const i=F4(l+O4(Hn(t.getLineContent(e)),n),n,o);u=i+this.trimLeft(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=AC(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=Hn(t.getLineContent(e)),h=O4(i,n);if(h!==O4(s,n)){const t=F4(h,n,o);u=t+this.trimLeft(r)}}}i.addEditOperation(new ws(s.startLineNumber,1,s.startLineNumber,1),u+"\n");const a=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,u);if(null!==a)0!==a&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,a);else{c.getLineContent=i=>i===s.startLineNumber?u:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=AC(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=Hn(t.getLineContent(s.startLineNumber)),h=O4(r,n),c=O4(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new ws(s.startLineNumber,1,s.startLineNumber,1),u+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new ws(e,1,e+1,1),null),i.addEditOperation(new ws(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=AC(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=Hn(t.getLineContent(s.startLineNumber)),h=O4(r,n),c=O4(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=>SC.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>SC.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===fh.None||n.indentAction===fh.Indent?r=n.indentation+n.appendText:n.indentAction===fh.IndentOutdent?r=n.indentation:n.indentAction===fh.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimLeft(o).indexOf(this.trimLeft(r))>=0){const n=Hn(t.getLineContent(s));let o=Hn(r);const h=LC(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),O4(o,e)-O4(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(zn(r)>=0){const r=t.getLineMaxColumn(n),o=yC(this._autoIndent,t,new ws(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(zn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=yC(this._autoIndent,t,new ws(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),zn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=yC(this._autoIndent,t,new ws(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimLeft(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=Hn(t.getLineContent(o)),c=F4(O4(h,s)+r,s,n);c!==h&&(i.addEditOperation(new ws(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}};f5=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,_c)],f5);class g5{static getCollator(){return g5._COLLATOR||(g5._COLLATOR=new Intl.Collator),g5._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=p5(t,i,e);return s?WI.replace(new ws(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=p5(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 p5(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(g5.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}g5._COLLATOR=null;class m5 extends Tp{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)=>ws.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 d5(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class v5 extends Tp{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(_c),s=[],n=i.getSelections()||[],r=i.getOption(10);for(const t of n)s.push(new f5(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class w5 extends Tp{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!g5.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new g5(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class b5 extends Tp{constructor(){super({id:b5.ID,label:e(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:PC.writable,kbOpts:{kbExpr:PC.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 a5(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}b5.ID="editor.action.trimTrailingWhitespace";class y5 extends Tp{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===ws.intersectRanges(i,e)?n.push(i):s[t+1]=ws.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>WI.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class k5 extends Tp{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(126),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new ws(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(WI.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(WI.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class C5{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 S5 extends k5{constructor(){super({id:"editor.action.transformToTitlecase",label:e(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:PC.writable})}_modifyText(t,i){const e=S5.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}S5.titleBoundary=new C5("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class x5 extends k5{constructor(){super({id:"editor.action.transformToSnakecase",label:e(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:PC.writable})}_modifyText(t,i){const e=x5.caseBoundary.get(),s=x5.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}x5.caseBoundary=new C5("(\\p{Ll})(\\p{Lu})","gmu"),x5.singleLetters=new C5("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class D5 extends k5{constructor(){super({id:"editor.action.transformToCamelcase",label:e(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:PC.writable})}_modifyText(t,i){const e=D5.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("")}}D5.wordBoundary=new C5("[_\\s-]","gm");class E5 extends k5{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:e(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:PC.writable})}_modifyText(t,i){const e=E5.caseBoundary.get(),s=E5.singleLetters.get(),n=E5.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}E5.caseBoundary=new C5("(\\p{Ll})(\\p{Lu})","gmu"),E5.singleLetters=new C5("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),E5.underscoreBoundary=new C5("(\\S)(_)(\\S)","gm"),Np(class extends m5{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:e(0,"Copy Line Up"),alias:"Copy Line Up",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"&&Copy Line Up"),order:1}})}}),Np(class extends m5{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:e(0,"Copy Line Down"),alias:"Copy Line Down",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Co&&py Line Down"),order:2}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.duplicateSelection",label:e(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:PC.writable,menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(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 d5(t,!0));else{const i=new bs(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new cC(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),Np(class extends v5{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:e(0,"Move Line Up"),alias:"Move Line Up",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Mo&&ve Line Up"),order:3}})}}),Np(class extends v5{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:e(0,"Move Line Down"),alias:"Move Line Down",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"2_line",title:e(0,"Move &&Line Down"),order:4}})}}),Np(class extends w5{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:e(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:PC.writable})}}),Np(class extends w5{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:e(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:PC.writable})}}),Np(class extends Tp{constructor(){super({id:"editor.action.removeDuplicateLines",label:e(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:PC.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 bs(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,u=new bs(c,1,c+o.length-1,o[o.length-1].length);s.push(WI.replace(h,o.join("\n"))),n.push(u),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),Np(b5),Np(class extends Tp{constructor(){super({id:"editor.action.deleteLines",label:e(0,"Delete Line"),alias:"Delete Line",precondition:PC.writable,kbOpts:{kbExpr:PC.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,u=1,l=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,l=1):h>1&&(h-=1,u=s.getLineMaxColumn(h)),r.push(WI.replace(new bs(h,u,c,l),"")),o.push(new bs(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}}),Np(class extends Tp{constructor(){super({id:"editor.action.indentLines",label:e(0,"Indent Line"),alias:"Indent Line",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),Np(class extends Tp{constructor(){super({id:"editor.action.outdentLines",label:e(0,"Outdent Line"),alias:"Outdent Line",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2140,weight:100}})}run(t,i){UC.Outdent.runEditorCommand(t,i,null)}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertLineBefore",label:e(0,"Insert Line Above"),alias:"Insert Line Above",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertLineAfter",label:e(0,"Insert Line Below"),alias:"Insert Line Below",precondition:PC.writable,kbOpts:{kbExpr:PC.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,MC.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),Np(class extends y5{constructor(){super({id:"deleteAllLeft",label:e(0,"Delete All Left"),alias:"Delete All Left",precondition:PC.writable,kbOpts:{kbExpr:PC.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 bs(t,i.startColumn,t,i.startColumn)}else r=new bs(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(ws.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.getLineContent(i).length+1;return new ws(i,e,t.startLineNumber,1)}return new ws(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new ws(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),Np(class extends y5{constructor(){super({id:"deleteAllRight",label:e(0,"Delete All Right"),alias:"Delete All Right",precondition:PC.writable,kbOpts:{kbExpr:PC.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 bs(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 ws(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new ws(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(ws.compareRangesUsingStarts),s}}),Np(class extends Tp{constructor(){super({id:"editor.action.joinLines",label:e(0,"Join Lines"),alias:"Join Lines",precondition:PC.writable,kbOpts:{kbExpr:PC.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(ws.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 bs(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new bs(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let u=s,l=0;for(let t=0,i=n.length;t<i;t++){const i=n[t],e=i.startLineNumber,r=1;let a,d,f=0;const g=o.getLineContent(i.endLineNumber).length-i.endColumn;if(i.isEmpty()||i.startLineNumber===i.endLineNumber){const t=i.getStartPosition();t.lineNumber<o.getLineCount()?(a=e+1,d=o.getLineMaxColumn(a)):(a=t.lineNumber,d=o.getLineMaxColumn(t.lineNumber))}else a=i.endLineNumber,d=o.getLineMaxColumn(a);let p=o.getLineContent(e);for(let t=e+1;t<=a;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 ws(e,r,a,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(WI.replace(m,p)),t=new bs(m.startLineNumber-l,p.length-f+1,e-l,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(WI.replace(m,p)),t=new bs(i.startLineNumber-l,i.startColumn,i.endLineNumber-l,i.endColumn)):(h.push(WI.replace(m,p)),t=new bs(i.startLineNumber-l,i.startColumn,i.startLineNumber-l,p.length-g)),null!==ws.intersectRanges(m,s)?u=t:c.push(t)}l+=m.endLineNumber-m.startLineNumber}c.unshift(u),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),Np(class extends Tp{constructor(){super({id:"editor.action.transpose",label:e(0,"Transpose characters around the cursor"),alias:"Transpose characters around the cursor",precondition:PC.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 ws(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new hC(new bs(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new ws(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new aC(t,i,new bs(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),Np(class extends k5{constructor(){super({id:"editor.action.transformToUppercase",label:e(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:PC.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),Np(class extends k5{constructor(){super({id:"editor.action.transformToLowercase",label:e(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:PC.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),x5.caseBoundary.isSupported()&&x5.singleLetters.isSupported()&&Np(x5),D5.wordBoundary.isSupported()&&Np(D5),S5.titleBoundary.isSupported()&&Np(S5),E5.isSupported()&&Np(E5);var A5=function(t,i){return function(e,s){i(e,s,t)}},L5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const M5=new Jo("LinkedEditingInputVisible",!1);let O5=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e,s,n){super(),this.languageConfigurationService=s,this._syncRangesToken=0,this._localToDispose=this._register(new Vi),this._editor=t,this._providers=e.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=M5.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 Vi),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(67)||t.hasChanged(89))&&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(67)||this._editor.getOption(89))&&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(Qi.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new su(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 su(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=tr(t,r);o+=c,t=t.substr(c),r=r.substr(c);const u=ir(t,r);h-=u,t=t.substr(0,t.length-u),r=r.substr(0,r.length-u),o===h&&0===r.length||n.push({range:new ws(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)}updateRanges(i=!1){return L5(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return void this.clearRanges();const e=this._editor.getPosition();if(!this._enabled&&!i||this._editor.getSelections().length>1)return void this.clearRanges();const s=this._editor.getModel(),n=s.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(e.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(e))return}}this.clearRanges(),this._currentRequestPosition=e,this._currentRequestModelVersion=n;const r=tu((i=>L5(this,void 0,void 0,(function*(){try{const o=new Ji(!1),h=yield F5(this._providers,s,e,i);if(this._debounceInformation.update(s,o.elapsed()),r!==this._currentRequest)return;if(this._currentRequest=null,n!==s.getVersionId())return;let c=[];(null==h?void 0:h.ranges)&&(c=h.ranges),this._currentWordPattern=(null==h?void 0:h.wordPattern)||this._languageWordPattern;let u=!1;for(let t=0,i=c.length;t<i;t++)if(ws.containsPosition(c[t],e)){if(u=!0,0!==t){const i=c[t];c.splice(t,1),c.unshift(i)}break}if(!u)return void this.clearRanges();const l=c.map((i=>({range:i,options:t.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Ei(t),this._currentRequest!==r&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=r,r}))}};function F5(t,i,e,s){return hu(t.ordered(i).map((t=>()=>L5(this,void 0,void 0,(function*(){try{return yield t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Ai(t)}})))),(t=>!!t&&et(null==t?void 0:t.ranges)))}O5.ID="editor.contrib.linkedEditing",O5.DECORATION=sL.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),O5=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}([A5(1,Qo),A5(2,ka),A5(3,_c),A5(4,z_)],O5),Pp(new(Fp.bindToContribution(O5.get))({id:"cancelLinkedEditingInput",precondition:M5,handler:t=>t.clearRanges(),kbOpts:{kbExpr:PC.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),fm("editor.linkedEditingBackground",{dark:ea.fromHex("#f00").transparent(.3),light:ea.fromHex("#f00").transparent(.3),hcDark:ea.fromHex("#f00").transparent(.3),hcLight:ea.white},e(0,"Background color when the editor auto renames on type.")),Ip("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(ka);return F5(s,i,e,fe.None)})),$p(O5.ID,O5,1),Np(class extends Tp{constructor(){super({id:"editor.action.linkedEditing",label:e(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Oo.and(PC.writable,PC.hasRenameProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(ro),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return os.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)))))}),Ei):super.runCommand(t,i)}run(t,i){const e=O5.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var T5=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class R5{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}resolve(t){return T5(this,void 0,void 0,(function*(){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 _5{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new R5(t,s)));i=_5._union(i,t),Bi(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];ws.areIntersectingOrTouching(n.range,o.range)?s++:ws.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 I5(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])}),Ai)));return Promise.all(n).then((()=>{const t=new _5(X(s));return e.isCancellationRequested?(t.dispose(),new _5([])):t}))}fp.registerCommand("_executeLinkProvider",((t,...i)=>T5(void 0,void 0,void 0,(function*(){let[e,s]=i;Mt(e instanceof os),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(ka),r=t.get(Zc).getModel(e);if(!r)return[];const o=yield I5(n,r,fe.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)yield o.links[t].resolve(fe.None);const h=o.links.slice(0);return o.dispose(),h}))));var P5=function(t,i){return function(e,s){i(e,s,t)}};let N5=class t extends Hi{static get(i){return i.getContribution(t.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 lu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new tG(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(68)&&(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)}computeLinksNow(){return t=this,i=void 0,s=function*(){if(!this.editor.hasModel()||!this.editor.getOption(68))return;const t=this.editor.getModel();if(this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=tu((i=>I5(this.providers,t,i)));try{const i=new Ji(!1);if(this.activeLinksList=yield this.computePromise,this.debounceInformation.update(t,i.elapsed()),t.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Ei(t)}finally{this.computePromise=null}}},new((e=void 0)||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}));var t,i,e,s}updateDecorations(t){const i="altKey"===this.editor.getOption(75),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($5.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 $5(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(75);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(75);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,s=!1){if(!this.openerService)return;const{link:n}=t;n.resolve(fe.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===Wf.file&&t.startsWith(`${Wf.file}:`)){const e=os.parse(t);if(e.scheme===Wf.file){const s=KD(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=XD(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:s,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(e(0,"Failed to open this link because it is not well-formed: {0}",n.url.toString())):"missing"===i?this.notificationService.warn(e(0,"Failed to open this link because its target is missing.")):Ei(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()}};N5.ID="editor.linkDetector",N5=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}([P5(1,W_),P5(2,IM),P5(3,ka),P5(4,z_)],N5);const B5={general:sL.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:sL.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class $5{static decoration(t,i){return{range:t.range,options:$5._getOptions(t,i,!1)}}static _getOptions(t,i,s){const n=Object.assign({},s?B5.active:B5.general);return n.hoverMessage=function(t,i){const s=t.url&&/^command:/i.test(t.url.toString()),n=t.tooltip?t.tooltip:e(0,s?"Execute command":"Follow link"),r=e(0,i?b?"cmd + click":"ctrl + click":b?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const s=t.url.toString().match(/^command:([^?#]+)/);s&&(i=e(0,"Execute command {0}",s[1]))}return new MF("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),n,i).appendMarkdown(` (${r})`)}return(new MF).appendText(`${n} (${r})`)}(t,i),n}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,$5._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,$5._getOptions(this.link,i,!1))}}$p(N5.ID,N5,1),Np(class extends Tp{constructor(){super({id:"editor.action.openLink",label:e(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=N5.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 j5 extends Hi{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(113);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}j5.ID="editor.contrib.longLinesHelper",$p(j5.ID,j5,2);const W5=fm("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},e(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);fm("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},e(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),fm("editor.wordHighlightTextBackground",{light:W5,dark:W5,hcDark:W5,hcLight:W5},e(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 V5=fm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:bm,hcLight:bm},e(0,"Border color of a symbol during read-access, like reading a variable."));fm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:bm,hcLight:bm},e(0,"Border color of a symbol during write-access, like writing to a variable.")),fm("editor.wordHighlightTextBorder",{light:V5,dark:V5,hcDark:V5,hcLight:V5},e(0,"Border color of a textual occurrence for a symbol."));const H5=fm("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},e(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),z5=fm("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},e(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),U5=fm("editorOverviewRuler.wordHighlightTextForeground",{dark:Yw,light:Yw,hcDark:Yw,hcLight:Yw},e(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),K5=sL.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:Xy(z5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),q5=sL.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:Xy(U5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),G5=sL.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:Xy(Yw),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}}),Z5=sL.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),J5=sL.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:Xy(H5),position:uh.Center},minimap:{color:Xy(tb),position:ah.Inline}});function Q5(t){return t?Z5:G5}sk(((t,i)=>{const e=t.getColor(Lv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));function Y5(t,i){const s=i.filter((i=>!t.find((t=>t.equals(i)))));if(s.length>=1){const t=s.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");Xg(e(0,1===s.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class X5{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class t3{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new t3(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,u=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,u=new bs(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new t3(t,i,r,c,s,n,u)}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 X5(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 X5(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(126):null,!1);return e?new bs(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 X5(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 X5(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(126):null,!1);return e?new bs(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(126):null,!1,1073741824)}}class i3 extends Hi{static get(t){return t.getContribution(i3.ID)}constructor(t){super(),this._sessionDispose=this._register(new Vi),this._editor=t,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(t){if(!this._session){const i=t3.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 bs(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(!r3(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(126):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 bs(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}i3.ID="editor.contrib.multiCursorController";class e3 extends Tp{run(t,i){const e=i3.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=F0.get(i);if(r)this._run(e,r);else{const s=t.get(eo).createInstance(F0,i);this._run(e,s),s.dispose()}Y5(n,s.getCursorStates())}}}class s3{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(ws.compareRangesUsingStarts)),this._cachedFindMatches}}let n3=class t extends Hi{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(104),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new lu((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(104)}))),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=F0.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(t._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=i3.get(e);if(!n)return null;const r=F0.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(!r3(e.getModel(),t,i))return null}o=t3.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 s3(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(126):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(ws.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=ws.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&ws.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r=this._languageFeaturesService.documentHighlightProvider.has(i)&&this.editor.getOption(78),o=n.map((t=>({range:t,options:Q5(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function r3(t,i,e){const s=o3(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!==o3(t,r,!e))return!1}return!0}function o3(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}n3.ID="editor.contrib.selectionHighlighter",n3=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,ka)],n3),$p(i3.ID,i3,4),$p(n3.ID,n3,1),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorAbove",label:e(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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,wC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorBelow",label:e(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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,wC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:e(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(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 bs(s,t,s,t))}t.endColumn>1&&e.push(new bs(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),Y5(r,n.getCursorStates())}}),Np(class extends e3{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:e(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2082,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:e(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:e(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:Ae(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:e(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)}}),Np(class extends e3{constructor(){super({id:"editor.action.selectHighlights",label:e(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:3114,weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"3_multi",title:e(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),Np(class extends e3{constructor(){super({id:"editor.action.changeAll",label:e(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Oo.and(PC.writable,PC.editorTextFocus),kbOpts:{kbExpr:PC.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),Np(class extends Tp{constructor(){super({id:"editor.action.addCursorsToBottom",label:e(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 bs(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),Y5(o,r.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.addCursorsToTop",label:e(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 bs(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),Y5(r,n.getCursorStates())}}),Np(class extends Tp{constructor(){super({id:"editor.action.focusNextCursor",label:e(0,"Focus Next Cursor"),description:{description:e(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),Y5(n,s.getCursorStates()))}}),Np(class extends Tp{constructor(){super({id:"editor.action.focusPreviousCursor",label:e(0,"Focus Previous Cursor"),description:{description:e(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),Y5(n,s.getCursorStates()))}});var h3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const c3={Visible:new Jo("parameterHintsVisible",!1),MultipleSignatures:new Jo("parameterHintsMultipleSignatures",!1)};function u3(t,i,e,s,n){return h3(this,void 0,void 0,(function*(){const r=t.ordered(i);for(const t of r)try{const r=yield t.provideSignatureHelp(i,e,n,s);if(r)return r}catch(t){Ai(t)}}))}fp.registerCommand("_executeSignatureHelpProvider",((t,...i)=>h3(void 0,void 0,void 0,(function*(){const[e,s,n]=i;Mt(os.isUri(e)),Mt(vs.isIPosition(s)),Mt("string"==typeof n||!n);const r=t.get(ka),o=yield t.get(ep).createModelReference(e);try{const t=yield u3(r.signatureHelpProvider,o.object.textEditorModel,vs.lift(s),{triggerKind:Es.Invoke,isRetrigger:!1,triggerCharacter:n},fe.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}}))));var l3;!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}}}(l3||(l3={}));class a3 extends Hi{constructor(t,i,e=a3.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ee),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=l3.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new tl,this.retriggerChars=new tl,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new su(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=l3.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(Ei)}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(83).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(83).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new l3.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:t})),this._onChangedHints.fire(this.state.hints))}doTrigger(t){return i=this,e=void 0,n=function*(){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(d3);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 l3.Pending(tu((t=>u3(this.providers,r,o,n,t))),e);try{const i=yield this.state.request;return t!==this.triggerId?(null==i||i.dispose(),!1):i&&i.value.signatures&&0!==i.value.signatures.length?(this.state=new l3.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=l3.Default),Ei(i),!1}},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}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:Es.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Es.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Es.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(83).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function d3(t,i){switch(i.triggerKind){case Es.Invoke:return i;case Es.ContentChange:return t;default:return i}}a3.DEFAULT_DELAY=120;var f3=function(t,i){return function(e,s){i(e,s,t)}};const g3=Rg,p3=SR("parameter-hints-next",Ss.chevronDown,e(0,"Icon for show next parameter hint.")),m3=SR("parameter-hints-previous",Ss.chevronUp,e(0,"Icon for show previous parameter hint."));let v3=class t extends Hi{constructor(t,i,e,s,n){super(),this.editor=t,this.model=i,this.renderDisposeables=this._register(new Vi),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=this._register(new RJ({editor:t},n,s)),this.keyVisible=c3.Visible.bindTo(e),this.keyMultipleSignatures=c3.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=g3(".editor-widget.parameter-hints-widget"),i=Lg(t,g3(".phwrapper"));i.tabIndex=-1;const e=Lg(i,g3(".controls")),s=Lg(e,g3(".button"+np.asCSSSelector(m3))),n=Lg(e,g3(".overloads")),r=Lg(e,g3(".button"+np.asCSSSelector(p3)));this._register(Zf(s,"click",(t=>{Dg(t),this.previous()}))),this._register(Zf(r,"click",(t=>{Dg(t),this.next()})));const o=g3(".body"),h=new Fy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Lg(o,g3(".signature")),u=Lg(o,g3(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:u,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const l=()=>{if(!this.domNodes)return;const t=this.editor.getOption(48);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};l(),this._register(Qi.chain(this.editor.onDidChangeConfiguration.bind(this.editor)).filter((t=>t.hasChanged(48))).on(l,null)),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 s=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",s),this.keyMultipleSignatures.set(s),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const n=t.signatures[t.activeSignature];if(!n)return;const r=Lg(this.domNodes.signature,g3(".code")),o=this.editor.getOption(48);r.style.fontSize=`${o.fontSize}px`,r.style.fontFamily=o.fontFamily;const h=null!==(i=n.activeParameter)&&void 0!==i?i:t.activeParameter;n.parameters.length>0?this.renderParameters(r,n,h):Lg(r,g3("span")).textContent=n.label;const c=n.parameters[h];if(null==c?void 0:c.documentation){const t=g3("span.documentation");if("string"==typeof c.documentation)t.textContent=c.documentation;else{const i=this.renderMarkdownDocs(c.documentation);t.appendChild(i.element)}Lg(this.domNodes.docs,g3("p",{},t))}if(void 0===n.documentation);else if("string"==typeof n.documentation)Lg(this.domNodes.docs,g3("p",{},n.documentation));else{const t=this.renderMarkdownDocs(n.documentation);Lg(this.domNodes.docs,t.element)}const u=this.hasDocs(n,c);if(this.domNodes.signature.classList.toggle("has-docs",u),this.domNodes.docs.classList.toggle("empty",!u),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,c){let t="";const i=n.parameters[h];t=Array.isArray(i.label)?n.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),n.documentation&&(t+="string"==typeof n.documentation?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==t&&(Yg(e(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&&Ot(i.documentation).length>0||i&&"object"==typeof i.documentation&&Ot(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&Ot(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&Ot(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),Lg(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|^)${In(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 t.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)}};v3.ID="editor.widget.parameterHintsWidget",v3=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}([f3(2,Qo),f3(3,W_),f3(4,hc)],v3),fm("editorHoverWidget.highlightForeground",{dark:dw,light:dw,hcDark:dw,hcLight:dw},e(0,"Foreground color of the active item in the parameter hint."));var w3=function(t,i){return function(e,s){i(e,s,t)}};let b3=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new a3(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(v3,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)}};b3.ID="editor.controller.parameterHints",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}([w3(1,eo),w3(2,ka)],b3),$p(b3.ID,b3,2),Np(class extends Tp{constructor(){super({id:"editor.action.triggerParameterHints",label:e(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:PC.hasSignatureHelpProvider,kbOpts:{kbExpr:PC.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=b3.get(i);null==e||e.trigger({triggerKind:Es.Invoke})}});const y3=Fp.bindToContribution(b3.get);Pp(new y3({id:"closeParameterHints",precondition:c3.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:PC.focus,primary:9,secondary:[1033]}})),Pp(new y3({id:"showPrevParameterHint",precondition:Oo.and(c3.Visible,c3.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:PC.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),Pp(new y3({id:"showNextParameterHint",precondition:Oo.and(c3.Visible,c3.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:PC.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var k3=function(t,i){return function(e,s){i(e,s,t)}};const C3=new Jo("renameInputVisible",!1,e(0,"Whether the rename input widget is visible"));let S3=class{constructor(t,i,e,s,n){this._editor=t,this._acceptKeybindings=i,this._themeService=e,this._keybindingService=s,this._disposables=new Vi,this.allowEditorOverflow=!0,this._visibleContextKey=C3.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(48)&&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",e(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(km),o=t.getColor(Cm);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(dv))&&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(xm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(Sm))&&void 0!==s?s:"");const h=t.getColor(Dm);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(48);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[s,n]=this._acceptKeybindings;return this._label.innerText=e(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(s))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(n))||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 Vi;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((()=>this.cancelInput(!document.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)}};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}([k3(2,Yy),k3(3,eP),k3(4,Qo)],S3);var x3=function(t,i){return function(e,s){i(e,s,t)}},D3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class E3{constructor(t,i,e){this.model=t,this.position=i,this._providerRenameIdx=0,this._providers=e.ordered(t)}hasProvider(){return this._providers.length>0}resolveRenameLocation(t){return D3(this,void 0,void 0,(function*(){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=yield e.resolveRenameLocation(this.model,this.position,t);if(s){if(!s.rejectReason)return s;i.push(s.rejectReason)}}const e=this.model.getWordAtPosition(this.position);return e?{range:new ws(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:ws.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}))}provideRenameEdits(t,i){return D3(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,s,n){return D3(this,void 0,void 0,(function*(){const r=this._providers[i];if(!r)return{edits:[],rejectReason:s.join("\n")};const o=yield r.provideRenameEdits(this.model,this.position,t,n);return o?o.rejectReason?this._provideRenameEdits(t,i+1,s.concat(o.rejectReason),n):o:this._provideRenameEdits(t,i+1,s.concat(e(0,"No result.")),n)}))}}let A3=class t{static get(i){return i.getContribution(t.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 Vi,this._cts=new pe,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(S3,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return D3(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),this._cts=new pe,!this.editor.hasModel())return;const s=this.editor.getPosition(),n=new E3(this.editor.getModel(),s,this._languageFeaturesService.renameProvider);if(!n.hasProvider())return;const r=new UH(this.editor,5,void 0,this._cts.token);let o;try{const t=n.resolveRenameLocation(r.token);this._progressService.showWhile(t,250),o=yield t}catch(i){return void(null===(t=kK.get(this.editor))||void 0===t||t.showMessage(i||e(0,"An unknown error occurred while resolving rename location"),s))}finally{r.dispose()}if(!o)return;if(o.rejectReason)return void(null===(i=kK.get(this.editor))||void 0===i||i.showMessage(o.rejectReason,s));if(r.token.isCancellationRequested)return;const h=new UH(this.editor,5,o.range,this._cts.token),c=this.editor.getSelection();let u=0,l=o.text.length;ws.isEmpty(c)||ws.spansMultipleLines(c)||!ws.containsRange(o.range,c)||(u=Math.max(0,c.startColumn-o.range.startColumn),l=Math.min(o.range.endColumn,c.endColumn)-o.range.startColumn);const a=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),d=yield this._renameInputField.getInput(o.range,o.text,u,l,a,h.token);if("boolean"==typeof d)return d&&this.editor.focus(),void h.dispose();this.editor.focus();const f=iu(n.provideRenameEdits(d.newName,h.token),h.token).then((t=>D3(this,void 0,void 0,(function*(){t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(ws.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:d.wantsPreview,label:e(0,"Renaming '{0}' to '{1}'",null==o?void 0:o.text,d.newName),code:"undoredo.rename",quotableLabel:e(0,"Renaming {0} to {1}",null==o?void 0:o.text,d.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&Yg(e(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",o.text,d.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(e(0,"Rename failed to apply edits")),this._logService.error(t)}))))}))),(t=>{this._notificationService.error(e(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{h.dispose()}));return this._progressService.showWhile(f,250),f}))}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};A3.ID="editor.contrib.renameController",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}([x3(1,eo),x3(2,IM),x3(3,TI),x3(4,qR),x3(5,pa),x3(6,fa),x3(7,ka)],A3),$p(A3.ID,A3,4),Np(class extends Tp{constructor(){super({id:"editor.action.rename",label:e(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Oo.and(PC.writable,PC.hasRenameProvider),kbOpts:{kbExpr:PC.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(ro),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return os.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)))))}),Ei):super.runCommand(t,i)}run(t,i){const e=A3.get(i);return e?e.run():Promise.resolve()}});const L3=Fp.bindToContribution(A3.get);function M3(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 R()||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),Th.wrap(i)}(i)}Pp(new L3({id:"acceptRenameInput",precondition:C3,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:3}})),Pp(new L3({id:"acceptRenameInputWithPreview",precondition:Oo.and(C3,Oo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Oo.and(PC.focus,Oo.not("isComposing")),primary:1027}})),Pp(new L3({id:"cancelRenameInput",precondition:C3,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:PC.focus,primary:9,secondary:[1033]}})),Ip("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;Mt("string"==typeof n);const{renameProvider:r}=t.get(ka);return function(t,i,e,s){return D3(this,void 0,void 0,(function*(){const n=new E3(i,e,t),r=yield n.resolveRenameLocation(fe.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,fe.None)}))}(r,i,e,n)})),Ip("_executePrepareRename",(function(t,i,e){return D3(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get(ka),n=new E3(i,e,s),r=yield n.resolveRenameLocation(fe.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),dc.as(mc).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:e(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var O3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function F3(t){return t&&!!t.data}function T3(t){return t&&Array.isArray(t.edits)}class R3{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function _3(t,i){return t.has(i)}function I3(t,i,e,s,n){return O3(this,void 0,void 0,(function*(){const r=function(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}(t,i),o=yield Promise.all(r.map((t=>O3(this,void 0,void 0,(function*(){let r,o=null;try{r=yield t.provideDocumentSemanticTokens(i,t===e?s:null,n)}catch(t){o=t,r=null}return r&&(F3(r)||T3(r))||(r=null),new R3(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 P3{constructor(t,i){this.provider=t,this.tokens=i}}function N3(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function B3(t,i,e,s){return O3(this,void 0,void 0,(function*(){const n=N3(t,i),r=yield Promise.all(n.map((t=>O3(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&F3(n)||(n=null),new P3(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}fp.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e]=i;Mt(e instanceof os);const s=t.get(Zc).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(ka),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(dp).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),fp.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e]=i;Mt(e instanceof os);const s=t.get(Zc).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(ka);if(!_3(n,s))return t.get(dp).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield I3(n,s,null,null,fe.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!F3(h))return;const c=M3({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),fp.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(e instanceof os);const n=t.get(Zc).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(ka),o=N3(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!ws.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=yield B3(r,n,ws.lift(s),fe.None);return h?h.provider.getLegend():void 0})))),fp.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>O3(void 0,void 0,void 0,(function*(){const[e,s]=i;Mt(e instanceof os),Mt(ws.isIRange(s));const n=t.get(Zc).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(ka),o=yield B3(r,n,ws.lift(s),fe.None);return o&&o.tokens?M3({id:0,type:"full",data:o.tokens.data}):void 0}))));const $3="editor.semanticHighlighting";function j3(t,i,e){var s;const n=null===(s=e.getValue($3,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var W3=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},V3=function(t,i){return function(e,s){i(e,s,t)}};let H3=class extends Hi{constructor(t,i,e,s,n,r){super(),this._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new z3(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()];j3(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{j3(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($3)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};H3=W3([V3(0,eI),V3(1,Zc),V3(2,Yy),V3(3,ic),V3(4,z_),V3(5,ka)],H3);let z3=class t extends Hi{constructor(i,e,s,n,r){super(),this._semanticTokensStylingService=e,this._isDisposed=!1,this._model=i,this._provider=r.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:t.REQUEST_MIN_DELAY,max:t.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new lu((()=>this._fetchDocumentSemanticTokensNow()),t.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 o=()=>{$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const t of this._provider.all(i))"function"==typeof t.onDidChange&&this._documentProvidersChangeListeners.push(t.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};o(),this._register(this._provider.onDidChange((()=>{o(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(s.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),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!_3(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new pe,i=I3(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 Ji(!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"))||Ei(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(i,e,s,n){const r=this._currentDocumentResponse,o=()=>{(n.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)i&&e&&i.releaseDocumentSemanticTokens(e.resultId);else if(i&&s){if(!e)return this._model.tokenization.setSemanticTokens(null,!0),void o();if(T3(e)){if(!r)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===e.edits.length)e={resultId:e.resultId,data:r.data};else{let i=0;for(const t of e.edits)i+=(t.data?t.data.length:0)-t.deleteCount;const n=r.data,o=new Uint32Array(n.length+i);let h=n.length,c=o.length;for(let i=e.edits.length-1;i>=0;i--){const u=e.edits[i];if(u.start>n.length)return s.warnInvalidEditStart(r.resultId,e.resultId,i,u.start,n.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=h-(u.start+u.deleteCount);l>0&&(t._copy(n,h-l,o,c-l,l),c-=l),u.data&&(t._copy(u.data,0,o,c-u.data.length,u.data.length),c-=u.data.length),h=u.start}h>0&&t._copy(n,0,o,0,h),e={resultId:e.resultId,data:o}}}if(F3(e)){this._currentDocumentResponse=new U3(i,e.resultId,e.data);const t=X_(e,s,this._model.getLanguageId());if(n.length>0)for(const i of n)for(const e of t)for(const t of i.changes)e.applyEdit(t.range,t.text);this._model.tokenization.setSemanticTokens(t,!0)}else this._model.tokenization.setSemanticTokens(null,!0);o()}else this._model.tokenization.setSemanticTokens(null,!1)}};z3.REQUEST_MIN_DELAY=300,z3.REQUEST_MAX_DELAY=2e3,z3=W3([V3(1,eI),V3(2,Yy),V3(3,z_),V3(4,ka)],z3);class U3{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}ZV(H3);var K3=function(t,i){return function(e,s){i(e,s,t)}};let q3=class extends Hi{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 lu((()=>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($3)&&(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(!j3(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=tu((e=>Promise.resolve(B3(this._provider,t,i,e)))),n=new Ji(!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,X_(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};q3.ID="editor.contrib.viewportSemanticTokens",q3=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}([K3(1,eI),K3(2,Yy),K3(3,ic),K3(4,z_),K3(5,ka)],q3),$p(q3.ID,q3,1);class G3{provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),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,u=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(Jn(t)&&Qn(u))break;u=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(Qn(t)&&Jn(u))break;if(95===t||45===t)break;u=t}h<c&&t.push({range:new ws(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new ws(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 ws(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var Z3=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class J3{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 J3(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let Q3=class t{static get(i){return i.getContribution(t.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()}run(t){return Z3(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),e=this._editor.getModel();if(this._state||(yield X3(this._languageFeaturesService.selectionRangeProvider,e,i.map((t=>t.getPosition())),this._editor.getOption(109),fe.None).then((t=>{var e;if(et(t)&&t.length===i.length&&this._editor.hasModel()&&G(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 J3(0,t))),null===(e=this._selectionListener)||void 0===e||e.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 s=this._state.map((t=>bs.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(s)}finally{this._ignoreSelection=!1}}))}};Q3.ID="editor.contrib.smartSelectController",Q3=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,ka)],Q3);class Y3 extends Tp{constructor(t,i){super(i),this._forward=t}run(t,i){return Z3(this,void 0,void 0,(function*(){const t=Q3.get(i);t&&(yield t.run(this._forward))}))}}function X3(t,i,e,s,n){return Z3(this,void 0,void 0,(function*(){const r=t.all(i).concat(new G3);1===r.length&&r.unshift(new R2);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(et(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])ws.isIRange(s.range)&&ws.containsPosition(s.range,e[i])&&h[i].push(ws.lift(s.range))}}),Ai));return yield 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||ws.containsRange(i,n)&&!ws.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 ws(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 ws(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}))}))}fp.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),$p(Q3.ID,Q3,4),Np(class extends Y3{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:e(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"1_basic",title:e(0,"&&Expand Selection"),order:2}})}}),Np(class extends Y3{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:e(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:PC.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:bp.MenubarSelectionMenu,group:"1_basic",title:e(0,"&&Shrink Selection"),order:3}})}}),fp.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return Z3(this,void 0,void 0,(function*(){const[e,s]=i;Mt(os.isUri(e));const n=t.get(ka).selectionRangeProvider,r=yield t.get(ep).createModelReference(e);try{return X3(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0},fe.None)}finally{r.dispose()}}))}));const t6=Object.freeze({View:{value:e(0,"View"),original:"View"},Help:{value:e(0,"Help"),original:"Help"},Test:{value:e(0,"Test"),original:"Test"},File:{value:e(0,"File"),original:"File"},Preferences:{value:e(0,"Preferences"),original:"Preferences"},Developer:{value:e(0,"Developer"),original:"Developer"}});class i6{constructor(t,i){this.lineNumbers=t,this.lastLineRelativePosition=i}}const e6=Lu("stickyScrollViewLayer",{createHTML:t=>t});class s6 extends Hi{constructor(t){super(),this._editor=t,this._rootDomNode=document.createElement("div"),this._disposableStore=this._register(new Vi),this._lineNumbers=[],this._lastLineRelativePosition=0,this._hoverOnLine=-1,this._hoverOnColumn=-1,this._layoutInfo=this._editor.getLayoutInfo(),this._rootDomNode=document.createElement("div"),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof eG),this._rootDomNode.style.width=this._layoutInfo.width-this._layoutInfo.minimap.minimapCanvasOuterWidth-this._layoutInfo.verticalScrollbarWidth+"px"}get hoverOnLine(){return this._hoverOnLine}get hoverOnColumn(){return this._hoverOnColumn}get lineNumbers(){return this._lineNumbers}getCurrentLines(){return this._lineNumbers}setState(t){Kf(this._rootDomNode),this._disposableStore.clear(),this._lineNumbers.length=0;const i=this._editor.getOption(64);t.lineNumbers.length*i+t.lastLineRelativePosition>0?(this._lastLineRelativePosition=t.lastLineRelativePosition,this._lineNumbers=t.lineNumbers):(this._lastLineRelativePosition=0,this._lineNumbers=[]),this._renderRootNode()}_renderRootNode(){if(!this._editor._getViewModel())return;for(const[t,i]of this._lineNumbers.entries()){const e=this._renderChildNode(t,i);this._rootDomNode.appendChild(e)}const t=this._editor.getOption(64),i=this._lineNumbers.length*t+this._lastLineRelativePosition;this._rootDomNode.style.display=i>0?"block":"none",this._rootDomNode.style.height=i.toString()+"px",this._rootDomNode.setAttribute("role","list"),"left"===this._editor.getOption(70).side&&(this._rootDomNode.style.marginLeft=this._editor.getLayoutInfo().minimap.minimapCanvasOuterWidth+"px")}_renderChildNode(t,i){const e=document.createElement("div"),s=this._editor._getViewModel(),n=s.coordinatesConverter.convertModelPositionToViewPosition(new vs(i,1)).lineNumber,r=s.getViewLineRenderingData(n),o=this._editor.getLayoutInfo(),h=o.width-o.minimap.minimapCanvasOuterWidth-o.verticalScrollbarWidth,c=this._editor.getOption(70).side,u=this._editor.getOption(64),l=this._editor.getOption(65);let a;try{a=Pa.filter(r.inlineDecorations,n,r.minColumn,r.maxColumn)}catch(t){a=[]}const d=new Va(!0,!0,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,0,r.tokens,a,r.tabSize,r.startVisibleColumn,1,1,1,500,"none",!0,!0,null),f=new Wh(2e3);let g;Ka(d,f),g=e6?e6.createHTML(f.build()):f.build();const p=document.createElement("span");p.className="sticky-line",p.classList.add(`stickyLine${i}`),p.style.lineHeight=`${u}px`,p.innerHTML=g;const m=document.createElement("span");m.className="sticky-line",m.style.lineHeight=`${u}px`,"left"===c?m.style.width=o.contentLeft-o.minimap.minimapCanvasOuterWidth+"px":"right"===c&&(m.style.width=`${o.contentLeft}px`);const v=document.createElement("span");return 1===l.renderType||3===l.renderType&&i%10==0?v.innerText=i.toString():2===l.renderType&&(v.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),v.className="sticky-line-number",v.style.lineHeight=`${u}px`,v.style.width=`${o.lineNumbersWidth}px`,"left"===c?v.style.paddingLeft=o.lineNumbersLeft-o.minimap.minimapCanvasOuterWidth+"px":"right"===c&&(v.style.paddingLeft=`${o.lineNumbersLeft}px`),m.appendChild(v),this._editor.applyFontInfo(p),this._editor.applyFontInfo(v),e.appendChild(m),e.appendChild(p),e.className="sticky-line-root",e.setAttribute("role","listitem"),e.tabIndex=0,e.style.lineHeight=`${u}px`,e.style.width=`${h}px`,e.style.height=`${u}px`,e.style.zIndex="0",t===this._lineNumbers.length-1&&(e.style.position="relative",e.style.zIndex="-1",e.style.top=this._lastLineRelativePosition+"px"),this._disposableStore.add(Zf(e,"mouseover",(t=>{if(this._editor.hasModel()){const e=new jd(t).target.innerText;this._hoverOnLine=i,this._hoverOnColumn=this._editor.getModel().getLineContent(i).indexOf(e)+1||-1}}))),e}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}}class n6{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class r6{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class o6{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var h6,c6,u6=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},l6=function(t,i){return function(e,s){i(e,s,t)}},a6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};!function(t){t.OUTLINE_MODEL="outlineModel",t.FOLDING_PROVIDER_MODEL="foldingProviderModel",t.INDENTATION_MODEL="indentationModel"}(h6||(h6={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(c6||(c6={}));let d6=class{constructor(t,i,e,s){this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=new su(300);const n=new g6(e),r=new v6(this._editor,e),o=new m6(this._editor,i);switch(s){case h6.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case h6.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case h6.INDENTATION_MODEL:this._modelProviders.push(o)}this._store=new Vi}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return a6(this,void 0,void 0,(function*(){return this._store.clear(),this._store.add({dispose:()=>{var t;this._cancelModelPromise(),null===(t=this._updateScheduler)||void 0===t||t.cancel()}}),this._cancelModelPromise(),yield this._updateScheduler.trigger((()=>a6(this,void 0,void 0,(function*(){for(const s of this._modelProviders){const{statusPromise:n,modelPromise:r}=s.computeStickyModel(t,i,e);this._modelPromise=r;const o=yield n;if(this._modelPromise!==r)return null;switch(o){case c6.CANCELED:return this._store.clear(),null;case c6.VALID:return s.stickyModel}}return null}))))}))}};d6=u6([l6(1,_c),l6(2,ka)],d6);class f6{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,c6.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=tu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?c6.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),c6.VALID):this._invalid())).then(void 0,(t=>(Ei(t),c6.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let g6=class extends f6{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return A1.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 o6(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(B.first(t.children.values())instanceof E1){const s=B.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 n6(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new n6(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 r6(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 n6(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new r6(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 D1?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};g6=u6([l6(0,ka)],g6);class p6 extends f6{constructor(t){super(),this._foldingLimitReporter=new f1(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new o6(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new r6(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 r6(new n6(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let m6=class extends p6{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new Q0(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};m6=u6([l6(1,_c)],m6);let v6=class extends p6{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return d1.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=d1.getFoldingRangeProviders(this._languageFeaturesService,t);return new c1(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};v6=u6([l6(1,ka)],v6);var w6=function(t,i){return function(e,s){i(e,s,t)}},b6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class y6{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let k6=class extends Hi{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._store.add(new ee),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=new Vi,this._updateSoon=this._register(new lu((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(111)&&this.readConfiguration()}))),this.readConfiguration()}dispose(){super.dispose(),this._sessionStore.dispose()}readConfiguration(){this._options=this._editor.getOption(111),this._options.enabled?(this._stickyModelProvider=new d6(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel),this._sessionStore.add(this._editor.onDidChangeModel((()=>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()):this._sessionStore.clear()}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}update(){var t;return b6(this,void 0,void 0,(function*(){null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new pe,yield this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}))}updateStickyModel(t){return b6(this,void 0,void 0,(function*(){if(!this._editor.hasModel()||!this._stickyModelProvider)return;const i=this._editor.getModel(),e=i.getVersionId(),s=this._model&&!GD(this._model.uri,i.uri)?setTimeout((()=>{t.isCancellationRequested||(this._model=new o6(i.uri,i.getVersionId(),void 0,void 0),this._onDidChangeStickyScroll.fire())}),75):void 0;this._model=yield this._stickyModelProvider.update(i,e,t),clearTimeout(s)}))}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,s,n){if(0===i.children.length)return;let r=n;const o=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&o.push(e.range.startLineNumber)}const h=this.updateIndex(Z(o,t.startLineNumber,((t,i)=>t-i))),c=this.updateIndex(Z(o,t.startLineNumber+s,((t,i)=>t-i)));for(let o=h;o<=c;o++){const h=i.children[o];if(!h)return;if(h.range){const i=h.range.startLineNumber,n=h.range.endLineNumber;t.startLineNumber<=n+1&&i-1<=t.endLineNumber&&i!==r&&(r=i,e.push(new y6(i,n-1,s+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,s+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,s,n)}}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}};k6=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}([w6(1,ka),w6(2,_c)],k6);var C6=function(t,i){return function(e,s){i(e,s,t)}},S6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let x6=class t extends Hi{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 Vi,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._stickyScrollWidget=new s6(this._editor),this._stickyLineCandidateProvider=new k6(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i6([],0),this._readConfiguration(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(111)&&this._readConfiguration()}))),this._register(Zf(this._stickyScrollWidget.getDomNode(),xg.CONTEXT_MENU,(t=>S6(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=PC.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=PC.stickyScrollVisible.bindTo(this._contextKeyService);const h=this._register(Ag(this._stickyScrollWidget.getDomNode()));this._register(h.onDidBlur((()=>{const t=this._stickyScrollWidget.getDomNode().clientHeight;!1===this._positionRevealed&&0===t?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(h.onDidFocus((()=>{this.focus()}))),this._register(this._createClickLinkGesture()),this._register(Zf(this._stickyScrollWidget.getDomNode(),xg.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(i){return i.getContribution(t.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();if(!0===this._stickyScrollFocusedContextKey.get())return;this._focused=!0,this._focusDisposableStore=new Vi,this._stickyScrollFocusedContextKey.set(!0);const t=this._stickyScrollWidget.getDomNode();t.lastElementChild.focus(),this._stickyElements=t.children,this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1}focusNext(){this._focusedStickyElementIndex<this._stickyElements.length-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._stickyElements.item(this._focusedStickyElementIndex).focus()}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._positionRevealed=!0,this._editor.revealPosition(t),this._editor.setSelection(ws.fromPositions(t)),this._editor.focus()}_createClickLinkGesture(){const t=new Vi,i=new Vi;t.add(i);const e=new tG(this._editor,!0);return t.add(e),t.add(e.onMouseMoveOrRelevantKeyDown((([t,e])=>{if(!this._editor.hasModel()||!t.hasTriggerModifier)return void i.clear();const s=t.target;if(s.detail===this._stickyScrollWidget.getId()&&s.element.innerText===s.element.innerHTML){if(-1===this._stickyScrollWidget.hoverOnColumn)return;const t=this._stickyScrollWidget.hoverOnLine,e=this._stickyScrollWidget.hoverOnColumn,n=new ws(t,e,t,e+s.element.innerText.length);if(n.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===s.element.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=n,i.clear();const r=new pe;let o;i.add(Wi((()=>r.dispose(!0)))),eZ(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new vs(t,e+1),r.token).then((t=>{if(!r.token.isCancellationRequested)if(0!==t.length){this._candidateDefinitionsLength=t.length;const e=s.element;o!==e?(i.clear(),o=e,o.style.textDecoration="underline",i.add(Wi((()=>{o.style.textDecoration="none"})))):o||(o=e,o.style.textDecoration="underline",i.add(Wi((()=>{o.style.textDecoration="none"}))))}else i.clear()}))}else i.clear()}))),t.add(e.onCancel((()=>{i.clear()}))),t.add(e.onExecute((t=>S6(this,void 0,void 0,(function*(){t.target.detail===this._stickyScrollWidget.getId()&&(t.hasTriggerModifier?(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:this._stickyScrollWidget.hoverOnLine,column:1})),this._instaService.invokeFunction(Q4,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})):t.isRightClick||(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:this._stickyScrollWidget.hoverOnLine,column:this._stickyScrollWidget.hoverOnColumn})))}))))),t}_onContextMenu(t){this._contextMenuService.showContextMenu({menuId:bp.StickyScrollContext,getAnchor:()=>t})}_readConfiguration(){const t=this._editor.getOption(111);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((()=>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._renderStickyScroll()))),this._enabled=!0),2===this._editor.getOption(65).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>this._renderStickyScroll())))}_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()}_onDidResize(){const t=this._editor.getLayoutInfo(),i=t.width-t.minimap.minimapCanvasOuterWidth-t.verticalScrollbarWidth;this._stickyScrollWidget.getDomNode().style.width=`${i}px`;const e=t.height/this._editor.getOption(64);this._maxStickyLines=Math.round(.25*e)}_renderStickyScroll(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._stickyLineCandidateProvider.getVersionId();if(void 0===i||i===t.getVersionId())if(this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.lineNumbers.length)),this._focused)if(this._stickyElements=this._stickyScrollWidget.getDomNode().children,-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState),this._focusedStickyElementIndex=this._stickyElements.length-1,-1!==this._focusedStickyElementIndex&&this._stickyElements.item(this._focusedStickyElementIndex).focus();else{const t=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState),0===this._stickyElements.length?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(t)||(this._focusedStickyElementIndex=this._stickyElements.length-1),this._stickyElements.item(this._focusedStickyElementIndex).focus())}else this._stickyScrollWidget.setState(this._widgetState)}findScrollWidgetState(){const t=this._editor.getOption(64),i=Math.min(this._maxStickyLines,this._editor.getOption(111).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=this._editor.getVisibleRanges();if(0!==r.length){const o=new n6(r[0].startLineNumber,r[r.length-1].endLineNumber),h=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(o);for(const r of h){const o=r.startLineNumber,h=r.endLineNumber,c=r.nestingDepth;if(h-o>0){const r=(c-1)*t,u=c*t,l=this._editor.getBottomForLineNumber(o)-e,a=this._editor.getTopForLineNumber(h)-e,d=this._editor.getBottomForLineNumber(h)-e;if(r>a&&r<=d){n.push(o),s=d-u;break}if(u>l&&u<=d&&n.push(o),n.length===i)break}}}return new i6(n,s)}dispose(){super.dispose(),this._sessionStore.dispose()}};x6.ID="store.contrib.stickyScrollController",x6=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}([C6(1,zR),C6(2,ka),C6(3,eo),C6(4,_c),C6(5,z_),C6(6,Qo)],x6);const D6=100;$p(x6.ID,x6,1),Ep(class extends Dp{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:e(0,"Toggle Sticky Scroll"),mnemonicTitle:e(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:t6.View,toggled:{condition:Oo.equals("config.editor.stickyScroll.enabled",!0),title:e(0,"Sticky Scroll"),mnemonicTitle:e(0,"&&Sticky Scroll")},menu:[{id:bp.CommandPalette},{id:bp.MenubarViewMenu,group:"5_editor",order:2},{id:bp.StickyScrollContext}]})}run(t){return i=this,e=void 0,n=function*(){const i=t.get(ic),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)},new((s=void 0)||(s=Promise))((function(t,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(i){var e;i.done?t(i.value):(e=i.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,h)}c((n=n.apply(i,e||[])).next())}));var i,e,s,n}}),Ep(class extends _p{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:e(0,"Focus Sticky Scroll"),mnemonicTitle:e(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Oo.and(Oo.has("config.editor.stickyScroll.enabled"),PC.stickyScrollVisible),menu:[{id:bp.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focus()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:e(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:16}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focusPrevious()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:e(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:18}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.focusNext()}}),Ep(class extends _p{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:e(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:3}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.goToFocused()}}),Ep(class extends _p{constructor(){super({id:"editor.action.selectEditor",title:{value:e(0,"Select Editor"),original:"Select Editor"},precondition:PC.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:D6,primary:9}})}runEditorCommand(t,i){var e;null===(e=x6.get(i))||void 0===e||e.selectEditor()}});var E6=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},A6=function(t,i){return function(e,s){i(e,s,t)}};class L6{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 M6=class extends Ui{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=B.slice(e,s),r=B.slice(e,0,s);let o=5;for(const e of B.concat(n,r)){if(e.score===pF.Default)continue;const s=new ws(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new L6(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}};M6=E6([A6(5,M2)],M6);let O6=class{constructor(t,i,e,s){this._getEditorOption=t,this._languageFeatureService=i,this._clipboardService=e,this._suggestMemoryService=s}provideInlineCompletions(t,i,e,s){var n,r,o,h,c;return r=this,o=void 0,c=function*(){if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(86,t);if(bJ.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"!==bJ.valueFor(r,h))return;let c,u,l=t.getWordAtPosition(i);if((null==l?void 0:l.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==l?void 0:l.word)&&!c)return;if(l||(l=t.getWordUntilPosition(i)),l.endColumn!==i.column)return;const a=t.getValueInRange(new ws(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,l))){const t=new I2(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),u=this._lastResult}else{const e=yield mJ(this._languageFeatureService.completionProvider,t,i,new gJ(void 0,void 0,null==c?void 0:c.providers),c&&{triggerKind:1,triggerCharacter:c.ch},s);let n;e.needsClipboard&&(n=yield this._clipboardService.readText());const r=new P2(e.items,i.column,new I2(a,0),_2.None,this._getEditorOption(114,t),this._getEditorOption(108,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);u=new M6(t,i.lineNumber,l,r,e,this._suggestMemoryService)}return this._lastResult=u,u},new((h=void 0)||(h=Promise))((function(t,i){function e(t){try{n(c.next(t))}catch(t){i(t)}}function s(t){try{n(c.throw(t))}catch(t){i(t)}}function n(i){var n;i.done?t(i.value):(n=i.value,n instanceof h?n:new h((function(t){t(n)}))).then(e,s)}n((c=c.apply(r,o||[])).next())}))}handleItemDidShow(t,i){i.completion.resolve(fe.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(ws.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}}};O6=E6([A6(1,ka),A6(2,VR),A6(3,M2)],O6);let F6=class t{constructor(i,e,s,n){if(1==++t._counter){const r=n.createInstance(O6,((t,e)=>{var n;return(null!==(n=s.listCodeEditors().find((t=>t.getModel()===e)))&&void 0!==n?n:i).getOption(t)}));t._disposable=e.inlineCompletionsProvider.register("*",r)}}dispose(){var i;0==--t._counter&&(null===(i=t._disposable)||void 0===i||i.dispose(),t._disposable=void 0)}};F6._counter=0,F6=E6([A6(1,ka),A6(2,ro),A6(3,eo)],F6),$p("suggest.inlineCompletionsProvider",F6,0),Np(class extends Tp{constructor(){super({id:"editor.action.forceRetokenize",label:e(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 Ji(!0);e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class T6 extends Dp{constructor(){super({id:T6.ID,title:{value:e(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(t){const i="terminal"===t.get(Qo).getContextKeyValue("focusedView")?"terminalFocus":"editorFocus",s=!Yp.getTabFocusMode(i);Yp.setTabFocusMode(s,i),Yg(e(0,s?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}T6.ID="editor.action.toggleTabFocusMode",Ep(T6);let R6=class extends Hi{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=Lg(t,Rg("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 Ny(this.el,"click")),o=this._register(new Ny(this.el,"keypress")),h=Qi.chain(o.event).map((t=>new Pd(t))).filter((t=>3===t.keyCode)).event,c=this._register(new Ny(this.el,om.Tap)).event;this._register(hm.addTarget(this.el));const u=Qi.any(r.event,h,c);this._register(u((t=>{this.enabled&&(Dg(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};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)}}(3,W_)],R6);var _6=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=function(t,i){return function(e,s){i(e,s,t)}};let P6=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(N6))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(t){this.banner.show(Object.assign(Object.assign({},t),{onClose:()=>{var i;this.hide(),null===(i=t.onClose)||void 0===i||i.call(t)}})),this._editor.setBanner(this.banner.element,26)}};P6=_6([I6(1,eo)],P6);let N6=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(RJ,{}),this.element=Rg("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=Rg("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Kf(this.element)}show(t){Kf(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Lg(this.element,Rg("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Rg(`div${np.asCSSSelector(t.icon)}`));const s=Lg(this.element,Rg("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Lg(this.element,Rg("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(R6,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Lg(this.element,Rg("div.action-container"));this.actionBar=this._register(new kR(n)),this.actionBar.push(this._register(new op("banner.close","Close Banner",np.asClassName(LR),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};N6=_6([I6(0,eo)],N6);var B6=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},$6=function(t,i){return function(e,s){i(e,s,t)}},j6=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};const W6=SR("extensions-warning-message",Ss.warning,e(0,"Icon shown with a warning message in the extensions editor."));let V6=class extends Hi{constructor(t,i,s,n){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=s,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 s;if(t.nonBasicAsciiCharacterCount>=i)s={message:e(0,"This document contains many non-basic ASCII unicode characters"),command:new t9};else if(t.ambiguousCharacterCount>=i)s={message:e(0,"This document contains many ambiguous unicode characters"),command:new Y6};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");s={message:e(0,"This document contains many invisible unicode characters"),command:new X6}}this._bannerController.show({id:"unicodeHighlightBanner",message:s.message,icon:W6,actions:[{label:s.command.shortLabel,href:`command:${s.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(P6,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(121),this._register(s.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(121)&&(this._options=t.getOption(121),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===di?!t:i.nonBasicASCII,ambiguousCharacters:i.ambiguousCharacters,invisibleCharacters:i.invisibleCharacters,includeComments:i.includeComments===di?!t:i.includeComments,includeStrings:i.includeStrings===di?!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?A:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new H6(this._editor,i,this._updateState,this._editorWorkerService):new z6(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};V6.ID="editor.contrib.unicodeHighlighter",V6=B6([$6(1,$R),$6(2,IP),$6(3,eo)],V6);let H6=class extends Hi{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 lu((()=>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:Z6.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return cM(i,t)?{reason:G6(i.getValueInRange(t.range),this._options),inComment:uM(i,t),inString:lM(i,t)}:null}};H6=B6([$6(3,$R)],H6);class z6 extends Hi{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 lu((()=>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=pl.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:Z6.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 cM(i,t)?{reason:G6(e,this._options),inComment:uM(i,t),inString:lM(i,t)}:null}}let U6=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 s=this._editor.getModel(),n=this._editor.getContribution(V6.ID);if(!n)return[];const r=[];let o=300;for(const t of i){const i=n.getDecorationInfo(t);if(!i)continue;const h=s.getValueInRange(t.range).codePointAt(0),c=q6(h);let u;switch(i.reason.kind){case 0:u=fr(i.reason.confusableWith)?e(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,q6(i.reason.confusableWith.codePointAt(0))):e(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,q6(i.reason.confusableWith.codePointAt(0)));break;case 1:u=e(0,"The character {0} is invisible.",c);break;case 2:u=e(0,"The character {0} is not a basic ASCII character.",c)}const l={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},a=e(0,"Adjust settings"),d=`command:${i9.ID}?${encodeURIComponent(JSON.stringify(l))}`,f=new MF("",!0).appendMarkdown(u).appendText(" ").appendLink(d,a);r.push(new VJ(this,t.range,[f],!1,o++))}return r}renderHoverParts(t,i){return zJ(t,i,this._editor,this._languageService,this._openerService)}};function K6(t){return`U+${t.toString(16).padStart(4,"0")}`}function q6(t){let i=`\`${K6(t)}\``;return Dr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function G6(t,i){return pl.computeUnicodeHighlightReason(t,i)}U6=B6([$6(1,hc),$6(2,W_)],U6);class Z6{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=sL.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}}Z6.instance=new Z6;class J6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=e(0,"Disable Highlight In Comments")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class Q6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=e(0,"Disable Highlight In Strings")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class Y6 extends Tp{constructor(){super({id:Y6.ID,label:e(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=e(0,"Disable Ambiguous Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}Y6.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class X6 extends Tp{constructor(){super({id:X6.ID,label:e(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=e(0,"Disable Invisible Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}X6.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class t9 extends Tp{constructor(){super({id:t9.ID,label:e(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=e(0,"Disable Non ASCII Highlight")}run(t,i,e){return j6(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(ic);i&&this.runAction(i)}))}runAction(t){return j6(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}t9.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class i9 extends Tp{constructor(){super({id:i9.ID,label:e(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(t,i,s){return j6(this,void 0,void 0,(function*(){const{codePoint:i,reason:n,inString:r,inComment:o}=s,h=String.fromCodePoint(i),c=t.get(Kj),u=t.get(ic),l=[];if(0===n.kind)for(const t of n.notAmbiguousInLocales)l.push({label:e(0,'Allow unicode characters that are more common in the language "{0}".',t),run:()=>j6(this,void 0,void 0,(function*(){e9(u,[t])}))});if(l.push({label:function(t){return Dr.isInvisibleCharacter(t)?e(0,"Exclude {0} (invisible character) from being highlighted",K6(t)):e(0,"Exclude {0} from being highlighted",`${K6(t)} "${h}"`)}(i),run:()=>function(t,i){return j6(this,void 0,void 0,(function*(){const e=t.getValue(fi);let s;s="object"==typeof e&&e?e:{};for(const t of i)s[String.fromCodePoint(t)]=!0;yield t.updateValue(fi,s,2)}))}(u,[i])}),o){const t=new J6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(r){const t=new Q6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}if(0===n.kind){const t=new Y6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(1===n.kind){const t=new X6;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else if(2===n.kind){const t=new t9;l.push({label:t.label,run:()=>j6(this,void 0,void 0,(function*(){return t.runAction(u)}))})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(n);const a=yield c.pick(l,{title:e(0,"Configure Unicode Highlight Options")});a&&(yield a.run())}))}}function e9(t,i){var e;return j6(this,void 0,void 0,(function*(){const s=null===(e=t.inspect(bi).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;yield t.updateValue(bi,n,2)}))}i9.ID="editor.action.unicodeHighlight.showExcludeOptions",Np(Y6),Np(X6),Np(t9),Np(i9),$p(V6.ID,V6,1),PZ.register(U6);var s9=function(t,i){return function(e,s){i(e,s,t)}};const n9="ignoreUnusualLineTerminators";let r9=class extends Hi{constructor(t,i,e){super(),this._editor=t,this._dialogService=i,this._codeEditorService=e,this._isPresentingDialog=!1,this._config=this._editor.getOption(122),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(122)&&(this._config=this._editor.getOption(122),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}_checkForUnusualLineTerminators(){return t=this,i=void 0,n=function*(){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,n9)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(88))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let s;try{this._isPresentingDialog=!0,s=yield this._dialogService.confirm({title:e(0,"Unusual Line Terminators"),message:e(0,"Detected unusual line terminators"),detail:e(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`.",JD(t.uri)),primaryButton:e(0,"&&Remove Unusual Line Terminators"),cancelButton:e(0,"Ignore")})}finally{this._isPresentingDialog=!1}s.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,n9,!0)}(this._codeEditorService,t)},new((s=void 0)||(s=Promise))((function(e,r){function o(t){try{c(n.next(t))}catch(t){r(t)}}function h(t){try{c(n.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(t){t(i)}))).then(o,h)}c((n=n.apply(t,i||[])).next())}));var t,i,s,n}};r9.ID="editor.contrib.unusualLineTerminatorsDetector",r9=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}([s9(1,A_),s9(2,ro)],r9),$p(r9.ID,r9,1);var o9=function(t,i){return function(e,s){i(e,s,t)}};const h9=new Jo("hasWordHighlights",!1);function c9(t,i,e,s){return hu(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),et)}class u9{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=tu((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new ws(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 l9 extends u9{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return c9(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class a9 extends u9{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return ru(250,s).then((()=>{if(!i.isEmpty())return[];const s=t.getWordAtPosition(i.getPosition());return!s||s.word.length>1e3?[]:t.findMatches(s.word,!0,!1,!0,e,!1).map((t=>({range:t.range,kind:As.Text})))}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}Ip("_executeDocumentHighlights",((t,i,e)=>c9(t.get(ka).documentHighlightProvider,i,e,fe.None)));class d9{constructor(t,i,e){this.toUnhook=new Vi,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=[],this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1,this.editor=t,this.providers=i,this._hasWordHighlights=h9.bindTo(e),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(78),this.model=this.editor.getModel(),this.toUnhook.add(t.onDidChangeCursorPosition((t=>{this._ignorePositionChangeEvent||this.occurrencesHighlight&&this._onPositionChanged(t)}))),this.toUnhook.add(t.onDidChangeModelContent((()=>{this._stopAll()}))),this.toUnhook.add(t.onDidChangeConfiguration((()=>{const t=this.editor.getOption(78);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}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(ws.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&&Yg(`${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&&Yg(`${this.editor.getModel().getLineContent(s.startLineNumber)}, ${e+1} of ${t.length} for '${i.word}'`)}finally{this._ignorePositionChangeEvent=!1}}_removeDecorations(){this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1))}_stopAll(){this._removeDecorations(),-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){this.occurrencesHighlight&&3===t.reason?this._run():this._stopAll()}_getWord(){const t=this.editor.getSelection();return this.model.getWordAtPosition({lineNumber:t.startLineNumber,column:t.startColumn})}_run(){const t=this.editor.getSelection();if(t.startLineNumber!==t.endLineNumber)return void this._stopAll();const i=t.startColumn,e=t.endColumn,s=this._getWord();if(!s||s.startColumn>i||s.endColumn<e)return void this._stopAll();const n=this.workerRequest&&this.workerRequest.isValid(this.model,t,this.decorations);if(this.lastCursorPositionChangeTime=(new Date).getTime(),n)this.workerRequestCompleted&&-1!==this.renderDecorationsTimer&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=-1,this._beginRenderDecorations());else{this._stopAll();const t=++this.workerRequestTokenId;this.workerRequestCompleted=!1,this.workerRequest=function(t,i,e,s){return t.has(i)?new l9(i,e,s,t):new a9(i,e,s)}(this.providers,this.model,this.editor.getSelection(),this.editor.getOption(126)),this.workerRequest.result.then((i=>{t===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=i||[],this._beginRenderDecorations())}),Ei)}}_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(){this.renderDecorationsTimer=-1;const t=[];for(const e of this.workerRequestValue)e.range&&t.push({range:e.range,options:(i=e.kind,i===As.Write?K5:i===As.Text?q5:J5)});var i;this.decorations.set(t),this._hasWordHighlights.set(this.hasDecorations())}dispose(){this._stopAll(),this.toUnhook.dispose()}}let f9=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i,e){super(),this.wordHighlighter=null;const s=()=>{t.hasModel()&&(this.wordHighlighter=new d9(t,e.documentHighlightProvider,i))};this._register(t.onDidChangeModel((()=>{this.wordHighlighter&&(this.wordHighlighter.dispose(),this.wordHighlighter=null),s()}))),s()}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()}};f9.ID="editor.contrib.wordHighlighter",f9=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}([o9(1,Qo),o9(2,ka)],f9);class g9 extends Tp{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=f9.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}$p(f9.ID,f9,0),Np(class extends g9{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:e(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:h9,kbOpts:{kbExpr:PC.editorTextFocus,primary:65,weight:100}})}}),Np(class extends g9{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:e(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:h9,kbOpts:{kbExpr:PC.editorTextFocus,primary:1089,weight:100}})}}),Np(class extends Tp{constructor(){super({id:"editor.action.wordHighlight.trigger",label:e(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:h9.toNegated(),kbOpts:{kbExpr:PC.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=f9.get(i);s&&s.restoreViewState(!0)}});class p9 extends Fp{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=cl(i.getOption(126)),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=>tC.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 bs(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new bs(i.lineNumber,i.column,i.lineNumber,i.column)}}class m9 extends p9{_move(t,i,e,s){return pC.moveWordLeft(t,i,e,s)}}class v9 extends p9{_move(t,i,e,s){return pC.moveWordRight(t,i,e,s)}}class w9 extends Fp{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(_c);if(!i.hasModel())return;const n=cl(i.getOption(126)),r=i.getModel(),o=i.getSelections(),h=i.getOption(5),c=i.getOption(9),u=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),l=i._getViewModel(),a=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(7),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:u,autoClosedCharacters:l.getCursorAutoClosedCharacters()},this._wordNavigationType);return new hC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class b9 extends w9{_delete(t,i){return pC.deleteWordLeft(t,i)||new ws(1,1,1,1)}}class y9 extends w9{_delete(t,i){const e=pC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ws(s,n,s,n)}}Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),Pp(new class extends m9{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),Pp(new class extends v9{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),Pp(new class extends v9{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Oo.and(PC.textInputFocus,null===(t=Oo.and(nh,j$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends m9{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends v9{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(cl(xi.wordSeparators.defaultValue),i,e,s)}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:PC.writable})}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:PC.writable})}}),Pp(new class extends b9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:PC.writable})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:PC.writable})}}),Pp(new class extends y9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),Np(class extends Tp{constructor(){super({id:"deleteInsideWord",precondition:PC.writable,label:e(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=cl(i.getOption(126)),n=i.getModel(),r=i.getSelections().map((t=>{const i=pC.deleteInsideWord(s,n,t);return new hC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class k9 extends p9{_move(t,i,e,s){return mC.moveWordPartLeft(t,i,e)}}fp.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),fp.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class C9 extends p9{_move(t,i,e,s){return mC.moveWordPartRight(t,i,e)}}Pp(new class extends w9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return mC.deleteWordPartLeft(t)||new ws(1,1,1,1)}}),Pp(new class extends w9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:PC.writable,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=mC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ws(s,n,s,n)}}),Pp(new class extends k9{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),Pp(new class extends k9{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),Pp(new class extends C9{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),Pp(new class extends C9{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:PC.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class S9 extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=kK.get(this.editor);t&&this.editor.hasModel()&&t.showMessage(e(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"),this.editor.getPosition())}}S9.ID="editor.contrib.readOnlyMessageController",$p(S9.ID,S9,2);var x9=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=function(t,i){return function(e,s){i(e,s,t)}};const E9=new Jo("accessibilityHelpWidgetVisible",!1);let A9=class t extends Hi{static get(i){return i.getContribution(t.ID)}constructor(t,i){super(),this._editor=t,this._widget=this._register(i.createInstance(L9,this._editor))}show(){this._widget.show()}hide(){this._widget.hide()}};A9.ID="editor.contrib.accessibilityHelpController",A9=x9([D9(1,eo)],A9);let L9=class t extends gy{constructor(t,i,e,s){super(),this._contextKeyService=i,this._keybindingService=e,this._openerService=s,this._editor=t,this._isVisibleKey=E9.bindTo(this._contextKeyService),this._domNode=Ur(document.createElement("div")),this._domNode.setClassName("accessibilityHelpWidget"),this._domNode.setDisplay("none"),this._domNode.setAttribute("role","dialog"),this._domNode.setAttribute("aria-modal","true"),this._domNode.setAttribute("aria-hidden","true");const n=Lg(this._domNode.domNode,Rg("h1",void 0,EP.accessibilityHelpTitle));n.id="help-dialog-heading",this._domNode.setAttribute("aria-labelledby",n.id),this._contentDomNode=Ur(document.createElement("div")),this._contentDomNode.setAttribute("role","document"),this._contentDomNode.domNode.id="help-dialog-content",this._domNode.appendChild(this._contentDomNode),this._contentDomNode.setAttribute("aria-describedby",this._contentDomNode.domNode.id),this._isVisible=!1,this._register(this._editor.onDidLayoutChange((()=>{this._isVisible&&this._layout()}))),this._register(Qf(this._contentDomNode.domNode,"keydown",(t=>{if(this._isVisible&&(t.equals(2083)&&(Yg(EP.emergencyConfOn),this._editor.updateOptions({accessibilitySupport:"on"}),Kf(this._contentDomNode.domNode),this._buildContent(),this._contentDomNode.domNode.focus(),t.preventDefault(),t.stopPropagation()),t.equals(2086))){Yg(EP.openingDocs);let i=this._editor.getRawOptions().accessibilityHelpUrl;void 0===i&&(i="https://go.microsoft.com/fwlink/?linkid=852450"),this._openerService.open(os.parse(i)),t.preventDefault(),t.stopPropagation()}}))),this.onblur(this._contentDomNode.domNode,(()=>{this.hide()})),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return t.ID}getDomNode(){return this._domNode.domNode}getPosition(){return{preference:null}}show(){this._isVisible||(this._isVisible=!0,this._isVisibleKey.set(!0),this._layout(),this._domNode.setDisplay("block"),this._domNode.setAttribute("aria-hidden","false"),this._contentDomNode.domNode.tabIndex=0,this._buildContent(),this._contentDomNode.domNode.focus())}_descriptionForCommand(t,i,e){const s=this._keybindingService.lookupKeybinding(t);return s?Rn(i,s.getAriaLabel()):Rn(e,t)}_buildContent(){const t=this._contentDomNode.domNode,i=this._editor.getOptions(),e=this._editor.getSelections();let s=0;if(e){const t=this._editor.getModel();t&&e.forEach((i=>{s+=t.getValueLengthInRange(i)}))}Lg(t,Rg("p",void 0,function(t,i){return t&&0!==t.length?1===t.length?i?Rn(EP.singleSelectionRange,t[0].positionLineNumber,t[0].positionColumn,i):Rn(EP.singleSelection,t[0].positionLineNumber,t[0].positionColumn):i?Rn(EP.multiSelectionRange,t.length,i):t.length>0?Rn(EP.multiSelection,t.length):"":EP.noSelection}(e,s)));Lg(t,Rg("p")).textContent=i.get(59)?i.get(88)?EP.readonlyDiffEditor:EP.editableDiffEditor:i.get(88)?EP.readonlyEditor:EP.editableEditor;const n=Lg(t,Rg("ul")),r=b?EP.changeConfigToOnMac:EP.changeConfigToOnWinLinux;switch(i.get(2)){case 0:Lg(n,Rg("li",void 0,r));break;case 2:Lg(n,Rg("li",void 0,EP.auto_on));break;case 1:Lg(n,Rg("li",void 0,EP.auto_off,r))}i.get(139)?Lg(n,Rg("li",void 0,this._descriptionForCommand(T6.ID,EP.tabFocusModeOnMsg,EP.tabFocusModeOnMsgNoKb))):Lg(n,Rg("li",void 0,this._descriptionForCommand(T6.ID,EP.tabFocusModeOffMsg,EP.tabFocusModeOffMsgNoKb))),Lg(n,Rg("li",void 0,b?EP.openDocMac:EP.openDocWinLinux)),Lg(t,Rg("p",void 0,EP.outroMsg))}hide(){this._isVisible&&(this._isVisible=!1,this._isVisibleKey.reset(),this._domNode.setDisplay("none"),this._domNode.setAttribute("aria-hidden","true"),this._contentDomNode.domNode.tabIndex=-1,Kf(this._contentDomNode.domNode),this._editor.focus())}_layout(){const i=this._editor.getLayoutInfo(),e=Math.max(5,Math.min(t.WIDTH,i.width-40)),s=Math.max(5,Math.min(t.HEIGHT,i.height-40));this._domNode.setWidth(e),this._domNode.setHeight(s);const n=Math.round((i.height-s)/2);this._domNode.setTop(n);const r=Math.round((i.width-e)/2);this._domNode.setLeft(r)}};L9.ID="editor.contrib.accessibilityHelpWidget",L9.WIDTH=500,L9.HEIGHT=300,L9=x9([D9(1,Qo),D9(2,eP),D9(3,W_)],L9),$p(A9.ID,A9,4),Np(class extends Tp{constructor(){super({id:"editor.action.showAccessibilityHelp",label:EP.showAccessibilityHelpAction,alias:"Show Accessibility Help",precondition:void 0,kbOpts:{primary:571,weight:100,linux:{primary:1595,secondary:[571]}}})}run(t,i){const e=A9.get(i);null==e||e.show()}}),Pp(new(Fp.bindToContribution(A9.get))({id:"closeAccessibilityHelp",precondition:E9,handler:t=>t.hide(),kbOpts:{weight:200,kbExpr:PC.focus,primary:9,secondary:[1033]}}));class M9 extends Hi{constructor(t){super(),this.editor=t,this.widget=null,x&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(88);!this.widget&&t?this.widget=new O9(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}M9.ID="editor.contrib.iPadShowKeyboard";class O9 extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Zf(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Zf(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return O9.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}O9.ID="editor.contrib.ShowKeyboardWidget",$p(M9.ID,M9,3);var F9=function(t,i){return function(e,s){i(e,s,t)}};let T9=class t extends Hi{static get(i){return i.getContribution(t.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($s.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 R9(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};T9.ID="editor.contrib.inspectTokens",T9=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}([F9(1,fV),F9(2,hc)],T9);class R9 extends Hi{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=$s.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>Kc,tokenize:(t,e,s)=>qc(i,s),tokenizeEncoded:(t,i,e)=>Gc(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 R9._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)),Mg(this._domNode,Rg("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),Rg("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Lg(this._domNode,Rg("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Lg(this._domNode,Rg("table.tm-metadata-table",void 0,Rg("tbody",void 0,Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"language"),Rg("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"token type"),Rg("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"font style"),Rg("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"foreground"),Rg("td.tm-metadata-value",void 0,`${o?ea.Format.CSS.formatHex(o.foreground):"-?-"}`)),Rg("tr",void 0,Rg("td.tm-metadata-key",void 0,"background"),Rg("td.tm-metadata-value",void 0,`${o?ea.Format.CSS.formatHex(o.background):"-?-"}`))))),Lg(this._domNode,Rg("hr.tokens-inspect-separator")),e<i.tokens1.length&&Lg(this._domNode,Rg("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=$s.getColorMap(),e=Ra.getLanguageId(t),s=Ra.getTokenType(t),n=Ra.getFontStyle(t),r=Ra.getForeground(t),o=Ra.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]}}}R9._ID="editor.contrib.inspectTokensWidget",$p(T9.ID,T9,4),Np(class extends Tp{constructor(){super({id:"editor.action.inspectTokens",label:AP.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=T9.get(i);null==e||e.launch()}});var _9=function(t,i){return function(e,s){i(e,s,t)}};let I9=class t{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=dc.as(Vj)}provide(i){const e=new Vi;return e.add(i.onDidAccept((()=>{const[t]=i.selectedItems;t&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})}))),e.add(i.onDidChangeValue((i=>{const e=this.registry.getQuickAccessProvider(i.substr(t.PREFIX.length));e&&e.prefix&&e.prefix!==t.PREFIX&&this.quickInputService.quickAccess.show(e.prefix,{preserveValue:!0})}))),i.items=this.getQuickAccessProviders().filter((i=>i.prefix!==t.PREFIX)),e}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 s=i.prefix||t.prefix,n=s||"…";return{prefix:s,label:n,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:e(0,"{0}, {1}",n,i.description),description:i.description}}))}};I9.PREFIX="?",I9=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}([_9(0,Kj),_9(1,eP)],I9),dc.as(Vj).registerQuickAccessProvider({ctor:I9,prefix:"",helpEntries:[{description:MP.helpQuickAccessActionLabel}]});class P9{constructor(t){this.options=t,this.rangeHighlightDecorationId=void 0}provide(t,i){var e;const s=new Vi;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 zi);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){const e=new Vi,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const n={editor:s},r=ZH(s);if(r){let t=Rt(s.saveViewState());e.add(r.onDidChangeCursorPosition((()=>{t=Rt(s.saveViewState())}))),n.restoreViewState=()=>{t&&s===this.activeTextEditorControl&&s.restoreViewState(t)},e.add(Ni(i.onCancellationRequested)((()=>{var t;return null===(t=n.restoreViewState)||void 0===t?void 0:t.call(n)})))}e.add(Wi((()=>this.clearDecorations(s)))),e.add(this.provideWithTextEditor(n,t,i))}else e.add(this.provideWithoutTextEditor(t,i));return e}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&&Yg(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return GH(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:Xy(bk),position:uh.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 N9 extends P9{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=e(0,"Open a text editor first to go to a line.");return t.items=[{label:i}],t.ariaLabel=i,Hi.None}provideWithTextEditor(t,i,e){const s=t.editor,n=new Vi;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(N9.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=ZH(s);return o&&2===o.getOptions().get(65).renderType&&(o.updateOptions({lineNumbers:"on"}),n.add(Wi((()=>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,s){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,s)?e(0,"Go to line {0} and character {1}.",i,s):e(0,"Go to line {0}.",i);const n=t.getPosition()||{lineNumber:1,column:1},r=this.lineCount(t);return r>1?e(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,r):e(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.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}}N9.PREFIX=":";let B9=class extends N9{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Qi.None}get activeTextEditorControl(){return Rt(this.editorService.getFocusedCodeEditor())}};B9=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,ro)],B9);class $9 extends Tp{constructor(){super({id:$9.ID,label:LP.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Kj).quickAccess.show(B9.PREFIX)}}$9.ID="editor.action.gotoLine",Np($9),dc.as(Vj).registerQuickAccessProvider({ctor:B9,prefix:B9.PREFIX,helpEntries:[{description:LP.gotoLineActionLabel,commandId:$9.ID}]});const j9=[void 0,[]];function W9(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]=V9(t,o,e,s);if("number"!=typeof i)return j9;n+=i,r.push(...h)}return[n,H9(r)]}(t,i.values,e,s):V9(t,i,e,s)}function V9(t,i,e,s){const n=vF(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],sF(n)]:j9}function H9(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 z9(t){return t.startsWith('"')&&t.endsWith('"')}function U9(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=K9(t),r=e.indexOf(Xe)>=0,o=z9(t);let h;const c=t.split(" ");if(c.length>1)for(const t of c){const i=z9(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=K9(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 K9(t){let i;i=t.replace(w?/\//g:/\\/g,Xe);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function q9(t){return Array.isArray(t)?U9(t.map((t=>t.original)).join(" ")):U9(t.original)}Object.freeze({score:0});var G9=function(t,i){return function(e,s){i(e,s,t)}},Z9=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let J9=class t extends P9{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,e(0,"To go to a symbol, first open a text editor with symbol information.")),Hi.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):Hi.None}doProvideWithoutEditorSymbols(t,i,s,n){const r=new Vi;return this.provideLabelPick(s,e(0,"The active text editor does not provide symbol information.")),(()=>{Z9(this,void 0,void 0,(function*(){(yield this.waitForLanguageSymbolRegistry(i,r))&&!n.isCancellationRequested&&r.add(this.doProvideWithEditorSymbols(t,i,s,n))}))})(),r}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}waitForLanguageSymbolRegistry(t,i){return Z9(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new fu,s=i.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>{this._languageFeaturesService.documentSymbolProvider.has(t)&&(s.dispose(),e.complete(!0))})));return i.add(Wi((()=>e.complete(!1)))),e.p}))}doProvideWithEditorSymbols(i,s,n,r){var o;const h=i.editor,c=new Vi;c.add(n.onDidAccept((t=>{const[e]=n.selectedItems;e&&e.range&&(this.gotoLocation(i,{range:e.range.selection,keyMods:n.keyMods,preserveFocus:t.inBackground}),t.inBackground||n.hide())}))),c.add(n.onDidTriggerItemButton((({item:t})=>{t&&t.range&&(this.gotoLocation(i,{range:t.range.selection,keyMods:n.keyMods,forceSideBySide:!0}),n.hide())})));const u=this.getDocumentSymbols(s,r);let l;const a=i=>Z9(this,void 0,void 0,(function*(){null==l||l.dispose(!0),n.busy=!1,l=new pe(r),n.busy=!0;try{const s=U9(n.value.substr(t.PREFIX.length).trim()),o=yield this.doGetSymbolPicks(u,s,void 0,l.token);if(r.isCancellationRequested)return;if(o.length>0){if(n.items=o,i&&0===s.original.length){const t=nt(o,(t=>Boolean("separator"!==t.type&&t.range&&ws.containsPosition(t.range.decoration,i))));t&&(n.activeItems=[t])}}else this.provideLabelPick(n,e(0,s.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{r.isCancellationRequested||(n.busy=!1)}}));return c.add(n.onDidChangeValue((()=>a(void 0)))),a(null===(o=h.getSelection())||void 0===o?void 0:o.getPosition()),c.add(n.onDidChangeActive((()=>{const[t]=n.activeItems;t&&t.range&&(h.revealRangeInCenter(t.range.selection,0),this.addDecorations(h,t.range.decoration))}))),c}doGetSymbolPicks(i,s,n,r){var o,h;return Z9(this,void 0,void 0,(function*(){const c=yield i;if(r.isCancellationRequested)return[];const u=0===s.original.indexOf(t.SCOPE_PREFIX),l=u?1:0;let a,d,f;s.values&&s.values.length>1?(a=q9(s.values[0]),d=q9(s.values.slice(1))):a=s;const g=null===(h=null===(o=this.options)||void 0===o?void 0:o.openSideBySideDirection)||void 0===h?void 0:h.call(o);g&&(f=[{iconClass:np.asClassName("right"===g?Ss.splitHorizontal:Ss.splitVertical),tooltip:e(0,"right"===g?"Open to the Side":"Open to the Bottom")}]);const p=[];for(let w=0;w<c.length;w++){const b=c[w],y=Pn(b.name),k=`$(${Ls.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==n?void 0:n.extraContainerLabel)&&(A=A?`${n.extraContainerLabel} • ${A}`:n.extraContainerLabel),s.original.length>l){let M=!1;if(a!==s&&([S,x]=W9(k,Object.assign(Object.assign({},s),{values:void 0}),l,C),"number"==typeof S&&(M=!0)),"number"!=typeof S&&([S,x]=W9(k,a,l,C),"number"!=typeof S))continue;if(!M&&d){if(A&&d.original.length>0&&([D,E]=W9(A,d)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const L=b.tags&&b.tags.indexOf(1)>=0;p.push({index:w,kind:b.kind,score:S,label:k,ariaLabel:y,description:A,highlights:L?void 0:{label:x,description:E},range:{selection:ws.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:L,buttons:f})}const m=p.sort(((t,i)=>u?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let v=[];if(u){let O,F,T=0;function R(){F&&"number"==typeof O&&T>0&&(F.label=Rn(Y9[O]||Q9,T))}for(const _ of m)O!==_.kind?(R(),O=_.kind,T=1,F={type:"separator"},v.push(F)):T++,v.push(_);R()}else m.length>0&&(v=[{label:e(0,"symbols ({0})",p.length),type:"separator"},...m]);return v}))}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=(Y9[t.kind]||Q9).localeCompare(Y9[i.kind]||Q9);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return Z9(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};J9.PREFIX="@",J9.SCOPE_PREFIX=":",J9.PREFIX_BY_CATEGORY=`${J9.PREFIX}${J9.SCOPE_PREFIX}`,J9=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}([G9(0,ka),G9(1,L1)],J9);const Q9=e(0,"properties ({0})"),Y9={5:e(0,"methods ({0})"),11:e(0,"functions ({0})"),8:e(0,"constructors ({0})"),12:e(0,"variables ({0})"),4:e(0,"classes ({0})"),22:e(0,"structs ({0})"),23:e(0,"events ({0})"),24:e(0,"operators ({0})"),10:e(0,"interfaces ({0})"),2:e(0,"namespaces ({0})"),3:e(0,"packages ({0})"),25:e(0,"type parameters ({0})"),1:e(0,"modules ({0})"),6:e(0,"properties ({0})"),9:e(0,"enumerations ({0})"),21:e(0,"enumeration members ({0})"),14:e(0,"strings ({0})"),0:e(0,"files ({0})"),17:e(0,"arrays ({0})"),15:e(0,"numbers ({0})"),16:e(0,"booleans ({0})"),18:e(0,"objects ({0})"),19:e(0,"keys ({0})"),7:e(0,"fields ({0})"),13:e(0,"constants ({0})")};var X9=function(t,i){return function(e,s){i(e,s,t)}};let t7=class extends J9{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Qi.None}get activeTextEditorControl(){return Rt(this.editorService.getFocusedCodeEditor())}};t7=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}([X9(0,ro),X9(1,ka),X9(2,L1)],t7);class i7 extends Tp{constructor(){super({id:i7.ID,label:FP.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:PC.hasDocumentSymbolProvider,kbOpts:{kbExpr:PC.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Kj).quickAccess.show(J9.PREFIX,{itemActivation:Uj.NONE})}}function e7(t,i){return i&&(t.stack||t.stacktrace)?e(0,"{0}: {1}",n7(t),s7(t.stack)||s7(t.stacktrace)):n7(t)}function s7(t){return Array.isArray(t)?t.join("\n"):t}function n7(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?e(0,"A system error occurred ({0})",t.message):t.message||e(0,"An unknown error occurred. Please consult the log for more details.")}function r7(t=null,i=!1){if(!t)return e(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const s=X(t),n=r7(s[0],i);return s.length>1?e(0,"{0} ({1} errors in total)",n,s.length):n}if(yt(t))return t;if(t.detail){const e=t.detail;if(e.error)return e7(e.error,i);if(e.exception)return e7(e.exception,i)}return t.stack?e7(t,i):t.message?t.message:e(0,"An unknown error occurred. Please consult the log for more details.")}i7.ID="editor.action.quickOutline",Np(i7),dc.as(Vj).registerQuickAccessProvider({ctor:t7,prefix:J9.PREFIX,helpEntries:[{description:FP.quickOutlineActionLabel,prefix:J9.PREFIX,commandId:i7.ID},{description:FP.quickOutlineByCategoryActionLabel,prefix:J9.PREFIX_BY_CATEGORY}]});var o7,h7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function c7(t){return Array.isArray(t.items)}function u7(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"}(o7||(o7={}));class l7 extends Hi{constructor(t,i){super(),this.prefix=t,this.options=i}provide(t,i,e){var s;const n=new Vi;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 zi),h=()=>h7(this,void 0,void 0,(function*(){const s=o.value=new Vi;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),u=(i,e)=>{var s;let n,r;if(c7(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=Ft(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},l=i=>h7(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>h7(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield ru(i.mergeDelay),n.isCancellationRequested)||s||(e=u(i.picks,!0))})))(),(()=>h7(this,void 0,void 0,(function*(){t.busy=!0;try{const r=yield i.additionalPicks;if(n.isCancellationRequested)return;let o,h,c,l;if(c7(i.picks)?(o=i.picks.items,h=i.picks.active):o=i.picks,c7(r)?(c=r.items,l=r.active):c=r,c.length>0||!e){let i;if(!h&&!l){const e=t.activeItems[0];e&&-1!==o.indexOf(e)&&(i=e)}u({items:[...o,...c],active:h||l||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(u7(c))yield l(c);else if(c instanceof Promise){t.busy=!0;try{const i=yield c;if(n.isCancellationRequested)return;u7(i)?yield l(i):u(i)}finally{n.isCancellationRequested||(t.busy=!1)}}else u(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((({button:e,item:s})=>h7(this,void 0,void 0,(function*(){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:yield e;if(i.isCancellationRequested)return;switch(n){case o7.NO_ACTION:break;case o7.CLOSE_PICKER:t.hide();break;case o7.REFRESH_PICKER:h();break;case o7.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 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},d7=function(t,i){return function(e,s){i(e,s,t)}},f7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let g7=class t extends l7{constructor(i,e,s,n,r,o){super(t.PREFIX,i),this.instantiationService=e,this.keybindingService=s,this.commandService=n,this.telemetryService=r,this.dialogService=o,this.commandsHistory=this._register(this.instantiationService.createInstance(p7)),this.options=i}_getPicks(i,s,n,r){var o,h;return f7(this,void 0,void 0,(function*(){const s=yield this.getCommandPicks(n);if(n.isCancellationRequested)return[];const c=[];for(const e of s){const s=Rt(t.WORD_FILTER(i,e.label)),n=e.commandAlias?Rt(t.WORD_FILTER(i,e.commandAlias)):void 0;s||n?(e.highlights={label:s,detail:this.options.showAlias?n:void 0},c.push(e)):i===e.commandId&&c.push(e)}const u=new Map;for(const t of c){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}c.sort(((t,i)=>{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 l=[];let a=!1,d=!!this.options.suggestedCommandIds;for(let t=0;t<c.length;t++){const i=c[t];0===t&&this.commandsHistory.peek(i.commandId)&&(l.push({type:"separator",label:e(0,"recently used")}),a=!0),d&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(l.push({type:"separator",label:e(0,"commonly used")}),a=!0,d=!1),!a||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(l.push({type:"separator",label:e(0,"other commands")}),a=!1),l.push(this.toCommandPick(i,r))}return this.hasAdditionalCommandPicks(i,n)?{picks:l,additionalPicks:(()=>f7(this,void 0,void 0,(function*(){const t=yield this.getAdditionalCommandPicks(s,c,i,n);return n.isCancellationRequested?[]:t.map((t=>this.toCommandPick(t,r)))})))()}:l}))}toCommandPick(t,i){if("separator"===t.type)return t;const s=this.keybindingService.lookupKeybinding(t.commandId),n=s?e(0,"{0}, {1}",t.label,s.getAriaLabel()):t.label;return Object.assign(Object.assign({},t),{ariaLabel:n,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:s,accept:()=>f7(this,void 0,void 0,(function*(){var s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(s=null==i?void 0:i.from)&&void 0!==s?s:"quick open"});try{yield this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(e(0,"Command '{0}' resulted in an error",t.label),r7(i))}}))})}};g7.PREFIX=">",g7.WORD_FILTER=RO(_O,(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&&null===(s=JO(t,i,0,n,e));)n=QO(i,n+1);return s}),PO),g7=a7([d7(1,eo),d7(2,eP),d7(3,dp),d7(4,Ap),d7(5,A_)],g7);let p7=class t extends Hi{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))))}updateConfiguration(i){i&&!i.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=t.getConfiguredCommandHistoryLength(this.configurationService),t.cache&&t.cache.limit!==this.configuredCommandsHistoryLength&&(t.cache.limit=this.configuredCommandsHistoryLength,t.saveState(this.storageService)))}load(){const i=this.storageService.get(t.PREF_KEY_CACHE,0);let e;if(i)try{e=JSON.parse(i)}catch(t){}const s=t.cache=new TO(this.configuredCommandsHistoryLength,1);if(e){let t;t=e.usesLRU?e.entries:e.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>s.set(t.key,t.value)))}t.counter=this.storageService.getNumber(t.PREF_KEY_COUNTER,0,t.counter)}push(i){t.cache&&(t.cache.set(i,t.counter++),t.saveState(this.storageService))}peek(i){var e;return null===(e=t.cache)||void 0===e?void 0:e.peek(i)}static saveState(i){if(!t.cache)return;const e={usesLRU:!0,entries:[]};t.cache.forEach(((t,i)=>e.entries.push({key:i,value:t}))),i.store(t.PREF_KEY_CACHE,JSON.stringify(e),0,0),i.store(t.PREF_KEY_COUNTER,t.counter,0,0)}static getConfiguredCommandHistoryLength(i){var e,s;const n=null===(s=null===(e=i.getValue().workbench)||void 0===e?void 0:e.commandPalette)||void 0===s?void 0:s.history;return"number"==typeof n?n:t.DEFAULT_COMMANDS_HISTORY_LENGTH}};p7.DEFAULT_COMMANDS_HISTORY_LENGTH=50,p7.PREF_KEY_CACHE="commandPalette.mru.cache",p7.PREF_KEY_COUNTER="commandPalette.mru.counter",p7.counter=1,p7=a7([d7(0,hN),d7(1,ic)],p7);class m7 extends g7{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:DF(e.label)||e.id});return i}}var v7=function(t,i){return function(e,s){i(e,s,t)}},w7=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};let b7=class extends m7{get activeTextEditorControl(){return Rt(this.codeEditorService.getFocusedCodeEditor())}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}getCommandPicks(){return w7(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return w7(this,void 0,void 0,(function*(){return[]}))}};b7=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}([v7(0,eo),v7(1,ro),v7(2,eP),v7(3,dp),v7(4,Ap),v7(5,A_)],b7);class y7 extends Tp{constructor(){super({id:y7.ID,label:OP.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:PC.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Kj).quickAccess.show(b7.PREFIX)}}y7.ID="editor.action.quickCommand",Np(y7),dc.as(Vj).registerQuickAccessProvider({ctor:b7,prefix:b7.PREFIX,helpEntries:[{description:OP.quickCommandHelp,commandId:y7.ID}]});var k7=function(t,i){return function(e,s){i(e,s,t)}};let C7=class extends KG{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};C7=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}([k7(1,Qo),k7(2,ro),k7(3,IM),k7(4,eo),k7(5,hN),k7(6,ic)],C7),$p(KG.ID,C7,4),Np(class extends Tp{constructor(){super({id:"editor.action.toggleHighContrast",label:RP.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(fV),s=e.getColorTheme();Hb(s.type)?(e.setTheme(this._originalThemeName||(zb(s.type)?nV:sV)),this._originalThemeName=null):(e.setTheme(zb(s.type)?rV:oV),this._originalThemeName=s.themeName)}});var S7="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function x7(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 D7=x7((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,u,l,a,d,f,g,p,m,v,w,b,y,k,C,S,x,D,E,A,L,M;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 Ot.objectLiteral(i)&&Ot.uinteger(i.line)&&Ot.uinteger(i.character)}}(o||(i.Position=o={})),function(t){t.create=function(t,i,e,s){if(Ot.uinteger(t)&&Ot.uinteger(i)&&Ot.uinteger(e)&&Ot.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 Ot.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 Ot.objectLiteral(i)&&h.is(i.range)&&(Ot.string(i.uri)||Ot.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 Ot.objectLiteral(i)&&h.is(i.targetRange)&&Ot.string(i.targetUri)&&h.is(i.targetSelectionRange)&&(h.is(i.originSelectionRange)||Ot.undefined(i.originSelectionRange))}}(u||(i.LocationLink=u={})),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 Ot.objectLiteral(i)&&Ot.numberRange(i.red,0,1)&&Ot.numberRange(i.green,0,1)&&Ot.numberRange(i.blue,0,1)&&Ot.numberRange(i.alpha,0,1)}}(l||(i.Color=l={})),function(t){t.create=function(t,i){return{range:t,color:i}},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&h.is(i.range)&&l.is(i.color)}}(a||(i.ColorInformation=a={})),function(t){t.create=function(t,i,e){return{label:t,textEdit:i,additionalTextEdits:e}},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.string(i.label)&&(Ot.undefined(i.textEdit)||k.is(i))&&(Ot.undefined(i.additionalTextEdits)||Ot.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 Ot.defined(e)&&(o.startCharacter=e),Ot.defined(s)&&(o.endCharacter=s),Ot.defined(n)&&(o.kind=n),Ot.defined(r)&&(o.collapsedText=r),o},t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.uinteger(i.startLine)&&Ot.uinteger(i.startLine)&&(Ot.undefined(i.startCharacter)||Ot.uinteger(i.startCharacter))&&(Ot.undefined(i.endCharacter)||Ot.uinteger(i.endCharacter))&&(Ot.undefined(i.kind)||Ot.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 Ot.defined(i)&&c.is(i.location)&&Ot.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}(v||(i.DiagnosticTag=v={})),function(t){t.is=function(t){var i=t;return Ot.objectLiteral(i)&&Ot.string(i.href)}}(w||(i.CodeDescription=w={})),function(t){t.create=function(t,i,e,s,n,r){var o={range:t,message:i};return Ot.defined(e)&&(o.severity=e),Ot.defined(s)&&(o.code=s),Ot.defined(n)&&(o.source=n),Ot.defined(r)&&(o.relatedInformation=r),o},t.is=function(t){var i,e=t;return Ot.defined(e)&&h.is(e.range)&&Ot.string(e.message)&&(Ot.number(e.severity)||Ot.undefined(e.severity))&&(Ot.integer(e.code)||Ot.string(e.code)||Ot.undefined(e.code))&&(Ot.undefined(e.codeDescription)||Ot.string(null===(i=e.codeDescription)||void 0===i?void 0:i.href))&&(Ot.string(e.source)||Ot.undefined(e.source))&&(Ot.undefined(e.relatedInformation)||Ot.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 Ot.defined(e)&&e.length>0&&(n.arguments=e),n},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.title)&&Ot.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 Ot.objectLiteral(i)&&Ot.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 Ot.objectLiteral(i)&&Ot.string(i.label)&&(Ot.boolean(i.needsConfirmation)||void 0===i.needsConfirmation)&&(Ot.string(i.description)||void 0===i.description)}}(C||(i.ChangeAnnotation=C={})),function(t){t.is=function(t){return Ot.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 Ot.defined(i)&&T.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&&Ot.string(i.uri)&&(void 0===i.options||(void 0===i.options.overwrite||Ot.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ot.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&&Ot.string(i.oldUri)&&Ot.string(i.newUri)&&(void 0===i.options||(void 0===i.options.overwrite||Ot.boolean(i.options.overwrite))&&(void 0===i.options.ignoreIfExists||Ot.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&&Ot.string(i.uri)&&(void 0===i.options||(void 0===i.options.recursive||Ot.boolean(i.options.recursive))&&(void 0===i.options.ignoreIfNotExists||Ot.boolean(i.options.ignoreIfNotExists)))&&(void 0===i.annotationId||S.is(i.annotationId))}}(L||(i.DeleteFile=L={})),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 Ot.string(t.kind)?E.is(t)||A.is(t)||L.is(t):D.is(t)})))}}(M||(i.WorkspaceEdit=M={}));var O,F,T,R,_,I,P,N,B,$,j,W,V,H,z,U,K,q,G,Z,J,Q,Y,X,tt,it,et,st,nt,rt,ot,ht,ct,ut,lt,at,dt,ft,gt,pt,mt,vt,wt,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}(),Lt=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}(),Mt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Lt(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(T.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 Lt,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=L.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=L.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Mt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)}}(O||(i.TextDocumentIdentifier=O={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)&&Ot.integer(i.version)}}(F||(i.VersionedTextDocumentIdentifier=F={})),function(t){t.create=function(t,i){return{uri:t,version:i}},t.is=function(t){var i=t;return Ot.defined(i)&&Ot.string(i.uri)&&(null===i.version||Ot.integer(i.version))}}(T||(i.OptionalVersionedTextDocumentIdentifier=T={})),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 Ot.defined(i)&&Ot.string(i.uri)&&Ot.string(i.languageId)&&Ot.integer(i.version)&&Ot.string(i.text)}}(R||(i.TextDocumentItem=R={})),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 Ot.objectLiteral(t)&&_.is(i.kind)&&Ot.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&&Ot.string(i.newText)&&h.is(i.insert)&&h.is(i.replace)}}($||(i.InsertReplaceEdit=$={})),function(t){t.asIs=1,t.adjustIndentation=2}(j||(i.InsertTextMode=j={})),function(t){t.is=function(t){var i=t;return i&&(Ot.string(i.detail)||void 0===i.detail)&&(Ot.string(i.description)||void 0===i.description)}}(W||(i.CompletionItemLabelDetails=W={})),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 Ot.string(i)||Ot.objectLiteral(i)&&Ot.string(i.language)&&Ot.string(i.value)}}(z||(i.MarkedString=z={})),function(t){t.is=function(t){var i=t;return!!i&&Ot.objectLiteral(i)&&(I.is(i.contents)||z.is(i.contents)||Ot.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 Ot.defined(i)&&(n.documentation=i),n.parameters=Ot.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 Ot.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&&Ot.string(i.name)&&Ot.number(i.kind)&&h.is(i.range)&&h.is(i.selectionRange)&&(void 0===i.detail||Ot.string(i.detail))&&(void 0===i.deprecated||Ot.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 Ot.defined(i)&&Ot.typedArray(i.diagnostics,b.is)&&(void 0===i.only||Ot.typedArray(i.only,Ot.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&&Ot.string(i.title)&&(void 0===i.diagnostics||Ot.typedArray(i.diagnostics,b.is))&&(void 0===i.kind||Ot.string(i.kind))&&(void 0!==i.edit||void 0!==i.command)&&(void 0===i.command||y.is(i.command))&&(void 0===i.isPreferred||Ot.boolean(i.isPreferred))&&(void 0===i.edit||M.is(i.edit))}}(nt||(i.CodeAction=nt={})),function(t){t.create=function(t,i){var e={range:t};return Ot.defined(i)&&(e.data=i),e},t.is=function(t){var i=t;return Ot.defined(i)&&h.is(i.range)&&(Ot.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 Ot.defined(i)&&Ot.uinteger(i.tabSize)&&Ot.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 Ot.defined(i)&&h.is(i.range)&&(Ot.undefined(i.target)||Ot.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 Ot.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"}(ut||(i.SemanticTokenTypes=ut={})),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"}(lt||(i.SemanticTokenModifiers=lt={})),function(t){t.is=function(t){var i=t;return Ot.objectLiteral(i)&&(void 0===i.resultId||"string"==typeof i.resultId)&&Array.isArray(i.data)&&(0===i.data.length||"number"==typeof i.data[0])}}(at||(i.SemanticTokens=at={})),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)&&Ot.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)&&Ot.boolean(i.caseSensitiveLookup)&&(Ot.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)&&(Ot.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 Ot.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 Ot.objectLiteral(i)&&(void 0===i.tooltip||Ot.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.location||c.is(i.location))&&(void 0===i.command||y.is(i.command))}}(vt||(i.InlayHintLabelPart=vt={})),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 Ot.objectLiteral(i)&&o.is(i.position)&&(Ot.string(i.label)||Ot.typedArray(i.label,vt.is))&&(void 0===i.kind||mt.is(i.kind))&&void 0===i.textEdits||Ot.typedArray(i.textEdits,k.is)&&(void 0===i.tooltip||Ot.string(i.tooltip)||I.is(i.tooltip))&&(void 0===i.paddingLeft||Ot.boolean(i.paddingLeft))&&(void 0===i.paddingRight||Ot.boolean(i.paddingRight))}}(wt||(i.InlayHint=wt={})),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 Ot.objectLiteral(i)&&s.is(i.uri)&&Ot.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 u=e(n[o],r[h]);t[c++]=u<=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 Ft(t,i,e,s)},t.is=function(t){var i=t;return!!(Ot.defined(i)&&Ot.string(i.uri)&&(Ot.undefined(i.languageId)||Ot.string(i.languageId))&&Ot.uinteger(i.lineCount)&&Ot.func(i.getText)&&Ot.func(i.positionAt)&&Ot.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),u=t.offsetAt(h.range.end);if(!(u<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(u,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var Ot,Ft=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)}}(Ot||(Ot={}))}(0,i),void 0!==e&&(t.exports=e)}));const E7="define"in window&&"function"==typeof window.define&&"amd"in window.define;function A7(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function L7(){return E7?A7("esri/arcade"):await import("@arcgis/core/arcade.js")}async function M7(){return E7?A7("esri/request"):(await import("@arcgis/core/request.js")).default}async function O7(t){return new(await async function(){return E7?A7("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function F7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function T7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function R7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function _7(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function I7(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function P7(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function N7(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function B7(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function $7(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var j7=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function W7(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 V7(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)W7(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function H7(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 z7(t){let i=H7(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function U7(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(U7(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(U7(e.children[t],i))return!0;return!1}function K7(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void U7(t,i);let e=new MutationObserver((()=>{e.disconnect(),U7(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function q7(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function G7(){return[q7(2),q7(1),q7(1),q7(1),q7(3)].join("-")}var Z7=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"]),J7=new Map;async function Q7(t,i,e=""){let s=`${i}/${e}${t}.json`;if(J7.has(s))return J7.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return J7.set(s,t),t}if("en"===t)return void J7.set(s,void 0);let r=await Q7("en",i,e);return J7.set(s,r),r}catch{return void J7.set(s,void 0)}}var Y7=new WeakMap,X7=new WeakMap,t8=new WeakMap;async function i8(t,i,e){X7.set(t,i),Y7.set(t,V7(t._hostElt,["lang"],(()=>{s8(t,e)}))),await s8(t,e)}function e8(t){Y7.get(t)?.disconnect(),Y7.delete(t),X7.delete(t)}async function s8(t,i){let e=function(t){let i=function(t,i,e){return H7(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(Z7.has(i))return i;let e=i.slice(0,2);return Z7.has(e)?e:"en"}(t._hostElt);if(e===t._locale)return;let s=t8.get(t);if(!s){let i=X7.get(t)??"",n=t._hostElt.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${n}/t9n`,o=`${n}.t9n.`;t._locale=e,s=await Q7(t._locale,r,o)}t._t9nStrings=s,await(i?.call(t))}function n8(t,i){return new Array(i+1).join(t)}function r8(t){let i='"',e="'";t.indexOf(i)>=0&&t.indexOf(e)<0&&(e='"',i="'");let s=new RegExp("(^|[^\\\\])((?:\\\\{2})*)((?:\\\\"+e+")+)","g");t=t.replace(s,((t,i,s,n)=>i+s+n8(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+n8("\\"+i,n.length))),i+t+i}function o8(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function h8(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function c8(t){return"‎"+(t??"")+"‎"}function u8(t){return null!==t}function l8(t){return void 0!==t}function a8(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 d8(t){try{return new URL(t),!0}catch{return!1}}function f8(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=o8(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 g8(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 p8(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 m8(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 v8(t){return!!t?.typeIdField}function w8(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(v8(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 b8(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new L8({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new F8(t,e,s)}const y8=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function k8(t,i=!0){return t.match(y8)?`${i?".":""}${t}`:`["${t}"]`}function C8(t,i){return t?`${t}${k8(i)}`:i}async function S8(t){if(!t)return null;let i=null;if(F7(t)||T7(t)||N7(t))i=t;else if(i=await O7(t),!R7(i))return console.error("Invalid FeatureSetDefinition",t),null;return i?("function"==typeof i?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null)}function x8(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 D8(t,i=D7.CompletionItemKind.Variable){if(!t)return[];const e=await Promise.all(t.map((async t=>{switch(t.type){case"dictionary":return 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 D8(s,D7.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:r}}}}(t,i);case"feature":return async function(t,i){const e=await t.loadSource(),{name:s}=t,n=t.getDescription(),r={label:s,detail:s,insertText:s,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],u=[];return p8(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=k8(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:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:D7.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}`),u.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:D7.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...u],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:D7.InsertTextMode.asIs,insertTextFormat:D7.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class E8{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?c8(this._label):h8(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:h8(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class A8 extends E8{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 L8 extends A8{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?m8(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class M8 extends A8{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?m8(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class O8 extends A8{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 F8 extends E8{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class T8 extends O8{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new F8(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=C8(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new L8({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new _8({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new I8({profile:this._profile,declaration:t,label:i,snippet:i},[new L8({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new P8({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new T8({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new M8({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 R8 extends O8{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"}loadSource(){return u8(this._loadPromise)&&l8(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?C8(this.snippet,t.name):t.name;return new L8({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:g8(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if("function"!=typeof this._source?.getFieldDomain)return null;const i="feature"===this.type?C8(this.snippet,t.name):t.name,e=new T8({profile:this._profile,label:i,description:t.alias??t.name,snippet:i,icon:"form-dropdown"}),s=new F8(this._profile,t.alias??t.name,[new L8({profile:this._profile,label:i,description:"",snippet:i})]);if(e.variables=[s],v8(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=b8(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new L8({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new F8(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return e.variables.push(i),e}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;s.variables.push(new L8({profile:this._profile,label:i,description:"",snippet:i}))}if(v8(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=b8(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new T8({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new F8(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(e.variables.push(i),e):null}const n=b8(this._profile,this._source.getFieldDomain?.(t.name),{code:"domainvalues"});return n?(e.variables.push(n),e):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 F8(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=`${t.url}/${i.relatedTableId}`,s=await S8({url:e});return R7(s)?s:null}(t,i);if(!R7(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new I8({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new L8({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(u8),e.variables.length?e:null}}class _8 extends R8{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return F7(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await S8(this._definition),!this._source)throw new Error("Invalid definition");const t=F7(this._source)?this._source.title:"";this.variables.push(new F8(this._profile,t,[new L8({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const i=new F8(this._profile,{code:"values"});if(this.variables.push(i),"boolean"==typeof this._source?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,e=new L8({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});i.variables.push(e)}this._source.fields.sort(w8(this._source)).forEach((t=>{i.variables.push(this._getFieldProperty(t))}));const e=await this._getRelationshipsProperty();e&&this.variables.push(e)}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 I8 extends R8{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return F7(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await S8(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new F8(this._profile,this.title,this.featureSetSnippets));const t=new F8(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(w8(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 P8 extends O8{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 u8(this._loadPromise)&&l8(this._loadPromise)||(this._loadPromise=this._loadSource()),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 F8(this._profile,t,[new L8({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new F8(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new F8(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?_7(this._definition)?this._featureSetCollectionFromWebMap(this._definition):F7(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):I7(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):B7(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=_7(t)?t:await async function(t){return new(await async function(){return E7?A7("esri/WebMap"):(await import("@arcgis/core/WebMap.js")).default}())(t)}({portalItem:t});return await i.loadAll(),await Promise.all(i.tables.map((async t=>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 E7?A7("esri/portal/PortalItem"):(await import("@arcgis/core/portal/PortalItem.js")).default}())(t)}(t);switch(await i.load(),i.type){case"Web Map":return this._featureSetCollectionFromWebMap(i);case"Feature Service":return this._featureSetCollectionFromUrl(i.url);default:return console.error("Unsupported portal item",t),null}}async _featureSetCollectionFromUrl(t){t=(t=(t=t.replace(/\/featureserver\/[0-9]*/i,"/FeatureServer")).replace(/\/mapserver\/[0-9]*/i,"/MapServer")).split("?")[0];const i=await async function(t){t+="/layers";const i=await M7(),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:x8(s.layers,n),tables:x8(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await O7({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await O7({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(R7(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 I8({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 L8({profile:this._profile,label:i,description:"",snippet:i}),new L8({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new L8({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class N8 extends T8{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 D8(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function B8(t){return R7(t)||T7(t)||B7(t)||N7(t)||P7(t)}async function $8(i="en"){const e=j8.get(i);if(e)return e;if(!Z7.has(i))return $8("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)})),j8.set(t,e),e}(i,await e.json()):"en"===i?null:$8("en")}catch(t){return null}}const j8=new Map;function W8(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(W8):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function V8(t,i="en"){if(!$7(t))return;const e=await async function(t,i="en"){return(await $8(i))?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};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(W8({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return F7(n=e)||T7(n)||B7(n)||N7(n)||P7(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return B8(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return I7(t)||_7(t)||B8(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(W8(i))}var n})),Array.isArray(t?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const H8={locale:"en"},z8=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new lz,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new lz,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 bz.isUri(t)||(t=bz.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){$7(e)&&(e=await V8(e,s.locale));const n=await Q7(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 N8(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))??H8}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))}},U8={setProfileForModel:z8.setProfileForModel.bind(z8)};export{i8 as $,h8 as B,z7 as C,d8 as D,lz as E,e8 as F,fV as I,az as K,vz as M,K7 as O,gz as R,mH as S,bz as U,a8 as V,r8 as W,G7 as _,U8 as a,S7 as b,x7 as c,z8 as d,kz as e,f8 as f,QW as g,L7 as h,M7 as i,j7 as j,dz as k,Cz as l,xz as m,D7 as n,V7 as p,c8 as q,p8 as s,FU as t,o8 as z}