@arcgis/coding-components 4.29.0-beta.28 → 4.29.0-beta.29

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 (35) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
  2. package/dist/arcgis-coding-components/index.esm.js +1 -1
  3. package/dist/arcgis-coding-components/{p-5886ff57.js → p-1a0d22c4.js} +1 -1
  4. package/dist/arcgis-coding-components/{p-27c32cb5.js → p-26fffe38.js} +1 -1
  5. package/dist/arcgis-coding-components/{p-19e5c819.js → p-34dd60d8.js} +1 -1
  6. package/dist/arcgis-coding-components/{p-1026ac44.js → p-8bcbc927.js} +7 -7
  7. package/dist/arcgis-coding-components/{p-b22ca8bd.entry.js → p-a3a000a3.entry.js} +1 -1
  8. package/dist/arcgis-coding-components/{p-06933e66.js → p-a9bb9e41.js} +1 -1
  9. package/dist/arcgis-coding-components/{p-3230ff72.js → p-b10937ae.js} +1 -1
  10. package/dist/arcgis-coding-components/{p-0576dbec.js → p-cb05ff6f.js} +1 -1
  11. package/dist/arcgis-coding-components/{p-d295623f.js → p-d831108e.js} +1 -1
  12. package/dist/arcgis-coding-components/{p-03fdafca.js → p-ee72572f.js} +1 -1
  13. package/dist/cjs/{arcade-defaults-f3018d42.js → arcade-defaults-c46e5935.js} +7 -7
  14. package/dist/cjs/{arcade-mode-d8992eff.js → arcade-mode-ac9a13ff.js} +1 -1
  15. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +2 -2
  16. package/dist/cjs/{cssMode-ff46e730.js → cssMode-2e70db98.js} +1 -1
  17. package/dist/cjs/{html-bda3d1b5.js → html-22a1ceba.js} +1 -1
  18. package/dist/cjs/{htmlMode-8f94c96b.js → htmlMode-6ba70d52.js} +1 -1
  19. package/dist/cjs/index.cjs.js +1 -1
  20. package/dist/cjs/{javascript-30f6d6ec.js → javascript-b10c5e7d.js} +2 -2
  21. package/dist/cjs/{jsonMode-8fa83206.js → jsonMode-900c6c97.js} +1 -1
  22. package/dist/cjs/{tsMode-cbdd6b63.js → tsMode-c4091b45.js} +1 -1
  23. package/dist/cjs/{typescript-62fca9c7.js → typescript-54ec7269.js} +1 -1
  24. package/dist/esm/{arcade-defaults-ad21b36b.js → arcade-defaults-565da4a7.js} +7 -7
  25. package/dist/esm/{arcade-mode-b5543a19.js → arcade-mode-2bd19901.js} +1 -1
  26. package/dist/esm/arcgis-arcade-api_6.entry.js +2 -2
  27. package/dist/esm/{cssMode-36fbfe4d.js → cssMode-92a23630.js} +1 -1
  28. package/dist/esm/{html-f3e092fc.js → html-e20b9e94.js} +1 -1
  29. package/dist/esm/{htmlMode-488c22d0.js → htmlMode-b9886405.js} +1 -1
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/{javascript-252e8a68.js → javascript-183cde6a.js} +2 -2
  32. package/dist/esm/{jsonMode-5b163853.js → jsonMode-344fd107.js} +1 -1
  33. package/dist/esm/{tsMode-7ddbcb35.js → tsMode-f0e4299f.js} +1 -1
  34. package/dist/esm/{typescript-ab3b951e.js → typescript-cea2a689.js} +1 -1
  35. package/package.json +14 -14
@@ -18,45 +18,45 @@ import{g as t}from"./p-0fa0a06d.js";function i(t,i=0){return t[t.length-(1+i)]}f
18
18
  * Released under the MIT license
19
19
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
20
20
  *-----------------------------------------------------------------------------*/
21
- ZK({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-19e5c819.js")}),
21
+ ZK({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-34dd60d8.js")}),
22
22
  /*!-----------------------------------------------------------------------------
23
23
  * Copyright (c) Microsoft Corporation. All rights reserved.
24
24
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
25
25
  * Released under the MIT license
26
26
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
27
27
  *-----------------------------------------------------------------------------*/
28
- ZK({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-06933e66.js")}),
28
+ ZK({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-a9bb9e41.js")}),
29
29
  /*!-----------------------------------------------------------------------------
30
30
  * Copyright (c) Microsoft Corporation. All rights reserved.
31
31
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
32
32
  * Released under the MIT license
33
33
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
34
34
  *-----------------------------------------------------------------------------*/
35
- ZK({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-3230ff72.js")});
35
+ ZK({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-b10937ae.js")});
36
36
  /*!-----------------------------------------------------------------------------
37
37
  * Copyright (c) Microsoft Corporation. All rights reserved.
38
38
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
39
39
  * Released under the MIT license
40
40
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
41
41
  *-----------------------------------------------------------------------------*/
42
- var JK=Object.defineProperty,QK=Object.getOwnPropertyDescriptor,YK=Object.getOwnPropertyNames,XK=Object.prototype.hasOwnProperty,tq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of YK(i))XK.call(t,n)||n===e||JK(t,n,{get:()=>i[n],enumerable:!(s=QK(i,n))||s.enumerable});return t},iq={};((t,i)=>{tq(iq,i,"default")})(0,$K);var eq=class{_onDidChange=new iq.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)}},sq={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}},nq={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},rq=new eq("css",sq,nq),oq=new eq("scss",sq,nq),hq=new eq("less",sq,nq);function cq(){return import("./p-5886ff57.js")}iq.languages.css={cssDefaults:rq,lessDefaults:hq,scssDefaults:oq},iq.languages.onLanguage("less",(()=>{cq().then((t=>t.setupMode(hq)))})),iq.languages.onLanguage("scss",(()=>{cq().then((t=>t.setupMode(oq)))})),iq.languages.onLanguage("css",(()=>{cq().then((t=>t.setupMode(rq)))}));
42
+ var JK=Object.defineProperty,QK=Object.getOwnPropertyDescriptor,YK=Object.getOwnPropertyNames,XK=Object.prototype.hasOwnProperty,tq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of YK(i))XK.call(t,n)||n===e||JK(t,n,{get:()=>i[n],enumerable:!(s=QK(i,n))||s.enumerable});return t},iq={};((t,i)=>{tq(iq,i,"default")})(0,$K);var eq=class{_onDidChange=new iq.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)}},sq={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}},nq={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},rq=new eq("css",sq,nq),oq=new eq("scss",sq,nq),hq=new eq("less",sq,nq);function cq(){return import("./p-1a0d22c4.js")}iq.languages.css={cssDefaults:rq,lessDefaults:hq,scssDefaults:oq},iq.languages.onLanguage("less",(()=>{cq().then((t=>t.setupMode(hq)))})),iq.languages.onLanguage("scss",(()=>{cq().then((t=>t.setupMode(oq)))})),iq.languages.onLanguage("css",(()=>{cq().then((t=>t.setupMode(rq)))}));
43
43
  /*!-----------------------------------------------------------------------------
44
44
  * Copyright (c) Microsoft Corporation. All rights reserved.
45
45
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
46
46
  * Released under the MIT license
47
47
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
48
48
  *-----------------------------------------------------------------------------*/
49
- var lq=Object.defineProperty,uq=Object.getOwnPropertyDescriptor,aq=Object.getOwnPropertyNames,dq=Object.prototype.hasOwnProperty,fq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of aq(i))dq.call(t,n)||n===e||lq(t,n,{get:()=>i[n],enumerable:!(s=uq(i,n))||s.enumerable});return t},gq={};((t,i)=>{fq(gq,i,"default")})(0,$K);var pq={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 mq(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===vq,documentFormattingEdits:t===vq,documentRangeFormattingEdits:t===vq}}var vq="html",wq="handlebars",bq="razor",yq=Dq(vq,pq,mq(vq)),kq=yq.defaults,Cq=Dq(wq,pq,mq(wq)),Sq=Cq.defaults,xq=Dq(bq,pq,mq(bq));function Dq(t,i=pq,e=mq(t)){const s=new class{_onDidChange=new gq.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=gq.languages.onLanguage(t,(async()=>{n=(await import("./p-27c32cb5.js")).setupMode(s)}));return{defaults:s,dispose(){r.dispose(),n?.dispose(),n=void 0}}}
49
+ var lq=Object.defineProperty,uq=Object.getOwnPropertyDescriptor,aq=Object.getOwnPropertyNames,dq=Object.prototype.hasOwnProperty,fq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of aq(i))dq.call(t,n)||n===e||lq(t,n,{get:()=>i[n],enumerable:!(s=uq(i,n))||s.enumerable});return t},gq={};((t,i)=>{fq(gq,i,"default")})(0,$K);var pq={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 mq(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===vq,documentFormattingEdits:t===vq,documentRangeFormattingEdits:t===vq}}var vq="html",wq="handlebars",bq="razor",yq=Dq(vq,pq,mq(vq)),kq=yq.defaults,Cq=Dq(wq,pq,mq(wq)),Sq=Cq.defaults,xq=Dq(bq,pq,mq(bq));function Dq(t,i=pq,e=mq(t)){const s=new class{_onDidChange=new gq.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=gq.languages.onLanguage(t,(async()=>{n=(await import("./p-26fffe38.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.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
53
53
  * Released under the MIT license
54
54
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
55
- *-----------------------------------------------------------------------------*/gq.languages.html={htmlDefaults:kq,razorDefaults:xq.defaults,handlebarDefaults:Sq,htmlLanguageService:yq,handlebarLanguageService:Cq,razorLanguageService:xq,registerHTMLLanguageService:Dq};var Eq=Object.defineProperty,Aq=Object.getOwnPropertyDescriptor,Mq=Object.getOwnPropertyNames,Lq=Object.prototype.hasOwnProperty,Oq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Mq(i))Lq.call(t,n)||n===e||Eq(t,n,{get:()=>i[n],enumerable:!(s=Aq(i,n))||s.enumerable});return t},Fq={};((t,i)=>{Oq(Fq,i,"default")})(0,$K);var Tq=new class{_onDidChange=new Fq.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});Fq.languages.json={jsonDefaults:Tq},Fq.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),Fq.languages.onLanguage("json",(()=>{import("./p-0576dbec.js").then((t=>t.setupMode(Tq)))}));
55
+ *-----------------------------------------------------------------------------*/gq.languages.html={htmlDefaults:kq,razorDefaults:xq.defaults,handlebarDefaults:Sq,htmlLanguageService:yq,handlebarLanguageService:Cq,razorLanguageService:xq,registerHTMLLanguageService:Dq};var Eq=Object.defineProperty,Aq=Object.getOwnPropertyDescriptor,Mq=Object.getOwnPropertyNames,Lq=Object.prototype.hasOwnProperty,Oq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Mq(i))Lq.call(t,n)||n===e||Eq(t,n,{get:()=>i[n],enumerable:!(s=Aq(i,n))||s.enumerable});return t},Fq={};((t,i)=>{Oq(Fq,i,"default")})(0,$K);var Tq=new class{_onDidChange=new Fq.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});Fq.languages.json={jsonDefaults:Tq},Fq.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),Fq.languages.onLanguage("json",(()=>{import("./p-cb05ff6f.js").then((t=>t.setupMode(Tq)))}));
56
56
  /*!-----------------------------------------------------------------------------
57
57
  * Copyright (c) Microsoft Corporation. All rights reserved.
58
58
  * Version: 0.44.0(3e047efd345ff102c8c61b5398fb30845aaac166)
59
59
  * Released under the MIT license
60
60
  * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
61
61
  *-----------------------------------------------------------------------------*/
62
- var Rq=Object.defineProperty,_q=Object.getOwnPropertyDescriptor,Iq=Object.getOwnPropertyNames,Pq=Object.prototype.hasOwnProperty,Nq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Iq(i))Pq.call(t,n)||n===e||Rq(t,n,{get:()=>i[n],enumerable:!(s=_q(i,n))||s.enumerable});return t},Bq={};((t,i)=>{Nq(Bq,i,"default")})(0,$K);var $q=(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))($q||{}),jq=(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))(jq||{}),Wq=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(Wq||{}),Vq=(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))(Vq||{}),Hq=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(Hq||{}),zq=class{_onDidChange=new Bq.Emitter;_onDidExtraLibsChange=new Bq.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)}},Uq={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},Kq=new zq({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},Uq),qq=new zq({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},Uq);function Gq(){return import("./p-d295623f.js")}Bq.languages.typescript={ModuleKind:$q,JsxEmit:jq,NewLineKind:Wq,ScriptTarget:Vq,ModuleResolutionKind:Hq,typescriptVersion:"5.0.2",typescriptDefaults:Kq,javascriptDefaults:qq,getTypeScriptWorker:()=>Gq().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>Gq().then((t=>t.getJavaScriptWorker()))},Bq.languages.onLanguage("typescript",(()=>Gq().then((t=>t.setupTypeScript(Kq))))),Bq.languages.onLanguage("javascript",(()=>Gq().then((t=>t.setupJavaScript(qq))))),Eh(class extends Dh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:J(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:ys.map,toggled:Lo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Lo.has("isInDiffEditor"),menu:{when:Lo.has("isInDiffEditor"),id:bh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class Zq extends Dh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:J(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Lo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Eh(Zq);class Jq extends Dh{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:J(0,"Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:Lo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Eh(Jq),Ch.appendMenuItem(bh.EditorTitle,{command:{id:(new Jq).desc.id,title:J(0,"Use Inline View When Space Is Limited"),toggled:Lo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Lo.has("isInDiffEditor")},order:11,group:"1_diff",when:Lo.and(gS.diffEditorRenderSideBySideInlineBreakpointReached,Lo.has("isInDiffEditor"))}),Ch.appendMenuItem(bh.EditorTitle,{command:{id:(new Zq).desc.id,title:J(0,"Show Moved Code Blocks"),icon:ys.move,toggled:_o.create("config.diffEditor.experimental.showMoves",!0),precondition:Lo.has("isInDiffEditor")},order:10,group:"1_diff",when:Lo.has("isInDiffEditor")});const Qq={value:J(0,"Diff Editor"),original:"Diff Editor"};Eh(class extends eu{constructor(){super({id:"diffEditor.switchSide",title:{value:J(0,"Switch Side"),original:"Switch Side"},icon:ys.arrowSwap,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,e){const s=iG(t);if(s instanceof OU){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Eh(class extends eu{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:J(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:ys.close,precondition:gS.comparingMovedCode,f1:!1,category:Qq,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.exitCompareMove()}}),Eh(class extends eu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:J(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:ys.fold,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.collapseAllUnchangedRegions()}}),Eh(class extends eu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:J(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:ys.unfold,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.showAllUnchangedRegions()}});const Yq={value:J(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class Xq extends Dh{constructor(){super({id:Xq.id,title:{value:J(0,"Go to Next Difference"),original:"Go to Next Difference"},category:Yq,precondition:Lo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=iG(t);null==i||i.accessibleDiffViewerNext()}}Xq.id="editor.action.accessibleDiffViewer.next",Ch.appendMenuItem(bh.EditorTitle,{command:{id:Xq.id,title:J(0,"Open Accessible Diff Viewer"),precondition:Lo.has("isInDiffEditor")},order:10,group:"2_diff",when:Lo.and(gS.accessibleDiffViewerVisible.negate(),Lo.has("isInDiffEditor"))});class tG extends Dh{constructor(){super({id:tG.id,title:{value:J(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:Yq,precondition:Lo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=iG(t);null==i||i.accessibleDiffViewerPrev()}}function iG(t){var i;const e=t.get(Yr),s=e.listDiffEditors(),n=null!==(i=e.getFocusedCodeEditor())&&void 0!==i?i:e.getActiveCodeEditor();if(!n)return null;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i.getModifiedEditor().getId()===n.getId()||i.getOriginalEditor().getId()===n.getId())return i}const r=wl();if(r)for(const t of s)if(eG(t.getContainerDomNode(),r))return t;return null}function eG(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}tG.id="editor.action.accessibleDiffViewer.prev",ao.registerCommandAlias("editor.action.diffReview.next",Xq.id),Eh(Xq),ao.registerCommandAlias("editor.action.diffReview.prev",tG.id),Eh(tG);var sG,nG=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 rG=new Zo("selectionAnchorSet",!1);let oG=sG=class{static get(t){return t.getContribution(sG.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=rG.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(ms.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new H_).appendText(J(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),sm(J(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(ms.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()}};oG.ID="editor.contrib.selectionAnchorController",oG=sG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Jo)],oG),hu(oG.ID,oG,4),ru(class extends tu{constructor(){super({id:"editor.action.setSelectionAnchor",label:J(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2080),weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.setSelectionAnchor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.goToSelectionAnchor",label:J(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:rG})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:J(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:rG,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2089),weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:J(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:rG,kbOpts:{kbExpr:gS.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const hG=Om("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},J(0,"Overview ruler marker color for matching brackets."));class cG{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class lG extends Hi{static get(t){return t.getContribution(lG.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Mu((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(t.onDidChangeCursorPosition((()=>{"never"!==this._matchBrackets&&this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelContent((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModel((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelLanguageConfiguration((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())}))),this._register(t.onDidBlurEditorWidget((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidFocusEditorWidget((()=>{this._updateBracketsSoon.schedule()})))}jumpToBracket(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._editor.getSelections().map((i=>{const e=i.getStartPosition(),s=t.bracketPairs.matchBracket(e);let n=null;if(s)s[0].containsPosition(e)&&!s[1].containsPosition(e)?n=s[1].getStartPosition():s[1].containsPosition(e)&&(n=s[0].getStartPosition());else{const i=t.bracketPairs.findEnclosingBrackets(e);if(i)n=i[1].getStartPosition();else{const i=t.bracketPairs.findNextBracket(e);i&&i.range&&(n=i.range.getStartPosition())}}return n?new ms(n.lineNumber,n.column,n.lineNumber,n.column):new ms(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(ps.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 ms(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(gs.compare);const o=[];let h=0,c=0;const l=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<l&&s[c].position.isBefore(e);)c++;if(c<l&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=lG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=lG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new cG(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}lG.ID="editor.contrib.bracketMatchingController",lG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=$M.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:vk(hG),position:Xd.Center}}),lG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=$M.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),hu(lG.ID,lG,1),ru(class extends tu{constructor(){super({id:"editor.action.selectToBracket",label:J(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=lG.get(i))||void 0===s||s.selectToBracket(n)}}),ru(class extends tu{constructor(){super({id:"editor.action.jumpToBracket",label:J(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=lG.get(i))||void 0===e||e.jumpToBracket()}}),ru(class extends tu{constructor(){super({id:"editor.action.removeBrackets",label:J(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=lG.get(i))||void 0===e||e.removeBrackets(this.id)}}),Ch.appendMenuItem(bh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:J(0,"Go to &&Bracket")},order:2});class uG{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 ps(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ps(e,n,e,n),o)}else{const r=new ps(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ps(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new ms(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ms(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class aG extends tu{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 uG(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}ru(class extends aG{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:J(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:gS.writable})}}),ru(class extends aG{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:J(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:gS.writable})}}),ru(class extends tu{constructor(){super({id:"editor.action.transposeLetters",label:J(0,"Transpose Letters"),alias:"Transpose Letters",precondition:gS.writable,kbOpts:{kbExpr:gS.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():zC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=zC.leftPosition(e,o),c=zC.leftPosition(e,h),l=e.getValueInRange(ps.fromPositions(c,h)),u=e.getValueInRange(ps.fromPositions(h,o)),a=ps.fromPositions(c,o);s.push(new BC(a,u+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const dG="9_cutcopypaste",fG=pt||document.queryCommandSupported("cut"),gG=pt||document.queryCommandSupported("copy"),pG=void 0!==navigator.clipboard&&!Lr||document.queryCommandSupported("paste");function mG(t){return t.register(),t}const vG=fG?mG(new Ql({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:pt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"Cu&&t"),order:1},{menuId:bh.EditorContext,group:dG,title:J(0,"Cut"),when:gS.writable,order:1},{menuId:bh.CommandPalette,group:"",title:J(0,"Cut"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Cut"),when:gS.writable,order:1}]})):void 0,wG=gG?mG(new Ql({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:pt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Copy"),order:2},{menuId:bh.EditorContext,group:dG,title:J(0,"Copy"),order:2},{menuId:bh.CommandPalette,group:"",title:J(0,"Copy"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Copy"),order:2}]})):void 0;Ch.appendMenuItem(bh.MenubarEditMenu,{submenu:bh.MenubarCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:dG,order:3}),Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Lo.and(Lo.notEquals("resourceScheme","output"),gS.editorTextFocus)}),Ch.appendMenuItem(bh.EditorTitleContext,{submenu:bh.EditorTitleContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1}),Ch.appendMenuItem(bh.ExplorerContext,{submenu:bh.ExplorerContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1});const bG=pG?mG(new Ql({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:pt?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Paste"),order:4},{menuId:bh.EditorContext,group:dG,title:J(0,"Paste"),when:gS.writable,order:4},{menuId:bh.CommandPalette,group:"",title:J(0,"Paste"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Paste"),when:gS.writable,order:4}]})):void 0;function yG(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(Yr).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(37),s=e.getSelection();return s&&s.isEmpty()&&!t||e.getContainerDomNode().ownerDocument.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(bl().execCommand(i),!0))))}yG(vG,"cut"),yG(wG,"copy"),bG&&(bG.addImplementation(1e4,"code-editor",(t=>{const i=t.get(Yr),e=t.get(EV),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!s.getContainerDomNode().ownerDocument.execCommand("paste")&&mt)||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())}))}(void 0,void 0,void 0,(function*(){const t=yield e.readText();if(""!==t){const i=hk.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(37)&&!!i.isFromEmptySelection,n=void 0!==i.multicursorText?i.multicursorText:null,r=i.mode),s.trigger("keyboard","paste",{text:t,pasteOnNewLine:e,multicursorText:n,mode:r})}})))})),bG.addImplementation(0,"generic-dom",(()=>(bl().execCommand("paste"),!0)))),gG&&ru(class extends tu{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:J(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(ok.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),ok.forceCopyWithSyntaxHighlighting=!1))}});var kG;class CG{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+CG.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new CG(this.value+CG.sep+t)}}function SG(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}CG.sep=".",CG.None=new CG("@@none@@"),CG.Empty=new CG(""),CG.QuickFix=new CG("quickfix"),CG.Refactor=new CG("refactor"),CG.RefactorExtract=CG.Refactor.append("extract"),CG.RefactorInline=CG.Refactor.append("inline"),CG.RefactorMove=CG.Refactor.append("move"),CG.RefactorRewrite=CG.Refactor.append("rewrite"),CG.Notebook=new CG("notebook"),CG.Source=new CG("source"),CG.SourceOrganizeImports=CG.Source.append("organizeImports"),CG.SourceFixAll=CG.Source.append("fixAll"),CG.SurroundWith=CG.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"}(kG||(kG={}));class xG{static fromUser(t,i){return t&&"object"==typeof t?new xG(xG.getKindFromUser(t,i.kind),xG.getApplyFromUser(t,i.apply),xG.getPreferredUser(t)):new xG(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 CG(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 DG{constructor(t,i,e){this.action=t,this.provider=i,this.highlightRange=e}resolve(t){var i;return 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())}))}(this,void 0,void 0,(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}))}}var EG=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 AG="editor.action.codeAction",MG="editor.action.quickFix",LG="editor.action.autoFix",OG="editor.action.refactor",FG="editor.action.sourceAction",TG="editor.action.organizeImports",RG="editor.action.fixAll";class _G 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 a(t.diagnostics)?a(i.diagnostics)?_G.codeActionsPreferredComparator(t,i):-1:a(i.diagnostics)?1:_G.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(_G.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&CG.QuickFix.contains(new CG(t.kind))&&!!t.isPreferred))}}const IG={actions:[],documentation:void 0};function PG(t,i,s,n,r,o){var h;return EG(this,void 0,void 0,(function*(){const l=n.filter||{},u=Object.assign(Object.assign({},l),{excludes:[...l.excludes||[],CG.Notebook]}),a={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new hK(i,o),f=function(t,i,e){return t.all(i).filter((t=>!t.providedCodeActionKinds||t.providedCodeActionKinds.some((t=>function(t,i){return!(t.include&&!t.include.intersects(i)||t.excludes&&t.excludes.some((e=>SG(i,e,t.include)))||!t.includeSourceActions&&CG.Source.contains(i))}(e,new CG(t))))))}(t,i,2===n.type?u:l),g=new Vi,p=f.map((t=>EG(this,void 0,void 0,(function*(){try{r.report(t);const e=yield t.provideCodeActions(i,s,a,d.token);if(e&&g.add(e),d.token.isCancellationRequested)return IG;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new CG(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>SG(e,i,t.include)))||!t.includeSourceActions&&e&&CG.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(l,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new CG(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 CG(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new DG(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),IG}})))),m=t.onDidChange((()=>{e(t.all(i),f)||d.cancel()}));try{const e=yield Promise.all(p),s=e.map((t=>t.actions)).flat(),r=[...c(e.map((t=>t.documentation))),...NG(t,i,n,s)];return new _G(s,r,g)}finally{m.dispose(),d.dispose()}}))}function*NG(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 BG;function $G(t,i,e,s,n=ue.None){var r;return EG(this,void 0,void 0,(function*(){const o=t.get(yT),h=t.get(uo),c=t.get(Ah),l=t.get(vO);if(c.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),yield i.resolve(n),!n.isCancellationRequested){if((null===(r=i.action.edit)||void 0===r?void 0:r.edits.length)&&!(yield o.apply(i.action.edit,{editor:null==s?void 0:s.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!==BG.OnSave,showPreview:null==s?void 0:s.preview})).isApplied)return;if(i.action.command)try{yield h.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(t){const i=function(t){return"string"==typeof t?t:t instanceof Error&&"string"==typeof t.message?t.message:void 0}(t);l.error("string"==typeof i?i:J(0,"An unknown error occurred while applying the code action"))}}}))}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(BG||(BG={})),ao.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return EG(this,void 0,void 0,(function*(){if(!(i instanceof ss))throw Ti();const{codeActionProvider:r}=t.get(Wg),o=t.get(Xr).getModel(i);if(!o)throw Ti();const h=ms.isISelection(e)?ms.liftSelection(e):ps.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ti();const c="string"==typeof s?new CG(s):void 0,l=yield PG(r,o,h,{type:1,triggerAction:kG.Default,filter:{includeSourceActions:!0,include:c}},sR.None,ue.None),u=[],a=Math.min(l.validActions.length,"number"==typeof n?n:0);for(let t=0;t<a;t++)u.push(l.validActions[t].resolve(ue.None));try{return yield Promise.all(u),l.validActions.map((t=>t.action))}finally{setTimeout((()=>l.dispose()),100)}}))}));var jG;let WG=jG=class{constructor(t){this.keybindingService=t}getResolver(){const t=new Mn((()=>this.keybindingService.getKeybindings().filter((t=>jG.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===TG?i={kind:CG.SourceOrganizeImports.value}:t.command===RG&&(i={kind:CG.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},xG.fromUser(i,{kind:CG.None,apply:"never"}))}))));return i=>{if(i.kind){const e=this.bestKeybindingForCodeAction(i,t.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new CG(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)}};WG.codeActionCommands=[OG,AG,FG,TG,RG],WG=jG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,CC)],WG),Om("symbolIcon.arrayForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.booleanForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.colorForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.constantForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.fileForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.folderForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.keyForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.keywordForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.moduleForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.namespaceForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.nullForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.numberForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.objectForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.operatorForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.packageForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.propertyForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.referenceForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.snippetForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.stringForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.structForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.textForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.typeParameterForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.unitForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const VG=Object.freeze({kind:CG.Empty,title:J(0,"More Actions...")}),HG=Object.freeze([{kind:CG.QuickFix,title:J(0,"Quick Fix")},{kind:CG.RefactorExtract,title:J(0,"Extract"),icon:ys.wrench},{kind:CG.RefactorInline,title:J(0,"Inline"),icon:ys.wrench},{kind:CG.RefactorRewrite,title:J(0,"Rewrite"),icon:ys.wrench},{kind:CG.RefactorMove,title:J(0,"Move"),icon:ys.wrench},{kind:CG.SurroundWith,title:J(0,"Surround With"),icon:ys.symbolSnippet},{kind:CG.Source,title:J(0,"Source Action"),icon:ys.symbolFile},VG]);var zG,UG;!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}}}(UG||(UG={}));let KG=zG=class extends Hi{constructor(t,i){var e;super(),this._editor=t,this._onClick=this._register(new ie),this.onClick=this._onClick.event,this._state=UG.Hidden,this._domNode=Pl("div.lightBulbWidget"),this._register(xm.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 Qc(t,wt&&_h?El.POINTER_DOWN:El.MOUSE_DOWN,i,e)}(this._domNode,Yc((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=cl(this._domNode),s=this._editor.getOption(66);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(Qc(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(64)&&!this._editor.getOption(64).enabled&&this.hide()}))),this._register(Ji.runAndSubscribe(i.onDidUpdateKeybindings,(()=>{var t,e,s,n;this._preferredKbLabel=null!==(e=null===(t=i.lookupKeybinding(LG))||void 0===t?void 0:t.getLabel())&&void 0!==e?e:void 0,this._quickFixKbLabel=null!==(n=null===(s=i.lookupKeybinding(MG))||void 0===s?void 0:s.getLabel())&&void 0!==n?n:void 0,this._updateLightBulbTitleAndIcon()})))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return 1===this._state.type?this._state.widgetPosition:null}update(t,i,e){if(t.validActions.length<=0)return this.hide();const s=this._editor.getOptions();if(!s.get(64).enabled)return this.hide();const n=this._editor.getModel();if(!n)return this.hide();const{lineNumber:r,column:o}=n.validatePosition(e),h=n.getOptions().tabSize,c=s.get(50),l=GS(n.getLineContent(r),h),u=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let a=r;if(!(c.spaceWidth*l>22))if(r>1&&!u(r-1))a-=1;else if(u(r+1)){if(o*c.spaceWidth<22)return this.hide()}else a+=1;this.state=new UG.Showing(t,i,e,{position:{lineNumber:a,column:1},preference:zG._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==UG.Hidden&&(this.state=UG.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(...eo.asClassNameArray(ys.lightBulb)),this._domNode.classList.add(...eo.asClassNameArray(ys.lightbulbAutofix)),this._preferredKbLabel)?this.title=J(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...eo.asClassNameArray(ys.lightbulbAutofix)),this._domNode.classList.add(...eo.asClassNameArray(ys.lightBulb)),this.title=this._quickFixKbLabel?J(0,"Show Code Actions ({0})",this._quickFixKbLabel):J(0,"Show Code Actions"))}set title(t){this._domNode.title=t}};KG.ID="editor.contrib.lightbulbWidget",KG._posPref=[0],KG=zG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,CC)],KG);var qG,GG=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())}))};let JG=qG=class{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ie,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(fI(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(t,i){return{codeBlockRenderer:(t,i)=>ZG(this,void 0,void 0,(function*(){var e,s,n;let r;t?r=this._languageService.getLanguageIdByLanguageName(t):this._options.editor&&(r=null===(e=this._options.editor.getModel())||void 0===e?void 0:e.getLanguageId()),r||(r=ed);const o=yield function(t,i,e){return 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())}))}(this,void 0,void 0,(function*(){if(!e)return PL(i,t.languageIdCodec,_L);const s=yield Ns.getOrCreate(e);return PL(i,t.languageIdCodec,s||_L)}))}(this._languageService,i,r),h=document.createElement("span");return h.innerHTML=null!==(n=null===(s=qG._ttpTokenizer)||void 0===s?void 0:s.createHTML(o))&&void 0!==n?n:o,this._options.editor?$r(h,this._options.editor.getOption(50)):this._options.codeBlockFontFamily&&(h.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(h.style.fontSize=this._options.codeBlockFontSize),h})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>QG(this._openerService,i,t.isTrusted),disposables:i}}}};function QG(t,i,e){return ZG(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:YG(e)})}catch(t){return Ei(t),!1}}))}function YG(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}JG._ttpTokenizer=Ku("tokenizeToString",{createHTML:t=>t}),JG=qG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([GG(1,Ba),GG(2,AF)],JG);var XG,tZ=function(t,i){return function(e,s){i(e,s,t)}};let iZ=XG=class{static get(t){return t.getContribution(XG.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new zi,this._messageListeners=new Vi,this._mouseOverMessage=!1,this._editor=t,this._visible=XG.MESSAGE_VISIBLE.bindTo(i)}dispose(){var t;null===(t=this._message)||void 0===t||t.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;sm(U_(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=U_(t)?fI(t,{actionHandler:{callback:i=>QG(this._openerService,i,U_(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new eZ(this._editor,i,"string"==typeof t?t:this._message.element),this._messageListeners.add(Ji.debounce(this._editor.onDidBlurEditorText,((t,i)=>i),0)((()=>{this._mouseOverMessage||this._messageWidget.value&&fl(wl(),this._messageWidget.value.getDomNode())||this.closeMessage()}))),this._messageListeners.add(this._editor.onDidChangeCursorPosition((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidDispose((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidChangeModel((()=>this.closeMessage()))),this._messageListeners.add(Qc(this._messageWidget.value.getDomNode(),El.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Qc(this._messageWidget.value.getDomNode(),El.MOUSE_LEAVE,(()=>this._mouseOverMessage=!1),!0)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new ps(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(eZ.fadeOut(this._messageWidget.value))}};iZ.ID="editor.contrib.messageController",iZ.MESSAGE_VISIBLE=new Zo("messageVisible",!1,J(0,"Whether the editor is currently showing an inline message")),iZ=XG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tZ(1,Jo),tZ(2,AF)],iZ),nu(new(Xl.bindToContribution(iZ.get))({id:"leaveEditorMessage",precondition:iZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class eZ{static fadeOut(t){const i=()=>{t.dispose(),clearTimeout(e),t.getDomNode().removeEventListener("animationend",i)},e=setTimeout(i,110);return t.getDomNode().addEventListener("animationend",i),t.getDomNode().classList.add("fadeOut"),{dispose:i}}constructor(t,{lineNumber:i,column:e},s){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=t,this._editor.revealLinesInCenterIfOutsideViewport(i,i,0),this._position={lineNumber:i,column:e},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);const r=document.createElement("div");"string"==typeof s?(r.classList.add("message"),r.textContent=s):(s.classList.add("message"),r.appendChild(s)),this._domNode.appendChild(r);const o=document.createElement("div");o.classList.add("anchor","below"),this._domNode.appendChild(o),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(t){this._domNode.classList.toggle("below",2===t)}}hu(iZ.ID,iZ,4);var sZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},nZ=function(t,i){return function(e,s){i(e,s,t)}};const rZ="acceptSelectedCodeAction",oZ="previewSelectedCodeAction";class hZ{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 cZ=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 iW(t,xt)}}renderElement(t,i,e){var s,n,r;if((null===(s=t.group)||void 0===s?void 0:s.icon)?(e.icon.className=eo.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=Am(t.group.icon.color.id))):(e.icon.className=eo.asClassName(ys.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=fZ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Nl(...i):Bl(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(rZ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(oZ))||void 0===r?void 0:r.getLabel();e.container.classList.toggle("option-disabled",t.disabled),e.container.title=t.disabled?t.label:o&&h?this._supportsPreview&&t.canPreview?J(0,"{0} to apply, {1} to preview",o,h):J(0,"{0} to apply",o):""}disposeTemplate(t){}};cZ=sZ([nZ(1,CC)],cZ);class lZ extends UIEvent{constructor(){super("acceptSelectedAction")}}class uZ extends UIEvent{constructor(){super("previewSelectedAction")}}function aZ(t){if("action"===t.kind)return t.label}let dZ=class extends Hi{constructor(t,i,e,s,n,r){super(),this._delegate=s,this._contextViewService=n,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new de),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new vP(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new cZ(i,this._keybindingService),new hZ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:aZ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?fZ(null==t?void 0:t.label):"";return t.disabled&&(i=J(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>J(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(KP),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this.onFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=e,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(t){return!t.disabled&&"action"===t.kind}hide(t){this._delegate.onHide(t),this.cts.cancel(),this._contextViewService.hideContextView()}layout(t){const i=this._allMenuItems.filter((t=>"header"===t.kind)).length,e=this._allMenuItems.length*this._actionLineHeight+i*this._headerLineHeight-i*this._actionLineHeight;this._list.layout(e);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 uZ:new lZ;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 uZ):this._list.setSelection([])}onFocus(){var t,i;this._list.domFocus();const e=this._list.getFocus();if(0===e.length)return;const s=this._list.element(e[0]);null===(i=(t=this._delegate).onFocus)||void 0===i||i.call(t,s.item)}onListHover(t){return 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())}))}(this,void 0,void 0,(function*(){const i=t.element;if(i&&i.item&&this.focusCondition(i)){if(this._delegate.onHover&&!i.disabled&&"action"===i.kind){const t=yield this._delegate.onHover(i.item,this.cts.token);i.canPreview=t?t.canPreview:void 0}t.index&&this._list.splice(t.index,1,[i])}this._list.setFocus("number"==typeof t.index?[t.index]:[])}))}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function fZ(t){return t.replace(/\r\n|\r|\n/g," ")}dZ=sZ([nZ(4,ER),nZ(5,CC)],dZ);var gZ=function(t,i){return function(e,s){i(e,s,t)}};Om("actionBar.toggledBackground",{dark:zm,light:zm,hcDark:zm,hcLight:zm},J(0,"Background color for toggled action items in action bar."));const pZ={Visible:new Zo("codeActionMenuVisible",!1,J(0,"Whether the action widget list is visible"))},mZ=Qr("actionWidgetService");let vZ=class extends Hi{get isVisible(){return pZ.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=pZ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(dZ,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(Qc(h,El.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Qc(l,El.POINTER_MOVE,(()=>l.remove()))),r.add(Qc(l,El.MOUSE_DOWN,(()=>l.remove())));let u=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),u=t.getContainer().offsetWidth)}const a=null===(s=this._list.value)||void 0===s?void 0:s.layout(u);n.style.width=`${a}px`;const d=r.add(Ll(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Pl(t),s=new cN(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)}};vZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([gZ(0,ER),gZ(1,Jo),gZ(2,Zr)],vZ),Wa(mZ,vZ,1);const wZ=1100;Eh(class extends Dh{constructor(){super({id:"hideCodeActionWidget",title:{value:J(0,"Hide action widget"),original:"Hide action widget"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:9,secondary:[1033]}})}run(t){t.get(mZ).hide()}}),Eh(class extends Dh{constructor(){super({id:"selectPrevCodeAction",title:{value:J(0,"Select previous action"),original:"Select previous action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.focusPrevious()}}),Eh(class extends Dh{constructor(){super({id:"selectNextCodeAction",title:{value:J(0,"Select next action"),original:"Select next action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.focusNext()}}),Eh(class extends Dh{constructor(){super({id:rZ,title:{value:J(0,"Accept selected action"),original:"Accept selected action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:3,secondary:[2137]}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.acceptSelected()}}),Eh(class extends Dh{constructor(){super({id:oZ,title:{value:J(0,"Preview selected action"),original:"Preview selected action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:2051}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.acceptSelected(!0)}});const bZ=new Zo("supportedCodeAction","");class yZ 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 Eu),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=>LE(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:kG.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 kZ;!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 CZ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(kZ||(kZ={}));const CZ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class SZ extends Hi{constructor(t,i,e,s,n,r){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._configurationService=r,this._codeActionOracle=this._register(new zi),this._state=kZ.Empty,this._onDidChangeState=this._register(new ie),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=bZ.bindTo(s),this._register(this._editor.onDidChangeModel((()=>this._update()))),this._register(this._editor.onDidChangeModelLanguage((()=>this._update()))),this._register(this._registry.onDidChange((()=>this._update()))),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(kZ.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return!!this._configurationService&&this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickfixes",{resource:null==i?void 0:i.uri})}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(kZ.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(90)){const i=this._registry.all(t).flatMap((t=>{var i;return null!==(i=t.providedCodeActionKinds)&&void 0!==i?i:[]}));this._supportedCodeActions.set(i.join(" ")),this._codeActionOracle.value=new yZ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(kZ.Empty);const s=i.selection.getStartPosition(),n=wu((e=>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())}))}(this,void 0,void 0,(function*(){var s,n,r,o,h,c;if(this._settingEnabledNearbyQuickfixes()&&1===i.trigger.type&&(i.trigger.triggerAction===kG.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(CG.QuickFix)))){const s=yield PG(this._registry,t,i.selection,i.trigger,sR.None,e);if(e.isCancellationRequested)return CZ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&CG.QuickFix.contains(new CG(t.action.kind)))))){const n=this._markerService.read({resource:t.uri});if(n.length>0){const r=i.selection.getPosition();let l=r,u=Number.MAX_VALUE,a=!1;for(const t of n){const i=t.endColumn,e=t.endLineNumber;(e===r.lineNumber||t.startLineNumber===r.lineNumber)&&Math.abs(r.column-i)<u&&(u=Math.abs(r.column-i),a=!0,l=new gs(e,i))}if(a){const n={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(null===(o=i.trigger.filter)||void 0===o?void 0:o.include)?null===(h=i.trigger.filter)||void 0===h?void 0:h.include:CG.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:(null===(c=i.trigger.context)||void 0===c?void 0:c.notAvailableMessage)||"",position:l}},r=new ms(l.lineNumber,l.column,l.lineNumber,l.column),u=yield PG(this._registry,t,r,n,sR.None,e),a=[...s.validActions];return 0!==u.validActions.length&&(u.validActions.forEach((t=>{t.highlightRange=t.action.isPreferred})),a.push(...u.validActions)),{validActions:a,allActions:s.allActions,documentation:s.documentation,hasAutoFix:s.hasAutoFix,dispose:()=>{s.dispose()}}}}}}return PG(this._registry,t,i.selection,i.trigger,sR.None,e)}))));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new kZ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:kG.Default})}else this._supportedCodeActions.reset()}trigger(t){var i;null===(i=this._codeActionOracle.value)||void 0===i||i.trigger(t)}setState(t,i){t!==this._state&&(1===this._state.type&&this._state.cancel(),this._state=t,i||this._disposed||this._onDidChangeState.fire(t))}}var xZ,DZ=function(t,i){return function(e,s){i(e,s,t)}},EZ=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 AZ=xZ=class extends Hi{static get(t){return t.getContribution(xZ.ID)}constructor(t,i,e,s,n,r,o,h,c,l){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=l,this._activeCodeActions=this._register(new zi),this._showDisabled=!1,this._disposed=!1,this._editor=t,this._model=this._register(new SZ(this._editor,n.codeActionProvider,i,e,r,h)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new Mn((()=>{const t=this._editor.getContribution(KG.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(WG),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(t,i,e){return this.showCodeActionList(i,e,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(t,i,e,s){var n;if(!this._editor.hasModel())return;null===(n=iZ.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 EZ(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction($G,t,BG.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:kG.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return EZ(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(!this._disposed)if(null===(e=this._lightBulbWidget.value)||void 0===e||e.update(c,t.trigger,t.position),1===t.trigger.type){if(null===(s=t.trigger.filter)||void 0===s?void 0:s.include){const i=this.tryGetValidActionToApply(t.trigger,c);if(i){try{null===(n=this._lightBulbWidget.value)||void 0===n||n.hide(),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=iZ.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=iZ.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 EZ(this,void 0,void 0,(function*(){const s=this._editor.createDecorationsCollection(),n=this._editor.getDomNode();if(!n)return;const r=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!r.length)return;const o=gs.isIPosition(i)?this.toCoords(i):i,h={onSelect:(t,i)=>EZ(this,void 0,void 0,(function*(){this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide(),s.clear()})),onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus(),s.clear()},onHover:(t,i)=>EZ(this,void 0,void 0,(function*(){var e;if(yield t.resolve(i),!i.isCancellationRequested)return{canPreview:!!(null===(e=t.action.edit)||void 0===e?void 0:e.edits.length)}})),onFocus:t=>{var i,e;if(t&&t.highlightRange&&t.action.diagnostics){s.set([{range:t.action.diagnostics[0],options:xZ.DECORATION}]);const n=t.action.diagnostics[0];nm(J(0,"Context: {0} at line {1} and column {2}.",null===(e=null===(i=this._editor.getModel())||void 0===i?void 0:i.getWordAtPosition({lineNumber:n.startLineNumber,column:n.startColumn}))||void 0===e?void 0:e.word,n.startLineNumber,n.startColumn))}else s.clear()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>{var i;return{kind:"action",item:t,group:VG,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title,canPreview:!!(null===(i=t.action.edit)||void 0===i?void 0:i.edits.length)}}));const s=HG.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new CG(i.action.kind):CG.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}(r,this._shouldShowHeaders(),this._resolver.getResolver()),h,o,n,this._getActionBarActions(t,i,e))}))}toCoords(t){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(t,1),this._editor.render();const i=this._editor.getScrolledVisiblePosition(t),e=cl(this._editor.getDomNode());return{x:e.left+i.left,y:e.top+i.top+i.height}}_shouldShowHeaders(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:null==i?void 0:i.uri})}_getActionBarActions(t,i,e){if(e.fromLightbulb)return[];const s=t.documentation.map((t=>{var i;return{id:t.id,label:t.title,tooltip:null!==(i=t.tooltip)&&void 0!==i?i:"",class:void 0,enabled:!0,run:()=>{var i;return this._commandService.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}}}));return e.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&s.push(this._showDisabled?{id:"hideMoreActions",label:J(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,e))}:{id:"showMoreActions",label:J(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,e))}),s}};function MZ(t){return Lo.regex(bZ.keys()[0],new RegExp("(\\s|^)"+Rn(t.value)+"\\b"))}AZ.ID="editor.contrib.codeActionController",AZ.DECORATION=$M.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),AZ=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}([DZ(1,FN),DZ(2,Jo),DZ(3,Zr),DZ(4,Wg),DZ(5,nR),DZ(6,uo),DZ(7,Ta),DZ(8,mZ),DZ(9,Zr)],AZ),kk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(qv));const e=t.getColor(Jv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${oy(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const LZ={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:J(0,"Kind of the code action to run.")},apply:{type:"string",description:J(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[J(0,"Always apply the first returned code action."),J(0,"Apply the first returned code action if it is the only one."),J(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:J(0,"Controls if only preferred code actions should be returned.")}}};function OZ(t,i,e,s,n=kG.Default){if(t.hasModel()){const r=AZ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}hu(AZ.ID,AZ,3),hu(KG.ID,KG,4),ru(class extends tu{constructor(){super({id:MG,label:J(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),kbOpts:{kbExpr:gS.textInputFocus,primary:2137,weight:100}})}run(t,i){return OZ(i,J(0,"No code actions available"),void 0,void 0,kG.QuickFix)}}),ru(class extends tu{constructor(){super({id:OG,label:J(0,"Refactor..."),alias:"Refactor...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),kbOpts:{kbExpr:gS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Lo.and(gS.writable,MZ(CG.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:LZ}]}})}run(t,i,e){const s=xG.fromUser(e,{kind:CG.Refactor,apply:"never"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",e.kind):J(0,s.preferred?"No preferred refactorings available":"No refactorings available"),{include:CG.Refactor.contains(s.kind)?s.kind:CG.None,onlyIncludePreferredActions:s.preferred},s.apply,kG.Refactor)}}),ru(class extends tu{constructor(){super({id:FG,label:J(0,"Source Action..."),alias:"Source Action...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Lo.and(gS.writable,MZ(CG.Source))},description:{description:"Source Action...",args:[{name:"args",schema:LZ}]}})}run(t,i,e){const s=xG.fromUser(e,{kind:CG.Source,apply:"never"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",e.kind):J(0,s.preferred?"No preferred source actions available":"No source actions available"),{include:CG.Source.contains(s.kind)?s.kind:CG.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,kG.SourceAction)}}),ru(class extends tu{constructor(){super({id:TG,label:J(0,"Organize Imports"),alias:"Organize Imports",precondition:Lo.and(gS.writable,MZ(CG.SourceOrganizeImports)),kbOpts:{kbExpr:gS.textInputFocus,primary:1581,weight:100}})}run(t,i){return OZ(i,J(0,"No organize imports action available"),{include:CG.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",kG.OrganizeImports)}}),ru(class extends tu{constructor(){super({id:LG,label:J(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Lo.and(gS.writable,MZ(CG.QuickFix)),kbOpts:{kbExpr:gS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return OZ(i,J(0,"No auto fixes available"),{include:CG.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",kG.AutoFix)}}),ru(class extends tu{constructor(){super({id:RG,label:J(0,"Fix All"),alias:"Fix All",precondition:Lo.and(gS.writable,MZ(CG.SourceFixAll))})}run(t,i){return OZ(i,J(0,"No fix all action available"),{include:CG.SourceFixAll,includeSourceActions:!0},"ifSingle",kG.FixAll)}}),nu(new class extends Xl{constructor(){super({id:AG,precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:LZ}]}})}runEditorCommand(t,i,e){const s=xG.fromUser(e,{kind:CG.Empty,apply:"ifSingle"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",e.kind):J(0,s.preferred?"No preferred code actions available":"No code actions available"),{include:s.kind,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply)}}),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:J(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}})),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{"editor.codeActionWidget.includeNearbyQuickfixes":{type:"boolean",scope:5,description:J(0,"Enable/disable showing nearest quickfix within a line when not currently on a diagnostic."),default:!1}}}));var FZ=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 TZ{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 RZ(t,i,e){return FZ(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new TZ,o=s.map(((t,s)=>FZ(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}))}ao.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(ss.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get(Wg),r=t.get(Xr).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return RZ(n,r,ue.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,ue.None)).then((t=>o.push(t||e.symbol))));return Promise.all(i)})).then((()=>o)).finally((()=>{setTimeout((()=>h.dispose()),100)}))}));const _Z=Qr("ICodeLensCache");class IZ{constructor(t,i){this.lineCount=t,this.data=i}}let PZ=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new lg(20,.75),Lu((()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Ji.once(t.onWillSaveState)((e=>{e.reason===NP.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 TZ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new IZ(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 ps(t,1,t,11)});const n=new TZ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new IZ(e.lineCount,n))}}catch(t){}}};PZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,PP)],PZ),Wa(_Z,PZ,1);class NZ{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 BZ{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+BZ._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=sI(n.command.title.trim());n.command.id?(e.push(Pl("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Pl("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Pl("span",void 0," | "))}}s?(Tl(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Tl(this._domNode,Pl("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}}BZ._idPool=0;class $Z{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 jZ=$M.register({collapseOnReplaceEdit:!0,description:"codelens"});class WZ{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:jZ},(t=>this._decorationIds[i]=t)),o=o?ps.plusRange(o,t.symbol.range):ps.lift(t.symbol.range)})),this._viewZone=new NZ(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 BZ(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||ps.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:jZ},(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 VZ=function(t,i){return function(e,s){i(e,s,t)}},HZ=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 zZ=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 Mu((()=>this._resolveCodeLensesInViewport()),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(19)||t.hasChanged(18))&&this._updateLensStyle(),t.hasChanged(17)&&this._onModelChange()}))),this._disposables.add(i.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var t;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),null===(t=this._currentCodeLensModel)||void 0===t||t.dispose()}_getLayoutInfo(){const t=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let i=this._editor.getOption(19);return(!i||i<5)&&(i=.9*this._editor.getOption(52)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(18),s=this._editor.getOption(50),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${t}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",s.fontFeatureSettings),e&&(n.setProperty("--vscode-editorCodeLens-fontFamily",e),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",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(17)||t.isTooLargeForTokenization())return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&this._localToDispose.add(xu((()=>{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 Mu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=wu((i=>RZ(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 $Z;e.forEach((t=>{t.dispose(n,i),this._lenses.splice(this._lenses.indexOf(t),1)})),n.commit(t)}))})),e.schedule(),this._resolveCodeLensesScheduler.cancel(),null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0}))),this._localToDispose.add(this._editor.onDidFocusEditorWidget((()=>{e.schedule()}))),this._localToDispose.add(this._editor.onDidBlurEditorText((()=>{e.cancel()}))),this._localToDispose.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(Wi((()=>{if(this._editor.getModel()){const t=tU.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 $Z;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=tU.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new $Z;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 WZ(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 WZ(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=wu((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(){var t;return HZ(this,void 0,void 0,(function*(){return yield this._getCodeLensModelPromise,yield this._resolveCodeLensesPromise,(null===(t=this._currentCodeLensModel)||void 0===t?void 0:t.isDisposed)?void 0:this._currentCodeLensModel}))}};zZ.ID="css.editor.codeLens",zZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([VZ(1,Wg),VZ(2,FF),VZ(3,uo),VZ(4,vO),VZ(5,_Z)],zZ),hu(zZ.ID,zZ,1),ru(class extends tu{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:gS.hasCodeLensProvider,label:J(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return HZ(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Ij),s=t.get(uo),n=t.get(vO),r=i.getSelection().positionLineNumber,o=i.getContribution(zZ.ID);if(!o)return;const h=yield o.getModel();if(!h)return;const c=[];for(const t of h.lenses)t.symbol.command&&t.symbol.range.startLineNumber===r&&c.push({label:t.symbol.command.title,command:t.symbol.command});if(0===c.length)return;const l=yield e.pick(c,{canPickMany:!1,placeHolder:J(0,"Select a command")});if(!l)return;let u=l.command;if(h.isDisposed){const t=yield o.getModel(),i=null==t?void 0:t.lenses.find((t=>{var i;return t.symbol.range.startLineNumber===r&&(null===(i=t.symbol.command)||void 0===i?void 0:i.title)===u.title}));if(!i||!i.symbol.command)return;u=i.symbol.command}try{yield s.executeCommand(u.id,...u.arguments||[])}catch(t){n.error(t)}}))}});var UZ=function(t,i){return function(e,s){i(e,s,t)}};class KZ{constructor(t,i){this._editorWorkerClient=new Qg(t,!1,"editorWorkerService",i)}provideDocumentColors(t,i){return 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())}))}(this,void 0,void 0,(function*(){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)}))}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new Mg(new Dg(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Mg.Format.CSS.formatRGB(o):Mg.Format.CSS.formatRGBA(o),c=r?Mg.Format.CSS.formatHSL(o):Mg.Format.CSS.formatHSLA(o),l=r?Mg.Format.CSS.formatHex(o):Mg.Format.CSS.formatHexA(o),u=[];return u.push({label:h,textEdit:{range:s,text:h}}),u.push({label:c,textEdit:{range:s,text:c}}),u.push({label:l,textEdit:{range:s,text:l}}),u}}let qZ=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new KZ(t,i)))}};qZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([UZ(0,Xr),UZ(1,ud),UZ(2,Wg)],qZ),tH(qZ);var GZ=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 ZZ(t,i,e,s=!0){return GZ(this,void 0,void 0,(function*(){return tJ(new QZ,t,i,e,s)}))}function JZ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class QZ{constructor(){}compute(t,i,e,s){return GZ(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 YZ{constructor(){}compute(t,i,e,s){return GZ(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 XZ{constructor(t){this.colorInfo=t}compute(t,i,e,s){return GZ(this,void 0,void 0,(function*(){const e=yield t.provideColorPresentations(i,this.colorInfo,ue.None);return Array.isArray(e)&&s.push(...e),Array.isArray(e)}))}}function tJ(t,i,e,s,n){return GZ(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 KZ)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 iJ(t,i){const{colorProvider:e}=t.get(Wg),s=t.get(Xr).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(Ta).getValue("editor.defaultColorDecorators",{resource:i})}}ao.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof ss))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=iJ(t,e);return tJ(new YZ,n,s,ue.None,r)})),ao.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof ss&&Array.isArray(e)&&4===e.length&&ps.isIRange(r)))throw Ti();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=iJ(t,n),[l,u,a,d]=e;return tJ(new XZ({range:r,color:{red:l,green:u,blue:a,alpha:d}}),h,o,ue.None,c)}));var eJ,sJ=function(t,i){return function(e,s){i(e,s,t)}},nJ=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 rJ=Object.create({});let oJ=eJ=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._configurationService=i,this._languageFeaturesService=e,this._localToDispose=this._register(new Vi),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new Ub(this._editor),this._decoratorLimitReporter=new hJ,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:eJ.RECOMPUTE_TIME}),this._register(t.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(t.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(e.colorProvider.onDidChange((()=>this.updateColors()))),this._register(t.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(21),s=t.hasChanged(145);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const t=this._editor.getModel();if(!t)return!1;const i=t.getLanguageId(),e=this._configurationService.getValue(i);if(e&&"object"==typeof e){const t=e.colorDecorators;if(t&&void 0!==t.enable&&!t.enable)return t.enable}return this._editor.getOption(20)}static get(t){return t.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const t=this._editor.getModel();t&&this._languageFeaturesService.colorProvider.has(t)&&(this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._timeoutTimer||(this._timeoutTimer=new Eu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return nJ(this,void 0,void 0,(function*(){this._computePromise=wu((t=>nJ(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Zi(!1),s=yield ZZ(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:$M.EMPTY})));this._editor.changeDecorations((e=>{this._decorationsIds=e.deltaDecorations(this._decorationsIds,i),this._colorDatas=new Map,this._decorationsIds.forEach(((i,e)=>this._colorDatas.set(i,t[e])))}))}updateColorDecorators(t){this._colorDecorationClassRefs.clear();const i=[],e=this._editor.getOption(21);for(let s=0;s<t.length&&i.length<e;s++){const{red:e,green:n,blue:r,alpha:o}=t[s].colorInfo.color,h=new Dg(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:rJ}}})}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(ps.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)}};oJ.ID="editor.contrib.colorDetector",oJ.RECOMPUTE_TIME=1e3,oJ=eJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([sJ(1,Ta),sJ(2,Wg),sJ(3,FF)],oJ);class hJ{constructor(){this._onDidChange=new ie,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}hu(oJ.ID,oJ,1);class cJ{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 ie,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ie,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ie,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 lJ=Pl;class uJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=lJ(".colorpicker-header"),Ol(t,this._domNode),this._pickedColorNode=Ol(this._domNode,lJ(".picked-color")),Ol(this._pickedColorNode,lJ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Ol(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const n=J(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",n),this._originalColorNode=Ol(this._domNode,lJ(".original-color")),this._originalColorNode.style.backgroundColor=Mg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(Yv)||Mg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Yv)||Mg.white}))),this._register(Qc(this._pickedColorNode,El.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Qc(this._originalColorNode,El.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=Mg.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 aJ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Mg.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class aJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Ol(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Ol(this._button,i),Ol(i,lJ(".button"+eo.asCSSSelector(GW("color-picker-close",ys.close,J(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class dJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=lJ(".colorpicker-body"),Ol(t,this._domNode),this._saturationBox=new fJ(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 pJ(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 mJ(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 vJ(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 Mg(new Ag(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Mg(new Ag(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Mg(new Ag(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 fJ extends Hi{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ie,this.onColorFlushed=this._onColorFlushed.event,this._domNode=lJ(".saturation-wrap"),Ol(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ol(this._domNode,this._canvas),this.selection=lJ(".saturation-selection"),Ol(this._domNode,this.selection),this.layout(),this._register(Qc(this._domNode,El.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 Dm);const i=cl(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=Qc(t.target.ownerDocument,El.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 Mg(new Ag(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=Mg.Format.CSS.format(t),i.fill(),i.fillStyle=e,i.fill(),i.fillStyle=s,i.fill()}paintSelection(t,i){this.selection.style.left=t*this.width+"px",this.selection.style.top=this.height-i*this.height+"px"}onDidChangeColor(t){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const i=t.hsva;this.paintSelection(i.s,i.v)}}class gJ extends Hi{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ie,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=Ol(t,lJ(".standalone-strip")),this.overlay=Ol(this.domNode,lJ(".standalone-overlay"))):(this.domNode=Ol(t,lJ(".strip")),this.overlay=Ol(this.domNode,lJ(".overlay"))),this.slider=Ol(this.domNode,lJ(".slider")),this.slider.style.top="0px",this._register(Qc(this.domNode,El.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onDidChangeColor(t){const i=this.getValue(t);this.updateSliderPosition(i)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new Dm),e=cl(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=Qc(t.target.ownerDocument,El.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 pJ extends gJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){super.onDidChangeColor(t);const{r:i,g:e,b:s}=t.rgba,n=new Mg(new Dg(i,e,s,1)),r=new Mg(new Dg(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class mJ extends gJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class vJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=Ol(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 wJ extends Ty{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Ar.onDidChange((()=>this.layout())));const r=lJ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new uJ(r,this.model,s,n)),this.body=this._register(new dJ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var bJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},kJ=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 CJ{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 SJ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return Ru.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=oJ.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 EJ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return AJ(this,this._editor,this._themeService,i,t)}};SJ=bJ([yJ(1,mk)],SJ);class xJ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let DJ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!oJ.get(this._editor))return null;const s=yield ZZ(e,this._editor.getModel(),ue.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;ps.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 EJ(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=t.model;let e=new ps(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(yield LJ(this._editor.getModel(),i,this._color,e,t),e=MJ(this._editor,e,i))}))}renderHoverParts(t,i){return AJ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function EJ(t,i,e,s){return kJ(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Dg(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),u=new Mg(l),a=yield JZ(i,e,s,ue.None),d=new cJ(u,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(u,n),t instanceof SJ?new CJ(t,ps.lift(e.range),d,s):new xJ(t,ps.lift(e.range),d,s)}))}function AJ(t,i,e,s,n){if(0===s.length||!i.hasModel())return Hi.None;if(n.setMinimumDimensions){const t=i.getOption(66)+8;n.setMinimumDimensions(new ol(302,t))}const r=new Vi,o=s[0],h=i.getModel(),c=o.model,l=r.add(new wJ(n.fragment,c,i.getOption(141),e,t instanceof DJ));n.setColorPicker(l);let u=!1,a=new ps(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof DJ){const i=s[0].model.color;t.color=i,LJ(h,c,i,a,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>kJ(this,void 0,void 0,(function*(){yield LJ(h,c,t,a,o),u=!0,a=MJ(i,a,c,n)})))));return r.add(c.onDidChangeColor((t=>{LJ(h,c,t,a,o)}))),r.add(i.onDidChangeModelContent((()=>{u?u=!1:(n.hide(),i.focus())}))),r}function MJ(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new ps(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 LJ(t,i,e,s,n){return kJ(this,void 0,void 0,(function*(){const r=yield JZ(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,ue.None);i.colorPresentations=r||[]}))}function OJ(t,i){return!!t[i]}DJ=bJ([yJ(1,mk)],DJ);class FJ{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=OJ(t.event,i.triggerModifier),this.hasSideBySideModifier=OJ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class TJ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=OJ(t,i.triggerModifier)}}class RJ{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 _J(t){return"altKey"===t?ft?new RJ(57,"metaKey",6,"altKey"):new RJ(5,"ctrlKey",6,"altKey"):ft?new RJ(6,"altKey",57,"metaKey"):new RJ(6,"altKey",5,"ctrlKey")}class IJ extends Hi{constructor(t,i){var e;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ie),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ie),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ie),this.onCancel=this._onCancel.event,this._editor=t,this._extractLineNumberFromMouseEvent=null!==(e=null==i?void 0:i.extractLineNumberFromMouseEvent)&&void 0!==e?e:t=>t.target.position?t.target.position.lineNumber:0,this._opts=_J(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(77)){const t=_J(this._editor.getOption(77));if(this._opts.equals(t))return;this._opts=t,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}}))),this._register(this._editor.onMouseMove((t=>this._onEditorMouseMove(new FJ(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new FJ(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new FJ(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new TJ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new TJ(t,this._opts))))),this._register(this._editor.onMouseDrag((()=>this._resetHandler()))),this._register(this._editor.onDidChangeCursorSelection((t=>this._onDidChangeCursorSelection(t)))),this._register(this._editor.onDidChangeModel((()=>this._resetHandler()))),this._register(this._editor.onDidChangeModelContent((()=>this._resetHandler()))),this._register(this._editor.onDidScrollChange((t=>{(t.scrollTopChanged||t.scrollLeftChanged)&&this._resetHandler()})))}_onDidChangeCursorSelection(t){t.selection&&t.selection.startColumn!==t.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(t){this._lastMouseMoveEvent=t,this._onMouseMoveOrRelevantKeyDown.fire([t,null])}_onEditorMouseDown(t){this._hasTriggerKeyOnMouseDown=t.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(t)}_onEditorMouseUp(t){const i=this._extractLineNumberFromMouseEvent(t);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===i&&this._onExecute.fire(t)}_onEditorKeyDown(t){this._lastMouseMoveEvent&&(t.keyCodeIsTriggerKey||t.keyCodeIsSideBySideKey&&t.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,t]):t.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(t){t.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var PJ=function(t,i){return function(e,s){i(e,s,t)}};let NJ=class extends HO{constructor(t,i,e,s,n,r,o,h,c,l,u,a,d){super(t,Object.assign(Object.assign({},s.getRawOptions()),{overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()}),e,n,r,o,h,c,l,u,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){K(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};NJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([PJ(4,Zr),PJ(5,Yr),PJ(6,uo),PJ(7,Jo),PJ(8,mk),PJ(9,vO),PJ(10,gm),PJ(11,ud),PJ(12,Wg)],NJ);const BJ=new Mg(new Dg(0,122,204)),$J={showArrow:!0,showFrame:!0,className:"",frameColor:BJ,arrowColor:BJ,keepEditorSelection:!1};class jJ{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 WJ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class VJ{constructor(t){this._editor=t,this._ruleName=VJ._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),xl(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(){xl(this._ruleName),Sl(`.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:ps.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}VJ._IdGenerator=new rI(".arrow-decoration-");class HJ{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=V(i),K(this.options,$J,!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 VJ(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=ps.isIRange(t)?ps.lift(t):ps.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:$M.EMPTY}])}hide(){var t;this._viewZone&&(this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id)})),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),null===(t=this._arrow)||void 0===t||t.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const t=this.editor.getOption(66);let i=0;return this.options.showArrow&&(i+=2*Math.round(t/3)),this.options.showFrame&&(i+=2*Math.round(t/9)),i}_showImpl(t,i){const e=t.getStartPosition(),s=this.editor.getLayoutInfo(),n=this._getWidth(s);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(s)+"px";const r=document.createElement("div");r.style.overflow="hidden";const o=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const t=Math.max(12,this.editor.getLayoutInfo().height/o*.8);i=Math.min(i,t)}let h=0,c=0;if(this._arrow&&this.options.showArrow&&(h=Math.round(o/3),this._arrow.height=h,this._arrow.show(e)),this.options.showFrame&&(c=Math.round(o/9)),this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new jJ(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 WJ("vs.editor.contrib.zoneWidget"+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)})),this.container&&this.options.showFrame){const t=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=t+"px",this.container.style.borderBottomWidth=t+"px"}const l=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=l+"px",this.container.style.overflow="hidden"),this._doLayout(l,n),this.options.keepEditorSelection||this.editor.setSelection(t);const u=this.editor.getModel();if(u){const i=u.validateRange(new ps(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===u.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 tB(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0),this._disposables.add(this._resizeSash.onDidStart((i=>{this._viewZone&&(t={startY:i.startY,heightInLines:this._viewZone.heightInLines})}))),this._disposables.add(this._resizeSash.onDidEnd((()=>{t=void 0}))),this._disposables.add(this._resizeSash.onDidChange((i=>{if(t){const e=(i.currentY-t.startY)/this.editor.getOption(66),s=e<0?Math.ceil(e):Math.floor(e),n=t.heightInLines+s;n>5&&n<35&&this._relayout(n)}})))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(null===this.domNode.style.height?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const t=this.editor.getLayoutInfo();return t.width-t.minimap.minimapWidth}}var zJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},UJ=function(t,i){return function(e,s){i(e,s,t)}};const KJ=Qr("IPeekViewService");var qJ;Wa(KJ,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 Zo("inReferenceSearchEditor",!0,J(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(qJ||(qJ={}));let GJ=class{constructor(t,i){t instanceof NJ&&qJ.inPeekEditor.bindTo(i)}dispose(){}};GJ.ID="editor.contrib.referenceController",GJ=zJ([UJ(1,Jo)],GJ),hu(GJ.ID,GJ,0);const ZJ={headerBackgroundColor:Mg.white,primaryHeadingColor:Mg.fromHex("#333333"),secondaryHeadingColor:Mg.fromHex("#6c6c6cb3")};let JJ=class extends HJ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,K(this.options,ZJ,!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=Pl(".head"),this._bodyElement=Pl(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Pl(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Xc(this._titleElement,"click",(t=>this._onTitleClick(t)))),Ol(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Pl("span.filename"),this._secondaryHeading=Pl("span.dirname"),this._metaHeading=Pl("span.meta"),Ol(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=Pl(".peekview-actions");Ol(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new cN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new no("peekview.close",J(0,"Close"),eo.asClassName(ys.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:hN.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:Gc(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Nl(this._metaHeading)):Bl(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(66)),s=Math.round(t-(e+2));this._doLayoutHead(e,i),this._doLayoutBody(s,i)}_doLayoutHead(t,i){this._headElement&&(this._headElement.style.height=`${t}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(t,i){this._bodyElement&&(this._bodyElement.style.height=`${t}px`)}};JJ=zJ([UJ(2,Zr)],JJ);const QJ=Om("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view title area.")),YJ=Om("peekViewTitleLabel.foreground",{dark:Mg.white,light:Mg.black,hcDark:Mg.white,hcLight:Mv},J(0,"Color of the peek view title.")),XJ=Om("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},J(0,"Color of the peek view title info.")),tQ=Om("peekView.border",{dark:xv,light:xv,hcDark:Im,hcLight:Im},J(0,"Color of the peek view borders and arrow.")),iQ=Om("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view result list."));Om("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color for line nodes in the peek view result list.")),Om("peekViewResult.fileForeground",{dark:Mg.white,light:"#1E1E1E",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color for file nodes in the peek view result list.")),Om("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},J(0,"Background color of the selected entry in the peek view result list.")),Om("peekViewResult.selectionForeground",{dark:Mg.white,light:"#6C6C6C",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color of the selected entry in the peek view result list."));const eQ=Om("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view editor."));Om("peekViewEditorGutter.background",{dark:eQ,light:eQ,hcDark:eQ,hcLight:eQ},J(0,"Background color of the gutter in the peek view editor.")),Om("peekViewEditorStickyScroll.background",{dark:eQ,light:eQ,hcDark:eQ,hcLight:eQ},J(0,"Background color of sticky scroll in the peek view editor.")),Om("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view result list.")),Om("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view editor.")),Om("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Pm,hcLight:Pm},J(0,"Match highlight border in the peek view editor."));class sQ{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=oI.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?J(0,"{0} in {1} on line {2} at column {3}",i.value,FE(this.uri),this.range.startLineNumber,this.range.startColumn):J(0,"in {0} on line {1} at column {2}",FE(this.uri),this.range.startLineNumber,this.range.startColumn)}}class nQ{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 ps(s,h.startColumn,s,n),l=new ps(r,o,r,1073741824),u=e.getValueInRange(c).replace(/^\s+/,""),a=e.getValueInRange(t);return{value:u+a+e.getValueInRange(l).replace(/\s+$/,""),highlight:{start:u.length,end:u.length+a.length}}}}class rQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new hg}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?J(0,"1 symbol in {0}, full path {1}",FE(this.uri),this.uri.fsPath):J(0,"{0} symbols in {1}, full path {2}",t,FE(this.uri),this.uri.fsPath)}resolve(t){return 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())}))}(this,void 0,void 0,(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 nQ(e))}catch(t){Ei(t)}return this}))}}class oQ{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ie,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(oQ._compareReferences);for(const i of t)if(s&&ME.isEqual(s.uri,i.uri,!0)||(s=new rQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==oQ._compareReferences(i,s.children[s.children.length-1])){const t=new sQ(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 oQ(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?J(0,"No results found"):1===this.references.length?J(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?J(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):J(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:Qn(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()&&ps.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 ME.compare(t.uri,i.uri)||ps.compareRangesUsingStarts(t.range,i.range)}}var hQ,cQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},lQ=function(t,i){return function(e,s){i(e,s,t)}};let uQ=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof oQ||t instanceof rQ}getChildren(t){if(t instanceof oQ)return t.groups;if(t instanceof rQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};uQ=cQ([lQ(0,to)],uQ);class aQ{getHeight(){return 23}getTemplateId(t){return t instanceof rQ?pQ.id:vQ.id}}let dQ=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof sQ){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return FE(t.uri)}};dQ=cQ([lQ(0,CC)],dQ);class fQ{getId(t){return t instanceof sQ?t.id:t.uri}}let gQ=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 Jj(e,{supportHighlights:!0})),this.badge=new $j(Ol(e,Pl(".count")),{},UP),t.appendChild(e)}set(t,i){const e=RE(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(e,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const s=t.children.length;this.badge.setCount(s),this.badge.setTitleFormat(J(0,s>1?"{0} references":"{0} reference",s))}};gQ=cQ([lQ(1,iR)],gQ);let pQ=hQ=class{constructor(t){this._instantiationService=t,this.templateId=hQ.id}renderTemplate(t){return this._instantiationService.createInstance(gQ,t)}renderElement(t,i,e){e.set(t.element,v_(t.filterData))}disposeTemplate(t){t.dispose()}};pQ.id="FileReferencesRenderer",pQ=hQ=cQ([lQ(0,Zr)],pQ);class mQ{constructor(t){this.label=new Gj(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&&!L_.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,v_(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${FE(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class vQ{constructor(){this.templateId=vQ.id}renderTemplate(t){return new mQ(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}vQ.id="OneReferenceRenderer";class wQ{getWidgetAriaLabel(){return J(0,"References")}getAriaLabel(t){return t.ariaMessage}}var bQ=function(t,i){return function(e,s){i(e,s,t)}},yQ=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 kQ{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:kQ.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;ps.equalsRange(n,s.range)||((ps.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()}}kQ.DecorationOptions=$M.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class CQ{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 SQ extends xj{}let xQ=class extends JJ{constructor(t,i,e,s,n,r,o,h,c,l,u,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=l,this._languageService=u,this._languageConfigurationService=a,this._disposeOnNewModel=new Vi,this._callOnDispose=new Vi,this._onDidSelectReference=new ie,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ol(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(tQ)||Mg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(QJ)||Mg.transparent,primaryHeadingColor:t.getColor(YJ),secondaryHeadingColor:t.getColor(XJ)})}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=Ol(t,Pl("div.messages")),Bl(this._messageContainer),this._splitView=new hB(t,{orientation:1}),this._previewContainer=Ol(t,Pl("div.preview.inline")),this._preview=this._instantiationService.createInstance(NJ,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Bl(this._previewContainer),this._previewNotAvailableMessage=new LM(J(0,"no preview available"),ed,LM.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Ol(t,Pl("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new wQ,keyboardNavigationLabelProvider:this._instantiationService.createInstance(dQ),identityProvider:new fQ,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:iQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Xc(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(SQ,"ReferencesWidget",this._treeContainer,new aQ,[this._instantiationService.createInstance(pQ),this._instantiationService.createInstance(vQ)],this._instantiationService.createInstance(uQ),i),this._splitView.addView({onDidChange:Ji.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},oB.Distribute),this._splitView.addView({onDidChange:Ji.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:t=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${t}px`,this._tree.layout(this._dim.height,t)}},oB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const e=(t,i)=>{t instanceof sQ&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{e(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Bl(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ol(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=J(0,"No results"),Nl(this._messageContainer),Promise.resolve(void 0)):(Bl(this._messageContainer),this._decorationsManager=new kQ(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"),Nl(this._treeContainer),Nl(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 sQ?t:t instanceof rQ&&t.children.length>0?t.children[0]:void 0}revealReference(t){return yQ(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return yQ(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==Vc.inMemory?this.setTitle(OE(t.uri),this._uriLabel.getUriLabel(RE(t.uri))):this.setTitle(J(0,"References"));const e=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 s=yield e;if(!this._model)return void s.dispose();$i(this._previewModelReference);const n=s.object;if(n){const i=this._preview.getModel()===n.textEditorModel?0:1,e=ps.lift(t.range).collapseToStart();this._previewModelReference=s,this._preview.setModel(n.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),s.dispose()}))}};xQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([bQ(3,mk),bQ(4,to),bQ(5,Zr),bQ(6,KJ),bQ(7,iR),bQ(8,bM),bQ(9,CC),bQ(10,Ba),bQ(11,ud)],xQ);var DQ,EQ=function(t,i){return function(e,s){i(e,s,t)}},AQ=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 MQ=new Zo("referenceSearchVisible",!1,J(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let LQ=DQ=class{static get(t){return t.getContribution(DQ.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=MQ.bindTo(e)}dispose(){var t,i;this._referenceSearchVisible.reset(),this._disposables.dispose(),null===(t=this._widget)||void 0===t||t.dispose(),null===(i=this._model)||void 0===i||i.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(t,i,e){let s;if(this._widget&&(s=this._widget.position),this.closeWidget(),s&&t.containsPosition(s))return;this._peekMode=e,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const n="peekViewLayout",r=CQ.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(xQ,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(J(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:s}=t;if(i)switch(s){case"open":"editor"===t.source&&this._configurationService.getValue("editor.stablePeek")||this.openReference(i,!1,!1);break;case"side":this.openReference(i,!0,!1);break;case"goto":e?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const o=++this._requestIdPool;i.then((i=>{var e;if(o===this._requestIdPool&&this._widget)return null===(e=this._model)||void 0===e||e.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":J(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,e=new gs(t.startLineNumber,t.startColumn),s=this._model.nearestReference(i,e);if(s)return this._widget.setSelection(s).then((()=>{this._widget&&"editor"===this._editor.getOption(86)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}goToNextOrPreviousReference(t){return AQ(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 AQ(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(t,i){var e;null===(e=this._widget)||void 0===e||e.hide(),this._ignoreModelChangeEvent=!0;const s=ps.lift(t.range).collapseToStart();return this._editorService.openCodeEditor({resource:t.uri,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor).then((t=>{var i;if(this._ignoreModelChangeEvent=!1,t&&this._widget)if(this._editor===t)this._widget.show(s),this._widget.focusOnReferenceTree();else{const e=DQ.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,wu((()=>Promise.resolve(n))),null!==(i=this._peekMode)&&void 0!==i&&i)}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 OQ(t,i){const e=function(t){const i=t.get(Yr).getFocusedCodeEditor();return i instanceof NJ?i.getParentEditor():i}(t);if(!e)return;const s=LQ.get(e);s&&i(s)}LQ.ID="editor.contrib.referencesController",LQ=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}([EQ(2,Jo),EQ(3,Yr),EQ(4,vO),EQ(5,Zr),EQ(6,PP),EQ(7,Ta)],LQ),gh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:xe(2089,60),when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),gh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),gh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),ao.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),ao.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),ao.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),ao.registerCommand("closeReferenceSearch",(t=>OQ(t,(t=>t.closeWidget())))),gh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Lo.and(qJ.inPeekEditor,Lo.not("config.editor.stablePeek"))}),gh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Lo.and(MQ,Lo.not("config.editor.stablePeek"))}),gh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Lo.and(MQ,I$,W$.negate(),H$.negate()),handler(t){var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.revealReference(e[0])))}}),gh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Lo.and(MQ,I$,W$.negate(),H$.negate()),handler(t){var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.openReference(e[0],!0,!0)))}}),ao.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.openReference(e[0],!1,!0)))}));var 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},TQ=function(t,i){return function(e,s){i(e,s,t)}};const RQ=new Zo("hasSymbols",!1,J(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),_Q=Qr("ISymbolNavigationService");let IQ=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=RQ.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 PQ(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(LE(t.uri,e.uri))n=!0,r=r||ps.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:ps.collapseToStart(i.range),selectionRevealType:3}},t).finally((()=>{this._ignoreEditorChange=!1}))}_showMessage(){var t;null===(t=this._currentMessage)||void 0===t||t.dispose();const i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?J(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):J(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};IQ=FQ([TQ(0,Jo),TQ(1,Yr),TQ(2,vO),TQ(3,CC)],IQ),Wa(_Q,IQ,1),nu(new class extends Xl{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:RQ,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(_Q).revealNext(i)}}),gh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:RQ,primary:9,handler(t){t.get(_Q).reset()}});let PQ=class{constructor(t){this._listener=new Map,this._disposables=new Vi,this._onDidChange=new ie,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)}};PQ=FQ([TQ(0,Yr)],PQ);var NQ=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 BQ(t,i,e,s){return NQ(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 c((yield Promise.all(n)).flat())}))}function $Q(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function jQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function WQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function VQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function HQ(t,i,e,s,n){return BQ(i,e,t,((t,i,e)=>NQ(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 zQ(t){return NQ(this,void 0,void 0,(function*(){const i=yield t(),e=new oQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}su("_executeDefinitionProvider",((t,i,e)=>{const s=$Q(t.get(Wg).definitionProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeTypeDefinitionProvider",((t,i,e)=>{const s=VQ(t.get(Wg).typeDefinitionProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeDeclarationProvider",((t,i,e)=>{const s=jQ(t.get(Wg).declarationProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeReferenceProvider",((t,i,e)=>{const s=HQ(t.get(Wg).referenceProvider,i,e,!1,ue.None);return zQ((()=>s))})),su("_executeImplementationProvider",((t,i,e)=>{const s=WQ(t.get(Wg).implementationProvider,i,e,ue.None);return zQ((()=>s))}));var UQ,KQ,qQ,GQ,ZQ,JQ,QQ,YQ,XQ=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())}))};Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextPeek,title:J(0,"Peek"),group:"navigation",order:100});class tY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof tY||!(!gs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class iY extends eu{static all(){return iY._allSymbolNavigationCommands.values()}static _patchConfig(t){const i=Object.assign(Object.assign({},t),{f1:!0});if(i.menu)for(const e of Rt.wrap(i.menu))e.id!==bh.EditorContext&&e.id!==bh.EditorContextPeek||(e.when=Lo.and(t.precondition,e.when));return i}constructor(t,i){super(iY._patchConfig(i)),this.configuration=t,iY._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(vO),r=t.get(Yr),o=t.get(nR),h=t.get(_Q),c=t.get(Wg),l=t.get(Zr),u=i.getModel(),a=i.getPosition(),d=tY.is(e)?e:new tY(u,a),f=new oK(i,5),g=bu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>XQ(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(sm(t.ariaMessage),t.referenceAt(u.uri,a)){const t=this._getAlternativeCommand(i);!iY._activeAlternativeCommands.has(t)&&iY._allSymbolNavigationCommands.has(t)&&(o=iY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=u.getWordAtPosition(a);null===(n=iZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);iY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{iY._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 XQ(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof NJ||!(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 XQ(this,void 0,void 0,(function*(){let r;var o;if((o=e)&&ss.isUri(o.uri)&&ps.isIRange(o.range)&&(ps.isIRange(o.originSelectionRange)||ps.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=yield i.openCodeEditor({resource:e.uri,options:{selection:ps.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=LQ.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),wu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}iY._allSymbolNavigationCommands=new Map,iY._activeAlternativeCommands=new Set;class eY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield $Q(t.definitionProvider,i,e,s),J(0,"Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No definition found for '{0}'",t.word):J(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleDefinitions}}Eh(((UQ=class extends eY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:UQ.id,title:{value:J(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:J(0,"Go to &&Definition")},precondition:Lo.and(gS.hasDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:gS.editorTextFocus,primary:70,weight:100},{when:Lo.and(gS.editorTextFocus,A$),primary:2118,weight:100}],menu:[{id:bh.EditorContext,group:"navigation",order:1.1},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),ao.registerCommandAlias("editor.action.goToDeclaration",UQ.id)}}).id="editor.action.revealDefinition",UQ)),Eh(((KQ=class extends eY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:KQ.id,title:{value:J(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Lo.and(gS.hasDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:gS.editorTextFocus,primary:xe(2089,70),weight:100},{when:Lo.and(gS.editorTextFocus,A$),primary:xe(2089,2118),weight:100}]}),ao.registerCommandAlias("editor.action.openDeclarationToTheSide",KQ.id)}}).id="editor.action.revealDefinitionAside",KQ)),Eh(((qQ=class extends eY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:qQ.id,title:{value:J(0,"Peek Definition"),original:"Peek Definition"},precondition:Lo.and(gS.hasDefinitionProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:bh.EditorContextPeek,group:"peek",order:2}}),ao.registerCommandAlias("editor.action.previewDeclaration",qQ.id)}}).id="editor.action.peekDefinition",qQ));class sY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield jQ(t.declarationProvider,i,e,s),J(0,"Declarations"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No declaration found for '{0}'",t.word):J(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(58).multipleDeclarations}}Eh(((GQ=class extends sY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:GQ.id,title:{value:J(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:J(0,"Go to &&Declaration")},precondition:Lo.and(gS.hasDeclarationProvider,gS.isInWalkThroughSnippet.toNegated()),menu:[{id:bh.EditorContext,group:"navigation",order:1.3},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No declaration found for '{0}'",t.word):J(0,"No declaration found")}}).id="editor.action.revealDeclaration",GQ)),Eh(class extends sY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:J(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Lo.and(gS.hasDeclarationProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:3}})}});class nY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield VQ(t.typeDefinitionProvider,i,e,s),J(0,"Type Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No type definition found for '{0}'",t.word):J(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleTypeDefinitions}}Eh(((ZQ=class extends nY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ZQ.ID,title:{value:J(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:J(0,"Go to &&Type Definition")},precondition:Lo.and(gS.hasTypeDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:0,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.4},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",ZQ)),Eh(((JQ=class extends nY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:JQ.ID,title:{value:J(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Lo.and(gS.hasTypeDefinitionProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",JQ));class rY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield WQ(t.implementationProvider,i,e,s),J(0,"Implementations"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No implementation found for '{0}'",t.word):J(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(58).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(58).multipleImplementations}}Eh(((QQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:QQ.ID,title:{value:J(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:J(0,"Go to &&Implementations")},precondition:Lo.and(gS.hasImplementationProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:2118,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.45},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",QQ)),Eh(((YQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:YQ.ID,title:{value:J(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Lo.and(gS.hasImplementationProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:3142,weight:100},menu:{id:bh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",YQ));class oY extends iY{_getNoResultFoundMessage(t){return t?J(0,"No references found for '{0}'",t.word):J(0,"No references found")}_getAlternativeCommand(t){return t.getOption(58).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(58).multipleReferences}}Eh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:J(0,"Go to References"),original:"Go to References",mnemonicTitle:J(0,"Go to &&References")},precondition:Lo.and(gS.hasReferenceProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:1094,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.45},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield HQ(t.referenceProvider,i,e,!0,s),J(0,"References"))}))}}),Eh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:J(0,"Peek References"),original:"Peek References"},precondition:Lo.and(gS.hasReferenceProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield HQ(t.referenceProvider,i,e,!1,s),J(0,"References"))}))}});class hY extends iY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:J(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Lo.and(qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(this._references,J(0,"Locations"))}))}_getNoResultFoundMessage(t){return t&&J(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}ao.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:ss},{name:"position",description:"The position at which to start",constraint:gs.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)=>XQ(void 0,void 0,void 0,(function*(){B(ss.isUri(i)),B(gs.isIPosition(e)),B(Array.isArray(s)),B(void 0===n||"string"==typeof n),B(void 0===o||"boolean"==typeof o);const h=t.get(Yr),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(cK(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends hY{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(Zr).invokeFunction(i.run.bind(i),c)}))}))}),ao.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:ss},{name:"position",description:"The position at which to start",constraint:gs.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)=>XQ(void 0,void 0,void 0,(function*(){t.get(uo).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),ao.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(ss.isUri(i)),B(gs.isIPosition(e));const s=t.get(Wg),n=t.get(Yr);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!cK(t)||!t.hasModel())return;const i=LQ.get(t);if(!i)return;const n=wu((i=>HQ(s.referenceProvider,t.getModel(),gs.lift(e),!1,i).then((t=>new oQ(t,J(0,"References")))))),r=new ps(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),ao.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var cY,lY=function(t,i){return function(e,s){i(e,s,t)}},uY=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 aY=cY=class{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 IJ(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,null!=i?i:void 0)}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Ei(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(t){return t.getContribution(cY.ID)}startFindDefinitionFromCursor(t){return uY(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 uY(this,void 0,void 0,(function*(){this.toUnhookForKeyboard.clear();const e=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!e)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;const s=new rK(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=wu((i=>this.findDefinition(t,i)));try{n=yield this.previousPromise}catch(t){return void Ei(t)}if(!n||!n.length||!s.validate(this.editor))return void this.removeLinkDecorations();const r=n[0].originSelectionRange?ps.lift(n[0].originSelectionRange):new ps(t.lineNumber,e.startColumn,t.lineNumber,e.endColumn);if(n.length>1){let t=r;for(const{originSelectionRange:i}of n)i&&(t=ps.plusRange(t,i));this.addDecoration(t,(new H_).appendText(J(0,"Click to show {0} definitions.",n.length)))}else{const t=n[0];if(!t.uri)return;this.textModelResolverService.createModelReference(t.uri).then((i=>{if(!i.object||!i.object.textEditorModel)return void i.dispose();const{object:{textEditorModel:e}}=i,{startLineNumber:s}=t.range;if(s<1||s>e.getLineCount())return void i.dispose();const n=this.getPreviewValue(e,s,t),o=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(r,n?(new H_).appendCodeblock(o||"",n):void 0),i.dispose()}))}}))}getPreviewValue(t,i,e){let s=e.range;return s.endLineNumber-s.startLineNumber>=cY.MAX_SOURCE_PREVIEW_LINES&&(s=this.getPreviewRangeBasedOnIndentation(t,i)),this.stripIndentationFromPreviewRange(t,i,s)}stripIndentationFromPreviewRange(t,i,e){let s=t.getLineFirstNonWhitespaceColumn(i);for(let n=i+1;n<e.endLineNumber;n++){const i=t.getLineFirstNonWhitespaceColumn(n);s=Math.min(s,i)}return t.getValueInRange(e).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(t,i){const e=t.getLineFirstNonWhitespaceColumn(i),s=Math.min(t.getLineCount(),i+cY.MAX_SOURCE_PREVIEW_LINES);let n=i+1;for(;n<s&&e!==t.getLineFirstNonWhitespaceColumn(n);n++);return new ps(i,1,n+1,1)}addDecoration(t,i){this.linkDecorations.set([{range:t,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:i}}])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(t,i){var e;return this.editor.hasModel()&&t.isLeftClick&&t.isNoneOrSingleMouseDown&&6===t.target.type&&!((null===(e=t.target.detail.injectedText)||void 0===e?void 0:e.options)instanceof BM)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?$Q(this.languageFeaturesService.definitionProvider,e,t,i):Promise.resolve(null)}gotoDefinition(t,i){return this.editor.setPosition(t),this.editor.invokeWithinContext((t=>{const e=!i&&this.editor.getOption(87)&&!this.isInPeekEditor(t);return new eY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Jo);return qJ.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};aY.ID="editor.contrib.gotodefinitionatposition",aY.MAX_SOURCE_PREVIEW_LINES=8,aY=cY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,to),lY(2,Ba),lY(3,Wg)],aY),hu(aY.ID,aY,2);const dY=Pl;class fY 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 Zy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class gY extends Hi{static render(t,i,e){return new gY(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Ol(t,dY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ol(this.actionContainer,dY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Ol(this.action,dY(`span.icon.${i.iconClass}`)),Ol(this.action,dY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Qc(this.actionContainer,El.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Qc(this.actionContainer,El.KEY_DOWN,(t=>{const e=new Nh(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 pY{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class mY extends Hi{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ie),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Mu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new Mu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new Mu((()=>this._triggerLoadingMessage()),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(t,i=!0){this._state=t,i&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=function(t){const i=new de,e=t(i.token);return new _u(i,(t=>pu(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,l=mu(e);!(s=(h=yield l.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=l.return)||(yield r.call(l))}finally{if(n)throw n.error}}o.dispose(),i.dispose()}catch(e){o.dispose(),i.dispose(),t.reject(e)}}))))}((t=>this._computer.computeAsync(t))),(()=>{!function(t,i,e,s){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())}))}(this,void 0,void 0,(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)}}))})()):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 pY(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 vY{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 wY{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 bY=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class yY{constructor(){let t;this._onDidWillResize=new ie,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ie,this.onDidResize=this._onDidResize.event,this._sashListener=new Vi,this._size=new ol(0,0),this._minSize=new ol(0,0),this._maxSize=new ol(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new tB(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new tB(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new tB(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:KN.North}),this._southSash=new tB(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:KN.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(Ji.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(Ji.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(Ji.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(Ji.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 ol(i,t);ol.equals(o,this._size)||(this.domNode.style.height=t+"px",this.domNode.style.width=i+"px",this._size=o,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(t){this._maxSize=t}get maxSize(){return this._maxSize}set minSize(t){this._minSize=t}get minSize(){return this._minSize}set preferredSize(t){this._preferredSize=t}get preferredSize(){return this._preferredSize}}class kY extends Hi{constructor(t,i=new ol(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new yY),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ol.lift(i),this._resizableNode.layout(i.height,i.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize((t=>{this._resize(new ol(t.dimension.width,t.dimension.height)),t.done&&(this._isResizing=!1)}))),this._register(this._resizableNode.onDidWillResize((()=>{this._isResizing=!0})))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var t;return(null===(t=this._contentPosition)||void 0===t?void 0:t.position)?gs.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(i&&e)return cl(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=cl(i);return nl(i.ownerDocument.body).height-(s.top+e.top+e.height)-24}_findPositionPreference(t,i){var e,s;const n=Math.min(null!==(e=this._availableVerticalSpaceBelow(i))&&void 0!==e?e:1/0,t),r=Math.min(null!==(s=this._availableVerticalSpaceAbove(i))&&void 0!==s?s:1/0,t),o=Math.min(Math.max(r,n),t),h=Math.min(t,o);let c;return c=this._editor.getOption(60).above?h<=r?1:2:h<=n?2:1,1===c?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),c}_resize(t){this._resizableNode.layout(t.height,t.width)}}var CY,SY,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},DY=function(t,i){return function(e,s){i(e,s,t)}};const EY=Pl;let AY=CY=class extends Hi{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(FY,this._editor)),this._participants=[];for(const t of bY.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new RY(this._editor,this._participants),this._hoverOperation=this._register(new mY(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 MY(this._computer.anchor,i,t.isComplete))}))),this._register(Xc(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register(Ns.onDidChange((()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})))}get widget(){return this._widget}maybeShowAt(t){if(this._widget.isResizing)return!0;const i=[];for(const e of this._participants)if(e.suggestHoverAnchor){const s=e.suggestHoverAnchor(t);s&&i.push(s)}const e=t.target;if(6===e.type&&i.push(new vY(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new vY(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 vY(0,t,void 0,void 0),i,e,s,null)}_startShowingOrUpdateHover(t,i,e,s,n){return this._widget.position&&this._currentResult?this._editor.getOption(60).sticky&&n&&this._widget.isMouseGettingCloser(n.event.posx,n.event.posy)?(t&&this._startHoverOperationIfNecessary(t,i,e,s,!0),!0):t?!(!t||!this._currentResult.anchor.equals(t))||(t.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(t)),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)):(this._setCurrentResult(null),!1):!!t&&(this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)}_startHoverOperationIfNecessary(t,i,e,s,n){this._computer.anchor&&this._computer.anchor.equals(t)||(this._hoverOperation.cancel(),this._computer.anchor=t,this._computer.shouldFocus=s,this._computer.source=e,this._computer.insistOnKeepingHoverVisible=n,this._hoverOperation.start(i))}_setCurrentResult(t){this._currentResult!==t&&(t&&0===t.messages.length&&(t=null),this._currentResult=t,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(t){return!!t&&this._widget.getDomNode().contains(t)}_addLoadingMessage(t){if(this._computer.anchor)for(const i of this._participants)if(i.createLoadingMessage){const e=i.createLoadingMessage(this._computer.anchor);if(e)return t.slice(0).concat([e])}return t}_withResult(t){if(this._widget.position&&this._currentResult&&this._currentResult.isComplete){if(!t.isComplete)return;if(this._computer.insistOnKeepingHoverVisible&&0===t.messages.length)return}this._setCurrentResult(t)}_renderMessages(t,i){const{showAtPosition:e,showAtSecondaryPosition:s,highlightRange:n}=CY.computeHoverRanges(this._editor,t.range,i),r=new Vi,o=r.add(new TY(this._keybindingService)),h=document.createDocumentFragment();let c=null;const l={fragment:h,statusBar:o,setColorPicker:t=>c=t,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:t=>this._widget.setMinimumDimensions(t),hide:()=>this.hide()};for(const t of this._participants){const e=i.filter((i=>i.owner===t));e.length>0&&r.add(t.renderHoverParts(l,e))}const u=i.some((t=>t.isBeforeContent));if(o.hasContent&&h.appendChild(o.hoverElement),h.hasChildNodes()){if(n){const t=this._editor.createDecorationsCollection();t.set([{range:n,options:CY._DECORATION_OPTIONS}]),r.add(Wi((()=>{t.clear()})))}this._widget.showAt(h,new OY(c,e,s,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,u,t.initialMousePosX,t.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(t,i,e){let s=1;if(t.hasModel()){const e=t._getViewModel(),n=e.coordinatesConverter,r=n.convertModelRangeToViewRange(i),o=new gs(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=ps.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 gs(n,i.startColumn),showAtSecondaryPosition:h?h.getStartPosition():new gs(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()}};AY._DECORATION_OPTIONS=$M.register({description:"content-hover-highlight",className:"hoverHighlight"}),AY=CY=xY([DY(1,Zr),DY(2,CC)],AY);class MY{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 LY(this,this.anchor,i,this.isComplete)}}class LY extends MY{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class OY{constructor(t,i,e,s,n,r,o,h,c,l){this.colorPicker=t,this.showAtPosition=i,this.showAtSecondaryPosition=e,this.preferAbove=s,this.stoleFocus=n,this.source=r,this.isBeforeContent=o,this.initialMousePosX=h,this.initialMousePosY=c,this.disposables=l,this.closestMouseDistance=void 0}}let FY=SY=class extends kY{get isColorPickerVisible(){var t;return Boolean(null===(t=this._visibleData)||void 0===t?void 0:t.colorPicker)}get isVisibleFromKeyboard(){var t;return 1===(null===(t=this._visibleData)||void 0===t?void 0:t.source)}get isVisible(){var t;return null!==(t=this._hoverVisibleKey.get())&&void 0!==t&&t}get isFocused(){var t;return null!==(t=this._hoverFocusedKey.get())&&void 0!==t&&t}constructor(t,i,e,s,n){const r=t.getOption(66)+8,o=new ol(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new fY),this._minimumSize=o,this._hoverVisibleKey=gS.hoverVisible.bindTo(i),this._hoverFocusedKey=gS.hoverFocused.bindTo(i),Ol(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange((()=>this._layout()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()})));const h=this._register(Ll(this._resizableNode.domNode));this._register(h.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(h.onDidBlur((()=>{this._hoverFocusedKey.set(!1)}))),this._setHoverData(void 0),this._layout(),this._editor.addContentWidget(this)}dispose(){var t;super.dispose(),null===(t=this._visibleData)||void 0===t||t.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return SY.ID}static _applyDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.width="number"==typeof i?`${i}px`:i,t.style.height=s}_setContentsDomNodeDimensions(t,i){return SY._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return SY._applyDimensions(this._hover.containerDomNode,t,i)}_setHoverWidgetDimensions(t,i){this._setContentsDomNodeDimensions(t,i),this._setContainerDomNodeDimensions(t,i),this._layoutContentWidget()}static _applyMaxDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.maxWidth="number"==typeof i?`${i}px`:i,t.style.maxHeight=s}_setHoverWidgetMaxDimensions(t,i){SY._applyMaxDimensions(this._hover.contentsDomNode,t,i),SY._applyMaxDimensions(this._hover.containerDomNode,t,i),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth","number"==typeof t?`${t}px`:t),this._layoutContentWidget()}_hasHorizontalScrollbar(){const t=this._hover.scrollbar.getScrollDimensions();return t.scrollWidth>t.width}_adjustContentsBottomPadding(){const t=this._hover.contentsDomNode,i=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;t.style.paddingBottom!==i&&(t.style.paddingBottom=i)}_setAdjustedHoverWidgetDimensions(t){this._setHoverWidgetMaxDimensions("none","none");const i=t.width,e=t.height;this._setHoverWidgetDimensions(i,e),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(i,e-10))}_updateResizableNodeMaxDimensions(){var t,i;const e=null!==(t=this._findMaximumRenderingWidth())&&void 0!==t?t:1/0,s=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._resizableNode.maxSize=new ol(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;SY._lastDimensions=new ol(t.width,t.height),this._setAdjustedHoverWidgetDimensions(t),this._resizableNode.layout(t.height,t.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),null===(e=null===(i=this._visibleData)||void 0===i?void 0:i.colorPicker)||void 0===e||e.layout()}_findAvailableSpaceVertically(){var t;const i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition;if(i)return 1===this._positionPreference?this._availableVerticalSpaceAbove(i):this._availableVerticalSpaceBelow(i)}_findMaximumRenderingHeight(){const t=this._findAvailableSpaceVertically();if(!t)return;let i=6;return Array.from(this._hover.contentsDomNode.children).forEach((t=>{i+=t.clientHeight})),this._hasHorizontalScrollbar()&&(i+=10),Math.min(t,i)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const t=Array.from(this._hover.contentsDomNode.children).some((t=>t.scrollWidth>t.clientWidth));return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),t}_findMaximumRenderingWidth(){if(this._editor&&this._editor.hasModel())return this._isHoverTextOverflowing()||this._hover.containerDomNode.clientWidth<(void 0===this._contentWidth?0:this._contentWidth-2)?nl(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(t,i){if(!this._visibleData)return!1;if(void 0===this._visibleData.initialMousePosX||void 0===this._visibleData.initialMousePosY)return this._visibleData.initialMousePosX=t,this._visibleData.initialMousePosY=i,!1;const e=cl(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=_Y(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=_Y(t,i,e.left,e.top,e.width,e.height);return!(s>this._visibleData.closestMouseDistance+4||(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,s),0))}_setHoverData(t){var i;null===(i=this._visibleData)||void 0===i||i.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!t),this._hover.containerDomNode.classList.toggle("hidden",!t)}_layout(){const{fontSize:t,lineHeight:i}=this._editor.getOption(50),e=this._hover.contentsDomNode;e.style.fontSize=`${t}px`,e.style.lineHeight=""+i/t,this._updateMaxDimensions()}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_updateContent(t){const i=this._hover.contentsDomNode;i.style.paddingBottom="",i.textContent="",i.appendChild(t)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const t=Math.max(this._editor.getLayoutInfo().height/4,250,SY._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,SY._lastDimensions.width);this._setHoverWidgetMaxDimensions(i,t)}_render(t,i){this._setHoverData(i),this._updateFont(),this._updateContent(t),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var t;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[null!==(t=this._positionPreference)&&void 0!==t?t:1]}:null}showAt(t,i){var e,s,n,r;if(!this._editor||!this._editor.hasModel())return;this._render(t,i);const o=dl(this._hover.containerDomNode);this._positionPreference=null!==(e=this._findPositionPreference(o,i.showAtPosition))&&void 0!==e?e:1,this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(s=i.colorPicker)||void 0===s||s.layout();const h=(c=!0===this._configurationService.getValue("accessibility.verbosity.hover")&&this._accessibilityService.isScreenReaderOptimized(),l=null!==(r=null===(n=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))||void 0===n?void 0:n.getAriaLabel())&&void 0!==r?r:"",c&&l?J(0,"Inspect this in the accessible view with {0}.",l):c?J(0,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):"");var c,l;h&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+h)}hide(){if(!this._visibleData)return;const t=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new ol(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}_removeConstraintsRenderNormally(){const t=this._editor.getLayoutInfo();this._resizableNode.layout(t.height,t.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(t){var i;const e=this._hover.containerDomNode,s=this._hover.contentsDomNode,n=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._setContainerDomNodeDimensions(ll(e),Math.min(n,t)),this._setContentsDomNodeDimensions(ll(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new ol(Math.max(this._minimumSize.width,t.width),Math.max(this._minimumSize.height,t.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const t=void 0===this._contentWidth?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new ol(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=dl(i),s=ll(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=dl(i),s=ll(i),this._contentWidth=s,this._updateMinimumWidth(),this._resizableNode.layout(e,s),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(e)),null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition){const t=dl(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(t,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-30})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+30})}pageUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t-i})}pageDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t+i})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};FY.ID="editor.contrib.resizableContentHoverWidget",FY._lastDimensions=new ol(0,0),FY=SY=xY([DY(1,Jo),DY(2,Ta),DY(3,gm),DY(4,CC)],FY);let TY=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=EY("div.hover-row.status-bar"),this.actionsElement=Ol(this.hoverElement,EY("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(gY.render(this.actionsElement,t,e))}append(t){const i=Ol(this.actionsElement,t);return this._hasContent=!0,i}};TY=xY([DY(0,CC)],TY);class RY{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 Ru.EMPTY;const e=RY._getLineDecorations(this._editor,i);return Ru.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):Ru.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=RY._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return c(i)}}function _Y(t,i,e,s,n,r){const o=s+r/2,h=Math.max(Math.abs(t-(e+n/2))-n/2,0),c=Math.max(Math.abs(i-o)-r/2,0);return Math.sqrt(h*h+c*c)}const IY=Pl;class PY 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 fY),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new JG({editor:this._editor},i,e)),this._computer=new NY(this._editor),this._hoverOperation=this._register(new mY(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{this._withResult(t.value)}))),this._register(this._editor.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return PY.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=IY("div.hover-row.markdown-hover"),s=Ol(i,IY("div.hover-contents")),n=this._renderDisposeables.add(this._markdownRenderer.render(t.value));s.appendChild(n.element),e.appendChild(i)}this._updateContents(e),this._showAt(t)}_updateContents(t){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._updateFont()}_showAt(t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),e=this._editor.getTopForLineNumber(t),s=this._editor.getScrollTop(),n=this._editor.getOption(66),r=e-s-(this._hover.containerDomNode.clientHeight-n)/2;this._hover.containerDomNode.style.left=`${i.glyphMarginLeft+i.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(r),0)}px`}}PY.ID="editor.contrib.modesGlyphHoverWidget";class NY{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&&!z_(i)&&e.push(...b(i).map(t))}return e}}class BY{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function $Y(t,i,e,s){const n=t.ordered(i).map(((t,n)=>function(t,i,e,s,n){return 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())}))}(this,void 0,void 0,(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 BY(t,r,i)}catch(t){Ai(t)}}))}(t,n,i,e,s)));return Ru.fromPromises(n).coalesce()}su("_executeHoverProvider",((t,i,e)=>function(t,i,e){return $Y(t,i,e,ue.None).map((t=>t.hover)).toPromise()}(t.get(Wg).hoverProvider,i,e)));var jY=function(t,i){return function(e,s){i(e,s,t)}};const WY=Pl;class VY{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 HY=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 VY(this,t.range,[(new H_).appendText(J(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];let o=1e3;const h=e.getLineLength(s),c=e.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(116),u=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let a=!1;l>=0&&h>l&&t.range.startColumn>=l&&(a=!0,r.push(new VY(this,t.range,[{value:J(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,o++))),!a&&"number"==typeof u&&h>=u&&r.push(new VY(this,t.range,[{value:J(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,o++));let d=!1;for(const e of i){const i=e.range.startLineNumber===s?e.range.startColumn:1,h=e.range.endLineNumber===s?e.range.endColumn:n,c=e.options.hoverMessage;if(!c||z_(c))continue;e.options.beforeContentClassName&&(d=!0);const l=new ps(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new VY(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return Ru.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return Ru.EMPTY;const n=new gs(t.range.startLineNumber,t.range.startColumn);return $Y(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!z_(t.hover.contents))).map((i=>{const e=i.hover.range?ps.lift(i.hover.range):t.range;return new VY(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return zY(t,i,this._editor,this._languageService,this._openerService)}};function zY(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(z_(i))continue;const o=WY("div.hover-row.markdown-hover"),h=Ol(o,WY("div.hover-contents")),c=r.add(new JG({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const l=r.add(c.render(i));h.appendChild(l.element),t.fragment.appendChild(o)}return r}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}([jY(1,Ba),jY(2,AF),jY(3,Ta),jY(4,Wg)],HY);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},KY=function(t,i){return function(e,s){i(e,s,t)}};class qY{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let GY=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._dispoables=new Vi,this._markers=[],this._nextIdx=-1,ss.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=Vn(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?ps.compareRangesUsingStarts(t,i)||LN.compare(t.severity,i.severity):LN.compare(t.severity,i.severity)||ps.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:ss.isUri(t)?t:void 0,severities:LN.Error|LN.Warning|LN.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 qY(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let n=!1,r=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));r<0&&(r=s(this._markers,{resource:t.uri},((t,i)=>Vn(t.resource.toString(),i.resource.toString()))),r<0&&(r=~r));for(let e=r;e<this._markers.length;e++){let s=ps.lift(this._markers[e]);if(s.isEmpty()){const i=t.getWordAtPosition(s.getStartPosition());i&&(s=new ps(s.startLineNumber,i.startColumn,s.startLineNumber,i.endColumn))}if(i&&(s.containsPosition(i)||i.isBeforeOrEqual(s.getStartPosition()))){this._nextIdx=e,n=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}n||(this._nextIdx=e?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(t,i,e){if(0===this._markers.length)return!1;const s=this._nextIdx;return-1===this._nextIdx?this._initIdx(i,e,t):t?this._nextIdx=(this._nextIdx+1)%this._markers.length:t||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),s!==this._nextIdx}find(t,i){let e=this._markers.findIndex((i=>i.resource.toString()===t.toString()));if(!(e<0))for(;e<this._markers.length;e++)if(ps.containsPosition(this._markers[e],i))return new qY(this._markers[e],e+1,this._markers.length)}};GY=UY([KY(1,FN),KY(2,Ta)],GY);const ZY=Qr("IMarkerNavigationService");let JY=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new It}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new GY(t,this._markerService,this._configService)}};var QY;JY=UY([KY(0,FN),KY(1,Ta)],JY),Wa(ZY,JY,1),function(t){t.className=function(t){switch(t){case pO.Ignore:return"severity-ignore "+eo.asClassName(ys.info);case pO.Info:return eo.asClassName(ys.info);case pO.Warning:return eo.asClassName(ys.warning);case pO.Error:return eo.asClassName(ys.error);default:return""}}}(QY||(QY={}));var YY,XY=function(t,i){return function(e,s){i(e,s,t)}};class tX{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(Xc(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new qy(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=Bn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Gc(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=Pl("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()},Ol(this._codeLink,Pl("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Gc(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),a(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(66))}px`,this._lines+=1;for(const i of s){const e=document.createElement("div"),s=document.createElement("a");s.classList.add("filename"),s.innerText=`${this._labelService.getUriBasenameLabel(i.resource)}(${i.startLineNumber}, ${i.startColumn}): `,s.title=this._labelService.getUriLabel(i.resource),this._relatedDiagnostics.set(s,i);const n=document.createElement("span");n.innerText=i.message,e.appendChild(s),e.appendChild(n),this._lines+=1,t.appendChild(e)}}const c=this._editor.getOption(50),l=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:l,scrollHeight:c.lineHeight*this._lines})}layout(t,i){this._scrollable.getDomNode().style.height=`${t}px`,this._scrollable.getDomNode().style.width=`${i}px`,this._scrollable.setScrollDimensions({width:i,height:t})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(t){let i="";switch(t.severity){case LN.Error:i=J(0,"Error");break;case LN.Warning:i=J(0,"Warning");break;case LN.Info:i=J(0,"Info");break;case LN.Hint:i=J(0,"Hint")}let e=J(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const s=this._editor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1&&(e=`${s.getLineContent(t.startLineNumber)}, ${e}`),e}}let iX=YY=class extends JJ{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 ie,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=LN.Warning,this._backgroundColor=Mg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(aX);let i=rX,e=oX;this._severity===LN.Warning?(i=hX,e=cX):this._severity===LN.Info&&(i=lX,e=uX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(YJ),secondaryHeadingColor:t.getColor(XJ)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(t){super._fillHead(t),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const i=[],e=this._menuService.createMenu(YY.TitleMenu,this._contextKeyService);iN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=Ol(t,Pl(""))}_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 tX(this._container,this.editor,(t=>this._onDidSelectRelatedInformation.fire(t)),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(t,i,e){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const s=ps.lift(t),n=this.editor.getPosition(),r=n&&s.containsPosition(n)?n:s.getStartPosition();super.show(r,this.computeRequiredHeight());const o=this.editor.getModel();if(o){const t=J(0,e>1?"{0} of {1} problems":"{0} of {1} problem",i,e);this.setTitle(FE(o.uri),t)}this._icon.className=`codicon ${QY.className(LN.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(t){this._container.classList.remove("stale"),this._message.update(t)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._heightInPixel=t,this._message.layout(t,i),this._container.style.height=`${t}px`}_onWidth(t){this._message.layout(this._heightInPixel,t)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};iX.TitleMenu=new bh("gotoErrorTitleMenu"),iX=YY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([XY(1,mk),XY(2,AF),XY(3,yh),XY(4,Zr),XY(5,Jo),XY(6,iR)],iX);const eX=Lb(yv,kv),sX=Lb(Cv,Sv),nX=Lb(xv,Dv),rX=Om("editorMarkerNavigationError.background",{dark:eX,light:eX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget error color.")),oX=Om("editorMarkerNavigationError.headerBackground",{dark:Mb(rX,.1),light:Mb(rX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget error heading background.")),hX=Om("editorMarkerNavigationWarning.background",{dark:sX,light:sX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget warning color.")),cX=Om("editorMarkerNavigationWarning.headerBackground",{dark:Mb(hX,.1),light:Mb(hX,.1),hcDark:"#0C141F",hcLight:Mb(hX,.2)},J(0,"Editor marker navigation widget warning heading background.")),lX=Om("editorMarkerNavigationInfo.background",{dark:nX,light:nX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget info color.")),uX=Om("editorMarkerNavigationInfo.headerBackground",{dark:Mb(lX,.1),light:Mb(lX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget info heading background.")),aX=Om("editorMarkerNavigation.background",{dark:Av,light:Av,hcDark:Av,hcLight:Av},J(0,"Editor marker navigation widget background."));var dX,fX=function(t,i){return function(e,s){i(e,s,t)}},gX=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 pX=dX=class{static get(t){return t.getContribution(dX.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=bX.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(iX,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)&&ps.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:ps.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 gs(t.startLineNumber,t.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}nagivate(t,i){var e,s;return gX(this,void 0,void 0,(function*(){if(this._editor.hasModel()){const n=this._getOrCreateModel(i?void 0:this._editor.getModel().uri);if(n.move(t,this._editor.getModel(),this._editor.getPosition()),!n.selected)return;if(n.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=yield this._editorService.openCodeEditor({resource:n.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:n.selected.marker}},this._editor);r&&(null===(e=dX.get(r))||void 0===e||e.close(),null===(s=dX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}))}};pX.ID="editor.contrib.markerController",pX=dX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([fX(1,ZY),fX(2,Jo),fX(3,Yr),fX(4,Zr)],pX);class mX extends tu{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return gX(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=pX.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class vX extends mX{constructor(){super(!0,!1,{id:vX.ID,label:vX.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:578,weight:100},menuOpts:{menuId:iX.TitleMenu,title:vX.LABEL,icon:GW("marker-navigation-next",ys.arrowDown,J(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}vX.ID="editor.action.marker.next",vX.LABEL=J(0,"Go to Next Problem (Error, Warning, Info)");class wX extends mX{constructor(){super(!1,!1,{id:wX.ID,label:wX.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:1602,weight:100},menuOpts:{menuId:iX.TitleMenu,title:wX.LABEL,icon:GW("marker-navigation-previous",ys.arrowUp,J(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}wX.ID="editor.action.marker.prev",wX.LABEL=J(0,"Go to Previous Problem (Error, Warning, Info)"),hu(pX.ID,pX,4),ru(vX),ru(wX),ru(class extends mX{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:J(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:gS.focus,primary:66,weight:100},menuOpts:{menuId:bh.MenubarGoMenu,title:J(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),ru(class extends mX{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:J(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:gS.focus,primary:1090,weight:100},menuOpts:{menuId:bh.MenubarGoMenu,title:J(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const bX=new Zo("markersNavigationVisible",!1);nu(new(Xl.bindToContribution(pX.get))({id:"closeMarkersNavigation",precondition:bX,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:gS.focus,primary:9,secondary:[1033]}}));var yX=function(t,i){return function(e,s){i(e,s,t)}};const kX=Pl;class CX{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 SX={type:1,filter:{include:CG.QuickFix},triggerAction:kG.QuickFixHover};let xX=class{constructor(t,i,e,s){this._editor=t,this._markerDecorationsService=i,this._openerService=e,this._languageFeaturesService=s,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type&&!t.supportsMarkerHover)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];for(const o of i){const i=o.range.startLineNumber===s?o.range.startColumn:1,h=o.range.endLineNumber===s?o.range.endColumn:n,c=this._markerDecorationsService.getMarker(e.uri,o);if(!c)continue;const l=new ps(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new CX(this,l,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)=>LN.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=kX("div.hover-row"),s=Ol(e,kX("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Ol(s,kX("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=kX("span");n&&(Ol(t,kX("span")).innerText=n);const e=Ol(t,kX("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Qc(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Ol(e,kX("span")).innerText=o.value;const r=Ol(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Ol(s,kX("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(a(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=Ol(s,kX("div"));o.style.marginTop="8px";const h=Ol(o,kX("a"));h.innerText=`${FE(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Qc(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=Ol(o,kX("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,e){if(i.marker.severity!==LN.Error&&i.marker.severity!==LN.Warning&&i.marker.severity!==LN.Info||t.statusBar.addAction({label:J(0,"View Problem"),commandId:vX.ID,run:()=>{var e;t.hide(),null===(e=pX.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(kX("div"));this.recentMarkerCodeActionsInfo&&(ON.makeKey(this.recentMarkerCodeActionsInfo.marker)===ON.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(s.textContent=J(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Hi.None:e.add(xu((()=>s.textContent=J(0,"Checking for quick fixes...")),200));s.textContent||(s.textContent=String.fromCharCode(160));const r=this.getCodeActions(i.marker);e.add(Wi((()=>r.cancel()))),r.then((r=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:r.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return r.dispose(),void(s.textContent=J(0,"No quick fixes available"));s.style.display="none";let o=!1;e.add(Wi((()=>{o||r.dispose()}))),t.statusBar.addAction({label:J(0,"Quick Fix..."),commandId:MG,run:i=>{o=!0;const e=AZ.get(this._editor),s=cl(i);t.hide(),null==e||e.showCodeActions(SX,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return wu((i=>PG(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),SX,sR.None,i)))}};xX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([yX(1,om),yX(2,AF),yX(3,Wg)],xX);const DX="editor.action.inlineSuggest.commit",EX="editor.action.inlineSuggest.showPrevious",AX="editor.action.inlineSuggest.showNext";class MX extends Hi{constructor(t,i,e={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new oe),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new Vi),this.options=e,this.lookupKeybindings="function"==typeof this.options.getKeyBinding,this.toggleMenuAction=this._register(new LX((()=>{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 cN(this.element,{orientation:e.orientation,ariaLabel:e.ariaLabel,actionRunner:e.actionRunner,allowContextMenu:e.allowContextMenu,highlightToggledItems:e.highlightToggledItems,actionViewItemProvider:(t,s)=>{var n;if(t.id===LX.ID)return this.toggleMenuActionViewItem=new LP(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:eo.asClassNameArray(null!==(n=e.moreIcon)&&void 0!==n?n:ys.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry}),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 ho){const e=new LP(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,skipTelemetry:this.options.skipTelemetry});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,s;const n=this.lookupKeybindings?null===(e=(i=this.options).getKeyBinding)||void 0===e?void 0:e.call(i,t):void 0;return null!==(s=null==n?void 0:n.getLabel())&&void 0!==s?s:void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}}class LX extends no{constructor(t,i){i=i||J(0,"More Actions..."),super(LX.ID,i,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=t}run(){return 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())}))}(this,void 0,void 0,(function*(){this.toggleDropdownMenu()}))}get menuActions(){return this._menuActions}set menuActions(t){this._menuActions=t}}LX.ID="toolbar.toggle.more";var OX=function(t,i){return function(e,s){i(e,s,t)}};let FX=class extends MX{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,skipTelemetry:"string"==typeof(null==i?void 0:i.telemetrySource)})),this._options=i,this._menuService=e,this._contextKeyService=s,this._contextMenuService=n,this._sessionDisposables=this._store.add(new Vi);const h=null==i?void 0:i.telemetrySource;h&&this._store.add(this.actionBar.onDidRun((t=>o.publicLog2("workbenchActionExecuted",{id:t.action.id,from:h}))))}setActions(t,i=[],e){var s,n,r;this._sessionDisposables.clear();const o=t.slice(),h=i.slice(),c=[];let u=0;const a=[];let d=!1;if(-1!==(null===(s=this._options)||void 0===s?void 0:s.hiddenItemStrategy))for(let t=0;t<o.length;t++){const i=o[t];(i instanceof xh||i instanceof Sh)&&i.hideActions&&(c.push(i.hideActions.toggle),i.hideActions.toggle.checked&&u++,i.hideActions.isHidden&&(d=!0,o[t]=void 0,0!==(null===(n=this._options)||void 0===n?void 0:n.hiddenItemStrategy)&&(a[t]=i)))}if(void 0!==(null===(r=this._options)||void 0===r?void 0:r.overflowBehavior)){const t=function(t,i){const e=new Set;for(const s of i)t.has(s)&&e.add(s);return e}(new Set(this._options.overflowBehavior.exempted),Rt.map(o,(t=>null==t?void 0:t.id))),i=this._options.overflowBehavior.maxItems-t.size;let e=0;for(let s=0;s<o.length;s++){const n=o[s];n&&(e++,t.has(n.id)||e>=i&&(o[s]=void 0,a[s]=n))}}l(o),l(a),super.setActions(o,oo.join(a,h)),c.length>0&&this._sessionDisposables.add(Qc(this.getElement(),"contextmenu",(t=>{var i,s,n,r,o;const h=new Wh(t),l=this.getItemAction(h.target);if(!l)return;h.preventDefault(),h.stopPropagation();let a,f=!1;if(1===u&&0===(null===(i=this._options)||void 0===i?void 0:i.hiddenItemStrategy)){f=!0;for(let t=0;t<c.length;t++)if(c[t].checked){c[t]=lo({id:l.id,label:l.label,checked:!0,enabled:!1,run(){}});break}}if(!f&&(l instanceof xh||l instanceof Sh)){if(!l.hideActions)return;a=l.hideActions.hide}else a=lo({id:"label",label:J(0,"Hide"),enabled:!1,run(){}});const g=oo.join([a],c);(null===(s=this._options)||void 0===s?void 0:s.resetMenu)&&!e&&(e=[this._options.resetMenu]),d&&e&&(g.push(new oo),g.push(lo({id:"resetThisMenu",label:J(0,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(e)}))),this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>g,menuId:null===(n=this._options)||void 0===n?void 0:n.contextMenu,menuActionOptions:Object.assign({renderShortTitle:!0},null===(r=this._options)||void 0===r?void 0:r.menuOptions),skipTelemetry:"string"==typeof(null===(o=this._options)||void 0===o?void 0:o.telemetrySource),contextKeyService:this._contextKeyService})})))}};FX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([OX(2,yh),OX(3,Jo),OX(4,AR),OX(5,CC),OX(6,Ah)],FX);var TX,RX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},_X=function(t,i){return function(e,s){i(e,s,t)}};let IX=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=KH(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(62).showToolbar)),this.sessionPosition=void 0,this.position=IH(this,(t=>{var i,e,s;const n=null===(i=this.model.read(t))||void 0===i?void 0:i.ghostText.read(t);if(!this.alwaysShowToolbar.read(t)||!n||0===n.parts.length)return this.sessionPosition=void 0,null;const r=n.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==n.lineNumber&&(this.sessionPosition=void 0);const o=new gs(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(VH(((i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(BX,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(jH((t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Cs.Explicit&&s.triggerExplicitly()})))})))}};IX=RX([_X(2,Zr)],IX);const PX=GW("inline-suggestion-hints-next",ys.chevronRight,J(0,"Icon for show next parameter hint.")),NX=GW("inline-suggestion-hints-previous",ys.chevronLeft,J(0,"Icon for show previous parameter hint."));let BX=TX=class extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new no(t,i,e,!0,(()=>this._commandService.executeCommand(t))),n=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let r=i;return n&&(r=J(0,"{0} ({1})",i,n.getLabel())),s.tooltip=r,s}constructor(t,i,s,n,r,o,h,c,l,u,a){super(),this.editor=t,this.withBorder=i,this._position=s,this._currentSuggestionIdx=n,this._suggestionCount=r,this._extraCommands=o,this._commandService=h,this.keybindingService=l,this._contextKeyService=u,this._menuService=a,this.id="InlineSuggestionHintsContentWidget"+TX.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Gl("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Gl("div@toolBar")]),this.previousAction=this.createCommandAction(EX,J(0,"Previous"),eo.asClassName(NX)),this.availableSuggestionCountAction=new no("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(AX,J(0,"Next"),eo.asClassName(PX)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(bh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Mu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new Mu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(WX,this.nodes.toolBar,bh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof xh)return c.createInstance(jX,t,void 0);if(t===this.availableSuggestionCountAction){const i=new $X(void 0,t,{label:!0,icon:!1});return i.setClass("availableSuggestionCount"),i}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility((t=>{TX._dropDownVisible=t}))),this._register(jH((t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(jH((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(jH((t=>{const i=this._extraCommands.read(t);if(e(this.lastCommands,i))return;this.lastCommands=i;const s=i.map((t=>({class:void 0,id:t.id,enabled:!0,tooltip:t.tooltip||"",label:t.title,run:()=>this._commandService.executeCommand(t.id)})));for(const[t,i]of this.inlineCompletionsActionsMenus.getActions())for(const t of i)t instanceof xh&&s.push(t);s.length>0&&s.unshift(new oo),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};BX._dropDownVisible=!1,BX.id=0,BX=TX=RX([_X(6,uo),_X(7,Zr),_X(8,CC),_X(9,Jo),_X(10,yh)],BX);class $X extends DP{constructor(){super(...arguments),this._className=void 0}setClass(t){this._className=t}render(t){super.render(t),this._className&&t.classList.add(this._className)}}class jX extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Gl("div.keybinding").root;new iW(i,xt,Object.assign({disableTitle:!0},tW)).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let WX=class extends FX{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.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];iN(this.menu,null===(t=this.options2)||void 0===t?void 0:t.menuOptions,{primary:h,secondary:c},null===(e=null===(i=this.options2)||void 0===i?void 0:i.toolbarOptions)||void 0===e?void 0:e.primaryGroup,null===(n=null===(s=this.options2)||void 0===s?void 0:s.toolbarOptions)||void 0===n?void 0:n.shouldInlineSubmenu,null===(o=null===(r=this.options2)||void 0===r?void 0:r.toolbarOptions)||void 0===o?void 0:o.useSeparatorsInPrimaryActions),c.push(...this.additionalActions),h.unshift(...this.prependedPrimaryActions),this.setActions(h,c)}setPrependedPrimaryActions(t){e(this.prependedPrimaryActions,t,((t,i)=>t===i))||(this.prependedPrimaryActions=t,this.updateToolbar())}setAdditionalSecondaryActions(t){e(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};WX=RX([_X(3,yh),_X(4,Jo),_X(5,AR),_X(6,CC),_X(7,Ah)],WX);var VX,HX=function(t,i){return function(e,s){i(e,s,t)}};let zX=VX=class extends Hi{static get(t){return t.getContribution(VX.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Vi,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new Mu((()=>this._reactToEditorMouseMove(this._mouseMoveEvent)),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())}))),this._register(this._editor.onMouseLeave((()=>{this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()})))}_hookEvents(){const t=this._editor.getOption(60);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,this._hidingDelay=t.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._toUnhook.add(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))):(this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))),this._toUnhook.add(this._editor.onMouseLeave((t=>this._onEditorMouseLeave(t)))),this._toUnhook.add(this._editor.onDidChangeModel((()=>this._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){var i;this._isMouseDown=!0;const e=t.target;9!==e.type||e.detail!==FY.ID?12===e.type&&e.detail===PY.ID||(12!==e.type&&(this._hoverClicked=!1),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i,e;(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||(null===(e=this._contentWidget)||void 0===e?void 0:e.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_isMouseOverWidget(t){var i,e,s,n,r;const o=t.target;return!((!this._isHoverSticky||9!==o.type||o.detail!==FY.ID)&&(!this._isHoverSticky||!(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(null===(e=t.event.browserEvent.view)||void 0===e?void 0:e.document.activeElement))||(null===(n=null===(s=t.event.browserEvent.view)||void 0===s?void 0:s.getSelection())||void 0===n?void 0:n.isCollapsed))&&(this._isHoverSticky||9!==o.type||o.detail!==FY.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==PY.ID))}_onEditorMouseMove(t){var i,e,s,n;this._mouseMoveEvent=t,(null===(i=this._contentWidget)||void 0===i?void 0:i.isFocused)||(null===(e=this._contentWidget)||void 0===e?void 0:e.isResizing)||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(null===(s=this._contentWidget)||void 0===s?void 0:s.isVisibleFromKeyboard)||(this._isMouseOverWidget(t)?this._reactToEditorMouseMoveRunner.cancel():(null===(n=this._contentWidget)||void 0===n?void 0:n.isVisible)&&this._isHoverSticky&&this._hidingDelay>0?this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay):this._reactToEditorMouseMove(t))}_reactToEditorMouseMove(t){var i,e,s;if(!t)return;const n=t.target,r=null===(i=n.element)||void 0===i?void 0:i.classList.contains("colorpicker-color-decoration"),o=this._editor.getOption(146);if((!r||("click"!==o||this._hoverActivatedByColorDecoratorClick)&&("hover"!==o||this._isHoverEnabled)&&("clickAndHover"!==o||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))&&(r||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(e=this._glyphWidget)||void 0===e||e.hide()):2===n.type&&n.position?(null===(s=this._contentWidget)||void 0===s||s.hide(),this._glyphWidget||(this._glyphWidget=new PY(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(n.position.lineNumber)):void this._hideWidgets();this._hideWidgets()}_onKeyDown(t){var i;if(!this._editor.hasModel())return;const e=this._keybindingService.softDispatch(t,this._editor.getDomNode()),s=1===e.kind||2===e.kind&&"editor.action.showHover"===e.commandId&&(null===(i=this._contentWidget)||void 0===i?void 0:i.isVisible);5===t.keyCode||6===t.keyCode||57===t.keyCode||4===t.keyCode||s||this._hideWidgets()}_hideWidgets(){var t,i,e;this._isMouseDown&&this._hoverClicked&&(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible)||BX.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,null===(i=this._glyphWidget)||void 0===i||i.hide(),null===(e=this._contentWidget)||void 0===e||e.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(AY,this._editor)),this._contentWidget}showContentHover(t,i,e,s,n=!1){this._hoverActivatedByColorDecoratorClick=n,this._getOrCreateContentWidget().startShowingAtRange(t,i,e,s)}focus(){var t;null===(t=this._contentWidget)||void 0===t||t.focus()}scrollUp(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollUp()}scrollDown(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollDown()}scrollLeft(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollLeft()}scrollRight(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollRight()}pageUp(){var t;null===(t=this._contentWidget)||void 0===t||t.pageUp()}pageDown(){var t;null===(t=this._contentWidget)||void 0===t||t.pageDown()}goToTop(){var t;null===(t=this._contentWidget)||void 0===t||t.goToTop()}goToBottom(){var t;null===(t=this._contentWidget)||void 0===t||t.goToBottom()}get isColorPickerVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible}get isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible}dispose(){var t,i;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};zX.ID="editor.contrib.hover",zX=VX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([HX(1,Zr),HX(2,AF),HX(3,Ba),HX(4,CC)],zX),hu(zX.ID,zX,2),ru(class extends tu{constructor(){super({id:"editor.action.showHover",label:J(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:gS.editorTextFocus,primary:xe(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=zX.get(i);if(!s)return;const n=i.getPosition(),r=new ps(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)}}),ru(class extends tu{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:J(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=zX.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new ps(s.lineNumber,s.column,s.lineNumber,s.column),r=aY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollUpHover",label:J(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollUp()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollDownHover",label:J(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollDown()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollLeftHover",label:J(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollLeft()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollRightHover",label:J(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollRight()}}),ru(class extends tu{constructor(){super({id:"editor.action.pageUpHover",label:J(0,"Page Up Hover"),alias:"Page Up Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=zX.get(i);e&&e.pageUp()}}),ru(class extends tu{constructor(){super({id:"editor.action.pageDownHover",label:J(0,"Page Down Hover"),alias:"Page Down Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=zX.get(i);e&&e.pageDown()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToTopHover",label:J(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=zX.get(i);e&&e.goToTop()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToBottomHover",label:J(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=zX.get(i);e&&e.goToBottom()}}),bY.register(HY),bY.register(xX),kk(((t,i)=>{const e=t.getColor(Xv);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 UX extends Hi{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=this._editor.getOption(146);if("click"!==i&&"clickAndHover"!==i)return;const e=t.target;if(6!==e.type)return;if(!e.detail.injectedText)return;if(e.detail.injectedText.options.attachedData!==rJ)return;if(!e.range)return;const s=this._editor.getContribution(zX.ID);if(s&&!s.isColorPickerVisible){const t=new ps(e.range.startLineNumber,e.range.startColumn+1,e.range.endLineNumber,e.range.endColumn+1);s.showContentHover(t,1,0,!1,!0)}}}UX.ID="editor.contrib.colorContribution",hu(UX.ID,UX,2),bY.register(SJ);var KX,qX,GX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},ZX=function(t,i){return function(e,s){i(e,s,t)}},JX=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 QX=KX=class 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=gS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=gS.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 YX(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var t;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),null===(t=this._standaloneColorPickerWidget)||void 0===t||t.hide(),this._editor.focus()}insertColor(){var t;null===(t=this._standaloneColorPickerWidget)||void 0===t||t.updateEditor(),this.hide()}static get(t){return t.getContribution(KX.ID)}};QX.ID="editor.contrib.standaloneColorPickerController",QX=KX=GX([ZX(1,Jo),ZX(2,Xr),ZX(3,CC),ZX(4,Zr),ZX(5,Wg),ZX(6,ud)],QX),hu(QX.ID,QX,1);let YX=qX=class 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.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ie),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(DJ,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),u=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},a=this._register(Ll(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(u),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return qX.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:t?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}_start(t){return JX(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new XX(i.result,i.foundInEditor))}))}_computeAsync(t){return JX(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 KZ(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 TY(this._keybindingService)),setColorPicker:t=>s=t,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=t,this._register(this._standaloneColorPickerParticipant.renderHoverParts(n,[t])),void 0===s)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(.66*this._editor.getLayoutInfo().width,500)+"px",this._body.tabIndex=0,this._body.appendChild(e),s.layout();const r=s.body,o=r.saturationBox.domNode.clientWidth,h=r.domNode.clientWidth-o-22-8,c=s.body.enterButton;null==c||c.onClicked((()=>{this.updateEditor(),this.hide()}));const l=s.header;l.pickedColorNode.style.width=o+8+"px",l.originalColorNode.style.width=h+"px";const u=s.header.closeButton;null==u||u.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};YX.ID="editor.contrib.standaloneColorPickerWidget",YX=qX=GX([ZX(3,Zr),ZX(4,Xr),ZX(5,CC),ZX(6,Wg),ZX(7,ud)],YX);class XX{constructor(t,i){this.value=t,this.foundInEditor=i}}ru(class extends tu{constructor(){super({id:"editor.action.hideColorPicker",label:J(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:gS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=QX.get(i))||void 0===e||e.hide()}}),ru(class extends tu{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:J(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:gS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=QX.get(i))||void 0===e||e.insertColor()}}),Eh(class extends eu{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:J(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:J(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:bh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=QX.get(i))||void 0===e||e.showOrFocus()}});class t0{constructor(t,i,e){this.languageConfigurationService=e,this._selection=t,this._insertSpace=i,this._usedEndToken=null}static _haystackHasNeedleAtOffset(t,i,e){if(e<0)return!1;const s=i.length;if(e+s>t.length)return!1;for(let n=0;n<s;n++){const s=t.charCodeAt(e+n),r=i.charCodeAt(n);if(s!==r&&!(s>=65&&s<=90&&s+32===r||r>=65&&r<=90&&r+32===s))return!1}return!0}_createOperationsForBlockComment(t,i,e,s,n,r){const o=t.startLineNumber,h=t.startColumn,c=t.endLineNumber,l=t.endColumn,u=n.getLineContent(o),a=n.getLineContent(c);let d,f=u.lastIndexOf(i,h-1+i.length),g=a.indexOf(e,l-1-e.length);if(-1!==f&&-1!==g)if(o===c)u.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=u.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<u.length&&32===u.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===a.charCodeAt(g-1)&&(e=" "+e,g-=1),d=t0._createRemoveBlockCommentOperations(new ps(o,f+i.length+1,c,g+1),i,e)):(d=t0._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 ps.isEmpty(t)?s.push(OT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(OT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(OT.delete(new ps(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return ps.isEmpty(t)?n.push(OT.replace(new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(OT.insert(new gs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(OT.insert(new gs(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 ms(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 ms(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class i0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,u=s.length;h<u;h++){const u=s[h],a=n+h;if(a===n&&o){u.ignore=!0;continue}const d=e.getLineContent(a),f=$n(d);if(-1!==f){if(l=!1,u.ignore=!1,u.commentStrOffset=f,c&&!t0._haystackHasNeedleAtOffset(d,u.commentStr,f)&&(0===t?c=!1:1===t||(u.ignore=!0)),c&&i){const t=f+u.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(u.commentStrLength+=1)}}else u.ignore=r,u.commentStrOffset=d.length}if(0===t&&l){c=!1;for(let t=0,i=s.length;t<i;t++)s[t].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:s}}static _gatherPreflightData(t,i,e,s,n,r,o,h){const c=i0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:i0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=i0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(i0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new gs(s.positionLineNumber,s.positionColumn);for(let e=0,s=n.length;e<s;e++)i.addEditOperation(n[e].range,n[e].text),ps.isEmpty(n[e].range)&&ps.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?t0._createRemoveBlockCommentOperations(new ps(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=$n(i);-1===s&&(s=i.length),h=t0._createAddBlockCommentOperations(new ps(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=t0._createAddBlockCommentOperations(new ps(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 ps(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=i0._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 ms(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(OT.delete(new ps(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(OT.insert(new gs(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=i0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=i0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class e0 extends tu{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(ud);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(23),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>ps.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 i0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}ru(class extends e0{constructor(){super(0,{id:"editor.action.commentLine",label:J(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"5_insert",title:J(0,"&&Toggle Line Comment"),order:1}})}}),ru(class extends e0{constructor(){super(1,{id:"editor.action.addCommentLine",label:J(0,"Add Line Comment"),alias:"Add Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2081),weight:100}})}}),ru(class extends e0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:J(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2099),weight:100}})}}),ru(class extends tu{constructor(){super({id:"editor.action.blockComment",label:J(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"5_insert",title:J(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(ud);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new t0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var s0,n0=function(t,i){return function(e,s){i(e,s,t)}};let r0=s0=class{static get(t){return t.getContribution(s0.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&&vl(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(24)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(24))return this._editor.focus(),void(t.target.position&&!this._editor.getSelection().containsPosition(t.target.position)&&this._editor.setPosition(t.target.position));if(12===t.target.type)return;if(6===t.target.type&&t.target.detail.injectedText)return;if(t.event.preventDefault(),t.event.stopPropagation(),11===t.target.type)return this._showScrollbarContextMenu(t.event);if(6!==t.target.type&&7!==t.target.type&&1!==t.target.type)return;if(this._editor.focus(),t.target.position){let i=!1;for(const e of this._editor.getSelections())if(e.containsPosition(t.target.position)){i=!0;break}i||this._editor.setPosition(t.target.position)}let i=null;1!==t.target.type&&(i=t.event),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(24))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?bh.SimpleEditorContext:bh.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 Sh){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new ho(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new oo)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let s=i;if(!s){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),i=cl(this._editor.getDomNode());s={x:i.left+t.left,y:i.top+t.top+t.height}}const n=this._editor.getOption(126)&&!wt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getDomNode():void 0,getAnchor:()=>s,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new DP(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new DP(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===mR)return;const i=this._editor.getOption(72);let e=0;const s=t=>({id:"menu-action-"+ ++e,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),n=(t,i,n,r,o)=>{if(!i)return s({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(n,t)},c=[];for(const t of o)c.push(s({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new ho("menu-action-"+ ++e,t,i,void 0))(t,c)},r=[];r.push(s({label:J(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),r.push(new oo),r.push(s({label:J(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),r.push(n(J(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:J(0,"Proportional"),value:"proportional"},{label:J(0,"Fill"),value:"fill"},{label:J(0,"Fit"),value:"fit"}])),r.push(n(J(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:J(0,"Mouse Over"),value:"mouseover"},{label:J(0,"Always"),value:"always"}]));const o=this._editor.getOption(126)&&!wt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>r,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};r0.ID="editor.contrib.contextmenu",r0=s0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([n0(1,AR),n0(2,ER),n0(3,Jo),n0(4,CC),n0(5,yh),n0(6,Ta),n0(7,aR)],r0),hu(r0.ID,r0,2),ru(class extends tu{constructor(){super({id:"editor.action.showContextMenu",label:J(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=r0.get(i))||void 0===e||e.showContextMenu()}});class o0{constructor(t){this.selections=t}equals(t){const i=this.selections.length;if(i!==t.selections.length)return!1;for(let e=0;e<i;e++)if(!this.selections[e].equalsSelection(t.selections[e]))return!1;return!0}}class h0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class c0 extends Hi{static get(t){return t.getContribution(c0.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 o0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new h0(e,t.getScrollTop(),t.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new h0(new o0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){this._editor.hasModel()&&0!==this._redoStack.length&&(this._undoStack.push(new h0(new o0(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}}c0.ID="editor.contrib.cursorUndoRedoController",hu(c0.ID,c0,0),ru(class extends tu{constructor(){super({id:"cursorUndo",label:J(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=c0.get(i))||void 0===s||s.cursorUndo()}}),ru(class extends tu{constructor(){super({id:"cursorRedo",label:J(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=c0.get(i))||void 0===s||s.cursorRedo()}});class l0{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 ps(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 ms(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 ms(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 ms(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 ms(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 ms(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 u0(t){return ft?t.altKey:t.ctrlKey}class a0 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(35)&&!this._editor.getOption(22)&&(u0(t)&&(this._modifierPressed=!0),this._mouseDown&&u0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(u0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===a0.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]}u0(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 gs(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 ms(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new ms(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(u0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a0.ID,new l0(this._dragSelection,i,u0(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 ps(t.lineNumber,t.column,t.lineNumber,t.column),options:a0._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()}}a0.ID="editor.contrib.dragAndDrop",a0.TRIGGER_KEY_VALUE=ft?6:5,a0._DECORATION_OPTIONS=$M.register({description:"dnd-target",className:"dnd-target"}),hu(a0.ID,a0,2);const d0=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 f0=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 g0(t){return{asString:()=>f0(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class p0{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 Rt.some(this,(([t,i])=>i.asFile()))&&i.push("files"),w0(m0(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 m0(t)}}function m0(t){return t.toLowerCase()}function v0(t,i){return w0(m0(t),i.map(m0))}function w0(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 b0=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>b0.split(t).filter((t=>!t.startsWith("#")))});dh.add("workbench.contributions.dragAndDrop",new class{});class y0{constructor(){}static getInstance(){return y0.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}y0.INSTANCE=new y0;function k0(t){const i=new p0;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,g0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,C0(s))}}return i}function C0(t){const i=t.path?ss.parse(t.path):void 0;return function(t,i,e){const s={id:d0(),name:t,uri:i,data:e};return{asString:()=>f0(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>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())}))}(this,void 0,void 0,(function*(){return new Uint8Array(yield t.arrayBuffer())}))))}const S0=Object.freeze(["CodeEditors","CodeFiles",UR.RESOURCES,UR.INTERNAL_URI_LIST]);function x0(t,i=!1){const e=k0(t),s=e.get(UR.INTERNAL_URI_LIST);if(s)e.replace(Ha.uriList,s);else if(i||!e.has(Ha.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?ss.file(e).toString():ss.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(Ha.uriList,g0(b0.create(i)))}for(const t of S0)e.delete(t);return e}function D0(t){var i;function e(t,i){return"providerId"in t&&t.providerId===i.providerId||"mimeType"in t&&t.mimeType===i.handledMimeType}const s=new Map;for(const n of t)for(const r of null!==(i=n.yieldTo)&&void 0!==i?i:[])for(const i of t)if(i!==n&&e(r,i)){let t=s.get(n);t||(t=[],s.set(n,t)),t.push(i)}if(!s.size)return Array.from(t);const n=new Set,r=[];return function t(i){if(!i.length)return[];const e=i[0];if(r.includes(e))return console.warn(`Yield to cycle detected for ${e.providerId}`),i;if(n.has(e))return t(i.slice(1));let o=[];const h=s.get(e);return h&&(r.push(e),o=t(h),r.pop()),n.add(e),[...o,e,...t(i.slice(1))]}(Array.from(t))}const E0=$M.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class A0 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=Pl(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Pl("span.icon");this.domNode.append(i),i.classList.add(...eo.asClassNameArray(ys.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(66);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(52)||t.hasChanged(66))&&e()}))),this._register(Qc(this.domNode,El.CLICK,(()=>{this.delegate.cancel()})))}getId(){return A0.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)}}A0.baseId="editor.widget.inlineProgressWidget";let M0=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 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())}))}(this,void 0,void 0,(function*(){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=xu((()=>{const s=ps.fromPositions(t);this._currentDecorations.set([{range:s,options:E0}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(A0,this.id,this._editor,s,i,e))}),this._showDelay);try{return yield e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}))}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};M0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zr)],M0);var L0,O0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},F0=function(t,i){return function(e,s){i(e,s,t)}},T0=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 R0=L0=class extends Hi{constructor(t,i,e,s,n,r,o,h,c,l){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=l,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(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(Ji.runAndSubscribe(l.onDidUpdateKeybindings,(()=>{this._updateButtonTitle()})))}_updateButtonTitle(){var t;const i=null===(t=this._keybindingService.lookupKeybinding(this.showCommand.id))||void 0===t?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(i?` (${i})`:"")}create(){this.domNode=Pl(".post-edit-widget"),this.button=this._register(new Bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Qc(this.domNode,El.CLICK,(()=>this.showSelector())))}getId(){return L0.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=cl(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>lo({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};R0.baseId="editor.widget.postEditWidget",R0=L0=O0([F0(7,AR),F0(8,Jo),F0(9,CC)],R0);let _0=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(Ji.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}applyEditAndShowIfNeeded(t,i,e,s){var n,r;return T0(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;let c=[];c=("string"==typeof h.insertText?""===h.insertText:""===h.insertText.snippet)?[]:t.map((t=>new CT(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0})));const l={edits:[...c,...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},u=t[0],a=o.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);let d,f;try{d=yield this._bulkEditService.apply(l,{editor:this._editor,token:s}),f=o.getDecorationRange(a[0])}finally{o.deltaDecorations(a,[])}e&&d.isApplied&&i.allEdits.length>1&&this.show(null!=f?f:u,i,(n=>T0(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(R0,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()}};_0=O0([F0(4,Zr),F0(5,yT)],_0);var I0,P0=function(t,i){return function(e,s){i(e,s,t)}},N0=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 B0="editor.changePasteType",$0=new Zo("pasteWidgetVisible",!1,J(0,"Whether the paste widget is showing")),j0="application/vnd.code.copyMetadata";let W0=I0=class extends Hi{static get(t){return t.getContribution(I0.ID)}constructor(t,i,e,s,n,r,o){super(),this._bulkEditService=e,this._clipboardService=s,this._languageFeaturesService=n,this._quickInputService=r,this._progressService=o,this._editor=t;const h=t.getContainerDomNode();this._register(Qc(h,"copy",(t=>this.handleCopy(t)))),this._register(Qc(h,"cut",(t=>this.handleCopy(t)))),this._register(Qc(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new M0("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(_0,"pasteIntoEditor",t,$0,{id:B0,label:J(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},bl().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(84).enabled&&!this._editor.getOption(90)}handleCopy(t){var i,e;if(!this._editor.hasTextFocus())return;if(mt&&this._clipboardService.writeResources([]),!t.clipboardData||!this.isPasteAsEnabled())return;const s=this._editor.getModel(),n=this._editor.getSelections();if(!s||!(null==n?void 0:n.length))return;const r=this._editor.getOption(37);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new ps(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const l=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,dt),u={multicursorText:Array.isArray(l)?l:null,pasteOnNewLine:h,mode:null},a=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!a.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:u});const d=k0(t.clipboardData),f=a.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=d0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:u});const p=wu((t=>N0(this,void 0,void 0,(function*(){const i=c(yield Promise.all(a.map((i=>N0(this,void 0,void 0,(function*(){try{return yield i.prepareDocumentPaste(s,o,d,t)}catch(t){return void console.error(t)}}))))));i.reverse();for(const t of i)for(const[i,e]of t)d.replace(i,e);return d}))));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:g,dataTransferPromise:p}}handlePaste(t){var i,e;return N0(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),o=x0(t.clipboardData);o.delete(j0);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],Ha.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>v0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}))}doPasteInline(t,i,e,s){const n=wu((r=>N0(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new oK(o,3,void 0,r);try{if(yield this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const r=t.filter((t=>V0(t,e)));if(!r.length||1===r.length&&"text"===r[0].id)return void(yield this.applyDefaultPasteHandler(e,s,c.token));const l=yield this.getPasteEdits(r,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===l.length&&"text"===l[0].providerId)return void(yield this.applyDefaultPasteHandler(e,s,c.token));if(l.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:l},t,c.token)}yield this.applyDefaultPasteHandler(e,s,c.token)}finally{c.dispose(),this._currentPasteOperation===n&&(this._currentPasteOperation=void 0)}}))));this._pasteProgressManager.showWhile(i[0].getEndPosition(),J(0,"Running paste handlers. Click to cancel"),n),this._currentPasteOperation=n}showPasteAsPick(t,i,e,s,n){const r=wu((o=>N0(this,void 0,void 0,(function*(){const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new oK(h,3,void 0,o);try{if(yield this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let o=i.filter((t=>V0(t,s)));t&&(o=o.filter((i=>i.id===t)));const h=yield this.getPasteEdits(o,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!h.length)return;let u;if(t)u=h.at(0);else{const t=yield this._quickInputService.pick(h.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:J(0,"Select Paste Action")});u=null==t?void 0:t.edit}if(!u)return;const a=function(t,i,e){var s,n;return{edits:[...i.map((i=>new CT(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,u);yield this._bulkEditService.apply(a,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}))));this._progressService.withProgress({location:10,title:J(0,"Running paste handlers")},(()=>r))}setCopyMetadata(t,i){t.setData(j0,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(j0);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=uk.getTextData(t.clipboardData);return n?{defaultPastePayload:{mode:n.mode,multicursorText:null!==(i=n.multicursorText)&&void 0!==i?i:null,pasteOnNewLine:!!n.isFromEmptySelection}}:void 0}mergeInDataFromCopy(t,i,e){var s;return N0(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(Ha.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(Ha.uriList,g0(b0.create(i)))}}))}getPasteEdits(t,i,e,s,n){return N0(this,void 0,void 0,(function*(){const r=yield bu(Promise.all(t.map((t=>N0(this,void 0,void 0,(function*(){var r;try{const o=yield null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n);if(o)return Object.assign(Object.assign({},o),{providerId:t.id})}catch(t){console.error(t)}}))))),n);return D0(c(null!=r?r:[]))}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return N0(this,void 0,void 0,(function*(){const o=null!==(s=t.get(Ha.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 V0(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}W0.ID="editor.contrib.copyPasteActionController",W0=I0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P0(1,Zr),P0(2,yT),P0(3,EV),P0(4,Wg),P0(5,Ij),P0(6,eR)],W0);var H0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},z0=function(t,i){return function(e,s){i(e,s,t)}},U0=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 K0=J(0,"Built-in");class q0{provideDocumentPasteEdits(t,i,e,s){return U0(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{insertText:t.insertText,label:t.label,detail:t.detail,handledMimeType:t.handledMimeType,yieldTo:t.yieldTo}:void 0}))}provideDocumentOnDropEdits(t,i,e,s){return U0(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{insertText:t.insertText,label:t.label,handledMimeType:t.handledMimeType,yieldTo:t.yieldTo}:void 0}))}}class G0 extends q0{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[Ha.text],this.pasteMimeTypes=[Ha.text]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const i=t.get(Ha.text);if(!i)return;if(t.has(Ha.uriList))return;const e=yield i.asString();return{handledMimeType:Ha.text,label:J(0,"Insert Plain Text"),detail:K0,insertText:e}}))}}class Z0 extends q0{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[Ha.uriList],this.pasteMimeTypes=[Ha.uriList]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const e=yield Q0(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===Vc.file?t.fsPath:(s++,i))).join(" ");let r;return r=J(0,s>0?e.length>1?"Insert Uris":"Insert Uri":e.length>1?"Insert Paths":"Insert Path"),{handledMimeType:Ha.uriList,insertText:n,label:r,detail:K0}}))}}let J0=class extends q0{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[Ha.uriList],this.pasteMimeTypes=[Ha.uriList]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const e=yield Q0(t);if(!e.length||i.isCancellationRequested)return;const s=c(e.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?PE(i.uri,t):void 0})));return s.length?{handledMimeType:Ha.uriList,insertText:s.join(" "),label:J(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:K0}:void 0}))}};function Q0(t){return U0(this,void 0,void 0,(function*(){const i=t.get(Ha.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of b0.parse(e))try{s.push({uri:ss.parse(t),originalText:t})}catch(t){}return s}))}J0=H0([z0(0,aR)],J0);let Y0=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new G0)),this._register(t.documentOnDropEditProvider.register("*",new Z0)),this._register(t.documentOnDropEditProvider.register("*",new J0(i)))}};Y0=H0([z0(0,Wg),z0(1,aR)],Y0);let X0=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new G0)),this._register(t.documentPasteEditProvider.register("*",new Z0)),this._register(t.documentPasteEditProvider.register("*",new J0(i)))}};X0=H0([z0(0,Wg),z0(1,aR)],X0),hu(W0.ID,W0,0),tH(X0),nu(new class extends Xl{constructor(){super({id:B0,precondition:$0,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=W0.get(i))||void 0===s?void 0:s.changePasteType()}}),ru(class extends tu{constructor(){super({id:"editor.action.pasteAs",label:J(0,"Paste As..."),alias:"Paste As...",precondition:void 0,description:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:J(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=W0.get(i))||void 0===s?void 0:s.pasteAs(n)}});class t1{constructor(t){this.identifier=t}}const i1=Qr("treeViewsDndService");Wa(i1,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 e1,s1=function(t,i){return function(e,s){i(e,s,t)}},n1=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 r1="editor.experimental.dropIntoEditor.defaultProvider",o1="editor.changeDropType",h1=new Zo("dropWidgetVisible",!1,J(0,"Whether the drop widget is showing"));let c1=e1=class extends Hi{static get(t){return t.getContribution(e1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=y0.getInstance(),this._dropProgressManager=this._register(i.createInstance(M0,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(_0,"dropIntoEditor",t,h1,{id:o1,label:J(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}onDropIntoEditor(t,i,e){var s;return n1(this,void 0,void 0,(function*(){if(!e.dataTransfer||!t.hasModel())return;null===(s=this._currentOperation)||void 0===s||s.cancel(),t.focus(),t.setPosition(i);const n=wu((s=>n1(this,void 0,void 0,(function*(){const r=new oK(t,1,void 0,s);try{const o=yield this.extractDataTransferData(e);if(0===o.size||r.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))))),l=yield this.getDropEdits(c,h,i,o,r);if(r.token.isCancellationRequested)return;if(l.length){const e=this.getInitialActiveEditIndex(h,l),n="afterDrop"===t.getOption(36).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ps.fromPositions(i)],{activeEditIndex:e,allEdits:l},n,s)}}finally{r.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}}))));this._dropProgressManager.showWhile(i,J(0,"Running drop handlers. Click to cancel"),n),this._currentOperation=n}))}getDropEdits(t,i,e,s,n){return n1(this,void 0,void 0,(function*(){const r=yield bu(Promise.all(t.map((t=>n1(this,void 0,void 0,(function*(){try{const r=yield t.provideDocumentOnDropEdits(i,e,s,n.token);if(r)return Object.assign(Object.assign({},r),{providerId:t.id})}catch(t){console.error(t)}}))))),n.token);return D0(c(null!=r?r:[]))}))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(r1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&v0(t,[i.handledMimeType])));if(e>=0)return e}return 0}extractDataTransferData(t){return n1(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new p0;const i=x0(t.dataTransfer);if(this.treeItemsTransfer.hasData(t1.prototype)){const t=this.treeItemsTransfer.getData(t1.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}))}};c1.ID="editor.contrib.dropIntoEditorController",c1=e1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,Zr),s1(2,Ta),s1(3,Wg),s1(4,i1)],c1),hu(c1.ID,c1,2),nu(new class extends Xl{constructor(){super({id:o1,precondition:h1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=c1.get(i))||void 0===s||s.changeDropType()}}),tH(Y0),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{[r1]:{type:"object",scope:5,description:J(0,"Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}}));class l1{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===l1._FIND_MATCH_DECORATION||i===l1._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,l1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,l1._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 ps(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,l1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=l1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=l1._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 ps(o,1,h,1),options:l1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ps(o,1,h,1),options:l1._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,l1._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}}l1._CURRENT_FIND_MATCH_DECORATION=$M.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:vk(fb),position:Xd.Center},minimap:{color:vk(pb),position:ef.Inline}}),l1._FIND_MATCH_DECORATION=$M.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:vk(fb),position:Xd.Center},minimap:{color:vk(pb),position:ef.Inline}}),l1._FIND_MATCH_NO_OVERVIEW_DECORATION=$M.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),l1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=$M.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:vk(fb),position:Xd.Center}}),l1._RANGE_HIGHLIGHT_DECORATION=$M.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),l1._FIND_SCOPE_DECORATION=$M.register({description:"find-scope",className:"findScope",isWholeLine:!0});class u1{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)=>ps.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 a1(t,i){if(t&&""!==t[0]){const e=d1(t,i,"-"),s=d1(t,i,"_");return e&&!s?f1(t,i,"-"):!e&&s?f1(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 d1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function f1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=a1([n[i]],t)+e})),r.slice(0,-1)}class g1{constructor(t){this.staticValue=t,this.kind=0}}class p1{constructor(t){this.pieces=t,this.kind=1}}class m1{static fromStaticValue(t){return new m1([v1.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 g1(t[0].staticValue):new p1(t):new g1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?a1(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=m1._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 v1{static staticValue(t){return new v1(t,-1,null)}static caseOps(t,i){return new v1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class w1{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++]=v1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=v1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=v1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new m1(this._result)}}const b1=new Zo("findWidgetVisible",!1);b1.toNegated();const y1=new Zo("findInputFocussed",!1),k1=new Zo("replaceInputFocussed",!1),C1={primary:545,mac:{primary:2593}},S1={primary:565,mac:{primary:2613}},x1={primary:560,mac:{primary:2608}},D1={primary:554,mac:{primary:2602}},E1={primary:558,mac:{primary:2606}},A1="editor.action.nextMatchFindAction",M1="editor.action.previousMatchFindAction",L1="closeFindWidget",O1="toggleFindCaseSensitive",F1="toggleFindWholeWord",T1="toggleFindRegex",R1="toggleFindInSelection",_1="togglePreserveCase",I1="editor.action.replaceOne",P1="editor.action.replaceAll",N1=19999;class B1{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new Eu,this._decorations=new l1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Mu((()=>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 ps(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,N1);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=Mf(s.map((t=>t.range)),(t=>ps.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const t=this._decorations.getFindScope();return t&&this._editor.revealRangeInCenterIfOutsideViewport(t,0),!0}return!1}_setCurrentFindMatch(t){const i=this._decorations.setCurrentFindMatch(t);this._state.changeMatchInfo(i,this._decorations.getCount(),t),this._editor.setSelection(t),this._editor.revealRangeInCenterIfOutsideViewport(t,0)}_prevSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||1===s?(1===e?e=n.getLineCount():e--,s=n.getLineMaxColumn(e)):s--,new gs(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()<N1){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=B1._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 gs(n,r),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1);return c&&c.range.isEmpty()&&c.range.getStartPosition().equals(h)&&(h=this._prevSearchPosition(h),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1)),c?i||s.containsRange(c.range)?void this._setCurrentFindMatch(c.range):this._moveToPrevMatch(c.range.getStartPosition(),!0):void 0}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||s===n.getLineMaxColumn(e)?(e===n.getLineCount()?e=1:e++,s=1):s++,new gs(e,s)}_moveToNextMatch(t){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<N1){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=B1._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(t)&&(t=r.getStartPosition()),t.isBefore(r.getStartPosition())&&(t=r.getStartPosition());const{lineNumber:o,column:h}=t,c=this._editor.getModel();let l=new gs(o,h),u=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i);return e&&u&&u.range.isEmpty()&&u.range.getStartPosition().equals(l)&&(l=this._nextSearchPosition(l),u=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i)),u?s||r.containsRange(u.range)?u:this._getNextMatch(u.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 m1(null);const i=[],e=new w1(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):m1.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 BC(i,s);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new gs(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=>B1._getSearchRange(this._editor.getModel(),t)));return this._editor.getModel().findMatches(this._state.searchString,s,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=N1?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new df(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let t="mu";i.ignoreCase&&(t+="i"),i.global&&(t+="g"),i=new RegExp(i.source,t)}const e=this._editor.getModel(),s=e.getValue(1),n=e.getFullModelRange(),r=this._getReplacePattern();let o;const h=this._state.preserveCase;o=s.replace(i,r.hasReplacementPatterns||h?function(){return r.buildReplaceString(arguments,h)}:r.buildReplaceString(null,h));const c=new VC(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 u1(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 ms(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 $1 extends Ty{constructor(t,i,e){super(),this._hideSoon=this._register(new Mu((()=>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:Am(Hm),inputActiveOptionForeground:Am(Um),inputActiveOptionBackground:Am(zm)};this.caseSensitive=this._register(new pB(Object.assign({appendTitle:this._keybindingLabelFor(O1),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(F1),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 vB(Object.assign({appendTitle:this._keybindingLabelFor(T1),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(Qc(this._domNode,El.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Qc(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 $1.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 j1(t,i){return 1===t||2!==t&&i}$1.ID="editor.contrib.findOptionsWidget";class W1 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 j1(this._isRegexOverride,this._isRegex)}get wholeWord(){return j1(this._wholeWordOverride,this._wholeWord)}get matchCase(){return j1(this._matchCaseOverride,this._matchCase)}get preserveCase(){return j1(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 ie),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&&(ps.equalsRange(this._currentMatch,e)||(this._currentMatch=e,s.currentMatch=!0,n=!0)),n&&this._onFindReplaceStateChange.fire(s)}change(t,i,e=!0){var s;const n={moveCursor:i,updateHistory:e,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let r=!1;const o=this.isRegex,h=this.wholeWord,c=this.matchCase,l=this.preserveCase;void 0!==t.searchString&&this._searchString!==t.searchString&&(this._searchString=t.searchString,n.searchString=!0,r=!0),void 0!==t.replaceString&&this._replaceString!==t.replaceString&&(this._replaceString=t.replaceString,n.replaceString=!0,r=!0),void 0!==t.isRevealed&&this._isRevealed!==t.isRevealed&&(this._isRevealed=t.isRevealed,n.isRevealed=!0,r=!0),void 0!==t.isReplaceRevealed&&this._isReplaceRevealed!==t.isReplaceRevealed&&(this._isReplaceRevealed=t.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),void 0!==t.isRegex&&(this._isRegex=t.isRegex),void 0!==t.wholeWord&&(this._wholeWord=t.wholeWord),void 0!==t.matchCase&&(this._matchCase=t.matchCase),void 0!==t.preserveCase&&(this._preserveCase=t.preserveCase),void 0!==t.searchScope&&((null===(s=t.searchScope)||void 0===s?void 0:s.every((t=>{var i;return null===(i=this._searchScope)||void 0===i?void 0:i.some((i=>!ps.equalsRange(i,t)))})))||(this._searchScope=t.searchScope,n.searchScope=!0,r=!0)),void 0!==t.loop&&this._loop!==t.loop&&(this._loop=t.loop,n.loop=!0,r=!0),void 0!==t.isSearching&&this._isSearching!==t.isSearching&&(this._isSearching=t.isSearching,n.isSearching=!0,r=!0),void 0!==t.filters&&(this._filters?this._filters.update(t.filters):this._filters=t.filters,n.filters=!0,r=!0),this._isRegexOverride=void 0!==t.isRegexOverride?t.isRegexOverride:0,this._wholeWordOverride=void 0!==t.wholeWordOverride?t.wholeWordOverride:0,this._matchCaseOverride=void 0!==t.matchCaseOverride?t.matchCaseOverride:0,this._preserveCaseOverride=void 0!==t.preserveCaseOverride?t.preserveCaseOverride:0,o!==this.isRegex&&(r=!0,n.isRegex=!0),h!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),l!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||1!==this.matchesPosition}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=N1}}const V1=J(0,"input"),H1=J(0,"Preserve Case");class z1 extends aB{constructor(t){super({icon:ys.preserveCase,title:H1+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class U1 extends Ty{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ie),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ie),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ie),this._onInput=this._register(new ie),this._onKeyUp=this._register(new ie),this._onPreserveCaseKeyDown=this._register(new ie),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||V1;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 CB(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 z1(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 l=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=l.indexOf(document.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%l.length:t.equals(15)&&(e=0===i?l.length-1:i-1),t.equals(9)?(l[i].blur(),this.inputBox.focus()):e>=0&&l[e].focus(),Al(t,!0)}}}));const u=document.createElement("div");u.className="controls",u.style.display=this._showOptionButtons?"block":"none",u.appendChild(this.preserveCase.domNode),this.domNode.appendChild(u),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 K1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},q1=function(t,i){return function(e,s){i(e,s,t)}};const G1=new Zo("suggestWidgetVisible",!1,J(0,"Whether suggestion are visible")),Z1="historyNavigationWidgetFocus",J1="historyNavigationForwardsEnabled",Q1="historyNavigationBackwardsEnabled";let Y1;const X1=[];function t2(t,i){if(X1.includes(i))throw new Error("Cannot register the same widget multiple times");X1.push(i);const e=new Vi,s=new Zo(Z1,!1).bindTo(t),n=new Zo(J1,!0).bindTo(t),r=new Zo(Q1,!0).bindTo(t),o=()=>{s.set(!0),Y1=i},h=()=>{s.set(!1),Y1===i&&(Y1=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{X1.splice(X1.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let i2=class extends xB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(t2(n,this.inputBox))}};i2=K1([q1(3,Jo)],i2);let e2=class extends U1{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(t2(r,this.inputBox))}};function s2(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())}e2=K1([q1(3,Jo)],e2),gh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Lo.and(Lo.has(Z1),Lo.equals(Q1,!0),Lo.not("isComposing"),G1.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==Y1||Y1.showPreviousValue()}}),gh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Lo.and(Lo.has(Z1),Lo.equals(J1,!0),Lo.not("isComposing"),G1.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==Y1||Y1.showNextValue()}});const n2=GW("find-selection",ys.selection,J(0,"Icon for 'Find in Selection' in the editor find widget.")),r2=GW("find-collapsed",ys.chevronRight,J(0,"Icon to indicate that the editor find widget is collapsed.")),o2=GW("find-expanded",ys.chevronDown,J(0,"Icon to indicate that the editor find widget is expanded.")),h2=GW("find-replace",ys.replace,J(0,"Icon for 'Replace' in the editor find widget.")),c2=GW("find-replace-all",ys.replaceAll,J(0,"Icon for 'Replace All' in the editor find widget.")),l2=GW("find-previous-match",ys.arrowUp,J(0,"Icon for 'Find Previous' in the editor find widget.")),u2=GW("find-next-match",ys.arrowDown,J(0,"Icon for 'Find Next' in the editor find widget.")),a2=J(0,"Find / Replace"),d2=J(0,"Find"),f2=J(0,"Find"),g2=J(0,"Previous Match"),p2=J(0,"Next Match"),m2=J(0,"Find in Selection"),v2=J(0,"Close"),w2=J(0,"Replace"),b2=J(0,"Replace"),y2=J(0,"Replace"),k2=J(0,"Replace All"),C2=J(0,"Toggle Replace"),S2=J(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",N1),x2=J(0,"{0} of {1}"),D2=J(0,"No results"),E2=419;let A2=69;const M2="ctrlEnterReplaceAll.windows.donotask",L2=ft?256:2048;class O2{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function F2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function T2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class R2 extends Ty{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(M2,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new ku(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(90)&&(this._codeEditor.getOption(90)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(143)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(41)){const t=this._codeEditor.getOption(41).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(41).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new O2(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>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())}))}(this,void 0,void 0,(function*(){if(this._isVisible){const t=yield this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}}))))),this._findInputFocused=y1.bindTo(r),this._findFocusTracker=this._register(Ll(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=k1.bindTo(r),this._replaceFocusTracker=this._register(Ll(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus((()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._replaceFocusTracker.onDidBlur((()=>{this._replaceInputFocused.set(!1)}))),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new O2(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 R2.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(t){if(t.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}t.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),t.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),t.isReplaceRevealed&&(this._state.isReplaceRevealed?this._codeEditor.getOption(90)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=ll(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=A2+"px",this._matchesCount.title=this._state.matchesCount>=N1?S2:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=N1&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Fn(x2,e,i)}else t=D2;this._matchesCount.appendChild(document.createTextNode(t)),sm(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),A2=Math.max(A2,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===D2)return""===e?J(0,"{0} found",t):J(0,"{0} found for '{1}'",t,e);if(i){const s=J(0,"{0} found for '{1}', at {2}",t,e,i.startLineNumber+":"+i.startColumn),n=this._codeEditor.getModel();return n&&i.startLineNumber<=n.getLineCount()&&i.startLineNumber>=1?`${n.getLineContent(i.startLineNumber)}, ${s}`:s}return J(0,"{0} found for '{1}'",t,e)}_updateToggleSelectionFindButton(){const t=this._codeEditor.getSelection();this._isVisible&&(this._toggleSelectionFind.checked||t&&(t.startLineNumber!==t.endLineNumber||t.startColumn!==t.endColumn))?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const t=this._state.searchString.length>0,i=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const e=!this._codeEditor.getOption(90);this._toggleReplaceBtn.setEnabled(this._isVisible&&e)}_reveal(){if(this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const t=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":this._toggleSelectionFind.checked=!!t&&t.startLineNumber!==t.endLineNumber}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout((()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")}),0)),this._revealTimeouts.push(setTimeout((()=>{this._findInput.validate()}),200)),this._codeEditor.layoutOverlayWidget(this);let i=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=cl(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=hl(this._domNode).left;r>e&&(i=!1);const n=this._codeEditor.getScrolledVisiblePosition(t.getEndPosition());s.left+(n?n.left:0)>e&&(i=!1)}}}this._showViewZone(i)}}_hide(t){this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),t&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(t){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return void this._removeViewZone();if(!this._isVisible)return;const i=this._viewZone;void 0===this._viewZoneId&&i&&this._codeEditor.changeViewZones((e=>{i.heightInPx=this._getHeight(),this._viewZoneId=e.addZone(i),this._codeEditor.setScrollTop(t||this._codeEditor.getScrollTop()+i.heightInPx)}))}_showViewZone(t=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new O2(0));const i=this._viewZone;this._codeEditor.changeViewZones((e=>{if(void 0!==this._viewZoneId){const s=this._getHeight();if(s===i.heightInPx)return;const n=s-i.heightInPx;return i.heightInPx=s,e.layoutZone(this._viewZoneId),void(t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+n))}{let s=this._getHeight();if(s-=this._codeEditor.getOption(83).top,s<=0)return;i.heightInPx=s,this._viewZoneId=e.addZone(i),t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}}))}_removeViewZone(){this._codeEditor.changeViewZones((t=>{void 0!==this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))}))}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!Zc(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&&ll(this._domNode)>E2)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=ll(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-A2>=i&&(r=!0),447+e-A2>=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=ll(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||ps.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|L2)?(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)?F2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?T2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|L2)?(this._keybindingService.dispatchEvent(t,t.target)||(dt&&pt&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(J(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(M2,!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)?F2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?T2(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 i2(null,this._contextViewProvider,{width:221,label:d2,placeholder:f2,appendCaseSensitiveLabel:this._keybindingLabelFor(O1),appendWholeWordsLabel:this._keybindingLabelFor(F1),appendRegexLabel:this._keybindingLabelFor(T1),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:()=>s2(this._keybindingService),inputBoxStyles:HP,toggleStyles:VP},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()}))),gt&&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 _2({label:g2+this._keybindingLabelFor(M1),icon:l2,onTrigger:()=>{$(this._codeEditor.getAction(M1)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new _2({label:p2+this._keybindingLabelFor(A1),icon:u2,onTrigger:()=>{$(this._codeEditor.getAction(A1)).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 aB({icon:n2,title:m2+this._keybindingLabelFor(R1),isChecked:!1,inputActiveOptionBackground:Am(zm),inputActiveOptionBorder:Am(Hm),inputActiveOptionForeground:Am(Um)})),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 _2({label:v2+this._keybindingLabelFor(L1),icon:XW,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),t.preventDefault())}})),this._replaceInput=this._register(new e2(null,void 0,{label:w2,placeholder:b2,appendPreserveCaseLabel:this._keybindingLabelFor(_1),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>s2(this._keybindingService),inputBoxStyles:HP,toggleStyles:VP},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 _2({label:y2+this._keybindingLabelFor(I1),icon:h2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new _2({label:k2+this._keybindingLabelFor(P1),icon:c2,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 _2({label:C2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=ll(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}})),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=a2,this._domNode.role="dialog",this._domNode.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(e),this._resizeSash=new tB(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=E2;this._register(this._resizeSash.onDidStart((()=>{n=ll(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<E2||i>(parseFloat(sl(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=ll(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=ll(this._domNode);if(t<E2)return;let i=E2;if(!this._resized||t===E2){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=ll(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}R2.ID="editor.contrib.findWidget";class _2 extends Ty{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+eo.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(...eo.asClassNameArray(r2)),this._domNode.classList.add(...eo.asClassNameArray(o2))):(this._domNode.classList.remove(...eo.asClassNameArray(o2)),this._domNode.classList.add(...eo.asClassNameArray(r2)))}}kk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(qv)),e(".currentFindMatch",t.getColor(Kv)),e(".findScope",t.getColor(Gv)),e(".find-widget",t.getColor(Lv));const s=t.getColor(Bm);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor($m);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(Jv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${oy(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Zv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(Qv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${oy(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(Im);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Ov);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const u=t.getColor(Tm);u&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${u}; }`);const a=t.getColor(Tv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(Fv);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(tb);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(_m);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var I2,P2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},B2=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 $2(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 j2=I2=class extends Hi{get editor(){return this._editor}static get(t){return t.getContribution(I2.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=b1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new ku(500),this._state=this._register(new W1),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._model=null,this._register(this._editor.onDidChangeModel((()=>{const t=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),t&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})})))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(t){this.saveQueryState(t),t.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),t.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(t){t.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),t.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),t.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),t.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!y1.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=Rn(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}_start(t,i){return B2(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=$2(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?Rn(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=$2(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 B1(this._editor,this._state))}))}start(t,i){return this._start(t,i)}moveToNextMatch(){return!!this._model&&(this._model.moveToNextMatch(),!0)}moveToPrevMatch(){return!!this._model&&(this._model.moveToPrevMatch(),!0)}goToMatch(t){return!!this._model&&(this._model.moveToMatch(t),!0)}replace(){return!!this._model&&(this._model.replace(),!0)}replaceAll(){var t;return!!this._model&&((null===(t=this._editor.getModel())||void 0===t?void 0:t.isTooLargeForHeapOperation())?(this._notificationService.warn(J(0,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0))}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}getGlobalBufferTerm(){return B2(this,void 0,void 0,(function*(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}))}setGlobalBufferTerm(t){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};j2.ID="editor.contrib.findController",j2=I2=P2([N2(1,Jo),N2(2,PP),N2(3,EV),N2(4,vO)],j2);let W2=class extends j2{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h,r),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._widget=null,this._findOptionsWidget=null}_start(t,i){const e=Object.create(null,{_start:{get:()=>super._start}});return B2(this,void 0,void 0,(function*(){this._widget||this._createFindWidget();const s=this._editor.getSelection();let n=!1;switch(this._editor.getOption(41).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 R2(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new $1(this._editor,this._state,this._keybindingService))}};W2=P2([N2(1,ER),N2(2,Jo),N2(3,CC),N2(4,mk),N2(5,vO),N2(6,PP),N2(7,EV)],W2),ou(new iu({id:"actions.find",label:J(0,"Find"),alias:"Find",precondition:Lo.or(gS.focus,Lo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"3_find",title:J(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=j2.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})}));const V2={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:J(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:J(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:J(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:J(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 H2 extends tu{run(t,i){return B2(this,void 0,void 0,(function*(){const t=j2.get(i);t&&!this._run(t)&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(t))}))}}class z2 extends tu{run(t,i){return B2(this,void 0,void 0,(function*(){const t=j2.get(i);if(!t)return;const e=$2(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(41).loop}),this._run(t))}))}}ou(new iu({id:"editor.action.startFindReplaceAction",label:J(0,"Replace"),alias:"Replace",precondition:Lo.or(gS.focus,Lo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"3_find",title:J(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=j2.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(41).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(41).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})})),hu(j2.ID,W2,0),ru(class extends tu{constructor(){super({id:"editor.actions.findWithArgs",label:J(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:V2})}run(t,i,e){return B2(this,void 0,void 0,(function*(){const t=j2.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(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(41).loop},s),t.setGlobalBufferTerm(t.getState().searchString)}}))}}),ru(class extends tu{constructor(){super({id:"actions.findWithSelection",label:J(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 B2(this,void 0,void 0,(function*(){const t=j2.get(i);t&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),t.setGlobalBufferTerm(t.getState().searchString))}))}}),ru(class extends H2{constructor(){super({id:A1,label:J(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:gS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Lo.and(gS.focus,y1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),ru(class extends H2{constructor(){super({id:M1,label:J(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:gS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Lo.and(gS.focus,y1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToMatchFindAction",label:J(0,"Go to Match..."),alias:"Go to Match...",precondition:b1}),this._highlightDecorations=[]}run(t,i,e){const s=j2.get(i);if(!s)return;const n=s.getState().matchesCount;if(n<1)return void t.get(vO).notify({severity:mO.Warning,message:J(0,"No matches. Try searching for something else.")});const r=t.get(Ij).createInputBox();r.placeholder=J(0,"Type a number to go to a specific match (between 1 and {0})",n);const o=t=>{const i=parseInt(t);if(isNaN(i))return;const e=s.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},h=t=>{const e=o(t);if("number"==typeof e){r.validationMessage=void 0,s.goToMatch(e);const t=s.getState().currentMatch;t&&this.addDecorations(i,t)}else r.validationMessage=J(0,"Please type a number between 1 and {0}",s.getState().matchesCount),this.clearDecorations(i)};r.onDidChangeValue((t=>{h(t)})),r.onDidAccept((()=>{const t=o(r.value);"number"==typeof t?(s.goToMatch(t),r.hide()):r.validationMessage=J(0,"Please type a number between 1 and {0}",s.getState().matchesCount)})),r.onDidHide((()=>{this.clearDecorations(i),r.dispose()})),r.show()}clearDecorations(t){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])}))}addDecorations(t,i){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[{range:i,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:vk(Zk),position:Xd.Full}}}])}))}}),ru(class extends z2{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:J(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),ru(class extends z2{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:J(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const U2=Xl.bindToContribution(j2.get);nu(new U2({id:L1,precondition:b1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:9,secondary:[1033]}})),nu(new U2({id:O1,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:gS.focus,primary:C1.primary,mac:C1.mac,win:C1.win,linux:C1.linux}})),nu(new U2({id:F1,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:gS.focus,primary:S1.primary,mac:S1.mac,win:S1.win,linux:S1.linux}})),nu(new U2({id:T1,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:gS.focus,primary:x1.primary,mac:x1.mac,win:x1.win,linux:x1.linux}})),nu(new U2({id:R1,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:gS.focus,primary:D1.primary,mac:D1.mac,win:D1.win,linux:D1.linux}})),nu(new U2({id:_1,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:gS.focus,primary:E1.primary,mac:E1.mac,win:E1.win,linux:E1.linux}})),nu(new U2({id:I1,precondition:b1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:gS.focus,primary:3094}})),nu(new U2({id:I1,precondition:b1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,k1),primary:3}})),nu(new U2({id:P1,precondition:b1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:gS.focus,primary:2563}})),nu(new U2({id:P1,precondition:b1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,k1),primary:void 0,mac:{primary:2051}}})),nu(new U2({id:"editor.action.selectAllMatches",precondition:b1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:gS.focus,primary:515}}));const K2={0:" ",1:"u",2:"r"},q2=16777215,G2=4278190080;class Z2{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 J2{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 Z2(t.length),this._userDefinedStates=new Z2(t.length),this._recoveredStates=new Z2(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>q2||n>q2)throw new Error("startLineNumber or endLineNumber must not exceed "+q2);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]&q2}getEndLineNumber(t){return this._endIndexes[t]&q2}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 Q2(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&G2)>>>24)+((this._endIndexes[t]&G2)>>>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]=`[${K2[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&q2,endLineNumber:this._endIndexes[t]&q2,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 J2(e,s,n);for(let e=0;e<i;e++)t[e].isCollapsed&&o.setCollapsed(e,!0),o.setSource(e,t[e].source);return o}static sanitizeAndMerge(t,i,e){e=null!=e?e:Number.MAX_VALUE;const s=(t,i)=>Array.isArray(t)?e=>e<i?t[e]:void 0:e=>e<i?t.toFoldRange(e):void 0,n=s(t,t.length),r=s(i,i.length);let o=0,h=0,c=n(0),l=r(0);const u=[];let a,d=0;const f=[];for(;c||l;){let t;if(l&&(!c||c.startLineNumber>=l.startLineNumber))c&&c.startLineNumber===l.startLineNumber?(1===l.source?t=l:(t=c,t.isCollapsed=l.isCollapsed&&c.endLineNumber===l.endLineNumber,t.source=0),c=n(++o)):(t=l,l.isCollapsed&&0===l.source&&(t.source=2)),l=r(++h);else{let i=h,e=l;for(;;){if(!e||e.startLineNumber>c.endLineNumber){t=c;break}if(1===e.source&&e.endLineNumber>c.endLineNumber)break;e=r(++i)}c=n(++o)}if(t){for(;a&&a.endLineNumber<t.startLineNumber;)a=u.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!a||a.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,a&&u.push(a),a=t)}}return f}}class Q2{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 Y2{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ie,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new J2(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(J2.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=J2.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(J2.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=J2.sanitizeAndMerge(this._regions,s,n);this.updatePost(J2.fromFoldRanges(r))}_getLinesChecksum(t,i){return Sd(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 X2(t,i,e){const s=[];for(const n of e){const e=t.getRegionAtLine(n);if(e){const n=!e.isCollapsed;if(s.push(e),i>1){const r=t.getRegionsInside(e,((t,e)=>t.isCollapsed!==n&&e<i));s.push(...r)}}}t.toggleCollapseState(s)}function t4(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 i4(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 e4(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 s4(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 n4(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 r4{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ie,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!==hD(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 ps(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!==o4(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=o4(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 o4(t,i){const e=Mf(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class h4{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=l4){const n=t.getOptions().tabSize,r=new c4(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=GS(s,n);let l,u=h[h.length-1];if(-1!==c){if(o&&(l=s.match(o))){if(!l[1]){h.push({indent:-2,endAbove:e,line:e});continue}{let t=h.length-1;for(;t>0&&-2!==h[t].indent;)t--;if(t>0){h.length=t+1,u=h[t],r.insertFirst(e,u.line,c),u.line=e,u.indent=c,u.endAbove=e;continue}}}if(u.indent>c){do{h.pop(),u=h[h.length-1]}while(u.indent>c);const t=u.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}u.indent===c?u.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(u.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class c4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>q2||i>q2)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 J2(t,i)}{this._foldingRangesLimit.update(this._length,i);let e=0,s=this._indentOccurrences.length;for(let t=0;t<this._indentOccurrences.length;t++){const n=this._indentOccurrences[t];if(n){if(n+e>i){s=t;break}e+=n}}const n=t.getOptions().tabSize,r=new Uint32Array(i),o=new Uint32Array(i);for(let h=this._length-1,c=0;h>=0;h--){const l=this._startIndexes[h],u=GS(t.getLineContent(l),n);(u<s||u===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new J2(r,o)}}}const l4={limit:5e3,update:()=>{}},u4=Om("editor.foldBackground",{light:Mb(Vv,.3),dark:Mb(Vv,.3),hcDark:null,hcLight:null},J(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);Om("editorGutter.foldingControlForeground",{dark:Rm,light:Rm,hcDark:Rm,hcLight:Rm},J(0,"Color of the folding control in the editor gutter."));const a4=GW("folding-expanded",ys.chevronDown,J(0,"Icon for expanded ranges in the editor glyph margin.")),d4=GW("folding-collapsed",ys.chevronRight,J(0,"Icon for collapsed ranges in the editor glyph margin.")),f4=GW("folding-manual-collapsed",d4,J(0,"Icon for manually collapsed ranges in the editor glyph margin.")),g4=GW("folding-manual-expanded",a4,J(0,"Icon for manually expanded ranges in the editor glyph margin.")),p4={color:vk(u4),position:ef.Inline};class m4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?m4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?m4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:m4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:m4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?m4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:m4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?m4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:m4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?m4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:m4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?m4.MANUALLY_EXPANDED_VISUAL_DECORATION:m4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}m4.COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(d4)}),m4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(d4)}),m4.MANUALLY_COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(f4)}),m4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(f4)}),m4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),m4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0}),m4.EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+eo.asClassName(a4)}),m4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(a4)}),m4.MANUALLY_EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+eo.asClassName(g4)}),m4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(g4)}),m4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),m4.HIDDEN_RANGE_DECORATION=$M.register({description:"folding-hidden-range-decoration",stickiness:1});const v4={};class w4{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,v4,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 b4(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 b4{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>q2||i>q2)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 J2(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 J2(s,n,r)}}}var y4,k4=function(t,i){return function(e,s){i(e,s,t)}};const C4=new Zo("foldingEnabled",!1);let S4=y4=class extends Hi{static get(t){return t.getContribution(y4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=y4._foldingRangeSelector)||void 0===e?void 0:e.call(y4,n,i))&&void 0!==s?s:n}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Vi),this.editor=t,this._foldingLimitReporter=new x4(t);const o=this.editor.getOptions();this._isEnabled=o.get(43),this._useFoldingProviders="indentation"!==o.get(44),this._unfoldOnClickAfterEndOfLine=o.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(46),this.updateDebounceInfo=n.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new m4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=C4.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(47)&&this.onModelChanged(),t.hasChanged(109)||t.hasChanged(45)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(109),this.foldingDecorationProvider.showFoldingHighlights=t.get(45),this.triggerFoldingModelChanged()}t.hasChanged(44)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(44),this.onFoldingStrategyChanged()),t.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),t.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))}))),this.onModelChanged()}saveViewState(){const t=this.editor.getModel();if(!t||!this._isEnabled||t.isTooLargeForTokenization())return{};if(this.foldingModel){const i=this.foldingModel.getMemento(),e=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:i,lineCount:t.getLineCount(),provider:e,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(t){const i=this.editor.getModel();if(i&&this._isEnabled&&!i.isTooLargeForTokenization()&&this.hiddenRangeModel&&t&&(this._currentModelHasFoldedImports=!!t.foldedImports,t.collapsedRegions&&t.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(t.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const t=this.editor.getModel();this._isEnabled&&t&&!t.isTooLargeForTokenization()&&(this._currentModelHasFoldedImports=!1,this.foldingModel=new Y2(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new r4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new ku(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new Mu((()=>this.revealCursor()),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelContent((t=>this.onDidChangeModelContent(t)))),this.localToDispose.add(this.editor.onDidChangeCursorPosition((()=>this.onCursorPositionChanged()))),this.localToDispose.add(this.editor.onMouseDown((t=>this.onEditorMouseDown(t)))),this.localToDispose.add(this.editor.onMouseUp((t=>this.onEditorMouseUp(t)))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),null===(t=this.updateScheduler)||void 0===t||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,null===(i=this.rangeProvider)||void 0===i||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var t;null===(t=this.rangeProvider)||void 0===t||t.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(t){if(this.rangeProvider)return this.rangeProvider;const i=new h4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=y4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new w4(t,e,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,i))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(t){var i;null===(i=this.hiddenRangeModel)||void 0===i||i.notifyChangeModelContent(t),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger((()=>{const t=this.foldingModel;if(!t)return null;const i=new Zi,e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=wu((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Is.Imports.value,!0);t&&(s=tU.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<4)return;e=!0;break;case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!t.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){const t=this.editor.getModel();if(t&&i.startColumn===t.getLineMaxColumn(i.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:i.startLineNumber,iconClicked:e}}onEditorMouseUp(t){const i=this.foldingModel;if(!i||!this.mouseDownInfo||!t.target)return;const e=this.mouseDownInfo.lineNumber,s=this.mouseDownInfo.iconClicked,n=t.target.range;if(!n||n.startLineNumber!==e)return;if(s){if(4!==t.target.type)return}else{const t=this.editor.getModel();if(!t||n.startColumn!==t.getLineMaxColumn(e))return}const r=i.getRegionAtLine(e);if(r&&r.startLineNumber===e){const n=r.isCollapsed;if(s||n){let s=[];if(t.event.altKey){const t=i.getRegionsInside(null,(t=>!t.containedBy(r)&&!r.containedBy(t)));for(const i of t)i.isCollapsed&&s.push(i);0===s.length&&(s=t)}else{const e=t.event.middleButton||t.event.shiftKey;if(e)for(const t of i.getRegionsInside(r))t.isCollapsed===n&&s.push(t);!n&&e&&0!==s.length||s.push(r)}i.toggleCollapseState(s),this.reveal({lineNumber:e,column:1})}}}reveal(t){this.editor.revealPositionInCenterIfOutsideViewport(t,0)}};S4.ID="editor.contrib.folding",S4=y4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([k4(1,Jo),k4(2,ud),k4(3,vO),k4(4,FF),k4(5,Wg)],S4);class x4{constructor(t){this.editor=t,this._onDidChange=new ie,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class D4 extends tu{runEditorCommand(t,i,e){const s=t.get(ud),n=S4.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 E4(t){if(!I(t)){if(!O(t))return!1;const i=t;if(!I(i.levels)&&!T(i.levels))return!1;if(!I(i.direction)&&!L(i.direction))return!1;if(!(I(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(T)))return!1}return!0}class A4 extends D4{getFoldingLevel(){return parseInt(this.id.substr(A4.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))}}A4.ID_PREFIX="editor.foldLevel",A4.ID=t=>A4.ID_PREFIX+t,hu(S4.ID,S4,0),ru(class extends D4{constructor(){super({id:"editor.unfold",label:J(0,"Unfold"),alias:"Unfold",precondition:C4,kbOpts:{kbExpr:gS.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:E4,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?i4(i,!1,n,r):t4(i,!1,n,r)}}),ru(class extends D4{constructor(){super({id:"editor.unfoldRecursively",label:J(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2142),weight:100}})}invoke(t,i,e,s){t4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.fold",label:J(0,"Fold"),alias:"Fold",precondition:C4,kbOpts:{kbExpr:gS.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:E4,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?i4(i,!0,r||1,n):t4(i,!0,r||1,n)}}),ru(class extends D4{constructor(){super({id:"editor.foldRecursively",label:J(0,"Fold Recursively"),alias:"Fold Recursively",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);t4(i,!0,Number.MAX_VALUE,s)}}),ru(class extends D4{constructor(){super({id:"editor.foldAll",label:J(0,"Fold All"),alias:"Fold All",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2069),weight:100}})}invoke(t,i,e){t4(i,!0)}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAll",label:J(0,"Unfold All"),alias:"Unfold All",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2088),weight:100}})}invoke(t,i,e){t4(i,!1)}}),ru(class extends D4{constructor(){super({id:"editor.foldAllBlockComments",label:J(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&s4(i,new RegExp("^\\s*"+Rn(s.blockCommentStartToken)),!0)}}}),ru(class extends D4{constructor(){super({id:"editor.foldAllMarkerRegions",label:J(0,"Fold All Regions"),alias:"Fold All Regions",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&s4(i,new RegExp(s.markers.start),!0)}}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:J(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&s4(i,new RegExp(s.markers.start),!1)}}}),ru(class extends D4{constructor(){super({id:"editor.foldAllExcept",label:J(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2136),weight:100}})}invoke(t,i,e){e4(i,!0,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAllExcept",label:J(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2134),weight:100}})}invoke(t,i,e){e4(i,!1,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.toggleFold",label:J(0,"Toggle Fold"),alias:"Toggle Fold",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2090),weight:100}})}invoke(t,i,e){X2(i,1,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.gotoParentFold",label:J(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.gotoPreviousFold",label:J(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.gotoNextFold",label:J(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:J(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(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=J2.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(J2.fromFoldRanges(t))}}}}),ru(class extends D4{constructor(){super({id:"editor.removeManualFoldingRanges",label:J(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(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++)M4=new A4({id:A4.ID(t),label:J(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2048|21+t),weight:100}}),lu.INSTANCE.registerEditorAction(M4);var M4;ao.registerCommand("_executeFoldingRangeProvider",(function(t,...i){return 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())}))}(this,void 0,void 0,(function*(){const[e]=i;if(!(e instanceof ss))throw Ti();const s=t.get(Wg),n=t.get(Xr).getModel(e);if(!n)throw Ti();const r=t.get(Ta);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(ud),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new h4(n,o,c);let u=l;if("indentation"!==h){const t=S4.getFoldingRangeProviders(s,n);t.length&&(u=new w4(n,t,(()=>{}),c,l))}const a=yield u.compute(ue.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?Is.fromValue(i):void 0})}return d}finally{u.dispose()}}))})),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomIn",label:J(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Vr.setZoomLevel(Vr.getZoomLevel()+1)}}),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomOut",label:J(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Vr.setZoomLevel(Vr.getZoomLevel()-1)}}),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomReset",label:J(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Vr.setZoomLevel(0)}});var L4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},O4=function(t,i){return function(e,s){i(e,s,t)}},F4=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 T4=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(56)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56))return;if(!this._editor.hasModel())return;const t=this._editor.getModel(),[i]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(t);if(!i||!i.autoFormatTriggerCharacters)return;const e=new zd;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 de,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()}));CK(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||a(t)&&(aK.execute(this._editor,t,!0),pK(t))})).finally((()=>{n.dispose()}))}};T4.ID="editor.contrib.autoFormat",T4=L4([O4(1,Wg),O4(2,MN)],T4);let R4=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(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste((({range:t})=>this._trigger(t))))}_trigger(t){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(wK,this.editor,t,2,sR.None,ue.None).catch(Ei))}};R4.ID="editor.contrib.formatOnPaste",R4=L4([O4(1,Wg),O4(2,Zr)],R4),hu(T4.ID,T4,2),hu(R4.ID,R4,2),ru(class extends tu{constructor(){super({id:"editor.action.formatDocument",label:J(0,"Format Document"),alias:"Format Document",precondition:Lo.and(gS.notInCompositeEditor,gS.writable,gS.hasDocumentFormattingProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return F4(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(Zr),s=t.get(nR);yield s.showWhile(e.invokeFunction(yK,i,1,sR.None,ue.None),250)}}))}}),ru(class extends tu{constructor(){super({id:"editor.action.formatSelection",label:J(0,"Format Selection"),alias:"Format Selection",precondition:Lo.and(gS.writable,gS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2084),weight:100},contextMenuOpts:{when:gS.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return F4(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Zr),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new ps(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(nR);yield r.showWhile(e.invokeFunction(wK,i,n,1,sR.None,ue.None),250)}))}}),ao.registerCommand("editor.action.format",(t=>F4(void 0,void 0,void 0,(function*(){const i=t.get(Yr).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(uo);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var _4=function(t,i){return function(e,s){i(e,s,t)}};class I4{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 P4 extends I4{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class N4 extends I4{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class B4 extends I4{static create(t,i,s){const n=new de(s),r=new B4(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=I4.findId(`provider_${e}`,r),h=new N4(o,r,null!==(s=t.displayName)&&void 0!==s?s:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,n.token)).then((t=>{for(const i of t||[])B4._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{I4.empty(t)?t.remove():r._groups.set(o,t)}))})),c=t.onDidChange((()=>{e(t.ordered(i),o)||n.cancel()}));return Promise.all(h).then((()=>n.token.isCancellationRequested&&!s.isCancellationRequested?B4.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=I4.findId(t,i),s=new P4(e,i,t);if(t.children)for(const i of t.children)B4._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=Rt.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 P4?t.push(i.symbol):t.push(...Rt.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>ps.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return B4._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>gs.compare(ps.getStartPosition(t.range),ps.getStartPosition(i.range))||gs.compare(ps.getEndPosition(i.range),ps.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&&B4._flattenDocumentSymbols(t,s.children,s.name)}}const $4=Qr("IOutlineModelService");let j4=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new lg(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 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())}))}(this,void 0,void 0,(function*(){const s=this._languageFeaturesService.documentSymbolProvider,n=s.ordered(t);let r=this._cache.get(t.id);if(!r||r.versionId!==t.getVersionId()||!e(r.provider,n)){const i=new de;r={versionId:t.getVersionId(),provider:n,promiseCnt:0,source:i,promise:B4.create(s,t,i.token),model:void 0},this._cache.set(t.id,r);const e=Date.now();r.promise.then((i=>{r.model=i,this._debounceInformation.update(t,Date.now()-e)})).catch((()=>{this._cache.delete(t.id)}))}if(r.model)return r.model;r.promiseCnt+=1;const o=i.onCancellationRequested((()=>{0==--r.promiseCnt&&(r.source.cancel(),this._cache.delete(t.id))}));try{return yield r.promise}finally{o.dispose()}}))}};j4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([_4(0,Wg),_4(1,FF),_4(2,Xr)],j4),Wa($4,j4,1);ao.registerCommand("_executeDocumentSymbolProvider",(function(t,...i){return 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())}))}(this,void 0,void 0,(function*(){const[e]=i;B(ss.isUri(e));const s=t.get($4),n=t.get(to),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,ue.None)).getTopLevelSymbols()}finally{r.dispose()}}))}));class W4 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=W4.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=W4.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=W4.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=W4.suppressSuggestions.bindTo(this.contextKeyService),this._register(jH((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t),s=!!(null==e?void 0:e.inlineCompletion)&&void 0!==(null==e?void 0:e.ghostText)&&!(null==e?void 0:e.ghostText.isEmpty());this.inlineCompletionVisible.set(s),(null==e?void 0:e.ghostText)&&(null==e?void 0:e.inlineCompletion)&&this.suppressSuggestions.set(e.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(jH((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=$n(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=vy.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}W4.inlineSuggestionVisible=new Zo("inlineSuggestionVisible",!1,J(0,"Whether an inline suggestion is visible")),W4.inlineSuggestionHasIndentation=new Zo("inlineSuggestionHasIndentation",!1,J(0,"Whether the inline suggestion starts with whitespace")),W4.inlineSuggestionHasIndentationLessThanTabSize=new Zo("inlineSuggestionHasIndentationLessThanTabSize",!0,J(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),W4.suppressSuggestions=new Zo("inlineSuggestionSuppressSuggestions",void 0,J(0,"Whether suggestions should be suppressed for the current suggestion"));class V4{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 H4=[];class z4{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 ps(t,this.startColumn,t,this.endColumnExclusive)}equals(t){return this.startColumn===t.startColumn&&this.endColumnExclusive===t.endColumnExclusive}}function U4(t,i){return new gs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function K4(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new gs(i,e)}class q4{constructor(t,i){this.lineNumber=t,this.parts=i}equals(t){return this.lineNumber===t.lineNumber&&this.parts.length===t.parts.length&&this.parts.every(((i,e)=>i.equals(t.parts[e])))}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new V4(t),s=i.map((t=>{const i=ps.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 G4{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}equals(t){return this.column===t.column&&this.lines.length===t.lines.length&&this.lines.every(((i,e)=>i===t.lines[e]))}}class Z4{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new G4(this.columnRange.endColumnExclusive,this.newLines,!1)]}renderForScreenReader(t){return this.newLines.join("\n")}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every((t=>0===t.lines.length))}equals(t){return this.lineNumber===t.lineNumber&&this.columnRange.equals(t.columnRange)&&this.newLines.length===t.newLines.length&&this.newLines.every(((i,e)=>i===t.newLines[e]))&&this.additionalReservedLineCount===t.additionalReservedLineCount}}function J4(t,i){return t===i||!(!t||!i)&&(t instanceof q4&&i instanceof q4||t instanceof Z4&&i instanceof Z4)&&t.equals(i)}const Q4="ghost-text";let Y4=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=OH(this,!1),this.currentTextModel=KH(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=IH(this,(t=>{if(this.isDisposed.read(t))return;const i=this.currentTextModel.read(t);if(i!==this.model.targetTextModel.read(t))return;const e=this.model.ghostText.read(t);if(!e)return;const s=e instanceof Z4?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 op(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 op(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,l=0;for(const t of e.parts){let i=t.lines;void 0===c?(n.push({column:t.column,text:i[0],preview:t.preview}),i=i.slice(1)):o([h.substring(l,t.column-1)],void 0),i.length>0&&(o(i,Q4),void 0===c&&t.column<=h.length&&(c=t.column)),l=t.column-1}void 0!==c&&o([h.substring(l)],void 0);const u=void 0!==c?new z4(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:u,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=IH(this,(t=>{const i=this.uiState.read(t);if(!i)return[];const e=[];i.replacedRange&&e.push({range:i.replacedRange.toRange(i.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),i.hiddenRange&&e.push({range:i.hiddenRange.toRange(i.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const t of i.inlineTexts)e.push({range:ps.fromPositions(new gs(i.lineNumber,t.column)),options:{description:Q4,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:sf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new X4(this.editor,this.languageService.languageIdCodec,IH((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($H({debugName:()=>`Apply decorations from ${i.debugName}`},(t=>{const e=i.read(t);s.set(e)}))),e.add({dispose:()=>{s.clear()}}),e}(this.editor,this.decorations))}ownsViewZone(t){return this.additionalLinesWidget.viewZoneId===t}};Y4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Ba)],Y4);class X4 extends Hi{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=GH("editorOptionChanged",Ji.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(33)||t.hasChanged(116)||t.hasChanged(98)||t.hasChanged(93)||t.hasChanged(51)||t.hasChanged(50)||t.hasChanged(66)))),this._register(jH((t=>{const i=this.lines.read(t);this.editorOptionsChanged.read(t),i?this.updateLines(i.lineNumber,i.additionalLines,i.minReservedLineCount):this.clear()})))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones((t=>{this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0)}))}updateLines(t,i,e){const s=this.editor.getModel();if(!s)return;const{tabSize:n}=s.getOptions();this.editor.changeViewZones((s=>{this._viewZoneId&&(s.removeZone(this._viewZoneId),this._viewZoneId=void 0);const r=Math.max(i.length,e);if(r>0){const e=document.createElement("div");!function(t,i,e,s,n){const r=s.get(33),o=s.get(116),h=s.get(93),c=s.get(51),l=s.get(50),u=s.get(66),a=new wa(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*u)),a.appendString('px;width:1000000px;">');const f=ur(d),g=cr(d),p=np.createEmpty(d,n);mp(new dp(l.isMonospace&&!r,l.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,o,"none",h,c!==oi.OFF,null),a),a.appendString("</div>")}a.appendString("</div>"),$r(t,l);const d=a.build(),f=t5?t5.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 t5=Ku("editorGhostText",{createHTML:t=>t});class i5{constructor(t){this.lines=t,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(t){return this.lines[t-1].getLineContent().length}}class e5{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=e5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(e5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(e5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(e5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(e5.isVariableCharacter(s)||e5.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===e5._table[s]&&!e5.isDigitCharacter(s)&&!e5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}e5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class s5{constructor(){this._children=[]}appendChild(t){return t instanceof n5&&this._children[this._children.length-1]instanceof n5?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 d5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class n5 extends s5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new n5(this.value)}}class r5 extends s5{}class o5 extends r5{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 h5?this._children[0]:void 0}clone(){const t=new o5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class h5 extends s5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof n5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new h5;return this.options.forEach(t.appendChild,t),t}}class c5 extends s5{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 l5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof l5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new c5;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 l5 extends s5{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 l5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class u5 extends r5{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 n5(i)],!0)}clone(){const t=new u5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function a5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class d5 extends s5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof o5&&(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 a5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof o5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof u5&&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 d5;return this._children=this.children.map((t=>t.clone())),t}walk(t){a5(this.children,t)}}class f5{constructor(){this._scanner=new e5,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 d5;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 o5&&(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 o5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof o5&&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 o5(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 n5(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 o5(Number(i)):new u5(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 o5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new n5("${"+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 h5;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 n5(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 u5(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 n5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new c5;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 n5(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 l5(Number(s))),!0;if(this._accept(4))return t.appendChild(new l5(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 l5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new l5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new l5(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 l5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new l5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new n5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}var g5=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 p5(t,i,e,s,n=ue.None,r){return g5(this,void 0,void 0,(function*(){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new ps(t.lineNumber,e.startColumn,t.lineNumber,s):ps.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=new ag;for(const t of h)t.groupId&&c.add(t.groupId,t);function l(t){if(!t.yieldsToGroupIds)return[];const i=[];for(const e of t.yieldsToGroupIds||[]){const t=c.get(e);for(const e of t)i.push(e)}return i}const u=new Map,a=new Set;function d(t,i){if(i=[...i,t],a.has(t))return i;a.add(t);try{const e=l(t);for(const t of e){const e=d(t,i);if(e)return e}}finally{a.delete(t)}}function f(t){const r=u.get(t);if(r)return r;const o=d(t,[]);o&&Ai(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${o.map((t=>t.toString?t.toString():""+t)).join(" -> ")}`));const h=new Fu;return u.set(t,h.p),(()=>g5(this,void 0,void 0,(function*(){if(!o){const i=l(t);for(const t of i){const i=yield f(t);if(i&&i.items.length>0)return}}try{return yield t.provideInlineCompletions(e,i,s,n)}catch(t){return void Ai(t)}})))().then((t=>h.complete(t)),(t=>h.error(t))),h.p}const g=yield Promise.all(h.map((t=>g5(this,void 0,void 0,(function*(){return{provider:t,completions:yield f(t)}}))))),p=new Map,m=[];for(const t of g){const i=t.completions;if(!i)continue;const s=new v5(i,t.provider);m.push(s);for(const t of i.items){const i=w5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new m5(Array.from(p.values()),new Set(p.keys()),m)}))}class m5{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 v5{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 w5{static from(t,i,e,s,n){let r,o,h=t.range?ps.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=b5(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new ps(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=b5(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new ps(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new f5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof n5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else lh();return new w5(r,t.command,h,r,o,t.additionalTextEdits||H4,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 w5(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 b5(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 FD,s=new ZD(e,(t=>i.getLanguageConfiguration(t))),n=eE(new UD(new i5([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=mD(e,i.openingBracket.length),i.child&&(t(i.child,e),e=mD(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=mD(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,mD(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=mD(e,s.length)}(n,0),r}(o,s);return h}class y5{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=Qn(s,this.text),r=U4(this.range.getStartPosition(),K4(s.substring(0,n))),o=this.text.substring(n),h=ps.fromPositions(r,this.range.getEndPosition());return new y5(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=jn(r).length;if(n.range.startColumn-1<=o){const t=jn(n.text).length,i=r.substring(n.range.startColumn-1,o),[e,s]=[n.range.getStartPosition(),n.range.getEndPosition()],h=e.column+i.length<=s.column?e.delta(0,i.length):s,c=ps.fromPositions(h,s),l=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new y5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==k5?void 0:k5.originalValue)===t&&(null==k5?void 0:k5.newValue)===i)return null==k5?void 0:k5.changes;{let e=S5(t,i,!0);if(e){const s=C5(e);if(s>0){const n=S5(t,i,!1);n&&C5(n)<s&&(e=n)}}return k5={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const l=n.range.startLineNumber,u=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=Bn(h);u.push(new G4(s,t,!1))}if(c.length>0){const t=Bn(c);u.push(new G4(s,t,!0))}}return new q4(l,u)}}let k5;function C5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function S5(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 Pd({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var x5=function(t,i){return function(e,s){i(e,s,t)}};let D5=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=TH("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TH("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new E5(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 de,l=(()=>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())}))}(this,void 0,void 0,(function*(){var s;if((h||i.triggerKind===Cs.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,l=yield p5(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const u=new Date;this._debounceValue.update(this.textModel,u.getTime()-n.getTime());const a=new M5(l,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!l.has(i)&&a.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),DH((t=>{o.set(a,t)})),!0})))(),u=new A5(r,c,l);return this._updateOperation.value=u,l}clear(t){this._updateOperation.clear(),this.inlineCompletions.set(void 0,t),this.suggestWidgetInlineCompletions.set(void 0,t)}clearSuggestWidgetInlineCompletions(t){var i;(null===(i=this._updateOperation.value)||void 0===i?void 0:i.request.context.selectedSuggestionInfo)&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,t)}cancelUpdate(){this._updateOperation.clear()}};D5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([x5(3,Wg),x5(4,ud)],D5);class E5{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===Cs.Automatic||this.context.triggerKind===Cs.Explicit)&&this.versionId===t.versionId;var i,e}}class A5{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class M5{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=IH(this,(t=>{this.versionId.read(t);let i=!1;for(const t of this._inlineCompletions)i=i||t._updateRange(this.textModel);return i&&this._rangeVersionIdValue++,this._rangeVersionIdValue}));const n=e.deltaDecorations([],t.completions.map((t=>({range:t.range,options:{description:"inline-completion-tracking-range"}}))));this._inlineCompletions=t.completions.map(((t,i)=>new L5(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){setTimeout((()=>{this.textModel.isDisposed()||this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[])}),0),this.inlineCompletionProviderResult.dispose();for(const t of this._prependedInlineCompletionItems)t.source.removeRef()}}prepend(t,i,e){e&&t.source.addRef();const s=this.textModel.deltaDecorations([],[{range:i,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new L5(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class L5{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 y5(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),l=n.substring(0,o),u=n.substring(o);const a=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=a&&(l=l.trimStart(),0===l.length&&(u=u.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(l)&&!!JR(u,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 y5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return O5(this._getUpdatedRange(t)).isBefore(O5(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 O5(t){return t.startLineNumber===t.endLineNumber?new gs(1,1+t.endColumn-t.startColumn):new gs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}var F5=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 T5={Visible:G1,HasFocusedSuggestion:new Zo("suggestWidgetHasFocusedSuggestion",!1,J(0,"Whether any suggestion is focused")),DetailsVisible:new Zo("suggestWidgetDetailsVisible",!1,J(0,"Whether suggestion details are visible")),MultipleSuggestions:new Zo("suggestWidgetMultipleSuggestions",!1,J(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Zo("suggestionMakesTextEdit",!0,J(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Zo("acceptSuggestionOnEnter",!0,J(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Zo("suggestionHasInsertAndReplaceRange",!1,J(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Zo("suggestionInsertMode",void 0,{type:"string",description:J(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Zo("suggestionCanResolve",!1,J(0,"Whether the current suggestion supports to resolve further details"))},R5=new bh("suggestWidgetStatusBar");class _5{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=L_.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,ps.isIRange(i.range)?(this.editStart=new gs(i.range.startLineNumber,i.range.startColumn),this.editInsertEnd=new gs(i.range.endLineNumber,i.range.endColumn),this.editReplaceEnd=new gs(i.range.endLineNumber,i.range.endColumn),this.isInvalid=this.isInvalid||ps.spansMultipleLines(i.range)||i.range.startLineNumber!==t.lineNumber):(this.editStart=new gs(i.range.insert.startLineNumber,i.range.insert.startColumn),this.editInsertEnd=new gs(i.range.insert.endLineNumber,i.range.insert.endColumn),this.editReplaceEnd=new gs(i.range.replace.endLineNumber,i.range.replace.endColumn),this.isInvalid=this.isInvalid||ps.spansMultipleLines(i.range.insert)||ps.spansMultipleLines(i.range.replace)||i.range.insert.startLineNumber!==t.lineNumber||i.range.replace.startLineNumber!==t.lineNumber||i.range.insert.startColumn!==i.range.replace.startColumn),"function"!=typeof s.resolveCompletionItem&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return void 0!==this._resolveDuration}get resolveDuration(){return void 0!==this._resolveDuration?this._resolveDuration:-1}resolve(t){return F5(this,void 0,void 0,(function*(){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._resolveDuration=void 0})),e=new Zi(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._resolveDuration=e.elapsed()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._resolveDuration=void 0)})).finally((()=>{i.dispose()}))}return this._resolveCache}))}}class I5{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}}I5.default=new I5;class P5{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function N5(t,i,e,s=I5.default,n={triggerKind:0},r=ue.None){return F5(this,void 0,void 0,(function*(){const o=new Zi;e=e.clone();const h=i.getWordAtPosition(e),c=h?new ps(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):ps.fromPositions(e),l={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},u=[],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=l),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=f5.guessNeedsClipboard(n.insertText)),u.push(new _5(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=(()=>F5(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>F5(this,void 0,void 0,(function*(){if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>u.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Zi,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 P5(u.sort($5.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function B5(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 $5=new Map;$5.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 B5(t,i)})),$5.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 B5(t,i)})),$5.set(1,B5),ao.registerCommand("_executeCompletionItemProvider",((t,...i)=>F5(void 0,void 0,void 0,(function*(){const[e,s,n,r]=i;B(ss.isUri(e)),B(gs.isIPosition(s)),B("string"==typeof n||!n),B("number"==typeof r||!r);const{completionProvider:o}=t.get(Wg),h=yield t.get(to).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield N5(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(ue.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 j5{static isAllOff(t){return"off"===t.other&&"off"===t.comments&&"off"===t.strings}static isAllOn(t){return"on"===t.other&&"on"===t.comments&&"on"===t.strings}static valueFor(t,i){switch(i){case 1:return t.comments;case 2:return t.strings;default:return t.other}}}function W5(t,i=dt){return function(t,i=dt){return!!i&&EE(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 V5{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 H5{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=jn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof n5&&(s=jn(Bn(i.value).pop())),!0)));const n=Qn(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 z5{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Ge(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Ge(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===qe(this._model.uri.fsPath)?"":this._labelService.getUriLabel(RE(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 U5{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=>!Ln(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let K5=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}};K5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,ud)],K5);class q5{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 q5.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return q5.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return q5.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return q5.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)}}}q5.dayNames=[J(0,"Sunday"),J(0,"Monday"),J(0,"Tuesday"),J(0,"Wednesday"),J(0,"Thursday"),J(0,"Friday"),J(0,"Saturday")],q5.dayNamesShort=[J(0,"Sun"),J(0,"Mon"),J(0,"Tue"),J(0,"Wed"),J(0,"Thu"),J(0,"Fri"),J(0,"Sat")],q5.monthNames=[J(0,"January"),J(0,"February"),J(0,"March"),J(0,"April"),J(0,"May"),J(0,"June"),J(0,"July"),J(0,"August"),J(0,"September"),J(0,"October"),J(0,"November"),J(0,"December")],q5.monthNamesShort=[J(0,"Jan"),J(0,"Feb"),J(0,"Mar"),J(0,"Apr"),J(0,"May"),J(0,"Jun"),J(0,"Jul"),J(0,"Aug"),J(0,"Sep"),J(0,"Oct"),J(0,"Nov"),J(0,"Dec")];class G5{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:Ge(e)}:fR: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)||dR(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&ss.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(dR(t))return Ge(t.uri.path);let i=Ge(t.configPath.path);return i.endsWith(pR)&&(i=i.substr(0,i.length-pR.length-1)),i}_resoveWorkspacePath(t){if(dR(t))return W5(t.uri.fsPath);const i=Ge(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?W5(e):"/"}}class Z5{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?d0():void 0}}var J5;class Q5{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,o5.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=ps.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?Q5._decor.inactiveFinal:Q5._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(OT.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 ms(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?Q5._decor.activeFinal:Q5._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?Q5._decor.activeFinal:Q5._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?Q5._decor.inactiveFinal:Q5._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof o5){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 h5,!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=ps.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,Q5._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,o5.compareByIndex)}))}}Q5._decor={active:$M.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:$M.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:$M.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:$M.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const Y5={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let X5=J5=class{static adjustWhitespace(t,i,e,s,n){const r=jn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof n5)||i.parent instanceof h5)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 n5(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=ms.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(t,i,e,s,n,r,o,h,c){const l=[],u=[];if(!t.hasModel())return{edits:l,snippets:u};const a=t.getModel(),d=t.invokeWithinContext((t=>t.get(aR))),f=t.invokeWithinContext((t=>new z5(t.get(iR),a))),g=()=>o,p=a.getValueInRange(J5.adjustSelection(a,t.getSelection(),e,0)),m=a.getValueInRange(J5.adjustSelection(a,t.getSelection(),0,s)),v=a.getLineFirstNonWhitespaceColumn(t.getSelection().positionLineNumber),w=t.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>ps.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:o,idx:b}of w){let y=J5.adjustSelection(a,o,e,0),k=J5.adjustSelection(a,o,0,s);p!==a.getValueInRange(y)&&(y=o),m!==a.getValueInRange(k)&&(k=o);const C=o.setStartPosition(y.startLineNumber,y.startColumn).setEndPosition(k.endLineNumber,k.endColumn),S=(new f5).parse(i,!0,n),x=C.getStartPosition(),D=J5.adjustWhitespace(a,x,r||b>0&&v!==a.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new V5([f,new U5(g,b,w.length,"spread"===t.getOption(78)),new H5(a,o,b,h),new K5(a,o,c),new q5,new G5(d),new Z5])),l[b]=OT.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,u[b]=new Q5(t,S,D)}return{edits:l,snippets:u}}static createEditsAndSnippetsFromEdits(t,i,e,s,n,r,o){if(!t.hasModel()||0===i.length)return{edits:[],snippets:[]};const h=[],c=t.getModel(),l=new f5,u=new d5,a=new V5([t.invokeWithinContext((t=>new z5(t.get(iR),c))),new U5((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new H5(c,t.getSelection(),0,r),new K5(c,t.getSelection(),o),new q5,new G5(t.invokeWithinContext((t=>t.get(aR)))),new Z5]);i=i.sort(((t,i)=>ps.compareRangesUsingStarts(t.range,i.range)));let d=0;for(let t=0;t<i.length;t++){const{range:e,template:s}=i[t];if(t>0){const s=ps.fromPositions(i[t-1].range.getEndPosition(),e.getStartPosition()),n=new n5(c.getValueInRange(s));u.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,u);J5.adjustWhitespace(c,e.getStartPosition(),!0,u,new Set(n)),u.resolveVariables(a);const r=u.toString(),o=r.slice(d);d=r.length;const f=OT.replace(e,o);f.identifier={major:t,minor:0},f._isTracked=!0,h.push(f)}return l.ensureFinalTabstop(u,e,!0),{edits:h,snippets:[new Q5(t,u,"")]}}constructor(t,i,e=Y5,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:t,snippets:i}="string"==typeof this._template?J5.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):J5.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits("snippet",t,(t=>{const e=t.filter((t=>!!t.identifier));for(let t=0;t<i.length;t++)i[t].initialize(e[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):e.map((t=>ms.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(t,i=Y5){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=J5.createEditsAndSnippetsFromSelections(this._editor,t,i.overwriteBefore,i.overwriteAfter,!0,i.adjustWhitespace,i.clipboardText,i.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",e,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<s.length;t++)s[t].initialize(i[t].textChange);const e=s[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(s);console.assert(0===s.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>ms.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(ps.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(ps.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(ps.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}};X5=J5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,ud)],X5);var t3,i3=function(t,i){return function(e,s){i(e,s,t)}};const e3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let s3=t3=class{static get(t){return t.getContribution(t3.ID)}constructor(t,i,e,s,n){this._editor=t,this._logService=i,this._languageFeaturesService=e,this._languageConfigurationService=n,this._snippetListener=new Vi,this._modelVersionId=-1,this._inSnippet=t3.InSnippetMode.bindTo(s),this._hasNextTabstop=t3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=t3.HasPrevTabstop.bindTo(s)}dispose(){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),null===(t=this._session)||void 0===t||t.dispose(),this._snippetListener.dispose()}insert(t,i){try{this._doInsert(t,void 0===i?e3:Object.assign(Object.assign({},e3),i))}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",t),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(t,i){var e;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(B("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new X5(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(e=this._session)||void 0===e?void 0:e.hasChoice){const t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!gs.equals(this._editor.getPosition(),i))return;const{activeChoice:e}=this._session;if(!e||0===e.choice.options.length)return;const s=t.getValueInRange(e.range),n=Boolean(e.choice.options.find((t=>t.value===s))),r=[];for(let t=0;t<e.choice.options.length;t++){const i=e.choice.options[t];r.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:e.range,filterText:n?`${s}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:J(0,"Go to next placeholder...")}})}return{suggestions:r}}},i=this._editor.getModel();let e,s=!1;this._choiceCompletions={provider:t,enable:()=>{s||(e=this._languageFeaturesService.completionProvider.register({language:i.getLanguageId(),pattern:i.uri.fsPath,scheme:i.uri.scheme,exclusive:!0},t),this._snippetListener.add(e),s=!0)},disable:()=>{null==e||e.dispose(),s=!1}}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((t=>t.isFlush&&this.cancel()))),this._snippetListener.add(this._editor.onDidChangeModel((()=>this.cancel()))),this._snippetListener.add(this._editor.onDidChangeCursorSelection((()=>this._updateState())))}}_updateState(){if(this._session&&this._editor.hasModel()){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:i}=this._session;if(!i||!this._choiceCompletions)return null===(t=this._choiceCompletions)||void 0===t||t.disable(),void(this._currentChoice=void 0);this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask((()=>{!function(t,i){var e;null===(e=t.getContribution("editor.contrib.suggestController"))||void 0===e||e.triggerSuggest((new Set).add(i),void 0,!0)}(this._editor,this._choiceCompletions.provider)})))}finish(){for(;this._inSnippet.get();)this.next()}cancel(t=!1){var i;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,null===(i=this._session)||void 0===i||i.dispose(),this._session=void 0,this._modelVersionId=-1,t&&this._editor.setSelections([this._editor.getSelection()])}prev(){var t;null===(t=this._session)||void 0===t||t.prev(),this._updateState()}next(){var t;null===(t=this._session)||void 0===t||t.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}};s3.ID="snippetController2",s3.InSnippetMode=new Zo("inSnippetMode",!1,J(0,"Whether the editor in current in snippet mode")),s3.HasNextTabstop=new Zo("hasNextTabstop",!1,J(0,"Whether there is a next tab stop when in snippet mode")),s3.HasPrevTabstop=new Zo("hasPrevTabstop",!1,J(0,"Whether there is a previous tab stop when in snippet mode")),s3=t3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([i3(1,Mh),i3(2,Wg),i3(3,Jo),i3(4,ud)],s3),hu(s3.ID,s3,4);const n3=Xl.bindToContribution(s3.get);nu(new n3({id:"jumpToNextSnippetPlaceholder",precondition:Lo.and(s3.InSnippetMode,s3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:2}})),nu(new n3({id:"jumpToPrevSnippetPlaceholder",precondition:Lo.and(s3.InSnippetMode,s3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:1026}})),nu(new n3({id:"leaveSnippet",precondition:s3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:9,secondary:[1033]}})),nu(new n3({id:"acceptSnippet",precondition:s3.InSnippetMode,handler:t=>t.finish()}));var r3,o3=function(t,i){return function(e,s){i(e,s,t)}},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())}))};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(r3||(r3={}));let c3=class extends Hi{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(t,i,e,s,n,r,o,h,c,l,u,a){let d;super(),this.textModel=t,this.selectedSuggestItem=i,this.cursorPosition=e,this.textModelVersionId=s,this._debounceValue=n,this._suggestPreviewEnabled=r,this._suggestPreviewMode=o,this._inlineSuggestMode=h,this._enabled=c,this._instantiationService=l,this._commandService=u,this._languageConfigurationService=a,this._source=this._register(this._instantiationService.createInstance(D5,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=OH(this,!1),this._forceUpdate=JH("forceUpdate"),this._selectedInlineCompletionId=OH(this,void 0),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([r3.Redo,r3.Undo,r3.AcceptWord]),this._fetchInlineCompletions=function(t,i){var e;return new BH(t.owner,t.debugName,i,t.createEmptyChangeSummary,t.handleChange,void 0,null!==(e=t.equalityComparer)&&void 0!==e?e:_H)}({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Cs.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)},((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();DH((i=>{t&&n.request.versionId>t.request.versionId&&this._source.inlineCompletions.set(n.clone(),i),this._source.clearSuggestWidgetInlineCompletions(i)}))}const o=this.cursorPosition.read(t),h={triggerKind:i.inlineCompletionTriggerKind,selectedSuggestionInfo:null==r?void 0:r.toSelectedSuggestionInfo()};return this._source.fetch(o,h,s)})),this._filteredInlineCompletionItems=IH(this,(t=>{const i=this._source.inlineCompletions.read(t);if(!i)return[];const e=this.cursorPosition.read(t),s=i.inlineCompletions.filter((i=>i.isVisible(this.textModel,e,t)));return s})),this.selectedInlineCompletionIndex=IH(this,(t=>{const i=this._selectedInlineCompletionId.read(t),e=this._filteredInlineCompletionItems.read(t),s=void 0===this._selectedInlineCompletionId?-1:e.findIndex((t=>t.semanticId===i));return-1===s?(this._selectedInlineCompletionId.set(void 0,void 0),0):s})),this.selectedInlineCompletion=IH(this,(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=IH(this,(t=>this.lastTriggerKind.read(t)===Cs.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=PH({owner:this,equalityComparer:(t,i)=>t&&i?J4(t.ghostText,i.ghostText)&&t.inlineCompletion===i.inlineCompletion&&t.suggestItem===i.suggestItem:t===i},(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=s.toSingleTextEdit().removeCommonPrefix(e),r=this._computeAugmentedCompletion(n,t);if(!this._suggestPreviewEnabled.read(t)&&!r)return;const o=null!==(i=null==r?void 0:r.edit)&&void 0!==i?i:n,h=r?r.edit.text.length-n.text.length:0,c=this._suggestPreviewMode.read(t),l=this.cursorPosition.read(t),u=o.computeGhostText(e,c,l,h);return{ghostText:null!=u?u:new q4(o.range.endLineNumber,[]),inlineCompletion:null==r?void 0:r.completion,suggestItem:s}}{if(!this._isActive.read(t))return;const i=this.selectedInlineCompletion.read(t);if(!i)return;const s=i.toSingleTextEdit(t),n=this._inlineSuggestMode.read(t),r=this.cursorPosition.read(t),o=s.computeGhostText(e,n,r);return o?{ghostText:o,inlineCompletion:i,suggestItem:void 0}:void 0}})),this.ghostText=PH({owner:this,equalityComparer:J4},(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(YH(this._fetchInlineCompletions)),this._register(jH((t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.inlineCompletion;if((null==n?void 0:n.semanticId)!==(null==d?void 0:d.semanticId)&&(d=n,n)){const t=n.inlineCompletion,s=t.source;null===(e=(i=s.provider).handleItemDidShow)||void 0===e||e.call(i,s.inlineCompletions,t.sourceInlineCompletion,t.insertText)}})))}trigger(t){return h3(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return h3(this,void 0,void 0,(function*(){EH(t,(t=>{this._isActive.set(!0,t),this._forceUpdate.trigger(t,Cs.Explicit)})),yield this._fetchInlineCompletions.get()}))}stop(t){EH(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_computeAugmentedCompletion(t,i){const e=this.textModel,s=this._source.suggestWidgetInlineCompletions.read(i);return function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(s?s.inlineCompletions:[this.selectedInlineCompletion.read(i)].filter(P),(s=>{let n=s.toSingleTextEdit(i);return n=n.removeCommonPrefix(e,ps.fromPositions(n.range.getStartPosition(),t.range.getEndPosition())),n.augments(t)?{edit:n,completion:s}:void 0}))}_deltaSelectedInlineCompletionIndex(t){return h3(this,void 0,void 0,(function*(){yield this.triggerExplicitly();const i=this._filteredInlineCompletionItems.get()||[];if(i.length>0){const e=(this.selectedInlineCompletionIndex.get()+t+i.length)%i.length;this._selectedInlineCompletionId.set(i[e].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}))}next(){return h3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return h3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i;return h3(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.inlineCompletion.toInlineCompletion(void 0);t.pushUndoStop(),s.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[OT.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=s3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[OT.replaceMove(s.range,s.insertText),...s.additionalTextEdits]),s.command&&s.source.addRef(),DH((t=>{this._source.clear(t),this._isActive.set(!1,t)})),s.command&&(yield this._commandService.executeCommand(s.command.id,...s.command.arguments||[]).then(void 0,Ai),s.source.removeRef())}))}acceptNextWord(t){return h3(this,void 0,void 0,(function*(){yield 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){return h3(this,void 0,void 0,(function*(){yield this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}))}_acceptNext(t,i){return h3(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.ghostText,n=e.inlineCompletion.toInlineCompletion(void 0);if(n.snippetInfo||n.filterText!==n.insertText)return void(yield this.accept(t));const r=s.parts[0],o=new gs(s.lineNumber,r.column),h=r.lines.join("\n"),c=i(o,h);if(c===h.length&&1===s.parts.length)return void this.accept(t);const l=h.substring(0,c);this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[OT.replace(ps.fromPositions(o),l)]);const i=K4(l);t.setPosition(U4(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ps.fromPositions(n.range.getStartPosition(),U4(o,K4(l))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}))}handleSuggestAccepted(t){var i,e;const s=t.toSingleTextEdit().removeCommonPrefix(this.textModel),n=this._computeAugmentedCompletion(s,void 0);if(!n)return;const r=n.completion.inlineCompletion;null===(e=(i=r.source.provider).handlePartialAccept)||void 0===e||e.call(i,r.source.inlineCompletions,r.sourceInlineCompletion,s.text.length)}};c3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([o3(9,Zr),o3(10,uo),o3(11,ud)],c3);var l3,u3=function(t,i){return function(e,s){i(e,s,t)}};class a3{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 d3 extends a3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let f3=l3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new Mu((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===NP.SHUTDOWN&&this._saveState()})))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(t,i,e){this._withStrategy(t,i).memorize(t,i,e),this._persistSoon.schedule()}select(t,i,e){return this._withStrategy(t,i).select(t,i,e)}_withStrategy(t,i){var e;const s=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:t.getLanguageIdAtPosition(i.lineNumber,i.column),resource:t.uri});if((null===(e=this._strategy)||void 0===e?void 0:e.name)!==s){this._saveState();const t=l3._strategyCtors.get(s)||d3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${l3._storagePrefix}/${s}`,t?0:1);i&&this._strategy.fromJSON(JSON.parse(i))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${l3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};f3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends a3{constructor(){super("recentlyUsedByPrefix"),this._trie=uR.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:ks.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends a3{constructor(){super("recentlyUsed"),this._cache=new lg(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:ks.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",d3]]),f3._storagePrefix="suggest/memories",f3=l3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([u3(0,PP),u3(1,Ta)],f3);const g3=Qr("ISuggestMemories");Wa(g3,f3,1);var p3;let m3=p3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=p3.AtEnd.bindTo(i),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(122)&&this._update())),this._update()}dispose(){var t;this._configListener.dispose(),null===(t=this._selectionListener)||void 0===t||t.dispose(),this._ckAtEnd.reset()}_update(){const t="on"===this._editor.getOption(122);if(this._enabled!==t)if(this._enabled=t,this._enabled){const t=()=>{if(!this._editor.hasModel())return void this._ckAtEnd.set(!1);const t=this._editor.getModel(),i=this._editor.getSelection(),e=t.getWordAtPosition(i.getStartPosition());this._ckAtEnd.set(!!e&&e.endColumn===i.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};m3.AtEnd=new Zo("atEndOfWord",!1),m3=p3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Jo)],m3);var v3;let w3=v3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=v3.OtherSuggestions.bindTo(i)}dispose(){this.reset()}reset(){var t;this._ckOtherSuggestions.reset(),null===(t=this._listener)||void 0===t||t.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:t,index:i},e){0!==t.items.length&&v3._moveIndex(!0,t,i)!==i?(this._acceptNext=e,this._model=t,this._index=i,this._listener=this._editor.onDidChangeCursorPosition((()=>{this._ignore||this.reset()})),this._ckOtherSuggestions.set(!0)):this.reset()}static _moveIndex(t,i,e){let s=e;for(let n=i.items.length;n>0&&(s=(s+i.items.length+(t?1:-1))%i.items.length,s!==e)&&i.items[s].completion.additionalTextEdits;n--);return s}next(){this._move(!0)}prev(){this._move(!1)}_move(t){if(this._model)try{this._ignore=!0,this._index=v3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};w3.OtherSuggestions=new Zo("hasOtherSuggestions",!1),w3=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,Jo)],w3);class b3{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||!a(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new zd;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 y3{provideSelectionRanges(t,i){return 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())}))}(this,void 0,void 0,(function*(){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;yield new Promise((i=>y3._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>y3._bracketsLeftYield(e,0,t,s,n,i)))}return e}))}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=y3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>y3._maxDuration){setTimeout((()=>y3._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 It,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>=y3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>y3._maxDuration){setTimeout((()=>y3._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=ps.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=ps.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),y3._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:ps.fromPositions(new gs(s,n),i.getEndPosition())}),e.push({range:ps.fromPositions(new gs(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:ps.fromPositions(new gs(r,s),i.getEndPosition())}),e.push({range:ps.fromPositions(new gs(r,1),i.getEndPosition())}))}}}y3._maxDuration=30,y3._maxRounds=2;class k3{static create(t,i){return 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())}))}(this,void 0,void 0,(function*(){if(!i.getOption(117).localityBonus)return k3.None;if(!i.hasModel())return k3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return k3.None;const[r]=yield(new y3).provideSelectionRanges(e,[n]);if(0===r.length)return k3.None;const o=yield t.computeWordRanges(e.uri,r[0].range);if(!o)return k3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends k3{distance(t,e){if(!n.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const h=o["string"==typeof e.label?e.label:e.label.label];if(u(h))return 2<<20;const c=s(h,ps.fromPositions(t),ps.compareRangesUsingStarts),l=c>=0?h[c]:h[Math.max(0,~c-1)];let a=r.length;for(const t of r){if(!ps.containsRange(t.range,l))break;a-=1}return a}}}))}}k3.None=new class extends k3{distance(){return 0}};class C3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class S3{constructor(t,i,e,s,n,r,o=O_.default,h){this.clipboardText=h,this._snippetCompareFn=S3._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=S3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=S3._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(t){this._lineContext.leadingLineContent===t.leadingLineContent&&this._lineContext.characterCountDelta===t.characterCountDelta||(this._refilterKind=this._lineContext.characterCountDelta<t.characterCountDelta&&this._filteredItems?2:1,this._lineContext=t)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const t=new Set;for(const[i,e]of this.getItemsByProvider())e.length>0&&e[0].container.incomplete&&t.add(i);return t}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){0!==this._refilterKind&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const t=[],{leadingLineContent:i,characterCountDelta:e}=this._lineContext;let s="",r="";const o=1===this._refilterKind?this._items:this._filteredItems,h=[],c=!this._options.filterGraceful||o.length>2e3?F_:R_;for(let n=0;n<o.length;n++){const l=o[n];if(l.isInvalid)continue;const u=this._itemsByProvider.get(l.provider);u?u.push(l):this._itemsByProvider.set(l.provider,[l]);const a=l.position.column-l.editStart.column,d=a+e-(l.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),r=s.toLowerCase()),l.word=s,0===d)l.score=L_.Default;else{let t=0;for(;t<a;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)l.score=L_.Default;else if("string"==typeof l.completion.filterText){const i=c(s,r,t,l.completion.filterText,l.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===zn(l.completion.filterText,l.textLabel)?l.score=i:(l.score=m_(s,r,t,l.textLabel,l.labelLow,0),l.score[0]=i[0])}else{const i=c(s,r,t,l.textLabel,l.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;l.score=i}}l.idx=n,l.distance=this._wordDistance.distance(l.position,l.completion),h.push(l),t.push(l.textLabel.length)}this._filteredItems=h.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?n(t.length-.85,t,((t,i)=>t-i)):0}}static _compareCompletionItems(t,i){return t.score[0]>i.score[0]?-1:t.score[0]<i.score[0]?1:t.distance<i.distance?-1:t.distance>i.distance?1:t.idx<i.idx?-1:t.idx>i.idx?1:0}static _compareCompletionItemsSnippetsDown(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return S3._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 S3._compareCompletionItems(t,i)}}var x3,D3=function(t,i){return function(e,s){i(e,s,t)}};class E3{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 A3=x3=class{constructor(t,i,e,s,n,r,o,h,c){this._editor=t,this._editorWorkerService=i,this._clipboardService=e,this._telemetryService=s,this._logService=n,this._contextKeyService=r,this._configurationService=o,this._languageFeaturesService=h,this._envService=c,this._toDispose=new Vi,this._triggerCharacterListener=new Vi,this._triggerQuickSuggest=new Eu,this._triggerState=void 0,this._completionDisposables=new Vi,this._onDidCancel=new ie,this._onDidTrigger=new ie,this._onDidSuggest=new ie,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new ms(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeModelLanguage((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeConfiguration((()=>{this._updateTriggerCharacters()}))),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange((()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()})));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{l=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{l=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{l||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{l||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){$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(90)||!this._editor.hasModel()||!this._editor.getOption(120))return;const t=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const e of i.triggerCharacters||[]){let s=t.get(e);s||(s=new Set,s.add(void 0),t.set(e,s)),s.add(i)}const i=i=>{var e;if(!function(t,i){if(!Boolean(i.getContextKeyValue("inlineSuggestionVisible")))return!0;const e=i.getContextKeyValue(W4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(E3.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="";tr(i.charCodeAt(i.length-1))?Xn(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;j5.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=s3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!E3.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),e=this._editor.getOption(88);if(!j5.isAllOff(e)){if(!j5.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"!==j5.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(W4.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(W4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(89)))}_refilterCompletionItems(){B(this._editor.hasModel()),B(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new E3(t,i,Object.assign(Object.assign({},this._triggerState),{refilter:!0}));this._onNewContext(e)}trigger(t){var i,e,s,n,r,o;if(!this._editor.hasModel())return;const h=this._editor.getModel(),c=new E3(h,this._editor.getPosition(),t);this.cancel(t.retrigger),this._triggerState=t,this._onDidTrigger.fire({auto:t.auto,shy:null!==(i=t.shy)&&void 0!==i&&i,position:this._editor.getPosition()}),this._context=c;let l={triggerKind:null!==(e=t.triggerKind)&&void 0!==e?e:0};t.triggerCharacter&&(l={triggerKind:1,triggerCharacter:t.triggerCharacter}),this._requestToken=new de;let u=1;switch(this._editor.getOption(111)){case"top":u=0;break;case"bottom":u=2}const{itemKind:a,showDeprecated:d}=x3._createSuggestFilter(this._editor),f=new I5(u,null!==(n=null===(s=t.completionOptions)||void 0===s?void 0:s.kindFilter)&&void 0!==n?n:a,null===(r=t.completionOptions)||void 0===r?void 0:r.providerFilter,null===(o=t.completionOptions)||void 0===o?void 0:o.providerItemsToReuse,d),g=k3.create(this._editorWorkerService,this._editor),p=N5(this._languageFeaturesService.completionProvider,h,this._editor.getPosition(),f,l,this._requestToken.token);Promise.all([p,g]).then((([i,e])=>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())}))}(this,void 0,void 0,(function*(){var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==t?void 0:t.clipboardText;if(!n&&i.needsClipboard&&(n=yield this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new E3(r,this._editor.getPosition(),t),h=Object.assign(Object.assign({},O_.default),{firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly});if(this._completionModel=new S3(i.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(117),this._editor.getOption(111),h,n),this._completionDisposables.add(i.disposable),this._onNewContext(o),this._reportDurationsTelemetry(i.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const t of i.items)t.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${t.provider._debugDisplayName}`,t.completion)})))).catch(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(111)&&i.add(27);const e=t.getOption(117);return e.showMethods||i.add(0),e.showFunctions||i.add(1),e.showConstructors||i.add(2),e.showFields||i.add(3),e.showVariables||i.add(4),e.showClasses||i.add(5),e.showStructs||i.add(6),e.showInterfaces||i.add(7),e.showModules||i.add(8),e.showProperties||i.add(9),e.showEvents||i.add(10),e.showOperators||i.add(11),e.showUnits||i.add(12),e.showValues||i.add(13),e.showConstants||i.add(14),e.showEnums||i.add(15),e.showEnumMembers||i.add(16),e.showKeywords||i.add(17),e.showWords||i.add(18),e.showColors||i.add(19),e.showFiles||i.add(20),e.showReferences||i.add(21),e.showColors||i.add(22),e.showFolders||i.add(23),e.showTypeParameters||i.add(24),e.showSnippets||i.add(27),e.showUsers||i.add(25),e.showIssues||i.add(26),{itemKind:i,showDeprecated:e.showDeprecated}}_onNewContext(t){if(this._context)if(t.lineNumber===this._context.lineNumber)if(jn(t.leadingLineContent)===jn(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(E3.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=E3.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()}};A3=x3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D3(1,MN),D3(2,EV),D3(3,Ah),D3(4,Mh),D3(5,Jo),D3(6,Ta),D3(7,Wg),D3(8,EF)],A3);class M3{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)>M3._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()}}M3._maxSelectionLength=51200;var L3=function(t,i){return function(e,s){i(e,s,t)}};class O3 extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=J(0,"{0} ({1})",this._action.label,O3.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let F3=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Ol(t,Pl(".suggest-status-bar"));const r=t=>t instanceof xh?e.createInstance(O3,t,void 0):void 0;this._leftActions=new cN(this.element,{actionViewItemProvider:r}),this._rightActions=new cN(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const t=this._menuService.createMenu(this._menuId,this._contextKeyService),i=()=>{const i=[],e=[];for(const[s,n]of t.getActions())"left"===s?i.push(...n):e.push(...n);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(e)};this._menuDisposables.add(t.onDidChange((()=>i()))),this._menuDisposables.add(t)}hide(){this._menuDisposables.clear()}};F3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([L3(2,Zr),L3(3,yh),L3(4,Jo)],F3);function T3(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let R3=class{constructor(t,i){this._editor=t,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ie,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Vi,this._renderDisposeable=new Vi,this._borderWidth=1,this._size=new ol(330,0),this.domNode=Pl(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(JG,{editor:t}),this._body=Pl(".body"),this._scrollbar=new Zy(this._body,{alwaysConsumeMouseWheel:!0}),Ol(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ol(this._body,Pl(".header")),this._close=Ol(this._header,Pl("span"+eo.asCSSSelector(ys.close))),this._close.title=J(0,"Close"),this._type=Ol(this._header,Pl("p.type")),this._docs=Ol(this._body,Pl("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(50),e=i.getMassagedFontFamily(),s=t.get(118)||i.fontSize,n=t.get(119)||i.lineHeight,r=i.fontWeight,o=`${n}px`;this.domNode.style.fontSize=`${s}px`,this.domNode.style.lineHeight=""+n/s,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=i.fontFeatureSettings,this._type.style.fontFamily=e,this._close.style.height=o,this._close.style.width=o}getLayoutInfo(){const t=this._editor.getOption(119)||this._editor.getOption(50).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=J(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 H_).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||T3(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,Nl(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Gc(this._type),this._type.title="",Bl(this._type),this.domNode.classList.add("no-type");if(Gc(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Gc(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 ol(t,i);ol.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}};R3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zr)],R3);class _3{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 yY,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=nl(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new ol(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 ol(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),l=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ol(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ol(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)}}()],u=null!==(s=l.find((t=>t.fit>=0)))&&void 0!==s?s:l.sort(((t,i)=>i.fit-t.fit))[0],a=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(u.maxSizeTop.height,u.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=u.maxSizeTop.height?(d=!0,p=u.maxSizeTop):(d=!1,p=u.maxSizeBottom):f<=u.maxSizeBottom.height?(d=!1,p=u.maxSizeBottom):(d=!0,p=u.maxSizeTop),this._applyTopLeft({left:u.left,top:d?u.top:a-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,u===c,d,u!==c),this._resizable.minSize=u.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 I3;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(I3||(I3={}));const P3=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function N3(t,i,e,s){const n=s===I3.ROOT_FOLDER?["rootfolder-icon"]:s===I3.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Vc.data)r=jE.parseMetaData(e).get(jE.META_DATA_LABEL);else{const t=e.path.match(P3);t?(r=B3(t[2].toLowerCase()),t[1]&&n.push(`${B3(t[1].toLowerCase())}-name-dir-icon`)):r=B3(e.authority.toLowerCase())}if(s===I3.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===Vc.data){const t=jE.parseMetaData(e).get(jE.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==ed?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${B3(s)}-lang-file-icon`)}}return n}function B3(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var $3,j3=function(t,i){return function(e,s){i(e,s,t)}};function W3(t){return`suggest-aria-id:${t}`}const V3=GW("suggest-more-info",ys.chevronRight,J(0,"Icon for more information in the suggest widget.")),H3=new(($3=class{extract(t,i){if(t.textLabel.match($3._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match($3._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=$3._regexRelaxed.exec(t.completion.documentation);if(e&&(0===e.index||e.index+e[0].length===t.completion.documentation.length))return i[0]=e[0],!0}return!1}})._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,$3._regexStrict=new RegExp(`^${$3._regexRelaxed.source}$`,"i"),$3);let z3=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ie,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Vi,e=t;e.classList.add("show-file-icons");const s=Ol(t,Pl(".icon")),n=Ol(s,Pl("span.colorspan")),r=Ol(t,Pl(".contents")),o=Ol(r,Pl(".main")),h=Ol(o,Pl(".icon-label.codicon")),c=Ol(o,Pl("span.left")),l=Ol(o,Pl("span.right")),u=new Jj(c,{supportHighlights:!0,supportIcons:!0});i.add(u);const a=Ol(c,Pl("span.signature-label")),d=Ol(c,Pl("span.qualifier-label")),f=Ol(l,Pl("span.details-label")),g=Ol(l,Pl("span.readMore"+eo.asCSSSelector(V3)));g.title=J(0,"Read More");const p=()=>{const t=this._editor.getOptions(),i=t.get(50),n=i.getMassagedFontFamily(),r=i.fontFeatureSettings,h=t.get(118)||i.fontSize,c=t.get(119)||i.lineHeight,l=i.fontWeight,u=`${c}px`,a=`${i.letterSpacing}px`;e.style.fontSize=`${h}px`,e.style.fontWeight=l,e.style.letterSpacing=a,o.style.fontFamily=n,o.style.fontFeatureSettings=r,o.style.lineHeight=u,s.style.height=u,s.style.width=u,g.style.height=u,g.style.width=u};return p(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(118)||t.hasChanged(119))&&p()}))),{root:e,left:c,right:l,icon:s,colorspan:n,iconLabel:u,iconContainer:h,parametersLabel:a,qualifierLabel:d,detailsLabel:f,readMore:g,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=W3(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:v_(t.score)},r=[];if(19===s.kind&&H3.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=N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),I3.FILE),r=N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),I3.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=[N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),I3.FOLDER),N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),I3.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...eo.asClassNameArray(ks.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=U3(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=U3(s.label.detail||""),e.detailsLabel.textContent=U3(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Nl(e.detailsLabel):Bl(e.detailsLabel),T3(t)?(e.right.classList.add("can-expand-details"),Nl(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"),Bl(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function U3(t){return t.replace(/\r\n|\r|\n/g,"")}z3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j3(1,Xr),j3(2,Ba),j3(3,mk)],z3);var K3,q3=function(t,i){return function(e,s){i(e,s,t)}};Om("editorSuggestWidget.background",{dark:Lv,light:Lv,hcDark:Lv,hcLight:Lv},J(0,"Background color of the suggest widget.")),Om("editorSuggestWidget.border",{dark:Fv,light:Fv,hcDark:Fv,hcLight:Fv},J(0,"Border color of the suggest widget."));const G3=Om("editorSuggestWidget.foreground",{dark:Mv,light:Mv,hcDark:Mv,hcLight:Mv},J(0,"Foreground color of the suggest widget."));Om("editorSuggestWidget.selectedForeground",{dark:zw,light:zw,hcDark:zw,hcLight:zw},J(0,"Foreground color of the selected entry in the suggest widget.")),Om("editorSuggestWidget.selectedIconForeground",{dark:Uw,light:Uw,hcDark:Uw,hcLight:Uw},J(0,"Icon foreground color of the selected entry in the suggest widget."));const Z3=Om("editorSuggestWidget.selectedBackground",{dark:Kw,light:Kw,hcDark:Kw,hcLight:Kw},J(0,"Background color of the selected entry in the suggest widget."));Om("editorSuggestWidget.highlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Color of the match highlights in the suggest widget.")),Om("editorSuggestWidget.focusHighlightForeground",{dark:Lw,light:Lw,hcDark:Lw,hcLight:Lw},J(0,"Color of the match highlights in the suggest widget when an item is focused.")),Om("editorSuggestWidgetStatus.foreground",{dark:Mb(G3,.5),light:Mb(G3,.5),hcDark:Mb(G3,.5),hcLight:Mb(G3,.5)},J(0,"Foreground color of the suggest widget status."));class J3{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof NJ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ol.is(t))return ol.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let Q3=K3=class{constructor(t,i,e,s,n){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 Eu,this._disposables=new Vi,this._onDidSelect=new se,this._onDidFocus=new se,this._onDidHide=new ie,this._onDidShow=new ie,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ie,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new yY,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Y3(this,t),this._persistedSize=new J3(i,t);class r{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let o;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),o=new r(this._persistedSize.restore(),this.element.size)}))),this._disposables.add(this.element.onDidResize((t=>{var i,e,s,n;if(this._resize(t.dimension.width,t.dimension.height),o&&(o.persistHeight=o.persistHeight||!!t.north||!!t.south,o.persistWidth=o.persistWidth||!!t.east||!!t.west),t.done){if(o){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),h=Math.round(t/2);let{width:c,height:l}=this.element.size;(!o.persistHeight||Math.abs(o.currentSize.height-l)<=h)&&(l=null!==(e=null===(i=o.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!o.persistWidth||Math.abs(o.currentSize.width-c)<=h)&&(c=null!==(n=null===(s=o.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ol(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=Ol(this.element.domNode,Pl(".message")),this._listElement=Ol(this.element.domNode,Pl(".tree"));const h=this._disposables.add(n.createInstance(R3,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new _3(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(z3,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new vP("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>J(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:e,description:s}=t.completion.label;e&&s?i=J(0,"{0} {1}, {2}",i,e,s):e?i=J(0,"{0} {1}",i,e):s&&(i=J(0,"{0}, {1}",i,s))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:e,detail:s}=t.completion;return J(0,"{0}, docs: {1}",i,Fn("{0}{1}",s||"",e?"string"==typeof e?e:e.value:""))}}}),this._list.style(qP({listInactiveFocusBackground:Z3,listInactiveFocusOutline:Pm})),this._status=n.createInstance(F3,this.element.domNode,R5);const u=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);u(),this._disposables.add(s.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(s.getColorTheme()),this._disposables.add(this._list.onMouseDown((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onTap((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onDidChangeSelection((t=>this._onListSelection(t)))),this._disposables.add(this._list.onDidChangeFocus((t=>this._onListFocus(t)))),this._disposables.add(this.editor.onDidChangeCursorSelection((()=>this._onCursorSelectionChanged()))),this._disposables.add(this.editor.onDidChangeConfiguration((t=>{t.hasChanged(117)&&(u(),c())}))),this._ctxSuggestWidgetVisible=T5.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=T5.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=T5.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=T5.HasFocusedSuggestion.bindTo(e),this._disposables.add(Xc(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=oy(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=wu((t=>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())}))}(this,void 0,void 0,(function*(){const i=xu((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose()));try{return yield e.resolve(t)}finally{i.dispose(),s.dispose()}})))),this._currentSuggestionDetails.then((()=>{s>=this._list.length||e!==this._list.element(s)||(this._ignoreFocusEvents=!0,this._list.splice(s,1,[e]),this._list.setFocus([s]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:W3(s)}))})).catch(Ei)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(t){if(this._state!==t)switch(this._state=t,this.element.domNode.classList.toggle("frozen",4===t),this.element.domNode.classList.remove("message"),t){case 0:Bl(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=K3.LOADING_MESSAGE,Bl(this._listElement,this._status.element),Nl(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,nm(K3.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=K3.NO_SUGGESTIONS_MESSAGE,Bl(this._listElement,this._status.element),Nl(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,nm(K3.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Bl(this._messageElement),Nl(this._listElement,this._status.element),this._show();break;case 5:Bl(this._messageElement),Nl(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=xu((()=>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=tl((()=>{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")):!T3(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=tl((()=>{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=nl(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();t||(t=r.defaultSize);let o=t.height,h=t.width;if(this._status.element.style.height=`${r.itemHeight}px`,2===this._state||1===this._state)o=r.itemHeight+r.borderHeight,h=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new ol(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const l=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,u=r.statusBarHeight+this._list.contentHeight+r.borderHeight,a=r.itemHeight+r.statusBarHeight,d=cl(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,u),p=d.top+f.top-r.verticalPadding,m=Math.min(p,u);let v=Math.min(Math.max(m,g)+r.borderHeight,u);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 ol(l,r.defaultSize.height),this.element.maxSize=new ol(c,v),this.element.minSize=new ol(220,a),this._cappedHeight=o===u?{wanted:null!==(s=null===(e=this._cappedHeight)||void 0===e?void 0:e.wanted)&&void 0!==s?s:t.height,capped:o}:void 0}this._resize(h,o)}_resize(t,i){const{width:e,height:s}=this.element.maxSize;t=Math.min(e,t),i=Math.min(s,i);const{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(i-n,t),this._listElement.style.height=i-n+"px",this.element.layout(i,t),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var t;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,2===(null===(t=this._contentWidget.getPosition())||void 0===t?void 0:t.preference[0]))}getLayoutInfo(){const t=this.editor.getOption(50),i=SF(this.editor.getOption(119)||t.lineHeight,8,1e3),e=this.editor.getOption(117).showStatusBar&&2!==this._state&&1!==this._state?i:0,s=this._details.widget.borderWidth,n=2*s;return{itemHeight:i,statusBarHeight:e,borderWidth:s,borderHeight:n,typicalHalfwidthCharacterWidth:t.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new ol(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}};Q3.LOADING_MESSAGE=J(0,"Loading..."),Q3.NO_SUGGESTIONS_MESSAGE=J(0,"No suggestions."),Q3=K3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([q3(1,PP),q3(2,Jo),q3(3,mk),q3(4,Zr)],Q3);class Y3{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 ol(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 X3,t6=function(t,i){return function(e,s){i(e,s,t)}};class i6{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:ps.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 e6=X3=class{static get(t){return t.getContribution(X3.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 s6((t=>t.priority)),this._onWillInsertSuggestItem=new ie,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(A3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=T5.InsertMode.bindTo(s);h.set(t.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger((()=>h.set(t.getOption(117).insertMode)))),this.widget=this._toDispose.add(new Ou((()=>{const t=this._instantiationService.createInstance(Q3,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new b3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=T5.MakesTextEdit.bindTo(this._contextKeyService),s=T5.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=T5.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(!gs.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 nh(!0,!1,!1,!1,33))||ft&&t.toKeyCodeChord().equals(new nh(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new Ou((()=>this._toDispose.add(new M3(this.editor,this.model))))),this._alternatives=this._toDispose.add(new Ou((()=>this._toDispose.add(new w3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(m3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new i6(this.editor.getModel(),t.position)}))),this._toDispose.add(this.model.onDidSuggest((t=>{if(t.triggerOptions.shy)return;let i=-1;for(const e of this._selectors.itemsOrderedByPriorityDesc)if(i=e.select(this.editor.getModel(),this.editor.getPosition(),t.completionModel.items),-1!==i)break;-1===i&&(i=0);let e=!1;if(t.triggerOptions.auto){const i=this.editor.getOption(117);"never"===i.selectionMode||"always"===i.selectionMode?e="never"===i.selectionMode:"whenTriggerCharacter"===i.selectionMode?e=1!==t.triggerOptions.triggerKind:"whenQuickSuggestion"===i.selectionMode&&(e=1===t.triggerOptions.triggerKind&&!t.triggerOptions.refilter)}this.widget.value.showSuggestions(t.completionModel,i,t.isFrozen,t.triggerOptions.auto,e)}))),this._toDispose.add(this.model.onDidCancel((t=>{t.retrigger||this.widget.value.hideWidget()}))),this._toDispose.add(this.editor.onDidBlurEditorWidget((()=>{this.model.cancel(),this.model.clear()})));const c=T5.AcceptSuggestionsOnEnter.bindTo(s),l=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>l()))),l()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(t,i){if(!t||!t.item)return this._alternatives.value.reset(),this.model.cancel(),void this.model.clear();if(!this.editor.hasModel())return;const e=s3.get(this.editor);if(!e)return;this._onWillInsertSuggestItem.fire({item:t.item});const s=this.editor.getModel(),n=s.getAlternativeVersionId(),{item:r}=t,o=[],h=new de;1&i||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,Boolean(8&i));this._memoryService.memorize(s,this.editor.getPosition(),r);const l=r.isResolved;let u=-1,a=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=tU.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>OT.replaceMove(ps.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!l){const t=new Zi;let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=ps.getEndPosition(i.range);e&&!gs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let l=!1;const u=this.editor.onWillType((()=>{u.dispose(),l=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return;if(e&&r.completion.additionalTextEdits.some((t=>gs.isBefore(e,ps.getStartPosition(t.range)))))return!1;l&&this.editor.pushUndoStop();const t=tU.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>OT.replaceMove(ps.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!l&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),a=!0===i?1:!1===i?0:-2})).finally((()=>{n.dispose(),u.dispose()})))}let{insertText:d}=r.completion;if(4&r.completion.insertTextRules||(d=f5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===n6.id)this.model.trigger({auto:!0,retrigger:!0});else{const t=new Zi;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)})).finally((()=>{u=t.elapsed()})))}4&i&&this._alternatives.value.set(t,(t=>{for(h.cancel();s.canUndo();){n!==s.getAlternativeVersionId()&&s.undo(),this._insertSuggestion(t,3|(8&i?8:0));break}})),this._alertCompletionItem(r),Promise.all(o).finally((()=>{this._reportSuggestionAcceptedTelemetry(r,s,l,u,a),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e,s,n){var r,o,h;0!==Math.floor(100*Math.random())&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:null!==(o=null===(r=t.extensionId)||void 0===r?void 0:r.value)&&void 0!==o?o:"unknown",providerId:null!==(h=t.provider._debugDisplayName)&&void 0!==h?h:"unknown",kind:t.completion.kind,basenameHash:Sd(FE(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:TE(i.uri),resolveInfo:t.provider.resolveCompletionItem?e?1:0:-1,resolveDuration:t.resolveDuration,commandDuration:s,additionalEditsAsync:n})}getOverwriteInfo(t,i){B(this.editor.hasModel());let e="replace"===this.editor.getOption(117).insertMode;i&&(e=!e);const s=(e?t.editReplaceEnd.column:t.editInsertEnd.column)-t.position.column;return{overwriteBefore:t.position.column-t.editStart.column+(this.editor.getPosition().column-t.position.column),overwriteAfter:s+(this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0)}}_alertCompletionItem(t){a(t.completion.additionalTextEdits)&&sm(J(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};Ji.once(this.model.onDidTrigger)((()=>{const t=[];Ji.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)}};e6.ID="editor.contrib.suggestController",e6=X3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t6(1,g3),t6(2,uo),t6(3,Jo),t6(4,Zr),t6(5,Mh),t6(6,Ah)],e6);class s6{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 n6 extends tu{constructor(){super({id:n6.id,label:J(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Lo.and(gS.writable,gS.hasCompletionItemProvider,T5.Visible.toNegated()),kbOpts:{kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=e6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}n6.id="editor.action.triggerSuggest",hu(e6.ID,e6,2),ru(n6);const r6=190,o6=Xl.bindToContribution(e6.get);nu(new o6({id:"acceptSelectedSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Lo.and(T5.Visible,gS.textInputFocus),weight:r6},{primary:3,kbExpr:Lo.and(T5.Visible,gS.textInputFocus,T5.AcceptSuggestionsOnEnter,T5.MakesTextEdit),weight:r6}],menuOpts:[{menuId:R5,title:J(0,"Insert"),group:"left",order:1,when:T5.HasInsertAndReplaceRange.toNegated()},{menuId:R5,title:J(0,"Insert"),group:"left",order:1,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("insert"))},{menuId:R5,title:J(0,"Replace"),group:"left",order:1,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("replace"))}]})),nu(new o6({id:"acceptAlternativeSelectedSuggestion",precondition:Lo.and(T5.Visible,gS.textInputFocus,T5.HasFocusedSuggestion),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:R5,group:"left",order:2,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("insert")),title:J(0,"Replace")},{menuId:R5,group:"left",order:2,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("replace")),title:J(0,"Insert")}]})),ao.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),nu(new o6({id:"hideSuggestWidget",precondition:T5.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:9,secondary:[1033]}})),nu(new o6({id:"selectNextSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),nu(new o6({id:"selectNextPageSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:12,secondary:[2060]}})),nu(new o6({id:"selectLastSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),nu(new o6({id:"selectPrevSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),nu(new o6({id:"selectPrevPageSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:11,secondary:[2059]}})),nu(new o6({id:"selectFirstSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),nu(new o6({id:"focusSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),nu(new o6({id:"focusAndAcceptSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),nu(new o6({id:"toggleSuggestionDetails",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:R5,group:"right",order:1,when:Lo.and(T5.DetailsVisible,T5.CanResolve),title:J(0,"show less")},{menuId:R5,group:"right",order:1,when:Lo.and(T5.DetailsVisible.toNegated(),T5.CanResolve),title:J(0,"show more")}]})),nu(new o6({id:"toggleExplainMode",precondition:T5.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),nu(new o6({id:"toggleSuggestionFocus",precondition:T5.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2570,mac:{primary:778}}})),nu(new o6({id:"insertBestCompletion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),m3.AtEnd,T5.Visible.toNegated(),w3.OtherSuggestions.toNegated(),s3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(O(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:r6,primary:2}})),nu(new o6({id:"insertNextSuggestion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),w3.OtherSuggestions,T5.Visible.toNegated(),s3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2}})),nu(new o6({id:"insertPrevSuggestion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),w3.OtherSuggestions,T5.Visible.toNegated(),s3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:1026}})),ru(class extends tu{constructor(){super({id:"editor.action.resetSuggestSize",label:J(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=e6.get(i))||void 0===e||e.resetWidgetSize()}});class h6 extends Hi{get selectedItem(){return this._selectedItem}constructor(t,i,e,s){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.onWillAccept=s,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=OH(this,void 0),this._register(t.onKeyDown((t=>{t.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))}))),this._register(t.onKeyUp((t=>{t.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))})));const n=e6.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(t,i,e)=>{var s;DH((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(s=this.suggestControllerPreselector())||void 0===s?void 0:s.removeCommonPrefix(r);if(!o)return-1;const h=gs.lift(i),c=Of(e.map(((t,i)=>{const e=c6.fromSuggestion(n,r,h,t,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(r);return{index:i,valid:o.augments(e),prefixLength:e.text.length,suggestItem:t}})).filter((t=>t&&t.valid&&t.prefixLength>0)),S((t=>t.prefixLength),x));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(n.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(n.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(n.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Ji.once(n.model.onDidTrigger)((()=>{i()}))),this._register(n.onWillInsertSuggestItem((t=>{const i=this.editor.getPosition(),e=this.editor.getModel();if(!i||!e)return;const s=c6.fromSuggestion(n,e,i,t.item,this.isShiftKeyPressed);this.onWillAccept(s)})))}this.update(this._isActive)}update(t){const i=this.getSuggestItemInfo();this._isActive===t&&function(t,i){return t===i||!(!t||!i)&&t.equals(i)}(this._currentSuggestItemInfo,i)||(this._isActive=t,this._currentSuggestItemInfo=i,DH((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=e6.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?c6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=e6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=e6.get(this.editor);null==t||t.forceRenderingAbove()}}class c6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new f5).parse(r);t.children.length<100&&X5.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new c6(ps.fromPositions(e.delta(0,-h.overwriteBefore),e.delta(0,Math.max(h.overwriteAfter,0))),r,s.completion.kind,o)}constructor(t,i,e,s){this.range=t,this.insertText=i,this.completionItemKind=e,this.isSnippetText=s}equals(t){return this.range.equalsRange(t.range)&&this.insertText===t.insertText&&this.completionItemKind===t.completionItemKind&&this.isSnippetText===t.isSnippetText}toSelectedSuggestionInfo(){return new Os(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new y5(this.range,this.insertText)}}var l6,u6=function(t,i){return function(e,s){i(e,s,t)}};let a6=l6=class extends Hi{static get(t){return t.getContribution(l6.ID)}constructor(t,i,e,s,n,r,o,h,c){super(),this.editor=t,this.instantiationService=i,this.contextKeyService=e,this.configurationService=s,this.commandService=n,this.debounceService=r,this.languageFeaturesService=o,this.audioCueService=h,this._keybindingService=c,this.model=TH("inlineCompletionModel",void 0),this.textModelVersionId=OH(this,-1),this.cursorPosition=OH(this,new gs(1,1)),this.suggestWidgetAdaptor=this._register(new h6(this.editor,(()=>{var t,i;return null===(i=null===(t=this.model.get())||void 0===t?void 0:t.selectedInlineCompletion.get())||void 0===i?void 0:i.toSingleTextEdit(void 0)}),(t=>this.updateObservables(t,r3.Other)),(t=>{DH((i=>{var e;this.updateObservables(i,r3.Other),null===(e=this.model.get())||void 0===e||e.handleSuggestAccepted(t)}))}))),this._enabled=KH(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(62).enabled)),this.ghostTextWidget=this._register(this.instantiationService.createInstance(Y4,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:zH(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 W4(this.contextKeyService,this.model)),this._register(Ji.runAndSubscribe(t.onDidChangeModel,(()=>DH((e=>{this.model.set(void 0,e),this.updateObservables(e,r3.Other);const s=t.getModel();if(s){const n=i.createInstance(c3,s,this.suggestWidgetAdaptor.selectedItem,this.cursorPosition,this.textModelVersionId,this._debounceValue,KH(t.onDidChangeConfiguration,(()=>t.getOption(117).preview)),KH(t.onDidChangeConfiguration,(()=>t.getOption(117).previewMode)),KH(t.onDidChangeConfiguration,(()=>t.getOption(62).mode)),this._enabled);this.model.set(n,e)}})))));const l=t=>{var i;return t.isUndoing?r3.Undo:t.isRedoing?r3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?r3.AcceptWord:r3.Other};let u;this._register(t.onDidChangeModelContent((t=>DH((i=>this.updateObservables(i,l(t))))))),this._register(t.onDidChangeCursorPosition((t=>DH((i=>{var e;this.updateObservables(i,r3.Other),3!==t.reason&&"api"!==t.source||null===(e=this.model.get())||void 0===e||e.stop(i)}))))),this._register(t.onDidType((()=>DH((t=>{var i;this.updateObservables(t,r3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([SS.Tab.id,SS.DeleteLeft.id,SS.DeleteRight.id,DX,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&DH((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this.contextKeyService.getContextKeyValue("accessibleViewIsShown")||this.configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(62).keepOnBlur||BX.dropDownVisible||DH((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(jH((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(jH((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.inlineCompletion){if(e.inlineCompletion.semanticId!==u){u=e.inlineCompletion.semanticId;const t=i.textModel.getLineContent(e.ghostText.lineNumber);this.audioCueService.playAudioCue(QV.inlineSuggestion).then((()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(e.ghostText.renderForScreenReader(t))}))}}else u=void 0}))),this._register(new IX(this.editor,this.model,this.instantiationService)),this._register(this.configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.inlineCompletions")})}))),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.inlineCompletions")})}provideScreenReaderUpdate(t){const i=this.contextKeyService.getContextKeyValue("accessibleViewIsShown"),e=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let s;!i&&e&&this.editor.getOption(147)&&(s=J(0,"Inspect this in the accessible view ({0})",e.getAriaLabel())),sm(s?t+", "+s:t)}updateObservables(t,i){var e,s;const n=this.editor.getModel();this.textModelVersionId.set(null!==(e=null==n?void 0:n.getVersionId())&&void 0!==e?e:-1,t,i),this.cursorPosition.set(null!==(s=this.editor.getPosition())&&void 0!==s?s:new gs(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 gs(e.lineNumber,i.column))))}shouldShowHoverAtViewZone(t){return this.ghostTextWidget.ownsViewZone(t)}};a6.ID="editor.contrib.inlineCompletionsController",a6=l6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([u6(1,Zr),u6(2,Jo),u6(3,Ta),u6(4,uo),u6(5,FF),u6(6,Wg),u6(7,GV),u6(8,CC)],a6);var d6=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 f6 extends tu{constructor(){super({id:f6.ID,label:J(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}f6.ID=AX;class g6 extends tu{constructor(){super({id:g6.ID,label:J(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}g6.ID=EX;class p6 extends tu{constructor(){super({id:p6.ID,label:J(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:W4.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return d6(this,void 0,void 0,(function*(){const t=a6.get(i);DH((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}p6.ID="editor.action.inlineSuggest.hide";class m6 extends Dh{constructor(){super({id:m6.ID,title:J(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:bh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Lo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return d6(this,void 0,void 0,(function*(){const i=t.get(Ta),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}m6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var v6=function(t,i){return function(e,s){i(e,s,t)}};class w6{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 b6=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=a6.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 wY(1e3,this,ps.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 wY(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("always"===this._editor.getOption(62).showToolbar)return[];const e=a6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new w6(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Vi,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(BX,this._editor,!1,zH(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]})));return t.fragment.appendChild(r.getDomNode()),n.triggerExplicitly(),e.add(r),e}renderScreenReaderText(t,i,e){const s=Pl,n=s("div.hover-row.markdown-hover"),r=Ol(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new JG({editor:this._editor},this._languageService,this._openerService));e.add(jH((s=>{var n;const h=null===(n=i.controller.model.read(s))||void 0===n?void 0:n.ghostText.read(s);if(h){const i=this._editor.getModel().getLineContent(h.lineNumber);(i=>{e.add(o.onDidRenderAsync((()=>{r.className="hover-contents code-hover-contents",t.onContentsChanged()})));const s=J(0,"Suggestion:"),n=e.add(o.render((new H_).appendText(s).appendCodeblock("text",i)));r.replaceChildren(n.element)})(h.renderForScreenReader(i))}else Tl(r)}))),t.fragment.appendChild(n)}};function y6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function k6(t,i,e){t=t<0?0:t;let s="";if(!e){const e=Math.floor(t/i);t%=i;for(let t=0;t<e;t++)s+="\t"}for(let i=0;i<t;i++)s+=" ";return s}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}([v6(1,Ba),v6(2,AF),v6(3,gm),v6(4,Zr),v6(5,Ah)],b6),hu(a6.ID,a6,3),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:J(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:gS.writable})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),ru(f6),ru(g6),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:J(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Lo.and(gS.writable,W4.inlineSuggestionVisible)},menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextWord(t.editor)}))}}),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:J(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextLine(t.editor)}))}}),ru(class extends tu{constructor(){super({id:DX,label:J(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:W4.inlineSuggestionVisible,menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Lo.and(W4.inlineSuggestionVisible,gS.tabMovesFocus.toNegated(),W4.inlineSuggestionHasIndentationLessThanTabSize,T5.Visible.toNegated(),gS.hoverFocused.toNegated())}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),ru(p6),Eh(m6),bY.register(b6);function C6(t,i,e,s,n){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return[];const r=i.getLanguageConfiguration(t.getLanguageId()).indentationRules;if(!r)return[];for(s=Math.min(s,t.getLineCount());e<=s&&r.unIndentedLinePattern;){const i=t.getLineContent(e);if(!r.unIndentedLinePattern.test(i))break;e++}if(e>s-1)return[];const{tabSize:o,indentSize:h,insertSpaces:c}=t.getOptions(),l=(t,i)=>iS.shiftIndent(t,t.length+(i=i||1),o,h,c),u=(t,i)=>iS.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=jn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=u(d),g=d+f.substring(t.length)),f!==g&&a.push(OT.replaceMove(new ms(e,1,e,t.length+1),EC(d,h,c)))}else d=jn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=l(p),d=l(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=l(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=jn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=u(p),d=u(d)),s!==p&&a.push(OT.replaceMove(new ms(i,1,i,s.length+1),EC(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=l(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?l(p):d)}return a}class S6 extends tu{constructor(){super({id:S6.ID,label:J(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:gS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new R6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}S6.ID="editor.action.indentationToSpaces";class x6 extends tu{constructor(){super({id:x6.ID,label:J(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:gS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new _6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}x6.ID="editor.action.indentationToTabs";class D6 extends tu{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(Ij),s=t.get(Xr),n=i.getModel();if(!n)return;const r=s.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget),o=n.getOptions(),h=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===r.tabSize&&t===o.tabSize?J(0,"Configured Tab Size"):t===r.tabSize?J(0,"Default Tab Size"):t===o.tabSize?J(0,"Current Tab Size"):void 0}))),c=Math.min(n.getOptions().tabSize-1,7);setTimeout((()=>{e.pick(h,{placeHolder:J(0,"Select Tab Size for Current File"),activeItem:h[c]}).then((t=>{if(t&&n&&!n.isDisposed()){const i=parseInt(t.label,10);n.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class E6 extends D6{constructor(){super(!1,!1,{id:E6.ID,label:J(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}E6.ID="editor.action.indentUsingTabs";class A6 extends D6{constructor(){super(!0,!1,{id:A6.ID,label:J(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}A6.ID="editor.action.indentUsingSpaces";class M6 extends D6{constructor(){super(!0,!0,{id:M6.ID,label:J(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}M6.ID="editor.action.changeTabDisplaySize";class L6 extends tu{constructor(){super({id:L6.ID,label:J(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Xr),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}L6.ID="editor.action.detectIndentation";class O6{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(ps.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 F6=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(12)<4||this.editor.getOption(55)||this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste((({range:t})=>{this.trigger(t)})))}trigger(t){const i=this.editor.getSelections();if(null===i||i.length>1)return;const e=this.editor.getModel();if(!e)return;if(!e.tokenization.isCheapToTokenize(t.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>iS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>iS.unshiftIndent(t,t.length+1,n,r,o)};let l=t.startLineNumber;for(;l<=t.endLineNumber&&this.shouldIgnoreLine(e,l);)l++;if(l>t.endLineNumber)return;let u=e.getLineContent(l);if(!/\S/.test(u.substring(0,t.startColumn-1))){const t=rS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=jn(u),s=y6(t,n);if(s!==y6(i,n)){const t=k6(s,n,o);h.push({range:new ps(l,1,l,i.length+1),text:t}),u=t+u.substr(i.length)}else{const t=oS(e,l,this._languageConfigurationService);if(0===t||8===t)return}}}const a=l;for(;l<t.endLineNumber&&!/\S/.test(e.getLineContent(l+1));)l++;if(l!==t.endLineNumber){const i=rS(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===a?u:e.getLineContent(t)},e.getLanguageId(),l+1,c,this._languageConfigurationService);if(null!==i){const s=y6(i,n),r=y6(jn(e.getLineContent(l+1)),n);if(s!==r){const i=s-r;for(let s=l+1;s<=t.endLineNumber;s++){const t=jn(e.getLineContent(s)),r=k6(y6(t,n)+i,n,o);r!==t&&h.push({range:new ps(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new O6(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 T6(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 ps(e,1,e,o),c=t.getValueInRange(h),l=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,l)}}F6.ID="editor.contrib.autoIndentOnPaste",F6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,ud)],F6);class R6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),T6(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class _6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),T6(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}hu(F6.ID,F6,2),ru(S6),ru(x6),ru(E6),ru(A6),ru(M6),ru(L6),ru(class extends tu{constructor(){super({id:"editor.action.reindentlines",label:J(0,"Reindent Lines"),alias:"Reindent Lines",precondition:gS.writable})}run(t,i){const e=t.get(ud),s=i.getModel();if(!s)return;const n=C6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),ru(class extends tu{constructor(){super({id:"editor.action.reindentselectedlines",label:J(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:gS.writable})}run(t,i){const e=t.get(ud),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=C6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});var I6=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 P6{constructor(t,i){this.range=t,this.direction=i}}class N6{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new N6(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return I6(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 I6(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 B6{static create(t,i,e,s){return I6(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>I6(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 B6(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=B6._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=ps.fromPositions(o.getStartPosition(),t),r="after"):(h=ps.fromPositions(t,o.getEndPosition()),r="before"),s.push(new N6(i,new P6(h,r),n))}}this.items=s.sort(((t,i)=>gs.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 ps(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 ps(e,h+1,e,c+1)}}var $6=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 j6(t,i,e,s){var n;return $6(this,void 0,void 0,(function*(){const r=t.get(to),o=t.get(AR),h=t.get(uo),c=t.get(Zr),l=t.get(vO);if(yield s.item.resolve(ue.None),!s.part.location)return;const u=s.part.location,a=[],d=new Set(Ch.getMenuItems(bh.EditorContext).map((t=>wh(t)?t.command.id:d0())));for(const t of iY.all())d.has(t.desc.id)&&a.push(new no(t.desc.id,xh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>$6(this,void 0,void 0,(function*(){const e=yield r.createModelReference(u.uri);try{const n=new tY(e.object.textEditorModel,ps.getStartPosition(u.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 oo),a.push(new no(t.id,t.title,void 0,!0,(()=>$6(this,void 0,void 0,(function*(){var i;try{yield h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){l.notify({severity:mO.Error,source:s.item.provider.displayName,message:t})}})))))}const f=i.getOption(126);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=cl(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function W6(t,i,e,s){return $6(this,void 0,void 0,(function*(){const n=t.get(to),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>$6(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Jo),h=qJ.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new eY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new tY(r.object.textEditorModel,ps.getStartPosition(s.range)),ps.lift(s.range))})))),r.dispose()}))}var V6,H6=function(t,i){return function(e,s){i(e,s,t)}},z6=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 U6{constructor(){this._entries=new lg(50)}get(t){const i=U6._key(t);return this._entries.get(i)}set(t,i){const e=U6._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const K6=Qr("IInlayHintsCache");Wa(K6,U6,1);class q6{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 G6{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let Z6=V6=class{static get(t){var i;return null!==(i=t.getContribution(V6.ID))&&void 0!==i?i:void 0}constructor(t,i,e,s,n,r,o){this._editor=t,this._languageFeaturesService=i,this._inlayHintsCache=s,this._commandService=n,this._notificationService=r,this._instaService=o,this._disposables=new Vi,this._sessionDisposables=new Vi,this._decorationsMetadata=new Map,this._ruleFactory=new Ub(this._editor),this._activeRenderMode=0,this._debounceInfo=e.for(i.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(i.inlayHintsProvider.onDidChange((()=>this._update()))),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(139)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(139);if("off"===t.enabled)return;const i=this._editor.getModel();if(!i||!this._languageFeaturesService.inlayHintsProvider.has(i))return;const e=this._inlayHintsCache.get(i);let s;e&&this._updateHintsDecorators([i.getFullModelRange()],e),this._sessionDisposables.add(Wi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new Mu((()=>z6(this,void 0,void 0,(function*(){const t=Date.now();null==s||s.dispose(!0),s=new de;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const o=s.token,h=yield B6.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(Ul.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 IJ(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 de;e.add(Wi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new G6(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new ps(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=>z6(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(W6,t,this._editor,e.location):Rs.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=>z6(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(ue.None),a(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>OT.replace(ps.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>z6(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(j6,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 BM&&(null==e?void 0:e.attachedData)instanceof q6?e.attachedData:void 0}_invokeCommand(t,i){var e;return z6(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:mO.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 P6(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(ps.compareRangesUsingStarts)){const i=t.validateRange(new ps(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&ps.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=ps.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(t,i){var e,s;const n=[],r=(t,i,e,s,r)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:r};n.push({item:t,classNameRef:i,decoration:{range:t.anchor.range,options:{description:"InlayHint",showIfCollapsed:t.anchor.range.isEmpty(),collapseOnReplaceEdit:!t.anchor.range.isEmpty(),stickiness:0,[t.anchor.direction]:0===this._activeRenderMode?o:void 0}}})},o=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(h/3|0)+"px",display:"inline-block"});r(t,e," ",i?sf.Right:sf.None)},{fontSize:h,fontFamily:c,padding:l,isUniform:u}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,c);for(const t of i){t.hint.paddingLeft&&o(t,!1);const i="string"==typeof t.hint.label?[{label:t.hint.label}]:t.hint.label;for(let s=0;s<i.length;s++){const n=i[s],o=0===s,c=s===i.length-1,f={fontSize:`${h}px`,fontFamily:`var(${d}), ${ki.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};a(t.hint.textEdits)&&(f.cursor="default"),this._fillInColors(f,t.hint),(n.command||n.location)&&(null===(e=this._activeInlayHintPart)||void 0===e?void 0:e.part.item)===t&&this._activeInlayHintPart.part.index===s&&(f.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(f.color=vk(tw),f.cursor="pointer")),l&&(o&&c?(f.padding=`1px ${0|Math.max(1,h/4)}px`,f.borderRadius=(h/4|0)+"px"):o?(f.padding=`1px 0 1px ${0|Math.max(1,h/4)}px`,f.borderRadius=`${h/4|0}px 0 0 ${h/4|0}px`):c?(f.padding=`1px ${0|Math.max(1,h/4)}px 1px 0`,f.borderRadius=`0 ${h/4|0}px ${h/4|0}px 0`):f.padding="1px 0 1px 0"),r(t,this._ruleFactory.createClassNameRef(f),n.label.replace(/[ \t]/g," "),c&&!t.hint.paddingRight?sf.Right:sf.None,new q6(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>V6._MAX_DECORATORS)break}const f=[];for(const i of t)for(const{id:t}of null!==(s=this._editor.getDecorationsInRange(i))&&void 0!==s?s:[]){const i=this._decorationsMetadata.get(t);i&&(f.push(t),i.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const g=tU.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,n.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],n[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===_s.Parameter?(t.backgroundColor=vk(ow),t.color=vk(rw)):i.kind===_s.Type?(t.backgroundColor=vk(nw),t.color=vk(sw)):(t.backgroundColor=vk(ew),t.color=vk(iw))}_getLayoutInfo(){const t=this._editor.getOption(139),i=t.padding,e=this._editor.getOption(52),s=this._editor.getOption(49);let n=t.fontSize;(!n||n<5||n>e)&&(n=e);const r=t.fontFamily||s;return{fontSize:n,fontFamily:r,padding:i,isUniform:!i&&r===s&&n===e}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const t of this._decorationsMetadata.values())t.classNameRef.dispose();this._decorationsMetadata.clear()}};Z6.ID="editor.contrib.InlayHints",Z6._MAX_DECORATORS=1500,Z6=V6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([H6(1,Wg),H6(2,FF),H6(3,K6),H6(4,uo),H6(5,vO),H6(6,Zr)],Z6),ao.registerCommand("_executeInlayHintProvider",((t,...i)=>z6(void 0,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e)),B(ps.isIRange(s));const{inlayHintsProvider:n}=t.get(Wg),r=yield t.get(to).createModelReference(e);try{const t=yield B6.create(n,r.object.textEditorModel,[ps.lift(s)],ue.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}))));var J6=function(t,i){return function(e,s){i(e,s,t)}},Q6=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 extends wY{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let X6=class extends HY{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!Z6.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 BM&&e.attachedData instanceof q6?new Y6(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof Y6?new Ru((i=>Q6(this,void 0,void 0,(function*(){var s,n,r;const{part:o}=t;if(yield o.item.resolve(e),e.isCancellationRequested)return;let h,c;if("string"==typeof o.item.hint.tooltip?h=(new H_).appendText(o.item.hint.tooltip):o.item.hint.tooltip&&(h=o.item.hint.tooltip),h&&i.emitOne(new VY(this,t.range,[h],!1,0)),a(o.item.hint.textEdits)&&i.emitOne(new VY(this,t.range,[(new H_).appendText(J(0,"Double-click to insert"))],!1,10001)),"string"==typeof o.part.tooltip?c=(new H_).appendText(o.part.tooltip):o.part.tooltip&&(c=o.part.tooltip),c&&i.emitOne(new VY(this,t.range,[c],!1,1)),o.part.location||o.part.command){let e;const s=J(0,"altKey"===this._editor.getOption(77)?ft?"cmd + click":"ctrl + click":ft?"option + click":"alt + click");o.part.location&&o.part.command?e=(new H_).appendText(J(0,"Go to Definition ({0}), right click for more",s)):o.part.location?e=(new H_).appendText(J(0,"Go to Definition ({0})",s)):o.part.command&&(e=new H_(`[${J(0,"Execute Command")}](${l=o.part.command,ss.from({scheme:Vc.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${o.part.command.title}") (${s})`,{isTrusted:!0})),e&&i.emitOne(new VY(this,t.range,[e],!1,1e4))}var l;const u=yield this._resolveInlayHintLabelPartHover(o,e);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)}))}}}(u);!(s=(d=yield g.next()).done);f=!0)f=!1,i.emitOne(d.value)}catch(t){n={error:t}}finally{try{f||s||!(r=g.return)||(yield r.call(g))}finally{if(n)throw n.error}}})))):Ru.EMPTY}_resolveInlayHintLabelPartHover(t,i){return Q6(this,void 0,void 0,(function*(){if(!t.part.location)return Ru.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)?$Y(this._languageFeaturesService.hoverProvider,e,new gs(s.startLineNumber,s.startColumn),i).filter((t=>!z_(t.hover.contents))).map((i=>new VY(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):Ru.EMPTY}finally{n.dispose()}}))}};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}([J6(1,Ba),J6(2,AF),J6(3,Ta),J6(4,to),J6(5,Wg)],X6),hu(Z6.ID,Z6,1),bY.register(X6);class t9{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 ms(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new ms(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}var i9;let e9=i9=class{static get(t){return t.getContribution(i9.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(t,i){var e;null===(e=this.currentRequest)||void 0===e||e.cancel();const s=this.editor.getSelection(),n=this.editor.getModel();if(!n||!s)return;let r=s;if(r.startLineNumber!==r.endLineNumber)return;const o=new rK(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=wu((()=>this.editorWorkerService.navigateValueSet(h,r,i))),this.currentRequest.then((i=>{var e;if(!i||!i.range||!i.value)return;if(!o.validate(this.editor))return;const s=ps.lift(i.range);let n=i.range;const h=i.value.length-(r.endColumn-r.startColumn);n={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.startColumn+i.value.length},h>1&&(r=new ms(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+h-1));const c=new t9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:i9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=Su(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};e9.ID="editor.contrib.inPlaceReplaceController",e9.DECORATION=$M.register({description:"in-place-replace",className:"valueSetReplacement"}),e9=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,MN)],e9),hu(e9.ID,e9,4),ru(class extends tu{constructor(){super({id:"editor.action.inPlaceReplace.up",label:J(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=e9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),ru(class extends tu{constructor(){super({id:"editor.action.inPlaceReplace.down",label:J(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=e9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),ru(class extends tu{constructor(){super({id:"expandLineSelection",label:J(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:gS.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,ZC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class s9{constructor(t,i){this._selection=t,this._cursors=i,this._selectionId=null}getEditOperations(t,i){const e=function(t,i){i.sort(((t,i)=>t.lineNumber===i.lineNumber?t.column-i.column:t.lineNumber-i.lineNumber));for(let t=i.length-2;t>=0;t--)i[t].lineNumber===i[t+1].lineNumber&&i.splice(t,1);const e=[];let s=0,n=0;const r=i.length;for(let o=1,h=t.getLineCount();o<=h;o++){const h=t.getLineContent(o),c=h.length+1;let l=0;if(n<r&&i[n].lineNumber===o&&(l=i[n].column,n++,l===c))continue;if(0===h.length)continue;const u=Wn(h);let a=0;if(-1===u)a=1;else{if(u===h.length-1)continue;a=u+2}a=Math.max(l,a),e[s++]=OT.delete(new ps(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 n9{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 ps(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new ps(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new ps(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=ms.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let r9=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 ps(1,1,1,1),null):(i.addEditOperation(new ps(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new ps(n,1,n,t.getLineMaxColumn(n)),null)),s=new ms(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new ps(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let l=r;if(this.shouldAutoIndent(t,s)){const u=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==u){const i=k6(u+y6(jn(t.getLineContent(e)),n),n,o);l=i+this.trimStart(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=rS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=jn(t.getLineContent(e)),h=y6(i,n);if(h!==y6(s,n)){const t=k6(h,n,o);l=t+this.trimStart(r)}}}i.addEditOperation(new ps(s.startLineNumber,1,s.startLineNumber,1),l+"\n");const a=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,l);if(null!==a)0!==a&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,a);else{c.getLineContent=i=>i===s.startLineNumber?l:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=rS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=y6(r,n),c=y6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new ps(s.startLineNumber,1,s.startLineNumber,1),l+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new ps(e,1,e+1,1),null),i.addEditOperation(new ps(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=rS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=y6(r,n),c=y6(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=>iS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>iS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Ju.None||n.indentAction===Ju.Indent?r=n.indentation+n.appendText:n.indentAction===Ju.IndentOutdent?r=n.indentation:n.indentAction===Ju.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimStart(o).indexOf(this.trimStart(r))>=0){const n=jn(t.getLineContent(s));let o=jn(r);const h=oS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),y6(o,e)-y6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(Wn(r)>=0){const r=t.getLineMaxColumn(n),o=QC(this._autoIndent,t,new ps(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(Wn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=QC(this._autoIndent,t,new ps(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),Wn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=QC(this._autoIndent,t,new ps(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimStart(t){return t.replace(/^\s+/,"")}shouldAutoIndent(t,i){if(this._autoIndent<4)return!1;if(!t.tokenization.isCheapToTokenize(i.startLineNumber))return!1;const e=t.getLanguageIdAtPosition(i.startLineNumber,1);return e===t.getLanguageIdAtPosition(i.endLineNumber,1)&&null!==this._languageConfigurationService.getLanguageConfiguration(e).indentRulesSupport}getIndentEditsOfMovingBlock(t,i,e,s,n,r){for(let o=e.startLineNumber;o<=e.endLineNumber;o++){const h=jn(t.getLineContent(o)),c=k6(y6(h,s)+r,s,n);c!==h&&(i.addEditOperation(new ps(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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,ud)],r9);class o9{static getCollator(){return o9._COLLATOR||(o9._COLLATOR=new Intl.Collator),o9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=h9(t,i,e);return s?OT.replace(new ps(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=h9(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 h9(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(o9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}o9._COLLATOR=null;class c9 extends tu{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)=>ps.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 n9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class l9 extends tu{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(ud),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new r9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class u9 extends tu{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!o9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new o9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class a9 extends tu{constructor(){super({id:a9.ID,label:J(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2102),weight:100}})}run(t,i,e){let s=[];"auto-save"===e.reason&&(s=(i.getSelections()||[]).map((t=>new gs(t.positionLineNumber,t.positionColumn))));const n=i.getSelection();if(null===n)return;const r=new s9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}a9.ID="editor.action.trimTrailingWhitespace";class d9 extends tu{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===ps.intersectRanges(i,e)?n.push(i):s[t+1]=ps.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>OT.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class f9 extends tu{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(129),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new ps(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(OT.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(OT.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class g9{constructor(t,i){this._pattern=t,this._flags=i,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(t){}}return this._actual}isSupported(){return null!==this.get()}}class p9 extends f9{constructor(){super({id:"editor.action.transformToTitlecase",label:J(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:gS.writable})}_modifyText(t,i){const e=p9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}p9.titleBoundary=new g9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class m9 extends f9{constructor(){super({id:"editor.action.transformToSnakecase",label:J(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:gS.writable})}_modifyText(t,i){const e=m9.caseBoundary.get(),s=m9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}m9.caseBoundary=new g9("(\\p{Ll})(\\p{Lu})","gmu"),m9.singleLetters=new g9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class v9 extends f9{constructor(){super({id:"editor.action.transformToCamelcase",label:J(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:gS.writable})}_modifyText(t,i){const e=v9.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("")}}v9.wordBoundary=new g9("[_\\s-]","gm");class w9 extends f9{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:J(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:gS.writable})}_modifyText(t,i){const e=w9.caseBoundary.get(),s=w9.singleLetters.get(),n=w9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}w9.caseBoundary=new g9("(\\p{Ll})(\\p{Lu})","gmu"),w9.singleLetters=new g9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),w9.underscoreBoundary=new g9("(\\S)(_)(\\S)","gm"),ru(class extends c9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:J(0,"Copy Line Up"),alias:"Copy Line Up",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"&&Copy Line Up"),order:1}})}}),ru(class extends c9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:J(0,"Copy Line Down"),alias:"Copy Line Down",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Co&&py Line Down"),order:2}})}}),ru(class extends tu{constructor(){super({id:"editor.action.duplicateSelection",label:J(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:gS.writable,menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(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 n9(t,!0));else{const i=new ms(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new $C(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),ru(class extends l9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:J(0,"Move Line Up"),alias:"Move Line Up",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Mo&&ve Line Up"),order:3}})}}),ru(class extends l9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:J(0,"Move Line Down"),alias:"Move Line Down",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Move &&Line Down"),order:4}})}}),ru(class extends u9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:J(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:gS.writable})}}),ru(class extends u9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:J(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:gS.writable})}}),ru(class extends tu{constructor(){super({id:"editor.action.removeDuplicateLines",label:J(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:gS.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 ms(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,l=new ms(c,1,c+o.length-1,o[o.length-1].length);s.push(OT.replace(h,o.join("\n"))),n.push(l),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),ru(a9),ru(class extends tu{constructor(){super({id:"editor.action.deleteLines",label:J(0,"Delete Line"),alias:"Delete Line",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:3113,weight:100}})}run(t,i){if(!i.hasModel())return;const e=this._getLinesToRemove(i),s=i.getModel();if(1===s.getLineCount()&&1===s.getLineMaxColumn(1))return;let n=0;const r=[],o=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];let h=i.startLineNumber,c=i.endLineNumber,l=1,u=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,u=1):h>1&&(h-=1,l=s.getLineMaxColumn(h)),r.push(OT.replace(new ms(h,l,c,u),"")),o.push(new ms(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}}),ru(class extends tu{constructor(){super({id:"editor.action.indentLines",label:J(0,"Indent Line"),alias:"Indent Line",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),ru(class extends tu{constructor(){super({id:"editor.action.outdentLines",label:J(0,"Outdent Line"),alias:"Outdent Line",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2140,weight:100}})}run(t,i){SS.Outdent.runEditorCommand(t,i,null)}}),ru(class extends tu{constructor(){super({id:"editor.action.insertLineBefore",label:J(0,"Insert Line Above"),alias:"Insert Line Above",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),ru(class extends tu{constructor(){super({id:"editor.action.insertLineAfter",label:J(0,"Insert Line Below"),alias:"Insert Line Below",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),ru(class extends d9{constructor(){super({id:"deleteAllLeft",label:J(0,"Delete All Left"),alias:"Delete All Left",precondition:gS.writable,kbOpts:{kbExpr:gS.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 ms(t,i.startColumn,t,i.startColumn)}else r=new ms(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(ps.compareRangesUsingStarts),e=e.map((t=>{if(t.isEmpty()){if(1===t.startColumn){const i=Math.max(1,t.startLineNumber-1),e=1===t.startLineNumber?1:s.getLineLength(i)+1;return new ps(i,e,t.startLineNumber,1)}return new ps(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new ps(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),ru(class extends d9{constructor(){super({id:"deleteAllRight",label:J(0,"Delete All Right"),alias:"Delete All Right",precondition:gS.writable,kbOpts:{kbExpr:gS.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 ms(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 ps(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new ps(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(ps.compareRangesUsingStarts),s}}),ru(class extends tu{constructor(){super({id:"editor.action.joinLines",label:J(0,"Join Lines"),alias:"Join Lines",precondition:gS.writable,kbOpts:{kbExpr:gS.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(ps.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 ms(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new ms(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let l=s,u=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.getLineLength(i.endLineNumber)-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 ps(e,r,a,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(OT.replace(m,p)),t=new ms(m.startLineNumber-u,p.length-f+1,e-u,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(OT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.endLineNumber-u,i.endColumn)):(h.push(OT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.startLineNumber-u,p.length-g)),null!==ps.intersectRanges(m,s)?l=t:c.push(t)}u+=m.endLineNumber-m.startLineNumber}c.unshift(l),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),ru(class extends tu{constructor(){super({id:"editor.action.transpose",label:J(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:gS.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 ps(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new BC(new ms(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new ps(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new VC(t,i,new ms(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),ru(class extends f9{constructor(){super({id:"editor.action.transformToUppercase",label:J(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:gS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),ru(class extends f9{constructor(){super({id:"editor.action.transformToLowercase",label:J(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:gS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),m9.caseBoundary.isSupported()&&m9.singleLetters.isSupported()&&ru(m9),v9.wordBoundary.isSupported()&&ru(v9),p9.titleBoundary.isSupported()&&ru(p9),w9.isSupported()&&ru(w9);var b9,y9=function(t,i){return function(e,s){i(e,s,t)}},k9=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 C9=new Zo("LinkedEditingInputVisible",!1);let S9=b9=class extends Hi{static get(t){return t.getContribution(b9.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=C9.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(69)||t.hasChanged(92))&&this.reinitialize(!1)}))),this._register(this._providers.onDidChange((()=>this.reinitialize(!1)))),this._register(this._editor.onDidChangeModelLanguage((()=>this.reinitialize(!0)))),this.reinitialize(!0)}reinitialize(t){const i=this._editor.getModel(),e=null!==i&&(this._editor.getOption(69)||this._editor.getOption(92))&&this._providers.has(i);if(e===this._enabled&&!t)return;if(this._enabled=e,this.clearRanges(),this._localToDispose.clear(),!e||null===i)return;this._localToDispose.add(Ji.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new ku(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 ku(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=Qn(t,r);o+=c,t=t.substr(c),r=r.substr(c);const l=Yn(t,r);h-=l,t=t.substr(0,t.length-l),r=r.substr(0,r.length-l),o===h&&0===r.length||n.push({range:new ps(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(t=!1){return k9(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return void this.clearRanges();const i=this._editor.getPosition();if(!this._enabled&&!t||this._editor.getSelections().length>1)return void this.clearRanges();const e=this._editor.getModel(),s=e.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===s){if(i.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(i))return}}this.clearRanges(),this._currentRequestPosition=i,this._currentRequestModelVersion=s;const n=wu((t=>k9(this,void 0,void 0,(function*(){try{const r=new Zi(!1),o=yield x9(this._providers,e,i,t);if(this._debounceInformation.update(e,r.elapsed()),n!==this._currentRequest)return;if(this._currentRequest=null,s!==e.getVersionId())return;let h=[];(null==o?void 0:o.ranges)&&(h=o.ranges),this._currentWordPattern=(null==o?void 0:o.wordPattern)||this._languageWordPattern;let c=!1;for(let t=0,e=h.length;t<e;t++)if(ps.containsPosition(h[t],i)){if(c=!0,0!==t){const i=h[t];h.splice(t,1),h.unshift(i)}break}if(!c)return void this.clearRanges();const l=h.map((t=>({range:t,options:b9.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Ei(t),this._currentRequest!==n&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=n,n}))}};function x9(t,i,e,s){return Du(t.ordered(i).map((t=>()=>k9(this,void 0,void 0,(function*(){try{return yield t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Ai(t)}})))),(t=>!!t&&a(null==t?void 0:t.ranges)))}S9.ID="editor.contrib.linkedEditing",S9.DECORATION=$M.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),S9=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}([y9(1,Jo),y9(2,Wg),y9(3,ud),y9(4,FF)],S9),nu(new(Xl.bindToContribution(S9.get))({id:"cancelLinkedEditingInput",precondition:C9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:gS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Om("editor.linkedEditingBackground",{dark:Mg.fromHex("#f00").transparent(.3),light:Mg.fromHex("#f00").transparent(.3),hcDark:Mg.fromHex("#f00").transparent(.3),hcLight:Mg.white},J(0,"Background color when the editor auto renames on type.")),su("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(Wg);return x9(s,i,e,ue.None)})),hu(S9.ID,S9,1),ru(class extends tu{constructor(){super({id:"editor.action.linkedEditing",label:J(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Lo.and(gS.writable,gS.hasRenameProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(Yr),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return ss.isUri(s)&&gs.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=S9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var D9=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 E9{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 D9(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 A9{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new E9(t,s)));i=A9._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];ps.areIntersectingOrTouching(n.range,o.range)?s++:ps.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 M9(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 A9(c(s));return e.isCancellationRequested?(t.dispose(),new A9([])):t}))}ao.registerCommand("_executeLinkProvider",((t,...i)=>D9(void 0,void 0,void 0,(function*(){let[e,s]=i;B(e instanceof ss),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(Wg),r=t.get(Xr).getModel(e);if(!r)return[];const o=yield M9(n,r,ue.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)yield o.links[t].resolve(ue.None);const h=o.links.slice(0);return o.dispose(),h}))));var L9,O9=function(t,i){return function(e,s){i(e,s,t)}};let F9=L9=class extends Hi{static get(t){return t.getContribution(L9.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 Mu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new IJ(t));this._register(r.onMouseMoveOrRelevantKeyDown((([t,i])=>{this._onEditorMouseMove(t,i)}))),this._register(r.onExecute((t=>{this.onEditorMouseUp(t)}))),this._register(r.onCancel((()=>{this.cleanUpActiveLinkDecoration()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(70)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))}))),this._register(t.onDidChangeModelContent((()=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))}))),this._register(t.onDidChangeModel((()=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)}))),this._register(t.onDidChangeModelLanguage((()=>{this.stop(),this.computeLinks.schedule(0)}))),this._register(this.providers.onDidChange((()=>{this.stop(),this.computeLinks.schedule(0)}))),this.computeLinks.schedule(0)}computeLinksNow(){return 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())}))}(this,void 0,void 0,(function*(){if(!this.editor.hasModel()||!this.editor.getOption(70))return;const t=this.editor.getModel();if(!t.isTooLargeForSyncing()&&this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=wu((i=>M9(this.providers,t,i)));try{const i=new Zi(!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}}}))}updateDecorations(t){const i="altKey"===this.editor.getOption(77),e=[],s=Object.keys(this.currentOccurrences);for(const t of s)e.push(this.currentOccurrences[t].decorationId);const n=[];if(t)for(const e of t)n.push(R9.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 R9(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(77);if(this.isEnabled(t,i)){this.cleanUpActiveLinkDecoration();const i=this.getLinkOccurrence(t.target.position);i&&this.editor.changeDecorations((t=>{i.activate(t,e),this.activeLinkDecorationId=i.decorationId}))}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const t="altKey"===this.editor.getOption(77);if(this.activeLinkDecorationId){const i=this.currentOccurrences[this.activeLinkDecorationId];i&&this.editor.changeDecorations((e=>{i.deactivate(e,t)})),this.activeLinkDecorationId=null}}onEditorMouseUp(t){if(!this.isEnabled(t))return;const i=this.getLinkOccurrence(t.target.position);i&&this.openLinkOccurrence(i,t.hasSideBySideModifier,!0)}openLinkOccurrence(t,i,e=!1){if(!this.openerService)return;const{link:s}=t;s.resolve(ue.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===Vc.file&&t.startsWith(`${Vc.file}:`)){const e=ss.parse(t);if(e.scheme===Vc.file){const s=AE(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=_E(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:e,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(J(0,"Failed to open this link because it is not well-formed: {0}",s.url.toString())):"missing"===i?this.notificationService.warn(J(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()}};F9.ID="editor.linkDetector",F9=L9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,AF),O9(2,vO),O9(3,Wg),O9(4,FF)],F9);const T9={general:$M.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:$M.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class R9{static decoration(t,i){return{range:t.range,options:R9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s=Object.assign({},e?T9.active:T9.general);return s.hoverMessage=function(t,i){const e=t.url&&/^command:/i.test(t.url.toString()),s=t.tooltip?t.tooltip:J(0,e?"Execute command":"Follow link"),n=J(0,i?ft?"cmd + click":"ctrl + click":ft?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const e=t.url.toString().match(/^command:([^?#]+)/);e&&(i=J(0,"Execute command {0}",e[1]))}return new H_("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),s,i).appendMarkdown(` (${n})`)}return(new H_).appendText(`${s} (${n})`)}(t,i),s}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,R9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,R9._getOptions(this.link,i,!1))}}hu(F9.ID,F9,1),ru(class extends tu{constructor(){super({id:"editor.action.openLink",label:J(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=F9.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 _9 extends Hi{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(116);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}_9.ID="editor.contrib.longLinesHelper",hu(_9.ID,_9,2);const I9=Om("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},J(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);Om("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},J(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),Om("editor.wordHighlightTextBackground",{light:I9,dark:I9,hcDark:I9,hcLight:I9},J(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 P9=Om("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Pm,hcLight:Pm},J(0,"Border color of a symbol during read-access, like reading a variable."));Om("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Pm,hcLight:Pm},J(0,"Border color of a symbol during write-access, like writing to a variable.")),Om("editor.wordHighlightTextBorder",{light:P9,dark:P9,hcDark:P9,hcLight:P9},J(0,"Border color of a textual occurrence for a symbol."));const N9=Om("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},J(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),B9=Om("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},J(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),$9=Om("editorOverviewRuler.wordHighlightTextForeground",{dark:gb,light:gb,hcDark:gb,hcLight:gb},J(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),j9=$M.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:vk(B9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),W9=$M.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:vk($9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),V9=$M.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:vk(gb),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),H9=$M.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),z9=$M.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:vk(N9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}});function U9(t){return t?H9:V9}kk(((t,i)=>{const e=t.getColor(Uv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var K9;function q9(t,i){const e=i.filter((i=>!t.find((t=>t.equals(i)))));if(e.length>=1){const t=e.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");nm(J(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class G9{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class Z9{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new Z9(t,i,!1,e.searchString,e.wholeWord,e.matchCase,null);let s,n,r=!1;const o=t.getSelections();1===o.length&&o[0].isEmpty()?(r=!0,s=!0,n=!0):(s=e.wholeWord,n=e.matchCase);const h=t.getSelection();let c,l=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,l=new ms(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new Z9(t,i,r,c,s,n,l)}constructor(t,i,e,s,n,r,o){this._editor=t,this.findController=i,this.isDisconnectedFromFindController=e,this.searchText=s,this.wholeWord=n,this.matchCase=r,this.currentMatch=o}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new G9(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 G9(i.slice(0,i.length-1).concat(t),t,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findNextMatch(this.searchText,i.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ms(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 G9(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 G9(i.slice(0,i.length-1).concat(t),t,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findPreviousMatch(this.searchText,i.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ms(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}selectAll(t){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();return this._editor.getModel().findMatches(this.searchText,t||!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1,1073741824)}}class J9 extends Hi{static get(t){return t.getContribution(J9.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=Z9.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 ms(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(!t7(this._editor.getModel(),i,e)){const t=this._editor.getModel(),e=[];for(let s=0,n=i.length;s<n;s++)e[s]=this._expandEmptyToWord(t,i[s]);return void this._editor.setSelections(e)}}}this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(t){if(!this._editor.hasModel())return;let i=null;const e=t.getState();if(e.isRevealed&&e.searchString.length>0&&e.isRegex){i=this._editor.getModel().findMatches(e.searchString,!e.searchScope||e.searchScope,e.isRegex,e.matchCase,e.wholeWord?this._editor.getOption(129):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(t),!this._session)return;i=this._session.selectAll(e.searchScope)}if(i.length>0){const t=this._editor.getSelection();for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s.range.intersectRanges(t)){i[e]=i[0],i[0]=s;break}}this._setSelections(i.map((t=>new ms(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}J9.ID="editor.contrib.multiCursorController";class Q9 extends tu{run(t,i){const e=J9.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=j2.get(i);if(r)this._run(e,r);else{const s=t.get(Zr).createInstance(j2,i);this._run(e,s),s.dispose()}q9(n,s.getCursorStates())}}}class Y9{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(ps.compareRangesUsingStarts)),this._cachedFindMatches}}let X9=K9=class extends Hi{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(107),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new Mu((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(107)}))),this._register(t.onDidChangeCursorSelection((t=>{this._isEnabled&&(t.selection.isEmpty()?3===t.reason?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())}))),this._register(t.onDidChangeModel((()=>{this._setState(null)}))),this._register(t.onDidChangeModelContent((()=>{this._isEnabled&&this.updateSoon.schedule()})));const e=j2.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(K9._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=J9.get(e);if(!n)return null;const r=j2.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(!t7(e.getModel(),t,i))return null}o=Z9.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 Y9(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(129):null,t)}_setState(t){if(this.state=t,!this.state)return void this._decorations.clear();if(!this.editor.hasModel())return;const i=this.editor.getModel();if(i.isTooLargeForTokenization())return;const e=this.state.findMatches(),s=this.editor.getSelections();s.sort(ps.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=ps.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&ps.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r=this._languageFeaturesService.documentHighlightProvider.has(i)&&this.editor.getOption(80),o=n.map((t=>({range:t,options:U9(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function t7(t,i,e){const s=i7(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!==i7(t,r,!e))return!1}return!0}function i7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}X9.ID="editor.contrib.selectionHighlighter",X9=K9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Wg)],X9),hu(J9.ID,J9,4),hu(X9.ID,X9,1),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorAbove",label:J(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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,ZC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorBelow",label:J(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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,ZC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:J(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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 ms(s,t,s,t))}t.endColumn>1&&e.push(new ms(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),q9(r,n.getCursorStates())}}),ru(class extends Q9{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:J(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2082,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:J(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:J(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:xe(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:J(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)}}),ru(class extends Q9{constructor(){super({id:"editor.action.selectHighlights",label:J(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:3114,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.changeAll",label:J(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Lo.and(gS.writable,gS.editorTextFocus),kbOpts:{kbExpr:gS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),ru(class extends tu{constructor(){super({id:"editor.action.addCursorsToBottom",label:J(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 ms(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),q9(o,r.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.addCursorsToTop",label:J(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 ms(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.focusNextCursor",label:J(0,"Focus Next Cursor"),description:{description:J(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),q9(n,s.getCursorStates()))}}),ru(class extends tu{constructor(){super({id:"editor.action.focusPreviousCursor",label:J(0,"Focus Previous Cursor"),description:{description:J(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),q9(n,s.getCursorStates()))}});var e7=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 s7={Visible:new Zo("parameterHintsVisible",!1),MultipleSignatures:new Zo("parameterHintsMultipleSignatures",!1)};function n7(t,i,e,s,n){return e7(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)}}))}ao.registerCommand("_executeSignatureHelpProvider",((t,...i)=>e7(void 0,void 0,void 0,(function*(){const[e,s,n]=i;B(ss.isUri(e)),B(gs.isIPosition(s)),B("string"==typeof n||!n);const r=t.get(Wg),o=yield t.get(to).createModelReference(e);try{const t=yield n7(r.signatureHelpProvider,o.object.textEditorModel,gs.lift(s),{triggerKind:Ss.Invoke,isRetrigger:!1,triggerCharacter:n},ue.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}}))));var r7;!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}}}(r7||(r7={}));class o7 extends Hi{constructor(t,i,e=o7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ie),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=r7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new zd,this.retriggerChars=new zd,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new ku(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=r7.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(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?0:i+1):this.cancel()}previous(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=0===i,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new r7.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:t})),this._onChangedHints.fire(this.state.hints))}doTrigger(t){return 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())}))}(this,void 0,void 0,(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(h7);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 r7.Pending(wu((t=>n7(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 r7.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=r7.Default),Ei(i),!1}}))}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return 1===this.state.type||2===this.state.type||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const t=this.editor.getModel();if(t)for(const i of this.providers.ordered(t)){for(const t of i.signatureHelpTriggerCharacters||[])if(t.length){const i=t.charCodeAt(0);this.triggerChars.add(i),this.retriggerChars.add(i)}for(const t of i.signatureHelpRetriggerCharacters||[])t.length&&this.retriggerChars.add(t.charCodeAt(0))}}onDidType(t){if(!this.triggerOnType)return;const i=t.length-1,e=t.charCodeAt(i);(this.triggerChars.has(e)||this.isTriggered&&this.retriggerChars.has(e))&&this.trigger({triggerKind:Ss.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ss.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ss.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(85).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function h7(t,i){switch(i.triggerKind){case Ss.Invoke:return i;case Ss.ContentChange:return t;default:return i}}o7.DEFAULT_DELAY=120;var c7,l7=function(t,i){return function(e,s){i(e,s,t)}};const u7=Pl,a7=GW("parameter-hints-next",ys.chevronDown,J(0,"Icon for show next parameter hint.")),d7=GW("parameter-hints-previous",ys.chevronUp,J(0,"Icon for show previous parameter hint."));let f7=c7=class 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 JG({editor:t},n,s)),this.keyVisible=s7.Visible.bindTo(e),this.keyMultipleSignatures=s7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=u7(".editor-widget.parameter-hints-widget"),i=Ol(t,u7(".phwrapper"));i.tabIndex=-1;const e=Ol(i,u7(".controls")),s=Ol(e,u7(".button"+eo.asCSSSelector(d7))),n=Ol(e,u7(".overloads")),r=Ol(e,u7(".button"+eo.asCSSSelector(a7)));this._register(Qc(s,"click",(t=>{Al(t),this.previous()}))),this._register(Qc(r,"click",(t=>{Al(t),this.next()})));const o=u7(".body"),h=new Zy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Ol(o,u7(".signature")),l=Ol(o,u7(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:l,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const u=()=>{if(!this.domNodes)return;const t=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};u(),this._register(Ji.chain(this.editor.onDidChangeConfiguration.bind(this.editor),(t=>t.filter((t=>t.hasChanged(50)))))(u)),this._register(this.editor.onDidLayoutChange((()=>this.updateMaxHeight()))),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout((()=>{var t;null===(t=this.domNodes)||void 0===t||t.element.classList.add("visible")}),100),this.editor.layoutContentWidget(this))}hide(){var t;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,null===(t=this.domNodes)||void 0===t||t.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(t){var i;if(this.renderDisposeables.clear(),!this.domNodes)return;const e=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",e),this.keyMultipleSignatures.set(e),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const s=t.signatures[t.activeSignature];if(!s)return;const n=Ol(this.domNodes.signature,u7(".code")),r=this.editor.getOption(50);n.style.fontSize=`${r.fontSize}px`,n.style.fontFamily=r.fontFamily;const o=null!==(i=s.activeParameter)&&void 0!==i?i:t.activeParameter;s.parameters.length>0?this.renderParameters(n,s,o):Ol(n,u7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=u7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}Ol(this.domNodes.docs,u7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)Ol(this.domNodes.docs,u7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);Ol(this.domNodes.docs,t.element)}const c=this.hasDocs(s,h);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,h){let t="";const i=s.parameters[o];t=Array.isArray(i.label)?s.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),s.documentation&&(t+="string"==typeof s.documentation?`, ${s.documentation}`:`, ${s.documentation.value}`),this.announcedLabel!==t&&(sm(J(0,"{0}, hint",t)),this.announcedLabel=t)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(t){const i=this.renderDisposeables.add(this.markdownRenderer.render(t,{asyncRenderCallback:()=>{var t;null===(t=this.domNodes)||void 0===t||t.scrollbar.scanDomNode()}}));return i.element.classList.add("markdown-docs"),i}hasDocs(t,i){return!!(i&&"string"==typeof i.documentation&&$(i.documentation).length>0||i&&"object"==typeof i.documentation&&$(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&$(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&$(t.documentation.value).length>0)}renderParameters(t,i,e){const[s,n]=this.getParameterLabelOffsets(i,e),r=document.createElement("span");r.textContent=i.label.substring(0,s);const o=document.createElement("span");o.textContent=i.label.substring(s,n),o.className="parameter active";const h=document.createElement("span");h.textContent=i.label.substring(n),Ol(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|^)${Rn(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 c7.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)}};f7.ID="editor.widget.parameterHintsWidget",f7=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}([l7(2,Jo),l7(3,AF),l7(4,Ba)],f7),Om("editorHoverWidget.highlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Foreground color of the active item in the parameter hint."));var g7,p7=function(t,i){return function(e,s){i(e,s,t)}};let m7=g7=class extends Hi{static get(t){return t.getContribution(g7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new o7(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 Mn((()=>this._register(i.createInstance(f7,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)}};m7.ID="editor.controller.parameterHints",m7=g7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([p7(1,Zr),p7(2,Wg)],m7),hu(m7.ID,m7,2),ru(class extends tu{constructor(){super({id:"editor.action.triggerParameterHints",label:J(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:gS.hasSignatureHelpProvider,kbOpts:{kbExpr:gS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=m7.get(i);null==e||e.trigger({triggerKind:Ss.Invoke})}});const v7=Xl.bindToContribution(m7.get);nu(new v7({id:"closeParameterHints",precondition:s7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:gS.focus,primary:9,secondary:[1033]}})),nu(new v7({id:"showPrevParameterHint",precondition:Lo.and(s7.Visible,s7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:gS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),nu(new v7({id:"showNextParameterHint",precondition:Lo.and(s7.Visible,s7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:gS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var w7=function(t,i){return function(e,s){i(e,s,t)}};const b7=new Zo("renameInputVisible",!1,J(0,"Whether the rename input widget is visible"));let y7=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=b7.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._disposables.add(e.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",J(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(Bm),o=t.getColor($m);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Lv))&&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(Wm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(jm))&&void 0!==s?s:"");const h=t.getColor(Vm);this._input.style.borderWidth=h?"1px":"0px",this._input.style.borderStyle=h?"solid":"none",this._input.style.borderColor=null!==(n=null==h?void 0:h.toString())&&void 0!==n?n:"none"}_updateFont(){if(!this._input||!this._label)return;const t=this._editor.getOption(50);this._input.style.fontFamily=t.fontFamily,this._input.style.fontWeight=t.fontWeight,this._input.style.fontSize=`${t.fontSize}px`,this._label.style.fontSize=.8*t.fontSize+"px"}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}beforeRender(){var t,i;const[e,s]=this._acceptKeybindings;return this._label.innerText=J(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(e))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(s))||void 0===i?void 0:i.getLabel()),null}afterRender(t){t||this.cancelInput(!0)}acceptInput(t){var i;null===(i=this._currentAcceptInput)||void 0===i||i.call(this,t)}cancelInput(t){var i;null===(i=this._currentCancelInput)||void 0===i||i.call(this,t)}getInput(t,i,e,s,n,r){this._domNode.classList.toggle("preview",n),this._position=new gs(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((()=>{var t;return this.cancelInput(!(null===(t=this._domNode)||void 0===t?void 0:t.ownerDocument.hasFocus()))}))),this._show()})).finally((()=>{o.dispose(),this._hide()}))}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout((()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))}),100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};y7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([w7(2,mk),w7(3,CC),w7(4,Jo)],y7);var k7,C7=function(t,i){return function(e,s){i(e,s,t)}},S7=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 x7{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 S7(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 ps(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:ps.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}))}provideRenameEdits(t,i){return S7(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,e,s){return S7(this,void 0,void 0,(function*(){const n=this._providers[i];if(!n)return{edits:[],rejectReason:e.join("\n")};const r=yield n.provideRenameEdits(this.model,this.position,t,s);return r?r.rejectReason?this._provideRenameEdits(t,i+1,e.concat(r.rejectReason),s):r:this._provideRenameEdits(t,i+1,e.concat(J(0,"No result.")),s)}))}}let D7=k7=class{static get(t){return t.getContribution(k7.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 de,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(y7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return S7(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),this._cts=new de,!this.editor.hasModel())return;const e=this.editor.getPosition(),s=new x7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new oK(this.editor,5,void 0,this._cts.token);let r;try{const t=s.resolveRenameLocation(n.token);this._progressService.showWhile(t,250),r=yield t}catch(i){return void(null===(t=iZ.get(this.editor))||void 0===t||t.showMessage(i||J(0,"An unknown error occurred while resolving rename location"),e))}finally{n.dispose()}if(!r)return;if(r.rejectReason)return void(null===(i=iZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new oK(this.editor,5,r.range,this._cts.token),h=this.editor.getSelection();let c=0,l=r.text.length;ps.isEmpty(h)||ps.spansMultipleLines(h)||!ps.containsRange(r.range,h)||(c=Math.max(0,h.startColumn-r.range.startColumn),l=Math.min(r.range.endColumn,h.endColumn)-r.range.startColumn);const u=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),a=yield this._renameInputField.getInput(r.range,r.text,c,l,u,o.token);if("boolean"==typeof a)return a&&this.editor.focus(),void o.dispose();this.editor.focus();const d=bu(s.provideRenameEdits(a.newName,o.token),o.token).then((t=>S7(this,void 0,void 0,(function*(){t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(ps.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:a.wantsPreview,label:J(0,"Renaming '{0}' to '{1}'",null==r?void 0:r.text,a.newName),code:"undoredo.rename",quotableLabel:J(0,"Renaming {0} to {1}",null==r?void 0:r.text,a.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&sm(J(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,a.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(J(0,"Rename failed to apply edits")),this._logService.error(t)}))))}))),(t=>{this._notificationService.error(J(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{o.dispose()}));return this._progressService.showWhile(d,250),d}))}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};D7.ID="editor.contrib.renameController",D7=k7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([C7(1,Zr),C7(2,vO),C7(3,yT),C7(4,nR),C7(5,Mh),C7(6,$g),C7(7,Wg)],D7),hu(D7.ID,D7,4),ru(class extends tu{constructor(){super({id:"editor.action.rename",label:J(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Lo.and(gS.writable,gS.hasRenameProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(Yr),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return ss.isUri(s)&&gs.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=D7.get(i);return e?e.run():Promise.resolve()}});const E7=Xl.bindToContribution(D7.get);function A7(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 At()||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),la.wrap(i)}(i)}nu(new E7({id:"acceptRenameInput",precondition:b7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:3}})),nu(new E7({id:"acceptRenameInputWithPreview",precondition:Lo.and(b7,Lo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:1027}})),nu(new E7({id:"cancelRenameInput",precondition:b7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:gS.focus,primary:9,secondary:[1033]}})),su("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get(Wg);return function(t,i,e,s){return S7(this,void 0,void 0,(function*(){const n=new x7(i,e,t),r=yield n.resolveRenameLocation(ue.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,ue.None)}))}(r,i,e,n)})),su("_executePrepareRename",(function(t,i,e){return S7(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get(Wg),n=new x7(i,e,s),r=yield n.resolveRenameLocation(ue.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),dh.as(Ka).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:J(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var M7=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 L7(t){return t&&!!t.data}function O7(t){return t&&Array.isArray(t.edits)}class F7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function T7(t,i){return t.has(i)}function R7(t,i,e,s,n){return M7(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=>M7(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&&(L7(r)||O7(r))||(r=null),new F7(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 _7{constructor(t,i){this.provider=t,this.tokens=i}}function I7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function P7(t,i,e,s){return M7(this,void 0,void 0,(function*(){const n=I7(t,i),r=yield Promise.all(n.map((t=>M7(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&L7(n)||(n=null),new _7(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}ao.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Xr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(Wg),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(uo).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),ao.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Xr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(Wg);if(!T7(n,s))return t.get(uo).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield R7(n,s,null,null,ue.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!L7(h))return;const c=A7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),ao.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss);const n=t.get(Xr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(Wg),o=I7(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!ps.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 P7(r,n,ps.lift(s),ue.None);return h?h.provider.getLegend():void 0})))),ao.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss),B(ps.isIRange(s));const n=t.get(Xr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(Wg),o=yield P7(r,n,ps.lift(s),ue.None);return o&&o.tokens?A7({id:0,type:"full",data:o.tokens.data}):void 0}))));const N7="editor.semanticHighlighting";function B7(t,i,e){var s;const n=null===(s=e.getValue(N7,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var $7,j7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},W7=function(t,i){return function(e,s){i(e,s,t)}};let V7=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 H7(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()];B7(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{B7(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(N7)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};V7=j7([W7(0,zF),W7(1,Xr),W7(2,mk),W7(3,Ta),W7(4,FF),W7(5,Wg)],V7);let H7=$7=class extends Hi{constructor(t,i,e,s,n){super(),this._semanticTokensStylingService=i,this._isDisposed=!1,this._model=t,this._provider=n.documentSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentSemanticTokens",{min:$7.REQUEST_MIN_DELAY,max:$7.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Mu((()=>this._fetchDocumentSemanticTokensNow()),$7.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeAttached((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeLanguage((()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)})));const r=()=>{$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const i of this._provider.all(t))"function"==typeof i.onDidChange&&this._documentProvidersChangeListeners.push(i.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};r(),this._register(this._provider.onDidChange((()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(e.onDidColorThemeChange((()=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!T7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new de,i=R7(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 Zi(!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(t,i,e,s){const n=this._currentDocumentResponse,r=()=>{(s.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed)t&&i&&t.releaseDocumentSemanticTokens(i.resultId);else if(t&&e){if(!i)return this._model.tokenization.setSemanticTokens(null,!0),void r();if(O7(i)){if(!n)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===i.edits.length)i={resultId:i.resultId,data:n.data};else{let t=0;for(const e of i.edits)t+=(e.data?e.data.length:0)-e.deleteCount;const s=n.data,r=new Uint32Array(s.length+t);let o=s.length,h=r.length;for(let t=i.edits.length-1;t>=0;t--){const c=i.edits[t];if(c.start>s.length)return e.warnInvalidEditStart(n.resultId,i.resultId,t,c.start,s.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=o-(c.start+c.deleteCount);l>0&&($7._copy(s,o-l,r,h-l,l),h-=l),c.data&&($7._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&$7._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(L7(i)){this._currentDocumentResponse=new z7(t,i.resultId,i.data);const n=WF(i,e,this._model.getLanguageId());if(s.length>0)for(const t of s)for(const i of n)for(const e of t.changes)i.applyEdit(e.range,e.text);this._model.tokenization.setSemanticTokens(n,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}else this._model.tokenization.setSemanticTokens(null,!1)}};H7.REQUEST_MIN_DELAY=300,H7.REQUEST_MAX_DELAY=2e3,H7=$7=j7([W7(1,zF),W7(2,mk),W7(3,FF),W7(4,Wg)],H7);class z7{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}tH(V7);var U7=function(t,i){return function(e,s){i(e,s,t)}};let K7=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 Mu((()=>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(N7)&&(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(!B7(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=wu((e=>Promise.resolve(P7(this._provider,t,i,e)))),n=new Zi(!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,WF(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};K7.ID="editor.contrib.viewportSemanticTokens",K7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([U7(1,zF),U7(2,mk),U7(3,Ta),U7(4,FF),U7(5,Wg)],K7),hu(K7.ID,K7,1);class q7{constructor(t=!0){this.selectSubwords=t}provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),this.selectSubwords&&this._addInWordRanges(i,t,s),this._addWordRanges(i,t,s),this._addWhitespaceLine(i,t,s),i.push({range:t.getFullModelRange()})}return e}_addInWordRanges(t,i,e){const s=i.getWordAtPosition(e);if(!s)return;const{word:n,startColumn:r}=s,o=e.column-r;let h=o,c=o,l=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(qn(t)&&Gn(l))break;l=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(Gn(t)&&qn(l))break;if(95===t||45===t)break;l=t}h<c&&t.push({range:new ps(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new ps(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 ps(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var G7,Z7=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 J7{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 J7(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let Q7=G7=class{static get(t){return t.getContribution(G7.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 Z7(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||(yield X7(this._languageFeaturesService.selectionRangeProvider,s,i.map((t=>t.getPosition())),this._editor.getOption(112),ue.None).then((t=>{var s;if(a(t)&&t.length===i.length&&this._editor.hasModel()&&e(this._editor.getSelections(),i,((t,i)=>t.equalsSelection(i)))){for(let e=0;e<t.length;e++)t[e]=t[e].filter((t=>t.containsPosition(i[e].getStartPosition())&&t.containsPosition(i[e].getEndPosition()))),t[e].unshift(i[e]);this._state=t.map((t=>new J7(0,t))),null===(s=this._selectionListener)||void 0===s||s.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition((()=>{var t;this._ignoreSelection||(null===(t=this._selectionListener)||void 0===t||t.dispose(),this._state=void 0)}))}}))),!this._state)return;this._state=this._state.map((i=>i.mov(t)));const n=this._state.map((t=>ms.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}))}};Q7.ID="editor.contrib.smartSelectController",Q7=G7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Wg)],Q7);class Y7 extends tu{constructor(t,i){super(i),this._forward=t}run(t,i){return Z7(this,void 0,void 0,(function*(){const t=Q7.get(i);t&&(yield t.run(this._forward))}))}}function X7(t,i,e,s,n){return Z7(this,void 0,void 0,(function*(){const r=t.all(i).concat(new q7(s.selectSubwords));1===r.length&&r.unshift(new y3);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(a(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])ps.isIRange(s.range)&&ps.containsPosition(s.range,e[i])&&h[i].push(ps.lift(s.range))}}),Ai));return yield Promise.all(o),h.map((t=>{if(0===t.length)return[];t.sort(((t,i)=>gs.isBefore(t.getStartPosition(),i.getStartPosition())?1:gs.isBefore(i.getStartPosition(),t.getStartPosition())||gs.isBefore(t.getEndPosition(),i.getEndPosition())?-1:gs.isBefore(i.getEndPosition(),t.getEndPosition())?1:0));const e=[];let n;for(const i of t)(!n||ps.containsRange(i,n)&&!ps.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 ps(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 ps(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}))}))}ao.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),hu(Q7.ID,Q7,4),ru(class extends Y7{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:J(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Expand Selection"),order:2}})}}),ru(class extends Y7{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:J(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Shrink Selection"),order:3}})}}),ao.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return Z7(this,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e));const n=t.get(Wg).selectionRangeProvider,r=yield t.get(to).createModelReference(e);try{return X7(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ue.None)}finally{r.dispose()}}))}));const t8=Object.freeze({View:{value:J(0,"View"),original:"View"},Help:{value:J(0,"Help"),original:"Help"},Test:{value:J(0,"Test"),original:"Test"},File:{value:J(0,"File"),original:"File"},Preferences:{value:J(0,"Preferences"),original:"Preferences"},Developer:{value:J(0,"Developer"),original:"Developer"}});class i8{constructor(t,i,e,s=null){this.startLineNumbers=t,this.endLineNumbers=i,this.lastLineRelativePosition=e,this.showEndForLine=s}equals(t){return!!t&&this.lastLineRelativePosition===t.lastLineRelativePosition&&this.showEndForLine===t.showEndForLine&&e(this.startLineNumbers,t.startLineNumbers)&&e(this.endLineNumbers,t.endLineNumbers)}}const e8=Ku("stickyScrollViewLayer",{createHTML:t=>t}),s8="data-sticky-line-index",n8="data-sticky-is-line",r8="data-sticky-is-folding-icon";class o8 extends Hi{constructor(t){super(),this._editor=t,this._foldingIconStore=new Vi,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof NJ),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const i=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&i(),t.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))}))),this._register(this._editor.onDidScrollChange((t=>{t.scrollLeftChanged&&i(),t.scrollWidthChanged&&this._updateWidgetWidth()}))),this._register(this._editor.onDidChangeModel((()=>{i(),this._updateWidgetWidth()}))),this._register(this._foldingIconStore),i(),this._register(this._editor.onDidLayoutChange((()=>{this._updateWidgetWidth()}))),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(t){return this._stickyLines.find((i=>i.lineNumber===t))}getCurrentLines(){return this._lineNumbers}setState(t,i,e=1/0){if((!this._previousState&&!t||this._previousState&&this._previousState.equals(t))&&e===1/0)return;this._previousState=t;const s=this._stickyLines;if(this._clearStickyWidget(),t&&this._editor._getViewModel()){if(t.startLineNumbers.length*this._lineHeight+t.lastLineRelativePosition>0){this._lastLineRelativePosition=t.lastLineRelativePosition;const i=[...t.startLineNumbers];null!==t.showEndForLine&&(i[t.showEndForLine]=t.endLineNumbers[t.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(s,i,e)}}_updateWidgetWidth(){const t=this._editor.getLayoutInfo();this._lineNumbersDomNode.style.width=`${t.contentLeft}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",this._editor.getScrollWidth()-t.verticalScrollbarWidth+"px"),this._rootDomNode.style.width=t.width-t.verticalScrollbarWidth+"px"}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),Gc(this._lineNumbersDomNode),Gc(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(t){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${t?.5:0}s`)}_setFoldingIconsVisibility(t){for(const i of this._stickyLines){const e=i.foldingIcon;e&&e.setVisible(!!t||e.isCollapsed)}}_renderRootNode(t,i,e=1/0){return 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())}))}(this,void 0,void 0,(function*(){const s=this._editor.getLayoutInfo();for(const[n,r]of this._lineNumbers.entries()){const o=t[n],h=r>=e||(null==o?void 0:o.lineNumber)!==r?this._renderChildNode(n,r,i,s):this._updateTopAndZIndexOfStickyLine(o);h&&(this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),this._stickyLines.push(h))}i&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const n=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;0!==n?(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${n}px`,this._linesDomNodeScrollable.style.height=`${n}px`,this._rootDomNode.style.height=`${n}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)):this._clearStickyWidget()}))}_setFoldingHoverListeners(){"mouseover"===this._editor.getOption(109)&&(this._foldingIconStore.add(Qc(this._lineNumbersDomNode,El.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Qc(this._lineNumbersDomNode,El.MOUSE_LEAVE,(()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)}))))}_renderChildNode(t,i,e,s){const n=this._editor._getViewModel();if(!n)return;const r=n.coordinatesConverter.convertModelPositionToViewPosition(new gs(i,1)).lineNumber,o=n.getViewLineRenderingData(r),h=this._editor.getOption(67);let c;try{c=op.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new dp(!0,!0,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,0,o.tokens,c,o.tabSize,o.startVisibleColumn,1,1,1,500,"none",!0,!0,null),u=new wa(2e3),a=mp(l,u);let d;d=e8?e8.createHTML(u.build()):u.build();const f=document.createElement("span");f.setAttribute(s8,String(t)),f.setAttribute(n8,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${i}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=d;const g=document.createElement("span");g.setAttribute(s8,String(t)),g.setAttribute("data-sticky-is-line-number",""),g.className="sticky-line-number",g.style.lineHeight=`${this._lineHeight}px`,g.style.width=`${s.contentLeft}px`;const p=document.createElement("span");1===h.renderType||3===h.renderType&&i%10==0?p.innerText=i.toString():2===h.renderType&&(p.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),p.className="sticky-line-number-inner",p.style.lineHeight=`${this._lineHeight}px`,p.style.width=`${s.lineNumbersWidth}px`,p.style.paddingLeft=`${s.lineNumbersLeft}px`,g.appendChild(p);const m=this._renderFoldingIconForLine(e,i);m&&g.appendChild(m.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(p),g.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const v=new h8(t,i,f,g,m,a.characterMapping);return this._updateTopAndZIndexOfStickyLine(v)}_updateTopAndZIndexOfStickyLine(t){var i;const e=t.index,s=t.lineDomNode,n=t.lineNumberDomNode,r=e===this._lineNumbers.length-1;s.style.zIndex=r?"0":"1",n.style.zIndex=r?"0":"1";const o=`${e*this._lineHeight+this._lastLineRelativePosition+((null===(i=t.foldingIcon)||void 0===i?void 0:i.isCollapsed)?1:0)}px`,h=e*this._lineHeight+"px";return s.style.top=r?o:h,n.style.top=r?o:h,t}_renderFoldingIconForLine(t,i){const e=this._editor.getOption(109);if(!t||"never"===e)return;const s=t.regions,n=s.findRange(i),r=s.getStartLineNumber(n);if(i!==r)return;const o=s.isCollapsed(n),h=new c8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(r8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=my(i.characterMapping,t,0);return new gs(i.lineNumber,e)}getLineNumberFromChildDomNode(t){var i,e;return null!==(e=null===(i=this._getRenderedStickyLineFromChildDomNode(t))||void 0===i?void 0:i.lineNumber)&&void 0!==e?e:null}_getRenderedStickyLineFromChildDomNode(t){const i=this.getLineIndexFromChildDomNode(t);return null===i||i<0||i>=this._stickyLines.length?null:this._stickyLines[i]}getLineIndexFromChildDomNode(t){const i=this._getAttributeValue(t,s8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,n8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,r8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class h8{constructor(t,i,e,s,n,r){this.index=t,this.lineNumber=i,this.lineDomNode=e,this.lineNumberDomNode=s,this.foldingIcon=n,this.characterMapping=r}}class c8{constructor(t,i,e,s){this.isCollapsed=t,this.foldingStartLine=i,this.foldingEndLine=e,this.dimension=s,this.domNode=document.createElement("div"),this.domNode.style.width=`${s}px`,this.domNode.style.height=`${s}px`,this.domNode.className=eo.asClassName(t?d4:a4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class l8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class u8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class a8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var d8,f8,g8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},p8=function(t,i){return function(e,s){i(e,s,t)}},m8=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"}(d8||(d8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(f8||(f8={}));let v8=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new ku(300)),this._updateOperation=this._register(new Vi);const n=new b8(e),r=new C8(this._editor,e),o=new k8(this._editor,i);switch(s){case d8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case d8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case d8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return m8(this,void 0,void 0,(function*(){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),yield this._updateScheduler.trigger((()=>m8(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 f8.CANCELED:return this._updateOperation.clear(),null;case f8.VALID:return s.stickyModel}}return null})))).catch((t=>(Ei(t),null)))}))}};v8=g8([p8(1,ud),p8(2,Wg)],v8);class w8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,f8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=wu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?f8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),f8.VALID):this._invalid())).then(void 0,(t=>(Ei(t),f8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let b8=class extends w8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return B4.create(this._languageFeaturesService.documentSymbolProvider,t,e)}createStickyModel(t,i,e,s){var n;const{stickyOutlineElement:r,providerID:o}=this._stickyModelFromOutlineModel(s,null===(n=this._stickyModel)||void 0===n?void 0:n.outlineProviderId);return new a8(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(Rt.first(t.children.values())instanceof N4){const s=Rt.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 l8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new l8(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 u8(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 l8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new u8(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 P4?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};b8=g8([p8(0,Wg)],b8);class y8 extends w8{constructor(t){super(),this._foldingLimitReporter=new x4(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new a8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new u8(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 u8(new l8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let k8=class extends y8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new h4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};k8=g8([p8(1,ud)],k8);let C8=class extends y8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return S4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=S4.getFoldingRangeProviders(this._languageFeaturesService,t);return new w4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};C8=g8([p8(1,Wg)],C8);var S8=function(t,i){return function(e,s){i(e,s,t)}},x8=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 D8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let E8=class extends Hi{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._register(new ie),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=this._register(new Vi),this._updateSoon=this._register(new Mu((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&this.readConfiguration()}))),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new v8(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel((()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()}))),this._sessionStore.add(this._editor.onDidChangeHiddenAreas((()=>this.update()))),this._sessionStore.add(this._editor.onDidChangeModelContent((()=>this._updateSoon.schedule()))),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>this.update()))),this.update())}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}update(){var t;return x8(this,void 0,void 0,(function*(){null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new de,yield this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}))}updateStickyModel(t){return x8(this,void 0,void 0,(function*(){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization())return void(this._model=null);const i=this._editor.getModel(),e=i.getVersionId(),s=yield this._stickyModelProvider.update(i,e,t);t.isCancellationRequested||(this._model=s)}))}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,n,r){if(0===i.children.length)return;let o=r;const h=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&h.push(e.range.startLineNumber)}const c=this.updateIndex(s(h,t.startLineNumber,((t,i)=>t-i))),l=this.updateIndex(s(h,t.startLineNumber+n,((t,i)=>t-i)));for(let s=c;s<=l;s++){const h=i.children[s];if(!h)return;if(h.range){const i=h.range.startLineNumber,s=h.range.endLineNumber;t.startLineNumber<=s+1&&i-1<=t.endLineNumber&&i!==o&&(o=i,e.push(new D8(i,s-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n,r)}}getCandidateStickyLinesIntersecting(t){var i,e;if(!(null===(i=this._model)||void 0===i?void 0:i.element))return[];let s=[];this.getCandidateStickyLinesIntersectingFromStickyModel(t,this._model.element,s,0,-1);const n=null===(e=this._editor._getViewModel())||void 0===e?void 0:e.getHiddenAreas();if(n)for(const t of n)s=s.filter((i=>!(i.startLineNumber>=t.startLineNumber&&i.endLineNumber<=t.endLineNumber+1)));return s}};E8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([S8(1,Wg),S8(2,ud)],E8);var A8,M8=function(t,i){return function(e,s){i(e,s,t)}},L8=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 O8=A8=class 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._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new o8(this._editor),this._stickyLineCandidateProvider=new E8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i8([],[],0),this._readConfiguration();const h=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(114)||t.hasChanged(72)||t.hasChanged(66)||t.hasChanged(109))&&this._readConfiguration()}))),this._register(Qc(h,El.CONTEXT_MENU,(t=>L8(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=gS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=gS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Ll(h));this._register(c.onDidBlur((()=>{!1===this._positionRevealed&&0===h.clientHeight?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(c.onDidFocus((()=>{this.focus()}))),this._registerMouseListeners(),this._register(Qc(h,El.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(A8.ID)}_disposeFocusStickyScrollStore(){var t;this._stickyScrollFocusedContextKey.set(!1),null===(t=this._focusDisposableStore)||void 0===t||t.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown)return this._onMouseDown=!1,void this._editor.focus();!0!==this._stickyScrollFocusedContextKey.get()&&(this._focused=!0,this._focusDisposableStore=new Vi,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(t){this._focusedStickyElementIndex=t?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._reveaInEditor(t,(()=>this._editor.revealPosition(t)))}_revealLineInCenterIfOutsideViewport(t){this._reveaInEditor(t,(()=>this._editor.revealLineInCenterIfOutsideViewport(t.lineNumber,0)))}_reveaInEditor(t,i){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,i(),this._editor.setSelection(ps.fromPositions(t)),this._editor.focus()}_registerMouseListeners(){const t=this._register(new Vi),i=this._register(new IJ(this._editor,{extractLineNumberFromMouseEvent:t=>{const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);return i?i.lineNumber:0}})),e=t=>{if(!this._editor.hasModel())return null;if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return null;const i=t.target.element;if(!i||i.innerText!==i.innerHTML)return null;const e=this._stickyScrollWidget.getEditorPositionFromNode(i);return e?{range:new ps(e.lineNumber,e.column,e.lineNumber,e.column+i.innerText.length),textElement:i}:null},s=this._stickyScrollWidget.getDomNode();this._register(Xc(s,El.CLICK,(t=>{if(t.ctrlKey||t.altKey||t.metaKey)return;if(!t.leftButton)return;if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i)return;const e=new gs(this._endLineNumbers[i],1);return void this._revealLineInCenterIfOutsideViewport(e)}if(this._stickyScrollWidget.isInFoldingIconDomNode(t.target)){const i=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);return void this._toggleFoldingRegionForLine(i)}if(!this._stickyScrollWidget.isInStickyLine(t.target))return;let i=this._stickyScrollWidget.getEditorPositionFromNode(t.target);if(!i){const e=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);if(null===e)return;i=new gs(e,1)}this._revealPosition(i)}))),this._register(Xc(s,El.MOUSE_MOVE,(t=>{if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i||null!==this._showEndForLine&&this._showEndForLine===i)return;return this._showEndForLine=i,void this._renderStickyScroll()}null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(Qc(s,El.MOUSE_LEAVE,(()=>{null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(i.onMouseMoveOrRelevantKeyDown((([i,s])=>{const n=e(i);if(!n||!i.hasTriggerModifier||!this._editor.hasModel())return void t.clear();const{range:r,textElement:o}=n;if(r.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===o.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=r,t.clear();const h=new de;let c;t.add(Wi((()=>h.dispose(!0)))),$Q(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new gs(r.startLineNumber,r.startColumn+1),h.token).then((i=>{if(!h.token.isCancellationRequested)if(0!==i.length){this._candidateDefinitionsLength=i.length;const e=o;c!==e?(t.clear(),c=e,c.style.textDecoration="underline",t.add(Wi((()=>{c.style.textDecoration="none"})))):c||(c=e,c.style.textDecoration="underline",t.add(Wi((()=>{c.style.textDecoration="none"}))))}else t.clear()}))}))),this._register(i.onCancel((()=>{t.clear()}))),this._register(i.onExecute((t=>L8(this,void 0,void 0,(function*(){if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return;const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);i&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:i.lineNumber,column:1})),this._instaService.invokeFunction(W6,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))))}_onContextMenu(t){const i=new Wh(t);this._contextMenuService.showContextMenu({menuId:bh.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(t){if(!this._foldingModel||null===t)return;const i=this._stickyScrollWidget.getStickyLineForLine(t),e=null==i?void 0:i.foldingIcon;if(!e)return;X2(this._foldingModel,Number.MAX_VALUE,[t]),e.isCollapsed=!e.isCollapsed;const s=this._editor.getTopForLineNumber(e.isCollapsed?e.foldingEndLine:e.foldingStartLine)-this._editor.getOption(66)*i.index+1;this._editor.setScrollTop(s),this._renderStickyScroll(t)}_readConfiguration(){const t=this._editor.getOption(114);if(!1===t.enabled)return this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),void(this._enabled=!1);t.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._sessionStore.add(this._editor.onDidLayoutChange((()=>this._onDidResize()))),this._sessionStore.add(this._editor.onDidChangeModelTokens((t=>this._onTokensChange(t)))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll((()=>{this._showEndForLine=null,this._renderStickyScroll()}))),this._enabled=!0),2===this._editor.getOption(67).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>{this._showEndForLine=null,this._renderStickyScroll()})))}_needsUpdate(t){const i=this._stickyScrollWidget.getCurrentLines();for(const e of i)for(const i of t.ranges)if(e>=i.fromLineNumber&&e<=i.toLineNumber)return!0;return!1}_onTokensChange(t){this._needsUpdate(t)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(.25*t)}_renderStickyScroll(t=1/0){var i,e;return L8(this,void 0,void 0,(function*(){const s=this._editor.getModel();if(!s||s.isTooLargeForTokenization())return this._foldingModel=null,void this._stickyScrollWidget.setState(void 0,null,t);const n=this._stickyLineCandidateProvider.getVersionId();if(void 0===n||n===s.getVersionId())if(this._foldingModel=null!==(e=yield null===(i=S4.get(this._editor))||void 0===i?void 0:i.getFoldingModel())&&void 0!==e?e:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.startLineNumbers.length)),this._focused)if(-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,-1!==this._focusedStickyElementIndex&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const i=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),0===this._stickyScrollWidget.lineNumberCount?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(i)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}else this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t)}))}findScrollWidgetState(){const t=this._editor.getOption(66),i=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=[],o=this._editor.getVisibleRanges();if(0!==o.length){const h=new l8(o[0].startLineNumber,o[o.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(h);for(const o of c){const h=o.startLineNumber,c=o.endLineNumber,l=o.nestingDepth;if(c-h>0){const o=(l-1)*t,u=l*t,a=this._editor.getBottomForLineNumber(h)-e,d=this._editor.getTopForLineNumber(c)-e,f=this._editor.getBottomForLineNumber(c)-e;if(o>d&&o<=f){n.push(h),r.push(c+1),s=f-u;break}if(u>a&&u<=f&&(n.push(h),r.push(c+1)),n.length===i)break}}}return this._endLineNumbers=r,new i8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};O8.ID="store.contrib.stickyScrollController",O8=A8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M8(1,AR),M8(2,Wg),M8(3,Zr),M8(4,ud),M8(5,FF),M8(6,Jo)],O8);const F8=100;hu(O8.ID,O8,1),Eh(class extends Dh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:J(0,"Toggle Sticky Scroll"),mnemonicTitle:J(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:t8.View,toggled:{condition:Lo.equals("config.editor.stickyScroll.enabled",!0),title:J(0,"Sticky Scroll"),mnemonicTitle:J(0,"&&Sticky Scroll")},menu:[{id:bh.CommandPalette},{id:bh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:bh.StickyScrollContext}]})}run(t){return 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())}))}(this,void 0,void 0,(function*(){const i=t.get(Ta),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}))}}),Eh(class extends eu{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:J(0,"Focus Sticky Scroll"),mnemonicTitle:J(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Lo.and(Lo.has("config.editor.stickyScroll.enabled"),gS.stickyScrollVisible),menu:[{id:bh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focus()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:J(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:16}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focusPrevious()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:J(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:18}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focusNext()}}),Eh(class extends eu{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:J(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:3}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.goToFocused()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectEditor",title:{value:J(0,"Select Editor"),original:"Select Editor"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:9}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.selectEditor()}});var T8,R8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},_8=function(t,i){return function(e,s){i(e,s,t)}};class I8{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 P8=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=Rt.slice(e,s),r=Rt.slice(e,0,s);let o=5;for(const e of Rt.concat(n,r)){if(e.score===L_.Default)continue;const s=new ps(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new I8(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(ue.None)}return i}};P8=R8([_8(5,g3)],P8);let N8=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;return 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())}))}(this,void 0,void 0,(function*(){if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(88,t);if(j5.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"!==j5.valueFor(r,h))return;let c,l,u=t.getWordAtPosition(i);if((null==u?void 0:u.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==u?void 0:u.word)&&!c)return;if(u||(u=t.getWordUntilPosition(i)),u.endColumn!==i.column)return;const a=t.getValueInRange(new ps(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,u))){const t=new C3(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=yield N5(this._languageFeatureService.completionProvider,t,i,new I5(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 S3(e.items,i.column,new C3(a,0),k3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new P8(t,i.lineNumber,u,r,e,this._suggestMemoryService)}return this._lastResult=l,l}))}handleItemDidShow(t,i){i.completion.resolve(ue.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(ps.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}}};N8=R8([_8(1,Wg),_8(2,EV),_8(3,g3)],N8);let B8=T8=class{constructor(t,i,e,s){if(1==++T8._counter){const n=s.createInstance(N8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));T8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--T8._counter&&(null===(t=T8._disposable)||void 0===t||t.dispose(),T8._disposable=void 0)}};B8._counter=0,B8=T8=R8([_8(1,Wg),_8(2,Yr),_8(3,Zr)],B8),hu("suggest.inlineCompletionsProvider",B8,0),ru(class extends tu{constructor(){super({id:"editor.action.forceRetokenize",label:J(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 Zi;e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class $8 extends Dh{constructor(){super({id:$8.ID,title:{value:J(0,"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!fm.getTabFocusMode();fm.setTabFocusMode(t),sm(J(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}$8.ID="editor.action.toggleTabFocusMode",Eh($8);let j8=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=Ol(t,Pl("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 ik(this.el,"click")),o=this._register(new ik(this.el,"keypress")),h=Ji.chain(o.event,(t=>t.map((t=>new Nh(t))).filter((t=>3===t.keyCode)))),c=this._register(new ik(this.el,Sm.Tap)).event;this._register(xm.addTarget(this.el));const l=Ji.any(r.event,h,c);this._register(l((t=>{this.enabled&&(Al(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};j8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,AF)],j8);var W8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},V8=function(t,i){return function(e,s){i(e,s,t)}};let H8=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(z8))}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)}};H8=W8([V8(1,Zr)],H8);let z8=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(JG,{}),this.element=Pl("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=Pl("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Gc(this.element)}show(t){Gc(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Ol(this.element,Pl("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Pl(`div${eo.asCSSSelector(t.icon)}`));const s=Ol(this.element,Pl("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Ol(this.element,Pl("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(j8,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Ol(this.element,Pl("div.action-container"));this.actionBar=this._register(new cN(n)),this.actionBar.push(this._register(new no("banner.close","Close Banner",eo.asClassName(XW),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};z8=W8([V8(0,Zr)],z8);var U8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},K8=function(t,i){return function(e,s){i(e,s,t)}},q8=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 G8=GW("extensions-warning-message",ys.warning,J(0,"Icon shown with a warning message in the extensions editor."));let Z8=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=e,this._highlighter=null,this._bannerClosed=!1,this._updateState=t=>{if(t&&t.hasMore){if(this._bannerClosed)return;const i=Math.max(t.ambiguousCharacterCount,t.nonBasicAsciiCharacterCount,t.invisibleCharacterCount);let e;if(t.nonBasicAsciiCharacterCount>=i)e={message:J(0,"This document contains many non-basic ASCII unicode characters"),command:new htt};else if(t.ambiguousCharacterCount>=i)e={message:J(0,"This document contains many ambiguous unicode characters"),command:new rtt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:J(0,"This document contains many invisible unicode characters"),command:new ott}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:G8,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(H8,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(124),this._register(e.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(124)&&(this._options=t.getOption(124),this._updateHighlighter())}))),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const t=function(t,i){return{nonBasicASCII:i.nonBasicASCII===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?kt:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new J8(this._editor,i,this._updateState,this._editorWorkerService):new Q8(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};Z8.ID="editor.contrib.unicodeHighlighter",Z8=U8([K8(1,MN),K8(2,DR),K8(3,Zr)],Z8);let J8=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 Mu((()=>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:ett.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return zL(i,t)?{reason:itt(i.getValueInRange(t.range),this._options),inComment:UL(i,t),inString:KL(i,t)}:null}};J8=U8([K8(3,MN)],J8);class Q8 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 Mu((()=>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=wf.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:ett.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 zL(i,t)?{reason:itt(e,this._options),inComment:UL(i,t),inString:KL(i,t)}:null}}let Y8=class{constructor(t,i,e){this._editor=t,this._languageService=i,this._openerService=e,this.hoverOrdinal=5}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=this._editor.getContribution(Z8.ID);if(!s)return[];const n=[],r=new Set;let o=300;for(const t of i){const i=s.getDecorationInfo(t);if(!i)continue;const h=e.getValueInRange(t.range).codePointAt(0),c=ttt(h);let l;switch(i.reason.kind){case 0:l=ur(i.reason.confusableWith)?J(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,ttt(i.reason.confusableWith.codePointAt(0))):J(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,ttt(i.reason.confusableWith.codePointAt(0)));break;case 1:l=J(0,"The character {0} is invisible.",c);break;case 2:l=J(0,"The character {0} is not a basic ASCII character.",c)}if(r.has(l))continue;r.add(l);const u={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},a=J(0,"Adjust settings"),d=`command:${ctt.ID}?${encodeURIComponent(JSON.stringify(u))}`,f=new H_("",!0).appendMarkdown(l).appendText(" ").appendLink(d,a);n.push(new VY(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return zY(t,i,this._editor,this._languageService,this._openerService)}};function X8(t){return`U+${t.toString(16).padStart(4,"0")}`}function ttt(t){let i=`\`${X8(t)}\``;return Cr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function itt(t,i){return wf.computeUnicodeHighlightReason(t,i)}Y8=U8([K8(1,Ba),K8(2,AF)],Y8);class ett{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=$M.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}}ett.instance=new ett;class stt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=J(0,"Disable Highlight In Comments")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class ntt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=J(0,"Disable Highlight In Strings")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class rtt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=J(0,"Disable Ambiguous Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}rtt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class ott extends tu{constructor(){super({id:ott.ID,label:J(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=J(0,"Disable Invisible Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}ott.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class htt extends tu{constructor(){super({id:htt.ID,label:J(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=J(0,"Disable Non ASCII Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}htt.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class ctt extends tu{constructor(){super({id:ctt.ID,label:J(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(t,i,e){return q8(this,void 0,void 0,(function*(){const{codePoint:i,reason:s,inString:n,inComment:r}=e,o=String.fromCodePoint(i),h=t.get(Ij),c=t.get(Ta),l=[];if(0===s.kind)for(const t of s.notAmbiguousInLocales)l.push({label:J(0,'Allow unicode characters that are more common in the language "{0}".',t),run:()=>q8(this,void 0,void 0,(function*(){ltt(c,[t])}))});if(l.push({label:function(t){return Cr.isInvisibleCharacter(t)?J(0,"Exclude {0} (invisible character) from being highlighted",X8(t)):J(0,"Exclude {0} from being highlighted",`${X8(t)} "${o}"`)}(i),run:()=>function(t,i){return q8(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)}))}(c,[i])}),r){const t=new stt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(n){const t=new ntt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}if(0===s.kind){const t=new rtt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(1===s.kind){const t=new ott;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(2===s.kind){const t=new htt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(s);const u=yield h.pick(l,{title:J(0,"Configure Unicode Highlight Options")});u&&(yield u.run())}))}}function ltt(t,i){var e;return q8(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)}))}ctt.ID="editor.action.unicodeHighlight.showExcludeOptions",ru(rtt),ru(ott),ru(htt),ru(ctt),hu(Z8.ID,Z8,1),bY.register(Y8);var utt=function(t,i){return function(e,s){i(e,s,t)}};const att="ignoreUnusualLineTerminators";let dtt=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(125),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}_checkForUnusualLineTerminators(){return 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())}))}(this,void 0,void 0,(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,att)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(90))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let e;try{this._isPresentingDialog=!0,e=yield this._dialogService.confirm({title:J(0,"Unusual Line Terminators"),message:J(0,"Detected unusual line terminators"),detail:J(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`.",FE(t.uri)),primaryButton:J(0,"&&Remove Unusual Line Terminators"),cancelButton:J(0,"Ignore")})}finally{this._isPresentingDialog=!1}e.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,att,!0)}(this._codeEditorService,t)}))}};dtt.ID="editor.contrib.unusualLineTerminatorsDetector",dtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([utt(1,lF),utt(2,Yr)],dtt),hu(dtt.ID,dtt,1);var ftt,gtt=function(t,i){return function(e,s){i(e,s,t)}};const ptt=new Zo("hasWordHighlights",!1);function mtt(t,i,e,s){return Du(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),a)}class vtt{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=wu((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new ps(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 wtt extends vtt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return mtt(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class btt extends vtt{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return Su(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:xs.Text})))}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}su("_executeDocumentHighlights",((t,i,e)=>mtt(t.get(Wg).documentHighlightProvider,i,e,ue.None)));class ytt{constructor(t,i,e,s){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.linkedHighlighters=e,this._hasWordHighlights=ptt.bindTo(s),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),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(80);this.occurrencesHighlight!==t&&(this.occurrencesHighlight=t,this._stopAll())}))),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(ps.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&&sm(`${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&&sm(`${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 wtt(i,e,s,t):new btt(i,e,s)}(this.providers,this.model,this.editor.getSelection(),this.editor.getOption(129)),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===xs.Write?j9:i===xs.Text?W9:z9)});var i;this.decorations.set(t),this._hasWordHighlights.set(this.hasDecorations());for(const i of this.linkedHighlighters())(null==i?void 0:i.editor.getModel())===this.editor.getModel()&&(i._stopAll(),i.decorations.set(t),i._hasWordHighlights.set(i.hasDecorations()))}dispose(){this._stopAll(),this.toUnhook.dispose()}}let ktt=ftt=class extends Hi{static get(t){return t.getContribution(ftt.ID)}constructor(t,i,e){super(),this.wordHighlighter=null,this.linkedContributions=new Set;const s=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this.wordHighlighter=new ytt(t,e.documentHighlightProvider,(()=>Rt.map(this.linkedContributions,(t=>t.wordHighlighter))),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()}};ktt.ID="editor.contrib.wordHighlighter",ktt=ftt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([gtt(1,Jo),gtt(2,Wg)],ktt);class Ctt extends tu{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=ktt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}hu(ktt.ID,ktt,0),ru(class extends Ctt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:J(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:ptt,kbOpts:{kbExpr:gS.editorTextFocus,primary:65,weight:100}})}}),ru(class extends Ctt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:J(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:ptt,kbOpts:{kbExpr:gS.editorTextFocus,primary:1089,weight:100}})}}),ru(class extends tu{constructor(){super({id:"editor.action.wordHighlight.trigger",label:J(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:ptt.toNegated(),kbOpts:{kbExpr:gS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=ktt.get(i);s&&s.restoreViewState(!0)}});class Stt extends Xl{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=Yd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=new gs(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=>FC.fromModelSelection(t)))),1===r.length){const t=new gs(r[0].positionLineNumber,r[0].positionColumn);i.revealPosition(t,0)}}_moveTo(t,i,e){return e?new ms(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new ms(i.lineNumber,i.column,i.lineNumber,i.column)}}class xtt extends Stt{_move(t,i,e,s){return KC.moveWordLeft(t,i,e,s)}}class Dtt extends Stt{_move(t,i,e,s){return KC.moveWordRight(t,i,e,s)}}class Ett extends Xl{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(ud);if(!i.hasModel())return;const n=Yd(i.getOption(129)),r=i.getModel(),o=i.getSelections(),h=i.getOption(6),c=i.getOption(11),l=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),u=i._getViewModel(),a=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(9),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:l,autoClosedCharacters:u.getCursorAutoClosedCharacters()},this._wordNavigationType);return new BC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class Att extends Ett{_delete(t,i){return KC.deleteWordLeft(t,i)||new ps(1,1,1,1)}}class Mtt extends Ett{_delete(t,i){const e=KC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),nu(new class extends xtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),nu(new class extends Dtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),nu(new class extends Dtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:gS.writable})}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:gS.writable})}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:gS.writable})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:gS.writable})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),ru(class extends tu{constructor(){super({id:"deleteInsideWord",precondition:gS.writable,label:J(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=Yd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=KC.deleteInsideWord(s,n,t);return new BC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class Ltt extends Stt{_move(t,i,e,s){return qC.moveWordPartLeft(t,i,e)}}ao.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),ao.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Ott extends Stt{_move(t,i,e,s){return qC.moveWordPartRight(t,i,e)}}nu(new class extends Ett{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return qC.deleteWordPartLeft(t)||new ps(1,1,1,1)}}),nu(new class extends Ett{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=qC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}),nu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),nu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),nu(new class extends Ott{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),nu(new class extends Ott{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Ftt extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=iZ.get(this.editor);if(t&&this.editor.hasModel()){let i=this.editor.getOptions().get(91);i||(i=new H_(J(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"))),t.showMessage(i,this.editor.getPosition())}}}Ftt.ID="editor.contrib.readOnlyMessageController",hu(Ftt.ID,Ftt,2);class Ttt extends Hi{constructor(t){super(),this.editor=t,this.widget=null,wt&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(90);!this.widget&&t?this.widget=new Rtt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Ttt.ID="editor.contrib.iPadShowKeyboard";class Rtt extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Qc(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Qc(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Rtt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Rtt.ID="editor.contrib.ShowKeyboardWidget",hu(Ttt.ID,Ttt,3);var _tt,Itt=function(t,i){return function(e,s){i(e,s,t)}};let Ptt=_tt=class extends Hi{static get(t){return t.getContribution(_tt.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(Ns.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 Ntt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Ptt.ID="editor.contrib.inspectTokens",Ptt=_tt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Itt(1,aV),Itt(2,Ba)],Ptt);class Ntt 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=Ns.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>tp,tokenize:(t,e,s)=>ip(i,s),tokenizeEncoded:(t,i,e)=>ep(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 Ntt._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)),Tl(this._domNode,Pl("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),Pl("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Ol(this._domNode,Pl("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Ol(this._domNode,Pl("table.tm-metadata-table",void 0,Pl("tbody",void 0,Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"language"),Pl("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"token type"),Pl("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"font style"),Pl("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"foreground"),Pl("td.tm-metadata-value",void 0,`${o?Mg.Format.CSS.formatHex(o.foreground):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"background"),Pl("td.tm-metadata-value",void 0,`${o?Mg.Format.CSS.formatHex(o.background):"-?-"}`))))),Ol(this._domNode,Pl("hr.tokens-inspect-separator")),e<i.tokens1.length&&Ol(this._domNode,Pl("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ns.getColorMap(),e=sp.getLanguageId(t),s=sp.getTokenType(t),n=sp.getFontStyle(t),r=sp.getForeground(t),o=sp.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]}}}Ntt._ID="editor.contrib.inspectTokensWidget",hu(Ptt.ID,Ptt,4),ru(class extends tu{constructor(){super({id:"editor.action.inspectTokens",label:vR.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=Ptt.get(i);null==e||e.launch()}});var Btt,$tt=function(t,i){return function(e,s){i(e,s,t)}};let jtt=Btt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=dh.as(Fj)}provide(t){const i=new Vi;return i.add(t.onDidAccept((()=>{const[i]=t.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),i.add(t.onDidChangeValue((t=>{const i=this.registry.getQuickAccessProvider(t.substr(Btt.PREFIX.length));i&&i.prefix&&i.prefix!==Btt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Btt.PREFIX)),i}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort(((t,i)=>t.prefix.localeCompare(i.prefix))).flatMap((t=>this.createPicks(t)))}createPicks(t){return t.helpEntries.map((i=>{const e=i.prefix||t.prefix,s=e||"…";return{prefix:e,label:s,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:J(0,"{0}, {1}",s,i.description),description:i.description}}))}};jtt.PREFIX="?",jtt=Btt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$tt(0,Ij),$tt(1,CC)],jtt),dh.as(Fj).registerQuickAccessProvider({ctor:jtt,prefix:"",helpEntries:[{description:bR.helpQuickAccessActionLabel}]});class Wtt{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){var e;const s=new Vi,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const r={editor:n},o=uK(n);if(o){let t=null!==(e=n.saveViewState())&&void 0!==e?e:void 0;s.add(o.onDidChangeCursorPosition((()=>{var i;t=null!==(i=n.saveViewState())&&void 0!==i?i:void 0}))),r.restoreViewState=()=>{t&&n===this.activeTextEditorControl&&n.restoreViewState(t)},s.add(Ni(i.onCancellationRequested)((()=>{var t;return null===(t=r.restoreViewState)||void 0===t?void 0:t.call(r)})))}s.add(Wi((()=>this.clearDecorations(n)))),s.add(this.provideWithTextEditor(r,t,i))}else s.add(this.provideWithoutTextEditor(t,i));return s}canProvideWithTextEditor(t){return!0}gotoLocation({editor:t},i){t.setSelection(i.range),t.revealRangeInCenter(i.range,0),i.preserveFocus||t.focus();const e=t.getModel();e&&"getLineContent"in e&&nm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return lK(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:vk(Zk),position:Xd.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 Vtt extends Wtt{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=J(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(Vtt.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=uK(s);return o&&2===o.getOptions().get(67).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,e){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,e)?J(0,"Go to line {0} and character {1}.",i,e):J(0,"Go to line {0}.",i);const s=t.getPosition()||{lineNumber:1,column:1},n=this.lineCount(t);return n>1?J(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",s.lineNumber,s.column,n):J(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",s.lineNumber,s.column)}isValidLineNumber(t,i){return!(!i||"number"!=typeof i)&&i>0&&i<=this.lineCount(t)}isValidColumn(t,i,e){if(!e||"number"!=typeof e)return!1;const s=this.getModel(t);if(!s)return!1;const n={lineNumber:i,column:e};return s.validatePosition(n).equals(n)}lineCount(t){var i,e;return null!==(e=null===(i=this.getModel(t))||void 0===i?void 0:i.getLineCount())&&void 0!==e?e:0}}Vtt.PREFIX=":";let Htt=class extends Vtt{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Ji.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};Htt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Yr)],Htt);class ztt extends tu{constructor(){super({id:ztt.ID,label:wR.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Ij).quickAccess.show(Htt.PREFIX)}}ztt.ID="editor.action.gotoLine",ru(ztt),dh.as(Fj).registerQuickAccessProvider({ctor:Htt,prefix:Htt.PREFIX,helpEntries:[{description:wR.gotoLineActionLabel,commandId:ztt.ID}]});const Utt=[void 0,[]];function Ktt(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]=qtt(t,o,e,s);if("number"!=typeof i)return Utt;n+=i,r.push(...h)}return[n,Gtt(r)]}(t,i.values,e,s):qtt(t,i,e,s)}function qtt(t,i,e,s){const n=F_(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],v_(n)]:Utt}function Gtt(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 Ztt(t){return t.startsWith('"')&&t.endsWith('"')}function Jtt(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=Qtt(t),r=e.indexOf(Je)>=0,o=Ztt(t);let h;const c=t.split(" ");if(c.length>1)for(const t of c){const i=Ztt(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=Qtt(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 Qtt(t){let i;i=t.replace(dt?/\//g:/\\/g,Je);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function Ytt(t){return Array.isArray(t)?Jtt(t.map((t=>t.original)).join(" ")):Jtt(t.original)}Object.freeze({score:0});var Xtt,tit=function(t,i){return function(e,s){i(e,s,t)}},iit=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 eit=Xtt=class extends Wtt{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,J(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,e,s){const n=new Vi;return this.provideLabelPick(e,J(0,"The active text editor does not provide symbol information.")),(()=>{iit(this,void 0,void 0,(function*(){(yield this.waitForLanguageSymbolRegistry(i,n))&&!s.isCancellationRequested&&n.add(this.doProvideWithEditorSymbols(t,i,e,s))}))})(),n}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}waitForLanguageSymbolRegistry(t,i){return iit(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(t,i,e,s){var n;const r=t.editor,o=new Vi;o.add(e.onDidAccept((i=>{const[s]=e.selectedItems;s&&s.range&&(this.gotoLocation(t,{range:s.range.selection,keyMods:e.keyMods,preserveFocus:i.inBackground}),i.inBackground||e.hide())}))),o.add(e.onDidTriggerItemButton((({item:i})=>{i&&i.range&&(this.gotoLocation(t,{range:i.range.selection,keyMods:e.keyMods,forceSideBySide:!0}),e.hide())})));const h=this.getDocumentSymbols(i,s);let c;const l=t=>iit(this,void 0,void 0,(function*(){null==c||c.dispose(!0),e.busy=!1,c=new de(s),e.busy=!0;try{const i=Jtt(e.value.substr(Xtt.PREFIX.length).trim()),n=yield this.doGetSymbolPicks(h,i,void 0,c.token);if(s.isCancellationRequested)return;if(n.length>0){if(e.items=n,t&&0===i.original.length){const i=Df(n,(i=>Boolean("separator"!==i.type&&i.range&&ps.containsPosition(i.range.decoration,t))));i&&(e.activeItems=[i])}}else this.provideLabelPick(e,J(0,i.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{s.isCancellationRequested||(e.busy=!1)}}));return o.add(e.onDidChangeValue((()=>l(void 0)))),l(null===(n=r.getSelection())||void 0===n?void 0:n.getPosition()),o.add(e.onDidChangeActive((()=>{const[t]=e.activeItems;t&&t.range&&(r.revealRangeInCenter(t.range.selection,0),this.addDecorations(r,t.range.decoration))}))),o}doGetSymbolPicks(t,i,e,s){var n,r;return iit(this,void 0,void 0,(function*(){const o=yield t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(Xtt.SCOPE_PREFIX),c=h?1:0;let l,u,a;i.values&&i.values.length>1?(l=Ytt(i.values[0]),u=Ytt(i.values.slice(1))):l=i;const d=null===(r=null===(n=this.options)||void 0===n?void 0:n.openSideBySideDirection)||void 0===r?void 0:r.call(n);d&&(a=[{iconClass:eo.asClassName("right"===d?ys.splitHorizontal:ys.splitVertical),tooltip:J(0,"right"===d?"Open to the Side":"Open to the Bottom")}]);const f=[];for(let w=0;w<o.length;w++){const b=o[w],y=_n(b.name),k=`$(${Ts.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==e?void 0:e.extraContainerLabel)&&(A=A?`${e.extraContainerLabel} • ${A}`:e.extraContainerLabel),i.original.length>c){let L=!1;if(l!==i&&([S,x]=Ktt(k,Object.assign(Object.assign({},i),{values:void 0}),c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=Ktt(k,l,c,C),"number"!=typeof S))continue;if(!L&&u){if(A&&u.original.length>0&&([D,E]=Ktt(A,u)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const M=b.tags&&b.tags.indexOf(1)>=0;f.push({index:w,kind:b.kind,score:S,label:k,ariaLabel:(g=b.name,p=b.kind,J(0,"{0} ({1})",g,Fs[p])),description:A,highlights:M?void 0:{label:x,description:E},range:{selection:ps.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:M,buttons:a})}var g,p;const m=f.sort(((t,i)=>h?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let v=[];if(h){let O,F,T=0;function R(){F&&"number"==typeof O&&T>0&&(F.label=Fn(nit[O]||sit,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:J(0,"symbols ({0})",f.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=(nit[t.kind]||sit).localeCompare(nit[i.kind]||sit);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return iit(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};eit.PREFIX="@",eit.SCOPE_PREFIX=":",eit.PREFIX_BY_CATEGORY=`${Xtt.PREFIX}${Xtt.SCOPE_PREFIX}`,eit=Xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tit(0,Wg),tit(1,$4)],eit);const sit=J(0,"properties ({0})"),nit={5:J(0,"methods ({0})"),11:J(0,"functions ({0})"),8:J(0,"constructors ({0})"),12:J(0,"variables ({0})"),4:J(0,"classes ({0})"),22:J(0,"structs ({0})"),23:J(0,"events ({0})"),24:J(0,"operators ({0})"),10:J(0,"interfaces ({0})"),2:J(0,"namespaces ({0})"),3:J(0,"packages ({0})"),25:J(0,"type parameters ({0})"),1:J(0,"modules ({0})"),6:J(0,"properties ({0})"),9:J(0,"enumerations ({0})"),21:J(0,"enumeration members ({0})"),14:J(0,"strings ({0})"),0:J(0,"files ({0})"),17:J(0,"arrays ({0})"),15:J(0,"numbers ({0})"),16:J(0,"booleans ({0})"),18:J(0,"objects ({0})"),19:J(0,"keys ({0})"),7:J(0,"fields ({0})"),13:J(0,"constants ({0})")};var rit=function(t,i){return function(e,s){i(e,s,t)}};let oit=class extends eit{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Ji.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};oit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([rit(0,Yr),rit(1,Wg),rit(2,$4)],oit);class hit extends tu{constructor(){super({id:hit.ID,label:kR.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:gS.hasDocumentSymbolProvider,kbOpts:{kbExpr:gS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Ij).quickAccess.show(eit.PREFIX,{itemActivation:_j.NONE})}}function cit(t,i){return i&&(t.stack||t.stacktrace)?J(0,"{0}: {1}",uit(t),lit(t.stack)||lit(t.stacktrace)):uit(t)}function lit(t){return Array.isArray(t)?t.join("\n"):t}function uit(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?J(0,"A system error occurred ({0})",t.message):t.message||J(0,"An unknown error occurred. Please consult the log for more details.")}function ait(t=null,i=!1){if(!t)return J(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const e=c(t),s=ait(e[0],i);return e.length>1?J(0,"{0} ({1} errors in total)",s,e.length):s}if(L(t))return t;if(t.detail){const e=t.detail;if(e.error)return cit(e.error,i);if(e.exception)return cit(e.exception,i)}return t.stack?cit(t,i):t.message?t.message:J(0,"An unknown error occurred. Please consult the log for more details.")}hit.ID="editor.action.quickOutline",ru(hit),dh.as(Fj).registerQuickAccessProvider({ctor:oit,prefix:eit.PREFIX,helpEntries:[{description:kR.quickOutlineActionLabel,prefix:eit.PREFIX,commandId:hit.ID},{description:kR.quickOutlineByCategoryActionLabel,prefix:eit.PREFIX_BY_CATEGORY}]});class dit{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(t,i){const e=this.computeEmbedding(t),s=new Map,n=[];for(const[t,r]of this.documents){if(i.isCancellationRequested)return[];for(const i of r.chunks){const r=this.computeSimilarityScore(i,e,s);r>0&&n.push({key:t,score:r})}}return n}static termFrequencies(t){return function(t){var i;const e=new Map;for(const s of t)e.set(s,(null!==(i=e.get(s))&&void 0!==i?i:0)+1);return e}(dit.splitTerms(t))}static*splitTerms(t){const i=t=>t.toLowerCase();for(const[e]of t.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield i(e);const t=e.split(/(?<=[a-z])(?=[A-Z])/g);if(t.length>1)for(const e of t)e.length>2&&/\p{Letter}{3,}/gu.test(e)&&(yield i(e))}}updateDocuments(t){var i;for(const{key:i}of t)this.deleteDocument(i);for(const e of t){const t=[];for(const s of e.textChunks){const e=dit.termFrequencies(s);for(const t of e.keys())this.chunkOccurrences.set(t,(null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0)+1);t.push({text:s,tf:e})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(t){const i=this.documents.get(t);if(i){this.documents.delete(t),this.chunkCount-=i.chunks.length;for(const t of i.chunks)for(const i of t.tf.keys()){const t=this.chunkOccurrences.get(i);if("number"==typeof t){const e=t-1;e<=0?this.chunkOccurrences.delete(i):this.chunkOccurrences.set(i,e)}}}}computeSimilarityScore(t,i,e){let s=0;for(const[n,r]of Object.entries(i)){const i=t.tf.get(n);if(!i)continue;let o=e.get(n);"number"!=typeof o&&(o=this.computeIdf(n),e.set(n,o)),s+=i*o*r}return s}computeEmbedding(t){const i=dit.termFrequencies(t);return this.computeTfidf(i)}computeIdf(t){var i;const e=null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(t){const i=Object.create(null);for(const[e,s]of t){const t=this.computeIdf(e);t>0&&(i[e]=s*t)}return i}}var fit,git=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 pit(t){return Array.isArray(t.items)}function mit(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"}(fit||(fit={}));class vit 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=()=>git(this,void 0,void 0,(function*(){const s=o.value=new Vi;null==r||r.dispose(!0),t.busy=!1,r=new de(i);const n=r.token,h=t.value.substr(this.prefix.length).trim(),c=this._getPicks(h,s,n,e),l=(i,e)=>{var s;let n,r;if(pit(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=j(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},u=i=>git(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>git(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield Su(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})))(),(()=>git(this,void 0,void 0,(function*(){t.busy=!0;try{const r=yield i.additionalPicks;if(n.isCancellationRequested)return;let o,h,c,u;if(pit(i.picks)?(o=i.picks.items,h=i.picks.active):o=i.picks,pit(r)?(c=r.items,u=r.active):c=r,c.length>0||!e){let i;if(!h&&!u){const e=t.activeItems[0];e&&-1!==o.indexOf(e)&&(i=e)}l({items:[...o,...c],active:h||u||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(mit(c))yield u(c);else if(c instanceof Promise){t.busy=!0;try{const i=yield c;if(n.isCancellationRequested)return;mit(i)?yield u(i):l(i)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)}));return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((({button:e,item:s})=>git(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 fit.NO_ACTION:break;case fit.CLOSE_PICKER:t.hide();break;case fit.REFRESH_PICKER:h();break;case fit.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 wit,bit,yit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},kit=function(t,i){return function(e,s){i(e,s,t)}},Cit=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 Sit=wit=class extends vit{constructor(t,i,e,s,n,r){super(wit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(xit)),this.options=t}_getPicks(t,i,e,s){var n,r,o,h;return Cit(this,void 0,void 0,(function*(){const i=yield this.getCommandPicks(e);if(e.isCancellationRequested)return[];const c=Ni((()=>{const s=new dit;return s.updateDocuments(i.map((t=>({key:t.commandId,textChunks:[t.label+(t.commandAlias?` ${t.commandAlias}`:"")]})))),function(t){var i,e;const s=t.slice(0);s.sort(((t,i)=>i.score-t.score));const n=null!==(e=null===(i=s[0])||void 0===i?void 0:i.score)&&void 0!==e?e:0;if(n>0)for(const t of s)t.score/=n;return s}(s.calculateScores(t,e)).filter((t=>t.score>wit.TFIDF_THRESHOLD)).slice(0,wit.TFIDF_MAX_RESULTS)})),l=[];for(const s of i){const i=null!==(n=wit.WORD_FILTER(t,s.label))&&void 0!==n?n:void 0,o=s.commandAlias&&null!==(r=wit.WORD_FILTER(t,s.commandAlias))&&void 0!==r?r:void 0;if(i||o)s.highlights={label:i,detail:this.options.showAlias?o:void 0},l.push(s);else if(t===s.commandId)l.push(s);else if(t.length>=3){const t=c();if(e.isCancellationRequested)return[];const i=t.find((t=>t.key===s.commandId));i&&(s.tfIdfScore=i.score,l.push(s))}}const u=new Map;for(const t of l){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}l.sort(((t,i)=>{if(t.tfIdfScore&&i.tfIdfScore)return t.tfIdfScore===i.tfIdfScore?t.label.localeCompare(i.label):i.tfIdfScore-t.tfIdfScore;if(t.tfIdfScore)return 1;if(i.tfIdfScore)return-1;const e=this.commandsHistory.peek(t.commandId),s=this.commandsHistory.peek(i.commandId);if(e&&s)return e>s?-1:1;if(e)return-1;if(s)return 1;if(this.options.suggestedCommandIds){const e=this.options.suggestedCommandIds.has(t.commandId),s=this.options.suggestedCommandIds.has(i.commandId);if(e&&s)return 0;if(e)return-1;if(s)return 1}return t.label.localeCompare(i.label)}));const a=[];let d=!1,f=!0,g=!!this.options.suggestedCommandIds;for(let t=0;t<l.length;t++){const i=l[t];0===t&&this.commandsHistory.peek(i.commandId)&&(a.push({type:"separator",label:J(0,"recently used")}),d=!0),f&&void 0!==i.tfIdfScore&&(a.push({type:"separator",label:J(0,"similar commands")}),f=!1),g&&void 0===i.tfIdfScore&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(a.push({type:"separator",label:J(0,"commonly used")}),d=!0,g=!1),!d||void 0!==i.tfIdfScore||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(a.push({type:"separator",label:J(0,"other commands")}),d=!1),a.push(this.toCommandPick(i,s))}return this.hasAdditionalCommandPicks(t,e)?{picks:a,additionalPicks:(()=>Cit(this,void 0,void 0,(function*(){var n;const r=yield this.getAdditionalCommandPicks(i,l,t,e);if(e.isCancellationRequested)return[];const o=r.map((t=>this.toCommandPick(t,s)));return f&&"separator"!==(null===(n=o[0])||void 0===n?void 0:n.type)&&o.unshift({type:"separator",label:J(0,"similar commands")}),o})))()}:a}))}toCommandPick(t,i){if("separator"===t.type)return t;const e=this.keybindingService.lookupKeybinding(t.commandId),s=e?J(0,"{0}, {1}",t.label,e.getAriaLabel()):t.label;return Object.assign(Object.assign({},t),{ariaLabel:s,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:e,accept:()=>Cit(this,void 0,void 0,(function*(){var e,s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(e=null==i?void 0:i.from)&&void 0!==e?e:"quick open"});try{(null===(s=t.args)||void 0===s?void 0:s.length)?yield this.commandService.executeCommand(t.commandId,...t.args):yield this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(J(0,"Command '{0}' resulted in an error",t.label),ait(i))}}))})}};Sit.PREFIX=">",Sit.TFIDF_THRESHOLD=.5,Sit.TFIDF_MAX_RESULTS=5,Sit.WORD_FILTER=KR(qR,(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=l_(t,i,0,n,e));)n=u_(i,n+1);return s}),ZR),Sit=wit=yit([kit(1,Zr),kit(2,CC),kit(3,uo),kit(4,Ah),kit(5,lF)],Sit);let xit=bit=class 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(t){t&&!t.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=bit.getConfiguredCommandHistoryLength(this.configurationService),bit.cache&&bit.cache.limit!==this.configuredCommandsHistoryLength&&(bit.cache.limit=this.configuredCommandsHistoryLength,bit.saveState(this.storageService)))}load(){const t=this.storageService.get(bit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=bit.cache=new lg(this.configuredCommandsHistoryLength,1);if(i){let t;t=i.usesLRU?i.entries:i.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>e.set(t.key,t.value)))}bit.counter=this.storageService.getNumber(bit.PREF_KEY_COUNTER,0,bit.counter)}push(t){bit.cache&&(bit.cache.set(t,bit.counter++),bit.saveState(this.storageService))}peek(t){var i;return null===(i=bit.cache)||void 0===i?void 0:i.peek(t)}static saveState(t){if(!bit.cache)return;const i={usesLRU:!0,entries:[]};bit.cache.forEach(((t,e)=>i.entries.push({key:e,value:t}))),t.store(bit.PREF_KEY_CACHE,JSON.stringify(i),0,0),t.store(bit.PREF_KEY_COUNTER,bit.counter,0,0)}static getConfiguredCommandHistoryLength(t){var i,e;const s=null===(e=null===(i=t.getValue().workbench)||void 0===i?void 0:i.commandPalette)||void 0===e?void 0:e.history;return"number"==typeof s?s:bit.DEFAULT_COMMANDS_HISTORY_LENGTH}};xit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,xit.PREF_KEY_CACHE="commandPalette.mru.cache",xit.PREF_KEY_COUNTER="commandPalette.mru.counter",xit.counter=1,xit=bit=yit([kit(0,PP),kit(1,Ta)],xit);class Dit extends Sit{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:$_(e.label)||e.id});return i}}var Eit=function(t,i){return function(e,s){i(e,s,t)}},Ait=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 Mit=class extends Dit{get activeTextEditorControl(){var t;return null!==(t=this.codeEditorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}getCommandPicks(){return Ait(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return Ait(this,void 0,void 0,(function*(){return[]}))}};Mit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Eit(0,Zr),Eit(1,Yr),Eit(2,CC),Eit(3,uo),Eit(4,Ah),Eit(5,lF)],Mit);class Lit extends tu{constructor(){super({id:Lit.ID,label:yR.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Ij).quickAccess.show(Mit.PREFIX)}}Lit.ID="editor.action.quickCommand",ru(Lit),dh.as(Fj).registerQuickAccessProvider({ctor:Mit,prefix:Mit.PREFIX,helpEntries:[{description:yR.quickCommandHelp,commandId:Lit.ID}]});var Oit=function(t,i){return function(e,s){i(e,s,t)}};let Fit=class extends LQ{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Fit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Oit(1,Jo),Oit(2,Yr),Oit(3,vO),Oit(4,Zr),Oit(5,PP),Oit(6,Ta)],Fit),hu(LQ.ID,Fit,4),ru(class extends tu{constructor(){super({id:"editor.action.toggleHighContrast",label:SR.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(aV),s=e.getColorTheme();oy(s.type)?(e.setTheme(this._originalThemeName||(hy(s.type)?eV:iV)),this._originalThemeName=null):(e.setTheme(hy(s.type)?sV:nV),this._originalThemeName=s.themeName)}});var Tit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rit(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 _it=Rit((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,l,u,a,d,f,g,p,m,v,w,b,y,k,C,S,x,D,E,A,M,L;Object.defineProperty(i,"__esModule",{value:!0}),i.TextDocument=i.EOL=i.WorkspaceFolder=i.InlineCompletionContext=i.SelectedCompletionInfo=i.InlineCompletionTriggerKind=i.InlineCompletionList=i.InlineCompletionItem=i.StringValue=i.InlayHint=i.InlayHintLabelPart=i.InlayHintKind=i.InlineValueContext=i.InlineValueEvaluatableExpression=i.InlineValueVariableLookup=i.InlineValueText=i.SemanticTokens=i.SemanticTokenModifiers=i.SemanticTokenTypes=i.SelectionRange=i.DocumentLink=i.FormattingOptions=i.CodeLens=i.CodeAction=i.CodeActionContext=i.CodeActionTriggerKind=i.CodeActionKind=i.DocumentSymbol=i.WorkspaceSymbol=i.SymbolInformation=i.SymbolTag=i.SymbolKind=i.DocumentHighlight=i.DocumentHighlightKind=i.SignatureInformation=i.ParameterInformation=i.Hover=i.MarkedString=i.CompletionList=i.CompletionItem=i.CompletionItemLabelDetails=i.InsertTextMode=i.InsertReplaceEdit=i.CompletionItemTag=i.InsertTextFormat=i.CompletionItemKind=i.MarkupContent=i.MarkupKind=i.TextDocumentItem=i.OptionalVersionedTextDocumentIdentifier=i.VersionedTextDocumentIdentifier=i.TextDocumentIdentifier=i.WorkspaceChange=i.WorkspaceEdit=i.DeleteFile=i.RenameFile=i.CreateFile=i.TextDocumentEdit=i.AnnotatedTextEdit=i.ChangeAnnotationIdentifier=i.ChangeAnnotation=i.TextEdit=i.Command=i.Diagnostic=i.CodeDescription=i.DiagnosticTag=i.DiagnosticSeverity=i.DiagnosticRelatedInformation=i.FoldingRange=i.FoldingRangeKind=i.ColorPresentation=i.ColorInformation=i.Color=i.LocationLink=i.Location=i.Range=i.Position=i.uinteger=i.integer=i.URI=i.DocumentUri=void 0,function(t){t.is=function(t){return"string"==typeof t}}(e||(i.DocumentUri=e={})),function(t){t.is=function(t){return"string"==typeof t}}(s||(i.URI=s={})),function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(n||(i.integer=n={})),function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(r||(i.uinteger=r={})),function(t){t.create=function(t,i){return t===Number.MAX_VALUE&&(t=r.MAX_VALUE),i===Number.MAX_VALUE&&(i=r.MAX_VALUE),{line:t,character:i}},t.is=function(t){var i=t;return 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))}}(l||(i.LocationLink=l={})),function(t){t.create=function(t,i,e,s){return{red:t,green:i,blue:e,alpha:s}},t.is=function(t){var i=t;return 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)}}(u||(i.Color=u={})),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)&&u.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))}}(M||(i.DeleteFile=M={})),function(t){t.is=function(t){return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every((function(t){return Ot.string(t.kind)?E.is(t)||A.is(t)||M.is(t):D.is(t)})))}}(L||(i.WorkspaceEdit=L={}));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,lt,ut,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}(),Mt=function(){function t(t){this._annotations=void 0===t?Object.create(null):t,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(t,i){var e;if(S.is(t)?e=t:(e=this.nextId(),i=t),void 0!==this._annotations[e])throw new Error("Id ".concat(e," is already in use."));if(void 0===i)throw new Error("No annotation provided for id ".concat(e));return this._annotations[e]=i,this._size++,e},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),Lt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Mt(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach((function(t){if(D.is(t)){var e=new At(t.edits,i._changeAnnotations);i._textEditChanges[t.textDocument.uri]=e}}))):t.changes&&Object.keys(t.changes).forEach((function(e){var s=new At(t.changes[e]);i._textEditChanges[e]=s}))):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(this._workspaceEdit.changeAnnotations=0===this._changeAnnotations.size?void 0:this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(t){if(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 Mt,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=E.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=E.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t.prototype.renameFile=function(t,i,e,s){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n,r,o;if(C.is(e)||S.is(e)?n=e:s=e,void 0===n?r=A.create(t,i,s):(o=S.is(n)?n:this._changeAnnotations.manage(n),r=A.create(t,i,s,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},t.prototype.deleteFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=M.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=M.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Lt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return 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||L.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"}(lt||(i.SemanticTokenTypes=lt={})),function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"}(ut||(i.SemanticTokenModifiers=ut={})),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 l=e(n[o],r[h]);t[c++]=l<=0?n[o++]:r[h++]}for(;o<n.length;)t[c++]=n[o++];for(;h<r.length;)t[c++]=r[h++];return t}t.create=function(t,i,e,s){return new 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),l=t.offsetAt(h.range.end);if(!(l<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(l,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var 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 Iit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Pit(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Nit(){return Iit?Pit("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Bit(){return Iit?Pit("esri/request"):(await import("@arcgis/core/request.js")).default}async function $it(t){return new(await async function(){return Iit?Pit("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function jit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Wit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function Vit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function Hit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function zit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Uit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Kit(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function qit(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function Git(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var Zit=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function Jit(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 Qit(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)Jit(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function Yit(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 Xit(t){let i=Yit(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function tet(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(tet(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(tet(e.children[t],i))return!0;return!1}function iet(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void tet(t,i);let e=new MutationObserver((()=>{e.disconnect(),tet(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function eet(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function set(){return[eet(2),eet(1),eet(1),eet(1),eet(3)].join("-")}var net=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"]),ret=new Map;async function oet(t,i,e=""){let s=`${i}/${e}${t}.json`;if(ret.has(s))return ret.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return ret.set(s,t),t}if("en"===t)return void ret.set(s,void 0);let r=await oet("en",i,e);return ret.set(s,r),r}catch{return void ret.set(s,void 0)}}var het=new WeakMap,cet=new WeakMap,uet=new WeakMap;async function aet(t,i,e){cet.set(t,i),het.set(t,Qit(t._hostElement,["lang"],(()=>{fet(t,e)}))),await fet(t,e)}function det(t){het.get(t)?.disconnect(),het.delete(t),cet.delete(t)}async function fet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return Yit(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(net.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:net.has(e)?e:"en"}}(t._hostElement);if(e===t._lang&&s===t._t9nLocale||(e!==t._lang&&(t._lang=e),s===t._t9nLocale))return;let n=uet.get(t);if(!n){let i=cet.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await oet(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function get(t,i){return new Array(i+1).join(t)}function pet(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+get(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+get("\\"+i,n.length))),i+t+i}function met(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function vet(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function wet(t){return"‎"+(t??"")+"‎"}function bet(t){return null!==t}function yet(t){return void 0!==t}function ket(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 Cet(t){try{return new URL(t),!0}catch{return!1}}function xet(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=met(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 Det(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 Eet(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 Aet(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 Met(t){return!!t?.typeIdField}function Let(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Met(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 Oet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new $et({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new Vet(t,e,s)}const Fet=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function Tet(t,i=!0){return t.match(Fet)?`${i?".":""}${t}`:`["${t}"]`}function Ret(t,i){return t?`${t}${Tet(i)}`:i}async function _et(t){if(!t)return null;let i=null;if(jit(t)||Wit(t)||Kit(t))i=t;else if(i=await $it(t),!Vit(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 Iet(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 Pet(t,i=_it.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 Pet(s,_it.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.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:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],l=[];return Eet(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=Tet(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:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:_it.CompletionItemKind.Field,documentation:{kind:"markdown",value:i}}}),!t.alias||t.alias.toLowerCase()===t.name.toLowerCase())return;let n=`**${t.alias}** \n${t.type}`;t.description&&(n+=` \n'${t.description}`),l.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:_it.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...l],r.documentation={kind:"markdown",value:h},o}(t,i);default:return function(t,i){const{name:e,type:s}=t,n=t.getDescription();return{name:e,description:n,type:s,completion:{label:e,detail:e,insertText:e,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class Net{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?wet(this._label):vet(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:vet(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Bet extends Net{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 $et extends Bet{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?Aet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class jet extends Bet{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?Aet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Wet extends Bet{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 Vet extends Net{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class Het extends Wet{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new Vet(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=Ret(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new $et({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new Uet({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new Ket({profile:this._profile,declaration:t,label:i,snippet:i},[new $et({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new qet({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new Het({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new jet({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 zet extends Wet{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 bet(this._loadPromise)&&yet(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Ret(this.snippet,t.name):t.name;return new $et({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Det(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if("function"!=typeof this._source?.getFieldDomain)return null;const i="feature"===this.type?Ret(this.snippet,t.name):t.name,e=new Het({profile:this._profile,label:i,description:t.alias??t.name,snippet:i,icon:"form-dropdown"}),s=new Vet(this._profile,t.alias??t.name,[new $et({profile:this._profile,label:i,description:"",snippet:i})]);if(e.variables=[s],Met(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Oet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new $et({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new Vet(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 $et({profile:this._profile,label:i,description:"",snippet:i}))}if(Met(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=Oet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new Het({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new Vet(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(e.variables.push(i),e):null}const n=Oet(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 Vet(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 _et({url:e});return Vit(s)?s:null}(t,i);if(!Vit(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new Ket({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new $et({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(bet),e.variables.length?e:null}}class Uet extends zet{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return jit(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await _et(this._definition),!this._source)throw new Error("Invalid definition");const t=jit(this._source)?this._source.title:"";this.variables.push(new Vet(this._profile,t,[new $et({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const i=new Vet(this._profile,{code:"values"});if(this.variables.push(i),"boolean"==typeof this._source?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,e=new $et({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});i.variables.push(e)}this._source.fields.sort(Let(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 Ket extends zet{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return jit(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await _et(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new Vet(this._profile,this.title,this.featureSetSnippets));const t=new Vet(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(Let(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 qet extends Wet{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 bet(this._loadPromise)&&yet(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 Vet(this._profile,t,[new $et({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new Vet(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new Vet(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?Hit(this._definition)?this._featureSetCollectionFromWebMap(this._definition):jit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):zit(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):qit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=Hit(t)?t:await async function(t){return new(await async function(){return Iit?Pit("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 Iit?Pit("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 Bit(),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:Iet(s.layers,n),tables:Iet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await $it({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await $it({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(Vit(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 Ket({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 $et({profile:this._profile,label:i,description:"",snippet:i}),new $et({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new $et({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Get extends Het{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 Pet(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function Zet(t){return Vit(t)||Wit(t)||qit(t)||Kit(t)||Uit(t)}async function Jet(i="en"){const e=Qet.get(i);if(e)return e;if(!net.has(i))return Jet("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)})),Qet.set(t,e),e}(i,await e.json()):"en"===i?null:Jet("en")}catch(t){return null}}const Qet=new Map;function Yet(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(Yet):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function Xet(t,i="en"){if(!Git(t))return;const e=await async function(t,i="en"){return(await Jet(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(Yet({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return jit(n=e)||Wit(n)||qit(n)||Kit(n)||Uit(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return Zet(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return zit(t)||Hit(t)||Zet(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(Yet(i))}var n})),Array.isArray(t?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const tst={locale:"en"},ist=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new DK,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new DK,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 _K.isUri(t)||(t=_K.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){Git(e)&&(e=await Xet(e,s.locale));const n=await oet(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 Get(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))??tst}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))}},est={setProfileForModel:ist.setProfileForModel.bind(ist)};export{aet as $,vet as B,iet as C,Cet as D,DK as E,det as F,aV as I,EK as K,TK as M,Xit as P,LK as R,kH as S,_K as U,ket as V,pet as W,est as a,Tit as b,Rit as c,ist as d,PK as e,xet as f,jW as g,Nit as h,Bit as i,Zit as j,set as k,NK as l,AK as m,$K as n,_it as o,Qit as p,wet as q,Eet as s,Kq as t,met as z}
62
+ var Rq=Object.defineProperty,_q=Object.getOwnPropertyDescriptor,Iq=Object.getOwnPropertyNames,Pq=Object.prototype.hasOwnProperty,Nq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Iq(i))Pq.call(t,n)||n===e||Rq(t,n,{get:()=>i[n],enumerable:!(s=_q(i,n))||s.enumerable});return t},Bq={};((t,i)=>{Nq(Bq,i,"default")})(0,$K);var $q=(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))($q||{}),jq=(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))(jq||{}),Wq=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(Wq||{}),Vq=(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))(Vq||{}),Hq=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(Hq||{}),zq=class{_onDidChange=new Bq.Emitter;_onDidExtraLibsChange=new Bq.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)}},Uq={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},Kq=new zq({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},Uq),qq=new zq({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},Uq);function Gq(){return import("./p-d831108e.js")}Bq.languages.typescript={ModuleKind:$q,JsxEmit:jq,NewLineKind:Wq,ScriptTarget:Vq,ModuleResolutionKind:Hq,typescriptVersion:"5.0.2",typescriptDefaults:Kq,javascriptDefaults:qq,getTypeScriptWorker:()=>Gq().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>Gq().then((t=>t.getJavaScriptWorker()))},Bq.languages.onLanguage("typescript",(()=>Gq().then((t=>t.setupTypeScript(Kq))))),Bq.languages.onLanguage("javascript",(()=>Gq().then((t=>t.setupJavaScript(qq))))),Eh(class extends Dh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:J(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:ys.map,toggled:Lo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Lo.has("isInDiffEditor"),menu:{when:Lo.has("isInDiffEditor"),id:bh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class Zq extends Dh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:J(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Lo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Eh(Zq);class Jq extends Dh{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:{value:J(0,"Toggle Use Inline View When Space Is Limited"),original:"Toggle Use Inline View When Space Is Limited"},precondition:Lo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Ta),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Eh(Jq),Ch.appendMenuItem(bh.EditorTitle,{command:{id:(new Jq).desc.id,title:J(0,"Use Inline View When Space Is Limited"),toggled:Lo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Lo.has("isInDiffEditor")},order:11,group:"1_diff",when:Lo.and(gS.diffEditorRenderSideBySideInlineBreakpointReached,Lo.has("isInDiffEditor"))}),Ch.appendMenuItem(bh.EditorTitle,{command:{id:(new Zq).desc.id,title:J(0,"Show Moved Code Blocks"),icon:ys.move,toggled:_o.create("config.diffEditor.experimental.showMoves",!0),precondition:Lo.has("isInDiffEditor")},order:10,group:"1_diff",when:Lo.has("isInDiffEditor")});const Qq={value:J(0,"Diff Editor"),original:"Diff Editor"};Eh(class extends eu{constructor(){super({id:"diffEditor.switchSide",title:{value:J(0,"Switch Side"),original:"Switch Side"},icon:ys.arrowSwap,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,e){const s=iG(t);if(s instanceof OU){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Eh(class extends eu{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:J(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:ys.close,precondition:gS.comparingMovedCode,f1:!1,category:Qq,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.exitCompareMove()}}),Eh(class extends eu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:J(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:ys.fold,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.collapseAllUnchangedRegions()}}),Eh(class extends eu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:J(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:ys.unfold,precondition:Lo.has("isInDiffEditor"),f1:!0,category:Qq})}runEditorCommand(t,i,...e){const s=iG(t);s instanceof OU&&s.showAllUnchangedRegions()}});const Yq={value:J(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class Xq extends Dh{constructor(){super({id:Xq.id,title:{value:J(0,"Go to Next Difference"),original:"Go to Next Difference"},category:Yq,precondition:Lo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=iG(t);null==i||i.accessibleDiffViewerNext()}}Xq.id="editor.action.accessibleDiffViewer.next",Ch.appendMenuItem(bh.EditorTitle,{command:{id:Xq.id,title:J(0,"Open Accessible Diff Viewer"),precondition:Lo.has("isInDiffEditor")},order:10,group:"2_diff",when:Lo.and(gS.accessibleDiffViewerVisible.negate(),Lo.has("isInDiffEditor"))});class tG extends Dh{constructor(){super({id:tG.id,title:{value:J(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:Yq,precondition:Lo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=iG(t);null==i||i.accessibleDiffViewerPrev()}}function iG(t){var i;const e=t.get(Yr),s=e.listDiffEditors(),n=null!==(i=e.getFocusedCodeEditor())&&void 0!==i?i:e.getActiveCodeEditor();if(!n)return null;for(let t=0,i=s.length;t<i;t++){const i=s[t];if(i.getModifiedEditor().getId()===n.getId()||i.getOriginalEditor().getId()===n.getId())return i}const r=wl();if(r)for(const t of s)if(eG(t.getContainerDomNode(),r))return t;return null}function eG(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}tG.id="editor.action.accessibleDiffViewer.prev",ao.registerCommandAlias("editor.action.diffReview.next",Xq.id),Eh(Xq),ao.registerCommandAlias("editor.action.diffReview.prev",tG.id),Eh(tG);var sG,nG=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 rG=new Zo("selectionAnchorSet",!1);let oG=sG=class{static get(t){return t.getContribution(sG.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=rG.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(ms.fromPositions(t,t),{description:"selection-anchor",stickiness:1,hoverMessage:(new H_).appendText(J(0,"Selection Anchor")),className:"selection-anchor"})})),this.selectionAnchorSetContextKey.set(!!this.decorationId),sm(J(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(ms.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()}};oG.ID="editor.contrib.selectionAnchorController",oG=sG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Jo)],oG),hu(oG.ID,oG,4),ru(class extends tu{constructor(){super({id:"editor.action.setSelectionAnchor",label:J(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2080),weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.setSelectionAnchor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.goToSelectionAnchor",label:J(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:rG})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:J(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:rG,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2089),weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),ru(class extends tu{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:J(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:rG,kbOpts:{kbExpr:gS.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return nG(this,void 0,void 0,(function*(){null===(e=oG.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const hG=Om("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},J(0,"Overview ruler marker color for matching brackets."));class cG{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class lG extends Hi{static get(t){return t.getContribution(lG.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Mu((()=>this._updateBrackets()),50)),this._matchBrackets=this._editor.getOption(71),this._updateBracketsSoon.schedule(),this._register(t.onDidChangeCursorPosition((()=>{"never"!==this._matchBrackets&&this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelContent((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModel((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeModelLanguageConfiguration((()=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(71)&&(this._matchBrackets=this._editor.getOption(71),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())}))),this._register(t.onDidBlurEditorWidget((()=>{this._updateBracketsSoon.schedule()}))),this._register(t.onDidFocusEditorWidget((()=>{this._updateBracketsSoon.schedule()})))}jumpToBracket(){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._editor.getSelections().map((i=>{const e=i.getStartPosition(),s=t.bracketPairs.matchBracket(e);let n=null;if(s)s[0].containsPosition(e)&&!s[1].containsPosition(e)?n=s[1].getStartPosition():s[1].containsPosition(e)&&(n=s[0].getStartPosition());else{const i=t.bracketPairs.findEnclosingBrackets(e);if(i)n=i[1].getStartPosition();else{const i=t.bracketPairs.findNextBracket(e);i&&i.range&&(n=i.range.getStartPosition())}}return n?new ms(n.lineNumber,n.column,n.lineNumber,n.column):new ms(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(ps.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 ms(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(gs.compare);const o=[];let h=0,c=0;const l=s.length;for(let t=0,e=n.length;t<e;t++){const e=n[t];for(;c<l&&s[c].position.isBefore(e);)c++;if(c<l&&s[c].position.equals(e))o[h++]=s[c];else{let t=i.bracketPairs.matchBracket(e,20),s=lG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=lG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new cG(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}lG.ID="editor.contrib.bracketMatchingController",lG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=$M.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:vk(hG),position:Xd.Center}}),lG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=$M.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),hu(lG.ID,lG,1),ru(class extends tu{constructor(){super({id:"editor.action.selectToBracket",label:J(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=lG.get(i))||void 0===s||s.selectToBracket(n)}}),ru(class extends tu{constructor(){super({id:"editor.action.jumpToBracket",label:J(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=lG.get(i))||void 0===e||e.jumpToBracket()}}),ru(class extends tu{constructor(){super({id:"editor.action.removeBrackets",label:J(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=lG.get(i))||void 0===e||e.removeBrackets(this.id)}}),Ch.appendMenuItem(bh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:J(0,"Go to &&Bracket")},order:2});class uG{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 ps(e,s-1,e,s),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ps(e,n,e,n),o)}else{const r=new ps(e,n,e,n+1),o=t.getValueInRange(r);i.addEditOperation(r,null),i.addEditOperation(new ps(e,s,e,s),o)}}computeCursorState(t,i){return this._isMovingLeft?new ms(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ms(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class aG extends tu{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 uG(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}ru(class extends aG{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:J(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:gS.writable})}}),ru(class extends aG{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:J(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:gS.writable})}}),ru(class extends tu{constructor(){super({id:"editor.action.transposeLetters",label:J(0,"Transpose Letters"),alias:"Transpose Letters",precondition:gS.writable,kbOpts:{kbExpr:gS.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():zC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=zC.leftPosition(e,o),c=zC.leftPosition(e,h),l=e.getValueInRange(ps.fromPositions(c,h)),u=e.getValueInRange(ps.fromPositions(h,o)),a=ps.fromPositions(c,o);s.push(new BC(a,u+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const dG="9_cutcopypaste",fG=pt||document.queryCommandSupported("cut"),gG=pt||document.queryCommandSupported("copy"),pG=void 0!==navigator.clipboard&&!Lr||document.queryCommandSupported("paste");function mG(t){return t.register(),t}const vG=fG?mG(new Ql({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:pt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"Cu&&t"),order:1},{menuId:bh.EditorContext,group:dG,title:J(0,"Cut"),when:gS.writable,order:1},{menuId:bh.CommandPalette,group:"",title:J(0,"Cut"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Cut"),when:gS.writable,order:1}]})):void 0,wG=gG?mG(new Ql({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:pt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Copy"),order:2},{menuId:bh.EditorContext,group:dG,title:J(0,"Copy"),order:2},{menuId:bh.CommandPalette,group:"",title:J(0,"Copy"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Copy"),order:2}]})):void 0;Ch.appendMenuItem(bh.MenubarEditMenu,{submenu:bh.MenubarCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:dG,order:3}),Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Lo.and(Lo.notEquals("resourceScheme","output"),gS.editorTextFocus)}),Ch.appendMenuItem(bh.EditorTitleContext,{submenu:bh.EditorTitleContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1}),Ch.appendMenuItem(bh.ExplorerContext,{submenu:bh.ExplorerContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1});const bG=pG?mG(new Ql({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:pt?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:bh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Paste"),order:4},{menuId:bh.EditorContext,group:dG,title:J(0,"Paste"),when:gS.writable,order:4},{menuId:bh.CommandPalette,group:"",title:J(0,"Paste"),order:1},{menuId:bh.SimpleEditorContext,group:dG,title:J(0,"Paste"),when:gS.writable,order:4}]})):void 0;function yG(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(Yr).getFocusedCodeEditor();if(e&&e.hasTextFocus()){const t=e.getOption(37),s=e.getSelection();return s&&s.isEmpty()&&!t||e.getContainerDomNode().ownerDocument.execCommand(i),!0}return!1})),t.addImplementation(0,"generic-dom",(()=>(bl().execCommand(i),!0))))}yG(vG,"cut"),yG(wG,"copy"),bG&&(bG.addImplementation(1e4,"code-editor",(t=>{const i=t.get(Yr),e=t.get(EV),s=i.getFocusedCodeEditor();return!(!s||!s.hasTextFocus())&&(!(!s.getContainerDomNode().ownerDocument.execCommand("paste")&&mt)||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())}))}(void 0,void 0,void 0,(function*(){const t=yield e.readText();if(""!==t){const i=hk.INSTANCE.get(t);let e=!1,n=null,r=null;i&&(e=s.getOption(37)&&!!i.isFromEmptySelection,n=void 0!==i.multicursorText?i.multicursorText:null,r=i.mode),s.trigger("keyboard","paste",{text:t,pasteOnNewLine:e,multicursorText:n,mode:r})}})))})),bG.addImplementation(0,"generic-dom",(()=>(bl().execCommand("paste"),!0)))),gG&&ru(class extends tu{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:J(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(ok.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),ok.forceCopyWithSyntaxHighlighting=!1))}});var kG;class CG{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+CG.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new CG(this.value+CG.sep+t)}}function SG(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}CG.sep=".",CG.None=new CG("@@none@@"),CG.Empty=new CG(""),CG.QuickFix=new CG("quickfix"),CG.Refactor=new CG("refactor"),CG.RefactorExtract=CG.Refactor.append("extract"),CG.RefactorInline=CG.Refactor.append("inline"),CG.RefactorMove=CG.Refactor.append("move"),CG.RefactorRewrite=CG.Refactor.append("rewrite"),CG.Notebook=new CG("notebook"),CG.Source=new CG("source"),CG.SourceOrganizeImports=CG.Source.append("organizeImports"),CG.SourceFixAll=CG.Source.append("fixAll"),CG.SurroundWith=CG.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"}(kG||(kG={}));class xG{static fromUser(t,i){return t&&"object"==typeof t?new xG(xG.getKindFromUser(t,i.kind),xG.getApplyFromUser(t,i.apply),xG.getPreferredUser(t)):new xG(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 CG(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 DG{constructor(t,i,e){this.action=t,this.provider=i,this.highlightRange=e}resolve(t){var i;return 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())}))}(this,void 0,void 0,(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}))}}var EG=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 AG="editor.action.codeAction",MG="editor.action.quickFix",LG="editor.action.autoFix",OG="editor.action.refactor",FG="editor.action.sourceAction",TG="editor.action.organizeImports",RG="editor.action.fixAll";class _G 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 a(t.diagnostics)?a(i.diagnostics)?_G.codeActionsPreferredComparator(t,i):-1:a(i.diagnostics)?1:_G.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(_G.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&CG.QuickFix.contains(new CG(t.kind))&&!!t.isPreferred))}}const IG={actions:[],documentation:void 0};function PG(t,i,s,n,r,o){var h;return EG(this,void 0,void 0,(function*(){const l=n.filter||{},u=Object.assign(Object.assign({},l),{excludes:[...l.excludes||[],CG.Notebook]}),a={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new hK(i,o),f=function(t,i,e){return t.all(i).filter((t=>!t.providedCodeActionKinds||t.providedCodeActionKinds.some((t=>function(t,i){return!(t.include&&!t.include.intersects(i)||t.excludes&&t.excludes.some((e=>SG(i,e,t.include)))||!t.includeSourceActions&&CG.Source.contains(i))}(e,new CG(t))))))}(t,i,2===n.type?u:l),g=new Vi,p=f.map((t=>EG(this,void 0,void 0,(function*(){try{r.report(t);const e=yield t.provideCodeActions(i,s,a,d.token);if(e&&g.add(e),d.token.isCancellationRequested)return IG;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new CG(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>SG(e,i,t.include)))||!t.includeSourceActions&&e&&CG.Source.contains(e)||t.onlyIncludePreferredActions&&!i.isPreferred)}(l,t))),o=function(t,i,e){if(!t.documentation)return;const s=t.documentation.map((t=>({kind:new CG(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 CG(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new DG(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),IG}})))),m=t.onDidChange((()=>{e(t.all(i),f)||d.cancel()}));try{const e=yield Promise.all(p),s=e.map((t=>t.actions)).flat(),r=[...c(e.map((t=>t.documentation))),...NG(t,i,n,s)];return new _G(s,r,g)}finally{m.dispose(),d.dispose()}}))}function*NG(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 BG;function $G(t,i,e,s,n=ue.None){var r;return EG(this,void 0,void 0,(function*(){const o=t.get(yT),h=t.get(uo),c=t.get(Ah),l=t.get(vO);if(c.publicLog2("codeAction.applyCodeAction",{codeActionTitle:i.action.title,codeActionKind:i.action.kind,codeActionIsPreferred:!!i.action.isPreferred,reason:e}),yield i.resolve(n),!n.isCancellationRequested){if((null===(r=i.action.edit)||void 0===r?void 0:r.edits.length)&&!(yield o.apply(i.action.edit,{editor:null==s?void 0:s.editor,label:i.action.title,quotableLabel:i.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:e!==BG.OnSave,showPreview:null==s?void 0:s.preview})).isApplied)return;if(i.action.command)try{yield h.executeCommand(i.action.command.id,...i.action.command.arguments||[])}catch(t){const i=function(t){return"string"==typeof t?t:t instanceof Error&&"string"==typeof t.message?t.message:void 0}(t);l.error("string"==typeof i?i:J(0,"An unknown error occurred while applying the code action"))}}}))}!function(t){t.OnSave="onSave",t.FromProblemsView="fromProblemsView",t.FromCodeActions="fromCodeActions"}(BG||(BG={})),ao.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return EG(this,void 0,void 0,(function*(){if(!(i instanceof ss))throw Ti();const{codeActionProvider:r}=t.get(Wg),o=t.get(Xr).getModel(i);if(!o)throw Ti();const h=ms.isISelection(e)?ms.liftSelection(e):ps.isIRange(e)?o.validateRange(e):void 0;if(!h)throw Ti();const c="string"==typeof s?new CG(s):void 0,l=yield PG(r,o,h,{type:1,triggerAction:kG.Default,filter:{includeSourceActions:!0,include:c}},sR.None,ue.None),u=[],a=Math.min(l.validActions.length,"number"==typeof n?n:0);for(let t=0;t<a;t++)u.push(l.validActions[t].resolve(ue.None));try{return yield Promise.all(u),l.validActions.map((t=>t.action))}finally{setTimeout((()=>l.dispose()),100)}}))}));var jG;let WG=jG=class{constructor(t){this.keybindingService=t}getResolver(){const t=new Mn((()=>this.keybindingService.getKeybindings().filter((t=>jG.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===TG?i={kind:CG.SourceOrganizeImports.value}:t.command===RG&&(i={kind:CG.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},xG.fromUser(i,{kind:CG.None,apply:"never"}))}))));return i=>{if(i.kind){const e=this.bestKeybindingForCodeAction(i,t.value);return null==e?void 0:e.resolvedKeybinding}}}bestKeybindingForCodeAction(t,i){if(!t.kind)return;const e=new CG(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)}};WG.codeActionCommands=[OG,AG,FG,TG,RG],WG=jG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,CC)],WG),Om("symbolIcon.arrayForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.booleanForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.colorForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.constantForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},J(0,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.fileForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.folderForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.keyForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.keywordForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},J(0,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.moduleForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.namespaceForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.nullForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.numberForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.objectForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.operatorForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.packageForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.propertyForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.referenceForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.snippetForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.stringForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.structForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.textForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.typeParameterForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.unitForeground",{dark:Fm,light:Fm,hcDark:Fm,hcLight:Fm},J(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Om("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},J(0,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const VG=Object.freeze({kind:CG.Empty,title:J(0,"More Actions...")}),HG=Object.freeze([{kind:CG.QuickFix,title:J(0,"Quick Fix")},{kind:CG.RefactorExtract,title:J(0,"Extract"),icon:ys.wrench},{kind:CG.RefactorInline,title:J(0,"Inline"),icon:ys.wrench},{kind:CG.RefactorRewrite,title:J(0,"Rewrite"),icon:ys.wrench},{kind:CG.RefactorMove,title:J(0,"Move"),icon:ys.wrench},{kind:CG.SurroundWith,title:J(0,"Surround With"),icon:ys.symbolSnippet},{kind:CG.Source,title:J(0,"Source Action"),icon:ys.symbolFile},VG]);var zG,UG;!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}}}(UG||(UG={}));let KG=zG=class extends Hi{constructor(t,i){var e;super(),this._editor=t,this._onClick=this._register(new ie),this.onClick=this._onClick.event,this._state=UG.Hidden,this._domNode=Pl("div.lightBulbWidget"),this._register(xm.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 Qc(t,wt&&_h?El.POINTER_DOWN:El.MOUSE_DOWN,i,e)}(this._domNode,Yc((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=cl(this._domNode),s=this._editor.getOption(66);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(Qc(this._domNode,"mouseenter",(t=>{1==(1&t.buttons)&&this.hide()}))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(64)&&!this._editor.getOption(64).enabled&&this.hide()}))),this._register(Ji.runAndSubscribe(i.onDidUpdateKeybindings,(()=>{var t,e,s,n;this._preferredKbLabel=null!==(e=null===(t=i.lookupKeybinding(LG))||void 0===t?void 0:t.getLabel())&&void 0!==e?e:void 0,this._quickFixKbLabel=null!==(n=null===(s=i.lookupKeybinding(MG))||void 0===s?void 0:s.getLabel())&&void 0!==n?n:void 0,this._updateLightBulbTitleAndIcon()})))}dispose(){super.dispose(),this._editor.removeContentWidget(this)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return 1===this._state.type?this._state.widgetPosition:null}update(t,i,e){if(t.validActions.length<=0)return this.hide();const s=this._editor.getOptions();if(!s.get(64).enabled)return this.hide();const n=this._editor.getModel();if(!n)return this.hide();const{lineNumber:r,column:o}=n.validatePosition(e),h=n.getOptions().tabSize,c=s.get(50),l=GS(n.getLineContent(r),h),u=t=>t>2&&this._editor.getTopForLineNumber(t)===this._editor.getTopForLineNumber(t-1);let a=r;if(!(c.spaceWidth*l>22))if(r>1&&!u(r-1))a-=1;else if(u(r+1)){if(o*c.spaceWidth<22)return this.hide()}else a+=1;this.state=new UG.Showing(t,i,e,{position:{lineNumber:a,column:1},preference:zG._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==UG.Hidden&&(this.state=UG.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(...eo.asClassNameArray(ys.lightBulb)),this._domNode.classList.add(...eo.asClassNameArray(ys.lightbulbAutofix)),this._preferredKbLabel)?this.title=J(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...eo.asClassNameArray(ys.lightbulbAutofix)),this._domNode.classList.add(...eo.asClassNameArray(ys.lightBulb)),this.title=this._quickFixKbLabel?J(0,"Show Code Actions ({0})",this._quickFixKbLabel):J(0,"Show Code Actions"))}set title(t){this._domNode.title=t}};KG.ID="editor.contrib.lightbulbWidget",KG._posPref=[0],KG=zG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,CC)],KG);var qG,GG=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())}))};let JG=qG=class{constructor(t,i,e){this._options=t,this._languageService=i,this._openerService=e,this._onDidRenderAsync=new ie,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(fI(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(t,i){return{codeBlockRenderer:(t,i)=>ZG(this,void 0,void 0,(function*(){var e,s,n;let r;t?r=this._languageService.getLanguageIdByLanguageName(t):this._options.editor&&(r=null===(e=this._options.editor.getModel())||void 0===e?void 0:e.getLanguageId()),r||(r=ed);const o=yield function(t,i,e){return 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())}))}(this,void 0,void 0,(function*(){if(!e)return PL(i,t.languageIdCodec,_L);const s=yield Ns.getOrCreate(e);return PL(i,t.languageIdCodec,s||_L)}))}(this._languageService,i,r),h=document.createElement("span");return h.innerHTML=null!==(n=null===(s=qG._ttpTokenizer)||void 0===s?void 0:s.createHTML(o))&&void 0!==n?n:o,this._options.editor?$r(h,this._options.editor.getOption(50)):this._options.codeBlockFontFamily&&(h.style.fontFamily=this._options.codeBlockFontFamily),void 0!==this._options.codeBlockFontSize&&(h.style.fontSize=this._options.codeBlockFontSize),h})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:i=>QG(this._openerService,i,t.isTrusted),disposables:i}}}};function QG(t,i,e){return ZG(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:YG(e)})}catch(t){return Ei(t),!1}}))}function YG(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}JG._ttpTokenizer=Ku("tokenizeToString",{createHTML:t=>t}),JG=qG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([GG(1,Ba),GG(2,AF)],JG);var XG,tZ=function(t,i){return function(e,s){i(e,s,t)}};let iZ=XG=class{static get(t){return t.getContribution(XG.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new zi,this._messageListeners=new Vi,this._mouseOverMessage=!1,this._editor=t,this._visible=XG.MESSAGE_VISIBLE.bindTo(i)}dispose(){var t;null===(t=this._message)||void 0===t||t.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(t,i){let e;sm(U_(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=U_(t)?fI(t,{actionHandler:{callback:i=>QG(this._openerService,i,U_(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new eZ(this._editor,i,"string"==typeof t?t:this._message.element),this._messageListeners.add(Ji.debounce(this._editor.onDidBlurEditorText,((t,i)=>i),0)((()=>{this._mouseOverMessage||this._messageWidget.value&&fl(wl(),this._messageWidget.value.getDomNode())||this.closeMessage()}))),this._messageListeners.add(this._editor.onDidChangeCursorPosition((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidDispose((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidChangeModel((()=>this.closeMessage()))),this._messageListeners.add(Qc(this._messageWidget.value.getDomNode(),El.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Qc(this._messageWidget.value.getDomNode(),El.MOUSE_LEAVE,(()=>this._mouseOverMessage=!1),!0)),this._messageListeners.add(this._editor.onMouseMove((t=>{t.target.position&&(e?e.containsPosition(t.target.position)||this.closeMessage():e=new ps(i.lineNumber-3,1,t.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(eZ.fadeOut(this._messageWidget.value))}};iZ.ID="editor.contrib.messageController",iZ.MESSAGE_VISIBLE=new Zo("messageVisible",!1,J(0,"Whether the editor is currently showing an inline message")),iZ=XG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tZ(1,Jo),tZ(2,AF)],iZ),nu(new(Xl.bindToContribution(iZ.get))({id:"leaveEditorMessage",precondition:iZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class eZ{static fadeOut(t){const i=()=>{t.dispose(),clearTimeout(e),t.getDomNode().removeEventListener("animationend",i)},e=setTimeout(i,110);return t.getDomNode().addEventListener("animationend",i),t.getDomNode().classList.add("fadeOut"),{dispose:i}}constructor(t,{lineNumber:i,column:e},s){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=t,this._editor.revealLinesInCenterIfOutsideViewport(i,i,0),this._position={lineNumber:i,column:e},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const n=document.createElement("div");n.classList.add("anchor","top"),this._domNode.appendChild(n);const r=document.createElement("div");"string"==typeof s?(r.classList.add("message"),r.textContent=s):(s.classList.add("message"),r.appendChild(s)),this._domNode.appendChild(r);const o=document.createElement("div");o.classList.add("anchor","below"),this._domNode.appendChild(o),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(t){this._domNode.classList.toggle("below",2===t)}}hu(iZ.ID,iZ,4);var sZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},nZ=function(t,i){return function(e,s){i(e,s,t)}};const rZ="acceptSelectedCodeAction",oZ="previewSelectedCodeAction";class hZ{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 cZ=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 iW(t,xt)}}renderElement(t,i,e){var s,n,r;if((null===(s=t.group)||void 0===s?void 0:s.icon)?(e.icon.className=eo.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=Am(t.group.icon.color.id))):(e.icon.className=eo.asClassName(ys.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=fZ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Nl(...i):Bl(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(rZ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(oZ))||void 0===r?void 0:r.getLabel();e.container.classList.toggle("option-disabled",t.disabled),e.container.title=t.disabled?t.label:o&&h?this._supportsPreview&&t.canPreview?J(0,"{0} to apply, {1} to preview",o,h):J(0,"{0} to apply",o):""}disposeTemplate(t){}};cZ=sZ([nZ(1,CC)],cZ);class lZ extends UIEvent{constructor(){super("acceptSelectedAction")}}class uZ extends UIEvent{constructor(){super("previewSelectedAction")}}function aZ(t){if("action"===t.kind)return t.label}let dZ=class extends Hi{constructor(t,i,e,s,n,r){super(),this._delegate=s,this._contextViewService=n,this._keybindingService=r,this._actionLineHeight=24,this._headerLineHeight=26,this.cts=this._register(new de),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._list=this._register(new vP(t,this.domNode,{getHeight:t=>"header"===t.kind?this._headerLineHeight:this._actionLineHeight,getTemplateId:t=>t.kind},[new cZ(i,this._keybindingService),new hZ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:aZ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?fZ(null==t?void 0:t.label):"";return t.disabled&&(i=J(0,"{0}, Disabled Reason: {1}",i,t.disabled)),i}return null},getWidgetAriaLabel:()=>J(0,"Action Widget"),getRole:t=>"action"===t.kind?"option":"separator",getWidgetRole:()=>"listbox"}})),this._list.style(KP),this._register(this._list.onMouseClick((t=>this.onListClick(t)))),this._register(this._list.onMouseOver((t=>this.onListHover(t)))),this._register(this._list.onDidChangeFocus((()=>this.onFocus()))),this._register(this._list.onDidChangeSelection((t=>this.onListSelection(t)))),this._allMenuItems=e,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(t){return!t.disabled&&"action"===t.kind}hide(t){this._delegate.onHide(t),this.cts.cancel(),this._contextViewService.hideContextView()}layout(t){const i=this._allMenuItems.filter((t=>"header"===t.kind)).length,e=this._allMenuItems.length*this._actionLineHeight+i*this._headerLineHeight-i*this._actionLineHeight;this._list.layout(e);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 uZ:new lZ;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 uZ):this._list.setSelection([])}onFocus(){var t,i;this._list.domFocus();const e=this._list.getFocus();if(0===e.length)return;const s=this._list.element(e[0]);null===(i=(t=this._delegate).onFocus)||void 0===i||i.call(t,s.item)}onListHover(t){return 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())}))}(this,void 0,void 0,(function*(){const i=t.element;if(i&&i.item&&this.focusCondition(i)){if(this._delegate.onHover&&!i.disabled&&"action"===i.kind){const t=yield this._delegate.onHover(i.item,this.cts.token);i.canPreview=t?t.canPreview:void 0}t.index&&this._list.splice(t.index,1,[i])}this._list.setFocus("number"==typeof t.index?[t.index]:[])}))}onListClick(t){t.element&&this.focusCondition(t.element)&&this._list.setFocus([])}};function fZ(t){return t.replace(/\r\n|\r|\n/g," ")}dZ=sZ([nZ(4,ER),nZ(5,CC)],dZ);var gZ=function(t,i){return function(e,s){i(e,s,t)}};Om("actionBar.toggledBackground",{dark:zm,light:zm,hcDark:zm,hcLight:zm},J(0,"Background color for toggled action items in action bar."));const pZ={Visible:new Zo("codeActionMenuVisible",!1,J(0,"Whether the action widget list is visible"))},mZ=Qr("actionWidgetService");let vZ=class extends Hi{get isVisible(){return pZ.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=pZ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(dZ,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(Qc(h,El.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Qc(l,El.POINTER_MOVE,(()=>l.remove()))),r.add(Qc(l,El.MOUSE_DOWN,(()=>l.remove())));let u=0;if(e.length){const t=this._createActionBar(".action-widget-action-bar",e);t&&(n.appendChild(t.getContainer().parentElement),r.add(t),u=t.getContainer().offsetWidth)}const a=null===(s=this._list.value)||void 0===s?void 0:s.layout(u);n.style.width=`${a}px`;const d=r.add(Ll(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=Pl(t),s=new cN(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)}};vZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([gZ(0,ER),gZ(1,Jo),gZ(2,Zr)],vZ),Wa(mZ,vZ,1);const wZ=1100;Eh(class extends Dh{constructor(){super({id:"hideCodeActionWidget",title:{value:J(0,"Hide action widget"),original:"Hide action widget"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:9,secondary:[1033]}})}run(t){t.get(mZ).hide()}}),Eh(class extends Dh{constructor(){super({id:"selectPrevCodeAction",title:{value:J(0,"Select previous action"),original:"Select previous action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.focusPrevious()}}),Eh(class extends Dh{constructor(){super({id:"selectNextCodeAction",title:{value:J(0,"Select next action"),original:"Select next action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.focusNext()}}),Eh(class extends Dh{constructor(){super({id:rZ,title:{value:J(0,"Accept selected action"),original:"Accept selected action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:3,secondary:[2137]}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.acceptSelected()}}),Eh(class extends Dh{constructor(){super({id:oZ,title:{value:J(0,"Preview selected action"),original:"Preview selected action"},precondition:pZ.Visible,keybinding:{weight:wZ,primary:2051}})}run(t){const i=t.get(mZ);i instanceof vZ&&i.acceptSelected(!0)}});const bZ=new Zo("supportedCodeAction","");class yZ 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 Eu),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=>LE(t,i.uri)))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet((()=>{this.trigger({type:2,triggerAction:kG.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 kZ;!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 CZ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(kZ||(kZ={}));const CZ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class SZ extends Hi{constructor(t,i,e,s,n,r){super(),this._editor=t,this._registry=i,this._markerService=e,this._progressService=n,this._configurationService=r,this._codeActionOracle=this._register(new zi),this._state=kZ.Empty,this._onDidChangeState=this._register(new ie),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=bZ.bindTo(s),this._register(this._editor.onDidChangeModel((()=>this._update()))),this._register(this._editor.onDidChangeModelLanguage((()=>this._update()))),this._register(this._registry.onDidChange((()=>this._update()))),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(kZ.Empty,!0))}_settingEnabledNearbyQuickfixes(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return!!this._configurationService&&this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickfixes",{resource:null==i?void 0:i.uri})}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(kZ.Empty);const t=this._editor.getModel();if(t&&this._registry.has(t)&&!this._editor.getOption(90)){const i=this._registry.all(t).flatMap((t=>{var i;return null!==(i=t.providedCodeActionKinds)&&void 0!==i?i:[]}));this._supportedCodeActions.set(i.join(" ")),this._codeActionOracle.value=new yZ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(kZ.Empty);const s=i.selection.getStartPosition(),n=wu((e=>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())}))}(this,void 0,void 0,(function*(){var s,n,r,o,h,c;if(this._settingEnabledNearbyQuickfixes()&&1===i.trigger.type&&(i.trigger.triggerAction===kG.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(CG.QuickFix)))){const s=yield PG(this._registry,t,i.selection,i.trigger,sR.None,e);if(e.isCancellationRequested)return CZ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&CG.QuickFix.contains(new CG(t.action.kind)))))){const n=this._markerService.read({resource:t.uri});if(n.length>0){const r=i.selection.getPosition();let l=r,u=Number.MAX_VALUE,a=!1;for(const t of n){const i=t.endColumn,e=t.endLineNumber;(e===r.lineNumber||t.startLineNumber===r.lineNumber)&&Math.abs(r.column-i)<u&&(u=Math.abs(r.column-i),a=!0,l=new gs(e,i))}if(a){const n={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:(null===(o=i.trigger.filter)||void 0===o?void 0:o.include)?null===(h=i.trigger.filter)||void 0===h?void 0:h.include:CG.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:(null===(c=i.trigger.context)||void 0===c?void 0:c.notAvailableMessage)||"",position:l}},r=new ms(l.lineNumber,l.column,l.lineNumber,l.column),u=yield PG(this._registry,t,r,n,sR.None,e),a=[...s.validActions];return 0!==u.validActions.length&&(u.validActions.forEach((t=>{t.highlightRange=t.action.isPreferred})),a.push(...u.validActions)),{validActions:a,allActions:s.allActions,documentation:s.documentation,hasAutoFix:s.hasAutoFix,dispose:()=>{s.dispose()}}}}}}return PG(this._registry,t,i.selection,i.trigger,sR.None,e)}))));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new kZ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:kG.Default})}else this._supportedCodeActions.reset()}trigger(t){var i;null===(i=this._codeActionOracle.value)||void 0===i||i.trigger(t)}setState(t,i){t!==this._state&&(1===this._state.type&&this._state.cancel(),this._state=t,i||this._disposed||this._onDidChangeState.fire(t))}}var xZ,DZ=function(t,i){return function(e,s){i(e,s,t)}},EZ=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 AZ=xZ=class extends Hi{static get(t){return t.getContribution(xZ.ID)}constructor(t,i,e,s,n,r,o,h,c,l){super(),this._commandService=o,this._configurationService=h,this._actionWidgetService=c,this._instantiationService=l,this._activeCodeActions=this._register(new zi),this._showDisabled=!1,this._disposed=!1,this._editor=t,this._model=this._register(new SZ(this._editor,n.codeActionProvider,i,e,r,h)),this._register(this._model.onDidChangeState((t=>this.update(t)))),this._lightBulbWidget=new Mn((()=>{const t=this._editor.getContribution(KG.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(WG),this._register(this._editor.onDidLayoutChange((()=>this._actionWidgetService.hide())))}dispose(){this._disposed=!0,super.dispose()}showCodeActions(t,i,e){return this.showCodeActionList(i,e,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(t,i,e,s){var n;if(!this._editor.hasModel())return;null===(n=iZ.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 EZ(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction($G,t,BG.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:kG.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return EZ(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(!this._disposed)if(null===(e=this._lightBulbWidget.value)||void 0===e||e.update(c,t.trigger,t.position),1===t.trigger.type){if(null===(s=t.trigger.filter)||void 0===s?void 0:s.include){const i=this.tryGetValidActionToApply(t.trigger,c);if(i){try{null===(n=this._lightBulbWidget.value)||void 0===n||n.hide(),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=iZ.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=iZ.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 EZ(this,void 0,void 0,(function*(){const s=this._editor.createDecorationsCollection(),n=this._editor.getDomNode();if(!n)return;const r=e.includeDisabledActions&&(this._showDisabled||0===t.validActions.length)?t.allActions:t.validActions;if(!r.length)return;const o=gs.isIPosition(i)?this.toCoords(i):i,h={onSelect:(t,i)=>EZ(this,void 0,void 0,(function*(){this._applyCodeAction(t,!0,!!i),this._actionWidgetService.hide(),s.clear()})),onHide:()=>{var t;null===(t=this._editor)||void 0===t||t.focus(),s.clear()},onHover:(t,i)=>EZ(this,void 0,void 0,(function*(){var e;if(yield t.resolve(i),!i.isCancellationRequested)return{canPreview:!!(null===(e=t.action.edit)||void 0===e?void 0:e.edits.length)}})),onFocus:t=>{var i,e;if(t&&t.highlightRange&&t.action.diagnostics){s.set([{range:t.action.diagnostics[0],options:xZ.DECORATION}]);const n=t.action.diagnostics[0];nm(J(0,"Context: {0} at line {1} and column {2}.",null===(e=null===(i=this._editor.getModel())||void 0===i?void 0:i.getWordAtPosition({lineNumber:n.startLineNumber,column:n.startColumn}))||void 0===e?void 0:e.word,n.startLineNumber,n.startColumn))}else s.clear()}};this._actionWidgetService.show("codeActionWidget",!0,function(t,i,e){if(!i)return t.map((t=>{var i;return{kind:"action",item:t,group:VG,disabled:!!t.action.disabled,label:t.action.disabled||t.action.title,canPreview:!!(null===(i=t.action.edit)||void 0===i?void 0:i.edits.length)}}));const s=HG.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new CG(i.action.kind):CG.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}(r,this._shouldShowHeaders(),this._resolver.getResolver()),h,o,n,this._getActionBarActions(t,i,e))}))}toCoords(t){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(t,1),this._editor.render();const i=this._editor.getScrolledVisiblePosition(t),e=cl(this._editor.getDomNode());return{x:e.left+i.left,y:e.top+i.top+i.height}}_shouldShowHeaders(){var t;const i=null===(t=this._editor)||void 0===t?void 0:t.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:null==i?void 0:i.uri})}_getActionBarActions(t,i,e){if(e.fromLightbulb)return[];const s=t.documentation.map((t=>{var i;return{id:t.id,label:t.title,tooltip:null!==(i=t.tooltip)&&void 0!==i?i:"",class:void 0,enabled:!0,run:()=>{var i;return this._commandService.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}}}));return e.includeDisabledActions&&t.validActions.length>0&&t.allActions.length!==t.validActions.length&&s.push(this._showDisabled?{id:"hideMoreActions",label:J(0,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(t,i,e))}:{id:"showMoreActions",label:J(0,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(t,i,e))}),s}};function MZ(t){return Lo.regex(bZ.keys()[0],new RegExp("(\\s|^)"+Rn(t.value)+"\\b"))}AZ.ID="editor.contrib.codeActionController",AZ.DECORATION=$M.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),AZ=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}([DZ(1,FN),DZ(2,Jo),DZ(3,Zr),DZ(4,Wg),DZ(5,nR),DZ(6,uo),DZ(7,Ta),DZ(8,mZ),DZ(9,Zr)],AZ),kk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(qv));const e=t.getColor(Jv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${oy(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const LZ={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:J(0,"Kind of the code action to run.")},apply:{type:"string",description:J(0,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[J(0,"Always apply the first returned code action."),J(0,"Apply the first returned code action if it is the only one."),J(0,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:J(0,"Controls if only preferred code actions should be returned.")}}};function OZ(t,i,e,s,n=kG.Default){if(t.hasModel()){const r=AZ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}hu(AZ.ID,AZ,3),hu(KG.ID,KG,4),ru(class extends tu{constructor(){super({id:MG,label:J(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),kbOpts:{kbExpr:gS.textInputFocus,primary:2137,weight:100}})}run(t,i){return OZ(i,J(0,"No code actions available"),void 0,void 0,kG.QuickFix)}}),ru(class extends tu{constructor(){super({id:OG,label:J(0,"Refactor..."),alias:"Refactor...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),kbOpts:{kbExpr:gS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Lo.and(gS.writable,MZ(CG.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:LZ}]}})}run(t,i,e){const s=xG.fromUser(e,{kind:CG.Refactor,apply:"never"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred refactorings for '{0}' available":"No refactorings for '{0}' available",e.kind):J(0,s.preferred?"No preferred refactorings available":"No refactorings available"),{include:CG.Refactor.contains(s.kind)?s.kind:CG.None,onlyIncludePreferredActions:s.preferred},s.apply,kG.Refactor)}}),ru(class extends tu{constructor(){super({id:FG,label:J(0,"Source Action..."),alias:"Source Action...",precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Lo.and(gS.writable,MZ(CG.Source))},description:{description:"Source Action...",args:[{name:"args",schema:LZ}]}})}run(t,i,e){const s=xG.fromUser(e,{kind:CG.Source,apply:"never"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred source actions for '{0}' available":"No source actions for '{0}' available",e.kind):J(0,s.preferred?"No preferred source actions available":"No source actions available"),{include:CG.Source.contains(s.kind)?s.kind:CG.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,kG.SourceAction)}}),ru(class extends tu{constructor(){super({id:TG,label:J(0,"Organize Imports"),alias:"Organize Imports",precondition:Lo.and(gS.writable,MZ(CG.SourceOrganizeImports)),kbOpts:{kbExpr:gS.textInputFocus,primary:1581,weight:100}})}run(t,i){return OZ(i,J(0,"No organize imports action available"),{include:CG.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",kG.OrganizeImports)}}),ru(class extends tu{constructor(){super({id:LG,label:J(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Lo.and(gS.writable,MZ(CG.QuickFix)),kbOpts:{kbExpr:gS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return OZ(i,J(0,"No auto fixes available"),{include:CG.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",kG.AutoFix)}}),ru(class extends tu{constructor(){super({id:RG,label:J(0,"Fix All"),alias:"Fix All",precondition:Lo.and(gS.writable,MZ(CG.SourceFixAll))})}run(t,i){return OZ(i,J(0,"No fix all action available"),{include:CG.SourceFixAll,includeSourceActions:!0},"ifSingle",kG.FixAll)}}),nu(new class extends Xl{constructor(){super({id:AG,precondition:Lo.and(gS.writable,gS.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:LZ}]}})}runEditorCommand(t,i,e){const s=xG.fromUser(e,{kind:CG.Empty,apply:"ifSingle"});return OZ(i,"string"==typeof(null==e?void 0:e.kind)?J(0,s.preferred?"No preferred code actions for '{0}' available":"No code actions for '{0}' available",e.kind):J(0,s.preferred?"No preferred code actions available":"No code actions available"),{include:s.kind,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply)}}),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:J(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}})),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{"editor.codeActionWidget.includeNearbyQuickfixes":{type:"boolean",scope:5,description:J(0,"Enable/disable showing nearest quickfix within a line when not currently on a diagnostic."),default:!1}}}));var FZ=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 TZ{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 RZ(t,i,e){return FZ(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new TZ,o=s.map(((t,s)=>FZ(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}))}ao.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(ss.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get(Wg),r=t.get(Xr).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return RZ(n,r,ue.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,ue.None)).then((t=>o.push(t||e.symbol))));return Promise.all(i)})).then((()=>o)).finally((()=>{setTimeout((()=>h.dispose()),100)}))}));const _Z=Qr("ICodeLensCache");class IZ{constructor(t,i){this.lineCount=t,this.data=i}}let PZ=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new lg(20,.75),Lu((()=>t.remove("codelens/cache",1)));const i="codelens/cache2",e=t.get(i,1,"{}");this._deserialize(e),Ji.once(t.onWillSaveState)((e=>{e.reason===NP.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 TZ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new IZ(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 ps(t,1,t,11)});const n=new TZ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new IZ(e.lineCount,n))}}catch(t){}}};PZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,PP)],PZ),Wa(_Z,PZ,1);class NZ{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 BZ{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+BZ._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=sI(n.command.title.trim());n.command.id?(e.push(Pl("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(Pl("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(Pl("span",void 0," | "))}}s?(Tl(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Tl(this._domNode,Pl("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}}BZ._idPool=0;class $Z{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 jZ=$M.register({collapseOnReplaceEdit:!0,description:"codelens"});class WZ{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:jZ},(t=>this._decorationIds[i]=t)),o=o?ps.plusRange(o,t.symbol.range):ps.lift(t.symbol.range)})),this._viewZone=new NZ(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 BZ(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||ps.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:jZ},(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 VZ=function(t,i){return function(e,s){i(e,s,t)}},HZ=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 zZ=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 Mu((()=>this._resolveCodeLensesInViewport()),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>this._onModelChange()))),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(19)||t.hasChanged(18))&&this._updateLensStyle(),t.hasChanged(17)&&this._onModelChange()}))),this._disposables.add(i.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){var t;this._localDispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),null===(t=this._currentCodeLensModel)||void 0===t||t.dispose()}_getLayoutInfo(){const t=Math.max(1.3,this._editor.getOption(66)/this._editor.getOption(52));let i=this._editor.getOption(19);return(!i||i<5)&&(i=.9*this._editor.getOption(52)|0),{fontSize:i,codeLensHeight:i*t|0}}_updateLensStyle(){const{codeLensHeight:t,fontSize:i}=this._getLayoutInfo(),e=this._editor.getOption(18),s=this._editor.getOption(50),{style:n}=this._editor.getContainerDomNode();n.setProperty("--vscode-editorCodeLens-lineHeight",`${t}px`),n.setProperty("--vscode-editorCodeLens-fontSize",`${i}px`),n.setProperty("--vscode-editorCodeLens-fontFeatureSettings",s.fontFeatureSettings),e&&(n.setProperty("--vscode-editorCodeLens-fontFamily",e),n.setProperty("--vscode-editorCodeLens-fontFamilyDefault",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(17)||t.isTooLargeForTokenization())return;const i=this._codeLensCache.get(t);if(i&&this._renderCodeLensSymbols(i),!this._languageFeaturesService.codeLensProvider.has(t))return void(i&&this._localToDispose.add(xu((()=>{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 Mu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=wu((i=>RZ(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 $Z;e.forEach((t=>{t.dispose(n,i),this._lenses.splice(this._lenses.indexOf(t),1)})),n.commit(t)}))})),e.schedule(),this._resolveCodeLensesScheduler.cancel(),null===(t=this._resolveCodeLensesPromise)||void 0===t||t.cancel(),this._resolveCodeLensesPromise=void 0}))),this._localToDispose.add(this._editor.onDidFocusEditorWidget((()=>{e.schedule()}))),this._localToDispose.add(this._editor.onDidBlurEditorText((()=>{e.cancel()}))),this._localToDispose.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(this._editor.onDidLayoutChange((()=>{this._resolveCodeLensesInViewportSoon()}))),this._localToDispose.add(Wi((()=>{if(this._editor.getModel()){const t=tU.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 $Z;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=tU.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new $Z;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 WZ(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 WZ(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=wu((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(){var t;return HZ(this,void 0,void 0,(function*(){return yield this._getCodeLensModelPromise,yield this._resolveCodeLensesPromise,(null===(t=this._currentCodeLensModel)||void 0===t?void 0:t.isDisposed)?void 0:this._currentCodeLensModel}))}};zZ.ID="css.editor.codeLens",zZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([VZ(1,Wg),VZ(2,FF),VZ(3,uo),VZ(4,vO),VZ(5,_Z)],zZ),hu(zZ.ID,zZ,1),ru(class extends tu{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:gS.hasCodeLensProvider,label:J(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return HZ(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Ij),s=t.get(uo),n=t.get(vO),r=i.getSelection().positionLineNumber,o=i.getContribution(zZ.ID);if(!o)return;const h=yield o.getModel();if(!h)return;const c=[];for(const t of h.lenses)t.symbol.command&&t.symbol.range.startLineNumber===r&&c.push({label:t.symbol.command.title,command:t.symbol.command});if(0===c.length)return;const l=yield e.pick(c,{canPickMany:!1,placeHolder:J(0,"Select a command")});if(!l)return;let u=l.command;if(h.isDisposed){const t=yield o.getModel(),i=null==t?void 0:t.lenses.find((t=>{var i;return t.symbol.range.startLineNumber===r&&(null===(i=t.symbol.command)||void 0===i?void 0:i.title)===u.title}));if(!i||!i.symbol.command)return;u=i.symbol.command}try{yield s.executeCommand(u.id,...u.arguments||[])}catch(t){n.error(t)}}))}});var UZ=function(t,i){return function(e,s){i(e,s,t)}};class KZ{constructor(t,i){this._editorWorkerClient=new Qg(t,!1,"editorWorkerService",i)}provideDocumentColors(t,i){return 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())}))}(this,void 0,void 0,(function*(){return this._editorWorkerClient.computeDefaultDocumentColors(t.uri)}))}provideColorPresentations(t,i,e){const s=i.range,n=i.color,r=n.alpha,o=new Mg(new Dg(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Mg.Format.CSS.formatRGB(o):Mg.Format.CSS.formatRGBA(o),c=r?Mg.Format.CSS.formatHSL(o):Mg.Format.CSS.formatHSLA(o),l=r?Mg.Format.CSS.formatHex(o):Mg.Format.CSS.formatHexA(o),u=[];return u.push({label:h,textEdit:{range:s,text:h}}),u.push({label:c,textEdit:{range:s,text:c}}),u.push({label:l,textEdit:{range:s,text:l}}),u}}let qZ=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new KZ(t,i)))}};qZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([UZ(0,Xr),UZ(1,ud),UZ(2,Wg)],qZ),tH(qZ);var GZ=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 ZZ(t,i,e,s=!0){return GZ(this,void 0,void 0,(function*(){return tJ(new QZ,t,i,e,s)}))}function JZ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class QZ{constructor(){}compute(t,i,e,s){return GZ(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 YZ{constructor(){}compute(t,i,e,s){return GZ(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 XZ{constructor(t){this.colorInfo=t}compute(t,i,e,s){return GZ(this,void 0,void 0,(function*(){const e=yield t.provideColorPresentations(i,this.colorInfo,ue.None);return Array.isArray(e)&&s.push(...e),Array.isArray(e)}))}}function tJ(t,i,e,s,n){return GZ(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 KZ)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 iJ(t,i){const{colorProvider:e}=t.get(Wg),s=t.get(Xr).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(Ta).getValue("editor.defaultColorDecorators",{resource:i})}}ao.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof ss))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=iJ(t,e);return tJ(new YZ,n,s,ue.None,r)})),ao.registerCommand("_executeColorPresentationProvider",(function(t,...i){const[e,s]=i,{uri:n,range:r}=s;if(!(n instanceof ss&&Array.isArray(e)&&4===e.length&&ps.isIRange(r)))throw Ti();const{model:o,colorProviderRegistry:h,isDefaultColorDecoratorsEnabled:c}=iJ(t,n),[l,u,a,d]=e;return tJ(new XZ({range:r,color:{red:l,green:u,blue:a,alpha:d}}),h,o,ue.None,c)}));var eJ,sJ=function(t,i){return function(e,s){i(e,s,t)}},nJ=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 rJ=Object.create({});let oJ=eJ=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._configurationService=i,this._languageFeaturesService=e,this._localToDispose=this._register(new Vi),this._decorationsIds=[],this._colorDatas=new Map,this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=new Ub(this._editor),this._decoratorLimitReporter=new hJ,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:eJ.RECOMPUTE_TIME}),this._register(t.onDidChangeModel((()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()}))),this._register(t.onDidChangeModelLanguage((()=>this.updateColors()))),this._register(e.colorProvider.onDidChange((()=>this.updateColors()))),this._register(t.onDidChangeConfiguration((t=>{const i=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145);const e=i!==this._isColorDecoratorsEnabled||t.hasChanged(21),s=t.hasChanged(145);(e||s)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())}))),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._isDefaultColorDecoratorsEnabled=this._editor.getOption(145),this.updateColors()}isEnabled(){const t=this._editor.getModel();if(!t)return!1;const i=t.getLanguageId(),e=this._configurationService.getValue(i);if(e&&"object"==typeof e){const t=e.colorDecorators;if(t&&void 0!==t.enable&&!t.enable)return t.enable}return this._editor.getOption(20)}static get(t){return t.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const t=this._editor.getModel();t&&this._languageFeaturesService.colorProvider.has(t)&&(this._localToDispose.add(this._editor.onDidChangeModelContent((()=>{this._timeoutTimer||(this._timeoutTimer=new Eu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return nJ(this,void 0,void 0,(function*(){this._computePromise=wu((t=>nJ(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Zi(!1),s=yield ZZ(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:$M.EMPTY})));this._editor.changeDecorations((e=>{this._decorationsIds=e.deltaDecorations(this._decorationsIds,i),this._colorDatas=new Map,this._decorationsIds.forEach(((i,e)=>this._colorDatas.set(i,t[e])))}))}updateColorDecorators(t){this._colorDecorationClassRefs.clear();const i=[],e=this._editor.getOption(21);for(let s=0;s<t.length&&i.length<e;s++){const{red:e,green:n,blue:r,alpha:o}=t[s].colorInfo.color,h=new Dg(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:rJ}}})}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(ps.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)}};oJ.ID="editor.contrib.colorDetector",oJ.RECOMPUTE_TIME=1e3,oJ=eJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([sJ(1,Ta),sJ(2,Wg),sJ(3,FF)],oJ);class hJ{constructor(){this._onDidChange=new ie,this._computed=0,this._limited=!1}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}hu(oJ.ID,oJ,1);class cJ{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 ie,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new ie,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new ie,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 lJ=Pl;class uJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=lJ(".colorpicker-header"),Ol(t,this._domNode),this._pickedColorNode=Ol(this._domNode,lJ(".picked-color")),Ol(this._pickedColorNode,lJ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Ol(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const n=J(0,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",n),this._originalColorNode=Ol(this._domNode,lJ(".original-color")),this._originalColorNode.style.backgroundColor=Mg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(Yv)||Mg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Yv)||Mg.white}))),this._register(Qc(this._pickedColorNode,El.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Qc(this._originalColorNode,El.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=Mg.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 aJ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Mg.Format.CSS.format(t)||"",this._pickedColorNode.classList.toggle("light",t.rgba.a<.5?this.backgroundColor.isLighter():t.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}class aJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Ol(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Ol(this._button,i),Ol(i,lJ(".button"+eo.asCSSSelector(GW("color-picker-close",ys.close,J(0,"Icon to close the color picker"))))).classList.add("close-icon"),this._button.onclick=()=>{this._onClicked.fire()}}}class dJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=lJ(".colorpicker-body"),Ol(t,this._domNode),this._saturationBox=new fJ(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 pJ(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 mJ(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 vJ(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 Mg(new Ag(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Mg(new Ag(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Mg(new Ag(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 fJ extends Hi{constructor(t,i,e){super(),this.model=i,this.pixelRatio=e,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ie,this.onColorFlushed=this._onColorFlushed.event,this._domNode=lJ(".saturation-wrap"),Ol(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ol(this._domNode,this._canvas),this.selection=lJ(".saturation-selection"),Ol(this._domNode,this.selection),this.layout(),this._register(Qc(this._domNode,El.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 Dm);const i=cl(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=Qc(t.target.ownerDocument,El.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 Mg(new Ag(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=Mg.Format.CSS.format(t),i.fill(),i.fillStyle=e,i.fill(),i.fillStyle=s,i.fill()}paintSelection(t,i){this.selection.style.left=t*this.width+"px",this.selection.style.top=this.height-i*this.height+"px"}onDidChangeColor(t){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const i=t.hsva;this.paintSelection(i.s,i.v)}}class gJ extends Hi{constructor(t,i,e=!1){super(),this.model=i,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new ie,this.onColorFlushed=this._onColorFlushed.event,e?(this.domNode=Ol(t,lJ(".standalone-strip")),this.overlay=Ol(this.domNode,lJ(".standalone-overlay"))):(this.domNode=Ol(t,lJ(".strip")),this.overlay=Ol(this.domNode,lJ(".overlay"))),this.slider=Ol(this.domNode,lJ(".slider")),this.slider.style.top="0px",this._register(Qc(this.domNode,El.POINTER_DOWN,(t=>this.onPointerDown(t)))),this._register(i.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const t=this.getValue(this.model.color);this.updateSliderPosition(t)}onDidChangeColor(t){const i=this.getValue(t);this.updateSliderPosition(i)}onPointerDown(t){if(!(t.target&&t.target instanceof Element))return;const i=this._register(new Dm),e=cl(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=Qc(t.target.ownerDocument,El.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 pJ extends gJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(t){super.onDidChangeColor(t);const{r:i,g:e,b:s}=t.rgba,n=new Mg(new Dg(i,e,s,1)),r=new Mg(new Dg(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class mJ extends gJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class vJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=Ol(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 wJ extends Ty{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Ar.onDidChange((()=>this.layout())));const r=lJ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new uJ(r,this.model,s,n)),this.body=this._register(new dJ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var bJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},kJ=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 CJ{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 SJ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return Ru.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=oJ.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 EJ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return AJ(this,this._editor,this._themeService,i,t)}};SJ=bJ([yJ(1,mk)],SJ);class xJ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let DJ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!oJ.get(this._editor))return null;const s=yield ZZ(e,this._editor.getModel(),ue.None);let n=null,r=null;for(const i of s){const e=i.colorInfo;ps.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 EJ(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return kJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=t.model;let e=new ps(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn);this._color&&(yield LJ(this._editor.getModel(),i,this._color,e,t),e=MJ(this._editor,e,i))}))}renderHoverParts(t,i){return AJ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function EJ(t,i,e,s){return kJ(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Dg(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),u=new Mg(l),a=yield JZ(i,e,s,ue.None),d=new cJ(u,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(u,n),t instanceof SJ?new CJ(t,ps.lift(e.range),d,s):new xJ(t,ps.lift(e.range),d,s)}))}function AJ(t,i,e,s,n){if(0===s.length||!i.hasModel())return Hi.None;if(n.setMinimumDimensions){const t=i.getOption(66)+8;n.setMinimumDimensions(new ol(302,t))}const r=new Vi,o=s[0],h=i.getModel(),c=o.model,l=r.add(new wJ(n.fragment,c,i.getOption(141),e,t instanceof DJ));n.setColorPicker(l);let u=!1,a=new ps(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof DJ){const i=s[0].model.color;t.color=i,LJ(h,c,i,a,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>kJ(this,void 0,void 0,(function*(){yield LJ(h,c,t,a,o),u=!0,a=MJ(i,a,c,n)})))));return r.add(c.onDidChangeColor((t=>{LJ(h,c,t,a,o)}))),r.add(i.onDidChangeModelContent((()=>{u?u=!1:(n.hide(),i.focus())}))),r}function MJ(t,i,e,s){let n,r;if(e.presentation.textEdit){n=[e.presentation.textEdit],r=new ps(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 LJ(t,i,e,s,n){return kJ(this,void 0,void 0,(function*(){const r=yield JZ(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,ue.None);i.colorPresentations=r||[]}))}function OJ(t,i){return!!t[i]}DJ=bJ([yJ(1,mk)],DJ);class FJ{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=OJ(t.event,i.triggerModifier),this.hasSideBySideModifier=OJ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class TJ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=OJ(t,i.triggerModifier)}}class RJ{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 _J(t){return"altKey"===t?ft?new RJ(57,"metaKey",6,"altKey"):new RJ(5,"ctrlKey",6,"altKey"):ft?new RJ(6,"altKey",57,"metaKey"):new RJ(6,"altKey",5,"ctrlKey")}class IJ extends Hi{constructor(t,i){var e;super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ie),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ie),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ie),this.onCancel=this._onCancel.event,this._editor=t,this._extractLineNumberFromMouseEvent=null!==(e=null==i?void 0:i.extractLineNumberFromMouseEvent)&&void 0!==e?e:t=>t.target.position?t.target.position.lineNumber:0,this._opts=_J(this._editor.getOption(77)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((t=>{if(t.hasChanged(77)){const t=_J(this._editor.getOption(77));if(this._opts.equals(t))return;this._opts=t,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}}))),this._register(this._editor.onMouseMove((t=>this._onEditorMouseMove(new FJ(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new FJ(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new FJ(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new TJ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new TJ(t,this._opts))))),this._register(this._editor.onMouseDrag((()=>this._resetHandler()))),this._register(this._editor.onDidChangeCursorSelection((t=>this._onDidChangeCursorSelection(t)))),this._register(this._editor.onDidChangeModel((()=>this._resetHandler()))),this._register(this._editor.onDidChangeModelContent((()=>this._resetHandler()))),this._register(this._editor.onDidScrollChange((t=>{(t.scrollTopChanged||t.scrollLeftChanged)&&this._resetHandler()})))}_onDidChangeCursorSelection(t){t.selection&&t.selection.startColumn!==t.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(t){this._lastMouseMoveEvent=t,this._onMouseMoveOrRelevantKeyDown.fire([t,null])}_onEditorMouseDown(t){this._hasTriggerKeyOnMouseDown=t.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(t)}_onEditorMouseUp(t){const i=this._extractLineNumberFromMouseEvent(t);this._hasTriggerKeyOnMouseDown&&this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===i&&this._onExecute.fire(t)}_onEditorKeyDown(t){this._lastMouseMoveEvent&&(t.keyCodeIsTriggerKey||t.keyCodeIsSideBySideKey&&t.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,t]):t.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(t){t.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}var PJ=function(t,i){return function(e,s){i(e,s,t)}};let NJ=class extends HO{constructor(t,i,e,s,n,r,o,h,c,l,u,a,d){super(t,Object.assign(Object.assign({},s.getRawOptions()),{overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()}),e,n,r,o,h,c,l,u,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){K(this._overwriteOptions,t,!0),super.updateOptions(this._overwriteOptions)}};NJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([PJ(4,Zr),PJ(5,Yr),PJ(6,uo),PJ(7,Jo),PJ(8,mk),PJ(9,vO),PJ(10,gm),PJ(11,ud),PJ(12,Wg)],NJ);const BJ=new Mg(new Dg(0,122,204)),$J={showArrow:!0,showFrame:!0,className:"",frameColor:BJ,arrowColor:BJ,keepEditorSelection:!1};class jJ{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 WJ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class VJ{constructor(t){this._editor=t,this._ruleName=VJ._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),xl(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(){xl(this._ruleName),Sl(`.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:ps.fromPositions(t),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}VJ._IdGenerator=new rI(".arrow-decoration-");class HJ{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=V(i),K(this.options,$J,!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 VJ(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=ps.isIRange(t)?ps.lift(t):ps.fromPositions(t);this._isShowing=!0,this._showImpl(e,i),this._isShowing=!1,this._positionMarkerId.set([{range:e,options:$M.EMPTY}])}hide(){var t;this._viewZone&&(this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id)})),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),null===(t=this._arrow)||void 0===t||t.hide(),this._positionMarkerId.clear()}_decoratingElementsHeight(){const t=this.editor.getOption(66);let i=0;return this.options.showArrow&&(i+=2*Math.round(t/3)),this.options.showFrame&&(i+=2*Math.round(t/9)),i}_showImpl(t,i){const e=t.getStartPosition(),s=this.editor.getLayoutInfo(),n=this._getWidth(s);this.domNode.style.width=`${n}px`,this.domNode.style.left=this._getLeft(s)+"px";const r=document.createElement("div");r.style.overflow="hidden";const o=this.editor.getOption(66);if(!this.options.allowUnlimitedHeight){const t=Math.max(12,this.editor.getLayoutInfo().height/o*.8);i=Math.min(i,t)}let h=0,c=0;if(this._arrow&&this.options.showArrow&&(h=Math.round(o/3),this._arrow.height=h,this._arrow.show(e)),this.options.showFrame&&(c=Math.round(o/9)),this.editor.changeViewZones((t=>{this._viewZone&&t.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new jJ(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 WJ("vs.editor.contrib.zoneWidget"+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)})),this.container&&this.options.showFrame){const t=this.options.frameWidth?this.options.frameWidth:c;this.container.style.borderTopWidth=t+"px",this.container.style.borderBottomWidth=t+"px"}const l=i*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=h+"px",this.container.style.height=l+"px",this.container.style.overflow="hidden"),this._doLayout(l,n),this.options.keepEditorSelection||this.editor.setSelection(t);const u=this.editor.getModel();if(u){const i=u.validateRange(new ps(t.startLineNumber,1,t.endLineNumber+1,1));this.revealRange(i,i.startLineNumber===u.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 tB(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0),this._disposables.add(this._resizeSash.onDidStart((i=>{this._viewZone&&(t={startY:i.startY,heightInLines:this._viewZone.heightInLines})}))),this._disposables.add(this._resizeSash.onDidEnd((()=>{t=void 0}))),this._disposables.add(this._resizeSash.onDidChange((i=>{if(t){const e=(i.currentY-t.startY)/this.editor.getOption(66),s=e<0?Math.ceil(e):Math.floor(e),n=t.heightInLines+s;n>5&&n<35&&this._relayout(n)}})))}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(null===this.domNode.style.height?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const t=this.editor.getLayoutInfo();return t.width-t.minimap.minimapWidth}}var zJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},UJ=function(t,i){return function(e,s){i(e,s,t)}};const KJ=Qr("IPeekViewService");var qJ;Wa(KJ,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 Zo("inReferenceSearchEditor",!0,J(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(qJ||(qJ={}));let GJ=class{constructor(t,i){t instanceof NJ&&qJ.inPeekEditor.bindTo(i)}dispose(){}};GJ.ID="editor.contrib.referenceController",GJ=zJ([UJ(1,Jo)],GJ),hu(GJ.ID,GJ,0);const ZJ={headerBackgroundColor:Mg.white,primaryHeadingColor:Mg.fromHex("#333333"),secondaryHeadingColor:Mg.fromHex("#6c6c6cb3")};let JJ=class extends HJ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,K(this.options,ZJ,!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=Pl(".head"),this._bodyElement=Pl(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=Pl(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Xc(this._titleElement,"click",(t=>this._onTitleClick(t)))),Ol(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Pl("span.filename"),this._secondaryHeading=Pl("span.dirname"),this._metaHeading=Pl("span.meta"),Ol(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=Pl(".peekview-actions");Ol(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new cN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new no("peekview.close",J(0,"Close"),eo.asClassName(ys.close),!0,(()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(t){}_getActionBarOptions(){return{actionViewItemProvider:hN.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:Gc(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Nl(this._metaHeading)):Bl(this._metaHeading))}_doLayout(t,i){if(!this._isShowing&&t<0)return void this.dispose();const e=Math.ceil(1.2*this.editor.getOption(66)),s=Math.round(t-(e+2));this._doLayoutHead(e,i),this._doLayoutBody(s,i)}_doLayoutHead(t,i){this._headElement&&(this._headElement.style.height=`${t}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(t,i){this._bodyElement&&(this._bodyElement.style.height=`${t}px`)}};JJ=zJ([UJ(2,Zr)],JJ);const QJ=Om("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view title area.")),YJ=Om("peekViewTitleLabel.foreground",{dark:Mg.white,light:Mg.black,hcDark:Mg.white,hcLight:Mv},J(0,"Color of the peek view title.")),XJ=Om("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},J(0,"Color of the peek view title info.")),tQ=Om("peekView.border",{dark:xv,light:xv,hcDark:Im,hcLight:Im},J(0,"Color of the peek view borders and arrow.")),iQ=Om("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view result list."));Om("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color for line nodes in the peek view result list.")),Om("peekViewResult.fileForeground",{dark:Mg.white,light:"#1E1E1E",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color for file nodes in the peek view result list.")),Om("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},J(0,"Background color of the selected entry in the peek view result list.")),Om("peekViewResult.selectionForeground",{dark:Mg.white,light:"#6C6C6C",hcDark:Mg.white,hcLight:Mv},J(0,"Foreground color of the selected entry in the peek view result list."));const eQ=Om("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Mg.black,hcLight:Mg.white},J(0,"Background color of the peek view editor."));Om("peekViewEditorGutter.background",{dark:eQ,light:eQ,hcDark:eQ,hcLight:eQ},J(0,"Background color of the gutter in the peek view editor.")),Om("peekViewEditorStickyScroll.background",{dark:eQ,light:eQ,hcDark:eQ,hcLight:eQ},J(0,"Background color of sticky scroll in the peek view editor.")),Om("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view result list.")),Om("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view editor.")),Om("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Pm,hcLight:Pm},J(0,"Match highlight border in the peek view editor."));class sQ{constructor(t,i,e,s){this.isProviderFirst=t,this.parent=i,this.link=e,this._rangeCallback=s,this.id=oI.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?J(0,"{0} in {1} on line {2} at column {3}",i.value,FE(this.uri),this.range.startLineNumber,this.range.startColumn):J(0,"in {0} on line {1} at column {2}",FE(this.uri),this.range.startLineNumber,this.range.startColumn)}}class nQ{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 ps(s,h.startColumn,s,n),l=new ps(r,o,r,1073741824),u=e.getValueInRange(c).replace(/^\s+/,""),a=e.getValueInRange(t);return{value:u+a+e.getValueInRange(l).replace(/\s+$/,""),highlight:{start:u.length,end:u.length+a.length}}}}class rQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new hg}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?J(0,"1 symbol in {0}, full path {1}",FE(this.uri),this.uri.fsPath):J(0,"{0} symbols in {1}, full path {2}",t,FE(this.uri),this.uri.fsPath)}resolve(t){return 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())}))}(this,void 0,void 0,(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 nQ(e))}catch(t){Ei(t)}return this}))}}class oQ{constructor(t,i){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ie,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=i;const[e]=t;let s;t.sort(oQ._compareReferences);for(const i of t)if(s&&ME.isEqual(s.uri,i.uri,!0)||(s=new rQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==oQ._compareReferences(i,s.children[s.children.length-1])){const t=new sQ(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 oQ(this._links,this._title)}get title(){return this._title}get isEmpty(){return 0===this.groups.length}get ariaMessage(){return this.isEmpty?J(0,"No results found"):1===this.references.length?J(0,"Found 1 symbol in {0}",this.references[0].uri.fsPath):1===this.groups.length?J(0,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):J(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:Qn(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()&&ps.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 ME.compare(t.uri,i.uri)||ps.compareRangesUsingStarts(t.range,i.range)}}var hQ,cQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},lQ=function(t,i){return function(e,s){i(e,s,t)}};let uQ=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof oQ||t instanceof rQ}getChildren(t){if(t instanceof oQ)return t.groups;if(t instanceof rQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};uQ=cQ([lQ(0,to)],uQ);class aQ{getHeight(){return 23}getTemplateId(t){return t instanceof rQ?pQ.id:vQ.id}}let dQ=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof sQ){const e=null===(i=t.parent.getPreview(t))||void 0===i?void 0:i.preview(t.range);if(e)return e.value}return FE(t.uri)}};dQ=cQ([lQ(0,CC)],dQ);class fQ{getId(t){return t instanceof sQ?t.id:t.uri}}let gQ=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 Jj(e,{supportHighlights:!0})),this.badge=new $j(Ol(e,Pl(".count")),{},UP),t.appendChild(e)}set(t,i){const e=RE(t.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(t.uri),this._labelService.getUriLabel(e,{relative:!0}),{title:this._labelService.getUriLabel(t.uri),matches:i});const s=t.children.length;this.badge.setCount(s),this.badge.setTitleFormat(J(0,s>1?"{0} references":"{0} reference",s))}};gQ=cQ([lQ(1,iR)],gQ);let pQ=hQ=class{constructor(t){this._instantiationService=t,this.templateId=hQ.id}renderTemplate(t){return this._instantiationService.createInstance(gQ,t)}renderElement(t,i,e){e.set(t.element,v_(t.filterData))}disposeTemplate(t){t.dispose()}};pQ.id="FileReferencesRenderer",pQ=hQ=cQ([lQ(0,Zr)],pQ);class mQ{constructor(t){this.label=new Gj(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&&!L_.isDefault(i)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(t,v_(i))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(t,[e]))}else this.label.set(`${FE(t.uri)}:${t.range.startLineNumber+1}:${t.range.startColumn+1}`)}}class vQ{constructor(){this.templateId=vQ.id}renderTemplate(t){return new mQ(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}vQ.id="OneReferenceRenderer";class wQ{getWidgetAriaLabel(){return J(0,"References")}getAriaLabel(t){return t.ariaMessage}}var bQ=function(t,i){return function(e,s){i(e,s,t)}},yQ=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 kQ{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:kQ.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;ps.equalsRange(n,s.range)||((ps.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()}}kQ.DecorationOptions=$M.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class CQ{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 SQ extends xj{}let xQ=class extends JJ{constructor(t,i,e,s,n,r,o,h,c,l,u,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=l,this._languageService=u,this._languageConfigurationService=a,this._disposeOnNewModel=new Vi,this._callOnDispose=new Vi,this._onDidSelectReference=new ie,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new ol(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(tQ)||Mg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(QJ)||Mg.transparent,primaryHeadingColor:t.getColor(YJ),secondaryHeadingColor:t.getColor(XJ)})}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=Ol(t,Pl("div.messages")),Bl(this._messageContainer),this._splitView=new hB(t,{orientation:1}),this._previewContainer=Ol(t,Pl("div.preview.inline")),this._preview=this._instantiationService.createInstance(NJ,this._previewContainer,{scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}},{},this.editor),Bl(this._previewContainer),this._previewNotAvailableMessage=new LM(J(0,"no preview available"),ed,LM.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Ol(t,Pl("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new wQ,keyboardNavigationLabelProvider:this._instantiationService.createInstance(dQ),identityProvider:new fQ,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:iQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Xc(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(SQ,"ReferencesWidget",this._treeContainer,new aQ,[this._instantiationService.createInstance(pQ),this._instantiationService.createInstance(vQ)],this._instantiationService.createInstance(uQ),i),this._splitView.addView({onDidChange:Ji.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:t=>{this._preview.layout({height:this._dim.height,width:t})}},oB.Distribute),this._splitView.addView({onDidChange:Ji.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:t=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${t}px`,this._tree.layout(this._dim.height,t)}},oB.Distribute),this._disposables.add(this._splitView.onDidSashChange((()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)}),void 0));const e=(t,i)=>{t instanceof sQ&&("show"===i&&this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:i,source:"tree"}))};this._tree.onDidOpen((t=>{e(t.element,t.sideBySide?"side":t.editorOptions.pinned?"goto":"show")})),Bl(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new ol(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=J(0,"No results"),Nl(this._messageContainer),Promise.resolve(void 0)):(Bl(this._messageContainer),this._decorationsManager=new kQ(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"),Nl(this._treeContainer),Nl(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 sQ?t:t instanceof rQ&&t.children.length>0?t.children[0]:void 0}revealReference(t){return yQ(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return yQ(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==Vc.inMemory?this.setTitle(OE(t.uri),this._uriLabel.getUriLabel(RE(t.uri))):this.setTitle(J(0,"References"));const e=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 s=yield e;if(!this._model)return void s.dispose();$i(this._previewModelReference);const n=s.object;if(n){const i=this._preview.getModel()===n.textEditorModel?0:1,e=ps.lift(t.range).collapseToStart();this._previewModelReference=s,this._preview.setModel(n.textEditorModel),this._preview.setSelection(e),this._preview.revealRangeInCenter(e,i)}else this._preview.setModel(this._previewNotAvailableMessage),s.dispose()}))}};xQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([bQ(3,mk),bQ(4,to),bQ(5,Zr),bQ(6,KJ),bQ(7,iR),bQ(8,bM),bQ(9,CC),bQ(10,Ba),bQ(11,ud)],xQ);var DQ,EQ=function(t,i){return function(e,s){i(e,s,t)}},AQ=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 MQ=new Zo("referenceSearchVisible",!1,J(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let LQ=DQ=class{static get(t){return t.getContribution(DQ.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=MQ.bindTo(e)}dispose(){var t,i;this._referenceSearchVisible.reset(),this._disposables.dispose(),null===(t=this._widget)||void 0===t||t.dispose(),null===(i=this._model)||void 0===i||i.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(t,i,e){let s;if(this._widget&&(s=this._widget.position),this.closeWidget(),s&&t.containsPosition(s))return;this._peekMode=e,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage((()=>{this.closeWidget()}))),this._disposables.add(this._editor.onDidChangeModel((()=>{this._ignoreModelChangeEvent||this.closeWidget()})));const n="peekViewLayout",r=CQ.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(xQ,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(J(0,"Loading...")),this._widget.show(t),this._disposables.add(this._widget.onDidClose((()=>{i.cancel(),this._widget&&(this._storageService.store(n,JSON.stringify(this._widget.layoutData),0,1),this._widget=void 0),this.closeWidget()}))),this._disposables.add(this._widget.onDidSelectReference((t=>{const{element:i,kind:s}=t;if(i)switch(s){case"open":"editor"===t.source&&this._configurationService.getValue("editor.stablePeek")||this.openReference(i,!1,!1);break;case"side":this.openReference(i,!0,!1);break;case"goto":e?this._gotoReference(i,!0):this.openReference(i,!1,!0)}})));const o=++this._requestIdPool;i.then((i=>{var e;if(o===this._requestIdPool&&this._widget)return null===(e=this._model)||void 0===e||e.dispose(),this._model=i,this._widget.setModel(this._model).then((()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._widget.setMetaTitle(this._model.isEmpty?"":J(0,"{0} ({1})",this._model.title,this._model.references.length));const i=this._editor.getModel().uri,e=new gs(t.startLineNumber,t.startColumn),s=this._model.nearestReference(i,e);if(s)return this._widget.setSelection(s).then((()=>{this._widget&&"editor"===this._editor.getOption(86)&&this._widget.focusOnPreviewEditor()}))}}));i.dispose()}),(t=>{this._notificationService.error(t)}))}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}goToNextOrPreviousReference(t){return AQ(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 AQ(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(t,i){var e;null===(e=this._widget)||void 0===e||e.hide(),this._ignoreModelChangeEvent=!0;const s=ps.lift(t.range).collapseToStart();return this._editorService.openCodeEditor({resource:t.uri,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor).then((t=>{var i;if(this._ignoreModelChangeEvent=!1,t&&this._widget)if(this._editor===t)this._widget.show(s),this._widget.focusOnReferenceTree();else{const e=DQ.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,wu((()=>Promise.resolve(n))),null!==(i=this._peekMode)&&void 0!==i&&i)}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 OQ(t,i){const e=function(t){const i=t.get(Yr).getFocusedCodeEditor();return i instanceof NJ?i.getParentEditor():i}(t);if(!e)return;const s=LQ.get(e);s&&i(s)}LQ.ID="editor.contrib.referencesController",LQ=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}([EQ(2,Jo),EQ(3,Yr),EQ(4,vO),EQ(5,Zr),EQ(6,PP),EQ(7,Ta)],LQ),gh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:xe(2089,60),when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),gh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),gh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Lo.or(MQ,qJ.inPeekEditor),handler(t){OQ(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),ao.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),ao.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),ao.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),ao.registerCommand("closeReferenceSearch",(t=>OQ(t,(t=>t.closeWidget())))),gh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Lo.and(qJ.inPeekEditor,Lo.not("config.editor.stablePeek"))}),gh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Lo.and(MQ,Lo.not("config.editor.stablePeek"))}),gh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Lo.and(MQ,I$,W$.negate(),H$.negate()),handler(t){var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.revealReference(e[0])))}}),gh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Lo.and(MQ,I$,W$.negate(),H$.negate()),handler(t){var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.openReference(e[0],!0,!0)))}}),ao.registerCommand("openReference",(t=>{var i;const e=null===(i=t.get(F$).lastFocusedList)||void 0===i?void 0:i.getFocus();Array.isArray(e)&&e[0]instanceof sQ&&OQ(t,(t=>t.openReference(e[0],!1,!0)))}));var 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},TQ=function(t,i){return function(e,s){i(e,s,t)}};const RQ=new Zo("hasSymbols",!1,J(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),_Q=Qr("ISymbolNavigationService");let IQ=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=RQ.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 PQ(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(LE(t.uri,e.uri))n=!0,r=r||ps.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:ps.collapseToStart(i.range),selectionRevealType:3}},t).finally((()=>{this._ignoreEditorChange=!1}))}_showMessage(){var t;null===(t=this._currentMessage)||void 0===t||t.dispose();const i=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),e=i?J(0,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,i.getLabel()):J(0,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(e)}};IQ=FQ([TQ(0,Jo),TQ(1,Yr),TQ(2,vO),TQ(3,CC)],IQ),Wa(_Q,IQ,1),nu(new class extends Xl{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:RQ,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(_Q).revealNext(i)}}),gh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:RQ,primary:9,handler(t){t.get(_Q).reset()}});let PQ=class{constructor(t){this._listener=new Map,this._disposables=new Vi,this._onDidChange=new ie,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)}};PQ=FQ([TQ(0,Yr)],PQ);var NQ=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 BQ(t,i,e,s){return NQ(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 c((yield Promise.all(n)).flat())}))}function $Q(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function jQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function WQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function VQ(t,i,e,s){return BQ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function HQ(t,i,e,s,n){return BQ(i,e,t,((t,i,e)=>NQ(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 zQ(t){return NQ(this,void 0,void 0,(function*(){const i=yield t(),e=new oQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}su("_executeDefinitionProvider",((t,i,e)=>{const s=$Q(t.get(Wg).definitionProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeTypeDefinitionProvider",((t,i,e)=>{const s=VQ(t.get(Wg).typeDefinitionProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeDeclarationProvider",((t,i,e)=>{const s=jQ(t.get(Wg).declarationProvider,i,e,ue.None);return zQ((()=>s))})),su("_executeReferenceProvider",((t,i,e)=>{const s=HQ(t.get(Wg).referenceProvider,i,e,!1,ue.None);return zQ((()=>s))})),su("_executeImplementationProvider",((t,i,e)=>{const s=WQ(t.get(Wg).implementationProvider,i,e,ue.None);return zQ((()=>s))}));var UQ,KQ,qQ,GQ,ZQ,JQ,QQ,YQ,XQ=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())}))};Ch.appendMenuItem(bh.EditorContext,{submenu:bh.EditorContextPeek,title:J(0,"Peek"),group:"navigation",order:100});class tY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof tY||!(!gs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class iY extends eu{static all(){return iY._allSymbolNavigationCommands.values()}static _patchConfig(t){const i=Object.assign(Object.assign({},t),{f1:!0});if(i.menu)for(const e of Rt.wrap(i.menu))e.id!==bh.EditorContext&&e.id!==bh.EditorContextPeek||(e.when=Lo.and(t.precondition,e.when));return i}constructor(t,i){super(iY._patchConfig(i)),this.configuration=t,iY._allSymbolNavigationCommands.set(i.id,this)}runEditorCommand(t,i,e,s){if(!i.hasModel())return Promise.resolve(void 0);const n=t.get(vO),r=t.get(Yr),o=t.get(nR),h=t.get(_Q),c=t.get(Wg),l=t.get(Zr),u=i.getModel(),a=i.getPosition(),d=tY.is(e)?e:new tY(u,a),f=new oK(i,5),g=bu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>XQ(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(sm(t.ariaMessage),t.referenceAt(u.uri,a)){const t=this._getAlternativeCommand(i);!iY._activeAlternativeCommands.has(t)&&iY._allSymbolNavigationCommands.has(t)&&(o=iY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=u.getWordAtPosition(a);null===(n=iZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);iY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{iY._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 XQ(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof NJ||!(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 XQ(this,void 0,void 0,(function*(){let r;var o;if((o=e)&&ss.isUri(o.uri)&&ps.isIRange(o.range)&&(ps.isIRange(o.originSelectionRange)||ps.isIRange(o.targetSelectionRange))&&(r=e.targetSelectionRange),r||(r=e.range),!r)return;const h=yield i.openCodeEditor({resource:e.uri,options:{selection:ps.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=LQ.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),wu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}iY._allSymbolNavigationCommands=new Map,iY._activeAlternativeCommands=new Set;class eY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield $Q(t.definitionProvider,i,e,s),J(0,"Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No definition found for '{0}'",t.word):J(0,"No definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleDefinitions}}Eh(((UQ=class extends eY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:UQ.id,title:{value:J(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:J(0,"Go to &&Definition")},precondition:Lo.and(gS.hasDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:gS.editorTextFocus,primary:70,weight:100},{when:Lo.and(gS.editorTextFocus,A$),primary:2118,weight:100}],menu:[{id:bh.EditorContext,group:"navigation",order:1.1},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),ao.registerCommandAlias("editor.action.goToDeclaration",UQ.id)}}).id="editor.action.revealDefinition",UQ)),Eh(((KQ=class extends eY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:KQ.id,title:{value:J(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Lo.and(gS.hasDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:gS.editorTextFocus,primary:xe(2089,70),weight:100},{when:Lo.and(gS.editorTextFocus,A$),primary:xe(2089,2118),weight:100}]}),ao.registerCommandAlias("editor.action.openDeclarationToTheSide",KQ.id)}}).id="editor.action.revealDefinitionAside",KQ)),Eh(((qQ=class extends eY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:qQ.id,title:{value:J(0,"Peek Definition"),original:"Peek Definition"},precondition:Lo.and(gS.hasDefinitionProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:bh.EditorContextPeek,group:"peek",order:2}}),ao.registerCommandAlias("editor.action.previewDeclaration",qQ.id)}}).id="editor.action.peekDefinition",qQ));class sY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield jQ(t.declarationProvider,i,e,s),J(0,"Declarations"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No declaration found for '{0}'",t.word):J(0,"No declaration found")}_getAlternativeCommand(t){return t.getOption(58).alternativeDeclarationCommand}_getGoToPreference(t){return t.getOption(58).multipleDeclarations}}Eh(((GQ=class extends sY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:GQ.id,title:{value:J(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:J(0,"Go to &&Declaration")},precondition:Lo.and(gS.hasDeclarationProvider,gS.isInWalkThroughSnippet.toNegated()),menu:[{id:bh.EditorContext,group:"navigation",order:1.3},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No declaration found for '{0}'",t.word):J(0,"No declaration found")}}).id="editor.action.revealDeclaration",GQ)),Eh(class extends sY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:J(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Lo.and(gS.hasDeclarationProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:3}})}});class nY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield VQ(t.typeDefinitionProvider,i,e,s),J(0,"Type Definitions"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No type definition found for '{0}'",t.word):J(0,"No type definition found")}_getAlternativeCommand(t){return t.getOption(58).alternativeTypeDefinitionCommand}_getGoToPreference(t){return t.getOption(58).multipleTypeDefinitions}}Eh(((ZQ=class extends nY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:ZQ.ID,title:{value:J(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:J(0,"Go to &&Type Definition")},precondition:Lo.and(gS.hasTypeDefinitionProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:0,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.4},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",ZQ)),Eh(((JQ=class extends nY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:JQ.ID,title:{value:J(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Lo.and(gS.hasTypeDefinitionProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",JQ));class rY extends iY{_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield WQ(t.implementationProvider,i,e,s),J(0,"Implementations"))}))}_getNoResultFoundMessage(t){return t&&t.word?J(0,"No implementation found for '{0}'",t.word):J(0,"No implementation found")}_getAlternativeCommand(t){return t.getOption(58).alternativeImplementationCommand}_getGoToPreference(t){return t.getOption(58).multipleImplementations}}Eh(((QQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:QQ.ID,title:{value:J(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:J(0,"Go to &&Implementations")},precondition:Lo.and(gS.hasImplementationProvider,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:2118,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.45},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",QQ)),Eh(((YQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:YQ.ID,title:{value:J(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Lo.and(gS.hasImplementationProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:3142,weight:100},menu:{id:bh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",YQ));class oY extends iY{_getNoResultFoundMessage(t){return t?J(0,"No references found for '{0}'",t.word):J(0,"No references found")}_getAlternativeCommand(t){return t.getOption(58).alternativeReferenceCommand}_getGoToPreference(t){return t.getOption(58).multipleReferences}}Eh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{value:J(0,"Go to References"),original:"Go to References",mnemonicTitle:J(0,"Go to &&References")},precondition:Lo.and(gS.hasReferenceProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),keybinding:{when:gS.editorTextFocus,primary:1094,weight:100},menu:[{id:bh.EditorContext,group:"navigation",order:1.45},{id:bh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield HQ(t.referenceProvider,i,e,!0,s),J(0,"References"))}))}}),Eh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:J(0,"Peek References"),original:"Peek References"},precondition:Lo.and(gS.hasReferenceProvider,qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated()),menu:{id:bh.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(yield HQ(t.referenceProvider,i,e,!1,s),J(0,"References"))}))}});class hY extends iY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:J(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Lo.and(qJ.notInPeekEditor,gS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}_getLocationModel(t,i,e,s){return XQ(this,void 0,void 0,(function*(){return new oQ(this._references,J(0,"Locations"))}))}_getNoResultFoundMessage(t){return t&&J(0,"No results for '{0}'",t.word)||""}_getGoToPreference(t){var i;return null!==(i=this._gotoMultipleBehaviour)&&void 0!==i?i:t.getOption(58).multipleReferences}_getAlternativeCommand(){return""}}ao.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:ss},{name:"position",description:"The position at which to start",constraint:gs.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)=>XQ(void 0,void 0,void 0,(function*(){B(ss.isUri(i)),B(gs.isIPosition(e)),B(Array.isArray(s)),B(void 0===n||"string"==typeof n),B(void 0===o||"boolean"==typeof o);const h=t.get(Yr),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(cK(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends hY{_getNoResultFoundMessage(t){return r||super._getNoResultFoundMessage(t)}}({muteMessage:!Boolean(r),openInPeek:Boolean(o),openToSide:!1},s,n);t.get(Zr).invokeFunction(i.run.bind(i),c)}))}))}),ao.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:ss},{name:"position",description:"The position at which to start",constraint:gs.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)=>XQ(void 0,void 0,void 0,(function*(){t.get(uo).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),ao.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(ss.isUri(i)),B(gs.isIPosition(e));const s=t.get(Wg),n=t.get(Yr);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!cK(t)||!t.hasModel())return;const i=LQ.get(t);if(!i)return;const n=wu((i=>HQ(s.referenceProvider,t.getModel(),gs.lift(e),!1,i).then((t=>new oQ(t,J(0,"References")))))),r=new ps(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),ao.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var cY,lY=function(t,i){return function(e,s){i(e,s,t)}},uY=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 aY=cY=class{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 IJ(t);this.toUnhook.add(n),this.toUnhook.add(n.onMouseMoveOrRelevantKeyDown((([t,i])=>{this.startFindDefinitionFromMouse(t,null!=i?i:void 0)}))),this.toUnhook.add(n.onExecute((t=>{this.isEnabled(t)&&this.gotoDefinition(t.target.position,t.hasSideBySideModifier).catch((t=>{Ei(t)})).finally((()=>{this.removeLinkDecorations()}))}))),this.toUnhook.add(n.onCancel((()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null})))}static get(t){return t.getContribution(cY.ID)}startFindDefinitionFromCursor(t){return uY(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 uY(this,void 0,void 0,(function*(){this.toUnhookForKeyboard.clear();const e=t?null===(i=this.editor.getModel())||void 0===i?void 0:i.getWordAtPosition(t):null;if(!e)return this.currentWordAtPosition=null,void this.removeLinkDecorations();if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===e.startColumn&&this.currentWordAtPosition.endColumn===e.endColumn&&this.currentWordAtPosition.word===e.word)return;this.currentWordAtPosition=e;const s=new rK(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=wu((i=>this.findDefinition(t,i)));try{n=yield this.previousPromise}catch(t){return void Ei(t)}if(!n||!n.length||!s.validate(this.editor))return void this.removeLinkDecorations();const r=n[0].originSelectionRange?ps.lift(n[0].originSelectionRange):new ps(t.lineNumber,e.startColumn,t.lineNumber,e.endColumn);if(n.length>1){let t=r;for(const{originSelectionRange:i}of n)i&&(t=ps.plusRange(t,i));this.addDecoration(t,(new H_).appendText(J(0,"Click to show {0} definitions.",n.length)))}else{const t=n[0];if(!t.uri)return;this.textModelResolverService.createModelReference(t.uri).then((i=>{if(!i.object||!i.object.textEditorModel)return void i.dispose();const{object:{textEditorModel:e}}=i,{startLineNumber:s}=t.range;if(s<1||s>e.getLineCount())return void i.dispose();const n=this.getPreviewValue(e,s,t),o=this.languageService.guessLanguageIdByFilepathOrFirstLine(e.uri);this.addDecoration(r,n?(new H_).appendCodeblock(o||"",n):void 0),i.dispose()}))}}))}getPreviewValue(t,i,e){let s=e.range;return s.endLineNumber-s.startLineNumber>=cY.MAX_SOURCE_PREVIEW_LINES&&(s=this.getPreviewRangeBasedOnIndentation(t,i)),this.stripIndentationFromPreviewRange(t,i,s)}stripIndentationFromPreviewRange(t,i,e){let s=t.getLineFirstNonWhitespaceColumn(i);for(let n=i+1;n<e.endLineNumber;n++){const i=t.getLineFirstNonWhitespaceColumn(n);s=Math.min(s,i)}return t.getValueInRange(e).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(t,i){const e=t.getLineFirstNonWhitespaceColumn(i),s=Math.min(t.getLineCount(),i+cY.MAX_SOURCE_PREVIEW_LINES);let n=i+1;for(;n<s&&e!==t.getLineFirstNonWhitespaceColumn(n);n++);return new ps(i,1,n+1,1)}addDecoration(t,i){this.linkDecorations.set([{range:t,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:i}}])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(t,i){var e;return this.editor.hasModel()&&t.isLeftClick&&t.isNoneOrSingleMouseDown&&6===t.target.type&&!((null===(e=t.target.detail.injectedText)||void 0===e?void 0:e.options)instanceof BM)&&(t.hasTriggerModifier||!!i&&i.keyCodeIsTriggerKey)&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(t,i){const e=this.editor.getModel();return e?$Q(this.languageFeaturesService.definitionProvider,e,t,i):Promise.resolve(null)}gotoDefinition(t,i){return this.editor.setPosition(t),this.editor.invokeWithinContext((t=>{const e=!i&&this.editor.getOption(87)&&!this.isInPeekEditor(t);return new eY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Jo);return qJ.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};aY.ID="editor.contrib.gotodefinitionatposition",aY.MAX_SOURCE_PREVIEW_LINES=8,aY=cY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,to),lY(2,Ba),lY(3,Wg)],aY),hu(aY.ID,aY,2);const dY=Pl;class fY 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 Zy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class gY extends Hi{static render(t,i,e){return new gY(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Ol(t,dY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ol(this.actionContainer,dY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Ol(this.action,dY(`span.icon.${i.iconClass}`)),Ol(this.action,dY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Qc(this.actionContainer,El.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Qc(this.actionContainer,El.KEY_DOWN,(t=>{const e=new Nh(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 pY{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class mY extends Hi{constructor(t,i){super(),this._editor=t,this._computer=i,this._onResult=this._register(new ie),this.onResult=this._onResult.event,this._firstWaitScheduler=this._register(new Mu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new Mu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new Mu((()=>this._triggerLoadingMessage()),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),super.dispose()}get _hoverTime(){return this._editor.getOption(60).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(t,i=!0){this._state=t,i&&this._fireResult()}_triggerAsyncComputation(){this._setState(2),this._secondWaitScheduler.schedule(this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=function(t){const i=new de,e=t(i.token);return new _u(i,(t=>pu(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,l=mu(e);!(s=(h=yield l.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=l.return)||(yield r.call(l))}finally{if(n)throw n.error}}o.dispose(),i.dispose()}catch(e){o.dispose(),i.dispose(),t.reject(e)}}))))}((t=>this._computer.computeAsync(t))),(()=>{!function(t,i,e,s){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())}))}(this,void 0,void 0,(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)}}))})()):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 pY(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 vY{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 wY{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 bY=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class yY{constructor(){let t;this._onDidWillResize=new ie,this.onDidWillResize=this._onDidWillResize.event,this._onDidResize=new ie,this.onDidResize=this._onDidResize.event,this._sashListener=new Vi,this._size=new ol(0,0),this._minSize=new ol(0,0),this._maxSize=new ol(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new tB(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new tB(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new tB(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:KN.North}),this._southSash=new tB(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:KN.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(Ji.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(Ji.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(Ji.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(Ji.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 ol(i,t);ol.equals(o,this._size)||(this.domNode.style.height=t+"px",this.domNode.style.width=i+"px",this._size=o,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(t){this._maxSize=t}get maxSize(){return this._maxSize}set minSize(t){this._minSize=t}get minSize(){return this._minSize}set preferredSize(t){this._preferredSize=t}get preferredSize(){return this._preferredSize}}class kY extends Hi{constructor(t,i=new ol(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new yY),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=ol.lift(i),this._resizableNode.layout(i.height,i.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize((t=>{this._resize(new ol(t.dimension.width,t.dimension.height)),t.done&&(this._isResizing=!1)}))),this._register(this._resizableNode.onDidWillResize((()=>{this._isResizing=!0})))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){var t;return(null===(t=this._contentPosition)||void 0===t?void 0:t.position)?gs.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(i&&e)return cl(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=cl(i);return nl(i.ownerDocument.body).height-(s.top+e.top+e.height)-24}_findPositionPreference(t,i){var e,s;const n=Math.min(null!==(e=this._availableVerticalSpaceBelow(i))&&void 0!==e?e:1/0,t),r=Math.min(null!==(s=this._availableVerticalSpaceAbove(i))&&void 0!==s?s:1/0,t),o=Math.min(Math.max(r,n),t),h=Math.min(t,o);let c;return c=this._editor.getOption(60).above?h<=r?1:2:h<=n?2:1,1===c?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),c}_resize(t){this._resizableNode.layout(t.height,t.width)}}var CY,SY,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},DY=function(t,i){return function(e,s){i(e,s,t)}};const EY=Pl;let AY=CY=class extends Hi{constructor(t,i,e){super(),this._editor=t,this._instantiationService=i,this._keybindingService=e,this._currentResult=null,this._widget=this._register(this._instantiationService.createInstance(FY,this._editor)),this._participants=[];for(const t of bY.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new RY(this._editor,this._participants),this._hoverOperation=this._register(new mY(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 MY(this._computer.anchor,i,t.isComplete))}))),this._register(Xc(this._widget.getDomNode(),"keydown",(t=>{t.equals(9)&&this.hide()}))),this._register(Ns.onDidChange((()=>{this._widget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})))}get widget(){return this._widget}maybeShowAt(t){if(this._widget.isResizing)return!0;const i=[];for(const e of this._participants)if(e.suggestHoverAnchor){const s=e.suggestHoverAnchor(t);s&&i.push(s)}const e=t.target;if(6===e.type&&i.push(new vY(0,e.range,t.event.posx,t.event.posy)),7===e.type){const s=this._editor.getOption(50).typicalHalfwidthCharacterWidth/2;!e.detail.isAfterLines&&"number"==typeof e.detail.horizontalDistanceToText&&e.detail.horizontalDistanceToText<s&&i.push(new vY(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 vY(0,t,void 0,void 0),i,e,s,null)}_startShowingOrUpdateHover(t,i,e,s,n){return this._widget.position&&this._currentResult?this._editor.getOption(60).sticky&&n&&this._widget.isMouseGettingCloser(n.event.posx,n.event.posy)?(t&&this._startHoverOperationIfNecessary(t,i,e,s,!0),!0):t?!(!t||!this._currentResult.anchor.equals(t))||(t.canAdoptVisibleHover(this._currentResult.anchor,this._widget.position)?(this._setCurrentResult(this._currentResult.filter(t)),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)):(this._setCurrentResult(null),!1):!!t&&(this._startHoverOperationIfNecessary(t,i,e,s,!1),!0)}_startHoverOperationIfNecessary(t,i,e,s,n){this._computer.anchor&&this._computer.anchor.equals(t)||(this._hoverOperation.cancel(),this._computer.anchor=t,this._computer.shouldFocus=s,this._computer.source=e,this._computer.insistOnKeepingHoverVisible=n,this._hoverOperation.start(i))}_setCurrentResult(t){this._currentResult!==t&&(t&&0===t.messages.length&&(t=null),this._currentResult=t,this._currentResult?this._renderMessages(this._currentResult.anchor,this._currentResult.messages):this._widget.hide())}hide(){this._computer.anchor=null,this._hoverOperation.cancel(),this._setCurrentResult(null)}get isColorPickerVisible(){return this._widget.isColorPickerVisible}get isVisibleFromKeyboard(){return this._widget.isVisibleFromKeyboard}get isVisible(){return this._widget.isVisible}get isFocused(){return this._widget.isFocused}get isResizing(){return this._widget.isResizing}containsNode(t){return!!t&&this._widget.getDomNode().contains(t)}_addLoadingMessage(t){if(this._computer.anchor)for(const i of this._participants)if(i.createLoadingMessage){const e=i.createLoadingMessage(this._computer.anchor);if(e)return t.slice(0).concat([e])}return t}_withResult(t){if(this._widget.position&&this._currentResult&&this._currentResult.isComplete){if(!t.isComplete)return;if(this._computer.insistOnKeepingHoverVisible&&0===t.messages.length)return}this._setCurrentResult(t)}_renderMessages(t,i){const{showAtPosition:e,showAtSecondaryPosition:s,highlightRange:n}=CY.computeHoverRanges(this._editor,t.range,i),r=new Vi,o=r.add(new TY(this._keybindingService)),h=document.createDocumentFragment();let c=null;const l={fragment:h,statusBar:o,setColorPicker:t=>c=t,onContentsChanged:()=>this._widget.onContentsChanged(),setMinimumDimensions:t=>this._widget.setMinimumDimensions(t),hide:()=>this.hide()};for(const t of this._participants){const e=i.filter((i=>i.owner===t));e.length>0&&r.add(t.renderHoverParts(l,e))}const u=i.some((t=>t.isBeforeContent));if(o.hasContent&&h.appendChild(o.hoverElement),h.hasChildNodes()){if(n){const t=this._editor.createDecorationsCollection();t.set([{range:n,options:CY._DECORATION_OPTIONS}]),r.add(Wi((()=>{t.clear()})))}this._widget.showAt(h,new OY(c,e,s,this._editor.getOption(60).above,this._computer.shouldFocus,this._computer.source,u,t.initialMousePosX,t.initialMousePosY,r))}else r.dispose()}static computeHoverRanges(t,i,e){let s=1;if(t.hasModel()){const e=t._getViewModel(),n=e.coordinatesConverter,r=n.convertModelRangeToViewRange(i),o=new gs(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=ps.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 gs(n,i.startColumn),showAtSecondaryPosition:h?h.getStartPosition():new gs(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()}};AY._DECORATION_OPTIONS=$M.register({description:"content-hover-highlight",className:"hoverHighlight"}),AY=CY=xY([DY(1,Zr),DY(2,CC)],AY);class MY{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 LY(this,this.anchor,i,this.isComplete)}}class LY extends MY{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class OY{constructor(t,i,e,s,n,r,o,h,c,l){this.colorPicker=t,this.showAtPosition=i,this.showAtSecondaryPosition=e,this.preferAbove=s,this.stoleFocus=n,this.source=r,this.isBeforeContent=o,this.initialMousePosX=h,this.initialMousePosY=c,this.disposables=l,this.closestMouseDistance=void 0}}let FY=SY=class extends kY{get isColorPickerVisible(){var t;return Boolean(null===(t=this._visibleData)||void 0===t?void 0:t.colorPicker)}get isVisibleFromKeyboard(){var t;return 1===(null===(t=this._visibleData)||void 0===t?void 0:t.source)}get isVisible(){var t;return null!==(t=this._hoverVisibleKey.get())&&void 0!==t&&t}get isFocused(){var t;return null!==(t=this._hoverFocusedKey.get())&&void 0!==t&&t}constructor(t,i,e,s,n){const r=t.getOption(66)+8,o=new ol(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new fY),this._minimumSize=o,this._hoverVisibleKey=gS.hoverVisible.bindTo(i),this._hoverFocusedKey=gS.hoverFocused.bindTo(i),Ol(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._register(this._editor.onDidLayoutChange((()=>this._layout()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()})));const h=this._register(Ll(this._resizableNode.domNode));this._register(h.onDidFocus((()=>{this._hoverFocusedKey.set(!0)}))),this._register(h.onDidBlur((()=>{this._hoverFocusedKey.set(!1)}))),this._setHoverData(void 0),this._layout(),this._editor.addContentWidget(this)}dispose(){var t;super.dispose(),null===(t=this._visibleData)||void 0===t||t.disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return SY.ID}static _applyDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.width="number"==typeof i?`${i}px`:i,t.style.height=s}_setContentsDomNodeDimensions(t,i){return SY._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return SY._applyDimensions(this._hover.containerDomNode,t,i)}_setHoverWidgetDimensions(t,i){this._setContentsDomNodeDimensions(t,i),this._setContainerDomNodeDimensions(t,i),this._layoutContentWidget()}static _applyMaxDimensions(t,i,e){const s="number"==typeof e?`${e}px`:e;t.style.maxWidth="number"==typeof i?`${i}px`:i,t.style.maxHeight=s}_setHoverWidgetMaxDimensions(t,i){SY._applyMaxDimensions(this._hover.contentsDomNode,t,i),SY._applyMaxDimensions(this._hover.containerDomNode,t,i),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth","number"==typeof t?`${t}px`:t),this._layoutContentWidget()}_hasHorizontalScrollbar(){const t=this._hover.scrollbar.getScrollDimensions();return t.scrollWidth>t.width}_adjustContentsBottomPadding(){const t=this._hover.contentsDomNode,i=`${this._hover.scrollbar.options.horizontalScrollbarSize}px`;t.style.paddingBottom!==i&&(t.style.paddingBottom=i)}_setAdjustedHoverWidgetDimensions(t){this._setHoverWidgetMaxDimensions("none","none");const i=t.width,e=t.height;this._setHoverWidgetDimensions(i,e),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._setContentsDomNodeDimensions(i,e-10))}_updateResizableNodeMaxDimensions(){var t,i;const e=null!==(t=this._findMaximumRenderingWidth())&&void 0!==t?t:1/0,s=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._resizableNode.maxSize=new ol(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;SY._lastDimensions=new ol(t.width,t.height),this._setAdjustedHoverWidgetDimensions(t),this._resizableNode.layout(t.height,t.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),null===(e=null===(i=this._visibleData)||void 0===i?void 0:i.colorPicker)||void 0===e||e.layout()}_findAvailableSpaceVertically(){var t;const i=null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition;if(i)return 1===this._positionPreference?this._availableVerticalSpaceAbove(i):this._availableVerticalSpaceBelow(i)}_findMaximumRenderingHeight(){const t=this._findAvailableSpaceVertically();if(!t)return;let i=6;return Array.from(this._hover.contentsDomNode.children).forEach((t=>{i+=t.clientHeight})),this._hasHorizontalScrollbar()&&(i+=10),Math.min(t,i)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const t=Array.from(this._hover.contentsDomNode.children).some((t=>t.scrollWidth>t.clientWidth));return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),t}_findMaximumRenderingWidth(){if(this._editor&&this._editor.hasModel())return this._isHoverTextOverflowing()||this._hover.containerDomNode.clientWidth<(void 0===this._contentWidth?0:this._contentWidth-2)?nl(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth+2}isMouseGettingCloser(t,i){if(!this._visibleData)return!1;if(void 0===this._visibleData.initialMousePosX||void 0===this._visibleData.initialMousePosY)return this._visibleData.initialMousePosX=t,this._visibleData.initialMousePosY=i,!1;const e=cl(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=_Y(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=_Y(t,i,e.left,e.top,e.width,e.height);return!(s>this._visibleData.closestMouseDistance+4||(this._visibleData.closestMouseDistance=Math.min(this._visibleData.closestMouseDistance,s),0))}_setHoverData(t){var i;null===(i=this._visibleData)||void 0===i||i.disposables.dispose(),this._visibleData=t,this._hoverVisibleKey.set(!!t),this._hover.containerDomNode.classList.toggle("hidden",!t)}_layout(){const{fontSize:t,lineHeight:i}=this._editor.getOption(50),e=this._hover.contentsDomNode;e.style.fontSize=`${t}px`,e.style.lineHeight=""+i/t,this._updateMaxDimensions()}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((t=>this._editor.applyFontInfo(t)))}_updateContent(t){const i=this._hover.contentsDomNode;i.style.paddingBottom="",i.textContent="",i.appendChild(t)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const t=Math.max(this._editor.getLayoutInfo().height/4,250,SY._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,SY._lastDimensions.width);this._setHoverWidgetMaxDimensions(i,t)}_render(t,i){this._setHoverData(i),this._updateFont(),this._updateContent(t),this._updateMaxDimensions(),this.onContentsChanged(),this._editor.render()}getPosition(){var t;return this._visibleData?{position:this._visibleData.showAtPosition,secondaryPosition:this._visibleData.showAtSecondaryPosition,positionAffinity:this._visibleData.isBeforeContent?3:void 0,preference:[null!==(t=this._positionPreference)&&void 0!==t?t:1]}:null}showAt(t,i){var e,s,n,r;if(!this._editor||!this._editor.hasModel())return;this._render(t,i);const o=dl(this._hover.containerDomNode);this._positionPreference=null!==(e=this._findPositionPreference(o,i.showAtPosition))&&void 0!==e?e:1,this.onContentsChanged(),i.stoleFocus&&this._hover.containerDomNode.focus(),null===(s=i.colorPicker)||void 0===s||s.layout();const h=(c=!0===this._configurationService.getValue("accessibility.verbosity.hover")&&this._accessibilityService.isScreenReaderOptimized(),l=null!==(r=null===(n=this._keybindingService.lookupKeybinding("editor.action.accessibleView"))||void 0===n?void 0:n.getAriaLabel())&&void 0!==r?r:"",c&&l?J(0,"Inspect this in the accessible view with {0}.",l):c?J(0,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):"");var c,l;h&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+h)}hide(){if(!this._visibleData)return;const t=this._visibleData.stoleFocus||this._hoverFocusedKey.get();this._setHoverData(void 0),this._resizableNode.maxSize=new ol(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),t&&this._editor.focus()}_removeConstraintsRenderNormally(){const t=this._editor.getLayoutInfo();this._resizableNode.layout(t.height,t.width),this._setHoverWidgetDimensions("auto","auto")}_adjustHoverHeightForScrollbar(t){var i;const e=this._hover.containerDomNode,s=this._hover.contentsDomNode,n=null!==(i=this._findMaximumRenderingHeight())&&void 0!==i?i:1/0;this._setContainerDomNodeDimensions(ll(e),Math.min(n,t)),this._setContentsDomNodeDimensions(ll(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new ol(Math.max(this._minimumSize.width,t.width),Math.max(this._minimumSize.height,t.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const t=void 0===this._contentWidth?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new ol(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=dl(i),s=ll(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=dl(i),s=ll(i),this._contentWidth=s,this._updateMinimumWidth(),this._resizableNode.layout(e,s),this._hasHorizontalScrollbar()&&(this._adjustContentsBottomPadding(),this._adjustHoverHeightForScrollbar(e)),null===(t=this._visibleData)||void 0===t?void 0:t.showAtPosition){const t=dl(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(t,this._visibleData.showAtPosition)}this._layoutContentWidget()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t-i.lineHeight})}scrollDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._editor.getOption(50);this._hover.scrollbar.setScrollPosition({scrollTop:t+i.lineHeight})}scrollLeft(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t-30})}scrollRight(){const t=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:t+30})}pageUp(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t-i})}pageDown(){const t=this._hover.scrollbar.getScrollPosition().scrollTop,i=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:t+i})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};FY.ID="editor.contrib.resizableContentHoverWidget",FY._lastDimensions=new ol(0,0),FY=SY=xY([DY(1,Jo),DY(2,Ta),DY(3,gm),DY(4,CC)],FY);let TY=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=EY("div.hover-row.status-bar"),this.actionsElement=Ol(this.hoverElement,EY("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(gY.render(this.actionsElement,t,e))}append(t){const i=Ol(this.actionsElement,t);return this._hasContent=!0,i}};TY=xY([DY(0,CC)],TY);class RY{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 Ru.EMPTY;const e=RY._getLineDecorations(this._editor,i);return Ru.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):Ru.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=RY._getLineDecorations(this._editor,this._anchor);let i=[];for(const e of this._participants)i=i.concat(e.computeSync(this._anchor,t));return c(i)}}function _Y(t,i,e,s,n,r){const o=s+r/2,h=Math.max(Math.abs(t-(e+n/2))-n/2,0),c=Math.max(Math.abs(i-o)-r/2,0);return Math.sqrt(h*h+c*c)}const IY=Pl;class PY 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 fY),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new JG({editor:this._editor},i,e)),this._computer=new NY(this._editor),this._hoverOperation=this._register(new mY(this._editor,this._computer)),this._register(this._hoverOperation.onResult((t=>{this._withResult(t.value)}))),this._register(this._editor.onDidChangeModelDecorations((()=>this._onModelDecorationsChanged()))),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._editor.addOverlayWidget(this)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return PY.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=IY("div.hover-row.markdown-hover"),s=Ol(i,IY("div.hover-contents")),n=this._renderDisposeables.add(this._markdownRenderer.render(t.value));s.appendChild(n.element),e.appendChild(i)}this._updateContents(e),this._showAt(t)}_updateContents(t){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(t),this._updateFont()}_showAt(t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),e=this._editor.getTopForLineNumber(t),s=this._editor.getScrollTop(),n=this._editor.getOption(66),r=e-s-(this._hover.containerDomNode.clientHeight-n)/2;this._hover.containerDomNode.style.left=`${i.glyphMarginLeft+i.glyphMarginWidth}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(r),0)}px`}}PY.ID="editor.contrib.modesGlyphHoverWidget";class NY{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&&!z_(i)&&e.push(...b(i).map(t))}return e}}class BY{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function $Y(t,i,e,s){const n=t.ordered(i).map(((t,n)=>function(t,i,e,s,n){return 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())}))}(this,void 0,void 0,(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 BY(t,r,i)}catch(t){Ai(t)}}))}(t,n,i,e,s)));return Ru.fromPromises(n).coalesce()}su("_executeHoverProvider",((t,i,e)=>function(t,i,e){return $Y(t,i,e,ue.None).map((t=>t.hover)).toPromise()}(t.get(Wg).hoverProvider,i,e)));var jY=function(t,i){return function(e,s){i(e,s,t)}};const WY=Pl;class VY{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 HY=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 VY(this,t.range,[(new H_).appendText(J(0,"Loading..."))],!1,2e3)}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];let o=1e3;const h=e.getLineLength(s),c=e.getLanguageIdAtPosition(t.range.startLineNumber,t.range.startColumn),l=this._editor.getOption(116),u=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let a=!1;l>=0&&h>l&&t.range.startColumn>=l&&(a=!0,r.push(new VY(this,t.range,[{value:J(0,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,o++))),!a&&"number"==typeof u&&h>=u&&r.push(new VY(this,t.range,[{value:J(0,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,o++));let d=!1;for(const e of i){const i=e.range.startLineNumber===s?e.range.startColumn:1,h=e.range.endLineNumber===s?e.range.endColumn:n,c=e.options.hoverMessage;if(!c||z_(c))continue;e.options.beforeContentClassName&&(d=!0);const l=new ps(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new VY(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return Ru.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return Ru.EMPTY;const n=new gs(t.range.startLineNumber,t.range.startColumn);return $Y(this._languageFeaturesService.hoverProvider,s,n,e).filter((t=>!z_(t.hover.contents))).map((i=>{const e=i.hover.range?ps.lift(i.hover.range):t.range;return new VY(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return zY(t,i,this._editor,this._languageService,this._openerService)}};function zY(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(z_(i))continue;const o=WY("div.hover-row.markdown-hover"),h=Ol(o,WY("div.hover-contents")),c=r.add(new JG({editor:e},s,n));r.add(c.onDidRenderAsync((()=>{h.className="hover-contents code-hover-contents",t.onContentsChanged()})));const l=r.add(c.render(i));h.appendChild(l.element),t.fragment.appendChild(o)}return r}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}([jY(1,Ba),jY(2,AF),jY(3,Ta),jY(4,Wg)],HY);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},KY=function(t,i){return function(e,s){i(e,s,t)}};class qY{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let GY=class{constructor(t,i,e){this._markerService=i,this._configService=e,this._onDidChange=new ie,this.onDidChange=this._onDidChange.event,this._dispoables=new Vi,this._markers=[],this._nextIdx=-1,ss.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=Vn(t.resource.toString(),i.resource.toString());return 0===e&&(e="position"===s?ps.compareRangesUsingStarts(t,i)||LN.compare(t.severity,i.severity):LN.compare(t.severity,i.severity)||ps.compareRangesUsingStarts(t,i)),e},r=()=>{this._markers=this._markerService.read({resource:ss.isUri(t)?t:void 0,severities:LN.Error|LN.Warning|LN.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 qY(t,this._nextIdx+1,this._markers.length)}_initIdx(t,i,e){let n=!1,r=this._markers.findIndex((i=>i.resource.toString()===t.uri.toString()));r<0&&(r=s(this._markers,{resource:t.uri},((t,i)=>Vn(t.resource.toString(),i.resource.toString()))),r<0&&(r=~r));for(let e=r;e<this._markers.length;e++){let s=ps.lift(this._markers[e]);if(s.isEmpty()){const i=t.getWordAtPosition(s.getStartPosition());i&&(s=new ps(s.startLineNumber,i.startColumn,s.startLineNumber,i.endColumn))}if(i&&(s.containsPosition(i)||i.isBeforeOrEqual(s.getStartPosition()))){this._nextIdx=e,n=!0;break}if(this._markers[e].resource.toString()!==t.uri.toString())break}n||(this._nextIdx=e?0:this._markers.length-1),this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(t,i,e){if(0===this._markers.length)return!1;const s=this._nextIdx;return-1===this._nextIdx?this._initIdx(i,e,t):t?this._nextIdx=(this._nextIdx+1)%this._markers.length:t||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),s!==this._nextIdx}find(t,i){let e=this._markers.findIndex((i=>i.resource.toString()===t.toString()));if(!(e<0))for(;e<this._markers.length;e++)if(ps.containsPosition(this._markers[e],i))return new qY(this._markers[e],e+1,this._markers.length)}};GY=UY([KY(1,FN),KY(2,Ta)],GY);const ZY=Qr("IMarkerNavigationService");let JY=class{constructor(t,i){this._markerService=t,this._configService=i,this._provider=new It}getMarkerList(t){for(const i of this._provider){const e=i.getMarkerList(t);if(e)return e}return new GY(t,this._markerService,this._configService)}};var QY;JY=UY([KY(0,FN),KY(1,Ta)],JY),Wa(ZY,JY,1),function(t){t.className=function(t){switch(t){case pO.Ignore:return"severity-ignore "+eo.asClassName(ys.info);case pO.Info:return eo.asClassName(ys.info);case pO.Warning:return eo.asClassName(ys.warning);case pO.Error:return eo.asClassName(ys.error);default:return""}}}(QY||(QY={}));var YY,XY=function(t,i){return function(e,s){i(e,s,t)}};class tX{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(Xc(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new qy(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=Bn(e);this._lines=o.length,this._longestLineLength=0;for(const t of o)this._longestLineLength=Math.max(t.length+r,this._longestLineLength);Gc(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=Pl("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()},Ol(this._codeLink,Pl("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Gc(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),a(s)){const t=this._relatedBlock.appendChild(document.createElement("div"));t.style.paddingTop=`${Math.floor(.66*this._editor.getOption(66))}px`,this._lines+=1;for(const i of s){const e=document.createElement("div"),s=document.createElement("a");s.classList.add("filename"),s.innerText=`${this._labelService.getUriBasenameLabel(i.resource)}(${i.startLineNumber}, ${i.startColumn}): `,s.title=this._labelService.getUriLabel(i.resource),this._relatedDiagnostics.set(s,i);const n=document.createElement("span");n.innerText=i.message,e.appendChild(s),e.appendChild(n),this._lines+=1,t.appendChild(e)}}const c=this._editor.getOption(50),l=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75);this._scrollable.setScrollDimensions({scrollWidth:l,scrollHeight:c.lineHeight*this._lines})}layout(t,i){this._scrollable.getDomNode().style.height=`${t}px`,this._scrollable.getDomNode().style.width=`${i}px`,this._scrollable.setScrollDimensions({width:i,height:t})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(t){let i="";switch(t.severity){case LN.Error:i=J(0,"Error");break;case LN.Warning:i=J(0,"Warning");break;case LN.Info:i=J(0,"Info");break;case LN.Hint:i=J(0,"Hint")}let e=J(0,"{0} at {1}. ",i,t.startLineNumber+":"+t.startColumn);const s=this._editor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1&&(e=`${s.getLineContent(t.startLineNumber)}, ${e}`),e}}let iX=YY=class extends JJ{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 ie,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=LN.Warning,this._backgroundColor=Mg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(aX);let i=rX,e=oX;this._severity===LN.Warning?(i=hX,e=cX):this._severity===LN.Info&&(i=lX,e=uX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(YJ),secondaryHeadingColor:t.getColor(XJ)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(t){super._fillHead(t),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((()=>this.editor.focus())));const i=[],e=this._menuService.createMenu(YY.TitleMenu,this._contextKeyService);iN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=Ol(t,Pl(""))}_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 tX(this._container,this.editor,(t=>this._onDidSelectRelatedInformation.fire(t)),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(t,i,e){this._container.classList.remove("stale"),this._message.update(t),this._severity=t.severity,this._applyTheme(this._themeService.getColorTheme());const s=ps.lift(t),n=this.editor.getPosition(),r=n&&s.containsPosition(n)?n:s.getStartPosition();super.show(r,this.computeRequiredHeight());const o=this.editor.getModel();if(o){const t=J(0,e>1?"{0} of {1} problems":"{0} of {1} problem",i,e);this.setTitle(FE(o.uri),t)}this._icon.className=`codicon ${QY.className(LN.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(t){this._container.classList.remove("stale"),this._message.update(t)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._heightInPixel=t,this._message.layout(t,i),this._container.style.height=`${t}px`}_onWidth(t){this._message.layout(this._heightInPixel,t)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};iX.TitleMenu=new bh("gotoErrorTitleMenu"),iX=YY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([XY(1,mk),XY(2,AF),XY(3,yh),XY(4,Zr),XY(5,Jo),XY(6,iR)],iX);const eX=Lb(yv,kv),sX=Lb(Cv,Sv),nX=Lb(xv,Dv),rX=Om("editorMarkerNavigationError.background",{dark:eX,light:eX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget error color.")),oX=Om("editorMarkerNavigationError.headerBackground",{dark:Mb(rX,.1),light:Mb(rX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget error heading background.")),hX=Om("editorMarkerNavigationWarning.background",{dark:sX,light:sX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget warning color.")),cX=Om("editorMarkerNavigationWarning.headerBackground",{dark:Mb(hX,.1),light:Mb(hX,.1),hcDark:"#0C141F",hcLight:Mb(hX,.2)},J(0,"Editor marker navigation widget warning heading background.")),lX=Om("editorMarkerNavigationInfo.background",{dark:nX,light:nX,hcDark:Im,hcLight:Im},J(0,"Editor marker navigation widget info color.")),uX=Om("editorMarkerNavigationInfo.headerBackground",{dark:Mb(lX,.1),light:Mb(lX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget info heading background.")),aX=Om("editorMarkerNavigation.background",{dark:Av,light:Av,hcDark:Av,hcLight:Av},J(0,"Editor marker navigation widget background."));var dX,fX=function(t,i){return function(e,s){i(e,s,t)}},gX=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 pX=dX=class{static get(t){return t.getContribution(dX.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=bX.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(iX,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)&&ps.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:ps.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 gs(t.startLineNumber,t.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}}nagivate(t,i){var e,s;return gX(this,void 0,void 0,(function*(){if(this._editor.hasModel()){const n=this._getOrCreateModel(i?void 0:this._editor.getModel().uri);if(n.move(t,this._editor.getModel(),this._editor.getPosition()),!n.selected)return;if(n.selected.marker.resource.toString()!==this._editor.getModel().uri.toString()){this._cleanUp();const r=yield this._editorService.openCodeEditor({resource:n.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:n.selected.marker}},this._editor);r&&(null===(e=dX.get(r))||void 0===e||e.close(),null===(s=dX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}))}};pX.ID="editor.contrib.markerController",pX=dX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([fX(1,ZY),fX(2,Jo),fX(3,Yr),fX(4,Zr)],pX);class mX extends tu{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return gX(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=pX.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class vX extends mX{constructor(){super(!0,!1,{id:vX.ID,label:vX.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:578,weight:100},menuOpts:{menuId:iX.TitleMenu,title:vX.LABEL,icon:GW("marker-navigation-next",ys.arrowDown,J(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}vX.ID="editor.action.marker.next",vX.LABEL=J(0,"Go to Next Problem (Error, Warning, Info)");class wX extends mX{constructor(){super(!1,!1,{id:wX.ID,label:wX.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:1602,weight:100},menuOpts:{menuId:iX.TitleMenu,title:wX.LABEL,icon:GW("marker-navigation-previous",ys.arrowUp,J(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}wX.ID="editor.action.marker.prev",wX.LABEL=J(0,"Go to Previous Problem (Error, Warning, Info)"),hu(pX.ID,pX,4),ru(vX),ru(wX),ru(class extends mX{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:J(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:gS.focus,primary:66,weight:100},menuOpts:{menuId:bh.MenubarGoMenu,title:J(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),ru(class extends mX{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:J(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:gS.focus,primary:1090,weight:100},menuOpts:{menuId:bh.MenubarGoMenu,title:J(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const bX=new Zo("markersNavigationVisible",!1);nu(new(Xl.bindToContribution(pX.get))({id:"closeMarkersNavigation",precondition:bX,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:gS.focus,primary:9,secondary:[1033]}}));var yX=function(t,i){return function(e,s){i(e,s,t)}};const kX=Pl;class CX{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 SX={type:1,filter:{include:CG.QuickFix},triggerAction:kG.QuickFixHover};let xX=class{constructor(t,i,e,s){this._editor=t,this._markerDecorationsService=i,this._openerService=e,this._languageFeaturesService=s,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type&&!t.supportsMarkerHover)return[];const e=this._editor.getModel(),s=t.range.startLineNumber,n=e.getLineMaxColumn(s),r=[];for(const o of i){const i=o.range.startLineNumber===s?o.range.startColumn:1,h=o.range.endLineNumber===s?o.range.endColumn:n,c=this._markerDecorationsService.getMarker(e.uri,o);if(!c)continue;const l=new ps(t.range.startLineNumber,i,t.range.startLineNumber,h);r.push(new CX(this,l,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)=>LN.compare(t.marker.severity,i.marker.severity)))[0];return this.renderMarkerStatusbar(t,s,e),e}renderMarkerHover(t,i){const e=kX("div.hover-row"),s=Ol(e,kX("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Ol(s,kX("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=kX("span");n&&(Ol(t,kX("span")).innerText=n);const e=Ol(t,kX("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Qc(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Ol(e,kX("span")).innerText=o.value;const r=Ol(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Ol(s,kX("span"));t.style.opacity="0.6",t.style.paddingLeft="6px",t.innerText=n&&o?`${n}(${o})`:n||`(${o})`}if(a(h))for(const{message:t,resource:e,startLineNumber:n,startColumn:r}of h){const o=Ol(s,kX("div"));o.style.marginTop="8px";const h=Ol(o,kX("a"));h.innerText=`${FE(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Qc(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=Ol(o,kX("span"));c.innerText=t,this._editor.applyFontInfo(c)}return e}renderMarkerStatusbar(t,i,e){if(i.marker.severity!==LN.Error&&i.marker.severity!==LN.Warning&&i.marker.severity!==LN.Info||t.statusBar.addAction({label:J(0,"View Problem"),commandId:vX.ID,run:()=>{var e;t.hide(),null===(e=pX.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(kX("div"));this.recentMarkerCodeActionsInfo&&(ON.makeKey(this.recentMarkerCodeActionsInfo.marker)===ON.makeKey(i.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(s.textContent=J(0,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const n=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?Hi.None:e.add(xu((()=>s.textContent=J(0,"Checking for quick fixes...")),200));s.textContent||(s.textContent=String.fromCharCode(160));const r=this.getCodeActions(i.marker);e.add(Wi((()=>r.cancel()))),r.then((r=>{if(n.dispose(),this.recentMarkerCodeActionsInfo={marker:i.marker,hasCodeActions:r.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions)return r.dispose(),void(s.textContent=J(0,"No quick fixes available"));s.style.display="none";let o=!1;e.add(Wi((()=>{o||r.dispose()}))),t.statusBar.addAction({label:J(0,"Quick Fix..."),commandId:MG,run:i=>{o=!0;const e=AZ.get(this._editor),s=cl(i);t.hide(),null==e||e.showCodeActions(SX,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return wu((i=>PG(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),SX,sR.None,i)))}};xX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([yX(1,om),yX(2,AF),yX(3,Wg)],xX);const DX="editor.action.inlineSuggest.commit",EX="editor.action.inlineSuggest.showPrevious",AX="editor.action.inlineSuggest.showNext";class MX extends Hi{constructor(t,i,e={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new oe),this.onDidChangeDropdownVisibility=this._onDidChangeDropdownVisibility.event,this.disposables=this._register(new Vi),this.options=e,this.lookupKeybindings="function"==typeof this.options.getKeyBinding,this.toggleMenuAction=this._register(new LX((()=>{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 cN(this.element,{orientation:e.orientation,ariaLabel:e.ariaLabel,actionRunner:e.actionRunner,allowContextMenu:e.allowContextMenu,highlightToggledItems:e.highlightToggledItems,actionViewItemProvider:(t,s)=>{var n;if(t.id===LX.ID)return this.toggleMenuActionViewItem=new LP(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:eo.asClassNameArray(null!==(n=e.moreIcon)&&void 0!==n?n:ys.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry}),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 ho){const e=new LP(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,skipTelemetry:this.options.skipTelemetry});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,s;const n=this.lookupKeybindings?null===(e=(i=this.options).getKeyBinding)||void 0===e?void 0:e.call(i,t):void 0;return null!==(s=null==n?void 0:n.getLabel())&&void 0!==s?s:void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}}class LX extends no{constructor(t,i){i=i||J(0,"More Actions..."),super(LX.ID,i,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=t}run(){return 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())}))}(this,void 0,void 0,(function*(){this.toggleDropdownMenu()}))}get menuActions(){return this._menuActions}set menuActions(t){this._menuActions=t}}LX.ID="toolbar.toggle.more";var OX=function(t,i){return function(e,s){i(e,s,t)}};let FX=class extends MX{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,skipTelemetry:"string"==typeof(null==i?void 0:i.telemetrySource)})),this._options=i,this._menuService=e,this._contextKeyService=s,this._contextMenuService=n,this._sessionDisposables=this._store.add(new Vi);const h=null==i?void 0:i.telemetrySource;h&&this._store.add(this.actionBar.onDidRun((t=>o.publicLog2("workbenchActionExecuted",{id:t.action.id,from:h}))))}setActions(t,i=[],e){var s,n,r;this._sessionDisposables.clear();const o=t.slice(),h=i.slice(),c=[];let u=0;const a=[];let d=!1;if(-1!==(null===(s=this._options)||void 0===s?void 0:s.hiddenItemStrategy))for(let t=0;t<o.length;t++){const i=o[t];(i instanceof xh||i instanceof Sh)&&i.hideActions&&(c.push(i.hideActions.toggle),i.hideActions.toggle.checked&&u++,i.hideActions.isHidden&&(d=!0,o[t]=void 0,0!==(null===(n=this._options)||void 0===n?void 0:n.hiddenItemStrategy)&&(a[t]=i)))}if(void 0!==(null===(r=this._options)||void 0===r?void 0:r.overflowBehavior)){const t=function(t,i){const e=new Set;for(const s of i)t.has(s)&&e.add(s);return e}(new Set(this._options.overflowBehavior.exempted),Rt.map(o,(t=>null==t?void 0:t.id))),i=this._options.overflowBehavior.maxItems-t.size;let e=0;for(let s=0;s<o.length;s++){const n=o[s];n&&(e++,t.has(n.id)||e>=i&&(o[s]=void 0,a[s]=n))}}l(o),l(a),super.setActions(o,oo.join(a,h)),c.length>0&&this._sessionDisposables.add(Qc(this.getElement(),"contextmenu",(t=>{var i,s,n,r,o;const h=new Wh(t),l=this.getItemAction(h.target);if(!l)return;h.preventDefault(),h.stopPropagation();let a,f=!1;if(1===u&&0===(null===(i=this._options)||void 0===i?void 0:i.hiddenItemStrategy)){f=!0;for(let t=0;t<c.length;t++)if(c[t].checked){c[t]=lo({id:l.id,label:l.label,checked:!0,enabled:!1,run(){}});break}}if(!f&&(l instanceof xh||l instanceof Sh)){if(!l.hideActions)return;a=l.hideActions.hide}else a=lo({id:"label",label:J(0,"Hide"),enabled:!1,run(){}});const g=oo.join([a],c);(null===(s=this._options)||void 0===s?void 0:s.resetMenu)&&!e&&(e=[this._options.resetMenu]),d&&e&&(g.push(new oo),g.push(lo({id:"resetThisMenu",label:J(0,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(e)}))),this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>g,menuId:null===(n=this._options)||void 0===n?void 0:n.contextMenu,menuActionOptions:Object.assign({renderShortTitle:!0},null===(r=this._options)||void 0===r?void 0:r.menuOptions),skipTelemetry:"string"==typeof(null===(o=this._options)||void 0===o?void 0:o.telemetrySource),contextKeyService:this._contextKeyService})})))}};FX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([OX(2,yh),OX(3,Jo),OX(4,AR),OX(5,CC),OX(6,Ah)],FX);var TX,RX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},_X=function(t,i){return function(e,s){i(e,s,t)}};let IX=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.instantiationService=e,this.alwaysShowToolbar=KH(this.editor.onDidChangeConfiguration,(()=>"always"===this.editor.getOption(62).showToolbar)),this.sessionPosition=void 0,this.position=IH(this,(t=>{var i,e,s;const n=null===(i=this.model.read(t))||void 0===i?void 0:i.ghostText.read(t);if(!this.alwaysShowToolbar.read(t)||!n||0===n.parts.length)return this.sessionPosition=void 0,null;const r=n.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==n.lineNumber&&(this.sessionPosition=void 0);const o=new gs(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(VH(((i,e)=>{const s=this.model.read(i);if(!s||!this.alwaysShowToolbar.read(i))return;const n=e.add(this.instantiationService.createInstance(BX,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(jH((t=>{this.position.read(t)&&s.lastTriggerKind.read(t)!==Cs.Explicit&&s.triggerExplicitly()})))})))}};IX=RX([_X(2,Zr)],IX);const PX=GW("inline-suggestion-hints-next",ys.chevronRight,J(0,"Icon for show next parameter hint.")),NX=GW("inline-suggestion-hints-previous",ys.chevronLeft,J(0,"Icon for show previous parameter hint."));let BX=TX=class extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new no(t,i,e,!0,(()=>this._commandService.executeCommand(t))),n=this.keybindingService.lookupKeybinding(t,this._contextKeyService);let r=i;return n&&(r=J(0,"{0} ({1})",i,n.getLabel())),s.tooltip=r,s}constructor(t,i,s,n,r,o,h,c,l,u,a){super(),this.editor=t,this.withBorder=i,this._position=s,this._currentSuggestionIdx=n,this._suggestionCount=r,this._extraCommands=o,this._commandService=h,this.keybindingService=l,this._contextKeyService=u,this._menuService=a,this.id="InlineSuggestionHintsContentWidget"+TX.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Gl("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Gl("div@toolBar")]),this.previousAction=this.createCommandAction(EX,J(0,"Previous"),eo.asClassName(NX)),this.availableSuggestionCountAction=new no("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(AX,J(0,"Next"),eo.asClassName(PX)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(bh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Mu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new Mu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(WX,this.nodes.toolBar,bh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof xh)return c.createInstance(jX,t,void 0);if(t===this.availableSuggestionCountAction){const i=new $X(void 0,t,{label:!0,icon:!1});return i.setClass("availableSuggestionCount"),i}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility((t=>{TX._dropDownVisible=t}))),this._register(jH((t=>{this._position.read(t),this.editor.layoutContentWidget(this)}))),this._register(jH((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(jH((t=>{const i=this._extraCommands.read(t);if(e(this.lastCommands,i))return;this.lastCommands=i;const s=i.map((t=>({class:void 0,id:t.id,enabled:!0,tooltip:t.tooltip||"",label:t.title,run:()=>this._commandService.executeCommand(t.id)})));for(const[t,i]of this.inlineCompletionsActionsMenus.getActions())for(const t of i)t instanceof xh&&s.push(t);s.length>0&&s.unshift(new oo),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};BX._dropDownVisible=!1,BX.id=0,BX=TX=RX([_X(6,uo),_X(7,Zr),_X(8,CC),_X(9,Jo),_X(10,yh)],BX);class $X extends DP{constructor(){super(...arguments),this._className=void 0}setClass(t){this._className=t}render(t){super.render(t),this._className&&t.classList.add(this._className)}}class jX extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Gl("div.keybinding").root;new iW(i,xt,Object.assign({disableTitle:!0},tW)).set(t),this.label.textContent=this._action.label,this.label.appendChild(i),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}}let WX=class extends FX{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.prependedPrimaryActions=[],this._store.add(this.menu.onDidChange((()=>this.updateToolbar()))),this.updateToolbar()}updateToolbar(){var t,i,e,s,n,r,o;const h=[],c=[];iN(this.menu,null===(t=this.options2)||void 0===t?void 0:t.menuOptions,{primary:h,secondary:c},null===(e=null===(i=this.options2)||void 0===i?void 0:i.toolbarOptions)||void 0===e?void 0:e.primaryGroup,null===(n=null===(s=this.options2)||void 0===s?void 0:s.toolbarOptions)||void 0===n?void 0:n.shouldInlineSubmenu,null===(o=null===(r=this.options2)||void 0===r?void 0:r.toolbarOptions)||void 0===o?void 0:o.useSeparatorsInPrimaryActions),c.push(...this.additionalActions),h.unshift(...this.prependedPrimaryActions),this.setActions(h,c)}setPrependedPrimaryActions(t){e(this.prependedPrimaryActions,t,((t,i)=>t===i))||(this.prependedPrimaryActions=t,this.updateToolbar())}setAdditionalSecondaryActions(t){e(this.additionalActions,t,((t,i)=>t===i))||(this.additionalActions=t,this.updateToolbar())}};WX=RX([_X(3,yh),_X(4,Jo),_X(5,AR),_X(6,CC),_X(7,Ah)],WX);var VX,HX=function(t,i){return function(e,s){i(e,s,t)}};let zX=VX=class extends Hi{static get(t){return t.getContribution(VX.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._instantiationService=i,this._openerService=e,this._languageService=s,this._keybindingService=n,this._toUnhook=new Vi,this._hoverActivatedByColorDecoratorClick=!1,this._isMouseDown=!1,this._hoverClicked=!1,this._contentWidget=null,this._glyphWidget=null,this._reactToEditorMouseMoveRunner=this._register(new Mu((()=>this._reactToEditorMouseMove(this._mouseMoveEvent)),0)),this._hookEvents(),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(60)&&(this._unhookEvents(),this._hookEvents())}))),this._register(this._editor.onMouseLeave((()=>{this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()})))}_hookEvents(){const t=this._editor.getOption(60);this._isHoverEnabled=t.enabled,this._isHoverSticky=t.sticky,this._hidingDelay=t.hidingDelay,this._isHoverEnabled?(this._toUnhook.add(this._editor.onMouseDown((t=>this._onEditorMouseDown(t)))),this._toUnhook.add(this._editor.onMouseUp((t=>this._onEditorMouseUp(t)))),this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))):(this._toUnhook.add(this._editor.onMouseMove((t=>this._onEditorMouseMove(t)))),this._toUnhook.add(this._editor.onKeyDown((t=>this._onKeyDown(t))))),this._toUnhook.add(this._editor.onMouseLeave((t=>this._onEditorMouseLeave(t)))),this._toUnhook.add(this._editor.onDidChangeModel((()=>this._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){var i;this._isMouseDown=!0;const e=t.target;9!==e.type||e.detail!==FY.ID?12===e.type&&e.detail===PY.ID||(12!==e.type&&(this._hoverClicked=!1),(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||this._hideWidgets()):this._hoverClicked=!0}_onEditorMouseUp(t){this._isMouseDown=!1}_onEditorMouseLeave(t){var i,e;(null===(i=this._contentWidget)||void 0===i?void 0:i.widget.isResizing)||(null===(e=this._contentWidget)||void 0===e?void 0:e.containsNode(t.event.browserEvent.relatedTarget))||this._hideWidgets()}_isMouseOverWidget(t){var i,e,s,n,r;const o=t.target;return!((!this._isHoverSticky||9!==o.type||o.detail!==FY.ID)&&(!this._isHoverSticky||!(null===(i=this._contentWidget)||void 0===i?void 0:i.containsNode(null===(e=t.event.browserEvent.view)||void 0===e?void 0:e.document.activeElement))||(null===(n=null===(s=t.event.browserEvent.view)||void 0===s?void 0:s.getSelection())||void 0===n?void 0:n.isCollapsed))&&(this._isHoverSticky||9!==o.type||o.detail!==FY.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==PY.ID))}_onEditorMouseMove(t){var i,e,s,n;this._mouseMoveEvent=t,(null===(i=this._contentWidget)||void 0===i?void 0:i.isFocused)||(null===(e=this._contentWidget)||void 0===e?void 0:e.isResizing)||this._isMouseDown&&this._hoverClicked||this._isHoverSticky&&(null===(s=this._contentWidget)||void 0===s?void 0:s.isVisibleFromKeyboard)||(this._isMouseOverWidget(t)?this._reactToEditorMouseMoveRunner.cancel():(null===(n=this._contentWidget)||void 0===n?void 0:n.isVisible)&&this._isHoverSticky&&this._hidingDelay>0?this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hidingDelay):this._reactToEditorMouseMove(t))}_reactToEditorMouseMove(t){var i,e,s;if(!t)return;const n=t.target,r=null===(i=n.element)||void 0===i?void 0:i.classList.contains("colorpicker-color-decoration"),o=this._editor.getOption(146);if((!r||("click"!==o||this._hoverActivatedByColorDecoratorClick)&&("hover"!==o||this._isHoverEnabled)&&("clickAndHover"!==o||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))&&(r||this._isHoverEnabled||this._hoverActivatedByColorDecoratorClick))return this._getOrCreateContentWidget().maybeShowAt(t)?void(null===(e=this._glyphWidget)||void 0===e||e.hide()):2===n.type&&n.position?(null===(s=this._contentWidget)||void 0===s||s.hide(),this._glyphWidget||(this._glyphWidget=new PY(this._editor,this._languageService,this._openerService)),void this._glyphWidget.startShowingAt(n.position.lineNumber)):void this._hideWidgets();this._hideWidgets()}_onKeyDown(t){var i;if(!this._editor.hasModel())return;const e=this._keybindingService.softDispatch(t,this._editor.getDomNode()),s=1===e.kind||2===e.kind&&"editor.action.showHover"===e.commandId&&(null===(i=this._contentWidget)||void 0===i?void 0:i.isVisible);5===t.keyCode||6===t.keyCode||57===t.keyCode||4===t.keyCode||s||this._hideWidgets()}_hideWidgets(){var t,i,e;this._isMouseDown&&this._hoverClicked&&(null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible)||BX.dropDownVisible||(this._hoverActivatedByColorDecoratorClick=!1,this._hoverClicked=!1,null===(i=this._glyphWidget)||void 0===i||i.hide(),null===(e=this._contentWidget)||void 0===e||e.hide())}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(AY,this._editor)),this._contentWidget}showContentHover(t,i,e,s,n=!1){this._hoverActivatedByColorDecoratorClick=n,this._getOrCreateContentWidget().startShowingAtRange(t,i,e,s)}focus(){var t;null===(t=this._contentWidget)||void 0===t||t.focus()}scrollUp(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollUp()}scrollDown(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollDown()}scrollLeft(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollLeft()}scrollRight(){var t;null===(t=this._contentWidget)||void 0===t||t.scrollRight()}pageUp(){var t;null===(t=this._contentWidget)||void 0===t||t.pageUp()}pageDown(){var t;null===(t=this._contentWidget)||void 0===t||t.pageDown()}goToTop(){var t;null===(t=this._contentWidget)||void 0===t||t.goToTop()}goToBottom(){var t;null===(t=this._contentWidget)||void 0===t||t.goToBottom()}get isColorPickerVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isColorPickerVisible}get isHoverVisible(){var t;return null===(t=this._contentWidget)||void 0===t?void 0:t.isVisible}dispose(){var t,i;super.dispose(),this._unhookEvents(),this._toUnhook.dispose(),null===(t=this._glyphWidget)||void 0===t||t.dispose(),null===(i=this._contentWidget)||void 0===i||i.dispose()}};zX.ID="editor.contrib.hover",zX=VX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([HX(1,Zr),HX(2,AF),HX(3,Ba),HX(4,CC)],zX),hu(zX.ID,zX,2),ru(class extends tu{constructor(){super({id:"editor.action.showHover",label:J(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:gS.editorTextFocus,primary:xe(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=zX.get(i);if(!s)return;const n=i.getPosition(),r=new ps(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)}}),ru(class extends tu{constructor(){super({id:"editor.action.showDefinitionPreviewHover",label:J(0,"Show Definition Preview Hover"),alias:"Show Definition Preview Hover",precondition:void 0})}run(t,i){const e=zX.get(i);if(!e)return;const s=i.getPosition();if(!s)return;const n=new ps(s.lineNumber,s.column,s.lineNumber,s.column),r=aY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollUpHover",label:J(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollUp()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollDownHover",label:J(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollDown()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollLeftHover",label:J(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollLeft()}}),ru(class extends tu{constructor(){super({id:"editor.action.scrollRightHover",label:J(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=zX.get(i);e&&e.scrollRight()}}),ru(class extends tu{constructor(){super({id:"editor.action.pageUpHover",label:J(0,"Page Up Hover"),alias:"Page Up Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=zX.get(i);e&&e.pageUp()}}),ru(class extends tu{constructor(){super({id:"editor.action.pageDownHover",label:J(0,"Page Down Hover"),alias:"Page Down Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=zX.get(i);e&&e.pageDown()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToTopHover",label:J(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=zX.get(i);e&&e.goToTop()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToBottomHover",label:J(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:gS.hoverFocused,kbOpts:{kbExpr:gS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=zX.get(i);e&&e.goToBottom()}}),bY.register(HY),bY.register(xX),kk(((t,i)=>{const e=t.getColor(Xv);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 UX extends Hi{constructor(t){super(),this._editor=t,this._register(t.onMouseDown((t=>this.onMouseDown(t))))}dispose(){super.dispose()}onMouseDown(t){const i=this._editor.getOption(146);if("click"!==i&&"clickAndHover"!==i)return;const e=t.target;if(6!==e.type)return;if(!e.detail.injectedText)return;if(e.detail.injectedText.options.attachedData!==rJ)return;if(!e.range)return;const s=this._editor.getContribution(zX.ID);if(s&&!s.isColorPickerVisible){const t=new ps(e.range.startLineNumber,e.range.startColumn+1,e.range.endLineNumber,e.range.endColumn+1);s.showContentHover(t,1,0,!1,!0)}}}UX.ID="editor.contrib.colorContribution",hu(UX.ID,UX,2),bY.register(SJ);var KX,qX,GX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},ZX=function(t,i){return function(e,s){i(e,s,t)}},JX=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 QX=KX=class 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=gS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=gS.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 YX(this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused,this._instantiationService,this._modelService,this._keybindingService,this._languageFeatureService,this._languageConfigurationService))}hide(){var t;this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),null===(t=this._standaloneColorPickerWidget)||void 0===t||t.hide(),this._editor.focus()}insertColor(){var t;null===(t=this._standaloneColorPickerWidget)||void 0===t||t.updateEditor(),this.hide()}static get(t){return t.getContribution(KX.ID)}};QX.ID="editor.contrib.standaloneColorPickerController",QX=KX=GX([ZX(1,Jo),ZX(2,Xr),ZX(3,CC),ZX(4,Zr),ZX(5,Wg),ZX(6,ud)],QX),hu(QX.ID,QX,1);let YX=qX=class 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.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ie),this.onResult=this._onResult.event,this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(DJ,this._editor),this._position=null===(c=this._editor._getViewModel())||void 0===c?void 0:c.getPrimaryCursorState().modelState.position;const l=this._editor.getSelection(),u=l?{startLineNumber:l.startLineNumber,startColumn:l.startColumn,endLineNumber:l.endLineNumber,endColumn:l.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},a=this._register(Ll(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(u),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return qX.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const t=this._editor.getOption(60).above;return{position:this._position,secondaryPosition:this._position,preference:t?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}_start(t){return JX(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new XX(i.result,i.foundInEditor))}))}_computeAsync(t){return JX(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 KZ(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 TY(this._keybindingService)),setColorPicker:t=>s=t,onContentsChanged:()=>{},hide:()=>this.hide()};if(this._colorHover=t,this._register(this._standaloneColorPickerParticipant.renderHoverParts(n,[t])),void 0===s)return;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(.66*this._editor.getLayoutInfo().width,500)+"px",this._body.tabIndex=0,this._body.appendChild(e),s.layout();const r=s.body,o=r.saturationBox.domNode.clientWidth,h=r.domNode.clientWidth-o-22-8,c=s.body.enterButton;null==c||c.onClicked((()=>{this.updateEditor(),this.hide()}));const l=s.header;l.pickedColorNode.style.width=o+8+"px",l.originalColorNode.style.width=h+"px";const u=s.header.closeButton;null==u||u.onClicked((()=>{this.hide()})),i&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(t.range)),this._editor.layoutContentWidget(this)}};YX.ID="editor.contrib.standaloneColorPickerWidget",YX=qX=GX([ZX(3,Zr),ZX(4,Xr),ZX(5,CC),ZX(6,Wg),ZX(7,ud)],YX);class XX{constructor(t,i){this.value=t,this.foundInEditor=i}}ru(class extends tu{constructor(){super({id:"editor.action.hideColorPicker",label:J(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:gS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=QX.get(i))||void 0===e||e.hide()}}),ru(class extends tu{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:J(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:gS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=QX.get(i))||void 0===e||e.insertColor()}}),Eh(class extends eu{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{value:J(0,"Show or Focus Standalone Color Picker"),mnemonicTitle:J(0,"&&Show or Focus Standalone Color Picker"),original:"Show or Focus Standalone Color Picker"},precondition:void 0,menu:[{id:bh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=QX.get(i))||void 0===e||e.showOrFocus()}});class t0{constructor(t,i,e){this.languageConfigurationService=e,this._selection=t,this._insertSpace=i,this._usedEndToken=null}static _haystackHasNeedleAtOffset(t,i,e){if(e<0)return!1;const s=i.length;if(e+s>t.length)return!1;for(let n=0;n<s;n++){const s=t.charCodeAt(e+n),r=i.charCodeAt(n);if(s!==r&&!(s>=65&&s<=90&&s+32===r||r>=65&&r<=90&&r+32===s))return!1}return!0}_createOperationsForBlockComment(t,i,e,s,n,r){const o=t.startLineNumber,h=t.startColumn,c=t.endLineNumber,l=t.endColumn,u=n.getLineContent(o),a=n.getLineContent(c);let d,f=u.lastIndexOf(i,h-1+i.length),g=a.indexOf(e,l-1-e.length);if(-1!==f&&-1!==g)if(o===c)u.substring(f+i.length,g).indexOf(e)>=0&&(f=-1,g=-1);else{const t=u.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<u.length&&32===u.charCodeAt(f+i.length)&&(i+=" "),s&&g>0&&32===a.charCodeAt(g-1)&&(e=" "+e,g-=1),d=t0._createRemoveBlockCommentOperations(new ps(o,f+i.length+1,c,g+1),i,e)):(d=t0._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 ps.isEmpty(t)?s.push(OT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(OT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(OT.delete(new ps(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn+e.length)))),s}static _createAddBlockCommentOperations(t,i,e,s){const n=[];return ps.isEmpty(t)?n.push(OT.replace(new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(OT.insert(new gs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(OT.insert(new gs(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 ms(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 ms(t.endLineNumber,t.endColumn+i,t.endLineNumber,t.endColumn+i)}}}class i0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,u=s.length;h<u;h++){const u=s[h],a=n+h;if(a===n&&o){u.ignore=!0;continue}const d=e.getLineContent(a),f=$n(d);if(-1!==f){if(l=!1,u.ignore=!1,u.commentStrOffset=f,c&&!t0._haystackHasNeedleAtOffset(d,u.commentStr,f)&&(0===t?c=!1:1===t||(u.ignore=!0)),c&&i){const t=f+u.commentStrLength;t<d.length&&32===d.charCodeAt(t)&&(u.commentStrLength+=1)}}else u.ignore=r,u.commentStrOffset=d.length}if(0===t&&l){c=!1;for(let t=0,i=s.length;t<i;t++)s[t].ignore=!1}return{supported:!0,shouldRemoveComments:c,lines:s}}static _gatherPreflightData(t,i,e,s,n,r,o,h){const c=i0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:i0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=i0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(i0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new gs(s.positionLineNumber,s.positionColumn);for(let e=0,s=n.length;e<s;e++)i.addEditOperation(n[e].range,n[e].text),ps.isEmpty(n[e].range)&&ps.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?t0._createRemoveBlockCommentOperations(new ps(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=$n(i);-1===s&&(s=i.length),h=t0._createAddBlockCommentOperations(new ps(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=t0._createAddBlockCommentOperations(new ps(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 ps(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=i0._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 ms(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(OT.delete(new ps(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(OT.insert(new gs(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=i0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=i0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class e0 extends tu{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(ud);if(!i.hasModel())return;const s=[],n=i.getModel().getOptions(),r=i.getOption(23),o=i.getSelections().map(((t,i)=>({selection:t,index:i,ignoreFirstLine:!1})));o.sort(((t,i)=>ps.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 i0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}ru(class extends e0{constructor(){super(0,{id:"editor.action.commentLine",label:J(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"5_insert",title:J(0,"&&Toggle Line Comment"),order:1}})}}),ru(class extends e0{constructor(){super(1,{id:"editor.action.addCommentLine",label:J(0,"Add Line Comment"),alias:"Add Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2081),weight:100}})}}),ru(class extends e0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:J(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2099),weight:100}})}}),ru(class extends tu{constructor(){super({id:"editor.action.blockComment",label:J(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"5_insert",title:J(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(ud);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new t0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var s0,n0=function(t,i){return function(e,s){i(e,s,t)}};let r0=s0=class{static get(t){return t.getContribution(s0.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&&vl(i)===e.shadowRoot||this._contextViewService.hideContextView()}}))),this._toDispose.add(this._editor.onKeyDown((t=>{this._editor.getOption(24)&&58===t.keyCode&&(t.preventDefault(),t.stopPropagation(),this.showContextMenu())})))}_onContextMenu(t){if(!this._editor.hasModel())return;if(!this._editor.getOption(24))return this._editor.focus(),void(t.target.position&&!this._editor.getSelection().containsPosition(t.target.position)&&this._editor.setPosition(t.target.position));if(12===t.target.type)return;if(6===t.target.type&&t.target.detail.injectedText)return;if(t.event.preventDefault(),t.event.stopPropagation(),11===t.target.type)return this._showScrollbarContextMenu(t.event);if(6!==t.target.type&&7!==t.target.type&&1!==t.target.type)return;if(this._editor.focus(),t.target.position){let i=!1;for(const e of this._editor.getSelections())if(e.containsPosition(t.target.position)){i=!0;break}i||this._editor.setPosition(t.target.position)}let i=null;1!==t.target.type&&(i=t.event),this.showContextMenu(i)}showContextMenu(t){if(!this._editor.getOption(24))return;if(!this._editor.hasModel())return;const i=this._getMenuActions(this._editor.getModel(),this._editor.isSimpleWidget?bh.SimpleEditorContext:bh.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 Sh){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new ho(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new oo)}return e.length&&e.pop(),e}_doShowContextMenu(t,i=null){if(!this._editor.hasModel())return;const e=this._editor.getOption(60);this._editor.updateOptions({hover:{enabled:!1}});let s=i;if(!s){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),i=cl(this._editor.getDomNode());s={x:i.left+t.left,y:i.top+t.top+t.height}}const n=this._editor.getOption(126)&&!wt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getDomNode():void 0,getAnchor:()=>s,getActions:()=>t,getActionViewItem:t=>{const i=this._keybindingFor(t);return i?new DP(t,t,{label:!0,keybinding:i.getLabel(),isMenu:!0}):"function"==typeof t.getActionViewItem?t.getActionViewItem():new DP(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===mR)return;const i=this._editor.getOption(72);let e=0;const s=t=>({id:"menu-action-"+ ++e,label:t.label,tooltip:"",class:void 0,enabled:void 0===t.enabled||t.enabled,checked:t.checked,run:t.run}),n=(t,i,n,r,o)=>{if(!i)return s({label:t,enabled:i,run:()=>{}});const h=t=>()=>{this._configurationService.updateValue(n,t)},c=[];for(const t of o)c.push(s({label:t.label,checked:r===t.value,run:h(t.value)}));return((t,i)=>new ho("menu-action-"+ ++e,t,i,void 0))(t,c)},r=[];r.push(s({label:J(0,"Minimap"),checked:i.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!i.enabled)}})),r.push(new oo),r.push(s({label:J(0,"Render Characters"),enabled:i.enabled,checked:i.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!i.renderCharacters)}})),r.push(n(J(0,"Vertical size"),i.enabled,"editor.minimap.size",i.size,[{label:J(0,"Proportional"),value:"proportional"},{label:J(0,"Fill"),value:"fill"},{label:J(0,"Fit"),value:"fit"}])),r.push(n(J(0,"Slider"),i.enabled,"editor.minimap.showSlider",i.showSlider,[{label:J(0,"Mouse Over"),value:"mouseover"},{label:J(0,"Always"),value:"always"}]));const o=this._editor.getOption(126)&&!wt;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:o?this._editor.getDomNode():void 0,getAnchor:()=>t,getActions:()=>r,onHide:()=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(t){return this._keybindingService.lookupKeybinding(t.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};r0.ID="editor.contrib.contextmenu",r0=s0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([n0(1,AR),n0(2,ER),n0(3,Jo),n0(4,CC),n0(5,yh),n0(6,Ta),n0(7,aR)],r0),hu(r0.ID,r0,2),ru(class extends tu{constructor(){super({id:"editor.action.showContextMenu",label:J(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=r0.get(i))||void 0===e||e.showContextMenu()}});class o0{constructor(t){this.selections=t}equals(t){const i=this.selections.length;if(i!==t.selections.length)return!1;for(let e=0;e<i;e++)if(!this.selections[e].equalsSelection(t.selections[e]))return!1;return!0}}class h0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class c0 extends Hi{static get(t){return t.getContribution(c0.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 o0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new h0(e,t.getScrollTop(),t.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())})))}cursorUndo(){this._editor.hasModel()&&0!==this._undoStack.length&&(this._redoStack.push(new h0(new o0(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){this._editor.hasModel()&&0!==this._redoStack.length&&(this._undoStack.push(new h0(new o0(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}}c0.ID="editor.contrib.cursorUndoRedoController",hu(c0.ID,c0,0),ru(class extends tu{constructor(){super({id:"cursorUndo",label:J(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=c0.get(i))||void 0===s||s.cursorUndo()}}),ru(class extends tu{constructor(){super({id:"cursorRedo",label:J(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=c0.get(i))||void 0===s||s.cursorRedo()}});class l0{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 ps(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 ms(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 ms(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 ms(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 ms(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 ms(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 u0(t){return ft?t.altKey:t.ctrlKey}class a0 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(35)&&!this._editor.getOption(22)&&(u0(t)&&(this._modifierPressed=!0),this._mouseDown&&u0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(u0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===a0.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]}u0(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 gs(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 ms(s,n,i.lineNumber,i.column)]}}else e=(this._editor.getSelections()||[]).map((t=>t.containsPosition(i)?new ms(i.lineNumber,i.column,i.lineNumber,i.column):t));this._editor.setSelections(e||[],"mouse",3)}else(!this._dragSelection.containsPosition(i)||(u0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(a0.ID,new l0(this._dragSelection,i,u0(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 ps(t.lineNumber,t.column,t.lineNumber,t.column),options:a0._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()}}a0.ID="editor.contrib.dragAndDrop",a0.TRIGGER_KEY_VALUE=ft?6:5,a0._DECORATION_OPTIONS=$M.register({description:"dnd-target",className:"dnd-target"}),hu(a0.ID,a0,2);const d0=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 f0=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 g0(t){return{asString:()=>f0(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class p0{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 Rt.some(this,(([t,i])=>i.asFile()))&&i.push("files"),w0(m0(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 m0(t)}}function m0(t){return t.toLowerCase()}function v0(t,i){return w0(m0(t),i.map(m0))}function w0(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 b0=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>b0.split(t).filter((t=>!t.startsWith("#")))});dh.add("workbench.contributions.dragAndDrop",new class{});class y0{constructor(){}static getInstance(){return y0.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}y0.INSTANCE=new y0;function k0(t){const i=new p0;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,g0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,C0(s))}}return i}function C0(t){const i=t.path?ss.parse(t.path):void 0;return function(t,i,e){const s={id:d0(),name:t,uri:i,data:e};return{asString:()=>f0(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>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())}))}(this,void 0,void 0,(function*(){return new Uint8Array(yield t.arrayBuffer())}))))}const S0=Object.freeze(["CodeEditors","CodeFiles",UR.RESOURCES,UR.INTERNAL_URI_LIST]);function x0(t,i=!1){const e=k0(t),s=e.get(UR.INTERNAL_URI_LIST);if(s)e.replace(Ha.uriList,s);else if(i||!e.has(Ha.uriList)){const i=[];for(const e of t.items){const t=e.getAsFile();if(t){const e=t.path;try{i.push(e?ss.file(e).toString():ss.parse(t.name,!0).toString())}catch(t){}}}i.length&&e.replace(Ha.uriList,g0(b0.create(i)))}for(const t of S0)e.delete(t);return e}function D0(t){var i;function e(t,i){return"providerId"in t&&t.providerId===i.providerId||"mimeType"in t&&t.mimeType===i.handledMimeType}const s=new Map;for(const n of t)for(const r of null!==(i=n.yieldTo)&&void 0!==i?i:[])for(const i of t)if(i!==n&&e(r,i)){let t=s.get(n);t||(t=[],s.set(n,t)),t.push(i)}if(!s.size)return Array.from(t);const n=new Set,r=[];return function t(i){if(!i.length)return[];const e=i[0];if(r.includes(e))return console.warn(`Yield to cycle detected for ${e.providerId}`),i;if(n.has(e))return t(i.slice(1));let o=[];const h=s.get(e);return h&&(r.push(e),o=t(h),r.pop()),n.add(e),[...o,e,...t(i.slice(1))]}(Array.from(t))}const E0=$M.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class A0 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=Pl(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=Pl("span.icon");this.domNode.append(i),i.classList.add(...eo.asClassNameArray(ys.loading),"codicon-modifier-spin");const e=()=>{const t=this.editor.getOption(66);this.domNode.style.height=`${t}px`,this.domNode.style.width=`${Math.ceil(.8*t)}px`};e(),this._register(this.editor.onDidChangeConfiguration((t=>{(t.hasChanged(52)||t.hasChanged(66))&&e()}))),this._register(Qc(this.domNode,El.CLICK,(()=>{this.delegate.cancel()})))}getId(){return A0.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)}}A0.baseId="editor.widget.inlineProgressWidget";let M0=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 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())}))}(this,void 0,void 0,(function*(){const s=this._operationIdPool++;this._currentOperation=s,this.clear(),this._showPromise.value=xu((()=>{const s=ps.fromPositions(t);this._currentDecorations.set([{range:s,options:E0}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(A0,this.id,this._editor,s,i,e))}),this._showDelay);try{return yield e}finally{this._currentOperation===s&&(this.clear(),this._currentOperation=void 0)}}))}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};M0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zr)],M0);var L0,O0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},F0=function(t,i){return function(e,s){i(e,s,t)}},T0=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 R0=L0=class extends Hi{constructor(t,i,e,s,n,r,o,h,c,l){super(),this.typeId=t,this.editor=i,this.showCommand=s,this.range=n,this.edits=r,this.onSelectNewEdit=o,this._contextMenuService=h,this._keybindingService=l,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=e.bindTo(c),this.visibleContext.set(!0),this._register(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(Ji.runAndSubscribe(l.onDidUpdateKeybindings,(()=>{this._updateButtonTitle()})))}_updateButtonTitle(){var t;const i=null===(t=this._keybindingService.lookupKeybinding(this.showCommand.id))||void 0===t?void 0:t.getLabel();this.button.element.title=this.showCommand.label+(i?` (${i})`:"")}create(){this.domNode=Pl(".post-edit-widget"),this.button=this._register(new Bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Qc(this.domNode,El.CLICK,(()=>this.showSelector())))}getId(){return L0.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=cl(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>lo({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};R0.baseId="editor.widget.postEditWidget",R0=L0=O0([F0(7,AR),F0(8,Jo),F0(9,CC)],R0);let _0=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(Ji.any(i.onDidChangeModel,i.onDidChangeModelContent)((()=>this.clear())))}applyEditAndShowIfNeeded(t,i,e,s){var n,r;return T0(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;let c=[];c=("string"==typeof h.insertText?""===h.insertText:""===h.insertText.snippet)?[]:t.map((t=>new CT(o.uri,"string"==typeof h.insertText?{range:t,text:h.insertText,insertAsSnippet:!1}:{range:t,text:h.insertText.snippet,insertAsSnippet:!0})));const l={edits:[...c,...null!==(r=null===(n=h.additionalEdit)||void 0===n?void 0:n.edits)&&void 0!==r?r:[]]},u=t[0],a=o.deltaDecorations([],[{range:u,options:{description:"paste-line-suffix",stickiness:0}}]);let d,f;try{d=yield this._bulkEditService.apply(l,{editor:this._editor,token:s}),f=o.getDecorationRange(a[0])}finally{o.deltaDecorations(a,[])}e&&d.isApplied&&i.allEdits.length>1&&this.show(null!=f?f:u,i,(n=>T0(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(R0,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()}};_0=O0([F0(4,Zr),F0(5,yT)],_0);var I0,P0=function(t,i){return function(e,s){i(e,s,t)}},N0=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 B0="editor.changePasteType",$0=new Zo("pasteWidgetVisible",!1,J(0,"Whether the paste widget is showing")),j0="application/vnd.code.copyMetadata";let W0=I0=class extends Hi{static get(t){return t.getContribution(I0.ID)}constructor(t,i,e,s,n,r,o){super(),this._bulkEditService=e,this._clipboardService=s,this._languageFeaturesService=n,this._quickInputService=r,this._progressService=o,this._editor=t;const h=t.getContainerDomNode();this._register(Qc(h,"copy",(t=>this.handleCopy(t)))),this._register(Qc(h,"cut",(t=>this.handleCopy(t)))),this._register(Qc(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new M0("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(_0,"pasteIntoEditor",t,$0,{id:B0,label:J(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},bl().execCommand("paste")}finally{this._pasteAsActionContext=void 0}}isPasteAsEnabled(){return this._editor.getOption(84).enabled&&!this._editor.getOption(90)}handleCopy(t){var i,e;if(!this._editor.hasTextFocus())return;if(mt&&this._clipboardService.writeResources([]),!t.clipboardData||!this.isPasteAsEnabled())return;const s=this._editor.getModel(),n=this._editor.getSelections();if(!s||!(null==n?void 0:n.length))return;const r=this._editor.getOption(37);let o=n;const h=1===n.length&&n[0].isEmpty();if(h){if(!r)return;o=[new ps(o[0].startLineNumber,1,o[0].startLineNumber,1+s.getLineLength(o[0].startLineNumber))]}const l=null===(i=this._editor._getViewModel())||void 0===i?void 0:i.getPlainTextToCopy(n,r,dt),u={multicursorText:Array.isArray(l)?l:null,pasteOnNewLine:h,mode:null},a=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>!!t.prepareDocumentPaste));if(!a.length)return void this.setCopyMetadata(t.clipboardData,{defaultPastePayload:u});const d=k0(t.clipboardData),f=a.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=d0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:u});const p=wu((t=>N0(this,void 0,void 0,(function*(){const i=c(yield Promise.all(a.map((i=>N0(this,void 0,void 0,(function*(){try{return yield i.prepareDocumentPaste(s,o,d,t)}catch(t){return void console.error(t)}}))))));i.reverse();for(const t of i)for(const[i,e]of t)d.replace(i,e);return d}))));null===(e=this._currentCopyOperation)||void 0===e||e.dataTransferPromise.cancel(),this._currentCopyOperation={handle:g,dataTransferPromise:p}}handlePaste(t){var i,e;return N0(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),o=x0(t.clipboardData);o.delete(j0);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],Ha.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>v0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}))}doPasteInline(t,i,e,s){const n=wu((r=>N0(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new oK(o,3,void 0,r);try{if(yield this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const r=t.filter((t=>V0(t,e)));if(!r.length||1===r.length&&"text"===r[0].id)return void(yield this.applyDefaultPasteHandler(e,s,c.token));const l=yield this.getPasteEdits(r,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===l.length&&"text"===l[0].providerId)return void(yield this.applyDefaultPasteHandler(e,s,c.token));if(l.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:l},t,c.token)}yield this.applyDefaultPasteHandler(e,s,c.token)}finally{c.dispose(),this._currentPasteOperation===n&&(this._currentPasteOperation=void 0)}}))));this._pasteProgressManager.showWhile(i[0].getEndPosition(),J(0,"Running paste handlers. Click to cancel"),n),this._currentPasteOperation=n}showPasteAsPick(t,i,e,s,n){const r=wu((o=>N0(this,void 0,void 0,(function*(){const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new oK(h,3,void 0,o);try{if(yield this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let o=i.filter((t=>V0(t,s)));t&&(o=o.filter((i=>i.id===t)));const h=yield this.getPasteEdits(o,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!h.length)return;let u;if(t)u=h.at(0);else{const t=yield this._quickInputService.pick(h.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:J(0,"Select Paste Action")});u=null==t?void 0:t.edit}if(!u)return;const a=function(t,i,e){var s,n;return{edits:[...i.map((i=>new CT(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,u);yield this._bulkEditService.apply(a,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}}))));this._progressService.withProgress({location:10,title:J(0,"Running paste handlers")},(()=>r))}setCopyMetadata(t,i){t.setData(j0,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(j0);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=uk.getTextData(t.clipboardData);return n?{defaultPastePayload:{mode:n.mode,multicursorText:null!==(i=n.multicursorText)&&void 0!==i?i:null,pasteOnNewLine:!!n.isFromEmptySelection}}:void 0}mergeInDataFromCopy(t,i,e){var s;return N0(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(Ha.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(Ha.uriList,g0(b0.create(i)))}}))}getPasteEdits(t,i,e,s,n){return N0(this,void 0,void 0,(function*(){const r=yield bu(Promise.all(t.map((t=>N0(this,void 0,void 0,(function*(){var r;try{const o=yield null===(r=t.provideDocumentPasteEdits)||void 0===r?void 0:r.call(t,e,s,i,n);if(o)return Object.assign(Object.assign({},o),{providerId:t.id})}catch(t){console.error(t)}}))))),n);return D0(c(null!=r?r:[]))}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return N0(this,void 0,void 0,(function*(){const o=null!==(s=t.get(Ha.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 V0(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}W0.ID="editor.contrib.copyPasteActionController",W0=I0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([P0(1,Zr),P0(2,yT),P0(3,EV),P0(4,Wg),P0(5,Ij),P0(6,eR)],W0);var H0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},z0=function(t,i){return function(e,s){i(e,s,t)}},U0=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 K0=J(0,"Built-in");class q0{provideDocumentPasteEdits(t,i,e,s){return U0(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{insertText:t.insertText,label:t.label,detail:t.detail,handledMimeType:t.handledMimeType,yieldTo:t.yieldTo}:void 0}))}provideDocumentOnDropEdits(t,i,e,s){return U0(this,void 0,void 0,(function*(){const t=yield this.getEdit(e,s);return t?{insertText:t.insertText,label:t.label,handledMimeType:t.handledMimeType,yieldTo:t.yieldTo}:void 0}))}}class G0 extends q0{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[Ha.text],this.pasteMimeTypes=[Ha.text]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const i=t.get(Ha.text);if(!i)return;if(t.has(Ha.uriList))return;const e=yield i.asString();return{handledMimeType:Ha.text,label:J(0,"Insert Plain Text"),detail:K0,insertText:e}}))}}class Z0 extends q0{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[Ha.uriList],this.pasteMimeTypes=[Ha.uriList]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const e=yield Q0(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===Vc.file?t.fsPath:(s++,i))).join(" ");let r;return r=J(0,s>0?e.length>1?"Insert Uris":"Insert Uri":e.length>1?"Insert Paths":"Insert Path"),{handledMimeType:Ha.uriList,insertText:n,label:r,detail:K0}}))}}let J0=class extends q0{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[Ha.uriList],this.pasteMimeTypes=[Ha.uriList]}getEdit(t,i){return U0(this,void 0,void 0,(function*(){const e=yield Q0(t);if(!e.length||i.isCancellationRequested)return;const s=c(e.map((({uri:t})=>{const i=this._workspaceContextService.getWorkspaceFolder(t);return i?PE(i.uri,t):void 0})));return s.length?{handledMimeType:Ha.uriList,insertText:s.join(" "),label:J(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:K0}:void 0}))}};function Q0(t){return U0(this,void 0,void 0,(function*(){const i=t.get(Ha.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of b0.parse(e))try{s.push({uri:ss.parse(t),originalText:t})}catch(t){}return s}))}J0=H0([z0(0,aR)],J0);let Y0=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new G0)),this._register(t.documentOnDropEditProvider.register("*",new Z0)),this._register(t.documentOnDropEditProvider.register("*",new J0(i)))}};Y0=H0([z0(0,Wg),z0(1,aR)],Y0);let X0=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new G0)),this._register(t.documentPasteEditProvider.register("*",new Z0)),this._register(t.documentPasteEditProvider.register("*",new J0(i)))}};X0=H0([z0(0,Wg),z0(1,aR)],X0),hu(W0.ID,W0,0),tH(X0),nu(new class extends Xl{constructor(){super({id:B0,precondition:$0,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=W0.get(i))||void 0===s?void 0:s.changePasteType()}}),ru(class extends tu{constructor(){super({id:"editor.action.pasteAs",label:J(0,"Paste As..."),alias:"Paste As...",precondition:void 0,description:{description:"Paste as",args:[{name:"args",schema:{type:"object",properties:{id:{type:"string",description:J(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=W0.get(i))||void 0===s?void 0:s.pasteAs(n)}});class t1{constructor(t){this.identifier=t}}const i1=Qr("treeViewsDndService");Wa(i1,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 e1,s1=function(t,i){return function(e,s){i(e,s,t)}},n1=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 r1="editor.experimental.dropIntoEditor.defaultProvider",o1="editor.changeDropType",h1=new Zo("dropWidgetVisible",!1,J(0,"Whether the drop widget is showing"));let c1=e1=class extends Hi{static get(t){return t.getContribution(e1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=y0.getInstance(),this._dropProgressManager=this._register(i.createInstance(M0,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(_0,"dropIntoEditor",t,h1,{id:o1,label:J(0,"Show drop options...")})),this._register(t.onDropIntoEditor((i=>this.onDropIntoEditor(t,i.position,i.event))))}changeDropType(){this._postDropWidgetManager.tryShowSelector()}onDropIntoEditor(t,i,e){var s;return n1(this,void 0,void 0,(function*(){if(!e.dataTransfer||!t.hasModel())return;null===(s=this._currentOperation)||void 0===s||s.cancel(),t.focus(),t.setPosition(i);const n=wu((s=>n1(this,void 0,void 0,(function*(){const r=new oK(t,1,void 0,s);try{const o=yield this.extractDataTransferData(e);if(0===o.size||r.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))))),l=yield this.getDropEdits(c,h,i,o,r);if(r.token.isCancellationRequested)return;if(l.length){const e=this.getInitialActiveEditIndex(h,l),n="afterDrop"===t.getOption(36).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ps.fromPositions(i)],{activeEditIndex:e,allEdits:l},n,s)}}finally{r.dispose(),this._currentOperation===n&&(this._currentOperation=void 0)}}))));this._dropProgressManager.showWhile(i,J(0,"Running drop handlers. Click to cancel"),n),this._currentOperation=n}))}getDropEdits(t,i,e,s,n){return n1(this,void 0,void 0,(function*(){const r=yield bu(Promise.all(t.map((t=>n1(this,void 0,void 0,(function*(){try{const r=yield t.provideDocumentOnDropEdits(i,e,s,n.token);if(r)return Object.assign(Object.assign({},r),{providerId:t.id})}catch(t){console.error(t)}}))))),n.token);return D0(c(null!=r?r:[]))}))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(r1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&v0(t,[i.handledMimeType])));if(e>=0)return e}return 0}extractDataTransferData(t){return n1(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new p0;const i=x0(t.dataTransfer);if(this.treeItemsTransfer.hasData(t1.prototype)){const t=this.treeItemsTransfer.getData(t1.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}))}};c1.ID="editor.contrib.dropIntoEditorController",c1=e1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,Zr),s1(2,Ta),s1(3,Wg),s1(4,i1)],c1),hu(c1.ID,c1,2),nu(new class extends Xl{constructor(){super({id:o1,precondition:h1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=c1.get(i))||void 0===s||s.changeDropType()}}),tH(Y0),dh.as(Ka).registerConfiguration(Object.assign(Object.assign({},DT),{properties:{[r1]:{type:"object",scope:5,description:J(0,"Configures the default drop provider to use for content of a given mime type."),default:{},additionalProperties:{type:"string"}}}}));class l1{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===l1._FIND_MATCH_DECORATION||i===l1._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,l1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,l1._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 ps(e.startLineNumber,e.startColumn,t,i)}this._rangeHighlightDecorationId=t.addDecoration(e,l1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=l1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=l1._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 ps(o,1,h,1),options:l1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ps(o,1,h,1),options:l1._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,l1._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}}l1._CURRENT_FIND_MATCH_DECORATION=$M.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:vk(fb),position:Xd.Center},minimap:{color:vk(pb),position:ef.Inline}}),l1._FIND_MATCH_DECORATION=$M.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:vk(fb),position:Xd.Center},minimap:{color:vk(pb),position:ef.Inline}}),l1._FIND_MATCH_NO_OVERVIEW_DECORATION=$M.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),l1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=$M.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:vk(fb),position:Xd.Center}}),l1._RANGE_HIGHLIGHT_DECORATION=$M.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),l1._FIND_SCOPE_DECORATION=$M.register({description:"find-scope",className:"findScope",isWholeLine:!0});class u1{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)=>ps.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 a1(t,i){if(t&&""!==t[0]){const e=d1(t,i,"-"),s=d1(t,i,"_");return e&&!s?f1(t,i,"-"):!e&&s?f1(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 d1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function f1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=a1([n[i]],t)+e})),r.slice(0,-1)}class g1{constructor(t){this.staticValue=t,this.kind=0}}class p1{constructor(t){this.pieces=t,this.kind=1}}class m1{static fromStaticValue(t){return new m1([v1.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 g1(t[0].staticValue):new p1(t):new g1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?a1(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=m1._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 v1{static staticValue(t){return new v1(t,-1,null)}static caseOps(t,i){return new v1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class w1{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++]=v1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=v1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=v1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new m1(this._result)}}const b1=new Zo("findWidgetVisible",!1);b1.toNegated();const y1=new Zo("findInputFocussed",!1),k1=new Zo("replaceInputFocussed",!1),C1={primary:545,mac:{primary:2593}},S1={primary:565,mac:{primary:2613}},x1={primary:560,mac:{primary:2608}},D1={primary:554,mac:{primary:2602}},E1={primary:558,mac:{primary:2606}},A1="editor.action.nextMatchFindAction",M1="editor.action.previousMatchFindAction",L1="closeFindWidget",O1="toggleFindCaseSensitive",F1="toggleFindWholeWord",T1="toggleFindRegex",R1="toggleFindInSelection",_1="togglePreserveCase",I1="editor.action.replaceOne",P1="editor.action.replaceAll",N1=19999;class B1{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new Eu,this._decorations=new l1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Mu((()=>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 ps(t.startLineNumber,1,i,this._editor.getModel().getLineMaxColumn(i))}return t})));const s=this._findMatches(e,!1,N1);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=Mf(s.map((t=>t.range)),(t=>ps.compareRangesUsingStarts(t,n)>=0));r=t>0?t-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),t&&this._editor.getOption(41).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const t=this._decorations.getFindScope();return t&&this._editor.revealRangeInCenterIfOutsideViewport(t,0),!0}return!1}_setCurrentFindMatch(t){const i=this._decorations.setCurrentFindMatch(t);this._state.changeMatchInfo(i,this._decorations.getCount(),t),this._editor.setSelection(t),this._editor.revealRangeInCenterIfOutsideViewport(t,0)}_prevSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||1===s?(1===e?e=n.getLineCount():e--,s=n.getLineMaxColumn(e)):s--,new gs(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()<N1){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=B1._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 gs(n,r),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1);return c&&c.range.isEmpty()&&c.range.getStartPosition().equals(h)&&(h=this._prevSearchPosition(h),c=o.findPreviousMatch(this._state.searchString,h,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,!1)),c?i||s.containsRange(c.range)?void this._setCurrentFindMatch(c.range):this._moveToPrevMatch(c.range.getStartPosition(),!0):void 0}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(t){const i=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:e,column:s}=t;const n=this._editor.getModel();return i||s===n.getLineMaxColumn(e)?(e===n.getLineCount()?e=1:e++,s=1):s++,new gs(e,s)}_moveToNextMatch(t){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(t);return void(i&&this._setCurrentFindMatch(i))}if(this._decorations.getCount()<N1){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=B1._getSearchRange(this._editor.getModel(),n);r.getEndPosition().isBefore(t)&&(t=r.getStartPosition()),t.isBefore(r.getStartPosition())&&(t=r.getStartPosition());const{lineNumber:o,column:h}=t,c=this._editor.getModel();let l=new gs(o,h),u=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i);return e&&u&&u.range.isEmpty()&&u.range.getStartPosition().equals(l)&&(l=this._nextSearchPosition(l),u=c.findNextMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i)),u?s||r.containsRange(u.range)?u:this._getNextMatch(u.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 m1(null);const i=[],e=new w1(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):m1.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 BC(i,s);this._executeEditorCommand("replace",n),this._decorations.setStartPosition(new gs(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=>B1._getSearchRange(this._editor.getModel(),t)));return this._editor.getModel().findMatches(this._state.searchString,s,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null,i,e)}replaceAll(){if(!this._hasMatches())return;const t=this._decorations.getFindScopes();null===t&&this._state.matchesCount>=N1?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new df(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(129):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let t="mu";i.ignoreCase&&(t+="i"),i.global&&(t+="g"),i=new RegExp(i.source,t)}const e=this._editor.getModel(),s=e.getValue(1),n=e.getFullModelRange(),r=this._getReplacePattern();let o;const h=this._state.preserveCase;o=s.replace(i,r.hasReplacementPatterns||h?function(){return r.buildReplaceString(arguments,h)}:r.buildReplaceString(null,h));const c=new VC(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 u1(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 ms(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 $1 extends Ty{constructor(t,i,e){super(),this._hideSoon=this._register(new Mu((()=>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:Am(Hm),inputActiveOptionForeground:Am(Um),inputActiveOptionBackground:Am(zm)};this.caseSensitive=this._register(new pB(Object.assign({appendTitle:this._keybindingLabelFor(O1),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(F1),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 vB(Object.assign({appendTitle:this._keybindingLabelFor(T1),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(Qc(this._domNode,El.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Qc(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 $1.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 j1(t,i){return 1===t||2!==t&&i}$1.ID="editor.contrib.findOptionsWidget";class W1 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 j1(this._isRegexOverride,this._isRegex)}get wholeWord(){return j1(this._wholeWordOverride,this._wholeWord)}get matchCase(){return j1(this._matchCaseOverride,this._matchCase)}get preserveCase(){return j1(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 ie),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&&(ps.equalsRange(this._currentMatch,e)||(this._currentMatch=e,s.currentMatch=!0,n=!0)),n&&this._onFindReplaceStateChange.fire(s)}change(t,i,e=!0){var s;const n={moveCursor:i,updateHistory:e,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let r=!1;const o=this.isRegex,h=this.wholeWord,c=this.matchCase,l=this.preserveCase;void 0!==t.searchString&&this._searchString!==t.searchString&&(this._searchString=t.searchString,n.searchString=!0,r=!0),void 0!==t.replaceString&&this._replaceString!==t.replaceString&&(this._replaceString=t.replaceString,n.replaceString=!0,r=!0),void 0!==t.isRevealed&&this._isRevealed!==t.isRevealed&&(this._isRevealed=t.isRevealed,n.isRevealed=!0,r=!0),void 0!==t.isReplaceRevealed&&this._isReplaceRevealed!==t.isReplaceRevealed&&(this._isReplaceRevealed=t.isReplaceRevealed,n.isReplaceRevealed=!0,r=!0),void 0!==t.isRegex&&(this._isRegex=t.isRegex),void 0!==t.wholeWord&&(this._wholeWord=t.wholeWord),void 0!==t.matchCase&&(this._matchCase=t.matchCase),void 0!==t.preserveCase&&(this._preserveCase=t.preserveCase),void 0!==t.searchScope&&((null===(s=t.searchScope)||void 0===s?void 0:s.every((t=>{var i;return null===(i=this._searchScope)||void 0===i?void 0:i.some((i=>!ps.equalsRange(i,t)))})))||(this._searchScope=t.searchScope,n.searchScope=!0,r=!0)),void 0!==t.loop&&this._loop!==t.loop&&(this._loop=t.loop,n.loop=!0,r=!0),void 0!==t.isSearching&&this._isSearching!==t.isSearching&&(this._isSearching=t.isSearching,n.isSearching=!0,r=!0),void 0!==t.filters&&(this._filters?this._filters.update(t.filters):this._filters=t.filters,n.filters=!0,r=!0),this._isRegexOverride=void 0!==t.isRegexOverride?t.isRegexOverride:0,this._wholeWordOverride=void 0!==t.wholeWordOverride?t.wholeWordOverride:0,this._matchCaseOverride=void 0!==t.matchCaseOverride?t.matchCaseOverride:0,this._preserveCaseOverride=void 0!==t.preserveCaseOverride?t.preserveCaseOverride:0,o!==this.isRegex&&(r=!0,n.isRegex=!0),h!==this.wholeWord&&(r=!0,n.wholeWord=!0),c!==this.matchCase&&(r=!0,n.matchCase=!0),l!==this.preserveCase&&(r=!0,n.preserveCase=!0),r&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||1!==this.matchesPosition}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=N1}}const V1=J(0,"input"),H1=J(0,"Preserve Case");class z1 extends aB{constructor(t){super({icon:ys.preserveCase,title:H1+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class U1 extends Ty{constructor(t,i,e,s){super(),this._showOptionButtons=e,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ie),this.onDidOptionChange=this._onDidOptionChange.event,this._onKeyDown=this._register(new ie),this.onKeyDown=this._onKeyDown.event,this._onMouseDown=this._register(new ie),this._onInput=this._register(new ie),this._onKeyUp=this._register(new ie),this._onPreserveCaseKeyDown=this._register(new ie),this.onPreserveCaseKeyDown=this._onPreserveCaseKeyDown.event,this.contextViewProvider=i,this.placeholder=s.placeholder||"",this.validation=s.validation,this.label=s.label||V1;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 CB(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 z1(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 l=[this.preserveCase.domNode];this.onkeydown(this.domNode,(t=>{if(t.equals(15)||t.equals(17)||t.equals(9)){const i=l.indexOf(document.activeElement);if(i>=0){let e=-1;t.equals(17)?e=(i+1)%l.length:t.equals(15)&&(e=0===i?l.length-1:i-1),t.equals(9)?(l[i].blur(),this.inputBox.focus()):e>=0&&l[e].focus(),Al(t,!0)}}}));const u=document.createElement("div");u.className="controls",u.style.display=this._showOptionButtons?"block":"none",u.appendChild(this.preserveCase.domNode),this.domNode.appendChild(u),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 K1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},q1=function(t,i){return function(e,s){i(e,s,t)}};const G1=new Zo("suggestWidgetVisible",!1,J(0,"Whether suggestion are visible")),Z1="historyNavigationWidgetFocus",J1="historyNavigationForwardsEnabled",Q1="historyNavigationBackwardsEnabled";let Y1;const X1=[];function t2(t,i){if(X1.includes(i))throw new Error("Cannot register the same widget multiple times");X1.push(i);const e=new Vi,s=new Zo(Z1,!1).bindTo(t),n=new Zo(J1,!0).bindTo(t),r=new Zo(Q1,!0).bindTo(t),o=()=>{s.set(!0),Y1=i},h=()=>{s.set(!1),Y1===i&&(Y1=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{X1.splice(X1.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let i2=class extends xB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(t2(n,this.inputBox))}};i2=K1([q1(3,Jo)],i2);let e2=class extends U1{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(t2(r,this.inputBox))}};function s2(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())}e2=K1([q1(3,Jo)],e2),gh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Lo.and(Lo.has(Z1),Lo.equals(Q1,!0),Lo.not("isComposing"),G1.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==Y1||Y1.showPreviousValue()}}),gh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Lo.and(Lo.has(Z1),Lo.equals(J1,!0),Lo.not("isComposing"),G1.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==Y1||Y1.showNextValue()}});const n2=GW("find-selection",ys.selection,J(0,"Icon for 'Find in Selection' in the editor find widget.")),r2=GW("find-collapsed",ys.chevronRight,J(0,"Icon to indicate that the editor find widget is collapsed.")),o2=GW("find-expanded",ys.chevronDown,J(0,"Icon to indicate that the editor find widget is expanded.")),h2=GW("find-replace",ys.replace,J(0,"Icon for 'Replace' in the editor find widget.")),c2=GW("find-replace-all",ys.replaceAll,J(0,"Icon for 'Replace All' in the editor find widget.")),l2=GW("find-previous-match",ys.arrowUp,J(0,"Icon for 'Find Previous' in the editor find widget.")),u2=GW("find-next-match",ys.arrowDown,J(0,"Icon for 'Find Next' in the editor find widget.")),a2=J(0,"Find / Replace"),d2=J(0,"Find"),f2=J(0,"Find"),g2=J(0,"Previous Match"),p2=J(0,"Next Match"),m2=J(0,"Find in Selection"),v2=J(0,"Close"),w2=J(0,"Replace"),b2=J(0,"Replace"),y2=J(0,"Replace"),k2=J(0,"Replace All"),C2=J(0,"Toggle Replace"),S2=J(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",N1),x2=J(0,"{0} of {1}"),D2=J(0,"No results"),E2=419;let A2=69;const M2="ctrlEnterReplaceAll.windows.donotask",L2=ft?256:2048;class O2{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function F2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function T2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class R2 extends Ty{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(M2,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new ku(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(90)&&(this._codeEditor.getOption(90)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),t.hasChanged(143)&&this._tryUpdateWidgetWidth(),t.hasChanged(2)&&this.updateAccessibilitySupport(),t.hasChanged(41)){const t=this._codeEditor.getOption(41).loop;this._state.change({loop:t},!1);const i=this._codeEditor.getOption(41).addExtraSpaceOnTop;i&&!this._viewZone&&(this._viewZone=new O2(0),this._showViewZone()),!i&&this._viewZone&&this._removeViewZone()}}))),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection((()=>{this._isVisible&&this._updateToggleSelectionFindButton()}))),this._register(this._codeEditor.onDidFocusEditorWidget((()=>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())}))}(this,void 0,void 0,(function*(){if(this._isVisible){const t=yield this._controller.getGlobalBufferTerm();t&&t!==this._state.searchString&&(this._state.change({searchString:t},!1),this._findInput.select())}}))))),this._findInputFocused=y1.bindTo(r),this._findFocusTracker=this._register(Ll(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=k1.bindTo(r),this._replaceFocusTracker=this._register(Ll(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus((()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()}))),this._register(this._replaceFocusTracker.onDidBlur((()=>{this._replaceInputFocused.set(!1)}))),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(41).addExtraSpaceOnTop&&(this._viewZone=new O2(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 R2.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(t){if(t.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}t.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),t.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),t.isReplaceRevealed&&(this._state.isReplaceRevealed?this._codeEditor.getOption(90)||this._isReplaceVisible||(this._isReplaceVisible=!0,this._replaceInput.width=ll(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=A2+"px",this._matchesCount.title=this._state.matchesCount>=N1?S2:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=N1&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Fn(x2,e,i)}else t=D2;this._matchesCount.appendChild(document.createTextNode(t)),sm(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),A2=Math.max(A2,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===D2)return""===e?J(0,"{0} found",t):J(0,"{0} found for '{1}'",t,e);if(i){const s=J(0,"{0} found for '{1}', at {2}",t,e,i.startLineNumber+":"+i.startColumn),n=this._codeEditor.getModel();return n&&i.startLineNumber<=n.getLineCount()&&i.startLineNumber>=1?`${n.getLineContent(i.startLineNumber)}, ${s}`:s}return J(0,"{0} found for '{1}'",t,e)}_updateToggleSelectionFindButton(){const t=this._codeEditor.getSelection();this._isVisible&&(this._toggleSelectionFind.checked||t&&(t.startLineNumber!==t.endLineNumber||t.startColumn!==t.endColumn))?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const t=this._state.searchString.length>0,i=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&t&&i&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&t),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const e=!this._codeEditor.getOption(90);this._toggleReplaceBtn.setEnabled(this._isVisible&&e)}_reveal(){if(this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const t=this._codeEditor.getSelection();switch(this._codeEditor.getOption(41).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":this._toggleSelectionFind.checked=!!t&&t.startLineNumber!==t.endLineNumber}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout((()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")}),0)),this._revealTimeouts.push(setTimeout((()=>{this._findInput.validate()}),200)),this._codeEditor.layoutOverlayWidget(this);let i=!0;if(this._codeEditor.getOption(41).seedSearchStringFromSelection&&t){const e=this._codeEditor.getDomNode();if(e){const s=cl(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=hl(this._domNode).left;r>e&&(i=!1);const n=this._codeEditor.getScrolledVisiblePosition(t.getEndPosition());s.left+(n?n.left:0)>e&&(i=!1)}}}this._showViewZone(i)}}_hide(t){this._revealTimeouts.forEach((t=>{clearTimeout(t)})),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),t&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(t){if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return void this._removeViewZone();if(!this._isVisible)return;const i=this._viewZone;void 0===this._viewZoneId&&i&&this._codeEditor.changeViewZones((e=>{i.heightInPx=this._getHeight(),this._viewZoneId=e.addZone(i),this._codeEditor.setScrollTop(t||this._codeEditor.getScrollTop()+i.heightInPx)}))}_showViewZone(t=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(41).addExtraSpaceOnTop)return;void 0===this._viewZone&&(this._viewZone=new O2(0));const i=this._viewZone;this._codeEditor.changeViewZones((e=>{if(void 0!==this._viewZoneId){const s=this._getHeight();if(s===i.heightInPx)return;const n=s-i.heightInPx;return i.heightInPx=s,e.layoutZone(this._viewZoneId),void(t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+n))}{let s=this._getHeight();if(s-=this._codeEditor.getOption(83).top,s<=0)return;i.heightInPx=s,this._viewZoneId=e.addZone(i),t&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}}))}_removeViewZone(){this._codeEditor.changeViewZones((t=>{void 0!==this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))}))}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!Zc(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&&ll(this._domNode)>E2)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=ll(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-A2>=i&&(r=!0),447+e-A2>=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=ll(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||ps.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|L2)?(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)?F2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?T2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|L2)?(this._keybindingService.dispatchEvent(t,t.target)||(dt&&pt&&!this._ctrlEnterReplaceAllWarningPrompted&&(this._notificationService.info(J(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(M2,!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)?F2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?T2(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 i2(null,this._contextViewProvider,{width:221,label:d2,placeholder:f2,appendCaseSensitiveLabel:this._keybindingLabelFor(O1),appendWholeWordsLabel:this._keybindingLabelFor(F1),appendRegexLabel:this._keybindingLabelFor(T1),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:()=>s2(this._keybindingService),inputBoxStyles:HP,toggleStyles:VP},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()}))),gt&&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 _2({label:g2+this._keybindingLabelFor(M1),icon:l2,onTrigger:()=>{$(this._codeEditor.getAction(M1)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new _2({label:p2+this._keybindingLabelFor(A1),icon:u2,onTrigger:()=>{$(this._codeEditor.getAction(A1)).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 aB({icon:n2,title:m2+this._keybindingLabelFor(R1),isChecked:!1,inputActiveOptionBackground:Am(zm),inputActiveOptionBorder:Am(Hm),inputActiveOptionForeground:Am(Um)})),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 _2({label:v2+this._keybindingLabelFor(L1),icon:XW,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:t=>{t.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),t.preventDefault())}})),this._replaceInput=this._register(new e2(null,void 0,{label:w2,placeholder:b2,appendPreserveCaseLabel:this._keybindingLabelFor(_1),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>s2(this._keybindingService),inputBoxStyles:HP,toggleStyles:VP},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 _2({label:y2+this._keybindingLabelFor(I1),icon:h2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new _2({label:k2+this._keybindingLabelFor(P1),icon:c2,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 _2({label:C2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=ll(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}})),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=a2,this._domNode.role="dialog",this._domNode.style.width="419px",this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(t),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(e),this._resizeSash=new tB(this._domNode,this,{orientation:0,size:2}),this._resized=!1;let n=E2;this._register(this._resizeSash.onDidStart((()=>{n=ll(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<E2||i>(parseFloat(sl(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=ll(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=ll(this._domNode);if(t<E2)return;let i=E2;if(!this._resized||t===E2){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=ll(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}R2.ID="editor.contrib.findWidget";class _2 extends Ty{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+eo.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(...eo.asClassNameArray(r2)),this._domNode.classList.add(...eo.asClassNameArray(o2))):(this._domNode.classList.remove(...eo.asClassNameArray(o2)),this._domNode.classList.add(...eo.asClassNameArray(r2)))}}kk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(qv)),e(".currentFindMatch",t.getColor(Kv)),e(".findScope",t.getColor(Gv)),e(".find-widget",t.getColor(Lv));const s=t.getColor(Bm);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor($m);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(Jv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${oy(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Zv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(Qv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${oy(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(Im);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Ov);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const u=t.getColor(Tm);u&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${u}; }`);const a=t.getColor(Tv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(Fv);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(tb);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(_m);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var I2,P2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},B2=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 $2(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 j2=I2=class extends Hi{get editor(){return this._editor}static get(t){return t.getContribution(I2.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=b1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new ku(500),this._state=this._register(new W1),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((t=>this._onStateChanged(t)))),this._model=null,this._register(this._editor.onDidChangeModel((()=>{const t=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),t&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(41).loop})})))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(t){this.saveQueryState(t),t.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),t.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(t){t.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),t.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),t.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),t.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!y1.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=Rn(t)),this._state.change({searchString:t},!1)}highlightFindOptions(t=!1){}_start(t,i){return B2(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=$2(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?Rn(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=$2(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 B1(this._editor,this._state))}))}start(t,i){return this._start(t,i)}moveToNextMatch(){return!!this._model&&(this._model.moveToNextMatch(),!0)}moveToPrevMatch(){return!!this._model&&(this._model.moveToPrevMatch(),!0)}goToMatch(t){return!!this._model&&(this._model.moveToMatch(t),!0)}replace(){return!!this._model&&(this._model.replace(),!0)}replaceAll(){var t;return!!this._model&&((null===(t=this._editor.getModel())||void 0===t?void 0:t.isTooLargeForHeapOperation())?(this._notificationService.warn(J(0,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0))}selectAllMatches(){return!!this._model&&(this._model.selectAllMatches(),this._editor.focus(),!0)}getGlobalBufferTerm(){return B2(this,void 0,void 0,(function*(){return this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}))}setGlobalBufferTerm(t){this._editor.getOption(41).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(t)}};j2.ID="editor.contrib.findController",j2=I2=P2([N2(1,Jo),N2(2,PP),N2(3,EV),N2(4,vO)],j2);let W2=class extends j2{constructor(t,i,e,s,n,r,o,h){super(t,e,o,h,r),this._contextViewService=i,this._keybindingService=s,this._themeService=n,this._widget=null,this._findOptionsWidget=null}_start(t,i){const e=Object.create(null,{_start:{get:()=>super._start}});return B2(this,void 0,void 0,(function*(){this._widget||this._createFindWidget();const s=this._editor.getSelection();let n=!1;switch(this._editor.getOption(41).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 R2(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new $1(this._editor,this._state,this._keybindingService))}};W2=P2([N2(1,ER),N2(2,Jo),N2(3,CC),N2(4,mk),N2(5,vO),N2(6,PP),N2(7,EV)],W2),ou(new iu({id:"actions.find",label:J(0,"Find"),alias:"Find",precondition:Lo.or(gS.focus,Lo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"3_find",title:J(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=j2.get(i);return!!e&&e.start({forceRevealReplace:!1,seedSearchStringFromSelection:"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:i.getOption(41).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})}));const V2={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:J(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:J(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:J(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:J(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 H2 extends tu{run(t,i){return B2(this,void 0,void 0,(function*(){const t=j2.get(i);t&&!this._run(t)&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:0===t.getState().searchString.length&&"never"!==i.getOption(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),this._run(t))}))}}class z2 extends tu{run(t,i){return B2(this,void 0,void 0,(function*(){const t=j2.get(i);if(!t)return;const e=$2(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(41).loop}),this._run(t))}))}}ou(new iu({id:"editor.action.startFindReplaceAction",label:J(0,"Replace"),alias:"Replace",precondition:Lo.or(gS.focus,Lo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:bh.MenubarEditMenu,group:"3_find",title:J(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=j2.get(i);if(!e)return!1;const s=i.getSelection(),n=e.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&"never"!==i.getOption(41).seedSearchStringFromSelection&&!n,o=n||r?2:1;return e.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:"never"!==i.getOption(41).seedSearchStringFromSelection,shouldFocus:o,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop})})),hu(j2.ID,W2,0),ru(class extends tu{constructor(){super({id:"editor.actions.findWithArgs",label:J(0,"Find With Arguments"),alias:"Find With Arguments",precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},description:V2})}run(t,i,e){return B2(this,void 0,void 0,(function*(){const t=j2.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(41).seedSearchStringFromSelection?"single":"none",seedSearchStringFromNonEmptySelection:"selection"===i.getOption(41).seedSearchStringFromSelection,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:(null==e?void 0:e.findInSelection)||!1,loop:i.getOption(41).loop},s),t.setGlobalBufferTerm(t.getState().searchString)}}))}}),ru(class extends tu{constructor(){super({id:"actions.findWithSelection",label:J(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 B2(this,void 0,void 0,(function*(){const t=j2.get(i);t&&(yield t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:i.getOption(41).loop}),t.setGlobalBufferTerm(t.getState().searchString))}))}}),ru(class extends H2{constructor(){super({id:A1,label:J(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:gS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Lo.and(gS.focus,y1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),ru(class extends H2{constructor(){super({id:M1,label:J(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:gS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Lo.and(gS.focus,y1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),ru(class extends tu{constructor(){super({id:"editor.action.goToMatchFindAction",label:J(0,"Go to Match..."),alias:"Go to Match...",precondition:b1}),this._highlightDecorations=[]}run(t,i,e){const s=j2.get(i);if(!s)return;const n=s.getState().matchesCount;if(n<1)return void t.get(vO).notify({severity:mO.Warning,message:J(0,"No matches. Try searching for something else.")});const r=t.get(Ij).createInputBox();r.placeholder=J(0,"Type a number to go to a specific match (between 1 and {0})",n);const o=t=>{const i=parseInt(t);if(isNaN(i))return;const e=s.getState().matchesCount;return i>0&&i<=e?i-1:i<0&&i>=-e?e+i:void 0},h=t=>{const e=o(t);if("number"==typeof e){r.validationMessage=void 0,s.goToMatch(e);const t=s.getState().currentMatch;t&&this.addDecorations(i,t)}else r.validationMessage=J(0,"Please type a number between 1 and {0}",s.getState().matchesCount),this.clearDecorations(i)};r.onDidChangeValue((t=>{h(t)})),r.onDidAccept((()=>{const t=o(r.value);"number"==typeof t?(s.goToMatch(t),r.hide()):r.validationMessage=J(0,"Please type a number between 1 and {0}",s.getState().matchesCount)})),r.onDidHide((()=>{this.clearDecorations(i),r.dispose()})),r.show()}clearDecorations(t){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])}))}addDecorations(t,i){t.changeDecorations((t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[{range:i,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:i,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:vk(Zk),position:Xd.Full}}}])}))}}),ru(class extends z2{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:J(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),ru(class extends z2{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:J(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const U2=Xl.bindToContribution(j2.get);nu(new U2({id:L1,precondition:b1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:9,secondary:[1033]}})),nu(new U2({id:O1,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:gS.focus,primary:C1.primary,mac:C1.mac,win:C1.win,linux:C1.linux}})),nu(new U2({id:F1,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:gS.focus,primary:S1.primary,mac:S1.mac,win:S1.win,linux:S1.linux}})),nu(new U2({id:T1,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:gS.focus,primary:x1.primary,mac:x1.mac,win:x1.win,linux:x1.linux}})),nu(new U2({id:R1,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:gS.focus,primary:D1.primary,mac:D1.mac,win:D1.win,linux:D1.linux}})),nu(new U2({id:_1,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:gS.focus,primary:E1.primary,mac:E1.mac,win:E1.win,linux:E1.linux}})),nu(new U2({id:I1,precondition:b1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:gS.focus,primary:3094}})),nu(new U2({id:I1,precondition:b1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,k1),primary:3}})),nu(new U2({id:P1,precondition:b1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:gS.focus,primary:2563}})),nu(new U2({id:P1,precondition:b1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Lo.and(gS.focus,k1),primary:void 0,mac:{primary:2051}}})),nu(new U2({id:"editor.action.selectAllMatches",precondition:b1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:gS.focus,primary:515}}));const K2={0:" ",1:"u",2:"r"},q2=16777215,G2=4278190080;class Z2{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 J2{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 Z2(t.length),this._userDefinedStates=new Z2(t.length),this._recoveredStates=new Z2(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>q2||n>q2)throw new Error("startLineNumber or endLineNumber must not exceed "+q2);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]&q2}getEndLineNumber(t){return this._endIndexes[t]&q2}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 Q2(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&G2)>>>24)+((this._endIndexes[t]&G2)>>>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]=`[${K2[this.getSource(i)]}${this.isCollapsed(i)?"+":"-"}] ${this.getStartLineNumber(i)}/${this.getEndLineNumber(i)}`;return t.join(", ")}toFoldRange(t){return{startLineNumber:this._startIndexes[t]&q2,endLineNumber:this._endIndexes[t]&q2,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 J2(e,s,n);for(let e=0;e<i;e++)t[e].isCollapsed&&o.setCollapsed(e,!0),o.setSource(e,t[e].source);return o}static sanitizeAndMerge(t,i,e){e=null!=e?e:Number.MAX_VALUE;const s=(t,i)=>Array.isArray(t)?e=>e<i?t[e]:void 0:e=>e<i?t.toFoldRange(e):void 0,n=s(t,t.length),r=s(i,i.length);let o=0,h=0,c=n(0),l=r(0);const u=[];let a,d=0;const f=[];for(;c||l;){let t;if(l&&(!c||c.startLineNumber>=l.startLineNumber))c&&c.startLineNumber===l.startLineNumber?(1===l.source?t=l:(t=c,t.isCollapsed=l.isCollapsed&&c.endLineNumber===l.endLineNumber,t.source=0),c=n(++o)):(t=l,l.isCollapsed&&0===l.source&&(t.source=2)),l=r(++h);else{let i=h,e=l;for(;;){if(!e||e.startLineNumber>c.endLineNumber){t=c;break}if(1===e.source&&e.endLineNumber>c.endLineNumber)break;e=r(++i)}c=n(++o)}if(t){for(;a&&a.endLineNumber<t.startLineNumber;)a=u.pop();t.endLineNumber>t.startLineNumber&&t.startLineNumber>d&&t.endLineNumber<=e&&(!a||a.endLineNumber>=t.endLineNumber)&&(f.push(t),d=t.startLineNumber,a&&u.push(a),a=t)}}return f}}class Q2{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 Y2{get regions(){return this._regions}get textModel(){return this._textModel}constructor(t,i){this._updateEventEmitter=new ie,this.onDidChange=this._updateEventEmitter.event,this._textModel=t,this._decorationProvider=i,this._regions=new J2(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(J2.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=J2.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(J2.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=J2.sanitizeAndMerge(this._regions,s,n);this.updatePost(J2.fromFoldRanges(r))}_getLinesChecksum(t,i){return Sd(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 X2(t,i,e){const s=[];for(const n of e){const e=t.getRegionAtLine(n);if(e){const n=!e.isCollapsed;if(s.push(e),i>1){const r=t.getRegionsInside(e,((t,e)=>t.isCollapsed!==n&&e<i));s.push(...r)}}}t.toggleCollapseState(s)}function t4(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 i4(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 e4(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 s4(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 n4(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 r4{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(t){this._updateEventEmitter=new ie,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!==hD(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 ps(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!==o4(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=o4(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 o4(t,i){const e=Mf(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class h4{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=l4){const n=t.getOptions().tabSize,r=new c4(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=GS(s,n);let l,u=h[h.length-1];if(-1!==c){if(o&&(l=s.match(o))){if(!l[1]){h.push({indent:-2,endAbove:e,line:e});continue}{let t=h.length-1;for(;t>0&&-2!==h[t].indent;)t--;if(t>0){h.length=t+1,u=h[t],r.insertFirst(e,u.line,c),u.line=e,u.indent=c,u.endAbove=e;continue}}}if(u.indent>c){do{h.pop(),u=h[h.length-1]}while(u.indent>c);const t=u.endAbove-1;t-e>=1&&r.insertFirst(e,t,c)}u.indent===c?u.endAbove=e:h.push({indent:c,endAbove:e,line:e})}else i&&(u.endAbove=e)}return r.toIndentRanges(t)}(this.editorModel,i&&!!i.offSide,i&&i.markers,this.foldingRangesLimit))}}class c4{constructor(t){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=t}insertFirst(t,i,e){if(t>q2||i>q2)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 J2(t,i)}{this._foldingRangesLimit.update(this._length,i);let e=0,s=this._indentOccurrences.length;for(let t=0;t<this._indentOccurrences.length;t++){const n=this._indentOccurrences[t];if(n){if(n+e>i){s=t;break}e+=n}}const n=t.getOptions().tabSize,r=new Uint32Array(i),o=new Uint32Array(i);for(let h=this._length-1,c=0;h>=0;h--){const l=this._startIndexes[h],u=GS(t.getLineContent(l),n);(u<s||u===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new J2(r,o)}}}const l4={limit:5e3,update:()=>{}},u4=Om("editor.foldBackground",{light:Mb(Vv,.3),dark:Mb(Vv,.3),hcDark:null,hcLight:null},J(0,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);Om("editorGutter.foldingControlForeground",{dark:Rm,light:Rm,hcDark:Rm,hcLight:Rm},J(0,"Color of the folding control in the editor gutter."));const a4=GW("folding-expanded",ys.chevronDown,J(0,"Icon for expanded ranges in the editor glyph margin.")),d4=GW("folding-collapsed",ys.chevronRight,J(0,"Icon for collapsed ranges in the editor glyph margin.")),f4=GW("folding-manual-collapsed",d4,J(0,"Icon for manually collapsed ranges in the editor glyph margin.")),g4=GW("folding-manual-expanded",a4,J(0,"Icon for manually expanded ranges in the editor glyph margin.")),p4={color:vk(u4),position:ef.Inline};class m4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?m4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?m4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:m4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:m4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?m4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:m4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?m4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:m4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?m4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:m4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?m4.MANUALLY_EXPANDED_VISUAL_DECORATION:m4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}m4.COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(d4)}),m4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(d4)}),m4.MANUALLY_COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(f4)}),m4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(f4)}),m4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),m4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:p4,isWholeLine:!0}),m4.EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+eo.asClassName(a4)}),m4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(a4)}),m4.MANUALLY_EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+eo.asClassName(g4)}),m4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:eo.asClassName(g4)}),m4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),m4.HIDDEN_RANGE_DECORATION=$M.register({description:"folding-hidden-range-decoration",stickiness:1});const v4={};class w4{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,v4,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 b4(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 b4{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>q2||i>q2)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 J2(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 J2(s,n,r)}}}var y4,k4=function(t,i){return function(e,s){i(e,s,t)}};const C4=new Zo("foldingEnabled",!1);let S4=y4=class extends Hi{static get(t){return t.getContribution(y4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=y4._foldingRangeSelector)||void 0===e?void 0:e.call(y4,n,i))&&void 0!==s?s:n}constructor(t,i,e,s,n,r){super(),this.contextKeyService=i,this.languageConfigurationService=e,this.languageFeaturesService=r,this.localToDispose=this._register(new Vi),this.editor=t,this._foldingLimitReporter=new x4(t);const o=this.editor.getOptions();this._isEnabled=o.get(43),this._useFoldingProviders="indentation"!==o.get(44),this._unfoldOnClickAfterEndOfLine=o.get(48),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(46),this.updateDebounceInfo=n.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new m4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=C4.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel((()=>this.onModelChanged()))),this._register(this.editor.onDidChangeConfiguration((t=>{if(t.hasChanged(43)&&(this._isEnabled=this.editor.getOptions().get(43),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),t.hasChanged(47)&&this.onModelChanged(),t.hasChanged(109)||t.hasChanged(45)){const t=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=t.get(109),this.foldingDecorationProvider.showFoldingHighlights=t.get(45),this.triggerFoldingModelChanged()}t.hasChanged(44)&&(this._useFoldingProviders="indentation"!==this.editor.getOptions().get(44),this.onFoldingStrategyChanged()),t.hasChanged(48)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(48)),t.hasChanged(46)&&(this._foldingImportsByDefault=this.editor.getOptions().get(46))}))),this.onModelChanged()}saveViewState(){const t=this.editor.getModel();if(!t||!this._isEnabled||t.isTooLargeForTokenization())return{};if(this.foldingModel){const i=this.foldingModel.getMemento(),e=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:i,lineCount:t.getLineCount(),provider:e,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(t){const i=this.editor.getModel();if(i&&this._isEnabled&&!i.isTooLargeForTokenization()&&this.hiddenRangeModel&&t&&(this._currentModelHasFoldedImports=!!t.foldedImports,t.collapsedRegions&&t.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(t.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const t=this.editor.getModel();this._isEnabled&&t&&!t.isTooLargeForTokenization()&&(this._currentModelHasFoldedImports=!1,this.foldingModel=new Y2(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new r4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new ku(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new Mu((()=>this.revealCursor()),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration((()=>this.onFoldingStrategyChanged()))),this.localToDispose.add(this.editor.onDidChangeModelContent((t=>this.onDidChangeModelContent(t)))),this.localToDispose.add(this.editor.onDidChangeCursorPosition((()=>this.onCursorPositionChanged()))),this.localToDispose.add(this.editor.onMouseDown((t=>this.onEditorMouseDown(t)))),this.localToDispose.add(this.editor.onMouseUp((t=>this.onEditorMouseUp(t)))),this.localToDispose.add({dispose:()=>{var t,i;this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),null===(t=this.updateScheduler)||void 0===t||t.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,null===(i=this.rangeProvider)||void 0===i||i.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){var t;null===(t=this.rangeProvider)||void 0===t||t.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(t){if(this.rangeProvider)return this.rangeProvider;const i=new h4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=y4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new w4(t,e,(()=>this.triggerFoldingModelChanged()),this._foldingLimitReporter,i))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(t){var i;null===(i=this.hiddenRangeModel)||void 0===i||i.notifyChangeModelContent(t),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger((()=>{const t=this.foldingModel;if(!t)return null;const i=new Zi,e=this.getRangeProvider(t.textModel),s=this.foldingRegionPromise=wu((t=>e.compute(t)));return s.then((e=>{if(e&&s===this.foldingRegionPromise){let s;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const t=e.setCollapsedAllOfType(Is.Imports.value,!0);t&&(s=tU.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<4)return;e=!0;break;case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!t.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){const t=this.editor.getModel();if(t&&i.startColumn===t.getLineMaxColumn(i.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:i.startLineNumber,iconClicked:e}}onEditorMouseUp(t){const i=this.foldingModel;if(!i||!this.mouseDownInfo||!t.target)return;const e=this.mouseDownInfo.lineNumber,s=this.mouseDownInfo.iconClicked,n=t.target.range;if(!n||n.startLineNumber!==e)return;if(s){if(4!==t.target.type)return}else{const t=this.editor.getModel();if(!t||n.startColumn!==t.getLineMaxColumn(e))return}const r=i.getRegionAtLine(e);if(r&&r.startLineNumber===e){const n=r.isCollapsed;if(s||n){let s=[];if(t.event.altKey){const t=i.getRegionsInside(null,(t=>!t.containedBy(r)&&!r.containedBy(t)));for(const i of t)i.isCollapsed&&s.push(i);0===s.length&&(s=t)}else{const e=t.event.middleButton||t.event.shiftKey;if(e)for(const t of i.getRegionsInside(r))t.isCollapsed===n&&s.push(t);!n&&e&&0!==s.length||s.push(r)}i.toggleCollapseState(s),this.reveal({lineNumber:e,column:1})}}}reveal(t){this.editor.revealPositionInCenterIfOutsideViewport(t,0)}};S4.ID="editor.contrib.folding",S4=y4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([k4(1,Jo),k4(2,ud),k4(3,vO),k4(4,FF),k4(5,Wg)],S4);class x4{constructor(t){this.editor=t,this._onDidChange=new ie,this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(47)}update(t,i){t===this._computed&&i===this._limited||(this._computed=t,this._limited=i,this._onDidChange.fire())}}class D4 extends tu{runEditorCommand(t,i,e){const s=t.get(ud),n=S4.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 E4(t){if(!I(t)){if(!O(t))return!1;const i=t;if(!I(i.levels)&&!T(i.levels))return!1;if(!I(i.direction)&&!L(i.direction))return!1;if(!(I(i.selectionLines)||Array.isArray(i.selectionLines)&&i.selectionLines.every(T)))return!1}return!0}class A4 extends D4{getFoldingLevel(){return parseInt(this.id.substr(A4.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))}}A4.ID_PREFIX="editor.foldLevel",A4.ID=t=>A4.ID_PREFIX+t,hu(S4.ID,S4,0),ru(class extends D4{constructor(){super({id:"editor.unfold",label:J(0,"Unfold"),alias:"Unfold",precondition:C4,kbOpts:{kbExpr:gS.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:E4,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?i4(i,!1,n,r):t4(i,!1,n,r)}}),ru(class extends D4{constructor(){super({id:"editor.unfoldRecursively",label:J(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2142),weight:100}})}invoke(t,i,e,s){t4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.fold",label:J(0,"Fold"),alias:"Fold",precondition:C4,kbOpts:{kbExpr:gS.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:E4,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?i4(i,!0,r||1,n):t4(i,!0,r||1,n)}}),ru(class extends D4{constructor(){super({id:"editor.foldRecursively",label:J(0,"Fold Recursively"),alias:"Fold Recursively",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);t4(i,!0,Number.MAX_VALUE,s)}}),ru(class extends D4{constructor(){super({id:"editor.foldAll",label:J(0,"Fold All"),alias:"Fold All",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2069),weight:100}})}invoke(t,i,e){t4(i,!0)}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAll",label:J(0,"Unfold All"),alias:"Unfold All",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2088),weight:100}})}invoke(t,i,e){t4(i,!1)}}),ru(class extends D4{constructor(){super({id:"editor.foldAllBlockComments",label:J(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&s4(i,new RegExp("^\\s*"+Rn(s.blockCommentStartToken)),!0)}}}),ru(class extends D4{constructor(){super({id:"editor.foldAllMarkerRegions",label:J(0,"Fold All Regions"),alias:"Fold All Regions",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Region.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&s4(i,new RegExp(s.markers.start),!0)}}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:J(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())n4(i,Is.Region.value,!1);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).foldingRules;s&&s.markers&&s.markers.start&&s4(i,new RegExp(s.markers.start),!1)}}}),ru(class extends D4{constructor(){super({id:"editor.foldAllExcept",label:J(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2136),weight:100}})}invoke(t,i,e){e4(i,!0,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.unfoldAllExcept",label:J(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2134),weight:100}})}invoke(t,i,e){e4(i,!1,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.toggleFold",label:J(0,"Toggle Fold"),alias:"Toggle Fold",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2090),weight:100}})}invoke(t,i,e){X2(i,1,this.getSelectedLines(e))}}),ru(class extends D4{constructor(){super({id:"editor.gotoParentFold",label:J(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.gotoPreviousFold",label:J(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.gotoNextFold",label:J(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:C4,kbOpts:{kbExpr:gS.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})}}}),ru(class extends D4{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:J(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(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=J2.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(J2.fromFoldRanges(t))}}}}),ru(class extends D4{constructor(){super({id:"editor.removeManualFoldingRanges",label:J(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(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++)M4=new A4({id:A4.ID(t),label:J(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:C4,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2048|21+t),weight:100}}),lu.INSTANCE.registerEditorAction(M4);var M4;ao.registerCommand("_executeFoldingRangeProvider",(function(t,...i){return 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())}))}(this,void 0,void 0,(function*(){const[e]=i;if(!(e instanceof ss))throw Ti();const s=t.get(Wg),n=t.get(Xr).getModel(e);if(!n)throw Ti();const r=t.get(Ta);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(ud),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new h4(n,o,c);let u=l;if("indentation"!==h){const t=S4.getFoldingRangeProviders(s,n);t.length&&(u=new w4(n,t,(()=>{}),c,l))}const a=yield u.compute(ue.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?Is.fromValue(i):void 0})}return d}finally{u.dispose()}}))})),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomIn",label:J(0,"Editor Font Zoom In"),alias:"Editor Font Zoom In",precondition:void 0})}run(t,i){Vr.setZoomLevel(Vr.getZoomLevel()+1)}}),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomOut",label:J(0,"Editor Font Zoom Out"),alias:"Editor Font Zoom Out",precondition:void 0})}run(t,i){Vr.setZoomLevel(Vr.getZoomLevel()-1)}}),ru(class extends tu{constructor(){super({id:"editor.action.fontZoomReset",label:J(0,"Editor Font Zoom Reset"),alias:"Editor Font Zoom Reset",precondition:void 0})}run(t,i){Vr.setZoomLevel(0)}});var L4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},O4=function(t,i){return function(e,s){i(e,s,t)}},F4=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 T4=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(56)&&this._update()}))),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(56))return;if(!this._editor.hasModel())return;const t=this._editor.getModel(),[i]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(t);if(!i||!i.autoFormatTriggerCharacters)return;const e=new zd;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 de,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()}));CK(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||a(t)&&(aK.execute(this._editor,t,!0),pK(t))})).finally((()=>{n.dispose()}))}};T4.ID="editor.contrib.autoFormat",T4=L4([O4(1,Wg),O4(2,MN)],T4);let R4=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(55)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste((({range:t})=>this._trigger(t))))}_trigger(t){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(wK,this.editor,t,2,sR.None,ue.None).catch(Ei))}};R4.ID="editor.contrib.formatOnPaste",R4=L4([O4(1,Wg),O4(2,Zr)],R4),hu(T4.ID,T4,2),hu(R4.ID,R4,2),ru(class extends tu{constructor(){super({id:"editor.action.formatDocument",label:J(0,"Format Document"),alias:"Format Document",precondition:Lo.and(gS.notInCompositeEditor,gS.writable,gS.hasDocumentFormattingProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return F4(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(Zr),s=t.get(nR);yield s.showWhile(e.invokeFunction(yK,i,1,sR.None,ue.None),250)}}))}}),ru(class extends tu{constructor(){super({id:"editor.action.formatSelection",label:J(0,"Format Selection"),alias:"Format Selection",precondition:Lo.and(gS.writable,gS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2084),weight:100},contextMenuOpts:{when:gS.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return F4(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Zr),s=i.getModel(),n=i.getSelections().map((t=>t.isEmpty()?new ps(t.startLineNumber,1,t.startLineNumber,s.getLineMaxColumn(t.startLineNumber)):t)),r=t.get(nR);yield r.showWhile(e.invokeFunction(wK,i,n,1,sR.None,ue.None),250)}))}}),ao.registerCommand("editor.action.format",(t=>F4(void 0,void 0,void 0,(function*(){const i=t.get(Yr).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(uo);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var _4=function(t,i){return function(e,s){i(e,s,t)}};class I4{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 P4 extends I4{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class N4 extends I4{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class B4 extends I4{static create(t,i,s){const n=new de(s),r=new B4(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=I4.findId(`provider_${e}`,r),h=new N4(o,r,null!==(s=t.displayName)&&void 0!==s?s:"Unknown Outline Provider",e);return Promise.resolve(t.provideDocumentSymbols(i,n.token)).then((t=>{for(const i of t||[])B4._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{I4.empty(t)?t.remove():r._groups.set(o,t)}))})),c=t.onDidChange((()=>{e(t.ordered(i),o)||n.cancel()}));return Promise.all(h).then((()=>n.token.isCancellationRequested&&!s.isCancellationRequested?B4.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=I4.findId(t,i),s=new P4(e,i,t);if(t.children)for(const i of t.children)B4._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=Rt.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 P4?t.push(i.symbol):t.push(...Rt.map(i.children.values(),(t=>t.symbol)));return t.sort(((t,i)=>ps.compareRangesUsingStarts(t.range,i.range)))}asListOfDocumentSymbols(){const t=this.getTopLevelSymbols(),i=[];return B4._flattenDocumentSymbols(i,t,""),i.sort(((t,i)=>gs.compare(ps.getStartPosition(t.range),ps.getStartPosition(i.range))||gs.compare(ps.getEndPosition(i.range),ps.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&&B4._flattenDocumentSymbols(t,s.children,s.name)}}const $4=Qr("IOutlineModelService");let j4=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new lg(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 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())}))}(this,void 0,void 0,(function*(){const s=this._languageFeaturesService.documentSymbolProvider,n=s.ordered(t);let r=this._cache.get(t.id);if(!r||r.versionId!==t.getVersionId()||!e(r.provider,n)){const i=new de;r={versionId:t.getVersionId(),provider:n,promiseCnt:0,source:i,promise:B4.create(s,t,i.token),model:void 0},this._cache.set(t.id,r);const e=Date.now();r.promise.then((i=>{r.model=i,this._debounceInformation.update(t,Date.now()-e)})).catch((()=>{this._cache.delete(t.id)}))}if(r.model)return r.model;r.promiseCnt+=1;const o=i.onCancellationRequested((()=>{0==--r.promiseCnt&&(r.source.cancel(),this._cache.delete(t.id))}));try{return yield r.promise}finally{o.dispose()}}))}};j4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([_4(0,Wg),_4(1,FF),_4(2,Xr)],j4),Wa($4,j4,1);ao.registerCommand("_executeDocumentSymbolProvider",(function(t,...i){return 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())}))}(this,void 0,void 0,(function*(){const[e]=i;B(ss.isUri(e));const s=t.get($4),n=t.get(to),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,ue.None)).getTopLevelSymbols()}finally{r.dispose()}}))}));class W4 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=W4.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=W4.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=W4.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=W4.suppressSuggestions.bindTo(this.contextKeyService),this._register(jH((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t),s=!!(null==e?void 0:e.inlineCompletion)&&void 0!==(null==e?void 0:e.ghostText)&&!(null==e?void 0:e.ghostText.isEmpty());this.inlineCompletionVisible.set(s),(null==e?void 0:e.ghostText)&&(null==e?void 0:e.inlineCompletion)&&this.suppressSuggestions.set(e.inlineCompletion.inlineCompletion.source.inlineCompletions.suppressSuggestions)}))),this._register(jH((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=$n(o);-1===t&&(t=o.length-1),e=t>0;const n=i.textModel.getOptions().tabSize;s=vy.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}W4.inlineSuggestionVisible=new Zo("inlineSuggestionVisible",!1,J(0,"Whether an inline suggestion is visible")),W4.inlineSuggestionHasIndentation=new Zo("inlineSuggestionHasIndentation",!1,J(0,"Whether the inline suggestion starts with whitespace")),W4.inlineSuggestionHasIndentationLessThanTabSize=new Zo("inlineSuggestionHasIndentationLessThanTabSize",!0,J(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),W4.suppressSuggestions=new Zo("inlineSuggestionSuppressSuggestions",void 0,J(0,"Whether suggestions should be suppressed for the current suggestion"));class V4{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 H4=[];class z4{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 ps(t,this.startColumn,t,this.endColumnExclusive)}equals(t){return this.startColumn===t.startColumn&&this.endColumnExclusive===t.endColumnExclusive}}function U4(t,i){return new gs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function K4(t){let i=1,e=1;for(const s of t)"\n"===s?(i++,e=1):e++;return new gs(i,e)}class q4{constructor(t,i){this.lineNumber=t,this.parts=i}equals(t){return this.lineNumber===t.lineNumber&&this.parts.length===t.parts.length&&this.parts.every(((i,e)=>i.equals(t.parts[e])))}renderForScreenReader(t){if(0===this.parts.length)return"";const i=function(t,i){const e=new V4(t),s=i.map((t=>{const i=ps.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 G4{constructor(t,i,e){this.column=t,this.lines=i,this.preview=e}equals(t){return this.column===t.column&&this.lines.length===t.lines.length&&this.lines.every(((i,e)=>i===t.lines[e]))}}class Z4{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new G4(this.columnRange.endColumnExclusive,this.newLines,!1)]}renderForScreenReader(t){return this.newLines.join("\n")}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every((t=>0===t.lines.length))}equals(t){return this.lineNumber===t.lineNumber&&this.columnRange.equals(t.columnRange)&&this.newLines.length===t.newLines.length&&this.newLines.every(((i,e)=>i===t.newLines[e]))&&this.additionalReservedLineCount===t.additionalReservedLineCount}}function J4(t,i){return t===i||!(!t||!i)&&(t instanceof q4&&i instanceof q4||t instanceof Z4&&i instanceof Z4)&&t.equals(i)}const Q4="ghost-text";let Y4=class extends Hi{constructor(t,i,e){super(),this.editor=t,this.model=i,this.languageService=e,this.isDisposed=OH(this,!1),this.currentTextModel=KH(this.editor.onDidChangeModel,(()=>this.editor.getModel())),this.uiState=IH(this,(t=>{if(this.isDisposed.read(t))return;const i=this.currentTextModel.read(t);if(i!==this.model.targetTextModel.read(t))return;const e=this.model.ghostText.read(t);if(!e)return;const s=e instanceof Z4?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 op(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 op(1,e.length+1,i,0)]:[]})}const h=i.getLineContent(e.lineNumber);let c,l=0;for(const t of e.parts){let i=t.lines;void 0===c?(n.push({column:t.column,text:i[0],preview:t.preview}),i=i.slice(1)):o([h.substring(l,t.column-1)],void 0),i.length>0&&(o(i,Q4),void 0===c&&t.column<=h.length&&(c=t.column)),l=t.column-1}void 0!==c&&o([h.substring(l)],void 0);const u=void 0!==c?new z4(c,h.length+1):void 0;return{replacedRange:s,inlineTexts:n,additionalLines:r,hiddenRange:u,lineNumber:e.lineNumber,additionalReservedLineCount:this.model.minReservedLineCount.read(t),targetTextModel:i}})),this.decorations=IH(this,(t=>{const i=this.uiState.read(t);if(!i)return[];const e=[];i.replacedRange&&e.push({range:i.replacedRange.toRange(i.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace",description:"GhostTextReplacement"}}),i.hiddenRange&&e.push({range:i.hiddenRange.toRange(i.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const t of i.inlineTexts)e.push({range:ps.fromPositions(new gs(i.lineNumber,t.column)),options:{description:Q4,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:sf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new X4(this.editor,this.languageService.languageIdCodec,IH((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($H({debugName:()=>`Apply decorations from ${i.debugName}`},(t=>{const e=i.read(t);s.set(e)}))),e.add({dispose:()=>{s.clear()}}),e}(this.editor,this.decorations))}ownsViewZone(t){return this.additionalLinesWidget.viewZoneId===t}};Y4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Ba)],Y4);class X4 extends Hi{get viewZoneId(){return this._viewZoneId}constructor(t,i,e){super(),this.editor=t,this.languageIdCodec=i,this.lines=e,this._viewZoneId=void 0,this.editorOptionsChanged=GH("editorOptionChanged",Ji.filter(this.editor.onDidChangeConfiguration,(t=>t.hasChanged(33)||t.hasChanged(116)||t.hasChanged(98)||t.hasChanged(93)||t.hasChanged(51)||t.hasChanged(50)||t.hasChanged(66)))),this._register(jH((t=>{const i=this.lines.read(t);this.editorOptionsChanged.read(t),i?this.updateLines(i.lineNumber,i.additionalLines,i.minReservedLineCount):this.clear()})))}dispose(){super.dispose(),this.clear()}clear(){this.editor.changeViewZones((t=>{this._viewZoneId&&(t.removeZone(this._viewZoneId),this._viewZoneId=void 0)}))}updateLines(t,i,e){const s=this.editor.getModel();if(!s)return;const{tabSize:n}=s.getOptions();this.editor.changeViewZones((s=>{this._viewZoneId&&(s.removeZone(this._viewZoneId),this._viewZoneId=void 0);const r=Math.max(i.length,e);if(r>0){const e=document.createElement("div");!function(t,i,e,s,n){const r=s.get(33),o=s.get(116),h=s.get(93),c=s.get(51),l=s.get(50),u=s.get(66),a=new wa(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*u)),a.appendString('px;width:1000000px;">');const f=ur(d),g=cr(d),p=np.createEmpty(d,n);mp(new dp(l.isMonospace&&!r,l.canUseHalfwidthRightwardsArrow,d,!1,f,g,0,p,s.decorations,i,0,l.spaceWidth,l.middotWidth,l.wsmiddotWidth,o,"none",h,c!==oi.OFF,null),a),a.appendString("</div>")}a.appendString("</div>"),$r(t,l);const d=a.build(),f=t5?t5.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 t5=Ku("editorGhostText",{createHTML:t=>t});class i5{constructor(t){this.lines=t,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(t){return this.lines[t-1].getLineContent().length}}class e5{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=e5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(e5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(e5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(e5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(e5.isVariableCharacter(s)||e5.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===e5._table[s]&&!e5.isDigitCharacter(s)&&!e5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}e5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class s5{constructor(){this._children=[]}appendChild(t){return t instanceof n5&&this._children[this._children.length-1]instanceof n5?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 d5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class n5 extends s5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new n5(this.value)}}class r5 extends s5{}class o5 extends r5{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 h5?this._children[0]:void 0}clone(){const t=new o5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class h5 extends s5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof n5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new h5;return this.options.forEach(t.appendChild,t),t}}class c5 extends s5{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 l5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof l5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new c5;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 l5 extends s5{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 l5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class u5 extends r5{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 n5(i)],!0)}clone(){const t=new u5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function a5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class d5 extends s5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof o5&&(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 a5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof o5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof u5&&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 d5;return this._children=this.children.map((t=>t.clone())),t}walk(t){a5(this.children,t)}}class f5{constructor(){this._scanner=new e5,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 d5;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 o5&&(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 o5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof o5&&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 o5(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 n5(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 o5(Number(i)):new u5(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 o5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new n5("${"+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 h5;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 n5(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 u5(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 n5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new c5;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 n5(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 l5(Number(s))),!0;if(this._accept(4))return t.appendChild(new l5(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 l5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new l5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new l5(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 l5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new l5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new n5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}var g5=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 p5(t,i,e,s,n=ue.None,r){return g5(this,void 0,void 0,(function*(){const o=function(t,i){const e=i.getWordAtPosition(t),s=i.getLineMaxColumn(t.lineNumber);return e?new ps(t.lineNumber,e.startColumn,t.lineNumber,s):ps.fromPositions(t,t.with(void 0,s))}(i,e),h=t.all(e),c=new ag;for(const t of h)t.groupId&&c.add(t.groupId,t);function l(t){if(!t.yieldsToGroupIds)return[];const i=[];for(const e of t.yieldsToGroupIds||[]){const t=c.get(e);for(const e of t)i.push(e)}return i}const u=new Map,a=new Set;function d(t,i){if(i=[...i,t],a.has(t))return i;a.add(t);try{const e=l(t);for(const t of e){const e=d(t,i);if(e)return e}}finally{a.delete(t)}}function f(t){const r=u.get(t);if(r)return r;const o=d(t,[]);o&&Ai(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${o.map((t=>t.toString?t.toString():""+t)).join(" -> ")}`));const h=new Fu;return u.set(t,h.p),(()=>g5(this,void 0,void 0,(function*(){if(!o){const i=l(t);for(const t of i){const i=yield f(t);if(i&&i.items.length>0)return}}try{return yield t.provideInlineCompletions(e,i,s,n)}catch(t){return void Ai(t)}})))().then((t=>h.complete(t)),(t=>h.error(t))),h.p}const g=yield Promise.all(h.map((t=>g5(this,void 0,void 0,(function*(){return{provider:t,completions:yield f(t)}}))))),p=new Map,m=[];for(const t of g){const i=t.completions;if(!i)continue;const s=new v5(i,t.provider);m.push(s);for(const t of i.items){const i=w5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new m5(Array.from(p.values()),new Set(p.keys()),m)}))}class m5{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 v5{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 w5{static from(t,i,e,s,n){let r,o,h=t.range?ps.lift(t.range):e;if("string"==typeof t.insertText){if(r=t.insertText,n&&t.completeBracketPairs){r=b5(r,h.getStartPosition(),s,n);const i=r.length-t.insertText.length;0!==i&&(h=new ps(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=b5(t.insertText.snippet,h.getStartPosition(),s,n);const e=t.insertText.snippet.length-i;0!==e&&(h=new ps(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn+e))}const e=(new f5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof n5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else lh();return new w5(r,t.command,h,r,o,t.additionalTextEdits||H4,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 w5(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 b5(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 FD,s=new ZD(e,(t=>i.getLanguageConfiguration(t))),n=eE(new UD(new i5([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=mD(e,i.openingBracket.length),i.child&&(t(i.child,e),e=mD(e,i.child.length)),i.closingBracket)t(i.closingBracket,e),e=mD(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,mD(e,i.length));else if(4===i.kind)for(const s of i.children)t(s,e),e=mD(e,s.length)}(n,0),r}(o,s);return h}class y5{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=Qn(s,this.text),r=U4(this.range.getStartPosition(),K4(s.substring(0,n))),o=this.text.substring(n),h=ps.fromPositions(r,this.range.getEndPosition());return new y5(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=jn(r).length;if(n.range.startColumn-1<=o){const t=jn(n.text).length,i=r.substring(n.range.startColumn-1,o),[e,s]=[n.range.getStartPosition(),n.range.getEndPosition()],h=e.column+i.length<=s.column?e.delta(0,i.length):s,c=ps.fromPositions(h,s),l=n.text.startsWith(i)?n.text.substring(i.length):n.text.substring(t);n=new y5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==k5?void 0:k5.originalValue)===t&&(null==k5?void 0:k5.newValue)===i)return null==k5?void 0:k5.changes;{let e=S5(t,i,!0);if(e){const s=C5(e);if(s>0){const n=S5(t,i,!1);n&&C5(n)<s&&(e=n)}}return k5={originalValue:t,newValue:i,changes:e},e}}(h,n.text);if(!c)return;const l=n.range.startLineNumber,u=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=Bn(h);u.push(new G4(s,t,!1))}if(c.length>0){const t=Bn(c);u.push(new G4(s,t,!0))}}return new q4(l,u)}}let k5;function C5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function S5(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 Pd({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var x5=function(t,i){return function(e,s){i(e,s,t)}};let D5=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=TH("inlineCompletions",void 0),this.suggestWidgetInlineCompletions=TH("suggestWidgetInlineCompletions",void 0),this._register(this.textModel.onDidChangeContent((()=>{this._updateOperation.clear()})))}fetch(t,i,e){var s,n;const r=new E5(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 de,l=(()=>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())}))}(this,void 0,void 0,(function*(){var s;if((h||i.triggerKind===Cs.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,l=yield p5(this.languageFeaturesService.inlineCompletionsProvider,t,this.textModel,i,c.token,this.languageConfigurationService);if(c.token.isCancellationRequested||this.textModel.getVersionId()!==r.versionId)return!1;const u=new Date;this._debounceValue.update(this.textModel,u.getTime()-n.getTime());const a=new M5(l,r,this.textModel,this.versionId);if(e){const i=e.toInlineCompletion(void 0);e.canBeReused(this.textModel,t)&&!l.has(i)&&a.prepend(e.inlineCompletion,i.range,!0)}return this._updateOperation.clear(),DH((t=>{o.set(a,t)})),!0})))(),u=new A5(r,c,l);return this._updateOperation.value=u,l}clear(t){this._updateOperation.clear(),this.inlineCompletions.set(void 0,t),this.suggestWidgetInlineCompletions.set(void 0,t)}clearSuggestWidgetInlineCompletions(t){var i;(null===(i=this._updateOperation.value)||void 0===i?void 0:i.request.context.selectedSuggestionInfo)&&this._updateOperation.clear(),this.suggestWidgetInlineCompletions.set(void 0,t)}cancelUpdate(){this._updateOperation.clear()}};D5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([x5(3,Wg),x5(4,ud)],D5);class E5{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===Cs.Automatic||this.context.triggerKind===Cs.Explicit)&&this.versionId===t.versionId;var i,e}}class A5{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class M5{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=IH(this,(t=>{this.versionId.read(t);let i=!1;for(const t of this._inlineCompletions)i=i||t._updateRange(this.textModel);return i&&this._rangeVersionIdValue++,this._rangeVersionIdValue}));const n=e.deltaDecorations([],t.completions.map((t=>({range:t.range,options:{description:"inline-completion-tracking-range"}}))));this._inlineCompletions=t.completions.map(((t,i)=>new L5(t,n[i],this._rangeVersionId)))}clone(){return this._refCount++,this}dispose(){if(this._refCount--,0===this._refCount){setTimeout((()=>{this.textModel.isDisposed()||this.textModel.deltaDecorations(this._inlineCompletions.map((t=>t.decorationId)),[])}),0),this.inlineCompletionProviderResult.dispose();for(const t of this._prependedInlineCompletionItems)t.source.removeRef()}}prepend(t,i,e){e&&t.source.addRef();const s=this.textModel.deltaDecorations([],[{range:i,options:{description:"inline-completion-tracking-range"}}])[0];this._inlineCompletions.unshift(new L5(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class L5{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 y5(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),l=n.substring(0,o),u=n.substring(o);const a=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=a&&(l=l.trimStart(),0===l.length&&(u=u.trimStart()),h=h.trimStart(),0===h.length&&(c=c.trimStart())),h.startsWith(l)&&!!JR(u,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 y5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return O5(this._getUpdatedRange(t)).isBefore(O5(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 O5(t){return t.startLineNumber===t.endLineNumber?new gs(1,1+t.endColumn-t.startColumn):new gs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}var F5=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 T5={Visible:G1,HasFocusedSuggestion:new Zo("suggestWidgetHasFocusedSuggestion",!1,J(0,"Whether any suggestion is focused")),DetailsVisible:new Zo("suggestWidgetDetailsVisible",!1,J(0,"Whether suggestion details are visible")),MultipleSuggestions:new Zo("suggestWidgetMultipleSuggestions",!1,J(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Zo("suggestionMakesTextEdit",!0,J(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Zo("acceptSuggestionOnEnter",!0,J(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Zo("suggestionHasInsertAndReplaceRange",!1,J(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Zo("suggestionInsertMode",void 0,{type:"string",description:J(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Zo("suggestionCanResolve",!1,J(0,"Whether the current suggestion supports to resolve further details"))},R5=new bh("suggestWidgetStatusBar");class _5{constructor(t,i,e,s){var n;this.position=t,this.completion=i,this.container=e,this.provider=s,this.isInvalid=!1,this.score=L_.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,ps.isIRange(i.range)?(this.editStart=new gs(i.range.startLineNumber,i.range.startColumn),this.editInsertEnd=new gs(i.range.endLineNumber,i.range.endColumn),this.editReplaceEnd=new gs(i.range.endLineNumber,i.range.endColumn),this.isInvalid=this.isInvalid||ps.spansMultipleLines(i.range)||i.range.startLineNumber!==t.lineNumber):(this.editStart=new gs(i.range.insert.startLineNumber,i.range.insert.startColumn),this.editInsertEnd=new gs(i.range.insert.endLineNumber,i.range.insert.endColumn),this.editReplaceEnd=new gs(i.range.replace.endLineNumber,i.range.replace.endColumn),this.isInvalid=this.isInvalid||ps.spansMultipleLines(i.range.insert)||ps.spansMultipleLines(i.range.replace)||i.range.insert.startLineNumber!==t.lineNumber||i.range.replace.startLineNumber!==t.lineNumber||i.range.insert.startColumn!==i.range.replace.startColumn),"function"!=typeof s.resolveCompletionItem&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return void 0!==this._resolveDuration}get resolveDuration(){return void 0!==this._resolveDuration?this._resolveDuration:-1}resolve(t){return F5(this,void 0,void 0,(function*(){if(!this._resolveCache){const i=t.onCancellationRequested((()=>{this._resolveCache=void 0,this._resolveDuration=void 0})),e=new Zi(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,t)).then((t=>{Object.assign(this.completion,t),this._resolveDuration=e.elapsed()}),(t=>{Oi(t)&&(this._resolveCache=void 0,this._resolveDuration=void 0)})).finally((()=>{i.dispose()}))}return this._resolveCache}))}}class I5{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}}I5.default=new I5;class P5{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function N5(t,i,e,s=I5.default,n={triggerKind:0},r=ue.None){return F5(this,void 0,void 0,(function*(){const o=new Zi;e=e.clone();const h=i.getWordAtPosition(e),c=h?new ps(e.lineNumber,h.startColumn,e.lineNumber,h.endColumn):ps.fromPositions(e),l={replace:c,insert:c.setEndPosition(e.lineNumber,e.column)},u=[],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=l),n.sortText||(n.sortText="string"==typeof n.label?n.label:n.label.label),!f&&n.insertTextRules&&4&n.insertTextRules&&(f=f5.guessNeedsClipboard(n.insertText)),u.push(new _5(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=(()=>F5(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>F5(this,void 0,void 0,(function*(){if(s.providerItemsToReuse.has(o)){const i=s.providerItemsToReuse.get(o);return i.forEach((t=>u.push(t))),void(t=t||i.length>0)}if(!(s.providerFilter.size>0)||s.providerFilter.has(o))try{const s=new Zi,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 P5(u.sort($5.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function B5(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 $5=new Map;$5.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 B5(t,i)})),$5.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 B5(t,i)})),$5.set(1,B5),ao.registerCommand("_executeCompletionItemProvider",((t,...i)=>F5(void 0,void 0,void 0,(function*(){const[e,s,n,r]=i;B(ss.isUri(e)),B(gs.isIPosition(s)),B("string"==typeof n||!n),B("number"==typeof r||!r);const{completionProvider:o}=t.get(Wg),h=yield t.get(to).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield N5(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(ue.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 j5{static isAllOff(t){return"off"===t.other&&"off"===t.comments&&"off"===t.strings}static isAllOn(t){return"on"===t.other&&"on"===t.comments&&"on"===t.strings}static valueFor(t,i){switch(i){case 1:return t.comments;case 2:return t.strings;default:return t.other}}}function W5(t,i=dt){return function(t,i=dt){return!!i&&EE(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 V5{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 H5{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=jn(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1);let s=e;t.snippet.walk((i=>i!==t&&(i instanceof n5&&(s=jn(Bn(i.value).pop())),!0)));const n=Qn(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 z5{constructor(t,i){this._labelService=t,this._model=i}resolve(t){const{name:i}=t;if("TM_FILENAME"===i)return Ge(this._model.uri.fsPath);if("TM_FILENAME_BASE"===i){const t=Ge(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}return"TM_DIRECTORY"===i?"."===qe(this._model.uri.fsPath)?"":this._labelService.getUriLabel(RE(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 U5{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=>!Ln(t)));if(t.length===this._selectionCount)return t[this._selectionIdx]}return i}}}let K5=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}};K5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,ud)],K5);class q5{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 q5.dayNames[this._date.getDay()];if("CURRENT_DAY_NAME_SHORT"===i)return q5.dayNamesShort[this._date.getDay()];if("CURRENT_MONTH_NAME"===i)return q5.monthNames[this._date.getMonth()];if("CURRENT_MONTH_NAME_SHORT"===i)return q5.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)}}}q5.dayNames=[J(0,"Sunday"),J(0,"Monday"),J(0,"Tuesday"),J(0,"Wednesday"),J(0,"Thursday"),J(0,"Friday"),J(0,"Saturday")],q5.dayNamesShort=[J(0,"Sun"),J(0,"Mon"),J(0,"Tue"),J(0,"Wed"),J(0,"Thu"),J(0,"Fri"),J(0,"Sat")],q5.monthNames=[J(0,"January"),J(0,"February"),J(0,"March"),J(0,"April"),J(0,"May"),J(0,"June"),J(0,"July"),J(0,"August"),J(0,"September"),J(0,"October"),J(0,"November"),J(0,"December")],q5.monthNamesShort=[J(0,"Jan"),J(0,"Feb"),J(0,"Mar"),J(0,"Apr"),J(0,"May"),J(0,"Jun"),J(0,"Jul"),J(0,"Aug"),J(0,"Sep"),J(0,"Oct"),J(0,"Nov"),J(0,"Dec")];class G5{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:Ge(e)}:fR: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)||dR(s)||function(t){return"string"==typeof(null==t?void 0:t.id)&&ss.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(dR(t))return Ge(t.uri.path);let i=Ge(t.configPath.path);return i.endsWith(pR)&&(i=i.substr(0,i.length-pR.length-1)),i}_resoveWorkspacePath(t){if(dR(t))return W5(t.uri.fsPath);const i=Ge(t.configPath.path);let e=t.configPath.fsPath;return e.endsWith(i)&&(e=e.substr(0,e.length-i.length-1)),e?W5(e):"/"}}class Z5{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?d0():void 0}}var J5;class Q5{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,o5.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=ps.fromPositions(t.getPositionAt(this._offset+s),t.getPositionAt(this._offset+s+n)),o=i.addDecoration(r,e.isFinalTabstop?Q5._decor.inactiveFinal:Q5._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(OT.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 ms(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn)),i=i&&this._hasPlaceholderBeenCollapsed(n),t.changeDecorationOptions(r,n.isFinalTabstop?Q5._decor.activeFinal:Q5._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?Q5._decor.activeFinal:Q5._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?Q5._decor.inactiveFinal:Q5._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof o5){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 h5,!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=ps.fromPositions(i.getPositionAt(n._offset+s),i.getPositionAt(n._offset+s+r)),h=e.addDecoration(o,Q5._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,o5.compareByIndex)}))}}Q5._decor={active:$M.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:$M.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:$M.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:$M.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};const Y5={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let X5=J5=class{static adjustWhitespace(t,i,e,s,n){const r=jn(t.getLineContent(i.lineNumber),0,i.column-1);let o;return s.walk((i=>{if(!(i instanceof n5)||i.parent instanceof h5)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 n5(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=ms.createWithDirection(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn,i.getDirection())}return i}static createEditsAndSnippetsFromSelections(t,i,e,s,n,r,o,h,c){const l=[],u=[];if(!t.hasModel())return{edits:l,snippets:u};const a=t.getModel(),d=t.invokeWithinContext((t=>t.get(aR))),f=t.invokeWithinContext((t=>new z5(t.get(iR),a))),g=()=>o,p=a.getValueInRange(J5.adjustSelection(a,t.getSelection(),e,0)),m=a.getValueInRange(J5.adjustSelection(a,t.getSelection(),0,s)),v=a.getLineFirstNonWhitespaceColumn(t.getSelection().positionLineNumber),w=t.getSelections().map(((t,i)=>({selection:t,idx:i}))).sort(((t,i)=>ps.compareRangesUsingStarts(t.selection,i.selection)));for(const{selection:o,idx:b}of w){let y=J5.adjustSelection(a,o,e,0),k=J5.adjustSelection(a,o,0,s);p!==a.getValueInRange(y)&&(y=o),m!==a.getValueInRange(k)&&(k=o);const C=o.setStartPosition(y.startLineNumber,y.startColumn).setEndPosition(k.endLineNumber,k.endColumn),S=(new f5).parse(i,!0,n),x=C.getStartPosition(),D=J5.adjustWhitespace(a,x,r||b>0&&v!==a.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new V5([f,new U5(g,b,w.length,"spread"===t.getOption(78)),new H5(a,o,b,h),new K5(a,o,c),new q5,new G5(d),new Z5])),l[b]=OT.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,u[b]=new Q5(t,S,D)}return{edits:l,snippets:u}}static createEditsAndSnippetsFromEdits(t,i,e,s,n,r,o){if(!t.hasModel()||0===i.length)return{edits:[],snippets:[]};const h=[],c=t.getModel(),l=new f5,u=new d5,a=new V5([t.invokeWithinContext((t=>new z5(t.get(iR),c))),new U5((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new H5(c,t.getSelection(),0,r),new K5(c,t.getSelection(),o),new q5,new G5(t.invokeWithinContext((t=>t.get(aR)))),new Z5]);i=i.sort(((t,i)=>ps.compareRangesUsingStarts(t.range,i.range)));let d=0;for(let t=0;t<i.length;t++){const{range:e,template:s}=i[t];if(t>0){const s=ps.fromPositions(i[t-1].range.getEndPosition(),e.getStartPosition()),n=new n5(c.getValueInRange(s));u.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,u);J5.adjustWhitespace(c,e.getStartPosition(),!0,u,new Set(n)),u.resolveVariables(a);const r=u.toString(),o=r.slice(d);d=r.length;const f=OT.replace(e,o);f.identifier={major:t,minor:0},f._isTracked=!0,h.push(f)}return l.ensureFinalTabstop(u,e,!0),{edits:h,snippets:[new Q5(t,u,"")]}}constructor(t,i,e=Y5,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:t,snippets:i}="string"==typeof this._template?J5.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):J5.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits("snippet",t,(t=>{const e=t.filter((t=>!!t.identifier));for(let t=0;t<i.length;t++)i[t].initialize(e[t].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):e.map((t=>ms.fromPositions(t.range.getEndPosition())))})),this._editor.revealRange(this._editor.getSelections()[0])}merge(t,i=Y5){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=J5.createEditsAndSnippetsFromSelections(this._editor,t,i.overwriteBefore,i.overwriteAfter,!0,i.adjustWhitespace,i.clipboardText,i.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",e,(t=>{const i=t.filter((t=>!!t.identifier));for(let t=0;t<s.length;t++)s[t].initialize(i[t].textChange);const e=s[0].isTrivialSnippet;if(!e){for(const t of this._snippets)t.merge(s);console.assert(0===s.length)}return this._snippets[0].hasPlaceholder&&!e?this._move(void 0):i.map((t=>ms.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(ps.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(ps.compareRangesUsingStarts);for(const[e,s]of i)if(s.length===t.length){s.sort(ps.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}};X5=J5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,ud)],X5);var t3,i3=function(t,i){return function(e,s){i(e,s,t)}};const e3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let s3=t3=class{static get(t){return t.getContribution(t3.ID)}constructor(t,i,e,s,n){this._editor=t,this._logService=i,this._languageFeaturesService=e,this._languageConfigurationService=n,this._snippetListener=new Vi,this._modelVersionId=-1,this._inSnippet=t3.InSnippetMode.bindTo(s),this._hasNextTabstop=t3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=t3.HasPrevTabstop.bindTo(s)}dispose(){var t;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),null===(t=this._session)||void 0===t||t.dispose(),this._snippetListener.dispose()}insert(t,i){try{this._doInsert(t,void 0===i?e3:Object.assign(Object.assign({},e3),i))}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",t),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(t,i){var e;if(this._editor.hasModel()){if(this._snippetListener.clear(),i.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&"string"!=typeof t&&this.cancel(),this._session?(B("string"==typeof t),this._session.merge(t,i)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new X5(this._editor,t,i,this._languageConfigurationService),this._session.insert()),i.undoStopAfter&&this._editor.getModel().pushStackElement(),null===(e=this._session)||void 0===e?void 0:e.hasChoice){const t={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(t,i)=>{if(!this._session||t!==this._editor.getModel()||!gs.equals(this._editor.getPosition(),i))return;const{activeChoice:e}=this._session;if(!e||0===e.choice.options.length)return;const s=t.getValueInRange(e.range),n=Boolean(e.choice.options.find((t=>t.value===s))),r=[];for(let t=0;t<e.choice.options.length;t++){const i=e.choice.options[t];r.push({kind:13,label:i.value,insertText:i.value,sortText:"a".repeat(t+1),range:e.range,filterText:n?`${s}_${i.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:J(0,"Go to next placeholder...")}})}return{suggestions:r}}},i=this._editor.getModel();let e,s=!1;this._choiceCompletions={provider:t,enable:()=>{s||(e=this._languageFeaturesService.completionProvider.register({language:i.getLanguageId(),pattern:i.uri.fsPath,scheme:i.uri.scheme,exclusive:!0},t),this._snippetListener.add(e),s=!0)},disable:()=>{null==e||e.dispose(),s=!1}}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((t=>t.isFlush&&this.cancel()))),this._snippetListener.add(this._editor.onDidChangeModel((()=>this.cancel()))),this._snippetListener.add(this._editor.onDidChangeCursorSelection((()=>this._updateState())))}}_updateState(){if(this._session&&this._editor.hasModel()){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){var t;if(!this._session||!this._editor.hasModel())return void(this._currentChoice=void 0);const{activeChoice:i}=this._session;if(!i||!this._choiceCompletions)return null===(t=this._choiceCompletions)||void 0===t||t.disable(),void(this._currentChoice=void 0);this._currentChoice!==i.choice&&(this._currentChoice=i.choice,this._choiceCompletions.enable(),queueMicrotask((()=>{!function(t,i){var e;null===(e=t.getContribution("editor.contrib.suggestController"))||void 0===e||e.triggerSuggest((new Set).add(i),void 0,!0)}(this._editor,this._choiceCompletions.provider)})))}finish(){for(;this._inSnippet.get();)this.next()}cancel(t=!1){var i;this._inSnippet.reset(),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,null===(i=this._session)||void 0===i||i.dispose(),this._session=void 0,this._modelVersionId=-1,t&&this._editor.setSelections([this._editor.getSelection()])}prev(){var t;null===(t=this._session)||void 0===t||t.prev(),this._updateState()}next(){var t;null===(t=this._session)||void 0===t||t.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}};s3.ID="snippetController2",s3.InSnippetMode=new Zo("inSnippetMode",!1,J(0,"Whether the editor in current in snippet mode")),s3.HasNextTabstop=new Zo("hasNextTabstop",!1,J(0,"Whether there is a next tab stop when in snippet mode")),s3.HasPrevTabstop=new Zo("hasPrevTabstop",!1,J(0,"Whether there is a previous tab stop when in snippet mode")),s3=t3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([i3(1,Mh),i3(2,Wg),i3(3,Jo),i3(4,ud)],s3),hu(s3.ID,s3,4);const n3=Xl.bindToContribution(s3.get);nu(new n3({id:"jumpToNextSnippetPlaceholder",precondition:Lo.and(s3.InSnippetMode,s3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:2}})),nu(new n3({id:"jumpToPrevSnippetPlaceholder",precondition:Lo.and(s3.InSnippetMode,s3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:1026}})),nu(new n3({id:"leaveSnippet",precondition:s3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:gS.editorTextFocus,primary:9,secondary:[1033]}})),nu(new n3({id:"acceptSnippet",precondition:s3.InSnippetMode,handler:t=>t.finish()}));var r3,o3=function(t,i){return function(e,s){i(e,s,t)}},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())}))};!function(t){t[t.Undo=0]="Undo",t[t.Redo=1]="Redo",t[t.AcceptWord=2]="AcceptWord",t[t.Other=3]="Other"}(r3||(r3={}));let c3=class extends Hi{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(t,i,e,s,n,r,o,h,c,l,u,a){let d;super(),this.textModel=t,this.selectedSuggestItem=i,this.cursorPosition=e,this.textModelVersionId=s,this._debounceValue=n,this._suggestPreviewEnabled=r,this._suggestPreviewMode=o,this._inlineSuggestMode=h,this._enabled=c,this._instantiationService=l,this._commandService=u,this._languageConfigurationService=a,this._source=this._register(this._instantiationService.createInstance(D5,this.textModel,this.textModelVersionId,this._debounceValue)),this._isActive=OH(this,!1),this._forceUpdate=JH("forceUpdate"),this._selectedInlineCompletionId=OH(this,void 0),this._isAcceptingPartially=!1,this._preserveCurrentCompletionReasons=new Set([r3.Redo,r3.Undo,r3.AcceptWord]),this._fetchInlineCompletions=function(t,i){var e;return new BH(t.owner,t.debugName,i,t.createEmptyChangeSummary,t.handleChange,void 0,null!==(e=t.equalityComparer)&&void 0!==e?e:_H)}({owner:this,createEmptyChangeSummary:()=>({preserveCurrentCompletion:!1,inlineCompletionTriggerKind:Cs.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)},((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();DH((i=>{t&&n.request.versionId>t.request.versionId&&this._source.inlineCompletions.set(n.clone(),i),this._source.clearSuggestWidgetInlineCompletions(i)}))}const o=this.cursorPosition.read(t),h={triggerKind:i.inlineCompletionTriggerKind,selectedSuggestionInfo:null==r?void 0:r.toSelectedSuggestionInfo()};return this._source.fetch(o,h,s)})),this._filteredInlineCompletionItems=IH(this,(t=>{const i=this._source.inlineCompletions.read(t);if(!i)return[];const e=this.cursorPosition.read(t),s=i.inlineCompletions.filter((i=>i.isVisible(this.textModel,e,t)));return s})),this.selectedInlineCompletionIndex=IH(this,(t=>{const i=this._selectedInlineCompletionId.read(t),e=this._filteredInlineCompletionItems.read(t),s=void 0===this._selectedInlineCompletionId?-1:e.findIndex((t=>t.semanticId===i));return-1===s?(this._selectedInlineCompletionId.set(void 0,void 0),0):s})),this.selectedInlineCompletion=IH(this,(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=IH(this,(t=>this.lastTriggerKind.read(t)===Cs.Explicit?this._filteredInlineCompletionItems.read(t).length:void 0)),this.state=PH({owner:this,equalityComparer:(t,i)=>t&&i?J4(t.ghostText,i.ghostText)&&t.inlineCompletion===i.inlineCompletion&&t.suggestItem===i.suggestItem:t===i},(t=>{var i;const e=this.textModel,s=this.selectedSuggestItem.read(t);if(s){const n=s.toSingleTextEdit().removeCommonPrefix(e),r=this._computeAugmentedCompletion(n,t);if(!this._suggestPreviewEnabled.read(t)&&!r)return;const o=null!==(i=null==r?void 0:r.edit)&&void 0!==i?i:n,h=r?r.edit.text.length-n.text.length:0,c=this._suggestPreviewMode.read(t),l=this.cursorPosition.read(t),u=o.computeGhostText(e,c,l,h);return{ghostText:null!=u?u:new q4(o.range.endLineNumber,[]),inlineCompletion:null==r?void 0:r.completion,suggestItem:s}}{if(!this._isActive.read(t))return;const i=this.selectedInlineCompletion.read(t);if(!i)return;const s=i.toSingleTextEdit(t),n=this._inlineSuggestMode.read(t),r=this.cursorPosition.read(t),o=s.computeGhostText(e,n,r);return o?{ghostText:o,inlineCompletion:i,suggestItem:void 0}:void 0}})),this.ghostText=PH({owner:this,equalityComparer:J4},(t=>{const i=this.state.read(t);if(i)return i.ghostText})),this._register(YH(this._fetchInlineCompletions)),this._register(jH((t=>{var i,e;const s=this.state.read(t),n=null==s?void 0:s.inlineCompletion;if((null==n?void 0:n.semanticId)!==(null==d?void 0:d.semanticId)&&(d=n,n)){const t=n.inlineCompletion,s=t.source;null===(e=(i=s.provider).handleItemDidShow)||void 0===e||e.call(i,s.inlineCompletions,t.sourceInlineCompletion,t.insertText)}})))}trigger(t){return h3(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return h3(this,void 0,void 0,(function*(){EH(t,(t=>{this._isActive.set(!0,t),this._forceUpdate.trigger(t,Cs.Explicit)})),yield this._fetchInlineCompletions.get()}))}stop(t){EH(t,(t=>{this._isActive.set(!1,t),this._source.clear(t)}))}_computeAugmentedCompletion(t,i){const e=this.textModel,s=this._source.suggestWidgetInlineCompletions.read(i);return function(t,i){for(const e of t){const t=i(e);if(void 0!==t)return t}}(s?s.inlineCompletions:[this.selectedInlineCompletion.read(i)].filter(P),(s=>{let n=s.toSingleTextEdit(i);return n=n.removeCommonPrefix(e,ps.fromPositions(n.range.getStartPosition(),t.range.getEndPosition())),n.augments(t)?{edit:n,completion:s}:void 0}))}_deltaSelectedInlineCompletionIndex(t){return h3(this,void 0,void 0,(function*(){yield this.triggerExplicitly();const i=this._filteredInlineCompletionItems.get()||[];if(i.length>0){const e=(this.selectedInlineCompletionIndex.get()+t+i.length)%i.length;this._selectedInlineCompletionId.set(i[e].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}))}next(){return h3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return h3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i;return h3(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.inlineCompletion.toInlineCompletion(void 0);t.pushUndoStop(),s.snippetInfo?(t.executeEdits("inlineSuggestion.accept",[OT.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=s3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[OT.replaceMove(s.range,s.insertText),...s.additionalTextEdits]),s.command&&s.source.addRef(),DH((t=>{this._source.clear(t),this._isActive.set(!1,t)})),s.command&&(yield this._commandService.executeCommand(s.command.id,...s.command.arguments||[]).then(void 0,Ai),s.source.removeRef())}))}acceptNextWord(t){return h3(this,void 0,void 0,(function*(){yield 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){return h3(this,void 0,void 0,(function*(){yield this._acceptNext(t,((t,i)=>{const e=i.match(/\n/);return e&&void 0!==e.index?e.index+1:i.length}))}))}_acceptNext(t,i){return h3(this,void 0,void 0,(function*(){if(t.getModel()!==this.textModel)throw new Pi;const e=this.state.get();if(!e||e.ghostText.isEmpty()||!e.inlineCompletion)return;const s=e.ghostText,n=e.inlineCompletion.toInlineCompletion(void 0);if(n.snippetInfo||n.filterText!==n.insertText)return void(yield this.accept(t));const r=s.parts[0],o=new gs(s.lineNumber,r.column),h=r.lines.join("\n"),c=i(o,h);if(c===h.length&&1===s.parts.length)return void this.accept(t);const l=h.substring(0,c);this._isAcceptingPartially=!0;try{t.pushUndoStop(),t.executeEdits("inlineSuggestion.accept",[OT.replace(ps.fromPositions(o),l)]);const i=K4(l);t.setPosition(U4(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ps.fromPositions(n.range.getStartPosition(),U4(o,K4(l))),e=t.getModel().getValueInRange(i,1);n.source.provider.handlePartialAccept(n.source.inlineCompletions,n.sourceInlineCompletion,e.length)}}))}handleSuggestAccepted(t){var i,e;const s=t.toSingleTextEdit().removeCommonPrefix(this.textModel),n=this._computeAugmentedCompletion(s,void 0);if(!n)return;const r=n.completion.inlineCompletion;null===(e=(i=r.source.provider).handlePartialAccept)||void 0===e||e.call(i,r.source.inlineCompletions,r.sourceInlineCompletion,s.text.length)}};c3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([o3(9,Zr),o3(10,uo),o3(11,ud)],c3);var l3,u3=function(t,i){return function(e,s){i(e,s,t)}};class a3{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 d3 extends a3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let f3=l3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new Mu((()=>this._saveState()),500),this._disposables.add(t.onWillSaveState((t=>{t.reason===NP.SHUTDOWN&&this._saveState()})))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(t,i,e){this._withStrategy(t,i).memorize(t,i,e),this._persistSoon.schedule()}select(t,i,e){return this._withStrategy(t,i).select(t,i,e)}_withStrategy(t,i){var e;const s=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:t.getLanguageIdAtPosition(i.lineNumber,i.column),resource:t.uri});if((null===(e=this._strategy)||void 0===e?void 0:e.name)!==s){this._saveState();const t=l3._strategyCtors.get(s)||d3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${l3._storagePrefix}/${s}`,t?0:1);i&&this._strategy.fromJSON(JSON.parse(i))}catch(t){}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${l3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};f3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends a3{constructor(){super("recentlyUsedByPrefix"),this._trie=uR.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:ks.fromString(e.type),this._trie.set(i,e)}}}],["recentlyUsed",class extends a3{constructor(){super("recentlyUsed"),this._cache=new lg(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:ks.fromString(e.type),this._cache.set(i,e);this._seq=this._cache.size}}],["first",d3]]),f3._storagePrefix="suggest/memories",f3=l3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([u3(0,PP),u3(1,Ta)],f3);const g3=Qr("ISuggestMemories");Wa(g3,f3,1);var p3;let m3=p3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=p3.AtEnd.bindTo(i),this._configListener=this._editor.onDidChangeConfiguration((t=>t.hasChanged(122)&&this._update())),this._update()}dispose(){var t;this._configListener.dispose(),null===(t=this._selectionListener)||void 0===t||t.dispose(),this._ckAtEnd.reset()}_update(){const t="on"===this._editor.getOption(122);if(this._enabled!==t)if(this._enabled=t,this._enabled){const t=()=>{if(!this._editor.hasModel())return void this._ckAtEnd.set(!1);const t=this._editor.getModel(),i=this._editor.getSelection(),e=t.getWordAtPosition(i.getStartPosition());this._ckAtEnd.set(!!e&&e.endColumn===i.getStartPosition().column)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};m3.AtEnd=new Zo("atEndOfWord",!1),m3=p3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Jo)],m3);var v3;let w3=v3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=v3.OtherSuggestions.bindTo(i)}dispose(){this.reset()}reset(){var t;this._ckOtherSuggestions.reset(),null===(t=this._listener)||void 0===t||t.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:t,index:i},e){0!==t.items.length&&v3._moveIndex(!0,t,i)!==i?(this._acceptNext=e,this._model=t,this._index=i,this._listener=this._editor.onDidChangeCursorPosition((()=>{this._ignore||this.reset()})),this._ckOtherSuggestions.set(!0)):this.reset()}static _moveIndex(t,i,e){let s=e;for(let n=i.items.length;n>0&&(s=(s+i.items.length+(t?1:-1))%i.items.length,s!==e)&&i.items[s].completion.additionalTextEdits;n--);return s}next(){this._move(!0)}prev(){this._move(!1)}_move(t){if(this._model)try{this._ignore=!0,this._index=v3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};w3.OtherSuggestions=new Zo("hasOtherSuggestions",!1),w3=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,Jo)],w3);class b3{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||!a(t.item.completion.commitCharacters))return void this.reset();if(this._active&&this._active.item.item===t.item)return;const i=new zd;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 y3{provideSelectionRanges(t,i){return 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())}))}(this,void 0,void 0,(function*(){const e=[];for(const s of i){const i=[];e.push(i);const n=new Map;yield new Promise((i=>y3._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>y3._bracketsLeftYield(e,0,t,s,n,i)))}return e}))}static _bracketsRightYield(t,i,e,s,n){const r=new Map,o=Date.now();for(;;){if(i>=y3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>y3._maxDuration){setTimeout((()=>y3._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 It,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>=y3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>y3._maxDuration){setTimeout((()=>y3._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=ps.fromPositions(c.range.getEndPosition(),s.getStartPosition()),h=ps.fromPositions(c.range.getStartPosition(),s.getEndPosition());r.push({range:o}),r.push({range:h}),y3._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:ps.fromPositions(new gs(s,n),i.getEndPosition())}),e.push({range:ps.fromPositions(new gs(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:ps.fromPositions(new gs(r,s),i.getEndPosition())}),e.push({range:ps.fromPositions(new gs(r,1),i.getEndPosition())}))}}}y3._maxDuration=30,y3._maxRounds=2;class k3{static create(t,i){return 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())}))}(this,void 0,void 0,(function*(){if(!i.getOption(117).localityBonus)return k3.None;if(!i.hasModel())return k3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return k3.None;const[r]=yield(new y3).provideSelectionRanges(e,[n]);if(0===r.length)return k3.None;const o=yield t.computeWordRanges(e.uri,r[0].range);if(!o)return k3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends k3{distance(t,e){if(!n.equals(i.getPosition()))return 0;if(17===e.kind)return 2<<20;const h=o["string"==typeof e.label?e.label:e.label.label];if(u(h))return 2<<20;const c=s(h,ps.fromPositions(t),ps.compareRangesUsingStarts),l=c>=0?h[c]:h[Math.max(0,~c-1)];let a=r.length;for(const t of r){if(!ps.containsRange(t.range,l))break;a-=1}return a}}}))}}k3.None=new class extends k3{distance(){return 0}};class C3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class S3{constructor(t,i,e,s,n,r,o=O_.default,h){this.clipboardText=h,this._snippetCompareFn=S3._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=S3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=S3._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(t){this._lineContext.leadingLineContent===t.leadingLineContent&&this._lineContext.characterCountDelta===t.characterCountDelta||(this._refilterKind=this._lineContext.characterCountDelta<t.characterCountDelta&&this._filteredItems?2:1,this._lineContext=t)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const t=new Set;for(const[i,e]of this.getItemsByProvider())e.length>0&&e[0].container.incomplete&&t.add(i);return t}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){0!==this._refilterKind&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const t=[],{leadingLineContent:i,characterCountDelta:e}=this._lineContext;let s="",r="";const o=1===this._refilterKind?this._items:this._filteredItems,h=[],c=!this._options.filterGraceful||o.length>2e3?F_:R_;for(let n=0;n<o.length;n++){const l=o[n];if(l.isInvalid)continue;const u=this._itemsByProvider.get(l.provider);u?u.push(l):this._itemsByProvider.set(l.provider,[l]);const a=l.position.column-l.editStart.column,d=a+e-(l.position.column-this._column);if(s.length!==d&&(s=0===d?"":i.slice(-d),r=s.toLowerCase()),l.word=s,0===d)l.score=L_.Default;else{let t=0;for(;t<a;){const i=s.charCodeAt(t);if(32!==i&&9!==i)break;t+=1}if(t>=d)l.score=L_.Default;else if("string"==typeof l.completion.filterText){const i=c(s,r,t,l.completion.filterText,l.filterTextLow,0,this._fuzzyScoreOptions);if(!i)continue;0===zn(l.completion.filterText,l.textLabel)?l.score=i:(l.score=m_(s,r,t,l.textLabel,l.labelLow,0),l.score[0]=i[0])}else{const i=c(s,r,t,l.textLabel,l.labelLow,0,this._fuzzyScoreOptions);if(!i)continue;l.score=i}}l.idx=n,l.distance=this._wordDistance.distance(l.position,l.completion),h.push(l),t.push(l.textLabel.length)}this._filteredItems=h.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:t.length?n(t.length-.85,t,((t,i)=>t-i)):0}}static _compareCompletionItems(t,i){return t.score[0]>i.score[0]?-1:t.score[0]<i.score[0]?1:t.distance<i.distance?-1:t.distance>i.distance?1:t.idx<i.idx?-1:t.idx>i.idx?1:0}static _compareCompletionItemsSnippetsDown(t,i){if(t.completion.kind!==i.completion.kind){if(27===t.completion.kind)return 1;if(27===i.completion.kind)return-1}return S3._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 S3._compareCompletionItems(t,i)}}var x3,D3=function(t,i){return function(e,s){i(e,s,t)}};class E3{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 A3=x3=class{constructor(t,i,e,s,n,r,o,h,c){this._editor=t,this._editorWorkerService=i,this._clipboardService=e,this._telemetryService=s,this._logService=n,this._contextKeyService=r,this._configurationService=o,this._languageFeaturesService=h,this._envService=c,this._toDispose=new Vi,this._triggerCharacterListener=new Vi,this._triggerQuickSuggest=new Eu,this._triggerState=void 0,this._completionDisposables=new Vi,this._onDidCancel=new ie,this._onDidTrigger=new ie,this._onDidSuggest=new ie,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._telemetryGate=0,this._currentSelection=this._editor.getSelection()||new ms(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeModelLanguage((()=>{this._updateTriggerCharacters(),this.cancel()}))),this._toDispose.add(this._editor.onDidChangeConfiguration((()=>{this._updateTriggerCharacters()}))),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange((()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()})));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart((()=>{l=!0}))),this._toDispose.add(this._editor.onDidCompositionEnd((()=>{l=!1,this._onCompositionEnd()}))),this._toDispose.add(this._editor.onDidChangeCursorSelection((t=>{l||this._onCursorChange(t)}))),this._toDispose.add(this._editor.onDidChangeModelContent((()=>{l||void 0===this._triggerState||this._refilterCompletionItems()}))),this._updateTriggerCharacters()}dispose(){$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(90)||!this._editor.hasModel()||!this._editor.getOption(120))return;const t=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const e of i.triggerCharacters||[]){let s=t.get(e);s||(s=new Set,s.add(void 0),t.set(e,s)),s.add(i)}const i=i=>{var e;if(!function(t,i){if(!Boolean(i.getContextKeyValue("inlineSuggestionVisible")))return!0;const e=i.getContextKeyValue(W4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(E3.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="";tr(i.charCodeAt(i.length-1))?Xn(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;j5.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=s3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!E3.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const t=this._editor.getModel(),i=this._editor.getPosition(),e=this._editor.getOption(88);if(!j5.isAllOff(e)){if(!j5.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"!==j5.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(W4.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(W4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions})(this._editor,this._contextKeyService)&&this._languageFeaturesService.completionProvider.has(t)&&this.trigger({auto:!0})}}),this._editor.getOption(89)))}_refilterCompletionItems(){B(this._editor.hasModel()),B(void 0!==this._triggerState);const t=this._editor.getModel(),i=this._editor.getPosition(),e=new E3(t,i,Object.assign(Object.assign({},this._triggerState),{refilter:!0}));this._onNewContext(e)}trigger(t){var i,e,s,n,r,o;if(!this._editor.hasModel())return;const h=this._editor.getModel(),c=new E3(h,this._editor.getPosition(),t);this.cancel(t.retrigger),this._triggerState=t,this._onDidTrigger.fire({auto:t.auto,shy:null!==(i=t.shy)&&void 0!==i&&i,position:this._editor.getPosition()}),this._context=c;let l={triggerKind:null!==(e=t.triggerKind)&&void 0!==e?e:0};t.triggerCharacter&&(l={triggerKind:1,triggerCharacter:t.triggerCharacter}),this._requestToken=new de;let u=1;switch(this._editor.getOption(111)){case"top":u=0;break;case"bottom":u=2}const{itemKind:a,showDeprecated:d}=x3._createSuggestFilter(this._editor),f=new I5(u,null!==(n=null===(s=t.completionOptions)||void 0===s?void 0:s.kindFilter)&&void 0!==n?n:a,null===(r=t.completionOptions)||void 0===r?void 0:r.providerFilter,null===(o=t.completionOptions)||void 0===o?void 0:o.providerItemsToReuse,d),g=k3.create(this._editorWorkerService,this._editor),p=N5(this._languageFeaturesService.completionProvider,h,this._editor.getPosition(),f,l,this._requestToken.token);Promise.all([p,g]).then((([i,e])=>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())}))}(this,void 0,void 0,(function*(){var s;if(null===(s=this._requestToken)||void 0===s||s.dispose(),!this._editor.hasModel())return;let n=null==t?void 0:t.clipboardText;if(!n&&i.needsClipboard&&(n=yield this._clipboardService.readText()),void 0===this._triggerState)return;const r=this._editor.getModel(),o=new E3(r,this._editor.getPosition(),t),h=Object.assign(Object.assign({},O_.default),{firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly});if(this._completionModel=new S3(i.items,this._context.column,{leadingLineContent:o.leadingLineContent,characterCountDelta:o.column-this._context.column},e,this._editor.getOption(117),this._editor.getOption(111),h,n),this._completionDisposables.add(i.disposable),this._onNewContext(o),this._reportDurationsTelemetry(i.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const t of i.items)t.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${t.provider._debugDisplayName}`,t.completion)})))).catch(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(111)&&i.add(27);const e=t.getOption(117);return e.showMethods||i.add(0),e.showFunctions||i.add(1),e.showConstructors||i.add(2),e.showFields||i.add(3),e.showVariables||i.add(4),e.showClasses||i.add(5),e.showStructs||i.add(6),e.showInterfaces||i.add(7),e.showModules||i.add(8),e.showProperties||i.add(9),e.showEvents||i.add(10),e.showOperators||i.add(11),e.showUnits||i.add(12),e.showValues||i.add(13),e.showConstants||i.add(14),e.showEnums||i.add(15),e.showEnumMembers||i.add(16),e.showKeywords||i.add(17),e.showWords||i.add(18),e.showColors||i.add(19),e.showFiles||i.add(20),e.showReferences||i.add(21),e.showColors||i.add(22),e.showFolders||i.add(23),e.showTypeParameters||i.add(24),e.showSnippets||i.add(27),e.showUsers||i.add(25),e.showIssues||i.add(26),{itemKind:i,showDeprecated:e.showDeprecated}}_onNewContext(t){if(this._context)if(t.lineNumber===this._context.lineNumber)if(jn(t.leadingLineContent)===jn(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(E3.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=E3.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()}};A3=x3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D3(1,MN),D3(2,EV),D3(3,Ah),D3(4,Mh),D3(5,Jo),D3(6,Ta),D3(7,Wg),D3(8,EF)],A3);class M3{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)>M3._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()}}M3._maxSelectionLength=51200;var L3=function(t,i){return function(e,s){i(e,s,t)}};class O3 extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();this.label&&(this.label.textContent=J(0,"{0} ({1})",this._action.label,O3.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let F3=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Ol(t,Pl(".suggest-status-bar"));const r=t=>t instanceof xh?e.createInstance(O3,t,void 0):void 0;this._leftActions=new cN(this.element,{actionViewItemProvider:r}),this._rightActions=new cN(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const t=this._menuService.createMenu(this._menuId,this._contextKeyService),i=()=>{const i=[],e=[];for(const[s,n]of t.getActions())"left"===s?i.push(...n):e.push(...n);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(e)};this._menuDisposables.add(t.onDidChange((()=>i()))),this._menuDisposables.add(t)}hide(){this._menuDisposables.clear()}};F3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([L3(2,Zr),L3(3,yh),L3(4,Jo)],F3);function T3(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let R3=class{constructor(t,i){this._editor=t,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ie,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new Vi,this._renderDisposeable=new Vi,this._borderWidth=1,this._size=new ol(330,0),this.domNode=Pl(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(JG,{editor:t}),this._body=Pl(".body"),this._scrollbar=new Zy(this._body,{alwaysConsumeMouseWheel:!0}),Ol(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ol(this._body,Pl(".header")),this._close=Ol(this._header,Pl("span"+eo.asCSSSelector(ys.close))),this._close.title=J(0,"Close"),this._type=Ol(this._header,Pl("p.type")),this._docs=Ol(this._body,Pl("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._configureFont()})))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const t=this._editor.getOptions(),i=t.get(50),e=i.getMassagedFontFamily(),s=t.get(118)||i.fontSize,n=t.get(119)||i.lineHeight,r=i.fontWeight,o=`${n}px`;this.domNode.style.fontSize=`${s}px`,this.domNode.style.lineHeight=""+n/s,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=i.fontFeatureSettings,this._type.style.fontFamily=e,this._close.style.height=o,this._close.style.width=o}getLayoutInfo(){const t=this._editor.getOption(119)||this._editor.getOption(50).lineHeight,i=this._borderWidth;return{lineHeight:t,borderWidth:i,borderHeight:2*i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=J(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 H_).appendCodeblock("empty",i),n=`Provider: ${t.provider._debugDisplayName}`}if(i||T3(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,Nl(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Gc(this._type),this._type.title="",Bl(this._type),this.domNode.classList.add("no-type");if(Gc(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Gc(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 ol(t,i);ol.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}};R3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zr)],R3);class _3{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 yY,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=nl(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new ol(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 ol(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),l=[c,function(){const e=t.left-r.borderWidth-r.horizontalPadding,s=Math.max(r.horizontalPadding,t.left-i.width-r.borderWidth),c=new ol(e,n.height-t.top-r.borderHeight-r.verticalPadding),l=c.with(void 0,t.top+t.height-r.borderHeight-r.verticalPadding);return{top:h,left:s,fit:e-i.width,maxSizeTop:c,maxSizeBottom:l,minSize:o.with(Math.min(e,o.width))}}(),function(){const e=t.left,s=-r.borderWidth+t.top+t.height,h=new ol(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)}}()],u=null!==(s=l.find((t=>t.fit>=0)))&&void 0!==s?s:l.sort(((t,i)=>i.fit-t.fit))[0],a=t.top+t.height-r.borderHeight;let d,f=i.height;const g=Math.max(u.maxSizeTop.height,u.maxSizeBottom.height);let p;f>g&&(f=g),e?f<=u.maxSizeTop.height?(d=!0,p=u.maxSizeTop):(d=!1,p=u.maxSizeBottom):f<=u.maxSizeBottom.height?(d=!1,p=u.maxSizeBottom):(d=!0,p=u.maxSizeTop),this._applyTopLeft({left:u.left,top:d?u.top:a-f}),this.getDomNode().style.position="fixed",this._resizable.enableSashes(!d,u===c,d,u!==c),this._resizable.minSize=u.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 I3;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}(I3||(I3={}));const P3=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function N3(t,i,e,s){const n=s===I3.ROOT_FOLDER?["rootfolder-icon"]:s===I3.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===Vc.data)r=jE.parseMetaData(e).get(jE.META_DATA_LABEL);else{const t=e.path.match(P3);t?(r=B3(t[2].toLowerCase()),t[1]&&n.push(`${B3(t[1].toLowerCase())}-name-dir-icon`)):r=B3(e.authority.toLowerCase())}if(s===I3.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===Vc.data){const t=jE.parseMetaData(e).get(jE.META_DATA_MIME);t&&(s=i.getLanguageIdByMimeType(t))}else{const i=t.getModel(e);i&&(s=i.getLanguageId())}return s&&s!==ed?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${B3(s)}-lang-file-icon`)}}return n}function B3(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var $3,j3=function(t,i){return function(e,s){i(e,s,t)}};function W3(t){return`suggest-aria-id:${t}`}const V3=GW("suggest-more-info",ys.chevronRight,J(0,"Icon for more information in the suggest widget.")),H3=new(($3=class{extract(t,i){if(t.textLabel.match($3._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match($3._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=$3._regexRelaxed.exec(t.completion.documentation);if(e&&(0===e.index||e.index+e[0].length===t.completion.documentation.length))return i[0]=e[0],!0}return!1}})._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,$3._regexStrict=new RegExp(`^${$3._regexRelaxed.source}$`,"i"),$3);let z3=class{constructor(t,i,e,s){this._editor=t,this._modelService=i,this._languageService=e,this._themeService=s,this._onDidToggleDetails=new ie,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(t){const i=new Vi,e=t;e.classList.add("show-file-icons");const s=Ol(t,Pl(".icon")),n=Ol(s,Pl("span.colorspan")),r=Ol(t,Pl(".contents")),o=Ol(r,Pl(".main")),h=Ol(o,Pl(".icon-label.codicon")),c=Ol(o,Pl("span.left")),l=Ol(o,Pl("span.right")),u=new Jj(c,{supportHighlights:!0,supportIcons:!0});i.add(u);const a=Ol(c,Pl("span.signature-label")),d=Ol(c,Pl("span.qualifier-label")),f=Ol(l,Pl("span.details-label")),g=Ol(l,Pl("span.readMore"+eo.asCSSSelector(V3)));g.title=J(0,"Read More");const p=()=>{const t=this._editor.getOptions(),i=t.get(50),n=i.getMassagedFontFamily(),r=i.fontFeatureSettings,h=t.get(118)||i.fontSize,c=t.get(119)||i.lineHeight,l=i.fontWeight,u=`${c}px`,a=`${i.letterSpacing}px`;e.style.fontSize=`${h}px`,e.style.fontWeight=l,e.style.letterSpacing=a,o.style.fontFamily=n,o.style.fontFeatureSettings=r,o.style.lineHeight=u,s.style.height=u,s.style.width=u,g.style.height=u,g.style.width=u};return p(),i.add(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(50)||t.hasChanged(118)||t.hasChanged(119))&&p()}))),{root:e,left:c,right:l,icon:s,colorspan:n,iconLabel:u,iconContainer:h,parametersLabel:a,qualifierLabel:d,detailsLabel:f,readMore:g,disposables:i}}renderElement(t,i,e){const{completion:s}=t;e.root.id=W3(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:v_(t.score)},r=[];if(19===s.kind&&H3.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=N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),I3.FILE),r=N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),I3.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=[N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),I3.FOLDER),N3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),I3.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...eo.asClassNameArray(ks.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=U3(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=U3(s.label.detail||""),e.detailsLabel.textContent=U3(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Nl(e.detailsLabel):Bl(e.detailsLabel),T3(t)?(e.right.classList.add("can-expand-details"),Nl(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"),Bl(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function U3(t){return t.replace(/\r\n|\r|\n/g,"")}z3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j3(1,Xr),j3(2,Ba),j3(3,mk)],z3);var K3,q3=function(t,i){return function(e,s){i(e,s,t)}};Om("editorSuggestWidget.background",{dark:Lv,light:Lv,hcDark:Lv,hcLight:Lv},J(0,"Background color of the suggest widget.")),Om("editorSuggestWidget.border",{dark:Fv,light:Fv,hcDark:Fv,hcLight:Fv},J(0,"Border color of the suggest widget."));const G3=Om("editorSuggestWidget.foreground",{dark:Mv,light:Mv,hcDark:Mv,hcLight:Mv},J(0,"Foreground color of the suggest widget."));Om("editorSuggestWidget.selectedForeground",{dark:zw,light:zw,hcDark:zw,hcLight:zw},J(0,"Foreground color of the selected entry in the suggest widget.")),Om("editorSuggestWidget.selectedIconForeground",{dark:Uw,light:Uw,hcDark:Uw,hcLight:Uw},J(0,"Icon foreground color of the selected entry in the suggest widget."));const Z3=Om("editorSuggestWidget.selectedBackground",{dark:Kw,light:Kw,hcDark:Kw,hcLight:Kw},J(0,"Background color of the selected entry in the suggest widget."));Om("editorSuggestWidget.highlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Color of the match highlights in the suggest widget.")),Om("editorSuggestWidget.focusHighlightForeground",{dark:Lw,light:Lw,hcDark:Lw,hcLight:Lw},J(0,"Color of the match highlights in the suggest widget when an item is focused.")),Om("editorSuggestWidgetStatus.foreground",{dark:Mb(G3,.5),light:Mb(G3,.5),hcDark:Mb(G3,.5),hcLight:Mb(G3,.5)},J(0,"Foreground color of the suggest widget status."));class J3{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof NJ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(ol.is(t))return ol.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let Q3=K3=class{constructor(t,i,e,s,n){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 Eu,this._disposables=new Vi,this._onDidSelect=new se,this._onDidFocus=new se,this._onDidHide=new ie,this._onDidShow=new ie,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ie,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new yY,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new Y3(this,t),this._persistedSize=new J3(i,t);class r{constructor(t,i,e=!1,s=!1){this.persistedSize=t,this.currentSize=i,this.persistHeight=e,this.persistWidth=s}}let o;this._disposables.add(this.element.onDidWillResize((()=>{this._contentWidget.lockPreference(),o=new r(this._persistedSize.restore(),this.element.size)}))),this._disposables.add(this.element.onDidResize((t=>{var i,e,s,n;if(this._resize(t.dimension.width,t.dimension.height),o&&(o.persistHeight=o.persistHeight||!!t.north||!!t.south,o.persistWidth=o.persistWidth||!!t.east||!!t.west),t.done){if(o){const{itemHeight:t,defaultSize:r}=this.getLayoutInfo(),h=Math.round(t/2);let{width:c,height:l}=this.element.size;(!o.persistHeight||Math.abs(o.currentSize.height-l)<=h)&&(l=null!==(e=null===(i=o.persistedSize)||void 0===i?void 0:i.height)&&void 0!==e?e:r.height),(!o.persistWidth||Math.abs(o.currentSize.width-c)<=h)&&(c=null!==(n=null===(s=o.persistedSize)||void 0===s?void 0:s.width)&&void 0!==n?n:r.width),this._persistedSize.store(new ol(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=Ol(this.element.domNode,Pl(".message")),this._listElement=Ol(this.element.domNode,Pl(".tree"));const h=this._disposables.add(n.createInstance(R3,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new _3(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(z3,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails((()=>this.toggleDetails()))),this._list=new vP("SuggestWidget",this._listElement,{getHeight:()=>this.getLayoutInfo().itemHeight,getTemplateId:()=>"suggestion"},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>"option",getWidgetAriaLabel:()=>J(0,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:t=>{let i=t.textLabel;if("string"!=typeof t.completion.label){const{detail:e,description:s}=t.completion.label;e&&s?i=J(0,"{0} {1}, {2}",i,e,s):e?i=J(0,"{0} {1}",i,e):s&&(i=J(0,"{0}, {1}",i,s))}if(!t.isResolved||!this._isDetailsVisible())return i;const{documentation:e,detail:s}=t.completion;return J(0,"{0}, docs: {1}",i,Fn("{0}{1}",s||"",e?"string"==typeof e?e:e.value:""))}}}),this._list.style(qP({listInactiveFocusBackground:Z3,listInactiveFocusOutline:Pm})),this._status=n.createInstance(F3,this.element.domNode,R5);const u=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(117).showStatusBar);u(),this._disposables.add(s.onDidColorThemeChange((t=>this._onThemeChange(t)))),this._onThemeChange(s.getColorTheme()),this._disposables.add(this._list.onMouseDown((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onTap((t=>this._onListMouseDownOrTap(t)))),this._disposables.add(this._list.onDidChangeSelection((t=>this._onListSelection(t)))),this._disposables.add(this._list.onDidChangeFocus((t=>this._onListFocus(t)))),this._disposables.add(this.editor.onDidChangeCursorSelection((()=>this._onCursorSelectionChanged()))),this._disposables.add(this.editor.onDidChangeConfiguration((t=>{t.hasChanged(117)&&(u(),c())}))),this._ctxSuggestWidgetVisible=T5.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=T5.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=T5.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=T5.HasFocusedSuggestion.bindTo(e),this._disposables.add(Xc(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=oy(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=wu((t=>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())}))}(this,void 0,void 0,(function*(){const i=xu((()=>{this._isDetailsVisible()&&this.showDetails(!0)}),250),s=t.onCancellationRequested((()=>i.dispose()));try{return yield e.resolve(t)}finally{i.dispose(),s.dispose()}})))),this._currentSuggestionDetails.then((()=>{s>=this._list.length||e!==this._list.element(s)||(this._ignoreFocusEvents=!0,this._list.splice(s,1,[e]),this._list.setFocus([s]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this.showDetails(!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:W3(s)}))})).catch(Ei)),this._onDidFocus.fire({item:e,index:s,model:this._completionModel})}_setState(t){if(this._state!==t)switch(this._state=t,this.element.domNode.classList.toggle("frozen",4===t),this.element.domNode.classList.remove("message"),t){case 0:Bl(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=K3.LOADING_MESSAGE,Bl(this._listElement,this._status.element),Nl(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,nm(K3.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=K3.NO_SUGGESTIONS_MESSAGE,Bl(this._listElement,this._status.element),Nl(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,nm(K3.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Bl(this._messageElement),Nl(this._listElement,this._status.element),this._show();break;case 5:Bl(this._messageElement),Nl(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=xu((()=>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=tl((()=>{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")):!T3(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=tl((()=>{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=nl(this.element.domNode.ownerDocument.body),r=this.getLayoutInfo();t||(t=r.defaultSize);let o=t.height,h=t.width;if(this._status.element.style.height=`${r.itemHeight}px`,2===this._state||1===this._state)o=r.itemHeight+r.borderHeight,h=r.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new ol(h,o),this._contentWidget.setPreference(2);else{const c=n.width-r.borderHeight-2*r.horizontalPadding;h>c&&(h=c);const l=this._completionModel?this._completionModel.stats.pLabelLen*r.typicalHalfwidthCharacterWidth:h,u=r.statusBarHeight+this._list.contentHeight+r.borderHeight,a=r.itemHeight+r.statusBarHeight,d=cl(this.editor.getDomNode()),f=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),g=Math.min(n.height-(d.top+f.top+f.height)-r.verticalPadding,u),p=d.top+f.top-r.verticalPadding,m=Math.min(p,u);let v=Math.min(Math.max(m,g)+r.borderHeight,u);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 ol(l,r.defaultSize.height),this.element.maxSize=new ol(c,v),this.element.minSize=new ol(220,a),this._cappedHeight=o===u?{wanted:null!==(s=null===(e=this._cappedHeight)||void 0===e?void 0:e.wanted)&&void 0!==s?s:t.height,capped:o}:void 0}this._resize(h,o)}_resize(t,i){const{width:e,height:s}=this.element.maxSize;t=Math.min(e,t),i=Math.min(s,i);const{statusBarHeight:n}=this.getLayoutInfo();this._list.layout(i-n,t),this._listElement.style.height=i-n+"px",this.element.layout(i,t),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){var t;this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,2===(null===(t=this._contentWidget.getPosition())||void 0===t?void 0:t.preference[0]))}getLayoutInfo(){const t=this.editor.getOption(50),i=SF(this.editor.getOption(119)||t.lineHeight,8,1e3),e=this.editor.getOption(117).showStatusBar&&2!==this._state&&1!==this._state?i:0,s=this._details.widget.borderWidth,n=2*s;return{itemHeight:i,statusBarHeight:e,borderWidth:s,borderHeight:n,typicalHalfwidthCharacterWidth:t.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new ol(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}};Q3.LOADING_MESSAGE=J(0,"Loading..."),Q3.NO_SUGGESTIONS_MESSAGE=J(0,"No suggestions."),Q3=K3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([q3(1,PP),q3(2,Jo),q3(3,mk),q3(4,Zr)],Q3);class Y3{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 ol(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 X3,t6=function(t,i){return function(e,s){i(e,s,t)}};class i6{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:ps.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 e6=X3=class{static get(t){return t.getContribution(X3.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 s6((t=>t.priority)),this._onWillInsertSuggestItem=new ie,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(A3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=T5.InsertMode.bindTo(s);h.set(t.getOption(117).insertMode),this._toDispose.add(this.model.onDidTrigger((()=>h.set(t.getOption(117).insertMode)))),this.widget=this._toDispose.add(new Ou((()=>{const t=this._instantiationService.createInstance(Q3,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new b3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=T5.MakesTextEdit.bindTo(this._contextKeyService),s=T5.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=T5.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(!gs.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 nh(!0,!1,!1,!1,33))||ft&&t.toKeyCodeChord().equals(new nh(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new Ou((()=>this._toDispose.add(new M3(this.editor,this.model))))),this._alternatives=this._toDispose.add(new Ou((()=>this._toDispose.add(new w3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(m3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new i6(this.editor.getModel(),t.position)}))),this._toDispose.add(this.model.onDidSuggest((t=>{if(t.triggerOptions.shy)return;let i=-1;for(const e of this._selectors.itemsOrderedByPriorityDesc)if(i=e.select(this.editor.getModel(),this.editor.getPosition(),t.completionModel.items),-1!==i)break;-1===i&&(i=0);let e=!1;if(t.triggerOptions.auto){const i=this.editor.getOption(117);"never"===i.selectionMode||"always"===i.selectionMode?e="never"===i.selectionMode:"whenTriggerCharacter"===i.selectionMode?e=1!==t.triggerOptions.triggerKind:"whenQuickSuggestion"===i.selectionMode&&(e=1===t.triggerOptions.triggerKind&&!t.triggerOptions.refilter)}this.widget.value.showSuggestions(t.completionModel,i,t.isFrozen,t.triggerOptions.auto,e)}))),this._toDispose.add(this.model.onDidCancel((t=>{t.retrigger||this.widget.value.hideWidget()}))),this._toDispose.add(this.editor.onDidBlurEditorWidget((()=>{this.model.cancel(),this.model.clear()})));const c=T5.AcceptSuggestionsOnEnter.bindTo(s),l=()=>{const t=this.editor.getOption(1);c.set("on"===t||"smart"===t)};this._toDispose.add(this.editor.onDidChangeConfiguration((()=>l()))),l()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(t,i){if(!t||!t.item)return this._alternatives.value.reset(),this.model.cancel(),void this.model.clear();if(!this.editor.hasModel())return;const e=s3.get(this.editor);if(!e)return;this._onWillInsertSuggestItem.fire({item:t.item});const s=this.editor.getModel(),n=s.getAlternativeVersionId(),{item:r}=t,o=[],h=new de;1&i||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,Boolean(8&i));this._memoryService.memorize(s,this.editor.getPosition(),r);const l=r.isResolved;let u=-1,a=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const t=tU.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>OT.replaceMove(ps.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!l){const t=new Zi;let e;const n=s.onDidChangeContent((t=>{if(t.isFlush)return h.cancel(),void n.dispose();for(const i of t.changes){const t=ps.getEndPosition(i.range);e&&!gs.isBefore(t,e)||(e=t)}})),c=i;i|=2;let l=!1;const u=this.editor.onWillType((()=>{u.dispose(),l=!0,2&c||this.editor.pushUndoStop()}));o.push(r.resolve(h.token).then((()=>{if(!r.completion.additionalTextEdits||h.token.isCancellationRequested)return;if(e&&r.completion.additionalTextEdits.some((t=>gs.isBefore(e,ps.getStartPosition(t.range)))))return!1;l&&this.editor.pushUndoStop();const t=tU.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>OT.replaceMove(ps.lift(t.range),t.text)))),t.restoreRelativeVerticalPositionOfCursor(this.editor),!l&&2&c||this.editor.pushUndoStop(),!0})).then((i=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",t.elapsed(),i),a=!0===i?1:!1===i?0:-2})).finally((()=>{n.dispose(),u.dispose()})))}let{insertText:d}=r.completion;if(4&r.completion.insertTextRules||(d=f5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===n6.id)this.model.trigger({auto:!0,retrigger:!0});else{const t=new Zi;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)})).finally((()=>{u=t.elapsed()})))}4&i&&this._alternatives.value.set(t,(t=>{for(h.cancel();s.canUndo();){n!==s.getAlternativeVersionId()&&s.undo(),this._insertSuggestion(t,3|(8&i?8:0));break}})),this._alertCompletionItem(r),Promise.all(o).finally((()=>{this._reportSuggestionAcceptedTelemetry(r,s,l,u,a),this.model.clear(),h.dispose()}))}_reportSuggestionAcceptedTelemetry(t,i,e,s,n){var r,o,h;0!==Math.floor(100*Math.random())&&this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:null!==(o=null===(r=t.extensionId)||void 0===r?void 0:r.value)&&void 0!==o?o:"unknown",providerId:null!==(h=t.provider._debugDisplayName)&&void 0!==h?h:"unknown",kind:t.completion.kind,basenameHash:Sd(FE(i.uri)).toString(16),languageId:i.getLanguageId(),fileExtension:TE(i.uri),resolveInfo:t.provider.resolveCompletionItem?e?1:0:-1,resolveDuration:t.resolveDuration,commandDuration:s,additionalEditsAsync:n})}getOverwriteInfo(t,i){B(this.editor.hasModel());let e="replace"===this.editor.getOption(117).insertMode;i&&(e=!e);const s=(e?t.editReplaceEnd.column:t.editInsertEnd.column)-t.position.column;return{overwriteBefore:t.position.column-t.editStart.column+(this.editor.getPosition().column-t.position.column),overwriteAfter:s+(this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0)}}_alertCompletionItem(t){a(t.completion.additionalTextEdits)&&sm(J(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};Ji.once(this.model.onDidTrigger)((()=>{const t=[];Ji.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)}};e6.ID="editor.contrib.suggestController",e6=X3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t6(1,g3),t6(2,uo),t6(3,Jo),t6(4,Zr),t6(5,Mh),t6(6,Ah)],e6);class s6{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 n6 extends tu{constructor(){super({id:n6.id,label:J(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Lo.and(gS.writable,gS.hasCompletionItemProvider,T5.Visible.toNegated()),kbOpts:{kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=e6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}n6.id="editor.action.triggerSuggest",hu(e6.ID,e6,2),ru(n6);const r6=190,o6=Xl.bindToContribution(e6.get);nu(new o6({id:"acceptSelectedSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Lo.and(T5.Visible,gS.textInputFocus),weight:r6},{primary:3,kbExpr:Lo.and(T5.Visible,gS.textInputFocus,T5.AcceptSuggestionsOnEnter,T5.MakesTextEdit),weight:r6}],menuOpts:[{menuId:R5,title:J(0,"Insert"),group:"left",order:1,when:T5.HasInsertAndReplaceRange.toNegated()},{menuId:R5,title:J(0,"Insert"),group:"left",order:1,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("insert"))},{menuId:R5,title:J(0,"Replace"),group:"left",order:1,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("replace"))}]})),nu(new o6({id:"acceptAlternativeSelectedSuggestion",precondition:Lo.and(T5.Visible,gS.textInputFocus,T5.HasFocusedSuggestion),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:R5,group:"left",order:2,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("insert")),title:J(0,"Replace")},{menuId:R5,group:"left",order:2,when:Lo.and(T5.HasInsertAndReplaceRange,T5.InsertMode.isEqualTo("replace")),title:J(0,"Insert")}]})),ao.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),nu(new o6({id:"hideSuggestWidget",precondition:T5.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:9,secondary:[1033]}})),nu(new o6({id:"selectNextSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),nu(new o6({id:"selectNextPageSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:12,secondary:[2060]}})),nu(new o6({id:"selectLastSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),nu(new o6({id:"selectPrevSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),nu(new o6({id:"selectPrevPageSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:11,secondary:[2059]}})),nu(new o6({id:"selectFirstSuggestion",precondition:Lo.and(T5.Visible,Lo.or(T5.MultipleSuggestions,T5.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),nu(new o6({id:"focusSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),nu(new o6({id:"focusAndAcceptSuggestion",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),nu(new o6({id:"toggleSuggestionDetails",precondition:Lo.and(T5.Visible,T5.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:R5,group:"right",order:1,when:Lo.and(T5.DetailsVisible,T5.CanResolve),title:J(0,"show less")},{menuId:R5,group:"right",order:1,when:Lo.and(T5.DetailsVisible.toNegated(),T5.CanResolve),title:J(0,"show more")}]})),nu(new o6({id:"toggleExplainMode",precondition:T5.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),nu(new o6({id:"toggleSuggestionFocus",precondition:T5.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2570,mac:{primary:778}}})),nu(new o6({id:"insertBestCompletion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),m3.AtEnd,T5.Visible.toNegated(),w3.OtherSuggestions.toNegated(),s3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(O(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:r6,primary:2}})),nu(new o6({id:"insertNextSuggestion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),w3.OtherSuggestions,T5.Visible.toNegated(),s3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:2}})),nu(new o6({id:"insertPrevSuggestion",precondition:Lo.and(gS.textInputFocus,Lo.equals("config.editor.tabCompletion","on"),w3.OtherSuggestions,T5.Visible.toNegated(),s3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:r6,kbExpr:gS.textInputFocus,primary:1026}})),ru(class extends tu{constructor(){super({id:"editor.action.resetSuggestSize",label:J(0,"Reset Suggest Widget Size"),alias:"Reset Suggest Widget Size",precondition:void 0})}run(t,i){var e;null===(e=e6.get(i))||void 0===e||e.resetWidgetSize()}});class h6 extends Hi{get selectedItem(){return this._selectedItem}constructor(t,i,e,s){super(),this.editor=t,this.suggestControllerPreselector=i,this.checkModelVersion=e,this.onWillAccept=s,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._selectedItem=OH(this,void 0),this._register(t.onKeyDown((t=>{t.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))}))),this._register(t.onKeyUp((t=>{t.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))})));const n=e6.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(t,i,e)=>{var s;DH((t=>this.checkModelVersion(t)));const r=this.editor.getModel();if(!r)return-1;const o=null===(s=this.suggestControllerPreselector())||void 0===s?void 0:s.removeCommonPrefix(r);if(!o)return-1;const h=gs.lift(i),c=Of(e.map(((t,i)=>{const e=c6.fromSuggestion(n,r,h,t,this.isShiftKeyPressed).toSingleTextEdit().removeCommonPrefix(r);return{index:i,valid:o.augments(e),prefixLength:e.text.length,suggestItem:t}})).filter((t=>t&&t.valid&&t.prefixLength>0)),S((t=>t.prefixLength),x));return c?c.index:-1}}));let t=!1;const i=()=>{t||(t=!0,this._register(n.widget.value.onDidShow((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))),this._register(n.widget.value.onDidHide((()=>{this.isSuggestWidgetVisible=!1,this.update(!1)}))),this._register(n.widget.value.onDidFocus((()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))))};this._register(Ji.once(n.model.onDidTrigger)((()=>{i()}))),this._register(n.onWillInsertSuggestItem((t=>{const i=this.editor.getPosition(),e=this.editor.getModel();if(!i||!e)return;const s=c6.fromSuggestion(n,e,i,t.item,this.isShiftKeyPressed);this.onWillAccept(s)})))}this.update(this._isActive)}update(t){const i=this.getSuggestItemInfo();this._isActive===t&&function(t,i){return t===i||!(!t||!i)&&t.equals(i)}(this._currentSuggestItemInfo,i)||(this._isActive=t,this._currentSuggestItemInfo=i,DH((t=>{this.checkModelVersion(t),this._selectedItem.set(this._isActive?this._currentSuggestItemInfo:void 0,t)})))}getSuggestItemInfo(){const t=e6.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?c6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=e6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=e6.get(this.editor);null==t||t.forceRenderingAbove()}}class c6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new f5).parse(r);t.children.length<100&&X5.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new c6(ps.fromPositions(e.delta(0,-h.overwriteBefore),e.delta(0,Math.max(h.overwriteAfter,0))),r,s.completion.kind,o)}constructor(t,i,e,s){this.range=t,this.insertText=i,this.completionItemKind=e,this.isSnippetText=s}equals(t){return this.range.equalsRange(t.range)&&this.insertText===t.insertText&&this.completionItemKind===t.completionItemKind&&this.isSnippetText===t.isSnippetText}toSelectedSuggestionInfo(){return new Os(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}toSingleTextEdit(){return new y5(this.range,this.insertText)}}var l6,u6=function(t,i){return function(e,s){i(e,s,t)}};let a6=l6=class extends Hi{static get(t){return t.getContribution(l6.ID)}constructor(t,i,e,s,n,r,o,h,c){super(),this.editor=t,this.instantiationService=i,this.contextKeyService=e,this.configurationService=s,this.commandService=n,this.debounceService=r,this.languageFeaturesService=o,this.audioCueService=h,this._keybindingService=c,this.model=TH("inlineCompletionModel",void 0),this.textModelVersionId=OH(this,-1),this.cursorPosition=OH(this,new gs(1,1)),this.suggestWidgetAdaptor=this._register(new h6(this.editor,(()=>{var t,i;return null===(i=null===(t=this.model.get())||void 0===t?void 0:t.selectedInlineCompletion.get())||void 0===i?void 0:i.toSingleTextEdit(void 0)}),(t=>this.updateObservables(t,r3.Other)),(t=>{DH((i=>{var e;this.updateObservables(i,r3.Other),null===(e=this.model.get())||void 0===e||e.handleSuggestAccepted(t)}))}))),this._enabled=KH(this.editor.onDidChangeConfiguration,(()=>this.editor.getOption(62).enabled)),this.ghostTextWidget=this._register(this.instantiationService.createInstance(Y4,this.editor,{ghostText:this.model.map(((t,i)=>null==t?void 0:t.ghostText.read(i))),minReservedLineCount:zH(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 W4(this.contextKeyService,this.model)),this._register(Ji.runAndSubscribe(t.onDidChangeModel,(()=>DH((e=>{this.model.set(void 0,e),this.updateObservables(e,r3.Other);const s=t.getModel();if(s){const n=i.createInstance(c3,s,this.suggestWidgetAdaptor.selectedItem,this.cursorPosition,this.textModelVersionId,this._debounceValue,KH(t.onDidChangeConfiguration,(()=>t.getOption(117).preview)),KH(t.onDidChangeConfiguration,(()=>t.getOption(117).previewMode)),KH(t.onDidChangeConfiguration,(()=>t.getOption(62).mode)),this._enabled);this.model.set(n,e)}})))));const l=t=>{var i;return t.isUndoing?r3.Undo:t.isRedoing?r3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?r3.AcceptWord:r3.Other};let u;this._register(t.onDidChangeModelContent((t=>DH((i=>this.updateObservables(i,l(t))))))),this._register(t.onDidChangeCursorPosition((t=>DH((i=>{var e;this.updateObservables(i,r3.Other),3!==t.reason&&"api"!==t.source||null===(e=this.model.get())||void 0===e||e.stop(i)}))))),this._register(t.onDidType((()=>DH((t=>{var i;this.updateObservables(t,r3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([SS.Tab.id,SS.DeleteLeft.id,SS.DeleteRight.id,DX,"acceptSelectedSuggestion"]).has(i.commandId)&&t.hasTextFocus()&&this._enabled.get()&&DH((t=>{var i;null===(i=this.model.get())||void 0===i||i.trigger(t)}))}))),this._register(this.editor.onDidBlurEditorWidget((()=>{this.contextKeyService.getContextKeyValue("accessibleViewIsShown")||this.configurationService.getValue("editor.inlineSuggest.keepOnBlur")||t.getOption(62).keepOnBlur||BX.dropDownVisible||DH((t=>{var i;null===(i=this.model.get())||void 0===i||i.stop(t)}))}))),this._register(jH((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(jH((t=>{const i=this.model.read(t),e=null==i?void 0:i.state.read(t);if(i&&e&&e.inlineCompletion){if(e.inlineCompletion.semanticId!==u){u=e.inlineCompletion.semanticId;const t=i.textModel.getLineContent(e.ghostText.lineNumber);this.audioCueService.playAudioCue(QV.inlineSuggestion).then((()=>{this.editor.getOption(8)&&this.provideScreenReaderUpdate(e.ghostText.renderForScreenReader(t))}))}}else u=void 0}))),this._register(new IX(this.editor,this.model,this.instantiationService)),this._register(this.configurationService.onDidChangeConfiguration((t=>{t.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.inlineCompletions")})}))),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this.configurationService.getValue("accessibility.verbosity.inlineCompletions")})}provideScreenReaderUpdate(t){const i=this.contextKeyService.getContextKeyValue("accessibleViewIsShown"),e=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let s;!i&&e&&this.editor.getOption(147)&&(s=J(0,"Inspect this in the accessible view ({0})",e.getAriaLabel())),sm(s?t+", "+s:t)}updateObservables(t,i){var e,s;const n=this.editor.getModel();this.textModelVersionId.set(null!==(e=null==n?void 0:n.getVersionId())&&void 0!==e?e:-1,t,i),this.cursorPosition.set(null!==(s=this.editor.getPosition())&&void 0!==s?s:new gs(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 gs(e.lineNumber,i.column))))}shouldShowHoverAtViewZone(t){return this.ghostTextWidget.ownsViewZone(t)}};a6.ID="editor.contrib.inlineCompletionsController",a6=l6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([u6(1,Zr),u6(2,Jo),u6(3,Ta),u6(4,uo),u6(5,FF),u6(6,Wg),u6(7,GV),u6(8,CC)],a6);var d6=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 f6 extends tu{constructor(){super({id:f6.ID,label:J(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}f6.ID=AX;class g6 extends tu{constructor(){super({id:g6.ID,label:J(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}g6.ID=EX;class p6 extends tu{constructor(){super({id:p6.ID,label:J(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:W4.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return d6(this,void 0,void 0,(function*(){const t=a6.get(i);DH((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}p6.ID="editor.action.inlineSuggest.hide";class m6 extends Dh{constructor(){super({id:m6.ID,title:J(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:bh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Lo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return d6(this,void 0,void 0,(function*(){const i=t.get(Ta),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}m6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var v6=function(t,i){return function(e,s){i(e,s,t)}};class w6{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 b6=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=a6.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 wY(1e3,this,ps.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 wY(1e3,this,e.range,t.event.posx,t.event.posy,!1):null}computeSync(t,i){if("always"===this._editor.getOption(62).showToolbar)return[];const e=a6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new w6(this,t.range,e)]:[]}renderHoverParts(t,i){const e=new Vi,s=i[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(8)&&this.renderScreenReaderText(t,s,e);const n=s.controller.model.get(),r=this._instantiationService.createInstance(BX,this._editor,!1,zH(null),n.selectedInlineCompletionIndex,n.inlineCompletionsCount,n.selectedInlineCompletion.map((t=>{var i;return null!==(i=null==t?void 0:t.inlineCompletion.source.inlineCompletions.commands)&&void 0!==i?i:[]})));return t.fragment.appendChild(r.getDomNode()),n.triggerExplicitly(),e.add(r),e}renderScreenReaderText(t,i,e){const s=Pl,n=s("div.hover-row.markdown-hover"),r=Ol(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new JG({editor:this._editor},this._languageService,this._openerService));e.add(jH((s=>{var n;const h=null===(n=i.controller.model.read(s))||void 0===n?void 0:n.ghostText.read(s);if(h){const i=this._editor.getModel().getLineContent(h.lineNumber);(i=>{e.add(o.onDidRenderAsync((()=>{r.className="hover-contents code-hover-contents",t.onContentsChanged()})));const s=J(0,"Suggestion:"),n=e.add(o.render((new H_).appendText(s).appendCodeblock("text",i)));r.replaceChildren(n.element)})(h.renderForScreenReader(i))}else Tl(r)}))),t.fragment.appendChild(n)}};function y6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function k6(t,i,e){t=t<0?0:t;let s="";if(!e){const e=Math.floor(t/i);t%=i;for(let t=0;t<e;t++)s+="\t"}for(let i=0;i<t;i++)s+=" ";return s}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}([v6(1,Ba),v6(2,AF),v6(3,gm),v6(4,Zr),v6(5,Ah)],b6),hu(a6.ID,a6,3),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:J(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:gS.writable})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),ru(f6),ru(g6),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:J(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Lo.and(gS.writable,W4.inlineSuggestionVisible)},menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextWord(t.editor)}))}}),ru(class extends tu{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:J(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Lo.and(gS.writable,W4.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextLine(t.editor)}))}}),ru(class extends tu{constructor(){super({id:DX,label:J(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:W4.inlineSuggestionVisible,menuOpts:[{menuId:bh.InlineSuggestionToolbar,title:J(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Lo.and(W4.inlineSuggestionVisible,gS.tabMovesFocus.toNegated(),W4.inlineSuggestionHasIndentationLessThanTabSize,T5.Visible.toNegated(),gS.hoverFocused.toNegated())}})}run(t,i){var e;return d6(this,void 0,void 0,(function*(){const t=a6.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),ru(p6),Eh(m6),bY.register(b6);function C6(t,i,e,s,n){if(1===t.getLineCount()&&1===t.getLineMaxColumn(1))return[];const r=i.getLanguageConfiguration(t.getLanguageId()).indentationRules;if(!r)return[];for(s=Math.min(s,t.getLineCount());e<=s&&r.unIndentedLinePattern;){const i=t.getLineContent(e);if(!r.unIndentedLinePattern.test(i))break;e++}if(e>s-1)return[];const{tabSize:o,indentSize:h,insertSpaces:c}=t.getOptions(),l=(t,i)=>iS.shiftIndent(t,t.length+(i=i||1),o,h,c),u=(t,i)=>iS.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=jn(f);g=d+f.substring(t.length),r.decreaseIndentPattern&&r.decreaseIndentPattern.test(g)&&(d=u(d),g=d+f.substring(t.length)),f!==g&&a.push(OT.replaceMove(new ms(e,1,e,t.length+1),EC(d,h,c)))}else d=jn(f);let p=d;r.increaseIndentPattern&&r.increaseIndentPattern.test(g)?(p=l(p),d=l(d)):r.indentNextLinePattern&&r.indentNextLinePattern.test(g)&&(p=l(p));for(let i=++e;i<=s;i++){const e=t.getLineContent(i),s=jn(e),n=p+e.substring(s.length);r.decreaseIndentPattern&&r.decreaseIndentPattern.test(n)&&(p=u(p),d=u(d)),s!==p&&a.push(OT.replaceMove(new ms(i,1,i,s.length+1),EC(p,h,c))),r.unIndentedLinePattern&&r.unIndentedLinePattern.test(e)||(r.increaseIndentPattern&&r.increaseIndentPattern.test(n)?(d=l(d),p=d):p=r.indentNextLinePattern&&r.indentNextLinePattern.test(n)?l(p):d)}return a}class S6 extends tu{constructor(){super({id:S6.ID,label:J(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:gS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new R6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}S6.ID="editor.action.indentationToSpaces";class x6 extends tu{constructor(){super({id:x6.ID,label:J(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:gS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new _6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}x6.ID="editor.action.indentationToTabs";class D6 extends tu{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(Ij),s=t.get(Xr),n=i.getModel();if(!n)return;const r=s.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget),o=n.getOptions(),h=[1,2,3,4,5,6,7,8].map((t=>({id:t.toString(),label:t.toString(),description:t===r.tabSize&&t===o.tabSize?J(0,"Configured Tab Size"):t===r.tabSize?J(0,"Default Tab Size"):t===o.tabSize?J(0,"Current Tab Size"):void 0}))),c=Math.min(n.getOptions().tabSize-1,7);setTimeout((()=>{e.pick(h,{placeHolder:J(0,"Select Tab Size for Current File"),activeItem:h[c]}).then((t=>{if(t&&n&&!n.isDisposed()){const i=parseInt(t.label,10);n.updateOptions(this.displaySizeOnly?{tabSize:i}:{tabSize:i,indentSize:i,insertSpaces:this.insertSpaces})}}))}),50)}}class E6 extends D6{constructor(){super(!1,!1,{id:E6.ID,label:J(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}E6.ID="editor.action.indentUsingTabs";class A6 extends D6{constructor(){super(!0,!1,{id:A6.ID,label:J(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}A6.ID="editor.action.indentUsingSpaces";class M6 extends D6{constructor(){super(!0,!0,{id:M6.ID,label:J(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}M6.ID="editor.action.changeTabDisplaySize";class L6 extends tu{constructor(){super({id:L6.ID,label:J(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Xr),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}L6.ID="editor.action.detectIndentation";class O6{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(ps.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 F6=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(12)<4||this.editor.getOption(55)||this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste((({range:t})=>{this.trigger(t)})))}trigger(t){const i=this.editor.getSelections();if(null===i||i.length>1)return;const e=this.editor.getModel();if(!e)return;if(!e.tokenization.isCheapToTokenize(t.getStartPosition().lineNumber))return;const s=this.editor.getOption(12),{tabSize:n,indentSize:r,insertSpaces:o}=e.getOptions(),h=[],c={shiftIndent:t=>iS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>iS.unshiftIndent(t,t.length+1,n,r,o)};let l=t.startLineNumber;for(;l<=t.endLineNumber&&this.shouldIgnoreLine(e,l);)l++;if(l>t.endLineNumber)return;let u=e.getLineContent(l);if(!/\S/.test(u.substring(0,t.startColumn-1))){const t=rS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=jn(u),s=y6(t,n);if(s!==y6(i,n)){const t=k6(s,n,o);h.push({range:new ps(l,1,l,i.length+1),text:t}),u=t+u.substr(i.length)}else{const t=oS(e,l,this._languageConfigurationService);if(0===t||8===t)return}}}const a=l;for(;l<t.endLineNumber&&!/\S/.test(e.getLineContent(l+1));)l++;if(l!==t.endLineNumber){const i=rS(s,{tokenization:{getLineTokens:t=>e.tokenization.getLineTokens(t),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,i)=>e.getLanguageIdAtPosition(t,i)},getLineContent:t=>t===a?u:e.getLineContent(t)},e.getLanguageId(),l+1,c,this._languageConfigurationService);if(null!==i){const s=y6(i,n),r=y6(jn(e.getLineContent(l+1)),n);if(s!==r){const i=s-r;for(let s=l+1;s<=t.endLineNumber;s++){const t=jn(e.getLineContent(s)),r=k6(y6(t,n)+i,n,o);r!==t&&h.push({range:new ps(s,1,s,t.length+1),text:r})}}}}if(h.length>0){this.editor.pushUndoStop();const t=new O6(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 T6(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 ps(e,1,e,o),c=t.getValueInRange(h),l=s?c.replace(/\t/gi,n):c.replace(r,"\t");i.addEditOperation(h,l)}}F6.ID="editor.contrib.autoIndentOnPaste",F6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,ud)],F6);class R6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),T6(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class _6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),T6(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}hu(F6.ID,F6,2),ru(S6),ru(x6),ru(E6),ru(A6),ru(M6),ru(L6),ru(class extends tu{constructor(){super({id:"editor.action.reindentlines",label:J(0,"Reindent Lines"),alias:"Reindent Lines",precondition:gS.writable})}run(t,i){const e=t.get(ud),s=i.getModel();if(!s)return;const n=C6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),ru(class extends tu{constructor(){super({id:"editor.action.reindentselectedlines",label:J(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:gS.writable})}run(t,i){const e=t.get(ud),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=C6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});var I6=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 P6{constructor(t,i){this.range=t,this.direction=i}}class N6{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new N6(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return I6(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 I6(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 B6{static create(t,i,e,s){return I6(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>I6(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 B6(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=B6._getRangeAtPosition(e,t);let h;o.getStartPosition().isBefore(t)?(h=ps.fromPositions(o.getStartPosition(),t),r="after"):(h=ps.fromPositions(t,o.getEndPosition()),r="before"),s.push(new N6(i,new P6(h,r),n))}}this.items=s.sort(((t,i)=>gs.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 ps(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 ps(e,h+1,e,c+1)}}var $6=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 j6(t,i,e,s){var n;return $6(this,void 0,void 0,(function*(){const r=t.get(to),o=t.get(AR),h=t.get(uo),c=t.get(Zr),l=t.get(vO);if(yield s.item.resolve(ue.None),!s.part.location)return;const u=s.part.location,a=[],d=new Set(Ch.getMenuItems(bh.EditorContext).map((t=>wh(t)?t.command.id:d0())));for(const t of iY.all())d.has(t.desc.id)&&a.push(new no(t.desc.id,xh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>$6(this,void 0,void 0,(function*(){const e=yield r.createModelReference(u.uri);try{const n=new tY(e.object.textEditorModel,ps.getStartPosition(u.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 oo),a.push(new no(t.id,t.title,void 0,!0,(()=>$6(this,void 0,void 0,(function*(){var i;try{yield h.executeCommand(t.id,...null!==(i=t.arguments)&&void 0!==i?i:[])}catch(t){l.notify({severity:mO.Error,source:s.item.provider.displayName,message:t})}})))))}const f=i.getOption(126);o.showContextMenu({domForShadowRoot:f&&null!==(n=i.getDomNode())&&void 0!==n?n:void 0,getAnchor:()=>{const t=cl(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function W6(t,i,e,s){return $6(this,void 0,void 0,(function*(){const n=t.get(to),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>$6(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Jo),h=qJ.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new eY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new tY(r.object.textEditorModel,ps.getStartPosition(s.range)),ps.lift(s.range))})))),r.dispose()}))}var V6,H6=function(t,i){return function(e,s){i(e,s,t)}},z6=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 U6{constructor(){this._entries=new lg(50)}get(t){const i=U6._key(t);return this._entries.get(i)}set(t,i){const e=U6._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const K6=Qr("IInlayHintsCache");Wa(K6,U6,1);class q6{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 G6{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let Z6=V6=class{static get(t){var i;return null!==(i=t.getContribution(V6.ID))&&void 0!==i?i:void 0}constructor(t,i,e,s,n,r,o){this._editor=t,this._languageFeaturesService=i,this._inlayHintsCache=s,this._commandService=n,this._notificationService=r,this._instaService=o,this._disposables=new Vi,this._sessionDisposables=new Vi,this._decorationsMetadata=new Map,this._ruleFactory=new Ub(this._editor),this._activeRenderMode=0,this._debounceInfo=e.for(i.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(i.inlayHintsProvider.onDidChange((()=>this._update()))),this._disposables.add(t.onDidChangeModel((()=>this._update()))),this._disposables.add(t.onDidChangeModelLanguage((()=>this._update()))),this._disposables.add(t.onDidChangeConfiguration((t=>{t.hasChanged(139)&&this._update()}))),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const t=this._editor.getOption(139);if("off"===t.enabled)return;const i=this._editor.getModel();if(!i||!this._languageFeaturesService.inlayHintsProvider.has(i))return;const e=this._inlayHintsCache.get(i);let s;e&&this._updateHintsDecorators([i.getFullModelRange()],e),this._sessionDisposables.add(Wi((()=>{i.isDisposed()||this._cacheHintsForFastRestore(i)})));const n=new Set,r=new Mu((()=>z6(this,void 0,void 0,(function*(){const t=Date.now();null==s||s.dispose(!0),s=new de;const e=i.onWillDispose((()=>null==s?void 0:s.cancel()));try{const o=s.token,h=yield B6.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(Ul.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 IJ(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 de;e.add(Wi((()=>r.dispose(!0)))),s.item.resolve(r.token),this._activeInlayHintPart=s.part.command||s.part.location?new G6(s,i.hasTriggerModifier):void 0;const o=n.validatePosition(s.item.hint.position).lineNumber,h=new ps(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=>z6(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(W6,t,this._editor,e.location):Rs.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=>z6(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(ue.None),a(e.item.hint.textEdits))){const i=e.item.hint.textEdits.map((t=>OT.replace(ps.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>z6(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(j6,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 BM&&(null==e?void 0:e.attachedData)instanceof q6?e.attachedData:void 0}_invokeCommand(t,i){var e;return z6(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:mO.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 P6(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(ps.compareRangesUsingStarts)){const i=t.validateRange(new ps(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));0!==e.length&&ps.areIntersectingOrTouching(e[e.length-1],i)?e[e.length-1]=ps.plusRange(e[e.length-1],i):e.push(i)}return e}_updateHintsDecorators(t,i){var e,s;const n=[],r=(t,i,e,s,r)=>{const o={content:e,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:i.className,cursorStops:s,attachedData:r};n.push({item:t,classNameRef:i,decoration:{range:t.anchor.range,options:{description:"InlayHint",showIfCollapsed:t.anchor.range.isEmpty(),collapseOnReplaceEdit:!t.anchor.range.isEmpty(),stickiness:0,[t.anchor.direction]:0===this._activeRenderMode?o:void 0}}})},o=(t,i)=>{const e=this._ruleFactory.createClassNameRef({width:(h/3|0)+"px",display:"inline-block"});r(t,e," ",i?sf.Right:sf.None)},{fontSize:h,fontFamily:c,padding:l,isUniform:u}=this._getLayoutInfo(),d="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(d,c);for(const t of i){t.hint.paddingLeft&&o(t,!1);const i="string"==typeof t.hint.label?[{label:t.hint.label}]:t.hint.label;for(let s=0;s<i.length;s++){const n=i[s],o=0===s,c=s===i.length-1,f={fontSize:`${h}px`,fontFamily:`var(${d}), ${ki.fontFamily}`,verticalAlign:u?"baseline":"middle",unicodeBidi:"isolate"};a(t.hint.textEdits)&&(f.cursor="default"),this._fillInColors(f,t.hint),(n.command||n.location)&&(null===(e=this._activeInlayHintPart)||void 0===e?void 0:e.part.item)===t&&this._activeInlayHintPart.part.index===s&&(f.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(f.color=vk(tw),f.cursor="pointer")),l&&(o&&c?(f.padding=`1px ${0|Math.max(1,h/4)}px`,f.borderRadius=(h/4|0)+"px"):o?(f.padding=`1px 0 1px ${0|Math.max(1,h/4)}px`,f.borderRadius=`${h/4|0}px 0 0 ${h/4|0}px`):c?(f.padding=`1px ${0|Math.max(1,h/4)}px 1px 0`,f.borderRadius=`0 ${h/4|0}px ${h/4|0}px 0`):f.padding="1px 0 1px 0"),r(t,this._ruleFactory.createClassNameRef(f),n.label.replace(/[ \t]/g," "),c&&!t.hint.paddingRight?sf.Right:sf.None,new q6(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>V6._MAX_DECORATORS)break}const f=[];for(const i of t)for(const{id:t}of null!==(s=this._editor.getDecorationsInRange(i))&&void 0!==s?s:[]){const i=this._decorationsMetadata.get(t);i&&(f.push(t),i.classNameRef.dispose(),this._decorationsMetadata.delete(t))}const g=tU.capture(this._editor);this._editor.changeDecorations((t=>{const i=t.deltaDecorations(f,n.map((t=>t.decoration)));for(let t=0;t<i.length;t++)this._decorationsMetadata.set(i[t],n[t])})),g.restore(this._editor)}_fillInColors(t,i){i.kind===_s.Parameter?(t.backgroundColor=vk(ow),t.color=vk(rw)):i.kind===_s.Type?(t.backgroundColor=vk(nw),t.color=vk(sw)):(t.backgroundColor=vk(ew),t.color=vk(iw))}_getLayoutInfo(){const t=this._editor.getOption(139),i=t.padding,e=this._editor.getOption(52),s=this._editor.getOption(49);let n=t.fontSize;(!n||n<5||n>e)&&(n=e);const r=t.fontFamily||s;return{fontSize:n,fontFamily:r,padding:i,isUniform:!i&&r===s&&n===e}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const t of this._decorationsMetadata.values())t.classNameRef.dispose();this._decorationsMetadata.clear()}};Z6.ID="editor.contrib.InlayHints",Z6._MAX_DECORATORS=1500,Z6=V6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([H6(1,Wg),H6(2,FF),H6(3,K6),H6(4,uo),H6(5,vO),H6(6,Zr)],Z6),ao.registerCommand("_executeInlayHintProvider",((t,...i)=>z6(void 0,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e)),B(ps.isIRange(s));const{inlayHintsProvider:n}=t.get(Wg),r=yield t.get(to).createModelReference(e);try{const t=yield B6.create(n,r.object.textEditorModel,[ps.lift(s)],ue.None),i=t.items.map((t=>t.hint));return setTimeout((()=>t.dispose()),0),i}finally{r.dispose()}}))));var J6=function(t,i){return function(e,s){i(e,s,t)}},Q6=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 extends wY{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let X6=class extends HY{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!Z6.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 BM&&e.attachedData instanceof q6?new Y6(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof Y6?new Ru((i=>Q6(this,void 0,void 0,(function*(){var s,n,r;const{part:o}=t;if(yield o.item.resolve(e),e.isCancellationRequested)return;let h,c;if("string"==typeof o.item.hint.tooltip?h=(new H_).appendText(o.item.hint.tooltip):o.item.hint.tooltip&&(h=o.item.hint.tooltip),h&&i.emitOne(new VY(this,t.range,[h],!1,0)),a(o.item.hint.textEdits)&&i.emitOne(new VY(this,t.range,[(new H_).appendText(J(0,"Double-click to insert"))],!1,10001)),"string"==typeof o.part.tooltip?c=(new H_).appendText(o.part.tooltip):o.part.tooltip&&(c=o.part.tooltip),c&&i.emitOne(new VY(this,t.range,[c],!1,1)),o.part.location||o.part.command){let e;const s=J(0,"altKey"===this._editor.getOption(77)?ft?"cmd + click":"ctrl + click":ft?"option + click":"alt + click");o.part.location&&o.part.command?e=(new H_).appendText(J(0,"Go to Definition ({0}), right click for more",s)):o.part.location?e=(new H_).appendText(J(0,"Go to Definition ({0})",s)):o.part.command&&(e=new H_(`[${J(0,"Execute Command")}](${l=o.part.command,ss.from({scheme:Vc.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${o.part.command.title}") (${s})`,{isTrusted:!0})),e&&i.emitOne(new VY(this,t.range,[e],!1,1e4))}var l;const u=yield this._resolveInlayHintLabelPartHover(o,e);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)}))}}}(u);!(s=(d=yield g.next()).done);f=!0)f=!1,i.emitOne(d.value)}catch(t){n={error:t}}finally{try{f||s||!(r=g.return)||(yield r.call(g))}finally{if(n)throw n.error}}})))):Ru.EMPTY}_resolveInlayHintLabelPartHover(t,i){return Q6(this,void 0,void 0,(function*(){if(!t.part.location)return Ru.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)?$Y(this._languageFeaturesService.hoverProvider,e,new gs(s.startLineNumber,s.startColumn),i).filter((t=>!z_(t.hover.contents))).map((i=>new VY(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):Ru.EMPTY}finally{n.dispose()}}))}};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}([J6(1,Ba),J6(2,AF),J6(3,Ta),J6(4,to),J6(5,Wg)],X6),hu(Z6.ID,Z6,1),bY.register(X6);class t9{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 ms(e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn),e.endLineNumber,Math.min(this._originalSelection.positionColumn,e.endColumn)):new ms(e.endLineNumber,e.endColumn-this._text.length,e.endLineNumber,e.endColumn)}}var i9;let e9=i9=class{static get(t){return t.getContribution(i9.ID)}constructor(t,i){this.editor=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(t,i){var e;null===(e=this.currentRequest)||void 0===e||e.cancel();const s=this.editor.getSelection(),n=this.editor.getModel();if(!n||!s)return;let r=s;if(r.startLineNumber!==r.endLineNumber)return;const o=new rK(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=wu((()=>this.editorWorkerService.navigateValueSet(h,r,i))),this.currentRequest.then((i=>{var e;if(!i||!i.range||!i.value)return;if(!o.validate(this.editor))return;const s=ps.lift(i.range);let n=i.range;const h=i.value.length-(r.endColumn-r.startColumn);n={startLineNumber:n.startLineNumber,startColumn:n.startColumn,endLineNumber:n.endLineNumber,endColumn:n.startColumn+i.value.length},h>1&&(r=new ms(r.startLineNumber,r.startColumn,r.endLineNumber,r.endColumn+h-1));const c=new t9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:i9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=Su(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};e9.ID="editor.contrib.inPlaceReplaceController",e9.DECORATION=$M.register({description:"in-place-replace",className:"valueSetReplacement"}),e9=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,MN)],e9),hu(e9.ID,e9,4),ru(class extends tu{constructor(){super({id:"editor.action.inPlaceReplace.up",label:J(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=e9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),ru(class extends tu{constructor(){super({id:"editor.action.inPlaceReplace.down",label:J(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=e9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),ru(class extends tu{constructor(){super({id:"expandLineSelection",label:J(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:gS.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,ZC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class s9{constructor(t,i){this._selection=t,this._cursors=i,this._selectionId=null}getEditOperations(t,i){const e=function(t,i){i.sort(((t,i)=>t.lineNumber===i.lineNumber?t.column-i.column:t.lineNumber-i.lineNumber));for(let t=i.length-2;t>=0;t--)i[t].lineNumber===i[t+1].lineNumber&&i.splice(t,1);const e=[];let s=0,n=0;const r=i.length;for(let o=1,h=t.getLineCount();o<=h;o++){const h=t.getLineContent(o),c=h.length+1;let l=0;if(n<r&&i[n].lineNumber===o&&(l=i[n].column,n++,l===c))continue;if(0===h.length)continue;const u=Wn(h);let a=0;if(-1===u)a=1;else{if(u===h.length-1)continue;a=u+2}a=Math.max(l,a),e[s++]=OT.delete(new ps(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 n9{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 ps(e.endLineNumber,t.getLineMaxColumn(e.endLineNumber),e.endLineNumber+1,1),e.endLineNumber===t.getLineCount()?"":"\n"):this._isCopyingDown?i.addEditOperation(new ps(e.startLineNumber,1,e.startLineNumber,1),n+"\n"):i.addEditOperation(new ps(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=ms.createWithDirection(t,i,s,n,this._selectionDirection)}return e}}let r9=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 ps(1,1,1,1),null):(i.addEditOperation(new ps(e,1,e,1),t.getLineContent(n)),i.addEditOperation(new ps(n,1,n,t.getLineMaxColumn(n)),null)),s=new ms(n,1,n,1)}else{let e,r;if(this._isMovingDown){e=s.endLineNumber+1,r=t.getLineContent(e),i.addEditOperation(new ps(e-1,t.getLineMaxColumn(e-1),e,t.getLineMaxColumn(e)),null);let l=r;if(this.shouldAutoIndent(t,s)){const u=this.matchEnterRule(t,h,n,e,s.startLineNumber-1);if(null!==u){const i=k6(u+y6(jn(t.getLineContent(e)),n),n,o);l=i+this.trimStart(r)}else{c.getLineContent=i=>t.getLineContent(i===s.startLineNumber?e:i);const i=rS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=jn(t.getLineContent(e)),h=y6(i,n);if(h!==y6(s,n)){const t=k6(h,n,o);l=t+this.trimStart(r)}}}i.addEditOperation(new ps(s.startLineNumber,1,s.startLineNumber,1),l+"\n");const a=this.matchEnterRuleMovingDown(t,h,n,s.startLineNumber,e,l);if(null!==a)0!==a&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,a);else{c.getLineContent=i=>i===s.startLineNumber?l:t.getLineContent(i>=s.startLineNumber+1&&i<=s.endLineNumber+1?i-1:i);const r=rS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=y6(r,n),c=y6(e,n);h!==c&&this.getIndentEditsOfMovingBlock(t,i,s,n,o,h-c)}}}else i.addEditOperation(new ps(s.startLineNumber,1,s.startLineNumber,1),l+"\n")}else if(e=s.startLineNumber-1,r=t.getLineContent(e),i.addEditOperation(new ps(e,1,e+1,1),null),i.addEditOperation(new ps(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=rS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=y6(r,n),c=y6(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=>iS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>iS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Ju.None||n.indentAction===Ju.Indent?r=n.indentation+n.appendText:n.indentAction===Ju.IndentOutdent?r=n.indentation:n.indentAction===Ju.Outdent&&(r=i.unshiftIndent(n.indentation)+n.appendText);const o=t.getLineContent(s);if(this.trimStart(o).indexOf(this.trimStart(r))>=0){const n=jn(t.getLineContent(s));let o=jn(r);const h=oS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),y6(o,e)-y6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(Wn(r)>=0){const r=t.getLineMaxColumn(n),o=QC(this._autoIndent,t,new ps(n,r,n,r),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,o)}{let n=s-1;for(;n>=1&&!(Wn(t.getLineContent(n))>=0);)n--;if(n<1||s>t.getLineCount())return null;const r=t.getLineMaxColumn(n),o=QC(this._autoIndent,t,new ps(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),Wn(i)>=0)break;o--}if(o<1||s>t.getLineCount())return null;const h=t.getLineMaxColumn(o),c=QC(this._autoIndent,t,new ps(o,h,o,h),this._languageConfigurationService);return this.parseEnterResult(t,i,e,s,c)}trimStart(t){return t.replace(/^\s+/,"")}shouldAutoIndent(t,i){if(this._autoIndent<4)return!1;if(!t.tokenization.isCheapToTokenize(i.startLineNumber))return!1;const e=t.getLanguageIdAtPosition(i.startLineNumber,1);return e===t.getLanguageIdAtPosition(i.endLineNumber,1)&&null!==this._languageConfigurationService.getLanguageConfiguration(e).indentRulesSupport}getIndentEditsOfMovingBlock(t,i,e,s,n,r){for(let o=e.startLineNumber;o<=e.endLineNumber;o++){const h=jn(t.getLineContent(o)),c=k6(y6(h,s)+r,s,n);c!==h&&(i.addEditOperation(new ps(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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,ud)],r9);class o9{static getCollator(){return o9._COLLATOR||(o9._COLLATOR=new Intl.Collator),o9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=h9(t,i,e);return s?OT.replace(new ps(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=h9(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 h9(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(o9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}o9._COLLATOR=null;class c9 extends tu{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)=>ps.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 n9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class l9 extends tu{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(ud),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new r9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class u9 extends tu{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!o9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new o9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class a9 extends tu{constructor(){super({id:a9.ID,label:J(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:xe(2089,2102),weight:100}})}run(t,i,e){let s=[];"auto-save"===e.reason&&(s=(i.getSelections()||[]).map((t=>new gs(t.positionLineNumber,t.positionColumn))));const n=i.getSelection();if(null===n)return;const r=new s9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}a9.ID="editor.action.trimTrailingWhitespace";class d9 extends tu{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===ps.intersectRanges(i,e)?n.push(i):s[t+1]=ps.plusRange(i,e)}n.push(s[s.length-1]);const r=this._getEndCursorState(e,n),o=n.map((t=>OT.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class f9 extends tu{run(t,i){const e=i.getSelections();if(null===e)return;const s=i.getModel();if(null===s)return;const n=i.getOption(129),r=[];for(const t of e)if(t.isEmpty()){const e=t.getStartPosition(),o=i.getConfiguredWordAtPosition(e);if(!o)continue;const h=new ps(e.lineNumber,o.startColumn,e.lineNumber,o.endColumn),c=s.getValueInRange(h);r.push(OT.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(OT.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class g9{constructor(t,i){this._pattern=t,this._flags=i,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(t){}}return this._actual}isSupported(){return null!==this.get()}}class p9 extends f9{constructor(){super({id:"editor.action.transformToTitlecase",label:J(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:gS.writable})}_modifyText(t,i){const e=p9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}p9.titleBoundary=new g9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class m9 extends f9{constructor(){super({id:"editor.action.transformToSnakecase",label:J(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:gS.writable})}_modifyText(t,i){const e=m9.caseBoundary.get(),s=m9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}m9.caseBoundary=new g9("(\\p{Ll})(\\p{Lu})","gmu"),m9.singleLetters=new g9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class v9 extends f9{constructor(){super({id:"editor.action.transformToCamelcase",label:J(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:gS.writable})}_modifyText(t,i){const e=v9.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("")}}v9.wordBoundary=new g9("[_\\s-]","gm");class w9 extends f9{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((t=>t.isSupported()))}constructor(){super({id:"editor.action.transformToKebabcase",label:J(0,"Transform to Kebab Case"),alias:"Transform to Kebab Case",precondition:gS.writable})}_modifyText(t,i){const e=w9.caseBoundary.get(),s=w9.singleLetters.get(),n=w9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}w9.caseBoundary=new g9("(\\p{Ll})(\\p{Lu})","gmu"),w9.singleLetters=new g9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),w9.underscoreBoundary=new g9("(\\S)(_)(\\S)","gm"),ru(class extends c9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:J(0,"Copy Line Up"),alias:"Copy Line Up",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"&&Copy Line Up"),order:1}})}}),ru(class extends c9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:J(0,"Copy Line Down"),alias:"Copy Line Down",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Co&&py Line Down"),order:2}})}}),ru(class extends tu{constructor(){super({id:"editor.action.duplicateSelection",label:J(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:gS.writable,menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(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 n9(t,!0));else{const i=new ms(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new $C(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),ru(class extends l9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:J(0,"Move Line Up"),alias:"Move Line Up",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Mo&&ve Line Up"),order:3}})}}),ru(class extends l9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:J(0,"Move Line Down"),alias:"Move Line Down",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"2_line",title:J(0,"Move &&Line Down"),order:4}})}}),ru(class extends u9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:J(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:gS.writable})}}),ru(class extends u9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:J(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:gS.writable})}}),ru(class extends tu{constructor(){super({id:"editor.action.removeDuplicateLines",label:J(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:gS.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 ms(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),c=t.startLineNumber-r,l=new ms(c,1,c+o.length-1,o[o.length-1].length);s.push(OT.replace(h,o.join("\n"))),n.push(l),r+=t.endLineNumber-t.startLineNumber+1-o.length}i.pushUndoStop(),i.executeEdits(this.id,s,n),i.pushUndoStop()}}),ru(a9),ru(class extends tu{constructor(){super({id:"editor.action.deleteLines",label:J(0,"Delete Line"),alias:"Delete Line",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:3113,weight:100}})}run(t,i){if(!i.hasModel())return;const e=this._getLinesToRemove(i),s=i.getModel();if(1===s.getLineCount()&&1===s.getLineMaxColumn(1))return;let n=0;const r=[],o=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];let h=i.startLineNumber,c=i.endLineNumber,l=1,u=s.getLineMaxColumn(c);c<s.getLineCount()?(c+=1,u=1):h>1&&(h-=1,l=s.getLineMaxColumn(h)),r.push(OT.replace(new ms(h,l,c,u),"")),o.push(new ms(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}}),ru(class extends tu{constructor(){super({id:"editor.action.indentLines",label:J(0,"Indent Line"),alias:"Indent Line",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),ru(class extends tu{constructor(){super({id:"editor.action.outdentLines",label:J(0,"Outdent Line"),alias:"Outdent Line",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2140,weight:100}})}run(t,i){SS.Outdent.runEditorCommand(t,i,null)}}),ru(class extends tu{constructor(){super({id:"editor.action.insertLineBefore",label:J(0,"Insert Line Above"),alias:"Insert Line Above",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),ru(class extends tu{constructor(){super({id:"editor.action.insertLineAfter",label:J(0,"Insert Line Below"),alias:"Insert Line Below",precondition:gS.writable,kbOpts:{kbExpr:gS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,hS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),ru(class extends d9{constructor(){super({id:"deleteAllLeft",label:J(0,"Delete All Left"),alias:"Delete All Left",precondition:gS.writable,kbOpts:{kbExpr:gS.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 ms(t,i.startColumn,t,i.startColumn)}else r=new ms(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(ps.compareRangesUsingStarts),e=e.map((t=>{if(t.isEmpty()){if(1===t.startColumn){const i=Math.max(1,t.startLineNumber-1),e=1===t.startLineNumber?1:s.getLineLength(i)+1;return new ps(i,e,t.startLineNumber,1)}return new ps(t.startLineNumber,1,t.startLineNumber,t.startColumn)}return new ps(t.startLineNumber,1,t.endLineNumber,t.endColumn)})),e)}}),ru(class extends d9{constructor(){super({id:"deleteAllRight",label:J(0,"Delete All Right"),alias:"Delete All Right",precondition:gS.writable,kbOpts:{kbExpr:gS.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 ms(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 ps(t.startLineNumber,t.startColumn,t.startLineNumber+1,1):new ps(t.startLineNumber,t.startColumn,t.startLineNumber,e)}return t}));return s.sort(ps.compareRangesUsingStarts),s}}),ru(class extends tu{constructor(){super({id:"editor.action.joinLines",label:J(0,"Join Lines"),alias:"Join Lines",precondition:gS.writable,kbOpts:{kbExpr:gS.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(ps.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 ms(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn):i.startLineNumber>t.endLineNumber?(n.push(t),i):new ms(t.startLineNumber,t.startColumn,i.endLineNumber,i.endColumn)));n.push(r);const o=i.getModel();if(null===o)return;const h=[],c=[];let l=s,u=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.getLineLength(i.endLineNumber)-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 ps(e,r,a,d);if(!m.isEmpty()){let t;i.isEmpty()?(h.push(OT.replace(m,p)),t=new ms(m.startLineNumber-u,p.length-f+1,e-u,p.length-f+1)):i.startLineNumber===i.endLineNumber?(h.push(OT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.endLineNumber-u,i.endColumn)):(h.push(OT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.startLineNumber-u,p.length-g)),null!==ps.intersectRanges(m,s)?l=t:c.push(t)}u+=m.endLineNumber-m.startLineNumber}c.unshift(l),i.pushUndoStop(),i.executeEdits(this.id,h,c),i.pushUndoStop()}}),ru(class extends tu{constructor(){super({id:"editor.action.transpose",label:J(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:gS.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 ps(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new BC(new ms(r.lineNumber,Math.max(1,r.column-1),r.lineNumber+1,1),i))}else{const t=new ps(r.lineNumber,Math.max(1,r.column-1),r.lineNumber,r.column+1),i=s.getValueInRange(t).split("").reverse().join("");n.push(new VC(t,i,new ms(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),ru(class extends f9{constructor(){super({id:"editor.action.transformToUppercase",label:J(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:gS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),ru(class extends f9{constructor(){super({id:"editor.action.transformToLowercase",label:J(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:gS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),m9.caseBoundary.isSupported()&&m9.singleLetters.isSupported()&&ru(m9),v9.wordBoundary.isSupported()&&ru(v9),p9.titleBoundary.isSupported()&&ru(p9),w9.isSupported()&&ru(w9);var b9,y9=function(t,i){return function(e,s){i(e,s,t)}},k9=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 C9=new Zo("LinkedEditingInputVisible",!1);let S9=b9=class extends Hi{static get(t){return t.getContribution(b9.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=C9.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(69)||t.hasChanged(92))&&this.reinitialize(!1)}))),this._register(this._providers.onDidChange((()=>this.reinitialize(!1)))),this._register(this._editor.onDidChangeModelLanguage((()=>this.reinitialize(!0)))),this.reinitialize(!0)}reinitialize(t){const i=this._editor.getModel(),e=null!==i&&(this._editor.getOption(69)||this._editor.getOption(92))&&this._providers.has(i);if(e===this._enabled&&!t)return;if(this._enabled=e,this.clearRanges(),this._localToDispose.clear(),!e||null===i)return;this._localToDispose.add(Ji.runAndSubscribe(i.onDidChangeLanguageConfiguration,(()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition()})));const s=new ku(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 ku(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=Qn(t,r);o+=c,t=t.substr(c),r=r.substr(c);const l=Yn(t,r);h-=l,t=t.substr(0,t.length-l),r=r.substr(0,r.length-l),o===h&&0===r.length||n.push({range:new ps(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(t=!1){return k9(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return void this.clearRanges();const i=this._editor.getPosition();if(!this._enabled&&!t||this._editor.getSelections().length>1)return void this.clearRanges();const e=this._editor.getModel(),s=e.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===s){if(i.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const t=this._currentDecorations.getRange(0);if(t&&t.containsPosition(i))return}}this.clearRanges(),this._currentRequestPosition=i,this._currentRequestModelVersion=s;const n=wu((t=>k9(this,void 0,void 0,(function*(){try{const r=new Zi(!1),o=yield x9(this._providers,e,i,t);if(this._debounceInformation.update(e,r.elapsed()),n!==this._currentRequest)return;if(this._currentRequest=null,s!==e.getVersionId())return;let h=[];(null==o?void 0:o.ranges)&&(h=o.ranges),this._currentWordPattern=(null==o?void 0:o.wordPattern)||this._languageWordPattern;let c=!1;for(let t=0,e=h.length;t<e;t++)if(ps.containsPosition(h[t],i)){if(c=!0,0!==t){const i=h[t];h.splice(t,1),h.unshift(i)}break}if(!c)return void this.clearRanges();const l=h.map((t=>({range:t,options:b9.DECORATION})));this._visibleContextKey.set(!0),this._currentDecorations.set(l),this._syncRangesToken++}catch(t){Oi(t)||Ei(t),this._currentRequest!==n&&this._currentRequest||this.clearRanges()}}))));return this._currentRequest=n,n}))}};function x9(t,i,e,s){return Du(t.ordered(i).map((t=>()=>k9(this,void 0,void 0,(function*(){try{return yield t.provideLinkedEditingRanges(i,e,s)}catch(t){return void Ai(t)}})))),(t=>!!t&&a(null==t?void 0:t.ranges)))}S9.ID="editor.contrib.linkedEditing",S9.DECORATION=$M.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),S9=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}([y9(1,Jo),y9(2,Wg),y9(3,ud),y9(4,FF)],S9),nu(new(Xl.bindToContribution(S9.get))({id:"cancelLinkedEditingInput",precondition:C9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:gS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Om("editor.linkedEditingBackground",{dark:Mg.fromHex("#f00").transparent(.3),light:Mg.fromHex("#f00").transparent(.3),hcDark:Mg.fromHex("#f00").transparent(.3),hcLight:Mg.white},J(0,"Background color when the editor auto renames on type.")),su("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get(Wg);return x9(s,i,e,ue.None)})),hu(S9.ID,S9,1),ru(class extends tu{constructor(){super({id:"editor.action.linkedEditing",label:J(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Lo.and(gS.writable,gS.hasRenameProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(Yr),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return ss.isUri(s)&&gs.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=S9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var D9=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 E9{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 D9(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 A9{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new E9(t,s)));i=A9._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];ps.areIntersectingOrTouching(n.range,o.range)?s++:ps.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 M9(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 A9(c(s));return e.isCancellationRequested?(t.dispose(),new A9([])):t}))}ao.registerCommand("_executeLinkProvider",((t,...i)=>D9(void 0,void 0,void 0,(function*(){let[e,s]=i;B(e instanceof ss),"number"!=typeof s&&(s=0);const{linkProvider:n}=t.get(Wg),r=t.get(Xr).getModel(e);if(!r)return[];const o=yield M9(n,r,ue.None);if(!o)return[];for(let t=0;t<Math.min(s,o.links.length);t++)yield o.links[t].resolve(ue.None);const h=o.links.slice(0);return o.dispose(),h}))));var L9,O9=function(t,i){return function(e,s){i(e,s,t)}};let F9=L9=class extends Hi{static get(t){return t.getContribution(L9.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 Mu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new IJ(t));this._register(r.onMouseMoveOrRelevantKeyDown((([t,i])=>{this._onEditorMouseMove(t,i)}))),this._register(r.onExecute((t=>{this.onEditorMouseUp(t)}))),this._register(r.onCancel((()=>{this.cleanUpActiveLinkDecoration()}))),this._register(t.onDidChangeConfiguration((t=>{t.hasChanged(70)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))}))),this._register(t.onDidChangeModelContent((()=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))}))),this._register(t.onDidChangeModel((()=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)}))),this._register(t.onDidChangeModelLanguage((()=>{this.stop(),this.computeLinks.schedule(0)}))),this._register(this.providers.onDidChange((()=>{this.stop(),this.computeLinks.schedule(0)}))),this.computeLinks.schedule(0)}computeLinksNow(){return 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())}))}(this,void 0,void 0,(function*(){if(!this.editor.hasModel()||!this.editor.getOption(70))return;const t=this.editor.getModel();if(!t.isTooLargeForSyncing()&&this.providers.has(t)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=wu((i=>M9(this.providers,t,i)));try{const i=new Zi(!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}}}))}updateDecorations(t){const i="altKey"===this.editor.getOption(77),e=[],s=Object.keys(this.currentOccurrences);for(const t of s)e.push(this.currentOccurrences[t].decorationId);const n=[];if(t)for(const e of t)n.push(R9.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 R9(t[i],s[i]);this.currentOccurrences[e.decorationId]=e}}))}_onEditorMouseMove(t,i){const e="altKey"===this.editor.getOption(77);if(this.isEnabled(t,i)){this.cleanUpActiveLinkDecoration();const i=this.getLinkOccurrence(t.target.position);i&&this.editor.changeDecorations((t=>{i.activate(t,e),this.activeLinkDecorationId=i.decorationId}))}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const t="altKey"===this.editor.getOption(77);if(this.activeLinkDecorationId){const i=this.currentOccurrences[this.activeLinkDecorationId];i&&this.editor.changeDecorations((e=>{i.deactivate(e,t)})),this.activeLinkDecorationId=null}}onEditorMouseUp(t){if(!this.isEnabled(t))return;const i=this.getLinkOccurrence(t.target.position);i&&this.openLinkOccurrence(i,t.hasSideBySideModifier,!0)}openLinkOccurrence(t,i,e=!1){if(!this.openerService)return;const{link:s}=t;s.resolve(ue.None).then((t=>{if("string"==typeof t&&this.editor.hasModel()){const i=this.editor.getModel().uri;if(i.scheme===Vc.file&&t.startsWith(`${Vc.file}:`)){const e=ss.parse(t);if(e.scheme===Vc.file){const s=AE(e);let n=null;s.startsWith("/./")?n=`.${s.substr(1)}`:s.startsWith("//./")&&(n=`.${s.substr(2)}`),n&&(t=_E(i,n))}}}return this.openerService.open(t,{openToSide:i,fromUserGesture:e,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})}),(t=>{const i=t instanceof Error?t.message:t;"invalid"===i?this.notificationService.warn(J(0,"Failed to open this link because it is not well-formed: {0}",s.url.toString())):"missing"===i?this.notificationService.warn(J(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()}};F9.ID="editor.linkDetector",F9=L9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,AF),O9(2,vO),O9(3,Wg),O9(4,FF)],F9);const T9={general:$M.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:$M.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class R9{static decoration(t,i){return{range:t.range,options:R9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s=Object.assign({},e?T9.active:T9.general);return s.hoverMessage=function(t,i){const e=t.url&&/^command:/i.test(t.url.toString()),s=t.tooltip?t.tooltip:J(0,e?"Execute command":"Follow link"),n=J(0,i?ft?"cmd + click":"ctrl + click":ft?"option + click":"alt + click");if(t.url){let i="";if(/^command:/i.test(t.url.toString())){const e=t.url.toString().match(/^command:([^?#]+)/);e&&(i=J(0,"Execute command {0}",e[1]))}return new H_("",!0).appendLink(t.url.toString(!0).replace(/ /g,"%20"),s,i).appendMarkdown(` (${n})`)}return(new H_).appendText(`${s} (${n})`)}(t,i),s}constructor(t,i){this.link=t,this.decorationId=i}activate(t,i){t.changeDecorationOptions(this.decorationId,R9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,R9._getOptions(this.link,i,!1))}}hu(F9.ID,F9,1),ru(class extends tu{constructor(){super({id:"editor.action.openLink",label:J(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=F9.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 _9 extends Hi{constructor(t){super(),this._editor=t,this._register(this._editor.onMouseDown((t=>{const i=this._editor.getOption(116);i>=0&&6===t.target.type&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})})))}}_9.ID="editor.contrib.longLinesHelper",hu(_9.ID,_9,2);const I9=Om("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},J(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);Om("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},J(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),Om("editor.wordHighlightTextBackground",{light:I9,dark:I9,hcDark:I9,hcLight:I9},J(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 P9=Om("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Pm,hcLight:Pm},J(0,"Border color of a symbol during read-access, like reading a variable."));Om("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Pm,hcLight:Pm},J(0,"Border color of a symbol during write-access, like writing to a variable.")),Om("editor.wordHighlightTextBorder",{light:P9,dark:P9,hcDark:P9,hcLight:P9},J(0,"Border color of a textual occurrence for a symbol."));const N9=Om("editorOverviewRuler.wordHighlightForeground",{dark:"#A0A0A0CC",light:"#A0A0A0CC",hcDark:"#A0A0A0CC",hcLight:"#A0A0A0CC"},J(0,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),B9=Om("editorOverviewRuler.wordHighlightStrongForeground",{dark:"#C0A0C0CC",light:"#C0A0C0CC",hcDark:"#C0A0C0CC",hcLight:"#C0A0C0CC"},J(0,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),$9=Om("editorOverviewRuler.wordHighlightTextForeground",{dark:gb,light:gb,hcDark:gb,hcLight:gb},J(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),j9=$M.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:vk(B9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),W9=$M.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:vk($9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),V9=$M.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:vk(gb),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}}),H9=$M.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),z9=$M.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:vk(N9),position:Xd.Center},minimap:{color:vk(mb),position:ef.Inline}});function U9(t){return t?H9:V9}kk(((t,i)=>{const e=t.getColor(Uv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var K9;function q9(t,i){const e=i.filter((i=>!t.find((t=>t.equals(i)))));if(e.length>=1){const t=e.map((t=>`line ${t.viewState.position.lineNumber} column ${t.viewState.position.column}`)).join(", ");nm(J(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class G9{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class Z9{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new Z9(t,i,!1,e.searchString,e.wholeWord,e.matchCase,null);let s,n,r=!1;const o=t.getSelections();1===o.length&&o[0].isEmpty()?(r=!0,s=!0,n=!0):(s=e.wholeWord,n=e.matchCase);const h=t.getSelection();let c,l=null;if(h.isEmpty()){const i=t.getConfiguredWordAtPosition(h.getStartPosition());if(!i)return null;c=i.word,l=new ms(h.startLineNumber,i.startColumn,h.startLineNumber,i.endColumn)}else c=t.getModel().getValueInRange(h).replace(/\r\n/g,"\n");return new Z9(t,i,r,c,s,n,l)}constructor(t,i,e,s,n,r,o){this._editor=t,this.findController=i,this.isDisconnectedFromFindController=e,this.searchText=s,this.wholeWord=n,this.matchCase=r,this.currentMatch=o}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const t=this._getNextMatch();if(!t)return null;const i=this._editor.getSelections();return new G9(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 G9(i.slice(0,i.length-1).concat(t),t,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findNextMatch(this.searchText,i.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ms(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 G9(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 G9(i.slice(0,i.length-1).concat(t),t,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const t=this.currentMatch;return this.currentMatch=null,t}this.findController.highlightFindOptions();const t=this._editor.getSelections(),i=t[t.length-1],e=this._editor.getModel().findPreviousMatch(this.searchText,i.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1);return e?new ms(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn):null}selectAll(t){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();return this._editor.getModel().findMatches(this.searchText,t||!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(129):null,!1,1073741824)}}class J9 extends Hi{static get(t){return t.getContribution(J9.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=Z9.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 ms(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(!t7(this._editor.getModel(),i,e)){const t=this._editor.getModel(),e=[];for(let s=0,n=i.length;s<n;s++)e[s]=this._expandEmptyToWord(t,i[s]);return void this._editor.setSelections(e)}}}this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(t){this._beginSessionIfNeeded(t),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(t){if(!this._editor.hasModel())return;let i=null;const e=t.getState();if(e.isRevealed&&e.searchString.length>0&&e.isRegex){i=this._editor.getModel().findMatches(e.searchString,!e.searchScope||e.searchScope,e.isRegex,e.matchCase,e.wholeWord?this._editor.getOption(129):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(t),!this._session)return;i=this._session.selectAll(e.searchScope)}if(i.length>0){const t=this._editor.getSelection();for(let e=0,s=i.length;e<s;e++){const s=i[e];if(s.range.intersectRanges(t)){i[e]=i[0],i[0]=s;break}}this._setSelections(i.map((t=>new ms(t.range.startLineNumber,t.range.startColumn,t.range.endLineNumber,t.range.endColumn))))}}}J9.ID="editor.contrib.multiCursorController";class Q9 extends tu{run(t,i){const e=J9.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=j2.get(i);if(r)this._run(e,r);else{const s=t.get(Zr).createInstance(j2,i);this._run(e,s),s.dispose()}q9(n,s.getCursorStates())}}}class Y9{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(ps.compareRangesUsingStarts)),this._cachedFindMatches}}let X9=K9=class extends Hi{constructor(t,i){super(),this._languageFeaturesService=i,this.editor=t,this._isEnabled=t.getOption(107),this._decorations=t.createDecorationsCollection(),this.updateSoon=this._register(new Mu((()=>this._update()),300)),this.state=null,this._register(t.onDidChangeConfiguration((()=>{this._isEnabled=t.getOption(107)}))),this._register(t.onDidChangeCursorSelection((t=>{this._isEnabled&&(t.selection.isEmpty()?3===t.reason?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())}))),this._register(t.onDidChangeModel((()=>{this._setState(null)}))),this._register(t.onDidChangeModelContent((()=>{this._isEnabled&&this.updateSoon.schedule()})));const e=j2.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(K9._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=J9.get(e);if(!n)return null;const r=j2.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(!t7(e.getModel(),t,i))return null}o=Z9.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 Y9(e.getModel(),o.searchText,o.matchCase,o.wholeWord?e.getOption(129):null,t)}_setState(t){if(this.state=t,!this.state)return void this._decorations.clear();if(!this.editor.hasModel())return;const i=this.editor.getModel();if(i.isTooLargeForTokenization())return;const e=this.state.findMatches(),s=this.editor.getSelections();s.sort(ps.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=ps.compareRangesUsingStarts(r,s[i]);e<0?(!s[i].isEmpty()&&ps.areIntersecting(r,s[i])||n.push(r),t++):(e>0||t++,i++)}}const r=this._languageFeaturesService.documentHighlightProvider.has(i)&&this.editor.getOption(80),o=n.map((t=>({range:t,options:U9(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function t7(t,i,e){const s=i7(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!==i7(t,r,!e))return!1}return!0}function i7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}X9.ID="editor.contrib.selectionHighlighter",X9=K9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Wg)],X9),hu(J9.ID,J9,4),hu(X9.ID,X9,1),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorAbove",label:J(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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,ZC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorBelow",label:J(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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,ZC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:J(0,"Add Cursors to Line Ends"),alias:"Add Cursors to Line Ends",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(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 ms(s,t,s,t))}t.endColumn>1&&e.push(new ms(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),q9(r,n.getCursorStates())}}),ru(class extends Q9{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:J(0,"Add Selection To Next Find Match"),alias:"Add Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2082,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:J(0,"Add Selection To Previous Find Match"),alias:"Add Selection To Previous Find Match",precondition:void 0,menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:J(0,"Move Last Selection To Next Find Match"),alias:"Move Last Selection To Next Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:xe(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:J(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)}}),ru(class extends Q9{constructor(){super({id:"editor.action.selectHighlights",label:J(0,"Select All Occurrences of Find Match"),alias:"Select All Occurrences of Find Match",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:3114,weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),ru(class extends Q9{constructor(){super({id:"editor.action.changeAll",label:J(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Lo.and(gS.writable,gS.editorTextFocus),kbOpts:{kbExpr:gS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),ru(class extends tu{constructor(){super({id:"editor.action.addCursorsToBottom",label:J(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 ms(t,e[0].startColumn,t,e[0].endColumn));const r=i._getViewModel(),o=r.getCursorStates();n.length>0&&i.setSelections(n),q9(o,r.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.addCursorsToTop",label:J(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 ms(t,e[0].startColumn,t,e[0].endColumn));const n=i._getViewModel(),r=n.getCursorStates();s.length>0&&i.setSelections(s),q9(r,n.getCursorStates())}}),ru(class extends tu{constructor(){super({id:"editor.action.focusNextCursor",label:J(0,"Focus Next Cursor"),description:{description:J(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),q9(n,s.getCursorStates()))}}),ru(class extends tu{constructor(){super({id:"editor.action.focusPreviousCursor",label:J(0,"Focus Previous Cursor"),description:{description:J(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),q9(n,s.getCursorStates()))}});var e7=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 s7={Visible:new Zo("parameterHintsVisible",!1),MultipleSignatures:new Zo("parameterHintsMultipleSignatures",!1)};function n7(t,i,e,s,n){return e7(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)}}))}ao.registerCommand("_executeSignatureHelpProvider",((t,...i)=>e7(void 0,void 0,void 0,(function*(){const[e,s,n]=i;B(ss.isUri(e)),B(gs.isIPosition(s)),B("string"==typeof n||!n);const r=t.get(Wg),o=yield t.get(to).createModelReference(e);try{const t=yield n7(r.signatureHelpProvider,o.object.textEditorModel,gs.lift(s),{triggerKind:Ss.Invoke,isRetrigger:!1,triggerCharacter:n},ue.None);if(!t)return;return setTimeout((()=>t.dispose()),0),t.value}finally{o.dispose()}}))));var r7;!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}}}(r7||(r7={}));class o7 extends Hi{constructor(t,i,e=o7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ie),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=r7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new zd,this.retriggerChars=new zd,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new ku(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=r7.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(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?0:i+1):this.cancel()}previous(){if(1!==this.state.type)return;const t=this.state.hints.signatures.length,i=this.state.hints.activeSignature,e=0===i,s=this.editor.getOption(85).cycle;!(t<2||e)||s?this.updateActiveSignature(e&&s?t-1:i-1):this.cancel()}updateActiveSignature(t){1===this.state.type&&(this.state=new r7.Active(Object.assign(Object.assign({},this.state.hints),{activeSignature:t})),this._onChangedHints.fire(this.state.hints))}doTrigger(t){return 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())}))}(this,void 0,void 0,(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(h7);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 r7.Pending(wu((t=>n7(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 r7.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=r7.Default),Ei(i),!1}}))}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return 1===this.state.type||2===this.state.type||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const t=this.editor.getModel();if(t)for(const i of this.providers.ordered(t)){for(const t of i.signatureHelpTriggerCharacters||[])if(t.length){const i=t.charCodeAt(0);this.triggerChars.add(i),this.retriggerChars.add(i)}for(const t of i.signatureHelpRetriggerCharacters||[])t.length&&this.retriggerChars.add(t.charCodeAt(0))}}onDidType(t){if(!this.triggerOnType)return;const i=t.length-1,e=t.charCodeAt(i);(this.triggerChars.has(e)||this.isTriggered&&this.retriggerChars.has(e))&&this.trigger({triggerKind:Ss.TriggerCharacter,triggerCharacter:t.charAt(i)})}onCursorChange(t){"mouse"===t.source?this.cancel():this.isTriggered&&this.trigger({triggerKind:Ss.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:Ss.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(85).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function h7(t,i){switch(i.triggerKind){case Ss.Invoke:return i;case Ss.ContentChange:return t;default:return i}}o7.DEFAULT_DELAY=120;var c7,l7=function(t,i){return function(e,s){i(e,s,t)}};const u7=Pl,a7=GW("parameter-hints-next",ys.chevronDown,J(0,"Icon for show next parameter hint.")),d7=GW("parameter-hints-previous",ys.chevronUp,J(0,"Icon for show previous parameter hint."));let f7=c7=class 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 JG({editor:t},n,s)),this.keyVisible=s7.Visible.bindTo(e),this.keyMultipleSignatures=s7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=u7(".editor-widget.parameter-hints-widget"),i=Ol(t,u7(".phwrapper"));i.tabIndex=-1;const e=Ol(i,u7(".controls")),s=Ol(e,u7(".button"+eo.asCSSSelector(d7))),n=Ol(e,u7(".overloads")),r=Ol(e,u7(".button"+eo.asCSSSelector(a7)));this._register(Qc(s,"click",(t=>{Al(t),this.previous()}))),this._register(Qc(r,"click",(t=>{Al(t),this.next()})));const o=u7(".body"),h=new Zy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Ol(o,u7(".signature")),l=Ol(o,u7(".docs"));t.style.userSelect="text",this.domNodes={element:t,signature:c,overloads:n,docs:l,scrollbar:h},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((()=>{this.visible&&this.editor.layoutContentWidget(this)})));const u=()=>{if(!this.domNodes)return;const t=this.editor.getOption(50);this.domNodes.element.style.fontSize=`${t.fontSize}px`,this.domNodes.element.style.lineHeight=""+t.lineHeight/t.fontSize};u(),this._register(Ji.chain(this.editor.onDidChangeConfiguration.bind(this.editor),(t=>t.filter((t=>t.hasChanged(50)))))(u)),this._register(this.editor.onDidLayoutChange((()=>this.updateMaxHeight()))),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout((()=>{var t;null===(t=this.domNodes)||void 0===t||t.element.classList.add("visible")}),100),this.editor.layoutContentWidget(this))}hide(){var t;this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,null===(t=this.domNodes)||void 0===t||t.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(t){var i;if(this.renderDisposeables.clear(),!this.domNodes)return;const e=t.signatures.length>1;this.domNodes.element.classList.toggle("multiple",e),this.keyMultipleSignatures.set(e),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const s=t.signatures[t.activeSignature];if(!s)return;const n=Ol(this.domNodes.signature,u7(".code")),r=this.editor.getOption(50);n.style.fontSize=`${r.fontSize}px`,n.style.fontFamily=r.fontFamily;const o=null!==(i=s.activeParameter)&&void 0!==i?i:t.activeParameter;s.parameters.length>0?this.renderParameters(n,s,o):Ol(n,u7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=u7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}Ol(this.domNodes.docs,u7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)Ol(this.domNodes.docs,u7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);Ol(this.domNodes.docs,t.element)}const c=this.hasDocs(s,h);if(this.domNodes.signature.classList.toggle("has-docs",c),this.domNodes.docs.classList.toggle("empty",!c),this.domNodes.overloads.textContent=String(t.activeSignature+1).padStart(t.signatures.length.toString().length,"0")+"/"+t.signatures.length,h){let t="";const i=s.parameters[o];t=Array.isArray(i.label)?s.label.substring(i.label[0],i.label[1]):i.label,i.documentation&&(t+="string"==typeof i.documentation?`, ${i.documentation}`:`, ${i.documentation.value}`),s.documentation&&(t+="string"==typeof s.documentation?`, ${s.documentation}`:`, ${s.documentation.value}`),this.announcedLabel!==t&&(sm(J(0,"{0}, hint",t)),this.announcedLabel=t)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(t){const i=this.renderDisposeables.add(this.markdownRenderer.render(t,{asyncRenderCallback:()=>{var t;null===(t=this.domNodes)||void 0===t||t.scrollbar.scanDomNode()}}));return i.element.classList.add("markdown-docs"),i}hasDocs(t,i){return!!(i&&"string"==typeof i.documentation&&$(i.documentation).length>0||i&&"object"==typeof i.documentation&&$(i.documentation).value.length>0||t.documentation&&"string"==typeof t.documentation&&$(t.documentation).length>0||t.documentation&&"object"==typeof t.documentation&&$(t.documentation.value).length>0)}renderParameters(t,i,e){const[s,n]=this.getParameterLabelOffsets(i,e),r=document.createElement("span");r.textContent=i.label.substring(0,s);const o=document.createElement("span");o.textContent=i.label.substring(s,n),o.className="parameter active";const h=document.createElement("span");h.textContent=i.label.substring(n),Ol(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|^)${Rn(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 c7.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)}};f7.ID="editor.widget.parameterHintsWidget",f7=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}([l7(2,Jo),l7(3,AF),l7(4,Ba)],f7),Om("editorHoverWidget.highlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Foreground color of the active item in the parameter hint."));var g7,p7=function(t,i){return function(e,s){i(e,s,t)}};let m7=g7=class extends Hi{static get(t){return t.getContribution(g7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new o7(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 Mn((()=>this._register(i.createInstance(f7,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)}};m7.ID="editor.controller.parameterHints",m7=g7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([p7(1,Zr),p7(2,Wg)],m7),hu(m7.ID,m7,2),ru(class extends tu{constructor(){super({id:"editor.action.triggerParameterHints",label:J(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:gS.hasSignatureHelpProvider,kbOpts:{kbExpr:gS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=m7.get(i);null==e||e.trigger({triggerKind:Ss.Invoke})}});const v7=Xl.bindToContribution(m7.get);nu(new v7({id:"closeParameterHints",precondition:s7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:gS.focus,primary:9,secondary:[1033]}})),nu(new v7({id:"showPrevParameterHint",precondition:Lo.and(s7.Visible,s7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:gS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),nu(new v7({id:"showNextParameterHint",precondition:Lo.and(s7.Visible,s7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:gS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var w7=function(t,i){return function(e,s){i(e,s,t)}};const b7=new Zo("renameInputVisible",!1,J(0,"Whether the rename input widget is visible"));let y7=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=b7.bindTo(n),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(50)&&this._updateFont()}))),this._disposables.add(e.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._input=document.createElement("input"),this._input.className="rename-input",this._input.type="text",this._input.setAttribute("aria-label",J(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(Bm),o=t.getColor($m);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Lv))&&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(Wm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor(jm))&&void 0!==s?s:"");const h=t.getColor(Vm);this._input.style.borderWidth=h?"1px":"0px",this._input.style.borderStyle=h?"solid":"none",this._input.style.borderColor=null!==(n=null==h?void 0:h.toString())&&void 0!==n?n:"none"}_updateFont(){if(!this._input||!this._label)return;const t=this._editor.getOption(50);this._input.style.fontFamily=t.fontFamily,this._input.style.fontWeight=t.fontWeight,this._input.style.fontSize=`${t.fontSize}px`,this._label.style.fontSize=.8*t.fontSize+"px"}getPosition(){return this._visible?{position:this._position,preference:[2,1]}:null}beforeRender(){var t,i;const[e,s]=this._acceptKeybindings;return this._label.innerText=J(0,"{0} to Rename, {1} to Preview",null===(t=this._keybindingService.lookupKeybinding(e))||void 0===t?void 0:t.getLabel(),null===(i=this._keybindingService.lookupKeybinding(s))||void 0===i?void 0:i.getLabel()),null}afterRender(t){t||this.cancelInput(!0)}acceptInput(t){var i;null===(i=this._currentAcceptInput)||void 0===i||i.call(this,t)}cancelInput(t){var i;null===(i=this._currentCancelInput)||void 0===i||i.call(this,t)}getInput(t,i,e,s,n,r){this._domNode.classList.toggle("preview",n),this._position=new gs(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((()=>{var t;return this.cancelInput(!(null===(t=this._domNode)||void 0===t?void 0:t.ownerDocument.hasFocus()))}))),this._show()})).finally((()=>{o.dispose(),this._hide()}))}_show(){this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout((()=>{this._input.focus(),this._input.setSelectionRange(parseInt(this._input.getAttribute("selectionStart")),parseInt(this._input.getAttribute("selectionEnd")))}),100)}_hide(){this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}};y7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([w7(2,mk),w7(3,CC),w7(4,Jo)],y7);var k7,C7=function(t,i){return function(e,s){i(e,s,t)}},S7=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 x7{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 S7(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 ps(this.position.lineNumber,e.startColumn,this.position.lineNumber,e.endColumn),text:e.word,rejectReason:i.length>0?i.join("\n"):void 0}:{range:ps.fromPositions(this.position),text:"",rejectReason:i.length>0?i.join("\n"):void 0}}))}provideRenameEdits(t,i){return S7(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,e,s){return S7(this,void 0,void 0,(function*(){const n=this._providers[i];if(!n)return{edits:[],rejectReason:e.join("\n")};const r=yield n.provideRenameEdits(this.model,this.position,t,s);return r?r.rejectReason?this._provideRenameEdits(t,i+1,e.concat(r.rejectReason),s):r:this._provideRenameEdits(t,i+1,e.concat(J(0,"No result.")),s)}))}}let D7=k7=class{static get(t){return t.getContribution(k7.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 de,this._renameInputField=this._disposableStore.add(this._instaService.createInstance(y7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return S7(this,void 0,void 0,(function*(){if(this._cts.dispose(!0),this._cts=new de,!this.editor.hasModel())return;const e=this.editor.getPosition(),s=new x7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new oK(this.editor,5,void 0,this._cts.token);let r;try{const t=s.resolveRenameLocation(n.token);this._progressService.showWhile(t,250),r=yield t}catch(i){return void(null===(t=iZ.get(this.editor))||void 0===t||t.showMessage(i||J(0,"An unknown error occurred while resolving rename location"),e))}finally{n.dispose()}if(!r)return;if(r.rejectReason)return void(null===(i=iZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new oK(this.editor,5,r.range,this._cts.token),h=this.editor.getSelection();let c=0,l=r.text.length;ps.isEmpty(h)||ps.spansMultipleLines(h)||!ps.containsRange(r.range,h)||(c=Math.max(0,h.startColumn-r.range.startColumn),l=Math.min(r.range.endColumn,h.endColumn)-r.range.startColumn);const u=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),a=yield this._renameInputField.getInput(r.range,r.text,c,l,u,o.token);if("boolean"==typeof a)return a&&this.editor.focus(),void o.dispose();this.editor.focus();const d=bu(s.provideRenameEdits(a.newName,o.token),o.token).then((t=>S7(this,void 0,void 0,(function*(){t&&this.editor.hasModel()&&(t.rejectReason?this._notificationService.info(t.rejectReason):(this.editor.setSelection(ps.fromPositions(this.editor.getSelection().getPosition())),this._bulkEditService.apply(t,{editor:this.editor,showPreview:a.wantsPreview,label:J(0,"Renaming '{0}' to '{1}'",null==r?void 0:r.text,a.newName),code:"undoredo.rename",quotableLabel:J(0,"Renaming {0} to {1}",null==r?void 0:r.text,a.newName),respectAutoSaveConfig:!0}).then((t=>{t.ariaSummary&&sm(J(0,"Successfully renamed '{0}' to '{1}'. Summary: {2}",r.text,a.newName,t.ariaSummary))})).catch((t=>{this._notificationService.error(J(0,"Rename failed to apply edits")),this._logService.error(t)}))))}))),(t=>{this._notificationService.error(J(0,"Rename failed to compute edits")),this._logService.error(t)})).finally((()=>{o.dispose()}));return this._progressService.showWhile(d,250),d}))}acceptRenameInput(t){this._renameInputField.acceptInput(t)}cancelRenameInput(){this._renameInputField.cancelInput(!0)}};D7.ID="editor.contrib.renameController",D7=k7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([C7(1,Zr),C7(2,vO),C7(3,yT),C7(4,nR),C7(5,Mh),C7(6,$g),C7(7,Wg)],D7),hu(D7.ID,D7,4),ru(class extends tu{constructor(){super({id:"editor.action.rename",label:J(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Lo.and(gS.writable,gS.hasRenameProvider),kbOpts:{kbExpr:gS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(Yr),[s,n]=Array.isArray(i)&&i||[void 0,void 0];return ss.isUri(s)&&gs.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=D7.get(i);return e?e.run():Promise.resolve()}});const E7=Xl.bindToContribution(D7.get);function A7(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 At()||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),la.wrap(i)}(i)}nu(new E7({id:"acceptRenameInput",precondition:b7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:3}})),nu(new E7({id:"acceptRenameInputWithPreview",precondition:Lo.and(b7,Lo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Lo.and(gS.focus,Lo.not("isComposing")),primary:1027}})),nu(new E7({id:"cancelRenameInput",precondition:b7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:gS.focus,primary:9,secondary:[1033]}})),su("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get(Wg);return function(t,i,e,s){return S7(this,void 0,void 0,(function*(){const n=new x7(i,e,t),r=yield n.resolveRenameLocation(ue.None);return(null==r?void 0:r.rejectReason)?{edits:[],rejectReason:r.rejectReason}:n.provideRenameEdits(s,ue.None)}))}(r,i,e,n)})),su("_executePrepareRename",(function(t,i,e){return S7(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get(Wg),n=new x7(i,e,s),r=yield n.resolveRenameLocation(ue.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),dh.as(Ka).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:5,description:J(0,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var M7=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 L7(t){return t&&!!t.data}function O7(t){return t&&Array.isArray(t.edits)}class F7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function T7(t,i){return t.has(i)}function R7(t,i,e,s,n){return M7(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=>M7(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&&(L7(r)||O7(r))||(r=null),new F7(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 _7{constructor(t,i){this.provider=t,this.tokens=i}}function I7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function P7(t,i,e,s){return M7(this,void 0,void 0,(function*(){const n=I7(t,i),r=yield Promise.all(n.map((t=>M7(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&L7(n)||(n=null),new _7(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}ao.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Xr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(Wg),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(uo).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),ao.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Xr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get(Wg);if(!T7(n,s))return t.get(uo).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield R7(n,s,null,null,ue.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!L7(h))return;const c=A7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),ao.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss);const n=t.get(Xr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(Wg),o=I7(r,n);if(0===o.length)return;if(1===o.length)return o[0].getLegend();if(!s||!ps.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 P7(r,n,ps.lift(s),ue.None);return h?h.provider.getLegend():void 0})))),ao.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>M7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss),B(ps.isIRange(s));const n=t.get(Xr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get(Wg),o=yield P7(r,n,ps.lift(s),ue.None);return o&&o.tokens?A7({id:0,type:"full",data:o.tokens.data}):void 0}))));const N7="editor.semanticHighlighting";function B7(t,i,e){var s;const n=null===(s=e.getValue(N7,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var $7,j7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},W7=function(t,i){return function(e,s){i(e,s,t)}};let V7=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 H7(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()];B7(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{B7(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(N7)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};V7=j7([W7(0,zF),W7(1,Xr),W7(2,mk),W7(3,Ta),W7(4,FF),W7(5,Wg)],V7);let H7=$7=class extends Hi{constructor(t,i,e,s,n){super(),this._semanticTokensStylingService=i,this._isDisposed=!1,this._model=t,this._provider=n.documentSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentSemanticTokens",{min:$7.REQUEST_MIN_DELAY,max:$7.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Mu((()=>this._fetchDocumentSemanticTokensNow()),$7.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeAttached((()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(this._model.onDidChangeLanguage((()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)})));const r=()=>{$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const i of this._provider.all(t))"function"==typeof i.onDidChange&&this._documentProvidersChangeListeners.push(i.onDidChange((()=>{this._currentDocumentRequestCancellationTokenSource?this._providersChangedDuringRequest=!0:this._fetchDocumentSemanticTokens.schedule(0)})))};r(),this._register(this._provider.onDidChange((()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._register(e.onDidColorThemeChange((()=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}))),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),$i(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!T7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new de,i=R7(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 Zi(!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(t,i,e,s){const n=this._currentDocumentResponse,r=()=>{(s.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed)t&&i&&t.releaseDocumentSemanticTokens(i.resultId);else if(t&&e){if(!i)return this._model.tokenization.setSemanticTokens(null,!0),void r();if(O7(i)){if(!n)return void this._model.tokenization.setSemanticTokens(null,!0);if(0===i.edits.length)i={resultId:i.resultId,data:n.data};else{let t=0;for(const e of i.edits)t+=(e.data?e.data.length:0)-e.deleteCount;const s=n.data,r=new Uint32Array(s.length+t);let o=s.length,h=r.length;for(let t=i.edits.length-1;t>=0;t--){const c=i.edits[t];if(c.start>s.length)return e.warnInvalidEditStart(n.resultId,i.resultId,t,c.start,s.length),void this._model.tokenization.setSemanticTokens(null,!0);const l=o-(c.start+c.deleteCount);l>0&&($7._copy(s,o-l,r,h-l,l),h-=l),c.data&&($7._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&$7._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(L7(i)){this._currentDocumentResponse=new z7(t,i.resultId,i.data);const n=WF(i,e,this._model.getLanguageId());if(s.length>0)for(const t of s)for(const i of n)for(const e of t.changes)i.applyEdit(e.range,e.text);this._model.tokenization.setSemanticTokens(n,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}else this._model.tokenization.setSemanticTokens(null,!1)}};H7.REQUEST_MIN_DELAY=300,H7.REQUEST_MAX_DELAY=2e3,H7=$7=j7([W7(1,zF),W7(2,mk),W7(3,FF),W7(4,Wg)],H7);class z7{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}tH(V7);var U7=function(t,i){return function(e,s){i(e,s,t)}};let K7=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 Mu((()=>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(N7)&&(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(!B7(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=wu((e=>Promise.resolve(P7(this._provider,t,i,e)))),n=new Zi(!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,WF(o,h,t.getLanguageId()))})).then((()=>this._removeOutstandingRequest(s)),(()=>this._removeOutstandingRequest(s))),s}};K7.ID="editor.contrib.viewportSemanticTokens",K7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([U7(1,zF),U7(2,mk),U7(3,Ta),U7(4,FF),U7(5,Wg)],K7),hu(K7.ID,K7,1);class q7{constructor(t=!0){this.selectSubwords=t}provideSelectionRanges(t,i){const e=[];for(const s of i){const i=[];e.push(i),this.selectSubwords&&this._addInWordRanges(i,t,s),this._addWordRanges(i,t,s),this._addWhitespaceLine(i,t,s),i.push({range:t.getFullModelRange()})}return e}_addInWordRanges(t,i,e){const s=i.getWordAtPosition(e);if(!s)return;const{word:n,startColumn:r}=s,o=e.column-r;let h=o,c=o,l=0;for(;h>=0;h--){const t=n.charCodeAt(h);if(h!==o&&(95===t||45===t))break;if(qn(t)&&Gn(l))break;l=t}for(h+=1;c<n.length;c++){const t=n.charCodeAt(c);if(Gn(t)&&qn(l))break;if(95===t||45===t)break;l=t}h<c&&t.push({range:new ps(e.lineNumber,r+h,e.lineNumber,r+c)})}_addWordRanges(t,i,e){const s=i.getWordAtPosition(e);s&&t.push({range:new ps(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 ps(e.lineNumber,1,e.lineNumber,i.getLineMaxColumn(e.lineNumber))})}}var G7,Z7=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 J7{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 J7(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let Q7=G7=class{static get(t){return t.getContribution(G7.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 Z7(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||(yield X7(this._languageFeaturesService.selectionRangeProvider,s,i.map((t=>t.getPosition())),this._editor.getOption(112),ue.None).then((t=>{var s;if(a(t)&&t.length===i.length&&this._editor.hasModel()&&e(this._editor.getSelections(),i,((t,i)=>t.equalsSelection(i)))){for(let e=0;e<t.length;e++)t[e]=t[e].filter((t=>t.containsPosition(i[e].getStartPosition())&&t.containsPosition(i[e].getEndPosition()))),t[e].unshift(i[e]);this._state=t.map((t=>new J7(0,t))),null===(s=this._selectionListener)||void 0===s||s.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition((()=>{var t;this._ignoreSelection||(null===(t=this._selectionListener)||void 0===t||t.dispose(),this._state=void 0)}))}}))),!this._state)return;this._state=this._state.map((i=>i.mov(t)));const n=this._state.map((t=>ms.fromPositions(t.ranges[t.index].getStartPosition(),t.ranges[t.index].getEndPosition())));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}))}};Q7.ID="editor.contrib.smartSelectController",Q7=G7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Wg)],Q7);class Y7 extends tu{constructor(t,i){super(i),this._forward=t}run(t,i){return Z7(this,void 0,void 0,(function*(){const t=Q7.get(i);t&&(yield t.run(this._forward))}))}}function X7(t,i,e,s,n){return Z7(this,void 0,void 0,(function*(){const r=t.all(i).concat(new q7(s.selectSubwords));1===r.length&&r.unshift(new y3);const o=[],h=[];for(const t of r)o.push(Promise.resolve(t.provideSelectionRanges(i,e,n)).then((t=>{if(a(t)&&t.length===e.length)for(let i=0;i<e.length;i++){h[i]||(h[i]=[]);for(const s of t[i])ps.isIRange(s.range)&&ps.containsPosition(s.range,e[i])&&h[i].push(ps.lift(s.range))}}),Ai));return yield Promise.all(o),h.map((t=>{if(0===t.length)return[];t.sort(((t,i)=>gs.isBefore(t.getStartPosition(),i.getStartPosition())?1:gs.isBefore(i.getStartPosition(),t.getStartPosition())||gs.isBefore(t.getEndPosition(),i.getEndPosition())?-1:gs.isBefore(i.getEndPosition(),t.getEndPosition())?1:0));const e=[];let n;for(const i of t)(!n||ps.containsRange(i,n)&&!ps.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 ps(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 ps(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}))}))}ao.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),hu(Q7.ID,Q7,4),ru(class extends Y7{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:J(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Expand Selection"),order:2}})}}),ru(class extends Y7{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:J(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:gS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:bh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Shrink Selection"),order:3}})}}),ao.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return Z7(this,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e));const n=t.get(Wg).selectionRangeProvider,r=yield t.get(to).createModelReference(e);try{return X7(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ue.None)}finally{r.dispose()}}))}));const t8=Object.freeze({View:{value:J(0,"View"),original:"View"},Help:{value:J(0,"Help"),original:"Help"},Test:{value:J(0,"Test"),original:"Test"},File:{value:J(0,"File"),original:"File"},Preferences:{value:J(0,"Preferences"),original:"Preferences"},Developer:{value:J(0,"Developer"),original:"Developer"}});class i8{constructor(t,i,e,s=null){this.startLineNumbers=t,this.endLineNumbers=i,this.lastLineRelativePosition=e,this.showEndForLine=s}equals(t){return!!t&&this.lastLineRelativePosition===t.lastLineRelativePosition&&this.showEndForLine===t.showEndForLine&&e(this.startLineNumbers,t.startLineNumbers)&&e(this.endLineNumbers,t.endLineNumbers)}}const e8=Ku("stickyScrollViewLayer",{createHTML:t=>t}),s8="data-sticky-line-index",n8="data-sticky-is-line",r8="data-sticky-is-folding-icon";class o8 extends Hi{constructor(t){super(),this._editor=t,this._foldingIconStore=new Vi,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._lineHeight=this._editor.getOption(66),this._stickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",t instanceof NJ),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable);const i=()=>{this._linesDomNode.style.left=this._editor.getOption(114).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&i(),t.hasChanged(66)&&(this._lineHeight=this._editor.getOption(66))}))),this._register(this._editor.onDidScrollChange((t=>{t.scrollLeftChanged&&i(),t.scrollWidthChanged&&this._updateWidgetWidth()}))),this._register(this._editor.onDidChangeModel((()=>{i(),this._updateWidgetWidth()}))),this._register(this._foldingIconStore),i(),this._register(this._editor.onDidLayoutChange((()=>{this._updateWidgetWidth()}))),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getStickyLineForLine(t){return this._stickyLines.find((i=>i.lineNumber===t))}getCurrentLines(){return this._lineNumbers}setState(t,i,e=1/0){if((!this._previousState&&!t||this._previousState&&this._previousState.equals(t))&&e===1/0)return;this._previousState=t;const s=this._stickyLines;if(this._clearStickyWidget(),t&&this._editor._getViewModel()){if(t.startLineNumbers.length*this._lineHeight+t.lastLineRelativePosition>0){this._lastLineRelativePosition=t.lastLineRelativePosition;const i=[...t.startLineNumbers];null!==t.showEndForLine&&(i[t.showEndForLine]=t.endLineNumbers[t.showEndForLine]),this._lineNumbers=i}else this._lastLineRelativePosition=0,this._lineNumbers=[];this._renderRootNode(s,i,e)}}_updateWidgetWidth(){const t=this._editor.getLayoutInfo();this._lineNumbersDomNode.style.width=`${t.contentLeft}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",this._editor.getScrollWidth()-t.verticalScrollbarWidth+"px"),this._rootDomNode.style.width=t.width-t.verticalScrollbarWidth+"px"}_clearStickyWidget(){this._stickyLines=[],this._foldingIconStore.clear(),Gc(this._lineNumbersDomNode),Gc(this._linesDomNode),this._rootDomNode.style.display="none"}_useFoldingOpacityTransition(t){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${t?.5:0}s`)}_setFoldingIconsVisibility(t){for(const i of this._stickyLines){const e=i.foldingIcon;e&&e.setVisible(!!t||e.isCollapsed)}}_renderRootNode(t,i,e=1/0){return 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())}))}(this,void 0,void 0,(function*(){const s=this._editor.getLayoutInfo();for(const[n,r]of this._lineNumbers.entries()){const o=t[n],h=r>=e||(null==o?void 0:o.lineNumber)!==r?this._renderChildNode(n,r,i,s):this._updateTopAndZIndexOfStickyLine(o);h&&(this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),this._stickyLines.push(h))}i&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin));const n=this._lineNumbers.length*this._lineHeight+this._lastLineRelativePosition;0!==n?(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${n}px`,this._linesDomNodeScrollable.style.height=`${n}px`,this._rootDomNode.style.height=`${n}px`,this._rootDomNode.style.marginLeft="0px",this._updateMinContentWidth(),this._editor.layoutOverlayWidget(this)):this._clearStickyWidget()}))}_setFoldingHoverListeners(){"mouseover"===this._editor.getOption(109)&&(this._foldingIconStore.add(Qc(this._lineNumbersDomNode,El.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Qc(this._lineNumbersDomNode,El.MOUSE_LEAVE,(()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)}))))}_renderChildNode(t,i,e,s){const n=this._editor._getViewModel();if(!n)return;const r=n.coordinatesConverter.convertModelPositionToViewPosition(new gs(i,1)).lineNumber,o=n.getViewLineRenderingData(r),h=this._editor.getOption(67);let c;try{c=op.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new dp(!0,!0,o.content,o.continuesWithWrappedLine,o.isBasicASCII,o.containsRTL,0,o.tokens,c,o.tabSize,o.startVisibleColumn,1,1,1,500,"none",!0,!0,null),u=new wa(2e3),a=mp(l,u);let d;d=e8?e8.createHTML(u.build()):u.build();const f=document.createElement("span");f.setAttribute(s8,String(t)),f.setAttribute(n8,""),f.setAttribute("role","listitem"),f.tabIndex=0,f.className="sticky-line-content",f.classList.add(`stickyLine${i}`),f.style.lineHeight=`${this._lineHeight}px`,f.innerHTML=d;const g=document.createElement("span");g.setAttribute(s8,String(t)),g.setAttribute("data-sticky-is-line-number",""),g.className="sticky-line-number",g.style.lineHeight=`${this._lineHeight}px`,g.style.width=`${s.contentLeft}px`;const p=document.createElement("span");1===h.renderType||3===h.renderType&&i%10==0?p.innerText=i.toString():2===h.renderType&&(p.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),p.className="sticky-line-number-inner",p.style.lineHeight=`${this._lineHeight}px`,p.style.width=`${s.lineNumbersWidth}px`,p.style.paddingLeft=`${s.lineNumbersLeft}px`,g.appendChild(p);const m=this._renderFoldingIconForLine(e,i);m&&g.appendChild(m.domNode),this._editor.applyFontInfo(f),this._editor.applyFontInfo(p),g.style.lineHeight=`${this._lineHeight}px`,f.style.lineHeight=`${this._lineHeight}px`,g.style.height=`${this._lineHeight}px`,f.style.height=`${this._lineHeight}px`;const v=new h8(t,i,f,g,m,a.characterMapping);return this._updateTopAndZIndexOfStickyLine(v)}_updateTopAndZIndexOfStickyLine(t){var i;const e=t.index,s=t.lineDomNode,n=t.lineNumberDomNode,r=e===this._lineNumbers.length-1;s.style.zIndex=r?"0":"1",n.style.zIndex=r?"0":"1";const o=`${e*this._lineHeight+this._lastLineRelativePosition+((null===(i=t.foldingIcon)||void 0===i?void 0:i.isCollapsed)?1:0)}px`,h=e*this._lineHeight+"px";return s.style.top=r?o:h,n.style.top=r?o:h,t}_renderFoldingIconForLine(t,i){const e=this._editor.getOption(109);if(!t||"never"===e)return;const s=t.regions,n=s.findRange(i),r=s.getStartLineNumber(n);if(i!==r)return;const o=s.isCollapsed(n),h=new c8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(r8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=my(i.characterMapping,t,0);return new gs(i.lineNumber,e)}getLineNumberFromChildDomNode(t){var i,e;return null!==(e=null===(i=this._getRenderedStickyLineFromChildDomNode(t))||void 0===i?void 0:i.lineNumber)&&void 0!==e?e:null}_getRenderedStickyLineFromChildDomNode(t){const i=this.getLineIndexFromChildDomNode(t);return null===i||i<0||i>=this._stickyLines.length?null:this._stickyLines[i]}getLineIndexFromChildDomNode(t){const i=this._getAttributeValue(t,s8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,n8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,r8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class h8{constructor(t,i,e,s,n,r){this.index=t,this.lineNumber=i,this.lineDomNode=e,this.lineNumberDomNode=s,this.foldingIcon=n,this.characterMapping=r}}class c8{constructor(t,i,e,s){this.isCollapsed=t,this.foldingStartLine=i,this.foldingEndLine=e,this.dimension=s,this.domNode=document.createElement("div"),this.domNode.style.width=`${s}px`,this.domNode.style.height=`${s}px`,this.domNode.className=eo.asClassName(t?d4:a4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class l8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class u8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class a8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var d8,f8,g8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},p8=function(t,i){return function(e,s){i(e,s,t)}},m8=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"}(d8||(d8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(f8||(f8={}));let v8=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._languageConfigurationService=i,this._languageFeaturesService=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new ku(300)),this._updateOperation=this._register(new Vi);const n=new b8(e),r=new C8(this._editor,e),o=new k8(this._editor,i);switch(s){case d8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case d8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case d8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return m8(this,void 0,void 0,(function*(){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),yield this._updateScheduler.trigger((()=>m8(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 f8.CANCELED:return this._updateOperation.clear(),null;case f8.VALID:return s.stickyModel}}return null})))).catch((t=>(Ei(t),null)))}))}};v8=g8([p8(1,ud),p8(2,Wg)],v8);class w8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,f8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=wu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?f8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),f8.VALID):this._invalid())).then(void 0,(t=>(Ei(t),f8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let b8=class extends w8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return B4.create(this._languageFeaturesService.documentSymbolProvider,t,e)}createStickyModel(t,i,e,s){var n;const{stickyOutlineElement:r,providerID:o}=this._stickyModelFromOutlineModel(s,null===(n=this._stickyModel)||void 0===n?void 0:n.outlineProviderId);return new a8(t.uri,i,r,o)}isModelValid(t){return t&&t.children.size>0}_stickyModelFromOutlineModel(t,i){let e;if(Rt.first(t.children.values())instanceof N4){const s=Rt.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 l8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new l8(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 u8(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 l8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new u8(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 P4?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};b8=g8([p8(0,Wg)],b8);class y8 extends w8{constructor(t){super(),this._foldingLimitReporter=new x4(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new a8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new u8(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 u8(new l8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let k8=class extends y8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new h4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};k8=g8([p8(1,ud)],k8);let C8=class extends y8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return S4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=S4.getFoldingRangeProviders(this._languageFeaturesService,t);return new w4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};C8=g8([p8(1,Wg)],C8);var S8=function(t,i){return function(e,s){i(e,s,t)}},x8=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 D8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let E8=class extends Hi{constructor(t,i,e){super(),this._languageFeaturesService=i,this._languageConfigurationService=e,this._onDidChangeStickyScroll=this._register(new ie),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._options=null,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=t,this._sessionStore=this._register(new Vi),this._updateSoon=this._register(new Mu((()=>this.update()),50)),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(114)&&this.readConfiguration()}))),this.readConfiguration()}readConfiguration(){this._stickyModelProvider=null,this._sessionStore.clear(),this._options=this._editor.getOption(114),this._options.enabled&&(this._stickyModelProvider=this._sessionStore.add(new v8(this._editor,this._languageConfigurationService,this._languageFeaturesService,this._options.defaultModel)),this._sessionStore.add(this._editor.onDidChangeModel((()=>{this._model=null,this._onDidChangeStickyScroll.fire(),this.update()}))),this._sessionStore.add(this._editor.onDidChangeHiddenAreas((()=>this.update()))),this._sessionStore.add(this._editor.onDidChangeModelContent((()=>this._updateSoon.schedule()))),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange((()=>this.update()))),this.update())}getVersionId(){var t;return null===(t=this._model)||void 0===t?void 0:t.version}update(){var t;return x8(this,void 0,void 0,(function*(){null===(t=this._cts)||void 0===t||t.dispose(!0),this._cts=new de,yield this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}))}updateStickyModel(t){return x8(this,void 0,void 0,(function*(){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization())return void(this._model=null);const i=this._editor.getModel(),e=i.getVersionId(),s=yield this._stickyModelProvider.update(i,e,t);t.isCancellationRequested||(this._model=s)}))}updateIndex(t){return-1===t?t=0:t<0&&(t=-t-2),t}getCandidateStickyLinesIntersectingFromStickyModel(t,i,e,n,r){if(0===i.children.length)return;let o=r;const h=[];for(let t=0;t<i.children.length;t++){const e=i.children[t];e.range&&h.push(e.range.startLineNumber)}const c=this.updateIndex(s(h,t.startLineNumber,((t,i)=>t-i))),l=this.updateIndex(s(h,t.startLineNumber+n,((t,i)=>t-i)));for(let s=c;s<=l;s++){const h=i.children[s];if(!h)return;if(h.range){const i=h.range.startLineNumber,s=h.range.endLineNumber;t.startLineNumber<=s+1&&i-1<=t.endLineNumber&&i!==o&&(o=i,e.push(new D8(i,s-1,n+1)),this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n+1,i))}else this.getCandidateStickyLinesIntersectingFromStickyModel(t,h,e,n,r)}}getCandidateStickyLinesIntersecting(t){var i,e;if(!(null===(i=this._model)||void 0===i?void 0:i.element))return[];let s=[];this.getCandidateStickyLinesIntersectingFromStickyModel(t,this._model.element,s,0,-1);const n=null===(e=this._editor._getViewModel())||void 0===e?void 0:e.getHiddenAreas();if(n)for(const t of n)s=s.filter((i=>!(i.startLineNumber>=t.startLineNumber&&i.endLineNumber<=t.endLineNumber+1)));return s}};E8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([S8(1,Wg),S8(2,ud)],E8);var A8,M8=function(t,i){return function(e,s){i(e,s,t)}},L8=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 O8=A8=class 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._foldingModel=null,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._showEndForLine=null,this._stickyScrollWidget=new o8(this._editor),this._stickyLineCandidateProvider=new E8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new i8([],[],0),this._readConfiguration();const h=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeConfiguration((t=>{(t.hasChanged(114)||t.hasChanged(72)||t.hasChanged(66)||t.hasChanged(109))&&this._readConfiguration()}))),this._register(Qc(h,El.CONTEXT_MENU,(t=>L8(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=gS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=gS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Ll(h));this._register(c.onDidBlur((()=>{!1===this._positionRevealed&&0===h.clientHeight?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()}))),this._register(c.onDidFocus((()=>{this.focus()}))),this._registerMouseListeners(),this._register(Qc(h,El.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(A8.ID)}_disposeFocusStickyScrollStore(){var t;this._stickyScrollFocusedContextKey.set(!1),null===(t=this._focusDisposableStore)||void 0===t||t.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}focus(){if(this._onMouseDown)return this._onMouseDown=!1,void this._editor.focus();!0!==this._stickyScrollFocusedContextKey.get()&&(this._focused=!0,this._focusDisposableStore=new Vi,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(t){this._focusedStickyElementIndex=t?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const t=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t[this._focusedStickyElementIndex],column:1})}_revealPosition(t){this._reveaInEditor(t,(()=>this._editor.revealPosition(t)))}_revealLineInCenterIfOutsideViewport(t){this._reveaInEditor(t,(()=>this._editor.revealLineInCenterIfOutsideViewport(t.lineNumber,0)))}_reveaInEditor(t,i){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,i(),this._editor.setSelection(ps.fromPositions(t)),this._editor.focus()}_registerMouseListeners(){const t=this._register(new Vi),i=this._register(new IJ(this._editor,{extractLineNumberFromMouseEvent:t=>{const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);return i?i.lineNumber:0}})),e=t=>{if(!this._editor.hasModel())return null;if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return null;const i=t.target.element;if(!i||i.innerText!==i.innerHTML)return null;const e=this._stickyScrollWidget.getEditorPositionFromNode(i);return e?{range:new ps(e.lineNumber,e.column,e.lineNumber,e.column+i.innerText.length),textElement:i}:null},s=this._stickyScrollWidget.getDomNode();this._register(Xc(s,El.CLICK,(t=>{if(t.ctrlKey||t.altKey||t.metaKey)return;if(!t.leftButton)return;if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i)return;const e=new gs(this._endLineNumbers[i],1);return void this._revealLineInCenterIfOutsideViewport(e)}if(this._stickyScrollWidget.isInFoldingIconDomNode(t.target)){const i=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);return void this._toggleFoldingRegionForLine(i)}if(!this._stickyScrollWidget.isInStickyLine(t.target))return;let i=this._stickyScrollWidget.getEditorPositionFromNode(t.target);if(!i){const e=this._stickyScrollWidget.getLineNumberFromChildDomNode(t.target);if(null===e)return;i=new gs(e,1)}this._revealPosition(i)}))),this._register(Xc(s,El.MOUSE_MOVE,(t=>{if(t.shiftKey){const i=this._stickyScrollWidget.getLineIndexFromChildDomNode(t.target);if(null===i||null!==this._showEndForLine&&this._showEndForLine===i)return;return this._showEndForLine=i,void this._renderStickyScroll()}null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(Qc(s,El.MOUSE_LEAVE,(()=>{null!==this._showEndForLine&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._register(i.onMouseMoveOrRelevantKeyDown((([i,s])=>{const n=e(i);if(!n||!i.hasTriggerModifier||!this._editor.hasModel())return void t.clear();const{range:r,textElement:o}=n;if(r.equalsRange(this._stickyRangeProjectedOnEditor)){if("underline"===o.style.textDecoration)return}else this._stickyRangeProjectedOnEditor=r,t.clear();const h=new de;let c;t.add(Wi((()=>h.dispose(!0)))),$Q(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new gs(r.startLineNumber,r.startColumn+1),h.token).then((i=>{if(!h.token.isCancellationRequested)if(0!==i.length){this._candidateDefinitionsLength=i.length;const e=o;c!==e?(t.clear(),c=e,c.style.textDecoration="underline",t.add(Wi((()=>{c.style.textDecoration="none"})))):c||(c=e,c.style.textDecoration="underline",t.add(Wi((()=>{c.style.textDecoration="none"}))))}else t.clear()}))}))),this._register(i.onCancel((()=>{t.clear()}))),this._register(i.onExecute((t=>L8(this,void 0,void 0,(function*(){if(12!==t.target.type||t.target.detail!==this._stickyScrollWidget.getId())return;const i=this._stickyScrollWidget.getEditorPositionFromNode(t.target.element);i&&(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:i.lineNumber,column:1})),this._instaService.invokeFunction(W6,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))))}_onContextMenu(t){const i=new Wh(t);this._contextMenuService.showContextMenu({menuId:bh.StickyScrollContext,getAnchor:()=>i})}_toggleFoldingRegionForLine(t){if(!this._foldingModel||null===t)return;const i=this._stickyScrollWidget.getStickyLineForLine(t),e=null==i?void 0:i.foldingIcon;if(!e)return;X2(this._foldingModel,Number.MAX_VALUE,[t]),e.isCollapsed=!e.isCollapsed;const s=this._editor.getTopForLineNumber(e.isCollapsed?e.foldingEndLine:e.foldingStartLine)-this._editor.getOption(66)*i.index+1;this._editor.setScrollTop(s),this._renderStickyScroll(t)}_readConfiguration(){const t=this._editor.getOption(114);if(!1===t.enabled)return this._editor.removeOverlayWidget(this._stickyScrollWidget),this._sessionStore.clear(),void(this._enabled=!1);t.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange((t=>{t.scrollTopChanged&&(this._showEndForLine=null,this._renderStickyScroll())}))),this._sessionStore.add(this._editor.onDidLayoutChange((()=>this._onDidResize()))),this._sessionStore.add(this._editor.onDidChangeModelTokens((t=>this._onTokensChange(t)))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll((()=>{this._showEndForLine=null,this._renderStickyScroll()}))),this._enabled=!0),2===this._editor.getOption(67).renderType&&this._sessionStore.add(this._editor.onDidChangeCursorPosition((()=>{this._showEndForLine=null,this._renderStickyScroll()})))}_needsUpdate(t){const i=this._stickyScrollWidget.getCurrentLines();for(const e of i)for(const i of t.ranges)if(e>=i.fromLineNumber&&e<=i.toLineNumber)return!0;return!1}_onTokensChange(t){this._needsUpdate(t)&&this._renderStickyScroll(-1)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(66);this._maxStickyLines=Math.round(.25*t)}_renderStickyScroll(t=1/0){var i,e;return L8(this,void 0,void 0,(function*(){const s=this._editor.getModel();if(!s||s.isTooLargeForTokenization())return this._foldingModel=null,void this._stickyScrollWidget.setState(void 0,null,t);const n=this._stickyLineCandidateProvider.getVersionId();if(void 0===n||n===s.getVersionId())if(this._foldingModel=null!==(e=yield null===(i=S4.get(this._editor))||void 0===i?void 0:i.getFoldingModel())&&void 0!==e?e:null,this._widgetState=this.findScrollWidgetState(),this._stickyScrollVisibleContextKey.set(!(0===this._widgetState.startLineNumbers.length)),this._focused)if(-1===this._focusedStickyElementIndex)this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,-1!==this._focusedStickyElementIndex&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const i=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t),0===this._stickyScrollWidget.lineNumberCount?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(i)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}else this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,t)}))}findScrollWidgetState(){const t=this._editor.getOption(66),i=Math.min(this._maxStickyLines,this._editor.getOption(114).maxLineCount),e=this._editor.getScrollTop();let s=0;const n=[],r=[],o=this._editor.getVisibleRanges();if(0!==o.length){const h=new l8(o[0].startLineNumber,o[o.length-1].endLineNumber),c=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(h);for(const o of c){const h=o.startLineNumber,c=o.endLineNumber,l=o.nestingDepth;if(c-h>0){const o=(l-1)*t,u=l*t,a=this._editor.getBottomForLineNumber(h)-e,d=this._editor.getTopForLineNumber(c)-e,f=this._editor.getBottomForLineNumber(c)-e;if(o>d&&o<=f){n.push(h),r.push(c+1),s=f-u;break}if(u>a&&u<=f&&(n.push(h),r.push(c+1)),n.length===i)break}}}return this._endLineNumbers=r,new i8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};O8.ID="store.contrib.stickyScrollController",O8=A8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M8(1,AR),M8(2,Wg),M8(3,Zr),M8(4,ud),M8(5,FF),M8(6,Jo)],O8);const F8=100;hu(O8.ID,O8,1),Eh(class extends Dh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:J(0,"Toggle Sticky Scroll"),mnemonicTitle:J(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:t8.View,toggled:{condition:Lo.equals("config.editor.stickyScroll.enabled",!0),title:J(0,"Sticky Scroll"),mnemonicTitle:J(0,"&&Sticky Scroll")},menu:[{id:bh.CommandPalette},{id:bh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:bh.StickyScrollContext}]})}run(t){return 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())}))}(this,void 0,void 0,(function*(){const i=t.get(Ta),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}))}}),Eh(class extends eu{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:J(0,"Focus Sticky Scroll"),mnemonicTitle:J(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Lo.and(Lo.has("config.editor.stickyScroll.enabled"),gS.stickyScrollVisible),menu:[{id:bh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focus()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:J(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:16}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focusPrevious()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:J(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:18}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.focusNext()}}),Eh(class extends eu{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:J(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:3}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.goToFocused()}}),Eh(class extends eu{constructor(){super({id:"editor.action.selectEditor",title:{value:J(0,"Select Editor"),original:"Select Editor"},precondition:gS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:F8,primary:9}})}runEditorCommand(t,i){var e;null===(e=O8.get(i))||void 0===e||e.selectEditor()}});var T8,R8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},_8=function(t,i){return function(e,s){i(e,s,t)}};class I8{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 P8=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=Rt.slice(e,s),r=Rt.slice(e,0,s);let o=5;for(const e of Rt.concat(n,r)){if(e.score===L_.Default)continue;const s=new ps(e.editStart.lineNumber,e.editStart.column,e.editInsertEnd.lineNumber,e.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta);i.push(new I8(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(ue.None)}return i}};P8=R8([_8(5,g3)],P8);let N8=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;return 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())}))}(this,void 0,void 0,(function*(){if(e.selectedSuggestionInfo)return;const r=this._getEditorOption(88,t);if(j5.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"!==j5.valueFor(r,h))return;let c,l,u=t.getWordAtPosition(i);if((null==u?void 0:u.word)||(c=this._getTriggerCharacterInfo(t,i)),!(null==u?void 0:u.word)&&!c)return;if(u||(u=t.getWordUntilPosition(i)),u.endColumn!==i.column)return;const a=t.getValueInRange(new ps(i.lineNumber,1,i.lineNumber,i.column));if(!c&&(null===(n=this._lastResult)||void 0===n?void 0:n.canBeReused(t,i.lineNumber,u))){const t=new C3(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=yield N5(this._languageFeatureService.completionProvider,t,i,new I5(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 S3(e.items,i.column,new C3(a,0),k3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new P8(t,i.lineNumber,u,r,e,this._suggestMemoryService)}return this._lastResult=l,l}))}handleItemDidShow(t,i){i.completion.resolve(ue.None)}freeInlineCompletions(t){t.release()}_getTriggerCharacterInfo(t,i){var e;const s=t.getValueInRange(ps.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}}};N8=R8([_8(1,Wg),_8(2,EV),_8(3,g3)],N8);let B8=T8=class{constructor(t,i,e,s){if(1==++T8._counter){const n=s.createInstance(N8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));T8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--T8._counter&&(null===(t=T8._disposable)||void 0===t||t.dispose(),T8._disposable=void 0)}};B8._counter=0,B8=T8=R8([_8(1,Wg),_8(2,Yr),_8(3,Zr)],B8),hu("suggest.inlineCompletionsProvider",B8,0),ru(class extends tu{constructor(){super({id:"editor.action.forceRetokenize",label:J(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 Zi;e.tokenization.forceTokenization(e.getLineCount()),s.stop(),console.log(`tokenization took ${s.elapsed()}`)}});class $8 extends Dh{constructor(){super({id:$8.ID,title:{value:J(0,"Toggle Tab Key Moves Focus"),original:"Toggle Tab Key Moves Focus"},precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},f1:!0})}run(){const t=!fm.getTabFocusMode();fm.setTabFocusMode(t),sm(J(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}$8.ID="editor.action.toggleTabFocusMode",Eh($8);let j8=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=Ol(t,Pl("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 ik(this.el,"click")),o=this._register(new ik(this.el,"keypress")),h=Ji.chain(o.event,(t=>t.map((t=>new Nh(t))).filter((t=>3===t.keyCode)))),c=this._register(new ik(this.el,Sm.Tap)).event;this._register(xm.addTarget(this.el));const l=Ji.any(r.event,h,c);this._register(l((t=>{this.enabled&&(Al(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};j8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(3,AF)],j8);var W8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},V8=function(t,i){return function(e,s){i(e,s,t)}};let H8=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(z8))}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)}};H8=W8([V8(1,Zr)],H8);let z8=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(JG,{}),this.element=Pl("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=Pl("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Gc(this.element)}show(t){Gc(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Ol(this.element,Pl("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(Pl(`div${eo.asCSSSelector(t.icon)}`));const s=Ol(this.element,Pl("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Ol(this.element,Pl("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(j8,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Ol(this.element,Pl("div.action-container"));this.actionBar=this._register(new cN(n)),this.actionBar.push(this._register(new no("banner.close","Close Banner",eo.asClassName(XW),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};z8=W8([V8(0,Zr)],z8);var U8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},K8=function(t,i){return function(e,s){i(e,s,t)}},q8=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 G8=GW("extensions-warning-message",ys.warning,J(0,"Icon shown with a warning message in the extensions editor."));let Z8=class extends Hi{constructor(t,i,e,s){super(),this._editor=t,this._editorWorkerService=i,this._workspaceTrustService=e,this._highlighter=null,this._bannerClosed=!1,this._updateState=t=>{if(t&&t.hasMore){if(this._bannerClosed)return;const i=Math.max(t.ambiguousCharacterCount,t.nonBasicAsciiCharacterCount,t.invisibleCharacterCount);let e;if(t.nonBasicAsciiCharacterCount>=i)e={message:J(0,"This document contains many non-basic ASCII unicode characters"),command:new htt};else if(t.ambiguousCharacterCount>=i)e={message:J(0,"This document contains many ambiguous unicode characters"),command:new rtt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:J(0,"This document contains many invisible unicode characters"),command:new ott}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:G8,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(H8,t)),this._register(this._editor.onDidChangeModel((()=>{this._bannerClosed=!1,this._updateHighlighter()}))),this._options=t.getOption(124),this._register(e.onDidChangeTrust((()=>{this._updateHighlighter()}))),this._register(t.onDidChangeConfiguration((i=>{i.hasChanged(124)&&(this._options=t.getOption(124),this._updateHighlighter())}))),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const t=function(t,i){return{nonBasicASCII:i.nonBasicASCII===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?kt:t))};this._highlighter=this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?new J8(this._editor,i,this._updateState,this._editorWorkerService):new Q8(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};Z8.ID="editor.contrib.unicodeHighlighter",Z8=U8([K8(1,MN),K8(2,DR),K8(3,Zr)],Z8);let J8=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 Mu((()=>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:ett.instance.getDecorationFromOptions(this._options)});this._decorations.set(e)}))}getDecorationInfo(t){if(!this._decorations.has(t))return null;const i=this._editor.getModel();return zL(i,t)?{reason:itt(i.getValueInRange(t.range),this._options),inComment:UL(i,t),inString:KL(i,t)}:null}};J8=U8([K8(3,MN)],J8);class Q8 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 Mu((()=>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=wf.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:ett.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 zL(i,t)?{reason:itt(e,this._options),inComment:UL(i,t),inString:KL(i,t)}:null}}let Y8=class{constructor(t,i,e){this._editor=t,this._languageService=i,this._openerService=e,this.hoverOrdinal=5}computeSync(t,i){if(!this._editor.hasModel()||1!==t.type)return[];const e=this._editor.getModel(),s=this._editor.getContribution(Z8.ID);if(!s)return[];const n=[],r=new Set;let o=300;for(const t of i){const i=s.getDecorationInfo(t);if(!i)continue;const h=e.getValueInRange(t.range).codePointAt(0),c=ttt(h);let l;switch(i.reason.kind){case 0:l=ur(i.reason.confusableWith)?J(0,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",c,ttt(i.reason.confusableWith.codePointAt(0))):J(0,"The character {0} could be confused with the character {1}, which is more common in source code.",c,ttt(i.reason.confusableWith.codePointAt(0)));break;case 1:l=J(0,"The character {0} is invisible.",c);break;case 2:l=J(0,"The character {0} is not a basic ASCII character.",c)}if(r.has(l))continue;r.add(l);const u={codePoint:h,reason:i.reason,inComment:i.inComment,inString:i.inString},a=J(0,"Adjust settings"),d=`command:${ctt.ID}?${encodeURIComponent(JSON.stringify(u))}`,f=new H_("",!0).appendMarkdown(l).appendText(" ").appendLink(d,a);n.push(new VY(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return zY(t,i,this._editor,this._languageService,this._openerService)}};function X8(t){return`U+${t.toString(16).padStart(4,"0")}`}function ttt(t){let i=`\`${X8(t)}\``;return Cr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function itt(t,i){return wf.computeUnicodeHighlightReason(t,i)}Y8=U8([K8(1,Ba),K8(2,AF)],Y8);class ett{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=$M.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}}ett.instance=new ett;class stt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of characters in comments"),alias:"Disable highlighting of characters in comments",precondition:void 0}),this.shortLabel=J(0,"Disable Highlight In Comments")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class ntt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of characters in strings"),alias:"Disable highlighting of characters in strings",precondition:void 0}),this.shortLabel=J(0,"Disable Highlight In Strings")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class rtt extends tu{constructor(){super({id:rtt.ID,label:J(0,"Disable highlighting of ambiguous characters"),alias:"Disable highlighting of ambiguous characters",precondition:void 0}),this.shortLabel=J(0,"Disable Ambiguous Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}rtt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class ott extends tu{constructor(){super({id:ott.ID,label:J(0,"Disable highlighting of invisible characters"),alias:"Disable highlighting of invisible characters",precondition:void 0}),this.shortLabel=J(0,"Disable Invisible Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}ott.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class htt extends tu{constructor(){super({id:htt.ID,label:J(0,"Disable highlighting of non basic ASCII characters"),alias:"Disable highlighting of non basic ASCII characters",precondition:void 0}),this.shortLabel=J(0,"Disable Non ASCII Highlight")}run(t,i,e){return q8(this,void 0,void 0,(function*(){const i=null==t?void 0:t.get(Ta);i&&this.runAction(i)}))}runAction(t){return q8(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}htt.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class ctt extends tu{constructor(){super({id:ctt.ID,label:J(0,"Show Exclude Options"),alias:"Show Exclude Options",precondition:void 0})}run(t,i,e){return q8(this,void 0,void 0,(function*(){const{codePoint:i,reason:s,inString:n,inComment:r}=e,o=String.fromCodePoint(i),h=t.get(Ij),c=t.get(Ta),l=[];if(0===s.kind)for(const t of s.notAmbiguousInLocales)l.push({label:J(0,'Allow unicode characters that are more common in the language "{0}".',t),run:()=>q8(this,void 0,void 0,(function*(){ltt(c,[t])}))});if(l.push({label:function(t){return Cr.isInvisibleCharacter(t)?J(0,"Exclude {0} (invisible character) from being highlighted",X8(t)):J(0,"Exclude {0} from being highlighted",`${X8(t)} "${o}"`)}(i),run:()=>function(t,i){return q8(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)}))}(c,[i])}),r){const t=new stt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(n){const t=new ntt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}if(0===s.kind){const t=new rtt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(1===s.kind){const t=new ott;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(2===s.kind){const t=new htt;l.push({label:t.label,run:()=>q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else!function(t){throw new Error(`Unexpected value: ${t}`)}(s);const u=yield h.pick(l,{title:J(0,"Configure Unicode Highlight Options")});u&&(yield u.run())}))}}function ltt(t,i){var e;return q8(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)}))}ctt.ID="editor.action.unicodeHighlight.showExcludeOptions",ru(rtt),ru(ott),ru(htt),ru(ctt),hu(Z8.ID,Z8,1),bY.register(Y8);var utt=function(t,i){return function(e,s){i(e,s,t)}};const att="ignoreUnusualLineTerminators";let dtt=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(125),this._register(this._editor.onDidChangeConfiguration((t=>{t.hasChanged(125)&&(this._config=this._editor.getOption(125),this._checkForUnusualLineTerminators())}))),this._register(this._editor.onDidChangeModel((()=>{this._checkForUnusualLineTerminators()}))),this._register(this._editor.onDidChangeModelContent((t=>{t.isUndoing||this._checkForUnusualLineTerminators()}))),this._checkForUnusualLineTerminators()}_checkForUnusualLineTerminators(){return 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())}))}(this,void 0,void 0,(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,att)}(this._codeEditorService,t);if(!0===i)return;if(this._editor.getOption(90))return;if("auto"===this._config)return void t.removeUnusualLineTerminators(this._editor.getSelections());if(this._isPresentingDialog)return;let e;try{this._isPresentingDialog=!0,e=yield this._dialogService.confirm({title:J(0,"Unusual Line Terminators"),message:J(0,"Detected unusual line terminators"),detail:J(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`.",FE(t.uri)),primaryButton:J(0,"&&Remove Unusual Line Terminators"),cancelButton:J(0,"Ignore")})}finally{this._isPresentingDialog=!1}e.confirmed?t.removeUnusualLineTerminators(this._editor.getSelections()):function(t,i){t.setModelProperty(i.uri,att,!0)}(this._codeEditorService,t)}))}};dtt.ID="editor.contrib.unusualLineTerminatorsDetector",dtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([utt(1,lF),utt(2,Yr)],dtt),hu(dtt.ID,dtt,1);var ftt,gtt=function(t,i){return function(e,s){i(e,s,t)}};const ptt=new Zo("hasWordHighlights",!1);function mtt(t,i,e,s){return Du(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),a)}class vtt{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=wu((t=>this._compute(this._model,this._selection,this._wordSeparators,t)))),this._result}_getCurrentWordRange(t,i){const e=t.getWordAtPosition(i.getPosition());return e?new ps(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 wtt extends vtt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return mtt(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class btt extends vtt{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return Su(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:xs.Text})))}))}isValid(t,i,e){const s=i.isEmpty();return this._selectionIsEmpty===s&&super.isValid(t,i,e)}}su("_executeDocumentHighlights",((t,i,e)=>mtt(t.get(Wg).documentHighlightProvider,i,e,ue.None)));class ytt{constructor(t,i,e,s){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.linkedHighlighters=e,this._hasWordHighlights=ptt.bindTo(s),this._ignorePositionChangeEvent=!1,this.occurrencesHighlight=this.editor.getOption(80),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(80);this.occurrencesHighlight!==t&&(this.occurrencesHighlight=t,this._stopAll())}))),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=-1}hasDecorations(){return this.decorations.length>0}restore(){this.occurrencesHighlight&&this._run()}_getSortedHighlights(){return this.decorations.getRanges().sort(ps.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&&sm(`${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&&sm(`${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 wtt(i,e,s,t):new btt(i,e,s)}(this.providers,this.model,this.editor.getSelection(),this.editor.getOption(129)),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===xs.Write?j9:i===xs.Text?W9:z9)});var i;this.decorations.set(t),this._hasWordHighlights.set(this.hasDecorations());for(const i of this.linkedHighlighters())(null==i?void 0:i.editor.getModel())===this.editor.getModel()&&(i._stopAll(),i.decorations.set(t),i._hasWordHighlights.set(i.hasDecorations()))}dispose(){this._stopAll(),this.toUnhook.dispose()}}let ktt=ftt=class extends Hi{static get(t){return t.getContribution(ftt.ID)}constructor(t,i,e){super(),this.wordHighlighter=null,this.linkedContributions=new Set;const s=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this.wordHighlighter=new ytt(t,e.documentHighlightProvider,(()=>Rt.map(this.linkedContributions,(t=>t.wordHighlighter))),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()}};ktt.ID="editor.contrib.wordHighlighter",ktt=ftt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([gtt(1,Jo),gtt(2,Wg)],ktt);class Ctt extends tu{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=ktt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}hu(ktt.ID,ktt,0),ru(class extends Ctt{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:J(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:ptt,kbOpts:{kbExpr:gS.editorTextFocus,primary:65,weight:100}})}}),ru(class extends Ctt{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:J(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:ptt,kbOpts:{kbExpr:gS.editorTextFocus,primary:1089,weight:100}})}}),ru(class extends tu{constructor(){super({id:"editor.action.wordHighlight.trigger",label:J(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:ptt.toNegated(),kbOpts:{kbExpr:gS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=ktt.get(i);s&&s.restoreViewState(!0)}});class Stt extends Xl{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=Yd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=new gs(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=>FC.fromModelSelection(t)))),1===r.length){const t=new gs(r[0].positionLineNumber,r[0].positionColumn);i.revealPosition(t,0)}}_moveTo(t,i,e){return e?new ms(t.selectionStartLineNumber,t.selectionStartColumn,i.lineNumber,i.column):new ms(i.lineNumber,i.column,i.lineNumber,i.column)}}class xtt extends Stt{_move(t,i,e,s){return KC.moveWordLeft(t,i,e,s)}}class Dtt extends Stt{_move(t,i,e,s){return KC.moveWordRight(t,i,e,s)}}class Ett extends Xl{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(ud);if(!i.hasModel())return;const n=Yd(i.getOption(129)),r=i.getModel(),o=i.getSelections(),h=i.getOption(6),c=i.getOption(11),l=s.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),u=i._getViewModel(),a=o.map((t=>{const e=this._delete({wordSeparators:n,model:r,selection:t,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:i.getOption(9),autoClosingBrackets:h,autoClosingQuotes:c,autoClosingPairs:l,autoClosedCharacters:u.getCursorAutoClosedCharacters()},this._wordNavigationType);return new BC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class Att extends Ett{_delete(t,i){return KC.deleteWordLeft(t,i)||new ps(1,1,1,1)}}class Mtt extends Ett{_delete(t,i){const e=KC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),nu(new class extends xtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),nu(new class extends Dtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),nu(new class extends Dtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Lo.and(gS.textInputFocus,null===(t=Lo.and(pm,E$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends xtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Dtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Yd(xi.wordSeparators.defaultValue),i,e,s)}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:gS.writable})}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:gS.writable})}}),nu(new class extends Att{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:gS.writable})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:gS.writable})}}),nu(new class extends Mtt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),ru(class extends tu{constructor(){super({id:"deleteInsideWord",precondition:gS.writable,label:J(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=Yd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=KC.deleteInsideWord(s,n,t);return new BC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class Ltt extends Stt{_move(t,i,e,s){return qC.moveWordPartLeft(t,i,e)}}ao.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),ao.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class Ott extends Stt{_move(t,i,e,s){return qC.moveWordPartRight(t,i,e)}}nu(new class extends Ett{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return qC.deleteWordPartLeft(t)||new ps(1,1,1,1)}}),nu(new class extends Ett{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:gS.writable,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=qC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}),nu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),nu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),nu(new class extends Ott{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),nu(new class extends Ott{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:gS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Ftt extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=iZ.get(this.editor);if(t&&this.editor.hasModel()){let i=this.editor.getOptions().get(91);i||(i=new H_(J(0,this.editor.isSimpleWidget?"Cannot edit in read-only input":"Cannot edit in read-only editor"))),t.showMessage(i,this.editor.getPosition())}}}Ftt.ID="editor.contrib.readOnlyMessageController",hu(Ftt.ID,Ftt,2);class Ttt extends Hi{constructor(t){super(),this.editor=t,this.widget=null,wt&&(this._register(t.onDidChangeConfiguration((()=>this.update()))),this.update())}update(){const t=!this.editor.getOption(90);!this.widget&&t?this.widget=new Rtt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Ttt.ID="editor.contrib.iPadShowKeyboard";class Rtt extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Qc(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Qc(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Rtt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Rtt.ID="editor.contrib.ShowKeyboardWidget",hu(Ttt.ID,Ttt,3);var _tt,Itt=function(t,i){return function(e,s){i(e,s,t)}};let Ptt=_tt=class extends Hi{static get(t){return t.getContribution(_tt.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(Ns.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 Ntt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};Ptt.ID="editor.contrib.inspectTokens",Ptt=_tt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Itt(1,aV),Itt(2,Ba)],Ptt);class Ntt 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=Ns.get(i);if(e)return e;const s=t.encodeLanguageId(i);return{getInitialState:()=>tp,tokenize:(t,e,s)=>ip(i,s),tokenizeEncoded:(t,i,e)=>ep(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 Ntt._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)),Tl(this._domNode,Pl("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),Pl("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Ol(this._domNode,Pl("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Ol(this._domNode,Pl("table.tm-metadata-table",void 0,Pl("tbody",void 0,Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"language"),Pl("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"token type"),Pl("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"font style"),Pl("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"foreground"),Pl("td.tm-metadata-value",void 0,`${o?Mg.Format.CSS.formatHex(o.foreground):"-?-"}`)),Pl("tr",void 0,Pl("td.tm-metadata-key",void 0,"background"),Pl("td.tm-metadata-value",void 0,`${o?Mg.Format.CSS.formatHex(o.background):"-?-"}`))))),Ol(this._domNode,Pl("hr.tokens-inspect-separator")),e<i.tokens1.length&&Ol(this._domNode,Pl("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ns.getColorMap(),e=sp.getLanguageId(t),s=sp.getTokenType(t),n=sp.getFontStyle(t),r=sp.getForeground(t),o=sp.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]}}}Ntt._ID="editor.contrib.inspectTokensWidget",hu(Ptt.ID,Ptt,4),ru(class extends tu{constructor(){super({id:"editor.action.inspectTokens",label:vR.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=Ptt.get(i);null==e||e.launch()}});var Btt,$tt=function(t,i){return function(e,s){i(e,s,t)}};let jtt=Btt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=dh.as(Fj)}provide(t){const i=new Vi;return i.add(t.onDidAccept((()=>{const[i]=t.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),i.add(t.onDidChangeValue((t=>{const i=this.registry.getQuickAccessProvider(t.substr(Btt.PREFIX.length));i&&i.prefix&&i.prefix!==Btt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Btt.PREFIX)),i}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort(((t,i)=>t.prefix.localeCompare(i.prefix))).flatMap((t=>this.createPicks(t)))}createPicks(t){return t.helpEntries.map((i=>{const e=i.prefix||t.prefix,s=e||"…";return{prefix:e,label:s,keybinding:i.commandId?this.keybindingService.lookupKeybinding(i.commandId):void 0,ariaLabel:J(0,"{0}, {1}",s,i.description),description:i.description}}))}};jtt.PREFIX="?",jtt=Btt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$tt(0,Ij),$tt(1,CC)],jtt),dh.as(Fj).registerQuickAccessProvider({ctor:jtt,prefix:"",helpEntries:[{description:bR.helpQuickAccessActionLabel}]});class Wtt{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){var e;const s=new Vi,n=this.activeTextEditorControl;if(n&&this.canProvideWithTextEditor(n)){const r={editor:n},o=uK(n);if(o){let t=null!==(e=n.saveViewState())&&void 0!==e?e:void 0;s.add(o.onDidChangeCursorPosition((()=>{var i;t=null!==(i=n.saveViewState())&&void 0!==i?i:void 0}))),r.restoreViewState=()=>{t&&n===this.activeTextEditorControl&&n.restoreViewState(t)},s.add(Ni(i.onCancellationRequested)((()=>{var t;return null===(t=r.restoreViewState)||void 0===t?void 0:t.call(r)})))}s.add(Wi((()=>this.clearDecorations(n)))),s.add(this.provideWithTextEditor(r,t,i))}else s.add(this.provideWithoutTextEditor(t,i));return s}canProvideWithTextEditor(t){return!0}gotoLocation({editor:t},i){t.setSelection(i.range),t.revealRangeInCenter(i.range,0),i.preserveFocus||t.focus();const e=t.getModel();e&&"getLineContent"in e&&nm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return lK(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:vk(Zk),position:Xd.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 Vtt extends Wtt{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(t){const i=J(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(Vtt.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=uK(s);return o&&2===o.getOptions().get(67).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,e){if(this.isValidLineNumber(t,i))return this.isValidColumn(t,i,e)?J(0,"Go to line {0} and character {1}.",i,e):J(0,"Go to line {0}.",i);const s=t.getPosition()||{lineNumber:1,column:1},n=this.lineCount(t);return n>1?J(0,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",s.lineNumber,s.column,n):J(0,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",s.lineNumber,s.column)}isValidLineNumber(t,i){return!(!i||"number"!=typeof i)&&i>0&&i<=this.lineCount(t)}isValidColumn(t,i,e){if(!e||"number"!=typeof e)return!1;const s=this.getModel(t);if(!s)return!1;const n={lineNumber:i,column:e};return s.validatePosition(n).equals(n)}lineCount(t){var i,e;return null!==(e=null===(i=this.getModel(t))||void 0===i?void 0:i.getLineCount())&&void 0!==e?e:0}}Vtt.PREFIX=":";let Htt=class extends Vtt{constructor(t){super(),this.editorService=t,this.onDidActiveTextEditorControlChange=Ji.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};Htt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Yr)],Htt);class ztt extends tu{constructor(){super({id:ztt.ID,label:wR.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Ij).quickAccess.show(Htt.PREFIX)}}ztt.ID="editor.action.gotoLine",ru(ztt),dh.as(Fj).registerQuickAccessProvider({ctor:Htt,prefix:Htt.PREFIX,helpEntries:[{description:wR.gotoLineActionLabel,commandId:ztt.ID}]});const Utt=[void 0,[]];function Ktt(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]=qtt(t,o,e,s);if("number"!=typeof i)return Utt;n+=i,r.push(...h)}return[n,Gtt(r)]}(t,i.values,e,s):qtt(t,i,e,s)}function qtt(t,i,e,s){const n=F_(i.original,i.originalLowercase,e,t,t.toLowerCase(),s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],v_(n)]:Utt}function Gtt(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 Ztt(t){return t.startsWith('"')&&t.endsWith('"')}function Jtt(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=Qtt(t),r=e.indexOf(Je)>=0,o=Ztt(t);let h;const c=t.split(" ");if(c.length>1)for(const t of c){const i=Ztt(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=Qtt(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 Qtt(t){let i;i=t.replace(dt?/\//g:/\\/g,Je);const e=(s=i,s.replace(/\*/g,"")).replace(/\s|"/g,"");var s;return{pathNormalized:i,normalized:e,normalizedLowercase:e.toLowerCase()}}function Ytt(t){return Array.isArray(t)?Jtt(t.map((t=>t.original)).join(" ")):Jtt(t.original)}Object.freeze({score:0});var Xtt,tit=function(t,i){return function(e,s){i(e,s,t)}},iit=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 eit=Xtt=class extends Wtt{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,J(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,e,s){const n=new Vi;return this.provideLabelPick(e,J(0,"The active text editor does not provide symbol information.")),(()=>{iit(this,void 0,void 0,(function*(){(yield this.waitForLanguageSymbolRegistry(i,n))&&!s.isCancellationRequested&&n.add(this.doProvideWithEditorSymbols(t,i,e,s))}))})(),n}provideLabelPick(t,i){t.items=[{label:i,index:0,kind:14}],t.ariaLabel=i}waitForLanguageSymbolRegistry(t,i){return iit(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(t,i,e,s){var n;const r=t.editor,o=new Vi;o.add(e.onDidAccept((i=>{const[s]=e.selectedItems;s&&s.range&&(this.gotoLocation(t,{range:s.range.selection,keyMods:e.keyMods,preserveFocus:i.inBackground}),i.inBackground||e.hide())}))),o.add(e.onDidTriggerItemButton((({item:i})=>{i&&i.range&&(this.gotoLocation(t,{range:i.range.selection,keyMods:e.keyMods,forceSideBySide:!0}),e.hide())})));const h=this.getDocumentSymbols(i,s);let c;const l=t=>iit(this,void 0,void 0,(function*(){null==c||c.dispose(!0),e.busy=!1,c=new de(s),e.busy=!0;try{const i=Jtt(e.value.substr(Xtt.PREFIX.length).trim()),n=yield this.doGetSymbolPicks(h,i,void 0,c.token);if(s.isCancellationRequested)return;if(n.length>0){if(e.items=n,t&&0===i.original.length){const i=Df(n,(i=>Boolean("separator"!==i.type&&i.range&&ps.containsPosition(i.range.decoration,t))));i&&(e.activeItems=[i])}}else this.provideLabelPick(e,J(0,i.original.length>0?"No matching editor symbols":"No editor symbols"))}finally{s.isCancellationRequested||(e.busy=!1)}}));return o.add(e.onDidChangeValue((()=>l(void 0)))),l(null===(n=r.getSelection())||void 0===n?void 0:n.getPosition()),o.add(e.onDidChangeActive((()=>{const[t]=e.activeItems;t&&t.range&&(r.revealRangeInCenter(t.range.selection,0),this.addDecorations(r,t.range.decoration))}))),o}doGetSymbolPicks(t,i,e,s){var n,r;return iit(this,void 0,void 0,(function*(){const o=yield t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(Xtt.SCOPE_PREFIX),c=h?1:0;let l,u,a;i.values&&i.values.length>1?(l=Ytt(i.values[0]),u=Ytt(i.values.slice(1))):l=i;const d=null===(r=null===(n=this.options)||void 0===n?void 0:n.openSideBySideDirection)||void 0===r?void 0:r.call(n);d&&(a=[{iconClass:eo.asClassName("right"===d?ys.splitHorizontal:ys.splitVertical),tooltip:J(0,"right"===d?"Open to the Side":"Open to the Bottom")}]);const f=[];for(let w=0;w<o.length;w++){const b=o[w],y=_n(b.name),k=`$(${Ts.toIcon(b.kind).id}) ${y}`,C=k.length-y.length;let S,x,D,E,A=b.containerName;if((null==e?void 0:e.extraContainerLabel)&&(A=A?`${e.extraContainerLabel} • ${A}`:e.extraContainerLabel),i.original.length>c){let L=!1;if(l!==i&&([S,x]=Ktt(k,Object.assign(Object.assign({},i),{values:void 0}),c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=Ktt(k,l,c,C),"number"!=typeof S))continue;if(!L&&u){if(A&&u.original.length>0&&([D,E]=Ktt(A,u)),"number"!=typeof D)continue;"number"==typeof S&&(S+=D)}}const M=b.tags&&b.tags.indexOf(1)>=0;f.push({index:w,kind:b.kind,score:S,label:k,ariaLabel:(g=b.name,p=b.kind,J(0,"{0} ({1})",g,Fs[p])),description:A,highlights:M?void 0:{label:x,description:E},range:{selection:ps.collapseToStart(b.selectionRange),decoration:b.range},strikethrough:M,buttons:a})}var g,p;const m=f.sort(((t,i)=>h?this.compareByKindAndScore(t,i):this.compareByScore(t,i)));let v=[];if(h){let O,F,T=0;function R(){F&&"number"==typeof O&&T>0&&(F.label=Fn(nit[O]||sit,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:J(0,"symbols ({0})",f.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=(nit[t.kind]||sit).localeCompare(nit[i.kind]||sit);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return iit(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};eit.PREFIX="@",eit.SCOPE_PREFIX=":",eit.PREFIX_BY_CATEGORY=`${Xtt.PREFIX}${Xtt.SCOPE_PREFIX}`,eit=Xtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([tit(0,Wg),tit(1,$4)],eit);const sit=J(0,"properties ({0})"),nit={5:J(0,"methods ({0})"),11:J(0,"functions ({0})"),8:J(0,"constructors ({0})"),12:J(0,"variables ({0})"),4:J(0,"classes ({0})"),22:J(0,"structs ({0})"),23:J(0,"events ({0})"),24:J(0,"operators ({0})"),10:J(0,"interfaces ({0})"),2:J(0,"namespaces ({0})"),3:J(0,"packages ({0})"),25:J(0,"type parameters ({0})"),1:J(0,"modules ({0})"),6:J(0,"properties ({0})"),9:J(0,"enumerations ({0})"),21:J(0,"enumeration members ({0})"),14:J(0,"strings ({0})"),0:J(0,"files ({0})"),17:J(0,"arrays ({0})"),15:J(0,"numbers ({0})"),16:J(0,"booleans ({0})"),18:J(0,"objects ({0})"),19:J(0,"keys ({0})"),7:J(0,"fields ({0})"),13:J(0,"constants ({0})")};var rit=function(t,i){return function(e,s){i(e,s,t)}};let oit=class extends eit{constructor(t,i,e){super(i,e),this.editorService=t,this.onDidActiveTextEditorControlChange=Ji.None}get activeTextEditorControl(){var t;return null!==(t=this.editorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}};oit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([rit(0,Yr),rit(1,Wg),rit(2,$4)],oit);class hit extends tu{constructor(){super({id:hit.ID,label:kR.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:gS.hasDocumentSymbolProvider,kbOpts:{kbExpr:gS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Ij).quickAccess.show(eit.PREFIX,{itemActivation:_j.NONE})}}function cit(t,i){return i&&(t.stack||t.stacktrace)?J(0,"{0}: {1}",uit(t),lit(t.stack)||lit(t.stacktrace)):uit(t)}function lit(t){return Array.isArray(t)?t.join("\n"):t}function uit(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?J(0,"A system error occurred ({0})",t.message):t.message||J(0,"An unknown error occurred. Please consult the log for more details.")}function ait(t=null,i=!1){if(!t)return J(0,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(t)){const e=c(t),s=ait(e[0],i);return e.length>1?J(0,"{0} ({1} errors in total)",s,e.length):s}if(L(t))return t;if(t.detail){const e=t.detail;if(e.error)return cit(e.error,i);if(e.exception)return cit(e.exception,i)}return t.stack?cit(t,i):t.message?t.message:J(0,"An unknown error occurred. Please consult the log for more details.")}hit.ID="editor.action.quickOutline",ru(hit),dh.as(Fj).registerQuickAccessProvider({ctor:oit,prefix:eit.PREFIX,helpEntries:[{description:kR.quickOutlineActionLabel,prefix:eit.PREFIX,commandId:hit.ID},{description:kR.quickOutlineByCategoryActionLabel,prefix:eit.PREFIX_BY_CATEGORY}]});class dit{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(t,i){const e=this.computeEmbedding(t),s=new Map,n=[];for(const[t,r]of this.documents){if(i.isCancellationRequested)return[];for(const i of r.chunks){const r=this.computeSimilarityScore(i,e,s);r>0&&n.push({key:t,score:r})}}return n}static termFrequencies(t){return function(t){var i;const e=new Map;for(const s of t)e.set(s,(null!==(i=e.get(s))&&void 0!==i?i:0)+1);return e}(dit.splitTerms(t))}static*splitTerms(t){const i=t=>t.toLowerCase();for(const[e]of t.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield i(e);const t=e.split(/(?<=[a-z])(?=[A-Z])/g);if(t.length>1)for(const e of t)e.length>2&&/\p{Letter}{3,}/gu.test(e)&&(yield i(e))}}updateDocuments(t){var i;for(const{key:i}of t)this.deleteDocument(i);for(const e of t){const t=[];for(const s of e.textChunks){const e=dit.termFrequencies(s);for(const t of e.keys())this.chunkOccurrences.set(t,(null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0)+1);t.push({text:s,tf:e})}this.chunkCount+=t.length,this.documents.set(e.key,{chunks:t})}return this}deleteDocument(t){const i=this.documents.get(t);if(i){this.documents.delete(t),this.chunkCount-=i.chunks.length;for(const t of i.chunks)for(const i of t.tf.keys()){const t=this.chunkOccurrences.get(i);if("number"==typeof t){const e=t-1;e<=0?this.chunkOccurrences.delete(i):this.chunkOccurrences.set(i,e)}}}}computeSimilarityScore(t,i,e){let s=0;for(const[n,r]of Object.entries(i)){const i=t.tf.get(n);if(!i)continue;let o=e.get(n);"number"!=typeof o&&(o=this.computeIdf(n),e.set(n,o)),s+=i*o*r}return s}computeEmbedding(t){const i=dit.termFrequencies(t);return this.computeTfidf(i)}computeIdf(t){var i;const e=null!==(i=this.chunkOccurrences.get(t))&&void 0!==i?i:0;return e>0?Math.log((this.chunkCount+1)/e):0}computeTfidf(t){const i=Object.create(null);for(const[e,s]of t){const t=this.computeIdf(e);t>0&&(i[e]=s*t)}return i}}var fit,git=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 pit(t){return Array.isArray(t.items)}function mit(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"}(fit||(fit={}));class vit 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=()=>git(this,void 0,void 0,(function*(){const s=o.value=new Vi;null==r||r.dispose(!0),t.busy=!1,r=new de(i);const n=r.token,h=t.value.substr(this.prefix.length).trim(),c=this._getPicks(h,s,n,e),l=(i,e)=>{var s;let n,r;if(pit(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=j(this.options.noResultsPick)?[this.options.noResultsPick(h)]:[this.options.noResultsPick])}return t.items=n,r&&(t.activeItems=[r]),!0},u=i=>git(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>git(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield Su(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})))(),(()=>git(this,void 0,void 0,(function*(){t.busy=!0;try{const r=yield i.additionalPicks;if(n.isCancellationRequested)return;let o,h,c,u;if(pit(i.picks)?(o=i.picks.items,h=i.picks.active):o=i.picks,pit(r)?(c=r.items,u=r.active):c=r,c.length>0||!e){let i;if(!h&&!u){const e=t.activeItems[0];e&&-1!==o.indexOf(e)&&(i=e)}l({items:[...o,...c],active:h||u||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(mit(c))yield u(c);else if(c instanceof Promise){t.busy=!0;try{const i=yield c;if(n.isCancellationRequested)return;mit(i)?yield u(i):l(i)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)}));return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((({button:e,item:s})=>git(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 fit.NO_ACTION:break;case fit.CLOSE_PICKER:t.hide();break;case fit.REFRESH_PICKER:h();break;case fit.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 wit,bit,yit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},kit=function(t,i){return function(e,s){i(e,s,t)}},Cit=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 Sit=wit=class extends vit{constructor(t,i,e,s,n,r){super(wit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(xit)),this.options=t}_getPicks(t,i,e,s){var n,r,o,h;return Cit(this,void 0,void 0,(function*(){const i=yield this.getCommandPicks(e);if(e.isCancellationRequested)return[];const c=Ni((()=>{const s=new dit;return s.updateDocuments(i.map((t=>({key:t.commandId,textChunks:[t.label+(t.commandAlias?` ${t.commandAlias}`:"")]})))),function(t){var i,e;const s=t.slice(0);s.sort(((t,i)=>i.score-t.score));const n=null!==(e=null===(i=s[0])||void 0===i?void 0:i.score)&&void 0!==e?e:0;if(n>0)for(const t of s)t.score/=n;return s}(s.calculateScores(t,e)).filter((t=>t.score>wit.TFIDF_THRESHOLD)).slice(0,wit.TFIDF_MAX_RESULTS)})),l=[];for(const s of i){const i=null!==(n=wit.WORD_FILTER(t,s.label))&&void 0!==n?n:void 0,o=s.commandAlias&&null!==(r=wit.WORD_FILTER(t,s.commandAlias))&&void 0!==r?r:void 0;if(i||o)s.highlights={label:i,detail:this.options.showAlias?o:void 0},l.push(s);else if(t===s.commandId)l.push(s);else if(t.length>=3){const t=c();if(e.isCancellationRequested)return[];const i=t.find((t=>t.key===s.commandId));i&&(s.tfIdfScore=i.score,l.push(s))}}const u=new Map;for(const t of l){const i=u.get(t.label);i?(t.description=t.commandId,i.description=i.commandId):u.set(t.label,t)}l.sort(((t,i)=>{if(t.tfIdfScore&&i.tfIdfScore)return t.tfIdfScore===i.tfIdfScore?t.label.localeCompare(i.label):i.tfIdfScore-t.tfIdfScore;if(t.tfIdfScore)return 1;if(i.tfIdfScore)return-1;const e=this.commandsHistory.peek(t.commandId),s=this.commandsHistory.peek(i.commandId);if(e&&s)return e>s?-1:1;if(e)return-1;if(s)return 1;if(this.options.suggestedCommandIds){const e=this.options.suggestedCommandIds.has(t.commandId),s=this.options.suggestedCommandIds.has(i.commandId);if(e&&s)return 0;if(e)return-1;if(s)return 1}return t.label.localeCompare(i.label)}));const a=[];let d=!1,f=!0,g=!!this.options.suggestedCommandIds;for(let t=0;t<l.length;t++){const i=l[t];0===t&&this.commandsHistory.peek(i.commandId)&&(a.push({type:"separator",label:J(0,"recently used")}),d=!0),f&&void 0!==i.tfIdfScore&&(a.push({type:"separator",label:J(0,"similar commands")}),f=!1),g&&void 0===i.tfIdfScore&&!this.commandsHistory.peek(i.commandId)&&(null===(o=this.options.suggestedCommandIds)||void 0===o?void 0:o.has(i.commandId))&&(a.push({type:"separator",label:J(0,"commonly used")}),d=!0,g=!1),!d||void 0!==i.tfIdfScore||this.commandsHistory.peek(i.commandId)||(null===(h=this.options.suggestedCommandIds)||void 0===h?void 0:h.has(i.commandId))||(a.push({type:"separator",label:J(0,"other commands")}),d=!1),a.push(this.toCommandPick(i,s))}return this.hasAdditionalCommandPicks(t,e)?{picks:a,additionalPicks:(()=>Cit(this,void 0,void 0,(function*(){var n;const r=yield this.getAdditionalCommandPicks(i,l,t,e);if(e.isCancellationRequested)return[];const o=r.map((t=>this.toCommandPick(t,s)));return f&&"separator"!==(null===(n=o[0])||void 0===n?void 0:n.type)&&o.unshift({type:"separator",label:J(0,"similar commands")}),o})))()}:a}))}toCommandPick(t,i){if("separator"===t.type)return t;const e=this.keybindingService.lookupKeybinding(t.commandId),s=e?J(0,"{0}, {1}",t.label,e.getAriaLabel()):t.label;return Object.assign(Object.assign({},t),{ariaLabel:s,detail:this.options.showAlias&&t.commandAlias!==t.label?t.commandAlias:void 0,keybinding:e,accept:()=>Cit(this,void 0,void 0,(function*(){var e,s;this.commandsHistory.push(t.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:t.commandId,from:null!==(e=null==i?void 0:i.from)&&void 0!==e?e:"quick open"});try{(null===(s=t.args)||void 0===s?void 0:s.length)?yield this.commandService.executeCommand(t.commandId,...t.args):yield this.commandService.executeCommand(t.commandId)}catch(i){Oi(i)||this.dialogService.error(J(0,"Command '{0}' resulted in an error",t.label),ait(i))}}))})}};Sit.PREFIX=">",Sit.TFIDF_THRESHOLD=.5,Sit.TFIDF_MAX_RESULTS=5,Sit.WORD_FILTER=KR(qR,(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=l_(t,i,0,n,e));)n=u_(i,n+1);return s}),ZR),Sit=wit=yit([kit(1,Zr),kit(2,CC),kit(3,uo),kit(4,Ah),kit(5,lF)],Sit);let xit=bit=class 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(t){t&&!t.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=bit.getConfiguredCommandHistoryLength(this.configurationService),bit.cache&&bit.cache.limit!==this.configuredCommandsHistoryLength&&(bit.cache.limit=this.configuredCommandsHistoryLength,bit.saveState(this.storageService)))}load(){const t=this.storageService.get(bit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=bit.cache=new lg(this.configuredCommandsHistoryLength,1);if(i){let t;t=i.usesLRU?i.entries:i.entries.sort(((t,i)=>t.value-i.value)),t.forEach((t=>e.set(t.key,t.value)))}bit.counter=this.storageService.getNumber(bit.PREF_KEY_COUNTER,0,bit.counter)}push(t){bit.cache&&(bit.cache.set(t,bit.counter++),bit.saveState(this.storageService))}peek(t){var i;return null===(i=bit.cache)||void 0===i?void 0:i.peek(t)}static saveState(t){if(!bit.cache)return;const i={usesLRU:!0,entries:[]};bit.cache.forEach(((t,e)=>i.entries.push({key:e,value:t}))),t.store(bit.PREF_KEY_CACHE,JSON.stringify(i),0,0),t.store(bit.PREF_KEY_COUNTER,bit.counter,0,0)}static getConfiguredCommandHistoryLength(t){var i,e;const s=null===(e=null===(i=t.getValue().workbench)||void 0===i?void 0:i.commandPalette)||void 0===e?void 0:e.history;return"number"==typeof s?s:bit.DEFAULT_COMMANDS_HISTORY_LENGTH}};xit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,xit.PREF_KEY_CACHE="commandPalette.mru.cache",xit.PREF_KEY_COUNTER="commandPalette.mru.counter",xit.counter=1,xit=bit=yit([kit(0,PP),kit(1,Ta)],xit);class Dit extends Sit{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:$_(e.label)||e.id});return i}}var Eit=function(t,i){return function(e,s){i(e,s,t)}},Ait=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 Mit=class extends Dit{get activeTextEditorControl(){var t;return null!==(t=this.codeEditorService.getFocusedCodeEditor())&&void 0!==t?t:void 0}constructor(t,i,e,s,n,r){super({showAlias:!1},t,e,s,n,r),this.codeEditorService=i}getCommandPicks(){return Ait(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return Ait(this,void 0,void 0,(function*(){return[]}))}};Mit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Eit(0,Zr),Eit(1,Yr),Eit(2,CC),Eit(3,uo),Eit(4,Ah),Eit(5,lF)],Mit);class Lit extends tu{constructor(){super({id:Lit.ID,label:yR.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:gS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Ij).quickAccess.show(Mit.PREFIX)}}Lit.ID="editor.action.quickCommand",ru(Lit),dh.as(Fj).registerQuickAccessProvider({ctor:Mit,prefix:Mit.PREFIX,helpEntries:[{description:yR.quickCommandHelp,commandId:Lit.ID}]});var Oit=function(t,i){return function(e,s){i(e,s,t)}};let Fit=class extends LQ{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Fit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Oit(1,Jo),Oit(2,Yr),Oit(3,vO),Oit(4,Zr),Oit(5,PP),Oit(6,Ta)],Fit),hu(LQ.ID,Fit,4),ru(class extends tu{constructor(){super({id:"editor.action.toggleHighContrast",label:SR.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(t,i){const e=t.get(aV),s=e.getColorTheme();oy(s.type)?(e.setTheme(this._originalThemeName||(hy(s.type)?eV:iV)),this._originalThemeName=null):(e.setTheme(hy(s.type)?sV:nV),this._originalThemeName=s.themeName)}});var Tit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Rit(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 _it=Rit((function(t,i){var e;e=function(t,i){var e,s,n,r,o,h,c,l,u,a,d,f,g,p,m,v,w,b,y,k,C,S,x,D,E,A,M,L;Object.defineProperty(i,"__esModule",{value:!0}),i.TextDocument=i.EOL=i.WorkspaceFolder=i.InlineCompletionContext=i.SelectedCompletionInfo=i.InlineCompletionTriggerKind=i.InlineCompletionList=i.InlineCompletionItem=i.StringValue=i.InlayHint=i.InlayHintLabelPart=i.InlayHintKind=i.InlineValueContext=i.InlineValueEvaluatableExpression=i.InlineValueVariableLookup=i.InlineValueText=i.SemanticTokens=i.SemanticTokenModifiers=i.SemanticTokenTypes=i.SelectionRange=i.DocumentLink=i.FormattingOptions=i.CodeLens=i.CodeAction=i.CodeActionContext=i.CodeActionTriggerKind=i.CodeActionKind=i.DocumentSymbol=i.WorkspaceSymbol=i.SymbolInformation=i.SymbolTag=i.SymbolKind=i.DocumentHighlight=i.DocumentHighlightKind=i.SignatureInformation=i.ParameterInformation=i.Hover=i.MarkedString=i.CompletionList=i.CompletionItem=i.CompletionItemLabelDetails=i.InsertTextMode=i.InsertReplaceEdit=i.CompletionItemTag=i.InsertTextFormat=i.CompletionItemKind=i.MarkupContent=i.MarkupKind=i.TextDocumentItem=i.OptionalVersionedTextDocumentIdentifier=i.VersionedTextDocumentIdentifier=i.TextDocumentIdentifier=i.WorkspaceChange=i.WorkspaceEdit=i.DeleteFile=i.RenameFile=i.CreateFile=i.TextDocumentEdit=i.AnnotatedTextEdit=i.ChangeAnnotationIdentifier=i.ChangeAnnotation=i.TextEdit=i.Command=i.Diagnostic=i.CodeDescription=i.DiagnosticTag=i.DiagnosticSeverity=i.DiagnosticRelatedInformation=i.FoldingRange=i.FoldingRangeKind=i.ColorPresentation=i.ColorInformation=i.Color=i.LocationLink=i.Location=i.Range=i.Position=i.uinteger=i.integer=i.URI=i.DocumentUri=void 0,function(t){t.is=function(t){return"string"==typeof t}}(e||(i.DocumentUri=e={})),function(t){t.is=function(t){return"string"==typeof t}}(s||(i.URI=s={})),function(t){t.MIN_VALUE=-2147483648,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(n||(i.integer=n={})),function(t){t.MIN_VALUE=0,t.MAX_VALUE=2147483647,t.is=function(i){return"number"==typeof i&&t.MIN_VALUE<=i&&i<=t.MAX_VALUE}}(r||(i.uinteger=r={})),function(t){t.create=function(t,i){return t===Number.MAX_VALUE&&(t=r.MAX_VALUE),i===Number.MAX_VALUE&&(i=r.MAX_VALUE),{line:t,character:i}},t.is=function(t){var i=t;return 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))}}(l||(i.LocationLink=l={})),function(t){t.create=function(t,i,e,s){return{red:t,green:i,blue:e,alpha:s}},t.is=function(t){var i=t;return 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)}}(u||(i.Color=u={})),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)&&u.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))}}(M||(i.DeleteFile=M={})),function(t){t.is=function(t){return t&&(void 0!==t.changes||void 0!==t.documentChanges)&&(void 0===t.documentChanges||t.documentChanges.every((function(t){return Ot.string(t.kind)?E.is(t)||A.is(t)||M.is(t):D.is(t)})))}}(L||(i.WorkspaceEdit=L={}));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,lt,ut,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}(),Mt=function(){function t(t){this._annotations=void 0===t?Object.create(null):t,this._counter=0,this._size=0}return t.prototype.all=function(){return this._annotations},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),t.prototype.manage=function(t,i){var e;if(S.is(t)?e=t:(e=this.nextId(),i=t),void 0!==this._annotations[e])throw new Error("Id ".concat(e," is already in use."));if(void 0===i)throw new Error("No annotation provided for id ".concat(e));return this._annotations[e]=i,this._size++,e},t.prototype.nextId=function(){return this._counter++,this._counter.toString()},t}(),Lt=function(){function t(t){var i=this;this._textEditChanges=Object.create(null),void 0!==t?(this._workspaceEdit=t,t.documentChanges?(this._changeAnnotations=new Mt(t.changeAnnotations),t.changeAnnotations=this._changeAnnotations.all(),t.documentChanges.forEach((function(t){if(D.is(t)){var e=new At(t.edits,i._changeAnnotations);i._textEditChanges[t.textDocument.uri]=e}}))):t.changes&&Object.keys(t.changes).forEach((function(e){var s=new At(t.changes[e]);i._textEditChanges[e]=s}))):this._workspaceEdit={}}return Object.defineProperty(t.prototype,"edit",{get:function(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(this._workspaceEdit.changeAnnotations=0===this._changeAnnotations.size?void 0:this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),t.prototype.getTextEditChange=function(t){if(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 Mt,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},t.prototype.initChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))},t.prototype.createFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=E.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=E.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t.prototype.renameFile=function(t,i,e,s){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n,r,o;if(C.is(e)||S.is(e)?n=e:s=e,void 0===n?r=A.create(t,i,s):(o=S.is(n)?n:this._changeAnnotations.manage(n),r=A.create(t,i,s,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},t.prototype.deleteFile=function(t,i,e){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var s,n,r;if(C.is(i)||S.is(i)?s=i:e=i,void 0===s?n=M.create(t,e):(r=S.is(s)?s:this._changeAnnotations.manage(s),n=M.create(t,e,r)),this._workspaceEdit.documentChanges.push(n),void 0!==r)return r},t}();i.WorkspaceChange=Lt,function(t){t.create=function(t){return{uri:t}},t.is=function(t){var i=t;return 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||L.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"}(lt||(i.SemanticTokenTypes=lt={})),function(t){t.declaration="declaration",t.definition="definition",t.readonly="readonly",t.static="static",t.deprecated="deprecated",t.abstract="abstract",t.async="async",t.modification="modification",t.documentation="documentation",t.defaultLibrary="defaultLibrary"}(ut||(i.SemanticTokenModifiers=ut={})),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 l=e(n[o],r[h]);t[c++]=l<=0?n[o++]:r[h++]}for(;o<n.length;)t[c++]=n[o++];for(;h<r.length;)t[c++]=r[h++];return t}t.create=function(t,i,e,s){return new 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),l=t.offsetAt(h.range.end);if(!(l<=r))throw new Error("Overlapping edit");s=s.substring(0,c)+h.newText+s.substring(l,s.length),r=c}return s}}(Et||(i.TextDocument=Et={}));var 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 Iit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Pit(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Nit(){return Iit?Pit("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Bit(){return Iit?Pit("esri/request"):(await import("@arcgis/core/request.js")).default}async function $it(t){return new(await async function(){return Iit?Pit("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function jit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Wit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function Vit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function Hit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.WebMap"===t.declaredClass}function zit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Uit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Kit(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function qit(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function Git(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var Zit=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function Jit(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 Qit(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)Jit(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function Yit(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 Xit(t){let i=Yit(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function tet(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(tet(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(tet(e.children[t],i))return!0;return!1}function iet(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void tet(t,i);let e=new MutationObserver((()=>{e.disconnect(),tet(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function eet(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function set(){return[eet(2),eet(1),eet(1),eet(1),eet(3)].join("-")}var net=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"]),ret=new Map;async function oet(t,i,e=""){let s=`${i}/${e}${t}.json`;if(ret.has(s))return ret.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return ret.set(s,t),t}if("en"===t)return void ret.set(s,void 0);let r=await oet("en",i,e);return ret.set(s,r),r}catch{return void ret.set(s,void 0)}}var het=new WeakMap,cet=new WeakMap,uet=new WeakMap;async function aet(t,i,e){cet.set(t,i),het.set(t,Qit(t._hostElement,["lang"],(()=>{fet(t,e)}))),await fet(t,e)}function det(t){het.get(t)?.disconnect(),het.delete(t),cet.delete(t)}async function fet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return Yit(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(net.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:net.has(e)?e:"en"}}(t._hostElement);if(e===t._lang&&s===t._t9nLocale||(e!==t._lang&&(t._lang=e),s===t._t9nLocale))return;let n=uet.get(t);if(!n){let i=cet.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await oet(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function get(t,i){return new Array(i+1).join(t)}function pet(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+get(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+get("\\"+i,n.length))),i+t+i}function met(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function vet(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function wet(t){return"‎"+(t??"")+"‎"}function bet(t){return null!==t}function yet(t){return void 0!==t}function ket(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 Cet(t){try{return new URL(t),!0}catch{return!1}}function xet(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=met(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 Det(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 Eet(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 Aet(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 Met(t){return!!t?.typeIdField}function Let(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Met(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 Oet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new $et({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new Vet(t,e,s)}const Fet=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function Tet(t,i=!0){return t.match(Fet)?`${i?".":""}${t}`:`["${t}"]`}function Ret(t,i){return t?`${t}${Tet(i)}`:i}async function _et(t){if(!t)return null;let i=null;if(jit(t)||Wit(t)||Kit(t))i=t;else if(i=await $it(t),!Vit(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 Iet(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 Pet(t,i=_it.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 Pet(s,_it.CompletionItemKind.Field),completion:{label:e,detail:e,insertText:e,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.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:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:i},o={name:s,description:n,type:"dictionary",properties:[],completion:r};if(!e)return o;let h=n;const c=[],l=[];return Eet(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=Tet(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:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:_it.CompletionItemKind.Field,documentation:{kind:"markdown",value:i}}}),!t.alias||t.alias.toLowerCase()===t.name.toLowerCase())return;let n=`**${t.alias}** \n${t.type}`;t.description&&(n+=` \n'${t.description}`),l.push({name:t.alias,description:t.name,type:e,completion:{label:t.alias,detail:t.name,insertText:s,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:_it.CompletionItemKind.Field,documentation:{kind:"markdown",value:n}}})})),o.properties=[...c,...l],r.documentation={kind:"markdown",value:h},o}(t,i);default:return function(t,i){const{name:e,type:s}=t,n=t.getDescription();return{name:e,description:n,type:s,completion:{label:e,detail:e,insertText:e,insertTextMode:_it.InsertTextMode.asIs,insertTextFormat:_it.InsertTextFormat.PlainText,kind:i,documentation:{kind:"markdown",value:n}}}}(t,i)}})));return e.filter((t=>t))}class Net{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?wet(this._label):vet(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:vet(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Bet extends Net{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 $et extends Bet{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?Aet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class jet extends Bet{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?Aet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Wet extends Bet{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 Vet extends Net{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class Het extends Wet{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new Vet(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=Ret(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new $et({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new Uet({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new Ket({profile:this._profile,declaration:t,label:i,snippet:i},[new $et({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new qet({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new Het({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new jet({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 zet extends Wet{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 bet(this._loadPromise)&&yet(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Ret(this.snippet,t.name):t.name;return new $et({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Det(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if("function"!=typeof this._source?.getFieldDomain)return null;const i="feature"===this.type?Ret(this.snippet,t.name):t.name,e=new Het({profile:this._profile,label:i,description:t.alias??t.name,snippet:i,icon:"form-dropdown"}),s=new Vet(this._profile,t.alias??t.name,[new $et({profile:this._profile,label:i,description:"",snippet:i})]);if(e.variables=[s],Met(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Oet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new $et({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new Vet(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 $et({profile:this._profile,label:i,description:"",snippet:i}))}if(Met(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=Oet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new Het({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new Vet(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(e.variables.push(i),e):null}const n=Oet(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 Vet(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 _et({url:e});return Vit(s)?s:null}(t,i);if(!Vit(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new Ket({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new $et({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(bet),e.variables.length?e:null}}class Uet extends zet{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return jit(this._source)?this._source.title:{code:"feature"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await _et(this._definition),!this._source)throw new Error("Invalid definition");const t=jit(this._source)?this._source.title:"";this.variables.push(new Vet(this._profile,t,[new $et({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const i=new Vet(this._profile,{code:"values"});if(this.variables.push(i),"boolean"==typeof this._source?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,e=new $et({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});i.variables.push(e)}this._source.fields.sort(Let(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 Ket extends zet{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return jit(this._source)?this._source.title:{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await _et(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new Vet(this._profile,this.title,this.featureSetSnippets));const t=new Vet(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(Let(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 qet extends Wet{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 bet(this._loadPromise)&&yet(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 Vet(this._profile,t,[new $et({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new Vet(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new Vet(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?Hit(this._definition)?this._featureSetCollectionFromWebMap(this._definition):jit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):zit(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):qit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=Hit(t)?t:await async function(t){return new(await async function(){return Iit?Pit("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 Iit?Pit("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 Bit(),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:Iet(s.layers,n),tables:Iet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await $it({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await $it({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(Vit(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 Ket({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 $et({profile:this._profile,label:i,description:"",snippet:i}),new $et({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new $et({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Get extends Het{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 Pet(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function Zet(t){return Vit(t)||Wit(t)||qit(t)||Kit(t)||Uit(t)}async function Jet(i="en"){const e=Qet.get(i);if(e)return e;if(!net.has(i))return Jet("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)})),Qet.set(t,e),e}(i,await e.json()):"en"===i?null:Jet("en")}catch(t){return null}}const Qet=new Map;function Yet(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(Yet):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function Xet(t,i="en"){if(!Git(t))return;const e=await async function(t,i="en"){return(await Jet(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(Yet({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return jit(n=e)||Wit(n)||qit(n)||Kit(n)||Uit(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return Zet(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSetCollection":return function(t){return zit(t)||Hit(t)||Zet(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(Yet(i))}var n})),Array.isArray(t?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const tst={locale:"en"},ist=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new DK,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new DK,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 _K.isUri(t)||(t=_K.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){Git(e)&&(e=await Xet(e,s.locale));const n=await oet(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 Get(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))??tst}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))}},est={setProfileForModel:ist.setProfileForModel.bind(ist)};export{aet as $,vet as B,iet as C,Cet as D,DK as E,det as F,aV as I,EK as K,TK as M,Xit as P,LK as R,kH as S,_K as U,ket as V,pet as W,est as a,Tit as b,Rit as c,ist as d,PK as e,xet as f,jW as g,Nit as h,Bit as i,Zit as j,set as k,NK as l,AK as m,$K as n,_it as o,Qit as p,wet as q,Eet as s,Kq as t,met as z}