@arcgis/coding-components 4.29.0-beta.44 → 4.29.0-beta.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/index.esm.js +1 -1
- package/dist/arcgis-coding-components/{p-37171412.js → p-20726826.js} +1 -1
- package/dist/arcgis-coding-components/{p-64560927.js → p-49b81305.js} +1 -1
- package/dist/arcgis-coding-components/{p-dfc0f916.js → p-5506f8c0.js} +7 -7
- package/dist/arcgis-coding-components/{p-b9310c14.js → p-593c9969.js} +1 -1
- package/dist/arcgis-coding-components/{p-b65c3a30.js → p-5f83dd46.js} +1 -1
- package/dist/arcgis-coding-components/{p-ac329c8b.js → p-693c2931.js} +1 -1
- package/dist/arcgis-coding-components/{p-19914b73.js → p-e003090e.js} +2 -2
- package/dist/arcgis-coding-components/{p-44c876c6.js → p-f99f681c.js} +1 -1
- package/dist/arcgis-coding-components/{p-19ebd1da.js → p-fc0d7092.js} +1 -1
- package/dist/arcgis-coding-components/{p-85fde36e.entry.js → p-fd5ae1c6.entry.js} +1 -1
- package/dist/cjs/{arcade-defaults-600286c5.js → arcade-defaults-217d1cf8.js} +7 -7
- package/dist/cjs/{arcade-mode-a3dd3456.js → arcade-mode-62615087.js} +1 -1
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +2 -2
- package/dist/cjs/{cssMode-814d3c28.js → cssMode-8dbdfeab.js} +1 -1
- package/dist/cjs/{html-c7f8f5b8.js → html-ce8d26f4.js} +1 -1
- package/dist/cjs/{htmlMode-7c25450b.js → htmlMode-db975b24.js} +1 -1
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{javascript-23788850.js → javascript-83920cc0.js} +2 -2
- package/dist/cjs/{jsonMode-1775fa05.js → jsonMode-b0322ac6.js} +1 -1
- package/dist/cjs/{tsMode-05a815c2.js → tsMode-d172e43e.js} +1 -1
- package/dist/cjs/{typescript-b19cd36a.js → typescript-f588a3f1.js} +1 -1
- package/dist/esm/{arcade-defaults-25a05c46.js → arcade-defaults-d7940d3d.js} +7 -7
- package/dist/esm/{arcade-mode-11544271.js → arcade-mode-16f490ad.js} +1 -1
- package/dist/esm/arcgis-arcade-api_6.entry.js +2 -2
- package/dist/esm/{cssMode-492e42ac.js → cssMode-e4306ea6.js} +1 -1
- package/dist/esm/{html-6a447e7c.js → html-78f7ebdf.js} +1 -1
- package/dist/esm/{htmlMode-aaee0504.js → htmlMode-8cf4a07c.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{javascript-26c3c919.js → javascript-56f381ad.js} +2 -2
- package/dist/esm/{jsonMode-2ed77767.js → jsonMode-b48f3553.js} +1 -1
- package/dist/esm/{tsMode-f93cc05e.js → tsMode-87922314.js} +1 -1
- package/dist/esm/{typescript-809c3181.js → typescript-1d658551.js} +1 -1
- package/package.json +7 -7
|
@@ -18,45 +18,45 @@ import{g as t}from"./p-5d670bd2.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
|
-
QK({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-
|
|
21
|
+
QK({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-e003090e.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
|
-
QK({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-
|
|
28
|
+
QK({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>import("./p-5f83dd46.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
|
-
QK({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-
|
|
35
|
+
QK({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>import("./p-fc0d7092.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 YK=Object.defineProperty,XK=Object.getOwnPropertyDescriptor,tq=Object.getOwnPropertyNames,iq=Object.prototype.hasOwnProperty,eq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of tq(i))iq.call(t,n)||n===e||YK(t,n,{get:()=>i[n],enumerable:!(s=XK(i,n))||s.enumerable});return t},sq={};((t,i)=>{eq(sq,i,"default")})(0,WK);var nq=class{_onDidChange=new sq.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)}},rq={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}},oq={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},hq=new nq("css",rq,oq),cq=new nq("scss",rq,oq),lq=new nq("less",rq,oq);function uq(){return import("./p-
|
|
42
|
+
var YK=Object.defineProperty,XK=Object.getOwnPropertyDescriptor,tq=Object.getOwnPropertyNames,iq=Object.prototype.hasOwnProperty,eq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of tq(i))iq.call(t,n)||n===e||YK(t,n,{get:()=>i[n],enumerable:!(s=XK(i,n))||s.enumerable});return t},sq={};((t,i)=>{eq(sq,i,"default")})(0,WK);var nq=class{_onDidChange=new sq.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)}},rq={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}},oq={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},hq=new nq("css",rq,oq),cq=new nq("scss",rq,oq),lq=new nq("less",rq,oq);function uq(){return import("./p-f99f681c.js")}sq.languages.css={cssDefaults:hq,lessDefaults:lq,scssDefaults:cq},sq.languages.onLanguage("less",(()=>{uq().then((t=>t.setupMode(lq)))})),sq.languages.onLanguage("scss",(()=>{uq().then((t=>t.setupMode(cq)))})),sq.languages.onLanguage("css",(()=>{uq().then((t=>t.setupMode(hq)))}));
|
|
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 aq=Object.defineProperty,dq=Object.getOwnPropertyDescriptor,fq=Object.getOwnPropertyNames,gq=Object.prototype.hasOwnProperty,pq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of fq(i))gq.call(t,n)||n===e||aq(t,n,{get:()=>i[n],enumerable:!(s=dq(i,n))||s.enumerable});return t},mq={};((t,i)=>{pq(mq,i,"default")})(0,WK);var vq=class{_onDidChange=new mq.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)}},wq={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 bq(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===yq,documentFormattingEdits:t===yq,documentRangeFormattingEdits:t===yq}}var yq="html",kq="handlebars",Cq="razor",Sq=Mq(yq,wq,bq(yq)),xq=Sq.defaults,Dq=Mq(kq,wq,bq(kq)),Eq=Dq.defaults,Aq=Mq(Cq,wq,bq(Cq));function Mq(t,i=wq,e=bq(t)){const s=new vq(t,i,e);let n;const r=mq.languages.onLanguage(t,(async()=>{n=(await import("./p-
|
|
49
|
+
var aq=Object.defineProperty,dq=Object.getOwnPropertyDescriptor,fq=Object.getOwnPropertyNames,gq=Object.prototype.hasOwnProperty,pq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of fq(i))gq.call(t,n)||n===e||aq(t,n,{get:()=>i[n],enumerable:!(s=dq(i,n))||s.enumerable});return t},mq={};((t,i)=>{pq(mq,i,"default")})(0,WK);var vq=class{_onDidChange=new mq.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)}},wq={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 bq(t){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:t===yq,documentFormattingEdits:t===yq,documentRangeFormattingEdits:t===yq}}var yq="html",kq="handlebars",Cq="razor",Sq=Mq(yq,wq,bq(yq)),xq=Sq.defaults,Dq=Mq(kq,wq,bq(kq)),Eq=Dq.defaults,Aq=Mq(Cq,wq,bq(Cq));function Mq(t,i=wq,e=bq(t)){const s=new vq(t,i,e);let n;const r=mq.languages.onLanguage(t,(async()=>{n=(await import("./p-693c2931.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
|
-
*-----------------------------------------------------------------------------*/mq.languages.html={htmlDefaults:xq,razorDefaults:Aq.defaults,handlebarDefaults:Eq,htmlLanguageService:Sq,handlebarLanguageService:Dq,razorLanguageService:Aq,registerHTMLLanguageService:Mq};var Lq=Object.defineProperty,Oq=Object.getOwnPropertyDescriptor,Fq=Object.getOwnPropertyNames,Tq=Object.prototype.hasOwnProperty,Rq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Fq(i))Tq.call(t,n)||n===e||Lq(t,n,{get:()=>i[n],enumerable:!(s=Oq(i,n))||s.enumerable});return t},_q={};((t,i)=>{Rq(_q,i,"default")})(0,WK);var Iq=new class{_onDidChange=new _q.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});_q.languages.json={jsonDefaults:Iq},_q.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),_q.languages.onLanguage("json",(()=>{import("./p-
|
|
55
|
+
*-----------------------------------------------------------------------------*/mq.languages.html={htmlDefaults:xq,razorDefaults:Aq.defaults,handlebarDefaults:Eq,htmlLanguageService:Sq,handlebarLanguageService:Dq,razorLanguageService:Aq,registerHTMLLanguageService:Mq};var Lq=Object.defineProperty,Oq=Object.getOwnPropertyDescriptor,Fq=Object.getOwnPropertyNames,Tq=Object.prototype.hasOwnProperty,Rq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Fq(i))Tq.call(t,n)||n===e||Lq(t,n,{get:()=>i[n],enumerable:!(s=Oq(i,n))||s.enumerable});return t},_q={};((t,i)=>{Rq(_q,i,"default")})(0,WK);var Iq=new class{_onDidChange=new _q.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});_q.languages.json={jsonDefaults:Iq},_q.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),_q.languages.onLanguage("json",(()=>{import("./p-20726826.js").then((t=>t.setupMode(Iq)))}));
|
|
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 Pq=Object.defineProperty,Nq=Object.getOwnPropertyDescriptor,Bq=Object.getOwnPropertyNames,$q=Object.prototype.hasOwnProperty,jq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Bq(i))$q.call(t,n)||n===e||Pq(t,n,{get:()=>i[n],enumerable:!(s=Nq(i,n))||s.enumerable});return t},Wq={};((t,i)=>{jq(Wq,i,"default")})(0,WK);var Vq=(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))(Vq||{}),Hq=(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))(Hq||{}),zq=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(zq||{}),Uq=(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))(Uq||{}),Kq=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(Kq||{}),qq=class{_onDidChange=new Wq.Emitter;_onDidExtraLibsChange=new Wq.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)}},Gq={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},Zq=new qq({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},Gq),Jq=new qq({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},Gq);function Qq(){return import("./p-64560927.js")}Wq.languages.typescript={ModuleKind:Vq,JsxEmit:Hq,NewLineKind:zq,ScriptTarget:Uq,ModuleResolutionKind:Kq,typescriptVersion:"5.0.2",typescriptDefaults:Zq,javascriptDefaults:Jq,getTypeScriptWorker:()=>Qq().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>Qq().then((t=>t.getJavaScriptWorker()))},Wq.languages.onLanguage("typescript",(()=>Qq().then((t=>t.setupTypeScript(Zq))))),Wq.languages.onLanguage("javascript",(()=>Qq().then((t=>t.setupJavaScript(Jq))))),Dh(class extends xh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:J(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:ys.map,toggled:Mo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Mo.has("isInDiffEditor"),menu:{when:Mo.has("isInDiffEditor"),id:wh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class Yq extends xh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:J(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Mo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Dh(Yq);class Xq extends xh{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:Mo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Dh(Xq),kh.appendMenuItem(wh.EditorTitle,{command:{id:(new Xq).desc.id,title:J(0,"Use Inline View When Space Is Limited"),toggled:Mo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Mo.has("isInDiffEditor")},order:11,group:"1_diff",when:Mo.and(fS.diffEditorRenderSideBySideInlineBreakpointReached,Mo.has("isInDiffEditor"))}),kh.appendMenuItem(wh.EditorTitle,{command:{id:(new Yq).desc.id,title:J(0,"Show Moved Code Blocks"),icon:ys.move,toggled:Ro.create("config.diffEditor.experimental.showMoves",!0),precondition:Mo.has("isInDiffEditor")},order:10,group:"1_diff",when:Mo.has("isInDiffEditor")});const tG={value:J(0,"Diff Editor"),original:"Diff Editor"};Dh(class extends tu{constructor(){super({id:"diffEditor.switchSide",title:{value:J(0,"Switch Side"),original:"Switch Side"},icon:ys.arrowSwap,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,e){const s=nG(t);if(s instanceof FU){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Dh(class extends tu{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:J(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:ys.close,precondition:fS.comparingMovedCode,f1:!1,category:tG,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.exitCompareMove()}}),Dh(class extends tu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:J(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:ys.fold,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.collapseAllUnchangedRegions()}}),Dh(class extends tu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:J(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:ys.unfold,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.showAllUnchangedRegions()}});const iG={value:J(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class eG extends xh{constructor(){super({id:eG.id,title:{value:J(0,"Go to Next Difference"),original:"Go to Next Difference"},category:iG,precondition:Mo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=nG(t);null==i||i.accessibleDiffViewerNext()}}eG.id="editor.action.accessibleDiffViewer.next",kh.appendMenuItem(wh.EditorTitle,{command:{id:eG.id,title:J(0,"Open Accessible Diff Viewer"),precondition:Mo.has("isInDiffEditor")},order:10,group:"2_diff",when:Mo.and(fS.accessibleDiffViewerVisible.negate(),Mo.has("isInDiffEditor"))});class sG extends xh{constructor(){super({id:sG.id,title:{value:J(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:iG,precondition:Mo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=nG(t);null==i||i.accessibleDiffViewerPrev()}}function nG(t){var i;const e=t.get(Qr),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=ml();if(r)for(const t of s)if(rG(t.getContainerDomNode(),r))return t;return null}function rG(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}sG.id="editor.action.accessibleDiffViewer.prev",uo.registerCommandAlias("editor.action.diffReview.next",eG.id),Dh(eG),uo.registerCommandAlias("editor.action.diffReview.prev",sG.id),Dh(sG);var oG,hG=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 cG=new Go("selectionAnchorSet",!1);let lG=oG=class{static get(t){return t.getContribution(oG.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=cG.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),em(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()}};lG.ID="editor.contrib.selectionAnchorController",lG=oG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zo)],lG),ru(lG.ID,lG,4),su(class extends Yl{constructor(){super({id:"editor.action.setSelectionAnchor",label:J(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2080),weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.setSelectionAnchor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.goToSelectionAnchor",label:J(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:cG})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:J(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:cG,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2089),weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:J(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:cG,kbOpts:{kbExpr:fS.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const uG=Lm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},J(0,"Overview ruler marker color for matching brackets."));class aG{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class dG extends Hi{static get(t){return t.getContribution(dG.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Eu((()=>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=dG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=dG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new aG(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}dG.ID="editor.contrib.bracketMatchingController",dG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=$M.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:mk(uG),position:Qd.Center}}),dG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=$M.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),ru(dG.ID,dG,1),su(class extends Yl{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=dG.get(i))||void 0===s||s.selectToBracket(n)}}),su(class extends Yl{constructor(){super({id:"editor.action.jumpToBracket",label:J(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=dG.get(i))||void 0===e||e.jumpToBracket()}}),su(class extends Yl{constructor(){super({id:"editor.action.removeBrackets",label:J(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=dG.get(i))||void 0===e||e.removeBrackets(this.id)}}),kh.appendMenuItem(wh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:J(0,"Go to &&Bracket")},order:2});class fG{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 gG extends Yl{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 fG(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}su(class extends gG{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:J(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:fS.writable})}}),su(class extends gG{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:J(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:fS.writable})}}),su(class extends Yl{constructor(){super({id:"editor.action.transposeLetters",label:J(0,"Transpose Letters"),alias:"Transpose Letters",precondition:fS.writable,kbOpts:{kbExpr:fS.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():HC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=HC.leftPosition(e,o),c=HC.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 NC(a,u+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const pG="9_cutcopypaste",mG=pt||document.queryCommandSupported("cut"),vG=pt||document.queryCommandSupported("copy"),wG=void 0!==navigator.clipboard&&!Lr||document.queryCommandSupported("paste");function bG(t){return t.register(),t}const yG=mG?bG(new Zl({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:pt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"Cu&&t"),order:1},{menuId:wh.EditorContext,group:pG,title:J(0,"Cut"),when:fS.writable,order:1},{menuId:wh.CommandPalette,group:"",title:J(0,"Cut"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Cut"),when:fS.writable,order:1}]})):void 0,kG=vG?bG(new Zl({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:pt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Copy"),order:2},{menuId:wh.EditorContext,group:pG,title:J(0,"Copy"),order:2},{menuId:wh.CommandPalette,group:"",title:J(0,"Copy"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Copy"),order:2}]})):void 0;kh.appendMenuItem(wh.MenubarEditMenu,{submenu:wh.MenubarCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:pG,order:3}),kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Mo.and(Mo.notEquals("resourceScheme","output"),fS.editorTextFocus)}),kh.appendMenuItem(wh.EditorTitleContext,{submenu:wh.EditorTitleContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1}),kh.appendMenuItem(wh.ExplorerContext,{submenu:wh.ExplorerContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1});const CG=wG?bG(new Zl({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:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Paste"),order:4},{menuId:wh.EditorContext,group:pG,title:J(0,"Paste"),when:fS.writable,order:4},{menuId:wh.CommandPalette,group:"",title:J(0,"Paste"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Paste"),when:fS.writable,order:4}]})):void 0;function SG(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(Qr).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",(()=>(vl().execCommand(i),!0))))}SG(yG,"cut"),SG(kG,"copy"),CG&&(CG.addImplementation(1e4,"code-editor",(t=>{const i=t.get(Qr),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=ok.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})}})))})),CG.addImplementation(0,"generic-dom",(()=>(vl().execCommand("paste"),!0)))),vG&&su(class extends Yl{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:J(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(rk.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),rk.forceCopyWithSyntaxHighlighting=!1))}});var xG;class DG{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+DG.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new DG(this.value+DG.sep+t)}}function EG(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}DG.sep=".",DG.None=new DG("@@none@@"),DG.Empty=new DG(""),DG.QuickFix=new DG("quickfix"),DG.Refactor=new DG("refactor"),DG.RefactorExtract=DG.Refactor.append("extract"),DG.RefactorInline=DG.Refactor.append("inline"),DG.RefactorMove=DG.Refactor.append("move"),DG.RefactorRewrite=DG.Refactor.append("rewrite"),DG.Notebook=new DG("notebook"),DG.Source=new DG("source"),DG.SourceOrganizeImports=DG.Source.append("organizeImports"),DG.SourceFixAll=DG.Source.append("fixAll"),DG.SurroundWith=DG.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"}(xG||(xG={}));class AG{static fromUser(t,i){return t&&"object"==typeof t?new AG(AG.getKindFromUser(t,i.kind),AG.getApplyFromUser(t,i.apply),AG.getPreferredUser(t)):new AG(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 DG(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 MG{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 LG=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 OG="editor.action.codeAction",FG="editor.action.quickFix",TG="editor.action.autoFix",RG="editor.action.refactor",_G="editor.action.sourceAction",IG="editor.action.organizeImports",PG="editor.action.fixAll";class NG 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)?NG.codeActionsPreferredComparator(t,i):-1:a(i.diagnostics)?1:NG.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(NG.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&DG.QuickFix.contains(new DG(t.kind))&&!!t.isPreferred))}}const BG={actions:[],documentation:void 0};function $G(t,i,s,n,r,o){var h;return LG(this,void 0,void 0,(function*(){const l=n.filter||{},u=Object.assign(Object.assign({},l),{excludes:[...l.excludes||[],DG.Notebook]}),a={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new lK(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=>EG(i,e,t.include)))||!t.includeSourceActions&&DG.Source.contains(i))}(e,new DG(t))))))}(t,i,2===n.type?u:l),g=new Vi,p=f.map((t=>LG(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 BG;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new DG(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>EG(e,i,t.include)))||!t.includeSourceActions&&e&&DG.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 DG(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 DG(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new MG(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),BG}})))),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))),...jG(t,i,n,s)];return new NG(s,r,g)}finally{m.dispose(),d.dispose()}}))}function*jG(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 WG;function VG(t,i,e,s,n=ue.None){var r;return LG(this,void 0,void 0,(function*(){const o=t.get(kT),h=t.get(lo),c=t.get(Eh),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!==WG.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"}(WG||(WG={})),uo.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return LG(this,void 0,void 0,(function*(){if(!(i instanceof ss))throw Ti();const{codeActionProvider:r}=t.get($g),o=t.get(Yr).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 DG(s):void 0,l=yield $G(r,o,h,{type:1,triggerAction:xG.Default,filter:{includeSourceActions:!0,include:c}},nR.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 HG;let zG=HG=class{constructor(t){this.keybindingService=t}getResolver(){const t=new Mn((()=>this.keybindingService.getKeybindings().filter((t=>HG.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===IG?i={kind:DG.SourceOrganizeImports.value}:t.command===PG&&(i={kind:DG.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},AG.fromUser(i,{kind:DG.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 DG(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)}};zG.codeActionCommands=[RG,OG,_G,IG,PG],zG=HG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,kC)],zG),Lm("symbolIcon.arrayForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.booleanForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("symbolIcon.colorForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.constantForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("symbolIcon.fileForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.folderForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("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.")),Lm("symbolIcon.keyForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.keywordForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("symbolIcon.moduleForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.namespaceForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.nullForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.numberForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.objectForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.operatorForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.packageForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.propertyForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.referenceForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.snippetForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.stringForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.structForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.textForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.typeParameterForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.unitForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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 UG=Object.freeze({kind:DG.Empty,title:J(0,"More Actions...")}),KG=Object.freeze([{kind:DG.QuickFix,title:J(0,"Quick Fix")},{kind:DG.RefactorExtract,title:J(0,"Extract"),icon:ys.wrench},{kind:DG.RefactorInline,title:J(0,"Inline"),icon:ys.wrench},{kind:DG.RefactorRewrite,title:J(0,"Rewrite"),icon:ys.wrench},{kind:DG.RefactorMove,title:J(0,"Move"),icon:ys.wrench},{kind:DG.SurroundWith,title:J(0,"Surround With"),icon:ys.symbolSnippet},{kind:DG.Source,title:J(0,"Source Action"),icon:ys.symbolFile},UG]);var qG,GG;!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}}}(GG||(GG={}));let ZG=qG=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=GG.Hidden,this._domNode=_l("div.lightBulbWidget"),this._register(Sm.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 Zc(t,wt&&Rh?xl.POINTER_DOWN:xl.MOUSE_DOWN,i,e)}(this._domNode,Jc((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=ol(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(Zc(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(TG))||void 0===t?void 0:t.getLabel())&&void 0!==e?e:void 0,this._quickFixKbLabel=null!==(n=null===(s=i.lookupKeybinding(FG))||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=qS(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 GG.Showing(t,i,e,{position:{lineNumber:a,column:1},preference:qG._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==GG.Hidden&&(this.state=GG.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(...io.asClassNameArray(ys.lightBulb)),this._domNode.classList.add(...io.asClassNameArray(ys.lightbulbAutofix)),this._preferredKbLabel)?this.title=J(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...io.asClassNameArray(ys.lightbulbAutofix)),this._domNode.classList.add(...io.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}};ZG.ID="editor.contrib.lightbulbWidget",ZG._posPref=[0],ZG=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,kC)],ZG);var JG,QG=function(t,i){return function(e,s){i(e,s,t)}},YG=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 XG=JG=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)=>YG(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=td);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=JG._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=>tZ(this._openerService,i,t.isTrusted),disposables:i}}}};function tZ(t,i,e){return YG(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:iZ(e)})}catch(t){return Ei(t),!1}}))}function iZ(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}XG._ttpTokenizer=zu("tokenizeToString",{createHTML:t=>t}),XG=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}([QG(1,Pa),QG(2,AF)],XG);var eZ,sZ=function(t,i){return function(e,s){i(e,s,t)}};let nZ=eZ=class{static get(t){return t.getContribution(eZ.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new zi,this._messageListeners=new Vi,this._mouseOverMessage=!1,this._editor=t,this._visible=eZ.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;em(U_(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=U_(t)?fI(t,{actionHandler:{callback:i=>tZ(this._openerService,i,U_(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new rZ(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&&al(ml(),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(Zc(this._messageWidget.value.getDomNode(),xl.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Zc(this._messageWidget.value.getDomNode(),xl.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(rZ.fadeOut(this._messageWidget.value))}};nZ.ID="editor.contrib.messageController",nZ.MESSAGE_VISIBLE=new Go("messageVisible",!1,J(0,"Whether the editor is currently showing an inline message")),nZ=eZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([sZ(1,Zo),sZ(2,AF)],nZ),eu(new(Ql.bindToContribution(nZ.get))({id:"leaveEditorMessage",precondition:nZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class rZ{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)}}ru(nZ.ID,nZ,4);var oZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},hZ=function(t,i){return function(e,s){i(e,s,t)}};const cZ="acceptSelectedCodeAction",lZ="previewSelectedCodeAction";class uZ{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 aZ=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=io.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=Em(t.group.icon.color.id))):(e.icon.className=io.asClassName(ys.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=mZ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Il(...i):Pl(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(cZ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(lZ))||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){}};aZ=oZ([hZ(1,kC)],aZ);class dZ extends UIEvent{constructor(){super("acceptSelectedAction")}}class fZ extends UIEvent{constructor(){super("previewSelectedAction")}}function gZ(t){if("action"===t.kind)return t.label}let pZ=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 aZ(i,this._keybindingService),new uZ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:gZ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?mZ(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 fZ:new dZ;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 fZ):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 mZ(t){return t.replace(/\r\n|\r|\n/g," ")}pZ=oZ([hZ(4,ER),hZ(5,kC)],pZ);var vZ=function(t,i){return function(e,s){i(e,s,t)}};Lm("actionBar.toggledBackground",{dark:Hm,light:Hm,hcDark:Hm,hcLight:Hm},J(0,"Background color for toggled action items in action bar."));const wZ={Visible:new Go("codeActionMenuVisible",!1,J(0,"Whether the action widget list is visible"))},bZ=Jr("actionWidgetService");let yZ=class extends Hi{get isVisible(){return wZ.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=wZ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(pZ,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(Zc(h,xl.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Zc(l,xl.POINTER_MOVE,(()=>l.remove()))),r.add(Zc(l,xl.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(Al(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=_l(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)}};yZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(0,ER),vZ(1,Zo),vZ(2,Zr)],yZ),$a(bZ,yZ,1);const kZ=1100;Dh(class extends xh{constructor(){super({id:"hideCodeActionWidget",title:{value:J(0,"Hide action widget"),original:"Hide action widget"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:9,secondary:[1033]}})}run(t){t.get(bZ).hide()}}),Dh(class extends xh{constructor(){super({id:"selectPrevCodeAction",title:{value:J(0,"Select previous action"),original:"Select previous action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.focusPrevious()}}),Dh(class extends xh{constructor(){super({id:"selectNextCodeAction",title:{value:J(0,"Select next action"),original:"Select next action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.focusNext()}}),Dh(class extends xh{constructor(){super({id:cZ,title:{value:J(0,"Accept selected action"),original:"Accept selected action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:3,secondary:[2137]}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.acceptSelected()}}),Dh(class extends xh{constructor(){super({id:lZ,title:{value:J(0,"Preview selected action"),original:"Preview selected action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:2051}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.acceptSelected(!0)}});const CZ=new Go("supportedCodeAction","");class SZ 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 xu),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:xG.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 xZ;!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 DZ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(xZ||(xZ={}));const DZ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class EZ 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=xZ.Empty,this._onDidChangeState=this._register(new ie),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=CZ.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(xZ.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(xZ.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 SZ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(xZ.Empty);const s=i.selection.getStartPosition(),n=mu((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===xG.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(DG.QuickFix)))){const s=yield $G(this._registry,t,i.selection,i.trigger,nR.None,e);if(e.isCancellationRequested)return DZ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&DG.QuickFix.contains(new DG(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:DG.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 $G(this._registry,t,r,n,nR.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 $G(this._registry,t,i.selection,i.trigger,nR.None,e)}))));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new xZ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:xG.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 AZ,MZ=function(t,i){return function(e,s){i(e,s,t)}},LZ=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 OZ=AZ=class extends Hi{static get(t){return t.getContribution(AZ.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 EZ(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(ZG.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(zG),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=nZ.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 LZ(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction(VG,t,WG.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:xG.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return LZ(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=nZ.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=nZ.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 LZ(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)=>LZ(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)=>LZ(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:AZ.DECORATION}]);const n=t.action.diagnostics[0];sm(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:UG,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=KG.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new DG(i.action.kind):DG.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=ol(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 FZ(t){return Mo.regex(CZ.keys()[0],new RegExp("(\\s|^)"+Rn(t.value)+"\\b"))}OZ.ID="editor.contrib.codeActionController",OZ.DECORATION=$M.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),OZ=AZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([MZ(1,FN),MZ(2,Zo),MZ(3,Zr),MZ(4,$g),MZ(5,rR),MZ(6,lo),MZ(7,Oa),MZ(8,bZ),MZ(9,Zr)],OZ),yk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(Kv));const e=t.getColor(Zv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${ry(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const TZ={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 RZ(t,i,e,s,n=xG.Default){if(t.hasModel()){const r=OZ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}ru(OZ.ID,OZ,3),ru(ZG.ID,ZG,4),su(class extends Yl{constructor(){super({id:FG,label:J(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),kbOpts:{kbExpr:fS.textInputFocus,primary:2137,weight:100}})}run(t,i){return RZ(i,J(0,"No code actions available"),void 0,void 0,xG.QuickFix)}}),su(class extends Yl{constructor(){super({id:RG,label:J(0,"Refactor..."),alias:"Refactor...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),kbOpts:{kbExpr:fS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Mo.and(fS.writable,FZ(DG.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:TZ}]}})}run(t,i,e){const s=AG.fromUser(e,{kind:DG.Refactor,apply:"never"});return RZ(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:DG.Refactor.contains(s.kind)?s.kind:DG.None,onlyIncludePreferredActions:s.preferred},s.apply,xG.Refactor)}}),su(class extends Yl{constructor(){super({id:_G,label:J(0,"Source Action..."),alias:"Source Action...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Mo.and(fS.writable,FZ(DG.Source))},description:{description:"Source Action...",args:[{name:"args",schema:TZ}]}})}run(t,i,e){const s=AG.fromUser(e,{kind:DG.Source,apply:"never"});return RZ(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:DG.Source.contains(s.kind)?s.kind:DG.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,xG.SourceAction)}}),su(class extends Yl{constructor(){super({id:IG,label:J(0,"Organize Imports"),alias:"Organize Imports",precondition:Mo.and(fS.writable,FZ(DG.SourceOrganizeImports)),kbOpts:{kbExpr:fS.textInputFocus,primary:1581,weight:100}})}run(t,i){return RZ(i,J(0,"No organize imports action available"),{include:DG.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",xG.OrganizeImports)}}),su(class extends Yl{constructor(){super({id:TG,label:J(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Mo.and(fS.writable,FZ(DG.QuickFix)),kbOpts:{kbExpr:fS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return RZ(i,J(0,"No auto fixes available"),{include:DG.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",xG.AutoFix)}}),su(class extends Yl{constructor(){super({id:PG,label:J(0,"Fix All"),alias:"Fix All",precondition:Mo.and(fS.writable,FZ(DG.SourceFixAll))})}run(t,i){return RZ(i,J(0,"No fix all action available"),{include:DG.SourceFixAll,includeSourceActions:!0},"ifSingle",xG.FixAll)}}),eu(new class extends Ql{constructor(){super({id:OG,precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:TZ}]}})}runEditorCommand(t,i,e){const s=AG.fromUser(e,{kind:DG.Empty,apply:"ifSingle"});return RZ(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)}}),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:J(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}})),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{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 _Z=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 IZ{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 PZ(t,i,e){return _Z(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new IZ,o=s.map(((t,s)=>_Z(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}))}uo.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(ss.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get($g),r=t.get(Yr).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return PZ(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 NZ=Jr("ICodeLensCache");class BZ{constructor(t,i){this.lineCount=t,this.data=i}}let $Z=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new hg(20,.75),Au((()=>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 IZ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new BZ(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 IZ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new BZ(e.lineCount,n))}}catch(t){}}};$Z=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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)],$Z),$a(NZ,$Z,1);class jZ{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 WZ{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+WZ._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(_l("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(_l("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(_l("span",void 0," | "))}}s?(Ol(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Ol(this._domNode,_l("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}}WZ._idPool=0;class VZ{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 HZ=$M.register({collapseOnReplaceEdit:!0,description:"codelens"});class zZ{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:HZ},(t=>this._decorationIds[i]=t)),o=o?ps.plusRange(o,t.symbol.range):ps.lift(t.symbol.range)})),this._viewZone=new jZ(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 WZ(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:HZ},(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 UZ=function(t,i){return function(e,s){i(e,s,t)}},KZ=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 qZ=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 Eu((()=>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(Cu((()=>{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 Eu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=mu((i=>PZ(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 VZ;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=iU.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 VZ;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=iU.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new VZ;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 zZ(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 zZ(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=mu((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 KZ(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}))}};qZ.ID="css.editor.codeLens",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(1,$g),UZ(2,FF),UZ(3,lo),UZ(4,vO),UZ(5,NZ)],qZ),ru(qZ.ID,qZ,1),su(class extends Yl{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:fS.hasCodeLensProvider,label:J(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return KZ(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Ij),s=t.get(lo),n=t.get(vO),r=i.getSelection().positionLineNumber,o=i.getContribution(qZ.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 GZ=function(t,i){return function(e,s){i(e,s,t)}};class ZZ{constructor(t,i){this._editorWorkerClient=new Zg(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 Eg(new Sg(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Eg.Format.CSS.formatRGB(o):Eg.Format.CSS.formatRGBA(o),c=r?Eg.Format.CSS.formatHSL(o):Eg.Format.CSS.formatHSLA(o),l=r?Eg.Format.CSS.formatHex(o):Eg.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 JZ=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new ZZ(t,i)))}};JZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Yr),GZ(1,cd),GZ(2,$g)],JZ),tH(JZ);var QZ=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 YZ(t,i,e,s=!0){return QZ(this,void 0,void 0,(function*(){return sJ(new tJ,t,i,e,s)}))}function XZ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class tJ{constructor(){}compute(t,i,e,s){return QZ(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 iJ{constructor(){}compute(t,i,e,s){return QZ(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 eJ{constructor(t){this.colorInfo=t}compute(t,i,e,s){return QZ(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 sJ(t,i,e,s,n){return QZ(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 ZZ)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 nJ(t,i){const{colorProvider:e}=t.get($g),s=t.get(Yr).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(Oa).getValue("editor.defaultColorDecorators",{resource:i})}}uo.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof ss))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=nJ(t,e);return sJ(new iJ,n,s,ue.None,r)})),uo.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}=nJ(t,n),[l,u,a,d]=e;return sJ(new eJ({range:r,color:{red:l,green:u,blue:a,alpha:d}}),h,o,ue.None,c)}));var rJ,oJ=function(t,i){return function(e,s){i(e,s,t)}},hJ=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 cJ=Object.create({});let lJ=rJ=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 zb(this._editor),this._decoratorLimitReporter=new uJ,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:rJ.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 xu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return hJ(this,void 0,void 0,(function*(){this._computePromise=mu((t=>hJ(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Zi(!1),s=yield YZ(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 Sg(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:cJ}}})}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)}};lJ.ID="editor.contrib.colorDetector",lJ.RECOMPUTE_TIME=1e3,lJ=rJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([oJ(1,Oa),oJ(2,$g),oJ(3,FF)],lJ);class uJ{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())}}ru(lJ.ID,lJ,1);class aJ{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 dJ=_l;class fJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=dJ(".colorpicker-header"),Ml(t,this._domNode),this._pickedColorNode=Ml(this._domNode,dJ(".picked-color")),Ml(this._pickedColorNode,dJ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Ml(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=Ml(this._domNode,dJ(".original-color")),this._originalColorNode.style.backgroundColor=Eg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(Qv)||Eg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Qv)||Eg.white}))),this._register(Zc(this._pickedColorNode,xl.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Zc(this._originalColorNode,xl.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=Eg.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 gJ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Eg.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 gJ 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"),Ml(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Ml(this._button,i),Ml(i,dJ(".button"+io.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 pJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=dJ(".colorpicker-body"),Ml(t,this._domNode),this._saturationBox=new mJ(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 wJ(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 bJ(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 yJ(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 Eg(new Dg(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Eg(new Dg(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Eg(new Dg(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 mJ 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=dJ(".saturation-wrap"),Ml(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ml(this._domNode,this._canvas),this.selection=dJ(".saturation-selection"),Ml(this._domNode,this.selection),this.layout(),this._register(Zc(this._domNode,xl.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 xm);const i=ol(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=Zc(t.target.ownerDocument,xl.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 Eg(new Dg(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=Eg.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 vJ 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=Ml(t,dJ(".standalone-strip")),this.overlay=Ml(this.domNode,dJ(".standalone-overlay"))):(this.domNode=Ml(t,dJ(".strip")),this.overlay=Ml(this.domNode,dJ(".overlay"))),this.slider=Ml(this.domNode,dJ(".slider")),this.slider.style.top="0px",this._register(Zc(this.domNode,xl.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 xm),e=ol(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=Zc(t.target.ownerDocument,xl.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 wJ extends vJ{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 Eg(new Sg(i,e,s,1)),r=new Eg(new Sg(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class bJ extends vJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class yJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=Ml(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 kJ extends Fy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Ar.onDidChange((()=>this.layout())));const r=dJ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new fJ(r,this.model,s,n)),this.body=this._register(new pJ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var CJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},SJ=function(t,i){return function(e,s){i(e,s,t)}},xJ=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 DJ{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 EJ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return Fu.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return xJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=lJ.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 LJ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return OJ(this,this._editor,this._themeService,i,t)}};EJ=CJ([SJ(1,pk)],EJ);class AJ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let MJ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return xJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!lJ.get(this._editor))return null;const s=yield YZ(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 LJ(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return xJ(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 TJ(this._editor.getModel(),i,this._color,e,t),e=FJ(this._editor,e,i))}))}renderHoverParts(t,i){return OJ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function LJ(t,i,e,s){return xJ(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Sg(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),u=new Eg(l),a=yield XZ(i,e,s,ue.None),d=new aJ(u,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(u,n),t instanceof EJ?new DJ(t,ps.lift(e.range),d,s):new AJ(t,ps.lift(e.range),d,s)}))}function OJ(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 nl(302,t))}const r=new Vi,o=s[0],h=i.getModel(),c=o.model,l=r.add(new kJ(n.fragment,c,i.getOption(141),e,t instanceof MJ));n.setColorPicker(l);let u=!1,a=new ps(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof MJ){const i=s[0].model.color;t.color=i,TJ(h,c,i,a,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>xJ(this,void 0,void 0,(function*(){yield TJ(h,c,t,a,o),u=!0,a=FJ(i,a,c,n)})))));return r.add(c.onDidChangeColor((t=>{TJ(h,c,t,a,o)}))),r.add(i.onDidChangeModelContent((()=>{u?u=!1:(n.hide(),i.focus())}))),r}function FJ(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 TJ(t,i,e,s,n){return xJ(this,void 0,void 0,(function*(){const r=yield XZ(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 RJ(t,i){return!!t[i]}MJ=CJ([SJ(1,pk)],MJ);class _J{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=RJ(t.event,i.triggerModifier),this.hasSideBySideModifier=RJ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class IJ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=RJ(t,i.triggerModifier)}}class PJ{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 NJ(t){return"altKey"===t?ft?new PJ(57,"metaKey",6,"altKey"):new PJ(5,"ctrlKey",6,"altKey"):ft?new PJ(6,"altKey",57,"metaKey"):new PJ(6,"altKey",5,"ctrlKey")}class BJ 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=NJ(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=NJ(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 _J(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new _J(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new _J(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new IJ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new IJ(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 $J=function(t,i){return function(e,s){i(e,s,t)}};let jJ=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)}};jJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$J(4,Zr),$J(5,Qr),$J(6,lo),$J(7,Zo),$J(8,pk),$J(9,vO),$J(10,fm),$J(11,cd),$J(12,$g)],jJ);const WJ=new Eg(new Sg(0,122,204)),VJ={showArrow:!0,showFrame:!0,className:"",frameColor:WJ,arrowColor:WJ,keepEditorSelection:!1};class HJ{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 zJ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class UJ{constructor(t){this._editor=t,this._ruleName=UJ._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Cl(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(){Cl(this._ruleName),kl(`.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()}}UJ._IdGenerator=new rI(".arrow-decoration-");class KJ{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,VJ,!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 UJ(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 HJ(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 zJ("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 qJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},GJ=function(t,i){return function(e,s){i(e,s,t)}};const ZJ=Jr("IPeekViewService");var JJ;$a(ZJ,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 Go("inReferenceSearchEditor",!0,J(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(JJ||(JJ={}));let QJ=class{constructor(t,i){t instanceof jJ&&JJ.inPeekEditor.bindTo(i)}dispose(){}};QJ.ID="editor.contrib.referenceController",QJ=qJ([GJ(1,Zo)],QJ),ru(QJ.ID,QJ,0);const YJ={headerBackgroundColor:Eg.white,primaryHeadingColor:Eg.fromHex("#333333"),secondaryHeadingColor:Eg.fromHex("#6c6c6cb3")};let XJ=class extends KJ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,K(this.options,YJ,!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=_l(".head"),this._bodyElement=_l(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=_l(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Qc(this._titleElement,"click",(t=>this._onTitleClick(t)))),Ml(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_l("span.filename"),this._secondaryHeading=_l("span.dirname"),this._metaHeading=_l("span.meta"),Ml(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=_l(".peekview-actions");Ml(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new cN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new so("peekview.close",J(0,"Close"),io.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:Kc(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Il(this._metaHeading)):Pl(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`)}};XJ=qJ([GJ(2,Zr)],XJ);const tQ=Lm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view title area.")),iQ=Lm("peekViewTitleLabel.foreground",{dark:Eg.white,light:Eg.black,hcDark:Eg.white,hcLight:Av},J(0,"Color of the peek view title.")),eQ=Lm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},J(0,"Color of the peek view title info.")),sQ=Lm("peekView.border",{dark:Sv,light:Sv,hcDark:_m,hcLight:_m},J(0,"Color of the peek view borders and arrow.")),nQ=Lm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view result list."));Lm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color for line nodes in the peek view result list.")),Lm("peekViewResult.fileForeground",{dark:Eg.white,light:"#1E1E1E",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color for file nodes in the peek view result list.")),Lm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},J(0,"Background color of the selected entry in the peek view result list.")),Lm("peekViewResult.selectionForeground",{dark:Eg.white,light:"#6C6C6C",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color of the selected entry in the peek view result list."));const rQ=Lm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view editor."));Lm("peekViewEditorGutter.background",{dark:rQ,light:rQ,hcDark:rQ,hcLight:rQ},J(0,"Background color of the gutter in the peek view editor.")),Lm("peekViewEditorStickyScroll.background",{dark:rQ,light:rQ,hcDark:rQ,hcLight:rQ},J(0,"Background color of sticky scroll in the peek view editor.")),Lm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view result list.")),Lm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view editor.")),Lm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Im,hcLight:Im},J(0,"Match highlight border in the peek view editor."));class oQ{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 hQ{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 cQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new rg}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 hQ(e))}catch(t){Ei(t)}return this}))}}class lQ{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(lQ._compareReferences);for(const i of t)if(s&&ME.isEqual(s.uri,i.uri,!0)||(s=new cQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==lQ._compareReferences(i,s.children[s.children.length-1])){const t=new oQ(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 lQ(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 uQ,aQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},dQ=function(t,i){return function(e,s){i(e,s,t)}};let fQ=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof lQ||t instanceof cQ}getChildren(t){if(t instanceof lQ)return t.groups;if(t instanceof cQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};fQ=aQ([dQ(0,Xr)],fQ);class gQ{getHeight(){return 23}getTemplateId(t){return t instanceof cQ?wQ.id:yQ.id}}let pQ=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof oQ){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)}};pQ=aQ([dQ(0,kC)],pQ);class mQ{getId(t){return t instanceof oQ?t.id:t.uri}}let vQ=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(Ml(e,_l(".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))}};vQ=aQ([dQ(1,eR)],vQ);let wQ=uQ=class{constructor(t){this._instantiationService=t,this.templateId=uQ.id}renderTemplate(t){return this._instantiationService.createInstance(vQ,t)}renderElement(t,i,e){e.set(t.element,v_(t.filterData))}disposeTemplate(t){t.dispose()}};wQ.id="FileReferencesRenderer",wQ=uQ=aQ([dQ(0,Zr)],wQ);class bQ{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 yQ{constructor(){this.templateId=yQ.id}renderTemplate(t){return new bQ(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}yQ.id="OneReferenceRenderer";class kQ{getWidgetAriaLabel(){return J(0,"References")}getAriaLabel(t){return t.ariaMessage}}var CQ=function(t,i){return function(e,s){i(e,s,t)}},SQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class xQ{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:xQ.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()}}xQ.DecorationOptions=$M.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class DQ{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 EQ extends xj{}let AQ=class extends XJ{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 nl(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(sQ)||Eg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(tQ)||Eg.transparent,primaryHeadingColor:t.getColor(iQ),secondaryHeadingColor:t.getColor(eQ)})}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=Ml(t,_l("div.messages")),Pl(this._messageContainer),this._splitView=new hB(t,{orientation:1}),this._previewContainer=Ml(t,_l("div.preview.inline")),this._preview=this._instantiationService.createInstance(jJ,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),Pl(this._previewContainer),this._previewNotAvailableMessage=new LM(J(0,"no preview available"),td,LM.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Ml(t,_l("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new kQ,keyboardNavigationLabelProvider:this._instantiationService.createInstance(pQ),identityProvider:new mQ,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:nQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Qc(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(EQ,"ReferencesWidget",this._treeContainer,new gQ,[this._instantiationService.createInstance(wQ),this._instantiationService.createInstance(yQ)],this._instantiationService.createInstance(fQ),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 oQ&&("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")})),Pl(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new nl(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"),Il(this._messageContainer),Promise.resolve(void 0)):(Pl(this._messageContainer),this._decorationsManager=new xQ(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"),Il(this._treeContainer),Il(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 oQ?t:t instanceof cQ&&t.children.length>0?t.children[0]:void 0}revealReference(t){return SQ(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return SQ(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==jc.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()}))}};AQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([CQ(3,pk),CQ(4,Xr),CQ(5,Zr),CQ(6,ZJ),CQ(7,eR),CQ(8,bM),CQ(9,kC),CQ(10,Pa),CQ(11,cd)],AQ);var MQ,LQ=function(t,i){return function(e,s){i(e,s,t)}},OQ=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 FQ=new Go("referenceSearchVisible",!1,J(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let TQ=MQ=class{static get(t){return t.getContribution(MQ.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=FQ.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=DQ.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(AQ,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 OQ(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 OQ(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=MQ.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,mu((()=>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 RQ(t,i){const e=function(t){const i=t.get(Qr).getFocusedCodeEditor();return i instanceof jJ?i.getParentEditor():i}(t);if(!e)return;const s=TQ.get(e);s&&i(s)}TQ.ID="editor.contrib.referencesController",TQ=MQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(2,Zo),LQ(3,Qr),LQ(4,vO),LQ(5,Zr),LQ(6,PP),LQ(7,Oa)],TQ),fh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:xe(2089,60),when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),fh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),fh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),uo.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),uo.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),uo.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),uo.registerCommand("closeReferenceSearch",(t=>RQ(t,(t=>t.closeWidget())))),fh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Mo.and(JJ.inPeekEditor,Mo.not("config.editor.stablePeek"))}),fh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Mo.and(FQ,Mo.not("config.editor.stablePeek"))}),fh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Mo.and(FQ,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 oQ&&RQ(t,(t=>t.revealReference(e[0])))}}),fh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Mo.and(FQ,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 oQ&&RQ(t,(t=>t.openReference(e[0],!0,!0)))}}),uo.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 oQ&&RQ(t,(t=>t.openReference(e[0],!1,!0)))}));var _Q=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},IQ=function(t,i){return function(e,s){i(e,s,t)}};const PQ=new Go("hasSymbols",!1,J(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),NQ=Jr("ISymbolNavigationService");let BQ=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=PQ.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 $Q(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)}};BQ=_Q([IQ(0,Zo),IQ(1,Qr),IQ(2,vO),IQ(3,kC)],BQ),$a(NQ,BQ,1),eu(new class extends Ql{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:PQ,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(NQ).revealNext(i)}}),fh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:PQ,primary:9,handler(t){t.get(NQ).reset()}});let $Q=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)}};$Q=_Q([IQ(0,Qr)],$Q);var jQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function WQ(t,i,e,s){return jQ(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 VQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function HQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function zQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function UQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function KQ(t,i,e,s,n){return WQ(i,e,t,((t,i,e)=>jQ(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 qQ(t){return jQ(this,void 0,void 0,(function*(){const i=yield t(),e=new lQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}iu("_executeDefinitionProvider",((t,i,e)=>{const s=VQ(t.get($g).definitionProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeTypeDefinitionProvider",((t,i,e)=>{const s=UQ(t.get($g).typeDefinitionProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeDeclarationProvider",((t,i,e)=>{const s=HQ(t.get($g).declarationProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeReferenceProvider",((t,i,e)=>{const s=KQ(t.get($g).referenceProvider,i,e,!1,ue.None);return qQ((()=>s))})),iu("_executeImplementationProvider",((t,i,e)=>{const s=zQ(t.get($g).implementationProvider,i,e,ue.None);return qQ((()=>s))}));var GQ,ZQ,JQ,QQ,YQ,XQ,tY,iY,eY=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())}))};kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextPeek,title:J(0,"Peek"),group:"navigation",order:100});class sY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof sY||!(!gs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class nY extends tu{static all(){return nY._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!==wh.EditorContext&&e.id!==wh.EditorContextPeek||(e.when=Mo.and(t.precondition,e.when));return i}constructor(t,i){super(nY._patchConfig(i)),this.configuration=t,nY._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(Qr),o=t.get(rR),h=t.get(NQ),c=t.get($g),l=t.get(Zr),u=i.getModel(),a=i.getPosition(),d=sY.is(e)?e:new sY(u,a),f=new cK(i,5),g=vu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>eY(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(em(t.ariaMessage),t.referenceAt(u.uri,a)){const t=this._getAlternativeCommand(i);!nY._activeAlternativeCommands.has(t)&&nY._allSymbolNavigationCommands.has(t)&&(o=nY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=u.getWordAtPosition(a);null===(n=nZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);nY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{nY._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 eY(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof jJ||!(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 eY(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=TQ.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),mu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}nY._allSymbolNavigationCommands=new Map,nY._activeAlternativeCommands=new Set;class rY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield VQ(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}}Dh(((GQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:GQ.id,title:{value:J(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:J(0,"Go to &&Definition")},precondition:Mo.and(fS.hasDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:fS.editorTextFocus,primary:70,weight:100},{when:Mo.and(fS.editorTextFocus,A$),primary:2118,weight:100}],menu:[{id:wh.EditorContext,group:"navigation",order:1.1},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),uo.registerCommandAlias("editor.action.goToDeclaration",GQ.id)}}).id="editor.action.revealDefinition",GQ)),Dh(((ZQ=class extends rY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:ZQ.id,title:{value:J(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Mo.and(fS.hasDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:fS.editorTextFocus,primary:xe(2089,70),weight:100},{when:Mo.and(fS.editorTextFocus,A$),primary:xe(2089,2118),weight:100}]}),uo.registerCommandAlias("editor.action.openDeclarationToTheSide",ZQ.id)}}).id="editor.action.revealDefinitionAside",ZQ)),Dh(((JQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:JQ.id,title:{value:J(0,"Peek Definition"),original:"Peek Definition"},precondition:Mo.and(fS.hasDefinitionProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:wh.EditorContextPeek,group:"peek",order:2}}),uo.registerCommandAlias("editor.action.previewDeclaration",JQ.id)}}).id="editor.action.peekDefinition",JQ));class oY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield HQ(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}}Dh(((QQ=class extends oY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:QQ.id,title:{value:J(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:J(0,"Go to &&Declaration")},precondition:Mo.and(fS.hasDeclarationProvider,fS.isInWalkThroughSnippet.toNegated()),menu:[{id:wh.EditorContext,group:"navigation",order:1.3},{id:wh.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",QQ)),Dh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:J(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Mo.and(fS.hasDeclarationProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:3}})}});class hY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield UQ(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}}Dh(((YQ=class extends hY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:YQ.ID,title:{value:J(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:J(0,"Go to &&Type Definition")},precondition:Mo.and(fS.hasTypeDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:0,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.4},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",YQ)),Dh(((XQ=class extends hY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:XQ.ID,title:{value:J(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Mo.and(fS.hasTypeDefinitionProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",XQ));class cY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield zQ(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}}Dh(((tY=class extends cY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:tY.ID,title:{value:J(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:J(0,"Go to &&Implementations")},precondition:Mo.and(fS.hasImplementationProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:2118,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.45},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",tY)),Dh(((iY=class extends cY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:iY.ID,title:{value:J(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Mo.and(fS.hasImplementationProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:3142,weight:100},menu:{id:wh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",iY));class lY extends nY{_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}}Dh(class extends lY{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:Mo.and(fS.hasReferenceProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:1094,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.45},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield KQ(t.referenceProvider,i,e,!0,s),J(0,"References"))}))}}),Dh(class extends lY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:J(0,"Peek References"),original:"Peek References"},precondition:Mo.and(fS.hasReferenceProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield KQ(t.referenceProvider,i,e,!1,s),J(0,"References"))}))}});class uY extends nY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:J(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Mo.and(JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(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""}}uo.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)=>eY(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(Qr),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(uK(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends uY{_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)}))}))}),uo.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)=>eY(void 0,void 0,void 0,(function*(){t.get(lo).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),uo.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(ss.isUri(i)),B(gs.isIPosition(e));const s=t.get($g),n=t.get(Qr);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!uK(t)||!t.hasModel())return;const i=TQ.get(t);if(!i)return;const n=mu((i=>KQ(s.referenceProvider,t.getModel(),gs.lift(e),!1,i).then((t=>new lQ(t,J(0,"References")))))),r=new ps(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),uo.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var aY,dY=function(t,i){return function(e,s){i(e,s,t)}},fY=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 gY=aY=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 BJ(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(aY.ID)}startFindDefinitionFromCursor(t){return fY(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 fY(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 hK(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=mu((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>=aY.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+aY.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?VQ(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 rY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Zo);return JJ.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};gY.ID="editor.contrib.gotodefinitionatposition",gY.MAX_SOURCE_PREVIEW_LINES=8,gY=aY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,Xr),dY(2,Pa),dY(3,$g)],gY),ru(gY.ID,gY,2);const pY=_l;class mY 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 Gy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class vY extends Hi{static render(t,i,e){return new vY(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Ml(t,pY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ml(this.actionContainer,pY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Ml(this.action,pY(`span.icon.${i.iconClass}`)),Ml(this.action,pY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Zc(this.actionContainer,xl.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Zc(this.actionContainer,xl.KEY_DOWN,(t=>{const e=new Ph(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 wY{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class bY 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 Eu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new Eu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new Eu((()=>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 Tu(i,(t=>fu(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=gu(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 wY(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 yY{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 kY{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 CY=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class SY{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 nl(0,0),this._minSize=new nl(0,0),this._maxSize=new nl(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 nl(i,t);nl.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 xY extends Hi{constructor(t,i=new nl(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new SY),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=nl.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 nl(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 ol(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=ol(i);return el(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 DY,EY,AY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},MY=function(t,i){return function(e,s){i(e,s,t)}};const LY=_l;let OY=DY=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(_Y,this._editor)),this._participants=[];for(const t of CY.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new PY(this._editor,this._participants),this._hoverOperation=this._register(new bY(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 FY(this._computer.anchor,i,t.isComplete))}))),this._register(Qc(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 yY(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 yY(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 yY(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}=DY.computeHoverRanges(this._editor,t.range,i),r=new Vi,o=r.add(new IY(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:DY._DECORATION_OPTIONS}]),r.add(Wi((()=>{t.clear()})))}this._widget.showAt(h,new RY(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()}};OY._DECORATION_OPTIONS=$M.register({description:"content-hover-highlight",className:"hoverHighlight"}),OY=DY=AY([MY(1,Zr),MY(2,kC)],OY);class FY{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 TY(this,this.anchor,i,this.isComplete)}}class TY extends FY{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class RY{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 _Y=EY=class extends xY{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 nl(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new mY),this._minimumSize=o,this._hoverVisibleKey=fS.hoverVisible.bindTo(i),this._hoverFocusedKey=fS.hoverFocused.bindTo(i),Ml(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(Al(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 EY.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 EY._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return EY._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){EY._applyMaxDimensions(this._hover.contentsDomNode,t,i),EY._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 nl(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;EY._lastDimensions=new nl(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)?el(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=ol(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=NY(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=NY(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,EY._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,EY._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=ul(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 nl(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(hl(e),Math.min(n,t)),this._setContentsDomNodeDimensions(hl(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new nl(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 nl(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=ul(i),s=hl(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=ul(i),s=hl(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=ul(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})}};_Y.ID="editor.contrib.resizableContentHoverWidget",_Y._lastDimensions=new nl(0,0),_Y=EY=AY([MY(1,Zo),MY(2,Oa),MY(3,fm),MY(4,kC)],_Y);let IY=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=LY("div.hover-row.status-bar"),this.actionsElement=Ml(this.hoverElement,LY("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(vY.render(this.actionsElement,t,e))}append(t){const i=Ml(this.actionsElement,t);return this._hasContent=!0,i}};IY=AY([MY(0,kC)],IY);class PY{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 Fu.EMPTY;const e=PY._getLineDecorations(this._editor,i);return Fu.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):Fu.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=PY._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 NY(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 BY=_l;class $Y 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 mY),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new XG({editor:this._editor},i,e)),this._computer=new jY(this._editor),this._hoverOperation=this._register(new bY(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 $Y.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=BY("div.hover-row.markdown-hover"),s=Ml(i,BY("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`}}$Y.ID="editor.contrib.modesGlyphHoverWidget";class jY{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 WY{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function VY(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 WY(t,r,i)}catch(t){Ai(t)}}))}(t,n,i,e,s)));return Fu.fromPromises(n).coalesce()}iu("_executeHoverProvider",((t,i,e)=>function(t,i,e){return VY(t,i,e,ue.None).map((t=>t.hover)).toPromise()}(t.get($g).hoverProvider,i,e)));var HY=function(t,i){return function(e,s){i(e,s,t)}};const zY=_l;class UY{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 KY=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 UY(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 UY(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 UY(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 UY(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return Fu.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return Fu.EMPTY;const n=new gs(t.range.startLineNumber,t.range.startColumn);return VY(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 UY(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return qY(t,i,this._editor,this._languageService,this._openerService)}};function qY(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=zY("div.hover-row.markdown-hover"),h=Ml(o,zY("div.hover-contents")),c=r.add(new XG({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}KY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([HY(1,Pa),HY(2,AF),HY(3,Oa),HY(4,$g)],KY);var GY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},ZY=function(t,i){return function(e,s){i(e,s,t)}};class JY{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let QY=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 JY(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 JY(this._markers[e],e+1,this._markers.length)}};QY=GY([ZY(1,FN),ZY(2,Oa)],QY);const YY=Jr("IMarkerNavigationService");let XY=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 QY(t,this._markerService,this._configService)}};var tX;XY=GY([ZY(0,FN),ZY(1,Oa)],XY),$a(YY,XY,1),function(t){t.className=function(t){switch(t){case pO.Ignore:return"severity-ignore "+io.asClassName(ys.info);case pO.Info:return io.asClassName(ys.info);case pO.Warning:return io.asClassName(ys.warning);case pO.Error:return io.asClassName(ys.error);default:return""}}}(tX||(tX={}));var iX,eX=function(t,i){return function(e,s){i(e,s,t)}};class sX{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(Qc(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new Ky(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)+2;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);Kc(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=_l("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()},Ml(this._codeLink,_l("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Kc(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 nX=iX=class extends XJ{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=Eg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(gX);let i=cX,e=lX;this._severity===LN.Warning?(i=uX,e=aX):this._severity===LN.Info&&(i=dX,e=fX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(iQ),secondaryHeadingColor:t.getColor(eQ)})}_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(iX.TitleMenu,this._contextKeyService);iN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=Ml(t,_l(""))}_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 sX(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 ${tX.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()}};nX.TitleMenu=new wh("gotoErrorTitleMenu"),nX=iX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([eX(1,pk),eX(2,AF),eX(3,bh),eX(4,Zr),eX(5,Zo),eX(6,eR)],nX);const rX=Mb(bv,yv),oX=Mb(kv,Cv),hX=Mb(Sv,xv),cX=Lm("editorMarkerNavigationError.background",{dark:rX,light:rX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget error color.")),lX=Lm("editorMarkerNavigationError.headerBackground",{dark:Ab(cX,.1),light:Ab(cX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget error heading background.")),uX=Lm("editorMarkerNavigationWarning.background",{dark:oX,light:oX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget warning color.")),aX=Lm("editorMarkerNavigationWarning.headerBackground",{dark:Ab(uX,.1),light:Ab(uX,.1),hcDark:"#0C141F",hcLight:Ab(uX,.2)},J(0,"Editor marker navigation widget warning heading background.")),dX=Lm("editorMarkerNavigationInfo.background",{dark:hX,light:hX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget info color.")),fX=Lm("editorMarkerNavigationInfo.headerBackground",{dark:Ab(dX,.1),light:Ab(dX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget info heading background.")),gX=Lm("editorMarkerNavigation.background",{dark:Ev,light:Ev,hcDark:Ev,hcLight:Ev},J(0,"Editor marker navigation widget background."));var pX,mX=function(t,i){return function(e,s){i(e,s,t)}},vX=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 wX=pX=class{static get(t){return t.getContribution(pX.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=CX.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(nX,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 vX(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=pX.get(r))||void 0===e||e.close(),null===(s=pX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}))}};wX.ID="editor.contrib.markerController",wX=pX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([mX(1,YY),mX(2,Zo),mX(3,Qr),mX(4,Zr)],wX);class bX extends Yl{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return vX(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=wX.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class yX extends bX{constructor(){super(!0,!1,{id:yX.ID,label:yX.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:578,weight:100},menuOpts:{menuId:nX.TitleMenu,title:yX.LABEL,icon:GW("marker-navigation-next",ys.arrowDown,J(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}yX.ID="editor.action.marker.next",yX.LABEL=J(0,"Go to Next Problem (Error, Warning, Info)");class kX extends bX{constructor(){super(!1,!1,{id:kX.ID,label:kX.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:1602,weight:100},menuOpts:{menuId:nX.TitleMenu,title:kX.LABEL,icon:GW("marker-navigation-previous",ys.arrowUp,J(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}kX.ID="editor.action.marker.prev",kX.LABEL=J(0,"Go to Previous Problem (Error, Warning, Info)"),ru(wX.ID,wX,4),su(yX),su(kX),su(class extends bX{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:fS.focus,primary:66,weight:100},menuOpts:{menuId:wh.MenubarGoMenu,title:J(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),su(class extends bX{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:fS.focus,primary:1090,weight:100},menuOpts:{menuId:wh.MenubarGoMenu,title:J(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const CX=new Go("markersNavigationVisible",!1);eu(new(Ql.bindToContribution(wX.get))({id:"closeMarkersNavigation",precondition:CX,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:fS.focus,primary:9,secondary:[1033]}}));var SX=function(t,i){return function(e,s){i(e,s,t)}};const xX=_l;class DX{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 EX={type:1,filter:{include:DG.QuickFix},triggerAction:xG.QuickFixHover};let AX=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 DX(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=xX("div.hover-row"),s=Ml(e,xX("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Ml(s,xX("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=xX("span");n&&(Ml(t,xX("span")).innerText=n);const e=Ml(t,xX("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Zc(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Ml(e,xX("span")).innerText=o.value;const r=Ml(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Ml(s,xX("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=Ml(s,xX("div"));o.style.marginTop="8px";const h=Ml(o,xX("a"));h.innerText=`${FE(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Zc(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=Ml(o,xX("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:yX.ID,run:()=>{var e;t.hide(),null===(e=wX.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(xX("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(Cu((()=>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:FG,run:i=>{o=!0;const e=OZ.get(this._editor),s=ol(i);t.hide(),null==e||e.showCodeActions(EX,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return mu((i=>$G(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),EX,nR.None,i)))}};AX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([SX(1,rm),SX(2,AF),SX(3,$g)],AX);const MX="editor.action.inlineSuggest.commit",LX="editor.action.inlineSuggest.showPrevious",OX="editor.action.inlineSuggest.showNext";class FX 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 TX((()=>{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===TX.ID)return this.toggleMenuActionViewItem=new LP(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:io.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 oo){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 TX extends so{constructor(t,i){i=i||J(0,"More Actions..."),super(TX.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}}TX.ID="toolbar.toggle.more";var RX=function(t,i){return function(e,s){i(e,s,t)}};let _X=class extends FX{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 Sh||i instanceof Ch)&&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,ro.join(a,h)),c.length>0&&this._sessionDisposables.add(Zc(this.getElement(),"contextmenu",(t=>{var i,s,n,r,o;const h=new jh(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]=co({id:l.id,label:l.label,checked:!0,enabled:!1,run(){}});break}}if(!f&&(l instanceof Sh||l instanceof Ch)){if(!l.hideActions)return;a=l.hideActions.hide}else a=co({id:"label",label:J(0,"Hide"),enabled:!1,run(){}});const g=ro.join([a],c);(null===(s=this._options)||void 0===s?void 0:s.resetMenu)&&!e&&(e=[this._options.resetMenu]),d&&e&&(g.push(new ro),g.push(co({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})})))}};_X=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([RX(2,bh),RX(3,Zo),RX(4,AR),RX(5,kC),RX(6,Eh)],_X);var IX,PX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},NX=function(t,i){return function(e,s){i(e,s,t)}};let BX=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(WX,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()})))})))}};BX=PX([NX(2,Zr)],BX);const $X=GW("inline-suggestion-hints-next",ys.chevronRight,J(0,"Icon for show next parameter hint.")),jX=GW("inline-suggestion-hints-previous",ys.chevronLeft,J(0,"Icon for show previous parameter hint."));let WX=IX=class extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new so(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"+IX.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Kl("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Kl("div@toolBar")]),this.previousAction=this.createCommandAction(LX,J(0,"Previous"),io.asClassName(jX)),this.availableSuggestionCountAction=new so("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(OX,J(0,"Next"),io.asClassName($X)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(wh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Eu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new Eu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(zX,this.nodes.toolBar,wh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof Sh)return c.createInstance(HX,t,void 0);if(t===this.availableSuggestionCountAction){const i=new VX(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=>{IX._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 Sh&&s.push(t);s.length>0&&s.unshift(new ro),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};WX._dropDownVisible=!1,WX.id=0,WX=IX=PX([NX(6,lo),NX(7,Zr),NX(8,kC),NX(9,Zo),NX(10,bh)],WX);class VX 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 HX extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Kl("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 zX=class extends _X{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())}};zX=PX([NX(3,bh),NX(4,Zo),NX(5,AR),NX(6,kC),NX(7,Eh)],zX);var UX,KX=function(t,i){return function(e,s){i(e,s,t)}};let qX=UX=class extends Hi{static get(t){return t.getContribution(UX.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 Eu((()=>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!==_Y.ID?12===e.type&&e.detail===$Y.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!==_Y.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!==_Y.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==$Y.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 $Y(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)||WX.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(OY,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()}};qX.ID="editor.contrib.hover",qX=UX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([KX(1,Zr),KX(2,AF),KX(3,Pa),KX(4,kC)],qX),ru(qX.ID,qX,2),su(class extends Yl{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:fS.editorTextFocus,primary:xe(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=qX.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)}}),su(class extends Yl{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=qX.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=gY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollUpHover",label:J(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollUp()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollDownHover",label:J(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollDown()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollLeftHover",label:J(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollLeft()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollRightHover",label:J(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollRight()}}),su(class extends Yl{constructor(){super({id:"editor.action.pageUpHover",label:J(0,"Page Up Hover"),alias:"Page Up Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=qX.get(i);e&&e.pageUp()}}),su(class extends Yl{constructor(){super({id:"editor.action.pageDownHover",label:J(0,"Page Down Hover"),alias:"Page Down Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=qX.get(i);e&&e.pageDown()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToTopHover",label:J(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=qX.get(i);e&&e.goToTop()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToBottomHover",label:J(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=qX.get(i);e&&e.goToBottom()}}),CY.register(KY),CY.register(AX),yk(((t,i)=>{const e=t.getColor(Yv);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 GX 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!==cJ)return;if(!e.range)return;const s=this._editor.getContribution(qX.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)}}}GX.ID="editor.contrib.colorContribution",ru(GX.ID,GX,2),CY.register(EJ);var ZX,JX,QX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},XX=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 t0=ZX=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=fS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=fS.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 i0(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(ZX.ID)}};t0.ID="editor.contrib.standaloneColorPickerController",t0=ZX=QX([YX(1,Zo),YX(2,Yr),YX(3,kC),YX(4,Zr),YX(5,$g),YX(6,cd)],t0),ru(t0.ID,t0,1);let i0=JX=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(MJ,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(Al(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 JX.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 XX(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new e0(i.result,i.foundInEditor))}))}_computeAsync(t){return XX(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 ZZ(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 IY(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)}};i0.ID="editor.contrib.standaloneColorPickerWidget",i0=JX=QX([YX(3,Zr),YX(4,Yr),YX(5,kC),YX(6,$g),YX(7,cd)],i0);class e0{constructor(t,i){this.value=t,this.foundInEditor=i}}su(class extends Yl{constructor(){super({id:"editor.action.hideColorPicker",label:J(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:fS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=t0.get(i))||void 0===e||e.hide()}}),su(class extends Yl{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:J(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:fS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=t0.get(i))||void 0===e||e.insertColor()}}),Dh(class extends tu{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:wh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=t0.get(i))||void 0===e||e.showOrFocus()}});class s0{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=s0._createRemoveBlockCommentOperations(new ps(o,f+i.length+1,c,g+1),i,e)):(d=s0._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(FT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(FT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(FT.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(FT.replace(new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(FT.insert(new gs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(FT.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 n0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,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&&!s0._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=n0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:n0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=n0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(n0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new 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?s0._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=s0._createAddBlockCommentOperations(new ps(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=s0._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=n0._gatherPreflightData(this._type,this._insertSpace,t,e.startLineNumber,e.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return s.supported?this._executeLineComments(t,i,s,e):this._executeBlockComment(t,i,e)}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),new 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(FT.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(FT.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=n0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=n0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class r0 extends Yl{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(cd);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 n0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}su(class extends r0{constructor(){super(0,{id:"editor.action.commentLine",label:J(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"5_insert",title:J(0,"&&Toggle Line Comment"),order:1}})}}),su(class extends r0{constructor(){super(1,{id:"editor.action.addCommentLine",label:J(0,"Add Line Comment"),alias:"Add Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2081),weight:100}})}}),su(class extends r0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:J(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2099),weight:100}})}}),su(class extends Yl{constructor(){super({id:"editor.action.blockComment",label:J(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"5_insert",title:J(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(cd);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new s0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var o0,h0=function(t,i){return function(e,s){i(e,s,t)}};let c0=o0=class{static get(t){return t.getContribution(o0.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&&pl(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?wh.SimpleEditorContext:wh.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 Ch){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new oo(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new ro)}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=ol(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 oo("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 ro),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()}};c0.ID="editor.contrib.contextmenu",c0=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}([h0(1,AR),h0(2,ER),h0(3,Zo),h0(4,kC),h0(5,bh),h0(6,Oa),h0(7,dR)],c0),ru(c0.ID,c0,2),su(class extends Yl{constructor(){super({id:"editor.action.showContextMenu",label:J(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=c0.get(i))||void 0===e||e.showContextMenu()}});class l0{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 u0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class a0 extends Hi{static get(t){return t.getContribution(a0.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 l0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new u0(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 u0(new l0(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 u0(new l0(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}}a0.ID="editor.contrib.cursorUndoRedoController",ru(a0.ID,a0,0),su(class extends Yl{constructor(){super({id:"cursorUndo",label:J(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=a0.get(i))||void 0===s||s.cursorUndo()}}),su(class extends Yl{constructor(){super({id:"cursorRedo",label:J(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=a0.get(i))||void 0===s||s.cursorRedo()}});class d0{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 f0(t){return ft?t.altKey:t.ctrlKey}class g0 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)&&(f0(t)&&(this._modifierPressed=!0),this._mouseDown&&f0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(f0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===g0.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]}f0(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)||(f0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(g0.ID,new d0(this._dragSelection,i,f0(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:g0._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()}}g0.ID="editor.contrib.dragAndDrop",g0.TRIGGER_KEY_VALUE=ft?6:5,g0._DECORATION_OPTIONS=$M.register({description:"dnd-target",className:"dnd-target"}),ru(g0.ID,g0,2);const p0=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 m0=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function v0(t){return{asString:()=>m0(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class w0{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"),k0(b0(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 b0(t)}}function b0(t){return t.toLowerCase()}function y0(t,i){return k0(b0(t),i.map(b0))}function k0(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 C0=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>C0.split(t).filter((t=>!t.startsWith("#")))});ah.add("workbench.contributions.dragAndDrop",new class{});class S0{constructor(){}static getInstance(){return S0.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}S0.INSTANCE=new S0;var x0=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 D0(t){const i=new w0;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,v0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,E0(s))}}return i}function E0(t){const i=t.path?ss.parse(t.path):void 0;return function(t,i,e){const s={id:p0(),name:t,uri:i,data:e};return{asString:()=>m0(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>x0(this,void 0,void 0,(function*(){return new Uint8Array(yield t.arrayBuffer())}))))}const A0=Object.freeze(["CodeEditors","CodeFiles",UR.RESOURCES,UR.INTERNAL_URI_LIST]);function M0(t,i=!1){const e=D0(t),s=e.get(UR.INTERNAL_URI_LIST);if(s)e.replace(Wa.uriList,s);else if(i||!e.has(Wa.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(Wa.uriList,v0(C0.create(i)))}for(const t of A0)e.delete(t);return e}function L0(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 O0=$M.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class F0 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=_l(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=_l("span.icon");this.domNode.append(i),i.classList.add(...io.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(Zc(this.domNode,xl.CLICK,(()=>{this.delegate.cancel()})))}getId(){return F0.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)}}F0.baseId="editor.widget.inlineProgressWidget";let T0=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=Cu((()=>{const s=ps.fromPositions(t);this._currentDecorations.set([{range:s,options:O0}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(F0,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()}};T0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,Zr)],T0);var R0,_0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},I0=function(t,i){return function(e,s){i(e,s,t)}},P0=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 N0=R0=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=_l(".post-edit-widget"),this.button=this._register(new Bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Zc(this.domNode,xl.CLICK,(()=>this.showSelector())))}getId(){return R0.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=ol(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>co({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};N0.baseId="editor.widget.postEditWidget",N0=R0=_0([I0(7,AR),I0(8,Zo),I0(9,kC)],N0);let B0=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 P0(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 ST(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=>P0(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(N0,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()}};B0=_0([I0(4,Zr),I0(5,kT)],B0);var $0,j0=function(t,i){return function(e,s){i(e,s,t)}},W0=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 V0="editor.changePasteType",H0=new Go("pasteWidgetVisible",!1,J(0,"Whether the paste widget is showing")),z0="application/vnd.code.copyMetadata";let U0=$0=class extends Hi{static get(t){return t.getContribution($0.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(Zc(h,"copy",(t=>this.handleCopy(t)))),this._register(Zc(h,"cut",(t=>this.handleCopy(t)))),this._register(Zc(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new T0("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(B0,"pasteIntoEditor",t,H0,{id:V0,label:J(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},vl().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=D0(t.clipboardData),f=a.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=p0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:u});const p=mu((t=>W0(this,void 0,void 0,(function*(){const i=c(yield Promise.all(a.map((i=>W0(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 W0(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=M0(t.clipboardData);o.delete(z0);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],Wa.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>y0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}))}doPasteInline(t,i,e,s){const n=mu((r=>W0(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new cK(o,3,void 0,r);try{if(yield this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const n=t.filter((t=>K0(t,e)));if(!n.length||1===n.length&&"text"===n[0].id)return void(yield this.applyDefaultPasteHandler(e,s,c.token));const r=yield this.getPasteEdits(n,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===r.length&&"text"===r[0].providerId)return void(yield this.applyDefaultPasteHandler(e,s,c.token));if(r.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:r},t,c.token)}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=mu((o=>W0(this,void 0,void 0,(function*(){const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new cK(h,3,void 0,o);try{if(yield this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let r=i.filter((t=>K0(t,s)));t&&(r=r.filter((i=>i.id===t)));const o=yield this.getPasteEdits(r,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!o.length)return;let h;if(t)h=o.at(0);else{const t=yield this._quickInputService.pick(o.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:J(0,"Select Paste Action")});h=null==t?void 0:t.edit}if(!h)return;const u=function(t,i,e){var s,n;return{edits:[...i.map((i=>new ST(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,h);yield this._bulkEditService.apply(u,{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(z0,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(z0);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=lk.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 W0(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(Wa.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(Wa.uriList,v0(C0.create(i)))}}))}getPasteEdits(t,i,e,s,n){return W0(this,void 0,void 0,(function*(){const r=yield vu(Promise.all(t.map((t=>W0(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 L0(c(null!=r?r:[]))}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return W0(this,void 0,void 0,(function*(){const o=null!==(s=t.get(Wa.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 K0(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}U0.ID="editor.contrib.copyPasteActionController",U0=$0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j0(1,Zr),j0(2,kT),j0(3,EV),j0(4,$g),j0(5,Ij),j0(6,sR)],U0);var q0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},G0=function(t,i){return function(e,s){i(e,s,t)}},Z0=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 J0=J(0,"Built-in");class Q0{provideDocumentPasteEdits(t,i,e,s){return Z0(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 Z0(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 Y0 extends Q0{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[Wa.text],this.pasteMimeTypes=[Wa.text]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const i=t.get(Wa.text);if(!i)return;if(t.has(Wa.uriList))return;const e=yield i.asString();return{handledMimeType:Wa.text,label:J(0,"Insert Plain Text"),detail:J0,insertText:e}}))}}class X0 extends Q0{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[Wa.uriList],this.pasteMimeTypes=[Wa.uriList]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const e=yield i1(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===jc.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:Wa.uriList,insertText:n,label:r,detail:J0}}))}}let t1=class extends Q0{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[Wa.uriList],this.pasteMimeTypes=[Wa.uriList]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const e=yield i1(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:Wa.uriList,insertText:s.join(" "),label:J(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:J0}:void 0}))}};function i1(t){return Z0(this,void 0,void 0,(function*(){const i=t.get(Wa.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of C0.parse(e))try{s.push({uri:ss.parse(t),originalText:t})}catch(t){}return s}))}t1=q0([G0(0,dR)],t1);let e1=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new Y0)),this._register(t.documentOnDropEditProvider.register("*",new X0)),this._register(t.documentOnDropEditProvider.register("*",new t1(i)))}};e1=q0([G0(0,$g),G0(1,dR)],e1);let s1=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new Y0)),this._register(t.documentPasteEditProvider.register("*",new X0)),this._register(t.documentPasteEditProvider.register("*",new t1(i)))}};s1=q0([G0(0,$g),G0(1,dR)],s1),ru(U0.ID,U0,0),tH(s1),eu(new class extends Ql{constructor(){super({id:V0,precondition:H0,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=U0.get(i))||void 0===s?void 0:s.changePasteType()}}),su(class extends Yl{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=U0.get(i))||void 0===s?void 0:s.pasteAs(n)}});class n1{constructor(t){this.identifier=t}}const r1=Jr("treeViewsDndService");$a(r1,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 o1,h1=function(t,i){return function(e,s){i(e,s,t)}},c1=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 l1="editor.experimental.dropIntoEditor.defaultProvider",u1="editor.changeDropType",a1=new Go("dropWidgetVisible",!1,J(0,"Whether the drop widget is showing"));let d1=o1=class extends Hi{static get(t){return t.getContribution(o1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=S0.getInstance(),this._dropProgressManager=this._register(i.createInstance(T0,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(B0,"dropIntoEditor",t,a1,{id:u1,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 c1(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=mu((s=>c1(this,void 0,void 0,(function*(){const r=new cK(t,1,void 0,s);try{const n=yield this.extractDataTransferData(e);if(0===n.size||r.token.isCancellationRequested)return;const o=t.getModel();if(!o)return;const h=this._languageFeaturesService.documentOnDropEditProvider.ordered(o).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>n.matches(t))))),c=yield this.getDropEdits(h,o,i,n,r);if(r.token.isCancellationRequested)return;if(c.length){const e=this.getInitialActiveEditIndex(o,c),n="afterDrop"===t.getOption(36).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ps.fromPositions(i)],{activeEditIndex:e,allEdits:c},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 c1(this,void 0,void 0,(function*(){const r=yield vu(Promise.all(t.map((t=>c1(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 L0(c(null!=r?r:[]))}))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(l1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&y0(t,[i.handledMimeType])));if(e>=0)return e}return 0}extractDataTransferData(t){return c1(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new w0;const i=M0(t.dataTransfer);if(this.treeItemsTransfer.hasData(n1.prototype)){const t=this.treeItemsTransfer.getData(n1.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}))}};d1.ID="editor.contrib.dropIntoEditorController",d1=o1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([h1(1,Zr),h1(2,Oa),h1(3,$g),h1(4,r1)],d1),ru(d1.ID,d1,2),eu(new class extends Ql{constructor(){super({id:u1,precondition:a1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=d1.get(i))||void 0===s||s.changeDropType()}}),tH(e1),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{properties:{[l1]:{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 f1{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===f1._FIND_MATCH_DECORATION||i===f1._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,f1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,f1._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,f1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=f1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=f1._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:f1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ps(o,1,h,1),options:f1._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,f1._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}}f1._CURRENT_FIND_MATCH_DECORATION=$M.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:mk(db),position:Qd.Center},minimap:{color:mk(gb),position:Xd.Inline}}),f1._FIND_MATCH_DECORATION=$M.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:mk(db),position:Qd.Center},minimap:{color:mk(gb),position:Xd.Inline}}),f1._FIND_MATCH_NO_OVERVIEW_DECORATION=$M.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),f1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=$M.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:mk(db),position:Qd.Center}}),f1._RANGE_HIGHLIGHT_DECORATION=$M.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),f1._FIND_SCOPE_DECORATION=$M.register({description:"find-scope",className:"findScope",isWholeLine:!0});class g1{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 p1(t,i){if(t&&""!==t[0]){const e=m1(t,i,"-"),s=m1(t,i,"_");return e&&!s?v1(t,i,"-"):!e&&s?v1(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 m1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function v1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=p1([n[i]],t)+e})),r.slice(0,-1)}class w1{constructor(t){this.staticValue=t,this.kind=0}}class b1{constructor(t){this.pieces=t,this.kind=1}}class y1{static fromStaticValue(t){return new y1([k1.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 w1(t[0].staticValue):new b1(t):new w1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?p1(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=y1._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 k1{static staticValue(t){return new k1(t,-1,null)}static caseOps(t,i){return new k1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class C1{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++]=k1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=k1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=k1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new y1(this._result)}}const S1=new Go("findWidgetVisible",!1);S1.toNegated();const x1=new Go("findInputFocussed",!1),D1=new Go("replaceInputFocussed",!1),E1={primary:545,mac:{primary:2593}},A1={primary:565,mac:{primary:2613}},M1={primary:560,mac:{primary:2608}},L1={primary:554,mac:{primary:2602}},O1={primary:558,mac:{primary:2606}},F1="editor.action.nextMatchFindAction",T1="editor.action.previousMatchFindAction",R1="closeFindWidget",_1="toggleFindCaseSensitive",I1="toggleFindWholeWord",P1="toggleFindRegex",N1="toggleFindInSelection",B1="togglePreserveCase",$1="editor.action.replaceOne",j1="editor.action.replaceAll",W1=19999;class V1{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new xu,this._decorations=new f1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Eu((()=>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,W1);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=Ef(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()<W1){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=V1._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()<W1){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=V1._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 y1(null);const i=[],e=new C1(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):y1.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 NC(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=>V1._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>=W1?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new uf(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 WC(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 g1(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 H1 extends Fy{constructor(t,i,e){super(),this._hideSoon=this._register(new Eu((()=>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:Em(Vm),inputActiveOptionForeground:Em(zm),inputActiveOptionBackground:Em(Hm)};this.caseSensitive=this._register(new pB(Object.assign({appendTitle:this._keybindingLabelFor(_1),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(I1),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(P1),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(Zc(this._domNode,xl.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Zc(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 H1.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 z1(t,i){return 1===t||2!==t&&i}H1.ID="editor.contrib.findOptionsWidget";class U1 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 z1(this._isRegexOverride,this._isRegex)}get wholeWord(){return z1(this._wholeWordOverride,this._wholeWord)}get matchCase(){return z1(this._matchCaseOverride,this._matchCase)}get preserveCase(){return z1(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>=W1}}const K1=J(0,"input"),q1=J(0,"Preserve Case");class G1 extends aB{constructor(t){super({icon:ys.preserveCase,title:q1+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class Z1 extends Fy{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||K1;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 G1(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(),Dl(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 J1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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 Y1=new Go("suggestWidgetVisible",!1,J(0,"Whether suggestion are visible")),X1="historyNavigationWidgetFocus",t2="historyNavigationForwardsEnabled",i2="historyNavigationBackwardsEnabled";let e2;const s2=[];function n2(t,i){if(s2.includes(i))throw new Error("Cannot register the same widget multiple times");s2.push(i);const e=new Vi,s=new Go(X1,!1).bindTo(t),n=new Go(t2,!0).bindTo(t),r=new Go(i2,!0).bindTo(t),o=()=>{s.set(!0),e2=i},h=()=>{s.set(!1),e2===i&&(e2=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{s2.splice(s2.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let r2=class extends xB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(n2(n,this.inputBox))}};r2=J1([Q1(3,Zo)],r2);let o2=class extends Z1{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(n2(r,this.inputBox))}};function h2(t){var i,e;return"Up"===(null===(i=t.lookupKeybinding("history.showPrevious"))||void 0===i?void 0:i.getElectronAccelerator())&&"Down"===(null===(e=t.lookupKeybinding("history.showNext"))||void 0===e?void 0:e.getElectronAccelerator())}o2=J1([Q1(3,Zo)],o2),fh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Mo.and(Mo.has(X1),Mo.equals(i2,!0),Mo.not("isComposing"),Y1.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==e2||e2.showPreviousValue()}}),fh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Mo.and(Mo.has(X1),Mo.equals(t2,!0),Mo.not("isComposing"),Y1.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==e2||e2.showNextValue()}});const c2=GW("find-selection",ys.selection,J(0,"Icon for 'Find in Selection' in the editor find widget.")),l2=GW("find-collapsed",ys.chevronRight,J(0,"Icon to indicate that the editor find widget is collapsed.")),u2=GW("find-expanded",ys.chevronDown,J(0,"Icon to indicate that the editor find widget is expanded.")),a2=GW("find-replace",ys.replace,J(0,"Icon for 'Replace' in the editor find widget.")),d2=GW("find-replace-all",ys.replaceAll,J(0,"Icon for 'Replace All' in the editor find widget.")),f2=GW("find-previous-match",ys.arrowUp,J(0,"Icon for 'Find Previous' in the editor find widget.")),g2=GW("find-next-match",ys.arrowDown,J(0,"Icon for 'Find Next' in the editor find widget.")),p2=J(0,"Find / Replace"),m2=J(0,"Find"),v2=J(0,"Find"),w2=J(0,"Previous Match"),b2=J(0,"Next Match"),y2=J(0,"Find in Selection"),k2=J(0,"Close"),C2=J(0,"Replace"),S2=J(0,"Replace"),x2=J(0,"Replace"),D2=J(0,"Replace All"),E2=J(0,"Toggle Replace"),A2=J(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",W1),M2=J(0,"{0} of {1}"),L2=J(0,"No results"),O2=419;let F2=69;const T2="ctrlEnterReplaceAll.windows.donotask",R2=ft?256:2048;class _2{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function I2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function P2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class N2 extends Fy{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(T2,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new bu(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 _2(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=x1.bindTo(r),this._findFocusTracker=this._register(Al(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=D1.bindTo(r),this._replaceFocusTracker=this._register(Al(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 _2(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 N2.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=hl(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=F2+"px",this._matchesCount.title=this._state.matchesCount>=W1?A2:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=W1&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Fn(M2,e,i)}else t=L2;this._matchesCount.appendChild(document.createTextNode(t)),em(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),F2=Math.max(F2,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===L2)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=ol(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=rl(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 _2(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(!qc(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&&hl(this._domNode)>O2)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=hl(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-F2>=i&&(r=!0),447+e-F2>=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=hl(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|R2)?(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)?I2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?P2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|R2)?(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(T2,!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)?I2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?P2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):void 0}getVerticalSashLeft(t){return 0}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new r2(null,this._contextViewProvider,{width:221,label:m2,placeholder:v2,appendCaseSensitiveLabel:this._keybindingLabelFor(_1),appendWholeWordsLabel:this._keybindingLabelFor(I1),appendRegexLabel:this._keybindingLabelFor(P1),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:()=>h2(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 B2({label:w2+this._keybindingLabelFor(T1),icon:f2,onTrigger:()=>{$(this._codeEditor.getAction(T1)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new B2({label:b2+this._keybindingLabelFor(F1),icon:g2,onTrigger:()=>{$(this._codeEditor.getAction(F1)).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:c2,title:y2+this._keybindingLabelFor(N1),isChecked:!1,inputActiveOptionBackground:Em(Hm),inputActiveOptionBorder:Em(Vm),inputActiveOptionForeground:Em(zm)})),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 B2({label:k2+this._keybindingLabelFor(R1),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 o2(null,void 0,{label:C2,placeholder:S2,appendPreserveCaseLabel:this._keybindingLabelFor(B1),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>h2(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 B2({label:x2+this._keybindingLabelFor($1),icon:a2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new B2({label:D2+this._keybindingLabelFor(j1),icon:d2,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 B2({label:E2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=hl(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=p2,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=O2;this._register(this._resizeSash.onDidStart((()=>{n=hl(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<O2||i>(parseFloat(il(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=hl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=hl(this._domNode);if(t<O2)return;let i=O2;if(!this._resized||t===O2){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=hl(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}N2.ID="editor.contrib.findWidget";class B2 extends Fy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+io.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(...io.asClassNameArray(l2)),this._domNode.classList.add(...io.asClassNameArray(u2))):(this._domNode.classList.remove(...io.asClassNameArray(u2)),this._domNode.classList.add(...io.asClassNameArray(l2)))}}yk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(Kv)),e(".currentFindMatch",t.getColor(Uv)),e(".findScope",t.getColor(qv)),e(".find-widget",t.getColor(Mv));const s=t.getColor(Nm);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(Bm);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(Zv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${ry(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Gv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(Jv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${ry(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(_m);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Lv);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const u=t.getColor(Fm);u&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${u}; }`);const a=t.getColor(Fv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(Ov);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(Xw);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(Rm);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var $2,j2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},W2=function(t,i){return function(e,s){i(e,s,t)}},V2=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 H2(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 z2=$2=class extends Hi{get editor(){return this._editor}static get(t){return t.getContribution($2.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=S1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new bu(500),this._state=this._register(new U1),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!!x1.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 V2(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=H2(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?Rn(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=H2(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 V1(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 V2(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)}};z2.ID="editor.contrib.findController",z2=$2=j2([W2(1,Zo),W2(2,PP),W2(3,EV),W2(4,vO)],z2);let U2=class extends z2{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 V2(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 N2(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new H1(this._editor,this._state,this._keybindingService))}};U2=j2([W2(1,ER),W2(2,Zo),W2(3,kC),W2(4,pk),W2(5,vO),W2(6,PP),W2(7,EV)],U2),nu(new Xl({id:"actions.find",label:J(0,"Find"),alias:"Find",precondition:Mo.or(fS.focus,Mo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"3_find",title:J(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=z2.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 K2={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 q2 extends Yl{run(t,i){return V2(this,void 0,void 0,(function*(){const t=z2.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 G2 extends Yl{run(t,i){return V2(this,void 0,void 0,(function*(){const t=z2.get(i);if(!t)return;const e=H2(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))}))}}nu(new Xl({id:"editor.action.startFindReplaceAction",label:J(0,"Replace"),alias:"Replace",precondition:Mo.or(fS.focus,Mo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"3_find",title:J(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=z2.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})})),ru(z2.ID,U2,0),su(class extends Yl{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:K2})}run(t,i,e){return V2(this,void 0,void 0,(function*(){const t=z2.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)}}))}}),su(class extends Yl{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 V2(this,void 0,void 0,(function*(){const t=z2.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))}))}}),su(class extends q2{constructor(){super({id:F1,label:J(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:fS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Mo.and(fS.focus,x1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),su(class extends q2{constructor(){super({id:T1,label:J(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:fS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Mo.and(fS.focus,x1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToMatchFindAction",label:J(0,"Go to Match..."),alias:"Go to Match...",precondition:S1}),this._highlightDecorations=[]}run(t,i,e){const s=z2.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:mk(Gk),position:Qd.Full}}}])}))}}),su(class extends G2{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:J(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),su(class extends G2{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:J(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const Z2=Ql.bindToContribution(z2.get);eu(new Z2({id:R1,precondition:S1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:9,secondary:[1033]}})),eu(new Z2({id:_1,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:fS.focus,primary:E1.primary,mac:E1.mac,win:E1.win,linux:E1.linux}})),eu(new Z2({id:I1,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:fS.focus,primary:A1.primary,mac:A1.mac,win:A1.win,linux:A1.linux}})),eu(new Z2({id:P1,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:fS.focus,primary:M1.primary,mac:M1.mac,win:M1.win,linux:M1.linux}})),eu(new Z2({id:N1,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:fS.focus,primary:L1.primary,mac:L1.mac,win:L1.win,linux:L1.linux}})),eu(new Z2({id:B1,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:fS.focus,primary:O1.primary,mac:O1.mac,win:O1.win,linux:O1.linux}})),eu(new Z2({id:$1,precondition:S1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:fS.focus,primary:3094}})),eu(new Z2({id:$1,precondition:S1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,D1),primary:3}})),eu(new Z2({id:j1,precondition:S1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:fS.focus,primary:2563}})),eu(new Z2({id:j1,precondition:S1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,D1),primary:void 0,mac:{primary:2051}}})),eu(new Z2({id:"editor.action.selectAllMatches",precondition:S1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:fS.focus,primary:515}}));const J2={0:" ",1:"u",2:"r"},Q2=16777215,Y2=4278190080;class X2{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 t4{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 X2(t.length),this._userDefinedStates=new X2(t.length),this._recoveredStates=new X2(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 i4(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&Y2)>>>24)+((this._endIndexes[t]&Y2)>>>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]=`[${J2[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 t4(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 i4{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 e4{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 t4(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(t4.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=t4.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(t4.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=t4.sanitizeAndMerge(this._regions,s,n);this.updatePost(t4.fromFoldRanges(r))}_getLinesChecksum(t,i){return kd(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 s4(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 n4(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 r4(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 o4(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 h4(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 c4(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 l4{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!==oD(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!==u4(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=u4(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 u4(t,i){const e=Ef(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class a4{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=f4){const n=t.getOptions().tabSize,r=new d4(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=qS(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 d4{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 t4(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=qS(t.getLineContent(l),n);(u<s||u===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new t4(r,o)}}}const f4={limit:5e3,update:()=>{}},g4=Lm("editor.foldBackground",{light:Ab(Wv,.3),dark:Ab(Wv,.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);Lm("editorGutter.foldingControlForeground",{dark:Tm,light:Tm,hcDark:Tm,hcLight:Tm},J(0,"Color of the folding control in the editor gutter."));const p4=GW("folding-expanded",ys.chevronDown,J(0,"Icon for expanded ranges in the editor glyph margin.")),m4=GW("folding-collapsed",ys.chevronRight,J(0,"Icon for collapsed ranges in the editor glyph margin.")),v4=GW("folding-manual-collapsed",m4,J(0,"Icon for manually collapsed ranges in the editor glyph margin.")),w4=GW("folding-manual-expanded",p4,J(0,"Icon for manually expanded ranges in the editor glyph margin.")),b4={color:mk(g4),position:Xd.Inline};class y4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?y4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?y4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:y4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:y4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?y4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:y4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?y4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:y4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?y4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:y4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?y4.MANUALLY_EXPANDED_VISUAL_DECORATION:y4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}y4.COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:io.asClassName(m4)}),y4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(m4)}),y4.MANUALLY_COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:io.asClassName(v4)}),y4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(v4)}),y4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),y4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0}),y4.EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+io.asClassName(p4)}),y4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(p4)}),y4.MANUALLY_EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+io.asClassName(w4)}),y4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(w4)}),y4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),y4.HIDDEN_RANGE_DECORATION=$M.register({description:"folding-hidden-range-decoration",stickiness:1});const k4={};class C4{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,k4,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 S4(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 S4{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 t4(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 t4(s,n,r)}}}var x4,D4=function(t,i){return function(e,s){i(e,s,t)}};const E4=new Go("foldingEnabled",!1);let A4=x4=class extends Hi{static get(t){return t.getContribution(x4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=x4._foldingRangeSelector)||void 0===e?void 0:e.call(x4,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 M4(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 y4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=E4.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 e4(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new l4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new bu(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new Eu((()=>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 a4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=x4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new C4(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=mu((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=iU.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)}};A4.ID="editor.contrib.folding",A4=x4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D4(1,Zo),D4(2,cd),D4(3,vO),D4(4,FF),D4(5,$g)],A4);class M4{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 L4 extends Yl{runEditorCommand(t,i,e){const s=t.get(cd),n=A4.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 O4(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 F4 extends L4{getFoldingLevel(){return parseInt(this.id.substr(F4.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))}}F4.ID_PREFIX="editor.foldLevel",F4.ID=t=>F4.ID_PREFIX+t,ru(A4.ID,A4,0),su(class extends L4{constructor(){super({id:"editor.unfold",label:J(0,"Unfold"),alias:"Unfold",precondition:E4,kbOpts:{kbExpr:fS.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:O4,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?r4(i,!1,n,r):n4(i,!1,n,r)}}),su(class extends L4{constructor(){super({id:"editor.unfoldRecursively",label:J(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2142),weight:100}})}invoke(t,i,e,s){n4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.fold",label:J(0,"Fold"),alias:"Fold",precondition:E4,kbOpts:{kbExpr:fS.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:O4,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?r4(i,!0,r||1,n):n4(i,!0,r||1,n)}}),su(class extends L4{constructor(){super({id:"editor.foldRecursively",label:J(0,"Fold Recursively"),alias:"Fold Recursively",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);n4(i,!0,Number.MAX_VALUE,s)}}),su(class extends L4{constructor(){super({id:"editor.foldAll",label:J(0,"Fold All"),alias:"Fold All",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2069),weight:100}})}invoke(t,i,e){n4(i,!0)}}),su(class extends L4{constructor(){super({id:"editor.unfoldAll",label:J(0,"Unfold All"),alias:"Unfold All",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2088),weight:100}})}invoke(t,i,e){n4(i,!1)}}),su(class extends L4{constructor(){super({id:"editor.foldAllBlockComments",label:J(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(i,Is.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&h4(i,new RegExp("^\\s*"+Rn(s.blockCommentStartToken)),!0)}}}),su(class extends L4{constructor(){super({id:"editor.foldAllMarkerRegions",label:J(0,"Fold All Regions"),alias:"Fold All Regions",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(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&&h4(i,new RegExp(s.markers.start),!0)}}}),su(class extends L4{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:J(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(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&&h4(i,new RegExp(s.markers.start),!1)}}}),su(class extends L4{constructor(){super({id:"editor.foldAllExcept",label:J(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2136),weight:100}})}invoke(t,i,e){o4(i,!0,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.unfoldAllExcept",label:J(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2134),weight:100}})}invoke(t,i,e){o4(i,!1,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.toggleFold",label:J(0,"Toggle Fold"),alias:"Toggle Fold",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2090),weight:100}})}invoke(t,i,e){s4(i,1,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.gotoParentFold",label:J(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.gotoPreviousFold",label:J(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.gotoNextFold",label:J(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:J(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:E4,kbOpts:{kbExpr:fS.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=t4.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(t4.fromFoldRanges(t))}}}}),su(class extends L4{constructor(){super({id:"editor.removeManualFoldingRanges",label:J(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:E4,kbOpts:{kbExpr:fS.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++)T4=new F4({id:F4.ID(t),label:J(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2048|21+t),weight:100}}),hu.INSTANCE.registerEditorAction(T4);var T4;uo.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($g),n=t.get(Yr).getModel(e);if(!n)throw Ti();const r=t.get(Oa);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(cd),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new a4(n,o,c);let u=l;if("indentation"!==h){const t=A4.getFoldingRangeProviders(s,n);t.length&&(u=new C4(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()}}))})),su(class extends Yl{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)}}),su(class extends Yl{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)}}),su(class extends Yl{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 R4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},I4=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 P4=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 Vd;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()}));xK(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||a(t)&&(fK.execute(this._editor,t,!0),vK(t))})).finally((()=>{n.dispose()}))}};P4.ID="editor.contrib.autoFormat",P4=R4([_4(1,$g),_4(2,MN)],P4);let N4=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(yK,this.editor,t,2,nR.None,ue.None).catch(Ei))}};N4.ID="editor.contrib.formatOnPaste",N4=R4([_4(1,$g),_4(2,Zr)],N4),ru(P4.ID,P4,2),ru(N4.ID,N4,2),su(class extends Yl{constructor(){super({id:"editor.action.formatDocument",label:J(0,"Format Document"),alias:"Format Document",precondition:Mo.and(fS.notInCompositeEditor,fS.writable,fS.hasDocumentFormattingProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return I4(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(Zr),s=t.get(rR);yield s.showWhile(e.invokeFunction(CK,i,1,nR.None,ue.None),250)}}))}}),su(class extends Yl{constructor(){super({id:"editor.action.formatSelection",label:J(0,"Format Selection"),alias:"Format Selection",precondition:Mo.and(fS.writable,fS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2084),weight:100},contextMenuOpts:{when:fS.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return I4(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(rR);yield r.showWhile(e.invokeFunction(yK,i,n,1,nR.None,ue.None),250)}))}}),uo.registerCommand("editor.action.format",(t=>I4(void 0,void 0,void 0,(function*(){const i=t.get(Qr).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(lo);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var B4=function(t,i){return function(e,s){i(e,s,t)}};class $4{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 j4 extends $4{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class W4 extends $4{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class V4 extends $4{static create(t,i,s){const n=new de(s),r=new V4(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=$4.findId(`provider_${e}`,r),h=new W4(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||[])V4._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{$4.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?V4.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=$4.findId(t,i),s=new j4(e,i,t);if(t.children)for(const i of t.children)V4._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 j4?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 V4._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&&V4._flattenDocumentSymbols(t,s.children,s.name)}}const H4=Jr("IOutlineModelService");let z4=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new hg(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:V4.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()}}))}};z4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([B4(0,$g),B4(1,FF),B4(2,Yr)],z4),$a(H4,z4,1);uo.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(H4),n=t.get(Xr),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,ue.None)).getTopLevelSymbols()}finally{r.dispose()}}))}));class U4 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=U4.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=U4.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=U4.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=U4.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=my.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}U4.inlineSuggestionVisible=new Go("inlineSuggestionVisible",!1,J(0,"Whether an inline suggestion is visible")),U4.inlineSuggestionHasIndentation=new Go("inlineSuggestionHasIndentation",!1,J(0,"Whether the inline suggestion starts with whitespace")),U4.inlineSuggestionHasIndentationLessThanTabSize=new Go("inlineSuggestionHasIndentationLessThanTabSize",!0,J(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),U4.suppressSuggestions=new Go("inlineSuggestionSuppressSuggestions",void 0,J(0,"Whether suggestions should be suppressed for the current suggestion"));class K4{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 q4=[];class G4{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 Z4(t,i){return new gs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function J4(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 K4(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 Y4{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 X4{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new Y4(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 t5(t,i){return t===i||!(!t||!i)&&(t instanceof Q4&&i instanceof Q4||t instanceof X4&&i instanceof X4)&&t.equals(i)}const i5="ghost-text";let e5=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 X4?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 np(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 np(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,i5),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 G4(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:i5,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:tf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new s5(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}};e5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Pa)],e5);class s5 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 ma(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=ep.createEmpty(d,n);gp(new up(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=n5?n5.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 n5=zu("editorGhostText",{createHTML:t=>t});class r5{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 o5{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=o5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(o5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(o5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(o5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(o5.isVariableCharacter(s)||o5.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===o5._table[s]&&!o5.isDigitCharacter(s)&&!o5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}o5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class h5{constructor(){this._children=[]}appendChild(t){return t instanceof c5&&this._children[this._children.length-1]instanceof c5?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 m5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class c5 extends h5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new c5(this.value)}}class l5 extends h5{}class u5 extends l5{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 a5?this._children[0]:void 0}clone(){const t=new u5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class a5 extends h5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof c5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new a5;return this.options.forEach(t.appendChild,t),t}}class d5 extends h5{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 f5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof f5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new d5;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 f5 extends h5{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 f5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class g5 extends l5{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 c5(i)],!0)}clone(){const t=new g5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function p5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class m5 extends h5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof u5&&(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 p5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof u5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof g5&&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 m5;return this._children=this.children.map((t=>t.clone())),t}walk(t){p5(this.children,t)}}class v5{constructor(){this._scanner=new o5,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 m5;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 u5&&(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 u5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof u5&&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 u5(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 c5(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 u5(Number(i)):new g5(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 u5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new c5("${"+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 a5;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 c5(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 g5(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 c5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new d5;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 c5(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 f5(Number(s))),!0;if(this._accept(4))return t.appendChild(new f5(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 f5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new f5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new f5(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 f5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new f5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new c5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}var w5=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 b5(t,i,e,s,n=ue.None,r){return w5(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 lg;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 Lu;return u.set(t,h.p),(()=>w5(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=>w5(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 k5(i,t.provider);m.push(s);for(const t of i.items){const i=C5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new y5(Array.from(p.values()),new Set(p.keys()),m)}))}class y5{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 k5{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 C5{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=S5(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=S5(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 v5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof c5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else ch();return new C5(r,t.command,h,r,o,t.additionalTextEdits||q4,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 C5(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 S5(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 r5([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,aD),r}(o,s);return h}class x5{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=Z4(this.range.getStartPosition(),J4(s.substring(0,n))),o=this.text.substring(n),h=ps.fromPositions(r,this.range.getEndPosition());return new x5(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 x5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==D5?void 0:D5.originalValue)===t&&(null==D5?void 0:D5.newValue)===i)return null==D5?void 0:D5.changes;{let e=A5(t,i,!0);if(e){const s=E5(e);if(s>0){const n=A5(t,i,!1);n&&E5(n)<s&&(e=n)}}return D5={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 Y4(s,t,!1))}if(c.length>0){const t=Bn(c);u.push(new Y4(s,t,!0))}}return new Q4(l,u)}}let D5;function E5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function A5(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 _d({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var M5=function(t,i){return function(e,s){i(e,s,t)}};let L5=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 O5(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 b5(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 T5(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 F5(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()}};L5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M5(3,$g),M5(4,cd)],L5);class O5{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 F5{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class T5{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 R5(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 R5(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class R5{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 x5(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 x5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return _5(this._getUpdatedRange(t)).isBefore(_5(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 _5(t){return t.startLineNumber===t.endLineNumber?new gs(1,1+t.endColumn-t.startColumn):new gs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}var I5=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 P5={Visible:Y1,HasFocusedSuggestion:new Go("suggestWidgetHasFocusedSuggestion",!1,J(0,"Whether any suggestion is focused")),DetailsVisible:new Go("suggestWidgetDetailsVisible",!1,J(0,"Whether suggestion details are visible")),MultipleSuggestions:new Go("suggestWidgetMultipleSuggestions",!1,J(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Go("suggestionMakesTextEdit",!0,J(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Go("acceptSuggestionOnEnter",!0,J(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Go("suggestionHasInsertAndReplaceRange",!1,J(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Go("suggestionInsertMode",void 0,{type:"string",description:J(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Go("suggestionCanResolve",!1,J(0,"Whether the current suggestion supports to resolve further details"))},N5=new wh("suggestWidgetStatusBar");class B5{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 I5(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 $5{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}}$5.default=new $5;class j5{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function W5(t,i,e,s=$5.default,n={triggerKind:0},r=ue.None){return I5(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=v5.guessNeedsClipboard(n.insertText)),u.push(new B5(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=(()=>I5(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>I5(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 j5(u.sort(H5.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function V5(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 H5=new Map;H5.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 V5(t,i)})),H5.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 V5(t,i)})),H5.set(1,V5),uo.registerCommand("_executeCompletionItemProvider",((t,...i)=>I5(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($g),h=yield t.get(Xr).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield W5(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 z5{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 U5(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 K5{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 q5{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 c5&&(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 G5{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 Z5{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 J5=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}};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)}}(2,cd)],J5);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 Y5{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)}:gR: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)||fR(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(fR(t))return Ge(t.uri.path);let i=Ge(t.configPath.path);return i.endsWith("code-workspace")&&(i=i.substr(0,i.length-14-1)),i}_resoveWorkspacePath(t){if(fR(t))return U5(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?U5(e):"/"}}class X5{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?p0():void 0}}var t3;class i3{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,u5.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?i3._decor.inactiveFinal:i3._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(FT.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?i3._decor.activeFinal:i3._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?i3._decor.activeFinal:i3._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?i3._decor.inactiveFinal:i3._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof u5){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 a5,!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,i3._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,u5.compareByIndex)}))}}i3._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 e3={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let s3=t3=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 c5)||i.parent instanceof a5)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 c5(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(dR))),f=t.invokeWithinContext((t=>new G5(t.get(eR),a))),g=()=>o,p=a.getValueInRange(t3.adjustSelection(a,t.getSelection(),e,0)),m=a.getValueInRange(t3.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=t3.adjustSelection(a,o,e,0),k=t3.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 v5).parse(i,!0,n),x=C.getStartPosition(),D=t3.adjustWhitespace(a,x,r||b>0&&v!==a.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new K5([f,new Z5(g,b,w.length,"spread"===t.getOption(78)),new q5(a,o,b,h),new J5(a,o,c),new Q5,new Y5(d),new X5])),l[b]=FT.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,u[b]=new i3(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 v5,u=new m5,a=new K5([t.invokeWithinContext((t=>new G5(t.get(eR),c))),new Z5((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new q5(c,t.getSelection(),0,r),new J5(c,t.getSelection(),o),new Q5,new Y5(t.invokeWithinContext((t=>t.get(dR)))),new X5]);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 c5(c.getValueInRange(s));u.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,u);t3.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=FT.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 i3(t,u,"")]}}constructor(t,i,e=e3,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?t3.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):t3.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=e3){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=t3.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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,cd)],s3);var n3,r3=function(t,i){return function(e,s){i(e,s,t)}};const o3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let h3=n3=class{static get(t){return t.getContribution(n3.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=n3.InSnippetMode.bindTo(s),this._hasNextTabstop=n3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=n3.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?o3:Object.assign(Object.assign({},o3),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 s3(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())}};h3.ID="snippetController2",h3.InSnippetMode=new Go("inSnippetMode",!1,J(0,"Whether the editor in current in snippet mode")),h3.HasNextTabstop=new Go("hasNextTabstop",!1,J(0,"Whether there is a next tab stop when in snippet mode")),h3.HasPrevTabstop=new Go("hasPrevTabstop",!1,J(0,"Whether there is a previous tab stop when in snippet mode")),h3=n3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([r3(1,Ah),r3(2,$g),r3(3,Zo),r3(4,cd)],h3),ru(h3.ID,h3,4);const c3=Ql.bindToContribution(h3.get);eu(new c3({id:"jumpToNextSnippetPlaceholder",precondition:Mo.and(h3.InSnippetMode,h3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:2}})),eu(new c3({id:"jumpToPrevSnippetPlaceholder",precondition:Mo.and(h3.InSnippetMode,h3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:1026}})),eu(new c3({id:"leaveSnippet",precondition:h3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:9,secondary:[1033]}})),eu(new c3({id:"acceptSnippet",precondition:h3.InSnippetMode,handler:t=>t.finish()}));var l3,u3=function(t,i){return function(e,s){i(e,s,t)}},a3=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"}(l3||(l3={}));let d3=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(L5,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([l3.Redo,l3.Undo,l3.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?t5(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:t5},(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 a3(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return a3(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 a3(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 a3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return a3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i;return a3(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",[FT.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=h3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[FT.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 a3(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 a3(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 a3(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",[FT.replace(ps.fromPositions(o),l)]);const i=J4(l);t.setPosition(Z4(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ps.fromPositions(n.range.getStartPosition(),Z4(o,J4(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)}};d3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(9,Zr),u3(10,lo),u3(11,cd)],d3);var f3,g3=function(t,i){return function(e,s){i(e,s,t)}};class p3{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 m3 extends p3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let v3=f3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new Eu((()=>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=f3._strategyCtors.get(s)||m3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${f3._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(`${f3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};v3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends p3{constructor(){super("recentlyUsedByPrefix"),this._trie=aR.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 p3{constructor(){super("recentlyUsed"),this._cache=new hg(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",m3]]),v3._storagePrefix="suggest/memories",v3=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}([g3(0,PP),g3(1,Oa)],v3);const w3=Jr("ISuggestMemories");$a(w3,v3,1);var b3;let y3=b3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=b3.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)}};y3.AtEnd=new Go("atEndOfWord",!1),y3=b3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zo)],y3);var k3;let C3=k3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=k3.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&&k3._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=k3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};C3.OtherSuggestions=new Go("hasOtherSuggestions",!1),C3=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zo)],C3);class S3{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 Vd;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 x3{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=>x3._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>x3._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>=x3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>x3._maxDuration){setTimeout((()=>x3._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>=x3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>x3._maxDuration){setTimeout((()=>x3._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}),x3._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())}))}}}x3._maxDuration=30,x3._maxRounds=2;class D3{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 D3.None;if(!i.hasModel())return D3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return D3.None;const[r]=yield(new x3).provideSelectionRanges(e,[n]);if(0===r.length)return D3.None;const o=yield t.computeWordRanges(e.uri,r[0].range);if(!o)return D3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends D3{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}}}))}}D3.None=new class extends D3{distance(){return 0}};class E3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class A3{constructor(t,i,e,s,n,r,o=O_.default,h){this.clipboardText=h,this._snippetCompareFn=A3._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=A3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=A3._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 A3._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 A3._compareCompletionItems(t,i)}}var M3,L3=function(t,i){return function(e,s){i(e,s,t)}};class O3{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 F3=M3=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 xu,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(U4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(O3.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;z5.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=h3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!O3.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(!z5.isAllOff(e)){if(!z5.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"!==z5.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(U4.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(U4.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 O3(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 O3(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}=M3._createSuggestFilter(this._editor),f=new $5(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=D3.create(this._editorWorkerService,this._editor),p=W5(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 O3(r,this._editor.getPosition(),t),h=Object.assign(Object.assign({},O_.default),{firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly});if(this._completionModel=new A3(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(O3.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=O3.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()}};F3=M3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,MN),L3(2,EV),L3(3,Eh),L3(4,Ah),L3(5,Zo),L3(6,Oa),L3(7,$g),L3(8,EF)],F3);class T3{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)>T3._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()}}T3._maxSelectionLength=51200;var R3=function(t,i){return function(e,s){i(e,s,t)}};class _3 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,_3.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let I3=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Ml(t,_l(".suggest-status-bar"));const r=t=>t instanceof Sh?e.createInstance(_3,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()}};I3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([R3(2,Zr),R3(3,bh),R3(4,Zo)],I3);function P3(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let N3=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 nl(330,0),this.domNode=_l(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(XG,{editor:t}),this._body=_l(".body"),this._scrollbar=new Gy(this._body,{alwaysConsumeMouseWheel:!0}),Ml(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ml(this._body,_l(".header")),this._close=Ml(this._header,_l("span"+io.asCSSSelector(ys.close))),this._close.title=J(0,"Close"),this._type=Ml(this._header,_l("p.type")),this._docs=Ml(this._body,_l("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||P3(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,Il(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Kc(this._type),this._type.title="",Pl(this._type),this.domNode.classList.add("no-type");if(Kc(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Kc(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 nl(t,i);nl.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}};N3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zr)],N3);class B3{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 SY,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=el(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new nl(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 nl(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 nl(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 nl(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 $3;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}($3||($3={}));const j3=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function W3(t,i,e,s){const n=s===$3.ROOT_FOLDER?["rootfolder-icon"]:s===$3.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===jc.data)r=jE.parseMetaData(e).get(jE.META_DATA_LABEL);else{const t=e.path.match(j3);t?(r=V3(t[2].toLowerCase()),t[1]&&n.push(`${V3(t[1].toLowerCase())}-name-dir-icon`)):r=V3(e.authority.toLowerCase())}if(s===$3.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===jc.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!==td?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${V3(s)}-lang-file-icon`)}}return n}function V3(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var H3,z3=function(t,i){return function(e,s){i(e,s,t)}};function U3(t){return`suggest-aria-id:${t}`}const K3=GW("suggest-more-info",ys.chevronRight,J(0,"Icon for more information in the suggest widget.")),q3=new((H3=class{extract(t,i){if(t.textLabel.match(H3._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(H3._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=H3._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*\))/,H3._regexStrict=new RegExp(`^${H3._regexRelaxed.source}$`,"i"),H3);let G3=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=Ml(t,_l(".icon")),n=Ml(s,_l("span.colorspan")),r=Ml(t,_l(".contents")),o=Ml(r,_l(".main")),h=Ml(o,_l(".icon-label.codicon")),c=Ml(o,_l("span.left")),l=Ml(o,_l("span.right")),u=new Jj(c,{supportHighlights:!0,supportIcons:!0});i.add(u);const a=Ml(c,_l("span.signature-label")),d=Ml(c,_l("span.qualifier-label")),f=Ml(l,_l("span.details-label")),g=Ml(l,_l("span.readMore"+io.asCSSSelector(K3)));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=U3(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:v_(t.score)},r=[];if(19===s.kind&&q3.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=W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),$3.FILE),r=W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),$3.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=[W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),$3.FOLDER),W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),$3.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...io.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=Z3(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=Z3(s.label.detail||""),e.detailsLabel.textContent=Z3(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Il(e.detailsLabel):Pl(e.detailsLabel),P3(t)?(e.right.classList.add("can-expand-details"),Il(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"),Pl(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function Z3(t){return t.replace(/\r\n|\r|\n/g,"")}G3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([z3(1,Yr),z3(2,Pa),z3(3,pk)],G3);var J3,Q3=function(t,i){return function(e,s){i(e,s,t)}};Lm("editorSuggestWidget.background",{dark:Mv,light:Mv,hcDark:Mv,hcLight:Mv},J(0,"Background color of the suggest widget.")),Lm("editorSuggestWidget.border",{dark:Ov,light:Ov,hcDark:Ov,hcLight:Ov},J(0,"Border color of the suggest widget."));const Y3=Lm("editorSuggestWidget.foreground",{dark:Av,light:Av,hcDark:Av,hcLight:Av},J(0,"Foreground color of the suggest widget."));Lm("editorSuggestWidget.selectedForeground",{dark:Hw,light:Hw,hcDark:Hw,hcLight:Hw},J(0,"Foreground color of the selected entry in the suggest widget.")),Lm("editorSuggestWidget.selectedIconForeground",{dark:zw,light:zw,hcDark:zw,hcLight:zw},J(0,"Icon foreground color of the selected entry in the suggest widget."));const X3=Lm("editorSuggestWidget.selectedBackground",{dark:Uw,light:Uw,hcDark:Uw,hcLight:Uw},J(0,"Background color of the selected entry in the suggest widget."));Lm("editorSuggestWidget.highlightForeground",{dark:Aw,light:Aw,hcDark:Aw,hcLight:Aw},J(0,"Color of the match highlights in the suggest widget.")),Lm("editorSuggestWidget.focusHighlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Color of the match highlights in the suggest widget when an item is focused.")),Lm("editorSuggestWidgetStatus.foreground",{dark:Ab(Y3,.5),light:Ab(Y3,.5),hcDark:Ab(Y3,.5),hcLight:Ab(Y3,.5)},J(0,"Foreground color of the suggest widget status."));class t6{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof jJ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(nl.is(t))return nl.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let i6=J3=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 xu,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 SY,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new e6(this,t),this._persistedSize=new t6(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 nl(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=Ml(this.element.domNode,_l(".message")),this._listElement=Ml(this.element.domNode,_l(".tree"));const h=this._disposables.add(n.createInstance(N3,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new B3(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(G3,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:X3,listInactiveFocusOutline:Im})),this._status=n.createInstance(I3,this.element.domNode,N5);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=P5.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=P5.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=P5.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=P5.HasFocusedSuggestion.bindTo(e),this._disposables.add(Qc(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=ry(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=mu((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=Cu((()=>{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:U3(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:Pl(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=J3.LOADING_MESSAGE,Pl(this._listElement,this._status.element),Il(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,sm(J3.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=J3.NO_SUGGESTIONS_MESSAGE,Pl(this._listElement,this._status.element),Il(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,sm(J3.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Pl(this._messageElement),Il(this._listElement,this._status.element),this._show();break;case 5:Pl(this._messageElement),Il(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=Cu((()=>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=Yc((()=>{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")):!P3(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=Yc((()=>{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=el(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 nl(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=ol(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 nl(l,r.defaultSize.height),this.element.maxSize=new nl(c,v),this.element.minSize=new nl(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 nl(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}};i6.LOADING_MESSAGE=J(0,"Loading..."),i6.NO_SUGGESTIONS_MESSAGE=J(0,"No suggestions."),i6=J3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q3(1,PP),Q3(2,Zo),Q3(3,pk),Q3(4,Zr)],i6);class e6{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 nl(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 s6,n6=function(t,i){return function(e,s){i(e,s,t)}};class r6{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 o6=s6=class{static get(t){return t.getContribution(s6.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 h6((t=>t.priority)),this._onWillInsertSuggestItem=new ie,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(F3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=P5.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 Mu((()=>{const t=this._instantiationService.createInstance(i6,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new S3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=P5.MakesTextEdit.bindTo(this._contextKeyService),s=P5.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=P5.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 sh(!0,!1,!1,!1,33))||ft&&t.toKeyCodeChord().equals(new sh(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new Mu((()=>this._toDispose.add(new T3(this.editor,this.model))))),this._alternatives=this._toDispose.add(new Mu((()=>this._toDispose.add(new C3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(y3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new r6(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=P5.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=h3.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=iU.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>FT.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=iU.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>FT.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=v5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===c6.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:kd(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)&&em(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)}};o6.ID="editor.contrib.suggestController",o6=s6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([n6(1,w3),n6(2,lo),n6(3,Zo),n6(4,Zr),n6(5,Ah),n6(6,Eh)],o6);class h6{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 c6 extends Yl{constructor(){super({id:c6.id,label:J(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Mo.and(fS.writable,fS.hasCompletionItemProvider,P5.Visible.toNegated()),kbOpts:{kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=o6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}c6.id="editor.action.triggerSuggest",ru(o6.ID,o6,2),su(c6);const l6=190,u6=Ql.bindToContribution(o6.get);eu(new u6({id:"acceptSelectedSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Mo.and(P5.Visible,fS.textInputFocus),weight:l6},{primary:3,kbExpr:Mo.and(P5.Visible,fS.textInputFocus,P5.AcceptSuggestionsOnEnter,P5.MakesTextEdit),weight:l6}],menuOpts:[{menuId:N5,title:J(0,"Insert"),group:"left",order:1,when:P5.HasInsertAndReplaceRange.toNegated()},{menuId:N5,title:J(0,"Insert"),group:"left",order:1,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("insert"))},{menuId:N5,title:J(0,"Replace"),group:"left",order:1,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("replace"))}]})),eu(new u6({id:"acceptAlternativeSelectedSuggestion",precondition:Mo.and(P5.Visible,fS.textInputFocus,P5.HasFocusedSuggestion),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:N5,group:"left",order:2,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("insert")),title:J(0,"Replace")},{menuId:N5,group:"left",order:2,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("replace")),title:J(0,"Insert")}]})),uo.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),eu(new u6({id:"hideSuggestWidget",precondition:P5.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:9,secondary:[1033]}})),eu(new u6({id:"selectNextSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),eu(new u6({id:"selectNextPageSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:12,secondary:[2060]}})),eu(new u6({id:"selectLastSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),eu(new u6({id:"selectPrevSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),eu(new u6({id:"selectPrevPageSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:11,secondary:[2059]}})),eu(new u6({id:"selectFirstSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),eu(new u6({id:"focusSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),eu(new u6({id:"focusAndAcceptSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),eu(new u6({id:"toggleSuggestionDetails",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:N5,group:"right",order:1,when:Mo.and(P5.DetailsVisible,P5.CanResolve),title:J(0,"show less")},{menuId:N5,group:"right",order:1,when:Mo.and(P5.DetailsVisible.toNegated(),P5.CanResolve),title:J(0,"show more")}]})),eu(new u6({id:"toggleExplainMode",precondition:P5.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),eu(new u6({id:"toggleSuggestionFocus",precondition:P5.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2570,mac:{primary:778}}})),eu(new u6({id:"insertBestCompletion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),y3.AtEnd,P5.Visible.toNegated(),C3.OtherSuggestions.toNegated(),h3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(O(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:l6,primary:2}})),eu(new u6({id:"insertNextSuggestion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),C3.OtherSuggestions,P5.Visible.toNegated(),h3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2}})),eu(new u6({id:"insertPrevSuggestion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),C3.OtherSuggestions,P5.Visible.toNegated(),h3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:1026}})),su(class extends Yl{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=o6.get(i))||void 0===e||e.resetWidgetSize()}});class a6 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=o6.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=Mf(e.map(((t,i)=>{const e=d6.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=d6.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=o6.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?d6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=o6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=o6.get(this.editor);null==t||t.forceRenderingAbove()}}class d6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new v5).parse(r);t.children.length<100&&s3.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new d6(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 x5(this.range,this.insertText)}}var f6,g6=function(t,i){return function(e,s){i(e,s,t)}};let p6=f6=class extends Hi{static get(t){return t.getContribution(f6.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 a6(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,l3.Other)),(t=>{DH((i=>{var e;this.updateObservables(i,l3.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(e5,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 U4(this.contextKeyService,this.model)),this._register(Ji.runAndSubscribe(t.onDidChangeModel,(()=>DH((e=>{this.model.set(void 0,e),this.updateObservables(e,l3.Other);const s=t.getModel();if(s){const n=i.createInstance(d3,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?l3.Undo:t.isRedoing?l3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?l3.AcceptWord:l3.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,l3.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,l3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([CS.Tab.id,CS.DeleteLeft.id,CS.DeleteRight.id,MX,"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||WX.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 BX(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())),em(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)}};p6.ID="editor.contrib.inlineCompletionsController",p6=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}([g6(1,Zr),g6(2,Zo),g6(3,Oa),g6(4,lo),g6(5,FF),g6(6,$g),g6(7,GV),g6(8,kC)],p6);var m6=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 v6 extends Yl{constructor(){super({id:v6.ID,label:J(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}v6.ID=OX;class w6 extends Yl{constructor(){super({id:w6.ID,label:J(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}w6.ID=LX;class b6 extends Yl{constructor(){super({id:b6.ID,label:J(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:U4.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return m6(this,void 0,void 0,(function*(){const t=p6.get(i);DH((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}b6.ID="editor.action.inlineSuggest.hide";class y6 extends xh{constructor(){super({id:y6.ID,title:J(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:wh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Mo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return m6(this,void 0,void 0,(function*(){const i=t.get(Oa),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}y6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var k6=function(t,i){return function(e,s){i(e,s,t)}};class C6{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 S6=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=p6.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 kY(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 kY(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=p6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new C6(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(WX,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=_l,n=s("div.hover-row.markdown-hover"),r=Ml(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new XG({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 Ol(r)}))),t.fragment.appendChild(n)}};function x6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function D6(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}S6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([k6(1,Pa),k6(2,AF),k6(3,fm),k6(4,Zr),k6(5,Eh)],S6),ru(p6.ID,p6,3),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:J(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:fS.writable})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),su(v6),su(w6),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:J(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Mo.and(fS.writable,U4.inlineSuggestionVisible)},menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextWord(t.editor)}))}}),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:J(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextLine(t.editor)}))}}),su(class extends Yl{constructor(){super({id:MX,label:J(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:U4.inlineSuggestionVisible,menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Mo.and(U4.inlineSuggestionVisible,fS.tabMovesFocus.toNegated(),U4.inlineSuggestionHasIndentationLessThanTabSize,P5.Visible.toNegated(),fS.hoverFocused.toNegated())}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),su(b6),Dh(y6),CY.register(S6);function E6(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)=>tS.shiftIndent(t,t.length+(i=i||1),o,h,c),u=(t,i)=>tS.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(FT.replaceMove(new ms(e,1,e,t.length+1),DC(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(FT.replaceMove(new ms(i,1,i,s.length+1),DC(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 A6 extends Yl{constructor(){super({id:A6.ID,label:J(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:fS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new N6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}A6.ID="editor.action.indentationToSpaces";class M6 extends Yl{constructor(){super({id:M6.ID,label:J(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:fS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new B6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}M6.ID="editor.action.indentationToTabs";class L6 extends Yl{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(Ij),s=t.get(Yr),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 O6 extends L6{constructor(){super(!1,!1,{id:O6.ID,label:J(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}O6.ID="editor.action.indentUsingTabs";class F6 extends L6{constructor(){super(!0,!1,{id:F6.ID,label:J(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}F6.ID="editor.action.indentUsingSpaces";class T6 extends L6{constructor(){super(!0,!0,{id:T6.ID,label:J(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}T6.ID="editor.action.changeTabDisplaySize";class R6 extends Yl{constructor(){super({id:R6.ID,label:J(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Yr),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}R6.ID="editor.action.detectIndentation";class _6{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 I6=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=>tS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>tS.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=nS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=jn(u),s=x6(t,n);if(s!==x6(i,n)){const t=D6(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=rS(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=nS(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=x6(i,n),r=x6(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=D6(x6(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 _6(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 P6(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)}}I6.ID="editor.contrib.autoIndentOnPaste",I6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,cd)],I6);class N6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),P6(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class B6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),P6(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}ru(I6.ID,I6,2),su(A6),su(M6),su(O6),su(F6),su(T6),su(R6),su(class extends Yl{constructor(){super({id:"editor.action.reindentlines",label:J(0,"Reindent Lines"),alias:"Reindent Lines",precondition:fS.writable})}run(t,i){const e=t.get(cd),s=i.getModel();if(!s)return;const n=E6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),su(class extends Yl{constructor(){super({id:"editor.action.reindentselectedlines",label:J(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:fS.writable})}run(t,i){const e=t.get(cd),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=E6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});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())}))};class j6{constructor(t,i){this.range=t,this.direction=i}}class W6{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new W6(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return $6(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 $6(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 V6{static create(t,i,e,s){return $6(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>$6(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 V6(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=V6._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 W6(i,new j6(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 H6=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 z6(t,i,e,s){var n;return H6(this,void 0,void 0,(function*(){const r=t.get(Xr),o=t.get(AR),h=t.get(lo),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(kh.getMenuItems(wh.EditorContext).map((t=>vh(t)?t.command.id:p0())));for(const t of nY.all())d.has(t.desc.id)&&a.push(new so(t.desc.id,Sh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>H6(this,void 0,void 0,(function*(){const e=yield r.createModelReference(u.uri);try{const n=new sY(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 ro),a.push(new so(t.id,t.title,void 0,!0,(()=>H6(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=ol(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function U6(t,i,e,s){return H6(this,void 0,void 0,(function*(){const n=t.get(Xr),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>H6(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Zo),h=JJ.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new rY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new sY(r.object.textEditorModel,ps.getStartPosition(s.range)),ps.lift(s.range))})))),r.dispose()}))}var K6,q6=function(t,i){return function(e,s){i(e,s,t)}},G6=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 Z6{constructor(){this._entries=new hg(50)}get(t){const i=Z6._key(t);return this._entries.get(i)}set(t,i){const e=Z6._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const J6=Jr("IInlayHintsCache");$a(J6,Z6,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 Y6{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let X6=K6=class{static get(t){var i;return null!==(i=t.getContribution(K6.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 zb(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 Eu((()=>G6(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 e=s.token,o=yield V6.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),e);if(r.delay=this._debounceInfo.update(i,Date.now()-t),e.isCancellationRequested)return void o.dispose();for(const t of o.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(o),this._updateHintsDecorators(o.ranges,o.items),this._cacheHintsForFastRestore(i)}catch(t){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(Hl.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 BJ(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 Y6(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=>G6(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(U6,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=>G6(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=>FT.replace(ps.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>G6(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(z6,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 G6(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 j6(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?tf.Right:tf.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=mk(Xv),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?tf.Right:tf.None,new Q6(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>K6._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=iU.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=mk(rw),t.color=mk(nw)):i.kind===_s.Type?(t.backgroundColor=mk(sw),t.color=mk(ew)):(t.backgroundColor=mk(iw),t.color=mk(tw))}_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()}};X6.ID="editor.contrib.InlayHints",X6._MAX_DECORATORS=1500,X6=K6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([q6(1,$g),q6(2,FF),q6(3,J6),q6(4,lo),q6(5,vO),q6(6,Zr)],X6),uo.registerCommand("_executeInlayHintProvider",((t,...i)=>G6(void 0,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e)),B(ps.isIRange(s));const{inlayHintsProvider:n}=t.get($g),r=yield t.get(Xr).createModelReference(e);try{const t=yield V6.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 t9=function(t,i){return function(e,s){i(e,s,t)}},i9=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 extends kY{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let s9=class extends KY{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!X6.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 e9(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof e9?new Fu((i=>i9(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 UY(this,t.range,[h],!1,0)),a(o.item.hint.textEdits)&&i.emitOne(new UY(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 UY(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:jc.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${o.part.command.title}") (${s})`,{isTrusted:!0})),e&&i.emitOne(new UY(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}}})))):Fu.EMPTY}_resolveInlayHintLabelPartHover(t,i){return i9(this,void 0,void 0,(function*(){if(!t.part.location)return Fu.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)?VY(this._languageFeaturesService.hoverProvider,e,new gs(s.startLineNumber,s.startColumn),i).filter((t=>!z_(t.hover.contents))).map((i=>new UY(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):Fu.EMPTY}finally{n.dispose()}}))}};s9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t9(1,Pa),t9(2,AF),t9(3,Oa),t9(4,Xr),t9(5,$g)],s9),ru(X6.ID,X6,1),CY.register(s9);class n9{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 r9;let o9=r9=class{static get(t){return t.getContribution(r9.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 hK(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=mu((()=>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 n9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:r9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=ku(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};o9.ID="editor.contrib.inPlaceReplaceController",o9.DECORATION=$M.register({description:"in-place-replace",className:"valueSetReplacement"}),o9=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)}}(1,MN)],o9),ru(o9.ID,o9,4),su(class extends Yl{constructor(){super({id:"editor.action.inPlaceReplace.up",label:J(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=o9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),su(class extends Yl{constructor(){super({id:"editor.action.inPlaceReplace.down",label:J(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=o9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),su(class extends Yl{constructor(){super({id:"expandLineSelection",label:J(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:fS.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,GC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class h9{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++]=FT.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 c9{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 l9=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=D6(u+x6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=jn(t.getLineContent(e)),h=x6(i,n);if(h!==x6(s,n)){const t=D6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=x6(r,n),c=x6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=x6(r,n),c=x6(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=>tS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>tS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Gu.None||n.indentAction===Gu.Indent?r=n.indentation+n.appendText:n.indentAction===Gu.IndentOutdent?r=n.indentation:n.indentAction===Gu.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=rS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),x6(o,e)-x6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(Wn(r)>=0){const r=t.getLineMaxColumn(n),o=JC(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=JC(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=JC(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=D6(x6(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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,cd)],l9);class u9{static getCollator(){return u9._COLLATOR||(u9._COLLATOR=new Intl.Collator),u9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=a9(t,i,e);return s?FT.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=a9(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 a9(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(u9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}u9._COLLATOR=null;class d9 extends Yl{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 c9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class f9 extends Yl{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(cd),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new l9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class g9 extends Yl{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!u9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new u9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class p9 extends Yl{constructor(){super({id:p9.ID,label:J(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:fS.writable,kbOpts:{kbExpr:fS.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 h9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}p9.ID="editor.action.trimTrailingWhitespace";class m9 extends Yl{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=>FT.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class v9 extends Yl{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(FT.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(FT.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class w9{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 b9 extends v9{constructor(){super({id:"editor.action.transformToTitlecase",label:J(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:fS.writable})}_modifyText(t,i){const e=b9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}b9.titleBoundary=new w9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class y9 extends v9{constructor(){super({id:"editor.action.transformToSnakecase",label:J(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:fS.writable})}_modifyText(t,i){const e=y9.caseBoundary.get(),s=y9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}y9.caseBoundary=new w9("(\\p{Ll})(\\p{Lu})","gmu"),y9.singleLetters=new w9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class k9 extends v9{constructor(){super({id:"editor.action.transformToCamelcase",label:J(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:fS.writable})}_modifyText(t,i){const e=k9.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("")}}k9.wordBoundary=new w9("[_\\s-]","gm");class C9 extends v9{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:fS.writable})}_modifyText(t,i){const e=C9.caseBoundary.get(),s=C9.singleLetters.get(),n=C9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}C9.caseBoundary=new w9("(\\p{Ll})(\\p{Lu})","gmu"),C9.singleLetters=new w9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),C9.underscoreBoundary=new w9("(\\S)(_)(\\S)","gm"),su(class extends d9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:J(0,"Copy Line Up"),alias:"Copy Line Up",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"&&Copy Line Up"),order:1}})}}),su(class extends d9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:J(0,"Copy Line Down"),alias:"Copy Line Down",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Co&&py Line Down"),order:2}})}}),su(class extends Yl{constructor(){super({id:"editor.action.duplicateSelection",label:J(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:fS.writable,menuOpts:{menuId:wh.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 c9(t,!0));else{const i=new ms(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new BC(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),su(class extends f9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:J(0,"Move Line Up"),alias:"Move Line Up",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Mo&&ve Line Up"),order:3}})}}),su(class extends f9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:J(0,"Move Line Down"),alias:"Move Line Down",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Move &&Line Down"),order:4}})}}),su(class extends g9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:J(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:fS.writable})}}),su(class extends g9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:J(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:fS.writable})}}),su(class extends Yl{constructor(){super({id:"editor.action.removeDuplicateLines",label:J(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:fS.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(FT.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()}}),su(p9),su(class extends Yl{constructor(){super({id:"editor.action.deleteLines",label:J(0,"Delete Line"),alias:"Delete Line",precondition:fS.writable,kbOpts:{kbExpr:fS.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(FT.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}}),su(class extends Yl{constructor(){super({id:"editor.action.indentLines",label:J(0,"Indent Line"),alias:"Indent Line",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),su(class extends Yl{constructor(){super({id:"editor.action.outdentLines",label:J(0,"Outdent Line"),alias:"Outdent Line",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2140,weight:100}})}run(t,i){CS.Outdent.runEditorCommand(t,i,null)}}),su(class extends Yl{constructor(){super({id:"editor.action.insertLineBefore",label:J(0,"Insert Line Above"),alias:"Insert Line Above",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),su(class extends Yl{constructor(){super({id:"editor.action.insertLineAfter",label:J(0,"Insert Line Below"),alias:"Insert Line Below",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),su(class extends m9{constructor(){super({id:"deleteAllLeft",label:J(0,"Delete All Left"),alias:"Delete All Left",precondition:fS.writable,kbOpts:{kbExpr:fS.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)}}),su(class extends m9{constructor(){super({id:"deleteAllRight",label:J(0,"Delete All Right"),alias:"Delete All Right",precondition:fS.writable,kbOpts:{kbExpr:fS.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}}),su(class extends Yl{constructor(){super({id:"editor.action.joinLines",label:J(0,"Join Lines"),alias:"Join Lines",precondition:fS.writable,kbOpts:{kbExpr:fS.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(FT.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(FT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.endLineNumber-u,i.endColumn)):(h.push(FT.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()}}),su(class extends Yl{constructor(){super({id:"editor.action.transpose",label:J(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:fS.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 NC(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 WC(t,i,new ms(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),su(class extends v9{constructor(){super({id:"editor.action.transformToUppercase",label:J(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:fS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),su(class extends v9{constructor(){super({id:"editor.action.transformToLowercase",label:J(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:fS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),y9.caseBoundary.isSupported()&&y9.singleLetters.isSupported()&&su(y9),k9.wordBoundary.isSupported()&&su(k9),b9.titleBoundary.isSupported()&&su(b9),C9.isSupported()&&su(C9);var S9,x9=function(t,i){return function(e,s){i(e,s,t)}},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())}))};const E9=new Go("LinkedEditingInputVisible",!1);let A9=S9=class extends Hi{static get(t){return t.getContribution(S9.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=E9.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 bu(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 bu(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 D9(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=mu((t=>D9(this,void 0,void 0,(function*(){try{const r=new Zi(!1),o=yield M9(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:S9.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 M9(t,i,e,s){return Su(t.ordered(i).map((t=>()=>D9(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)))}A9.ID="editor.contrib.linkedEditing",A9.DECORATION=$M.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),A9=S9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([x9(1,Zo),x9(2,$g),x9(3,cd),x9(4,FF)],A9),eu(new(Ql.bindToContribution(A9.get))({id:"cancelLinkedEditingInput",precondition:E9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:fS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Lm("editor.linkedEditingBackground",{dark:Eg.fromHex("#f00").transparent(.3),light:Eg.fromHex("#f00").transparent(.3),hcDark:Eg.fromHex("#f00").transparent(.3),hcLight:Eg.white},J(0,"Background color when the editor auto renames on type.")),iu("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get($g);return M9(s,i,e,ue.None)})),ru(A9.ID,A9,1),su(class extends Yl{constructor(){super({id:"editor.action.linkedEditing",label:J(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Mo.and(fS.writable,fS.hasRenameProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(Qr),[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=A9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var L9=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 O9{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 L9(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 F9{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new O9(t,s)));i=F9._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 T9(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 F9(c(s));return e.isCancellationRequested?(t.dispose(),new F9([])):t}))}uo.registerCommand("_executeLinkProvider",((t,...i)=>L9(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($g),r=t.get(Yr).getModel(e);if(!r)return[];const o=yield T9(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 R9,_9=function(t,i){return function(e,s){i(e,s,t)}};let I9=R9=class extends Hi{static get(t){return t.getContribution(R9.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 Eu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new BJ(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=mu((i=>T9(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(N9.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 N9(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===jc.file&&t.startsWith(`${jc.file}:`)){const e=ss.parse(t);if(e.scheme===jc.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()}};I9.ID="editor.linkDetector",I9=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}([_9(1,AF),_9(2,vO),_9(3,$g),_9(4,FF)],I9);const P9={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 N9{static decoration(t,i){return{range:t.range,options:N9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s=Object.assign({},e?P9.active:P9.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,N9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,N9._getOptions(this.link,i,!1))}}ru(I9.ID,I9,1),su(class extends Yl{constructor(){super({id:"editor.action.openLink",label:J(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=I9.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 B9 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})})))}}B9.ID="editor.contrib.longLinesHelper",ru(B9.ID,B9,2);const $9=Lm("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);Lm("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),Lm("editor.wordHighlightTextBackground",{light:$9,dark:$9,hcDark:$9,hcLight:$9},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 j9=Lm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Im,hcLight:Im},J(0,"Border color of a symbol during read-access, like reading a variable."));Lm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Im,hcLight:Im},J(0,"Border color of a symbol during write-access, like writing to a variable.")),Lm("editor.wordHighlightTextBorder",{light:j9,dark:j9,hcDark:j9,hcLight:j9},J(0,"Border color of a textual occurrence for a symbol."));const W9=Lm("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),V9=Lm("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),H9=Lm("editorOverviewRuler.wordHighlightTextForeground",{dark:fb,light:fb,hcDark:fb,hcLight:fb},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),z9=$M.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:mk(V9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),U9=$M.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:mk(H9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),K9=$M.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:mk(fb),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),q9=$M.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),G9=$M.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:mk(W9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}});function Z9(t){return t?q9:K9}yk(((t,i)=>{const e=t.getColor(zv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var J9;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(", ");sm(J(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class Y9{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class X9{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new X9(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 X9(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 Y9(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 Y9(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 Y9(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 Y9(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 t7 extends Hi{static get(t){return t.getContribution(t7.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=X9.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(!n7(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))))}}}t7.ID="editor.contrib.multiCursorController";class i7 extends Yl{run(t,i){const e=t7.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=z2.get(i);if(r)this._run(e,r);else{const s=t.get(Zr).createInstance(z2,i);this._run(e,s),s.dispose()}Q9(n,s.getCursorStates())}}}class e7{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 s7=J9=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 Eu((()=>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=z2.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(J9._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=t7.get(e);if(!n)return null;const r=z2.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(!n7(e.getModel(),t,i))return null}o=X9.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 e7(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:Z9(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function n7(t,i,e){const s=r7(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!==r7(t,r,!e))return!1}return!0}function r7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}s7.ID="editor.contrib.selectionHighlighter",s7=J9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,$g)],s7),ru(t7.ID,t7,4),ru(s7.ID,s7,1),su(class extends Yl{constructor(){super({id:"editor.action.insertCursorAbove",label:J(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:wh.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,GC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),Q9(r,n.getCursorStates())}}),su(class extends Yl{constructor(){super({id:"editor.action.insertCursorBelow",label:J(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:wh.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,GC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),Q9(r,n.getCursorStates())}}),su(class extends Yl{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:fS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:wh.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())}}),su(class extends i7{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:fS.focus,primary:2082,weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),su(class extends i7{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:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),su(class extends i7{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:fS.focus,primary:xe(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),su(class extends i7{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)}}),su(class extends i7{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:fS.focus,primary:3114,weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),su(class extends i7{constructor(){super({id:"editor.action.changeAll",label:J(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Mo.and(fS.writable,fS.editorTextFocus),kbOpts:{kbExpr:fS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),su(class extends Yl{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())}}),su(class extends Yl{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())}}),su(class extends Yl{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()))}}),su(class extends Yl{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 o7=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 h7={Visible:new Go("parameterHintsVisible",!1),MultipleSignatures:new Go("parameterHintsMultipleSignatures",!1)};function c7(t,i,e,s,n){return o7(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)}}))}uo.registerCommand("_executeSignatureHelpProvider",((t,...i)=>o7(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($g),o=yield t.get(Xr).createModelReference(e);try{const t=yield c7(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 l7;!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}}}(l7||(l7={}));class u7 extends Hi{constructor(t,i,e=u7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ie),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=l7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new Vd,this.retriggerChars=new Vd,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new bu(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=l7.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 l7.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(a7);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 l7.Pending(mu((t=>c7(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 l7.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=l7.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 a7(t,i){switch(i.triggerKind){case Ss.Invoke:return i;case Ss.ContentChange:return t;default:return i}}u7.DEFAULT_DELAY=120;var d7,f7=function(t,i){return function(e,s){i(e,s,t)}};const g7=_l,p7=GW("parameter-hints-next",ys.chevronDown,J(0,"Icon for show next parameter hint.")),m7=GW("parameter-hints-previous",ys.chevronUp,J(0,"Icon for show previous parameter hint."));let v7=d7=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 XG({editor:t},n,s)),this.keyVisible=h7.Visible.bindTo(e),this.keyMultipleSignatures=h7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=g7(".editor-widget.parameter-hints-widget"),i=Ml(t,g7(".phwrapper"));i.tabIndex=-1;const e=Ml(i,g7(".controls")),s=Ml(e,g7(".button"+io.asCSSSelector(m7))),n=Ml(e,g7(".overloads")),r=Ml(e,g7(".button"+io.asCSSSelector(p7)));this._register(Zc(s,"click",(t=>{Dl(t),this.previous()}))),this._register(Zc(r,"click",(t=>{Dl(t),this.next()})));const o=g7(".body"),h=new Gy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Ml(o,g7(".signature")),l=Ml(o,g7(".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=Ml(this.domNodes.signature,g7(".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):Ml(n,g7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=g7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}Ml(this.domNodes.docs,g7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)Ml(this.domNodes.docs,g7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);Ml(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&&(em(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),Ml(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 d7.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)}};v7.ID="editor.widget.parameterHintsWidget",v7=d7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([f7(2,Zo),f7(3,AF),f7(4,Pa)],v7),Lm("editorHoverWidget.highlightForeground",{dark:Aw,light:Aw,hcDark:Aw,hcLight:Aw},J(0,"Foreground color of the active item in the parameter hint."));var w7,b7=function(t,i){return function(e,s){i(e,s,t)}};let y7=w7=class extends Hi{static get(t){return t.getContribution(w7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new u7(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(v7,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)}};y7.ID="editor.controller.parameterHints",y7=w7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([b7(1,Zr),b7(2,$g)],y7),ru(y7.ID,y7,2),su(class extends Yl{constructor(){super({id:"editor.action.triggerParameterHints",label:J(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:fS.hasSignatureHelpProvider,kbOpts:{kbExpr:fS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=y7.get(i);null==e||e.trigger({triggerKind:Ss.Invoke})}});const k7=Ql.bindToContribution(y7.get);eu(new k7({id:"closeParameterHints",precondition:h7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:fS.focus,primary:9,secondary:[1033]}})),eu(new k7({id:"showPrevParameterHint",precondition:Mo.and(h7.Visible,h7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:fS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),eu(new k7({id:"showNextParameterHint",precondition:Mo.and(h7.Visible,h7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:fS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var C7=function(t,i){return function(e,s){i(e,s,t)}};const S7=new Go("renameInputVisible",!1,J(0,"Whether the rename input widget is visible"));let x7=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=S7.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(Nm),o=t.getColor(Bm);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Mv))&&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(jm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor($m))&&void 0!==s?s:"");const h=t.getColor(Wm);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)}};x7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(2,pk),C7(3,kC),C7(4,Zo)],x7);var D7,E7=function(t,i){return function(e,s){i(e,s,t)}},A7=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 M7{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 A7(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 A7(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,e,s){return A7(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 L7=D7=class{static get(t){return t.getContribution(D7.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(x7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return A7(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 M7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new cK(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=nZ.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=nZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new cK(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=vu(s.provideRenameEdits(a.newName,o.token),o.token).then((t=>A7(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&&em(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)}};L7.ID="editor.contrib.renameController",L7=D7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([E7(1,Zr),E7(2,vO),E7(3,kT),E7(4,rR),E7(5,Ah),E7(6,Ng),E7(7,$g)],L7),ru(L7.ID,L7,4),su(class extends Yl{constructor(){super({id:"editor.action.rename",label:J(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Mo.and(fS.writable,fS.hasRenameProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(Qr),[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=L7.get(i);return e?e.run():Promise.resolve()}});const O7=Ql.bindToContribution(L7.get);function F7(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),ha.wrap(i)}(i)}eu(new O7({id:"acceptRenameInput",precondition:S7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:3}})),eu(new O7({id:"acceptRenameInputWithPreview",precondition:Mo.and(S7,Mo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:1027}})),eu(new O7({id:"cancelRenameInput",precondition:S7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:fS.focus,primary:9,secondary:[1033]}})),iu("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get($g);return function(t,i,e,s){return A7(this,void 0,void 0,(function*(){const n=new M7(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)})),iu("_executePrepareRename",(function(t,i,e){return A7(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get($g),n=new M7(i,e,s),r=yield n.resolveRenameLocation(ue.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),ah.as(za).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 T7=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 R7(t){return t&&!!t.data}function _7(t){return t&&Array.isArray(t.edits)}class I7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function P7(t,i){return t.has(i)}function N7(t,i,e,s,n){return T7(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=>T7(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&&(R7(r)||_7(r))||(r=null),new I7(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 B7{constructor(t,i){this.provider=t,this.tokens=i}}function $7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function j7(t,i,e,s){return T7(this,void 0,void 0,(function*(){const n=$7(t,i),r=yield Promise.all(n.map((t=>T7(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&R7(n)||(n=null),new B7(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}uo.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Yr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get($g),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(lo).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),uo.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Yr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get($g);if(!P7(n,s))return t.get(lo).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield N7(n,s,null,null,ue.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!R7(h))return;const c=F7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),uo.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss);const n=t.get(Yr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get($g),o=$7(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 j7(r,n,ps.lift(s),ue.None);return h?h.provider.getLegend():void 0})))),uo.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss),B(ps.isIRange(s));const n=t.get(Yr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get($g),o=yield j7(r,n,ps.lift(s),ue.None);return o&&o.tokens?F7({id:0,type:"full",data:o.tokens.data}):void 0}))));const W7="editor.semanticHighlighting";function V7(t,i,e){var s;const n=null===(s=e.getValue(W7,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var H7,z7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=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._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new q7(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()];V7(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{V7(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(W7)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};K7=z7([U7(0,zF),U7(1,Yr),U7(2,pk),U7(3,Oa),U7(4,FF),U7(5,$g)],K7);let q7=H7=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:H7.REQUEST_MIN_DELAY,max:H7.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Eu((()=>this._fetchDocumentSemanticTokensNow()),H7.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(!P7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new de,i=N7(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(_7(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&&(H7._copy(s,o-l,r,h-l,l),h-=l),c.data&&(H7._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&H7._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(R7(i)){this._currentDocumentResponse=new G7(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)}};q7.REQUEST_MIN_DELAY=300,q7.REQUEST_MAX_DELAY=2e3,q7=H7=z7([U7(1,zF),U7(2,pk),U7(3,FF),U7(4,$g)],q7);class G7{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}tH(K7);var Z7=function(t,i){return function(e,s){i(e,s,t)}};let J7=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 Eu((()=>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(W7)&&(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(!V7(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=mu((e=>Promise.resolve(j7(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}};J7.ID="editor.contrib.viewportSemanticTokens",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}([Z7(1,zF),Z7(2,pk),Z7(3,Oa),Z7(4,FF),Z7(5,$g)],J7),ru(J7.ID,J7,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 Y7,X7=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 t8{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 t8(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let i8=Y7=class{static get(t){return t.getContribution(Y7.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 X7(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||(yield s8(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 t8(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}}))}};i8.ID="editor.contrib.smartSelectController",i8=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,$g)],i8);class e8 extends Yl{constructor(t,i){super(i),this._forward=t}run(t,i){return X7(this,void 0,void 0,(function*(){const t=i8.get(i);t&&(yield t.run(this._forward))}))}}function s8(t,i,e,s,n){return X7(this,void 0,void 0,(function*(){const r=t.all(i).concat(new Q7(s.selectSubwords));1===r.length&&r.unshift(new x3);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}))}))}uo.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),ru(i8.ID,i8,4),su(class extends e8{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:J(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Expand Selection"),order:2}})}}),su(class extends e8{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:J(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Shrink Selection"),order:3}})}}),uo.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return X7(this,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e));const n=t.get($g).selectionRangeProvider,r=yield t.get(Xr).createModelReference(e);try{return s8(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ue.None)}finally{r.dispose()}}))}));const n8=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 r8{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 o8=zu("stickyScrollViewLayer",{createHTML:t=>t}),h8="data-sticky-line-index",c8="data-sticky-is-line",l8="data-sticky-is-folding-icon";class u8 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 jJ),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(),Kc(this._lineNumbersDomNode),Kc(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(Zc(this._lineNumbersDomNode,xl.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Zc(this._lineNumbersDomNode,xl.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=np.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new up(!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 ma(2e3),a=gp(l,u);let d;d=o8?o8.createHTML(u.build()):u.build();const f=document.createElement("span");f.setAttribute(h8,String(t)),f.setAttribute(c8,""),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(h8,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 a8(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 d8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(l8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=py(i.characterMapping,t,0);return new 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,h8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,c8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,l8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class a8{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 d8{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=io.asClassName(t?m4:p4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class f8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class g8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class p8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var m8,v8,w8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},b8=function(t,i){return function(e,s){i(e,s,t)}},y8=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"}(m8||(m8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(v8||(v8={}));let k8=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 bu(300)),this._updateOperation=this._register(new Vi);const n=new S8(e),r=new E8(this._editor,e),o=new D8(this._editor,i);switch(s){case m8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case m8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case m8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return y8(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((()=>y8(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 v8.CANCELED:return this._updateOperation.clear(),null;case v8.VALID:return s.stickyModel}}return null})))).catch((t=>(Ei(t),null)))}))}};k8=w8([b8(1,cd),b8(2,$g)],k8);class C8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,v8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=mu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?v8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),v8.VALID):this._invalid())).then(void 0,(t=>(Ei(t),v8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let S8=class extends C8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return V4.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 p8(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 W4){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 f8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new f8(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 g8(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 f8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new g8(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 j4?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};S8=w8([b8(0,$g)],S8);class x8 extends C8{constructor(t){super(),this._foldingLimitReporter=new M4(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new p8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new g8(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 g8(new f8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let D8=class extends x8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new a4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};D8=w8([b8(1,cd)],D8);let E8=class extends x8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return A4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=A4.getFoldingRangeProviders(this._languageFeaturesService,t);return new C4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};E8=w8([b8(1,$g)],E8);var A8=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())}))};class L8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let O8=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 Eu((()=>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 k8(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 M8(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 M8(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 L8(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}};O8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([A8(1,$g),A8(2,cd)],O8);var F8,T8=function(t,i){return function(e,s){i(e,s,t)}},R8=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 _8=F8=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 u8(this._editor),this._stickyLineCandidateProvider=new O8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new r8([],[],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(Zc(h,xl.CONTEXT_MENU,(t=>R8(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=fS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=fS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Al(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(Zc(h,xl.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(F8.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 BJ(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(Qc(s,xl.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(Qc(s,xl.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(Zc(s,xl.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)))),VQ(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=>R8(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(U6,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))))}_onContextMenu(t){const i=new jh(t);this._contextMenuService.showContextMenu({menuId:wh.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;s4(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 R8(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=A4.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 f8(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 r8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};_8.ID="store.contrib.stickyScrollController",_8=F8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([T8(1,AR),T8(2,$g),T8(3,Zr),T8(4,cd),T8(5,FF),T8(6,Zo)],_8);const I8=100;ru(_8.ID,_8,1),Dh(class extends xh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:J(0,"Toggle Sticky Scroll"),mnemonicTitle:J(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:n8.View,toggled:{condition:Mo.equals("config.editor.stickyScroll.enabled",!0),title:J(0,"Sticky Scroll"),mnemonicTitle:J(0,"&&Sticky Scroll")},menu:[{id:wh.CommandPalette},{id:wh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:wh.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(Oa),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}))}}),Dh(class extends tu{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:J(0,"Focus Sticky Scroll"),mnemonicTitle:J(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Mo.and(Mo.has("config.editor.stickyScroll.enabled"),fS.stickyScrollVisible),menu:[{id:wh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focus()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:J(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:16}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focusPrevious()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:J(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:18}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focusNext()}}),Dh(class extends tu{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:J(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:3}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.goToFocused()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectEditor",title:{value:J(0,"Select Editor"),original:"Select Editor"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:9}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.selectEditor()}});var P8,N8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},B8=function(t,i){return function(e,s){i(e,s,t)}};class $8{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 j8=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 $8(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}};j8=N8([B8(5,w3)],j8);let W8=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(z5.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"!==z5.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 E3(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=yield W5(this._languageFeatureService.completionProvider,t,i,new $5(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 A3(e.items,i.column,new E3(a,0),D3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new j8(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}}};W8=N8([B8(1,$g),B8(2,EV),B8(3,w3)],W8);let V8=P8=class{constructor(t,i,e,s){if(1==++P8._counter){const n=s.createInstance(W8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));P8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--P8._counter&&(null===(t=P8._disposable)||void 0===t||t.dispose(),P8._disposable=void 0)}};V8._counter=0,V8=P8=N8([B8(1,$g),B8(2,Qr),B8(3,Zr)],V8),ru("suggest.inlineCompletionsProvider",V8,0),su(class extends Yl{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 H8 extends xh{constructor(){super({id:H8.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=!dm.getTabFocusMode();dm.setTabFocusMode(t),em(J(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}H8.ID="editor.action.toggleTabFocusMode",Dh(H8);let z8=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=Ml(t,_l("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 tk(this.el,"click")),o=this._register(new tk(this.el,"keypress")),h=Ji.chain(o.event,(t=>t.map((t=>new Ph(t))).filter((t=>3===t.keyCode)))),c=this._register(new tk(this.el,Cm.Tap)).event;this._register(Sm.addTarget(this.el));const l=Ji.any(r.event,h,c);this._register(l((t=>{this.enabled&&(Dl(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};z8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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)],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)}};let q8=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(G8))}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)}};q8=U8([K8(1,Zr)],q8);let G8=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(XG,{}),this.element=_l("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=_l("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Kc(this.element)}show(t){Kc(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Ml(this.element,_l("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(_l(`div${io.asCSSSelector(t.icon)}`));const s=Ml(this.element,_l("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Ml(this.element,_l("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(z8,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Ml(this.element,_l("div.action-container"));this.actionBar=this._register(new cN(n)),this.actionBar.push(this._register(new so("banner.close","Close Banner",io.asClassName(XW),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};G8=U8([K8(0,Zr)],G8);var Z8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},J8=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 Y8=GW("extensions-warning-message",ys.warning,J(0,"Icon shown with a warning message in the extensions editor."));let X8=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 att};else if(t.ambiguousCharacterCount>=i)e={message:J(0,"This document contains many ambiguous unicode characters"),command:new ltt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:J(0,"This document contains many invisible unicode characters"),command:new utt}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:Y8,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(q8,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 ttt(this._editor,i,this._updateState,this._editorWorkerService):new itt(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};X8.ID="editor.contrib.unicodeHighlighter",X8=Z8([J8(1,MN),J8(2,DR),J8(3,Zr)],X8);let ttt=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 Eu((()=>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:ott.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:rtt(i.getValueInRange(t.range),this._options),inComment:UL(i,t),inString:KL(i,t)}:null}};ttt=Z8([J8(3,MN)],ttt);class itt 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 Eu((()=>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=mf.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:ott.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:rtt(e,this._options),inComment:UL(i,t),inString:KL(i,t)}:null}}let ett=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(X8.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=ntt(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,ntt(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,ntt(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:${dtt.ID}?${encodeURIComponent(JSON.stringify(u))}`,f=new H_("",!0).appendMarkdown(l).appendText(" ").appendLink(d,a);n.push(new UY(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return qY(t,i,this._editor,this._languageService,this._openerService)}};function stt(t){return`U+${t.toString(16).padStart(4,"0")}`}function ntt(t){let i=`\`${stt(t)}\``;return Cr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function rtt(t,i){return mf.computeUnicodeHighlightReason(t,i)}ett=Z8([J8(1,Pa),J8(2,AF)],ett);class ott{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}}ott.instance=new ott;class htt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class ctt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class ltt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}ltt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class utt extends Yl{constructor(){super({id:utt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}utt.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class att extends Yl{constructor(){super({id:att.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}att.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class dtt extends Yl{constructor(){super({id:dtt.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(Oa),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*(){ftt(c,[t])}))});if(l.push({label:function(t){return Cr.isInvisibleCharacter(t)?J(0,"Exclude {0} (invisible character) from being highlighted",stt(t)):J(0,"Exclude {0} from being highlighted",`${stt(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 htt;l.push({label:t.label,run:()=>Q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(n){const t=new ctt;l.push({label:t.label,run:()=>Q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}if(0===s.kind){const t=new ltt;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 utt;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 att;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 ftt(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)}))}dtt.ID="editor.action.unicodeHighlight.showExcludeOptions",su(ltt),su(utt),su(att),su(dtt),ru(X8.ID,X8,1),CY.register(ett);var gtt=function(t,i){return function(e,s){i(e,s,t)}};const ptt="ignoreUnusualLineTerminators";let mtt=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,ptt)}(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,ptt,!0)}(this._codeEditorService,t)}))}};mtt.ID="editor.contrib.unusualLineTerminatorsDetector",mtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,lF),gtt(2,Qr)],mtt),ru(mtt.ID,mtt,1);var vtt,wtt=function(t,i){return function(e,s){i(e,s,t)}};const btt=new Go("hasWordHighlights",!1);function ytt(t,i,e,s){return Su(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),a)}class ktt{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=mu((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 Ctt extends ktt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return ytt(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class Stt extends ktt{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return ku(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)}}iu("_executeDocumentHighlights",((t,i,e)=>ytt(t.get($g).documentHighlightProvider,i,e,ue.None)));class xtt{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=btt.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&&em(`${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&&em(`${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 Ctt(i,e,s,t):new Stt(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?z9:i===xs.Text?U9:G9)});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 Dtt=vtt=class extends Hi{static get(t){return t.getContribution(vtt.ID)}constructor(t,i,e){super(),this.wordHighlighter=null,this.linkedContributions=new Set;const s=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this.wordHighlighter=new xtt(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()}};Dtt.ID="editor.contrib.wordHighlighter",Dtt=vtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([wtt(1,Zo),wtt(2,$g)],Dtt);class Ett extends Yl{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=Dtt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}ru(Dtt.ID,Dtt,0),su(class extends Ett{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:J(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:btt,kbOpts:{kbExpr:fS.editorTextFocus,primary:65,weight:100}})}}),su(class extends Ett{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:J(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:btt,kbOpts:{kbExpr:fS.editorTextFocus,primary:1089,weight:100}})}}),su(class extends Yl{constructor(){super({id:"editor.action.wordHighlight.trigger",label:J(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:btt.toNegated(),kbOpts:{kbExpr:fS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=Dtt.get(i);s&&s.restoreViewState(!0)}});class Att extends Ql{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=Jd(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=>OC.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 Mtt extends Att{_move(t,i,e,s){return UC.moveWordLeft(t,i,e,s)}}class Ltt extends Att{_move(t,i,e,s){return UC.moveWordRight(t,i,e,s)}}class Ott extends Ql{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(cd);if(!i.hasModel())return;const n=Jd(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 NC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class Ftt extends Ott{_delete(t,i){return UC.deleteWordLeft(t,i)||new ps(1,1,1,1)}}class Ttt extends Ott{_delete(t,i){const e=UC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),eu(new class extends Mtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),eu(new class extends Ltt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),eu(new class extends Ltt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:fS.writable})}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:fS.writable})}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:fS.writable})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:fS.writable})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),su(class extends Yl{constructor(){super({id:"deleteInsideWord",precondition:fS.writable,label:J(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=Jd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=UC.deleteInsideWord(s,n,t);return new NC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class Rtt extends Att{_move(t,i,e,s){return KC.moveWordPartLeft(t,i,e)}}uo.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),uo.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class _tt extends Att{_move(t,i,e,s){return KC.moveWordPartRight(t,i,e)}}eu(new class extends Ott{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return KC.deleteWordPartLeft(t)||new ps(1,1,1,1)}}),eu(new class extends Ott{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=KC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}),eu(new class extends Rtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),eu(new class extends Rtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),eu(new class extends _tt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),eu(new class extends _tt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Itt extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=nZ.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())}}}Itt.ID="editor.contrib.readOnlyMessageController",ru(Itt.ID,Itt,2);class Ptt 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 Ntt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Ptt.ID="editor.contrib.iPadShowKeyboard";class Ntt extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Zc(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Zc(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Ntt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Ntt.ID="editor.contrib.ShowKeyboardWidget",ru(Ptt.ID,Ptt,3);var Btt,$tt=function(t,i){return function(e,s){i(e,s,t)}};let jtt=Btt=class extends Hi{static get(t){return t.getContribution(Btt.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 Wtt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};jtt.ID="editor.contrib.inspectTokens",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(1,aV),$tt(2,Pa)],jtt);class Wtt 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:()=>Yg,tokenize:(t,e,s)=>Xg(i,s),tokenizeEncoded:(t,i,e)=>tp(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 Wtt._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)),Ol(this._domNode,_l("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),_l("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Ml(this._domNode,_l("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Ml(this._domNode,_l("table.tm-metadata-table",void 0,_l("tbody",void 0,_l("tr",void 0,_l("td.tm-metadata-key",void 0,"language"),_l("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"token type"),_l("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"font style"),_l("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"foreground"),_l("td.tm-metadata-value",void 0,`${o?Eg.Format.CSS.formatHex(o.foreground):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"background"),_l("td.tm-metadata-value",void 0,`${o?Eg.Format.CSS.formatHex(o.background):"-?-"}`))))),Ml(this._domNode,_l("hr.tokens-inspect-separator")),e<i.tokens1.length&&Ml(this._domNode,_l("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ns.getColorMap(),e=ip.getLanguageId(t),s=ip.getTokenType(t),n=ip.getFontStyle(t),r=ip.getForeground(t),o=ip.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]}}}Wtt._ID="editor.contrib.inspectTokensWidget",ru(jtt.ID,jtt,4),su(class extends Yl{constructor(){super({id:"editor.action.inspectTokens",label:vR.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=jtt.get(i);null==e||e.launch()}});var Vtt,Htt=function(t,i){return function(e,s){i(e,s,t)}};let ztt=Vtt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=ah.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(Vtt.PREFIX.length));i&&i.prefix&&i.prefix!==Vtt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Vtt.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}}))}};ztt.PREFIX="?",ztt=Vtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Htt(0,Ij),Htt(1,kC)],ztt),ah.as(Fj).registerQuickAccessProvider({ctor:ztt,prefix:"",helpEntries:[{description:bR.helpQuickAccessActionLabel}]});class Utt{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=dK(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&&sm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return aK(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:mk(Gk),position:Qd.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 Ktt extends Utt{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(Ktt.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=dK(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}}Ktt.PREFIX=":";let qtt=class extends Ktt{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}};qtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Qr)],qtt);class Gtt extends Yl{constructor(){super({id:Gtt.ID,label:wR.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Ij).quickAccess.show(qtt.PREFIX)}}Gtt.ID="editor.action.gotoLine",su(Gtt),ah.as(Fj).registerQuickAccessProvider({ctor:qtt,prefix:qtt.PREFIX,helpEntries:[{description:wR.gotoLineActionLabel,commandId:Gtt.ID}]});const Ztt=[void 0,[]];function Jtt(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 Ztt;n+=i,r.push(...h)}return[n,Ytt(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)]:Ztt}function Ytt(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 Xtt(t){return t.startsWith('"')&&t.endsWith('"')}Object.freeze({score:0});const tit=" ";function iit(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=eit(t),r=e.indexOf(Je)>=0,o=Xtt(t);let h;const c=t.split(tit);if(c.length>1)for(const t of c){const i=Xtt(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=eit(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 eit(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 sit(t){return Array.isArray(t)?iit(t.map((t=>t.original)).join(tit)):iit(t.original)}var nit,rit=function(t,i){return function(e,s){i(e,s,t)}},oit=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 hit=nit=class extends Utt{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.")),(()=>{oit(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 oit(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new Lu,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=>oit(this,void 0,void 0,(function*(){null==c||c.dispose(!0),e.busy=!1,c=new de(s),e.busy=!0;try{const i=iit(e.value.substr(nit.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=Sf(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 oit(this,void 0,void 0,(function*(){const o=yield t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(nit.SCOPE_PREFIX),c=h?1:0;let l,u,a;i.values&&i.values.length>1?(l=sit(i.values[0]),u=sit(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:io.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]=Jtt(k,Object.assign(Object.assign({},i),{values:void 0}),c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=Jtt(k,l,c,C),"number"!=typeof S))continue;if(!L&&u){if(A&&u.original.length>0&&([D,E]=Jtt(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(lit[O]||cit,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=(lit[t.kind]||cit).localeCompare(lit[i.kind]||cit);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return oit(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};hit.PREFIX="@",hit.SCOPE_PREFIX=":",hit.PREFIX_BY_CATEGORY=`${nit.PREFIX}${nit.SCOPE_PREFIX}`,hit=nit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([rit(0,$g),rit(1,H4)],hit);const cit=J(0,"properties ({0})"),lit={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 uit=function(t,i){return function(e,s){i(e,s,t)}};let ait=class extends hit{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}};ait=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([uit(0,Qr),uit(1,$g),uit(2,H4)],ait);class dit extends Yl{constructor(){super({id:dit.ID,label:kR.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:fS.hasDocumentSymbolProvider,kbOpts:{kbExpr:fS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Ij).quickAccess.show(hit.PREFIX,{itemActivation:_j.NONE})}}function fit(t,i){return i&&(t.stack||t.stacktrace)?J(0,"{0}: {1}",pit(t),git(t.stack)||git(t.stacktrace)):pit(t)}function git(t){return Array.isArray(t)?t.join("\n"):t}function pit(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 mit(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=mit(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 fit(e.error,i);if(e.exception)return fit(e.exception,i)}return t.stack?fit(t,i):t.message?t.message:J(0,"An unknown error occurred. Please consult the log for more details.")}dit.ID="editor.action.quickOutline",su(dit),ah.as(Fj).registerQuickAccessProvider({ctor:ait,prefix:hit.PREFIX,helpEntries:[{description:kR.quickOutlineActionLabel,prefix:hit.PREFIX,commandId:dit.ID},{description:kR.quickOutlineByCategoryActionLabel,prefix:hit.PREFIX_BY_CATEGORY}]});class vit{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}(vit.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=vit.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=vit.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 wit,bit=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 yit(t){return Array.isArray(t.items)}function kit(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"}(wit||(wit={}));class Cit 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=()=>bit(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(yit(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=>bit(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>bit(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield ku(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})))(),(()=>bit(this,void 0,void 0,(function*(){t.busy=!0;try{const s=yield i.additionalPicks;if(n.isCancellationRequested)return;let r,o,h,c;if(yit(i.picks)?(r=i.picks.items,o=i.picks.active):r=i.picks,yit(s)?(h=s.items,c=s.active):h=s,h.length>0||!e){let i;if(!o&&!c){const e=t.activeItems[0];e&&-1!==r.indexOf(e)&&(i=e)}l({items:[...r,...h],active:o||c||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(kit(c))yield u(c);else if(c instanceof Promise){t.busy=!0;try{const t=yield c;if(n.isCancellationRequested)return;kit(t)?yield u(t):l(t)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)}));return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((({button:e,item:s})=>bit(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 wit.NO_ACTION:break;case wit.CLOSE_PICKER:t.hide();break;case wit.REFRESH_PICKER:h();break;case wit.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 Sit,xit,Dit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=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=Sit=class extends Cit{constructor(t,i,e,s,n,r){super(Sit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Lit)),this.options=t}_getPicks(t,i,e,s){var n,r,o,h;return Ait(this,void 0,void 0,(function*(){const i=yield this.getCommandPicks(e);if(e.isCancellationRequested)return[];const c=Ni((()=>{const s=new vit;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>Sit.TFIDF_THRESHOLD)).slice(0,Sit.TFIDF_MAX_RESULTS)})),l=[];for(const s of i){const i=null!==(n=Sit.WORD_FILTER(t,s.label))&&void 0!==n?n:void 0,o=s.commandAlias&&null!==(r=Sit.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:(()=>Ait(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:()=>Ait(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),mit(i))}}))})}};Mit.PREFIX=">",Mit.TFIDF_THRESHOLD=.5,Mit.TFIDF_MAX_RESULTS=5,Mit.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),Mit=Sit=Dit([Eit(1,Zr),Eit(2,kC),Eit(3,lo),Eit(4,Eh),Eit(5,lF)],Mit);let Lit=xit=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=xit.getConfiguredCommandHistoryLength(this.configurationService),xit.cache&&xit.cache.limit!==this.configuredCommandsHistoryLength&&(xit.cache.limit=this.configuredCommandsHistoryLength,xit.saveState(this.storageService)))}load(){const t=this.storageService.get(xit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=xit.cache=new hg(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)))}xit.counter=this.storageService.getNumber(xit.PREF_KEY_COUNTER,0,xit.counter)}push(t){xit.cache&&(xit.cache.set(t,xit.counter++),xit.saveState(this.storageService))}peek(t){var i;return null===(i=xit.cache)||void 0===i?void 0:i.peek(t)}static saveState(t){if(!xit.cache)return;const i={usesLRU:!0,entries:[]};xit.cache.forEach(((t,e)=>i.entries.push({key:e,value:t}))),t.store(xit.PREF_KEY_CACHE,JSON.stringify(i),0,0),t.store(xit.PREF_KEY_COUNTER,xit.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:xit.DEFAULT_COMMANDS_HISTORY_LENGTH}};Lit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Lit.PREF_KEY_CACHE="commandPalette.mru.cache",Lit.PREF_KEY_COUNTER="commandPalette.mru.counter",Lit.counter=1,Lit=xit=Dit([Eit(0,PP),Eit(1,Oa)],Lit);class Oit extends Mit{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 Fit=function(t,i){return function(e,s){i(e,s,t)}},Tit=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 Rit=class extends Oit{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 Tit(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return Tit(this,void 0,void 0,(function*(){return[]}))}};Rit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Fit(0,Zr),Fit(1,Qr),Fit(2,kC),Fit(3,lo),Fit(4,Eh),Fit(5,lF)],Rit);class _it extends Yl{constructor(){super({id:_it.ID,label:yR.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Ij).quickAccess.show(Rit.PREFIX)}}_it.ID="editor.action.quickCommand",su(_it),ah.as(Fj).registerQuickAccessProvider({ctor:Rit,prefix:Rit.PREFIX,helpEntries:[{description:yR.quickCommandHelp,commandId:_it.ID}]});var Iit=function(t,i){return function(e,s){i(e,s,t)}};let Pit=class extends TQ{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Pit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Iit(1,Zo),Iit(2,Qr),Iit(3,vO),Iit(4,Zr),Iit(5,PP),Iit(6,Oa)],Pit),ru(TQ.ID,Pit,4),su(class extends Yl{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();ry(s.type)?(e.setTheme(this._originalThemeName||(oy(s.type)?eV:iV)),this._originalThemeName=null):(e.setTheme(oy(s.type)?sV:nV),this._originalThemeName=s.themeName)}});var Nit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Bit(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=Bit((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 jit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Wit(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Vit(){return jit?Wit("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Hit(){return jit?Wit("esri/request"):(await import("@arcgis/core/request.js")).default}async function zit(t){return new(await async function(){return jit?Wit("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function Uit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Kit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function qit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function Git(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 Jit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Qit(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function Yit(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function Xit(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var tet=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function iet(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 eet(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)iet(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function set(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 net(t){let i=set(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function ret(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(ret(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(ret(e.children[t],i))return!0;return!1}function oet(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void ret(t,i);let e=new MutationObserver((()=>{e.disconnect(),ret(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function het(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function cet(){return[het(2),het(1),het(1),het(1),het(3)].join("-")}var uet=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"]),aet=new Map;async function det(t,i,e=""){let s=`${i}/${e}${t}.json`;if(aet.has(s))return aet.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return aet.set(s,t),t}if("en"===t)return void aet.set(s,void 0);let r=await det("en",i,e);return aet.set(s,r),r}catch{return void aet.set(s,void 0)}}var fet=new WeakMap,get=new WeakMap,pet=new WeakMap;async function met(t,i,e){get.set(t,i),fet.set(t,eet(t._hostElement,["lang"],(()=>{wet(t,e)}))),await wet(t,e)}function vet(t){fet.get(t)?.disconnect(),fet.delete(t),get.delete(t)}async function wet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return set(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(uet.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:uet.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=pet.get(t);if(!n){let i=get.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await det(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function bet(t,i){return new Array(i+1).join(t)}function yet(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+bet(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+bet("\\"+i,n.length))),i+t+i}function ket(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function Cet(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function xet(t){return""+(t??"")+""}function Det(t){return null!==t}function Eet(t){return void 0!==t}function Aet(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 Met(t){try{return new URL(t),!0}catch{return!1}}function Let(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=ket(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 Oet(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 Fet(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 Tet(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 Ret(t){return!!t?.typeIdField}function _et(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Ret(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 Iet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new zet({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new qet(t,e,s)}const Pet=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function Net(t,i=!0){return t.match(Pet)?`${i?".":""}${t}`:`["${t}"]`}function Bet(t,i){return t?`${t}${Net(i)}`:i}async function $et(t){if(!t)return null;let i=null;if(Uit(t)||Kit(t)||Qit(t))i=t;else if(i=await zit(t),!qit(i))return console.error("Invalid FeatureSetDefinition",t),null;return i?(e=i,"function"==typeof e?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null);var e}function jet(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 Wet(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 Wet(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 Fet(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=Net(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 Vet{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?xet(this._label):Cet(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:Cet(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Het extends Vet{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 zet extends Het{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?Tet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class Uet extends Het{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?Tet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Ket extends Het{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 qet extends Vet{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class Get extends Ket{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new qet(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=Bet(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new zet({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new Jet({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new Qet({profile:this._profile,declaration:t,label:i,snippet:i},[new zet({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new Yet({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new Get({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new Uet({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 Ket{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 Det(this._loadPromise)&&Eet(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Bet(this.snippet,t.name):t.name;return new zet({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Oet(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if(i=this._source,"function"!=typeof i?.getFieldDomain)return null;var i;const e="feature"===this.type?Bet(this.snippet,t.name):t.name,s=new Get({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:"form-dropdown"}),n=new qet(this._profile,t.alias??t.name,[new zet({profile:this._profile,label:e,description:"",snippet:e})]);if(s.variables=[n],Ret(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Iet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new zet({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new qet(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return s.variables.push(i),s}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;n.variables.push(new zet({profile:this._profile,label:i,description:"",snippet:i}))}if(Ret(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=Iet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new Get({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new qet(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(s.variables.push(i),s):null}const r=Iet(this._profile,this._source.getFieldDomain?.(t.name),{code:"domainvalues"});return r?(s.variables.push(r),s):null}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;const t=this._source;if(i=t,!Array.isArray(i?.relationships)||"string"!=typeof i?.url)return null;var i;const e=new qet(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 qit(s)?s:null}(t,i);if(!qit(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new Qet({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new zet({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(Det),e.variables.length?e:null}}class Jet extends Zet{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return Uit(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 i=Uit(this._source)?this._source.title:"";this.variables.push(new qet(this._profile,i,[new zet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const e=new qet(this._profile,{code:"values"});if(this.variables.push(e),t=this._source,"boolean"==typeof t?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,i=new zet({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});e.variables.push(i)}this._source.fields.sort(_et(this._source)).forEach((t=>{e.variables.push(this._getFieldProperty(t))}));const s=await this._getRelationshipsProperty();s&&this.variables.push(s)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}var t;return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Qet extends Zet{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return Uit(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 qet(this._profile,this.title,this.featureSetSnippets));const t=new qet(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(_et(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 Yet extends Ket{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 Det(this._loadPromise)&&Eet(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 qet(this._profile,t,[new zet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new qet(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new qet(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?Git(this._definition)?this._featureSetCollectionFromWebMap(this._definition):Uit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):Zit(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):Yit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=Git(t)?t:await async function(t){return new(await async function(){return jit?Wit("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 jit?Wit("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 Hit(),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:jet(s.layers,n),tables:jet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await zit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await zit({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(qit(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 Qet({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 zet({profile:this._profile,label:i,description:"",snippet:i}),new zet({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new zet({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Xet extends Get{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 Wet(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function tst(t){return qit(t)||Kit(t)||Yit(t)||Qit(t)||Jit(t)}async function ist(i="en"){const e=est.get(i);if(e)return e;if(!uet.has(i))return ist("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)})),est.set(t,e),e}(i,await e.json()):"en"===i?null:ist("en")}catch(t){return null}}const est=new Map;function sst(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(sst):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function nst(t,i="en"){if(!Xit(t))return;const e=await async function(t,i="en"){const e=await ist(i);return e?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};var n;return e.variables.forEach((i=>{if(t.disabledVariables?.includes(i.name))return;const e=t.definitions[i.name];switch(i.type){case"dictionary":return s.variables.push(sst({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return Uit(n=e)||Kit(n)||Yit(n)||Qit(n)||Jit(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return tst(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)||Git(t)||tst(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(sst(i))}var n})),n=t,Array.isArray(n?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const rst={locale:"en"},ost=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new AK,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new AK,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 PK.isUri(t)||(t=PK.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){Xit(e)&&(e=await nst(e,s.locale));const n=await det(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 Xet(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))??rst}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))}},hst={setProfileForModel:ost.setProfileForModel.bind(ost)};export{ket as B,AK as E,met as F,Cet as H,aV as I,MK as K,_K as M,oet as O,net as P,FK as R,kH as S,eet as T,PK as U,Aet as V,Met as X,hst as a,Nit as b,Bit as c,ost as d,BK as e,vet as f,jW as g,Let as h,Hit as i,Vit as j,cet as k,$K as l,LK as m,WK as n,$it as o,tet as p,xet as q,Fet as s,Zq as t,yet as z}
|
|
62
|
+
var Pq=Object.defineProperty,Nq=Object.getOwnPropertyDescriptor,Bq=Object.getOwnPropertyNames,$q=Object.prototype.hasOwnProperty,jq=(t,i,e,s)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let n of Bq(i))$q.call(t,n)||n===e||Pq(t,n,{get:()=>i[n],enumerable:!(s=Nq(i,n))||s.enumerable});return t},Wq={};((t,i)=>{jq(Wq,i,"default")})(0,WK);var Vq=(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))(Vq||{}),Hq=(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))(Hq||{}),zq=(t=>(t[t.CarriageReturnLineFeed=0]="CarriageReturnLineFeed",t[t.LineFeed=1]="LineFeed",t))(zq||{}),Uq=(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))(Uq||{}),Kq=(t=>(t[t.Classic=1]="Classic",t[t.NodeJs=2]="NodeJs",t))(Kq||{}),qq=class{_onDidChange=new Wq.Emitter;_onDidExtraLibsChange=new Wq.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)}},Gq={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},Zq=new qq({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},Gq),Jq=new qq({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},Gq);function Qq(){return import("./p-49b81305.js")}Wq.languages.typescript={ModuleKind:Vq,JsxEmit:Hq,NewLineKind:zq,ScriptTarget:Uq,ModuleResolutionKind:Kq,typescriptVersion:"5.0.2",typescriptDefaults:Zq,javascriptDefaults:Jq,getTypeScriptWorker:()=>Qq().then((t=>t.getTypeScriptWorker())),getJavaScriptWorker:()=>Qq().then((t=>t.getJavaScriptWorker()))},Wq.languages.onLanguage("typescript",(()=>Qq().then((t=>t.setupTypeScript(Zq))))),Wq.languages.onLanguage("javascript",(()=>Qq().then((t=>t.setupJavaScript(Jq))))),Dh(class extends xh{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:{value:J(0,"Toggle Collapse Unchanged Regions"),original:"Toggle Collapse Unchanged Regions"},icon:ys.map,toggled:Mo.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:Mo.has("isInDiffEditor"),menu:{when:Mo.has("isInDiffEditor"),id:wh.EditorTitle,order:22,group:"navigation"}})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.hideUnchangedRegions.enabled");e.updateValue("diffEditor.hideUnchangedRegions.enabled",s)}});class Yq extends xh{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:{value:J(0,"Toggle Show Moved Code Blocks"),original:"Toggle Show Moved Code Blocks"},precondition:Mo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.experimental.showMoves");e.updateValue("diffEditor.experimental.showMoves",s)}}Dh(Yq);class Xq extends xh{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:Mo.has("isInDiffEditor")})}run(t,...i){const e=t.get(Oa),s=!e.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");e.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",s)}}Dh(Xq),kh.appendMenuItem(wh.EditorTitle,{command:{id:(new Xq).desc.id,title:J(0,"Use Inline View When Space Is Limited"),toggled:Mo.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:Mo.has("isInDiffEditor")},order:11,group:"1_diff",when:Mo.and(fS.diffEditorRenderSideBySideInlineBreakpointReached,Mo.has("isInDiffEditor"))}),kh.appendMenuItem(wh.EditorTitle,{command:{id:(new Yq).desc.id,title:J(0,"Show Moved Code Blocks"),icon:ys.move,toggled:Ro.create("config.diffEditor.experimental.showMoves",!0),precondition:Mo.has("isInDiffEditor")},order:10,group:"1_diff",when:Mo.has("isInDiffEditor")});const tG={value:J(0,"Diff Editor"),original:"Diff Editor"};Dh(class extends tu{constructor(){super({id:"diffEditor.switchSide",title:{value:J(0,"Switch Side"),original:"Switch Side"},icon:ys.arrowSwap,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,e){const s=nG(t);if(s instanceof FU){if(e&&e.dryRun)return{destinationSelection:s.mapToOtherSide().destinationSelection};s.switchSide()}}}),Dh(class extends tu{constructor(){super({id:"diffEditor.exitCompareMove",title:{value:J(0,"Exit Compare Move"),original:"Exit Compare Move"},icon:ys.close,precondition:fS.comparingMovedCode,f1:!1,category:tG,keybinding:{weight:1e4,primary:9}})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.exitCompareMove()}}),Dh(class extends tu{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:{value:J(0,"Collapse All Unchanged Regions"),original:"Collapse All Unchanged Regions"},icon:ys.fold,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.collapseAllUnchangedRegions()}}),Dh(class extends tu{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:{value:J(0,"Show All Unchanged Regions"),original:"Show All Unchanged Regions"},icon:ys.unfold,precondition:Mo.has("isInDiffEditor"),f1:!0,category:tG})}runEditorCommand(t,i,...e){const s=nG(t);s instanceof FU&&s.showAllUnchangedRegions()}});const iG={value:J(0,"Accessible Diff Viewer"),original:"Accessible Diff Viewer"};class eG extends xh{constructor(){super({id:eG.id,title:{value:J(0,"Go to Next Difference"),original:"Go to Next Difference"},category:iG,precondition:Mo.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(t){const i=nG(t);null==i||i.accessibleDiffViewerNext()}}eG.id="editor.action.accessibleDiffViewer.next",kh.appendMenuItem(wh.EditorTitle,{command:{id:eG.id,title:J(0,"Open Accessible Diff Viewer"),precondition:Mo.has("isInDiffEditor")},order:10,group:"2_diff",when:Mo.and(fS.accessibleDiffViewerVisible.negate(),Mo.has("isInDiffEditor"))});class sG extends xh{constructor(){super({id:sG.id,title:{value:J(0,"Go to Previous Difference"),original:"Go to Previous Difference"},category:iG,precondition:Mo.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(t){const i=nG(t);null==i||i.accessibleDiffViewerPrev()}}function nG(t){var i;const e=t.get(Qr),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=ml();if(r)for(const t of s)if(rG(t.getContainerDomNode(),r))return t;return null}function rG(t,i){let e=i;for(;e;){if(e===t)return!0;e=e.parentElement}return!1}sG.id="editor.action.accessibleDiffViewer.prev",uo.registerCommandAlias("editor.action.diffReview.next",eG.id),Dh(eG),uo.registerCommandAlias("editor.action.diffReview.prev",sG.id),Dh(sG);var oG,hG=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 cG=new Go("selectionAnchorSet",!1);let lG=oG=class{static get(t){return t.getContribution(oG.ID)}constructor(t,i){this.editor=t,this.selectionAnchorSetContextKey=cG.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),em(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()}};lG.ID="editor.contrib.selectionAnchorController",lG=oG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Zo)],lG),ru(lG.ID,lG,4),su(class extends Yl{constructor(){super({id:"editor.action.setSelectionAnchor",label:J(0,"Set Selection Anchor"),alias:"Set Selection Anchor",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2080),weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.setSelectionAnchor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.goToSelectionAnchor",label:J(0,"Go to Selection Anchor"),alias:"Go to Selection Anchor",precondition:cG})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.goToSelectionAnchor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:J(0,"Select from Anchor to Cursor"),alias:"Select from Anchor to Cursor",precondition:cG,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2089),weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.selectFromAnchorToCursor()}))}}),su(class extends Yl{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:J(0,"Cancel Selection Anchor"),alias:"Cancel Selection Anchor",precondition:cG,kbOpts:{kbExpr:fS.editorTextFocus,primary:9,weight:100}})}run(t,i){var e;return hG(this,void 0,void 0,(function*(){null===(e=lG.get(i))||void 0===e||e.cancelSelectionAnchor()}))}});const uG=Lm("editorOverviewRuler.bracketMatchForeground",{dark:"#A0A0A0",light:"#A0A0A0",hcDark:"#A0A0A0",hcLight:"#A0A0A0"},J(0,"Overview ruler marker color for matching brackets."));class aG{constructor(t,i,e){this.position=t,this.brackets=i,this.options=e}}class dG extends Hi{static get(t){return t.getContribution(dG.ID)}constructor(t){super(),this._editor=t,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Eu((()=>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=dG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;t||"always"!==this._matchBrackets||(t=i.bracketPairs.findEnclosingBrackets(e,20),s=dG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),o[h++]=new aG(e,t,s)}}this._lastBracketsData=o,this._lastVersionId=e}}dG.ID="editor.contrib.bracketMatchingController",dG._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=$M.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:mk(uG),position:Qd.Center}}),dG._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=$M.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"}),ru(dG.ID,dG,1),su(class extends Yl{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=dG.get(i))||void 0===s||s.selectToBracket(n)}}),su(class extends Yl{constructor(){super({id:"editor.action.jumpToBracket",label:J(0,"Go to Bracket"),alias:"Go to Bracket",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:3165,weight:100}})}run(t,i){var e;null===(e=dG.get(i))||void 0===e||e.jumpToBracket()}}),su(class extends Yl{constructor(){super({id:"editor.action.removeBrackets",label:J(0,"Remove Brackets"),alias:"Remove Brackets",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2561,weight:100}})}run(t,i){var e;null===(e=dG.get(i))||void 0===e||e.removeBrackets(this.id)}}),kh.appendMenuItem(wh.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:J(0,"Go to &&Bracket")},order:2});class fG{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 gG extends Yl{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 fG(t,this.left));i.pushUndoStop(),i.executeCommands(this.id,e),i.pushUndoStop()}}su(class extends gG{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:J(0,"Move Selected Text Left"),alias:"Move Selected Text Left",precondition:fS.writable})}}),su(class extends gG{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:J(0,"Move Selected Text Right"),alias:"Move Selected Text Right",precondition:fS.writable})}}),su(class extends Yl{constructor(){super({id:"editor.action.transposeLetters",label:J(0,"Transpose Letters"),alias:"Transpose Letters",precondition:fS.writable,kbOpts:{kbExpr:fS.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():HC.rightPosition(e,t.getPosition().lineNumber,t.getPosition().column),h=HC.leftPosition(e,o),c=HC.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 NC(a,u+l))}s.length>0&&(i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop())}});const pG="9_cutcopypaste",mG=pt||document.queryCommandSupported("cut"),vG=pt||document.queryCommandSupported("copy"),wG=void 0!==navigator.clipboard&&!Lr||document.queryCommandSupported("paste");function bG(t){return t.register(),t}const yG=mG?bG(new Zl({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:pt?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"Cu&&t"),order:1},{menuId:wh.EditorContext,group:pG,title:J(0,"Cut"),when:fS.writable,order:1},{menuId:wh.CommandPalette,group:"",title:J(0,"Cut"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Cut"),when:fS.writable,order:1}]})):void 0,kG=vG?bG(new Zl({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:pt?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Copy"),order:2},{menuId:wh.EditorContext,group:pG,title:J(0,"Copy"),order:2},{menuId:wh.CommandPalette,group:"",title:J(0,"Copy"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Copy"),order:2}]})):void 0;kh.appendMenuItem(wh.MenubarEditMenu,{submenu:wh.MenubarCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:"2_ccp",order:3}),kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextCopy,title:{value:J(0,"Copy As"),original:"Copy As"},group:pG,order:3}),kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1,when:Mo.and(Mo.notEquals("resourceScheme","output"),fS.editorTextFocus)}),kh.appendMenuItem(wh.EditorTitleContext,{submenu:wh.EditorTitleContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1}),kh.appendMenuItem(wh.ExplorerContext,{submenu:wh.ExplorerContextShare,title:{value:J(0,"Share"),original:"Share"},group:"11_share",order:-1});const CG=wG?bG(new Zl({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:wh.MenubarEditMenu,group:"2_ccp",title:J(0,"&&Paste"),order:4},{menuId:wh.EditorContext,group:pG,title:J(0,"Paste"),when:fS.writable,order:4},{menuId:wh.CommandPalette,group:"",title:J(0,"Paste"),order:1},{menuId:wh.SimpleEditorContext,group:pG,title:J(0,"Paste"),when:fS.writable,order:4}]})):void 0;function SG(t,i){t&&(t.addImplementation(1e4,"code-editor",(t=>{const e=t.get(Qr).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",(()=>(vl().execCommand(i),!0))))}SG(yG,"cut"),SG(kG,"copy"),CG&&(CG.addImplementation(1e4,"code-editor",(t=>{const i=t.get(Qr),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=ok.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})}})))})),CG.addImplementation(0,"generic-dom",(()=>(vl().execCommand("paste"),!0)))),vG&&su(class extends Yl{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:J(0,"Copy With Syntax Highlighting"),alias:"Copy With Syntax Highlighting",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,weight:100}})}run(t,i){i.hasModel()&&(!i.getOption(37)&&i.getSelection().isEmpty()||(rk.forceCopyWithSyntaxHighlighting=!0,i.focus(),i.getContainerDomNode().ownerDocument.execCommand("copy"),rk.forceCopyWithSyntaxHighlighting=!1))}});var xG;class DG{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+DG.sep)}intersects(t){return this.contains(t)||t.contains(this)}append(t){return new DG(this.value+DG.sep+t)}}function EG(t,i,e){return!(!i.contains(t)||e&&i.contains(e))}DG.sep=".",DG.None=new DG("@@none@@"),DG.Empty=new DG(""),DG.QuickFix=new DG("quickfix"),DG.Refactor=new DG("refactor"),DG.RefactorExtract=DG.Refactor.append("extract"),DG.RefactorInline=DG.Refactor.append("inline"),DG.RefactorMove=DG.Refactor.append("move"),DG.RefactorRewrite=DG.Refactor.append("rewrite"),DG.Notebook=new DG("notebook"),DG.Source=new DG("source"),DG.SourceOrganizeImports=DG.Source.append("organizeImports"),DG.SourceFixAll=DG.Source.append("fixAll"),DG.SurroundWith=DG.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"}(xG||(xG={}));class AG{static fromUser(t,i){return t&&"object"==typeof t?new AG(AG.getKindFromUser(t,i.kind),AG.getApplyFromUser(t,i.apply),AG.getPreferredUser(t)):new AG(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 DG(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 MG{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 LG=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 OG="editor.action.codeAction",FG="editor.action.quickFix",TG="editor.action.autoFix",RG="editor.action.refactor",_G="editor.action.sourceAction",IG="editor.action.organizeImports",PG="editor.action.fixAll";class NG 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)?NG.codeActionsPreferredComparator(t,i):-1:a(i.diagnostics)?1:NG.codeActionsPreferredComparator(t,i)}constructor(t,i,e){super(),this.documentation=i,this._register(e),this.allActions=[...t].sort(NG.codeActionsComparator),this.validActions=this.allActions.filter((({action:t})=>!t.disabled))}get hasAutoFix(){return this.validActions.some((({action:t})=>!!t.kind&&DG.QuickFix.contains(new DG(t.kind))&&!!t.isPreferred))}}const BG={actions:[],documentation:void 0};function $G(t,i,s,n,r,o){var h;return LG(this,void 0,void 0,(function*(){const l=n.filter||{},u=Object.assign(Object.assign({},l),{excludes:[...l.excludes||[],DG.Notebook]}),a={only:null===(h=l.include)||void 0===h?void 0:h.value,trigger:n.type},d=new lK(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=>EG(i,e,t.include)))||!t.includeSourceActions&&DG.Source.contains(i))}(e,new DG(t))))))}(t,i,2===n.type?u:l),g=new Vi,p=f.map((t=>LG(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 BG;const n=((null==e?void 0:e.actions)||[]).filter((t=>t&&function(t,i){const e=i.kind?new DG(i.kind):void 0;return!(!(!t.include||e&&t.include.contains(e))||t.excludes&&e&&t.excludes.some((i=>EG(e,i,t.include)))||!t.includeSourceActions&&e&&DG.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 DG(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 DG(t.kind)))return i.command}(t,n,l.include);return{actions:n.map((i=>new MG(i,t))),documentation:o}}catch(t){if(Oi(t))throw t;return Ai(t),BG}})))),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))),...jG(t,i,n,s)];return new NG(s,r,g)}finally{m.dispose(),d.dispose()}}))}function*jG(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 WG;function VG(t,i,e,s,n=ue.None){var r;return LG(this,void 0,void 0,(function*(){const o=t.get(kT),h=t.get(lo),c=t.get(Eh),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!==WG.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"}(WG||(WG={})),uo.registerCommand("_executeCodeActionProvider",(function(t,i,e,s,n){return LG(this,void 0,void 0,(function*(){if(!(i instanceof ss))throw Ti();const{codeActionProvider:r}=t.get($g),o=t.get(Yr).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 DG(s):void 0,l=yield $G(r,o,h,{type:1,triggerAction:xG.Default,filter:{includeSourceActions:!0,include:c}},nR.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 HG;let zG=HG=class{constructor(t){this.keybindingService=t}getResolver(){const t=new Mn((()=>this.keybindingService.getKeybindings().filter((t=>HG.codeActionCommands.indexOf(t.command)>=0)).filter((t=>t.resolvedKeybinding)).map((t=>{let i=t.commandArgs;return t.command===IG?i={kind:DG.SourceOrganizeImports.value}:t.command===PG&&(i={kind:DG.SourceFixAll.value}),Object.assign({resolvedKeybinding:t.resolvedKeybinding},AG.fromUser(i,{kind:DG.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 DG(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)}};zG.codeActionCommands=[RG,OG,_G,IG,PG],zG=HG=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,kC)],zG),Lm("symbolIcon.arrayForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.booleanForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("symbolIcon.colorForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.constantForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("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.")),Lm("symbolIcon.fileForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.folderForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("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.")),Lm("symbolIcon.keyForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.keywordForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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.")),Lm("symbolIcon.moduleForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.namespaceForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.nullForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.numberForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.objectForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.operatorForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.packageForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.propertyForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.referenceForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.snippetForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.stringForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.structForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.textForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.typeParameterForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("symbolIcon.unitForeground",{dark:Om,light:Om,hcDark:Om,hcLight:Om},J(0,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),Lm("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 UG=Object.freeze({kind:DG.Empty,title:J(0,"More Actions...")}),KG=Object.freeze([{kind:DG.QuickFix,title:J(0,"Quick Fix")},{kind:DG.RefactorExtract,title:J(0,"Extract"),icon:ys.wrench},{kind:DG.RefactorInline,title:J(0,"Inline"),icon:ys.wrench},{kind:DG.RefactorRewrite,title:J(0,"Rewrite"),icon:ys.wrench},{kind:DG.RefactorMove,title:J(0,"Move"),icon:ys.wrench},{kind:DG.SurroundWith,title:J(0,"Surround With"),icon:ys.symbolSnippet},{kind:DG.Source,title:J(0,"Source Action"),icon:ys.symbolFile},UG]);var qG,GG;!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}}}(GG||(GG={}));let ZG=qG=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=GG.Hidden,this._domNode=_l("div.lightBulbWidget"),this._register(Sm.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 Zc(t,wt&&Rh?xl.POINTER_DOWN:xl.MOUSE_DOWN,i,e)}(this._domNode,Jc((t=>{if(1!==this.state.type)return;this._editor.focus(),t.preventDefault();const{top:i,height:e}=ol(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(Zc(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(TG))||void 0===t?void 0:t.getLabel())&&void 0!==e?e:void 0,this._quickFixKbLabel=null!==(n=null===(s=i.lookupKeybinding(FG))||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=qS(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 GG.Showing(t,i,e,{position:{lineNumber:a,column:1},preference:qG._posPref}),this._editor.layoutContentWidget(this)}hide(){this.state!==GG.Hidden&&(this.state=GG.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(...io.asClassNameArray(ys.lightBulb)),this._domNode.classList.add(...io.asClassNameArray(ys.lightbulbAutofix)),this._preferredKbLabel)?this.title=J(0,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):(this._domNode.classList.remove(...io.asClassNameArray(ys.lightbulbAutofix)),this._domNode.classList.add(...io.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}};ZG.ID="editor.contrib.lightbulbWidget",ZG._posPref=[0],ZG=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,kC)],ZG);var JG,QG=function(t,i){return function(e,s){i(e,s,t)}},YG=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 XG=JG=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)=>YG(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=td);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=JG._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=>tZ(this._openerService,i,t.isTrusted),disposables:i}}}};function tZ(t,i,e){return YG(this,void 0,void 0,(function*(){try{return yield t.open(i,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:iZ(e)})}catch(t){return Ei(t),!1}}))}function iZ(t){return!0===t||!(!t||!Array.isArray(t.enabledCommands))&&t.enabledCommands}XG._ttpTokenizer=zu("tokenizeToString",{createHTML:t=>t}),XG=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}([QG(1,Pa),QG(2,AF)],XG);var eZ,sZ=function(t,i){return function(e,s){i(e,s,t)}};let nZ=eZ=class{static get(t){return t.getContribution(eZ.ID)}constructor(t,i,e){this._openerService=e,this._messageWidget=new zi,this._messageListeners=new Vi,this._mouseOverMessage=!1,this._editor=t,this._visible=eZ.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;em(U_(t)?t.value:t),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=U_(t)?fI(t,{actionHandler:{callback:i=>tZ(this._openerService,i,U_(t)?t.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new rZ(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&&al(ml(),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(Zc(this._messageWidget.value.getDomNode(),xl.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(Zc(this._messageWidget.value.getDomNode(),xl.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(rZ.fadeOut(this._messageWidget.value))}};nZ.ID="editor.contrib.messageController",nZ.MESSAGE_VISIBLE=new Go("messageVisible",!1,J(0,"Whether the editor is currently showing an inline message")),nZ=eZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([sZ(1,Zo),sZ(2,AF)],nZ),eu(new(Ql.bindToContribution(nZ.get))({id:"leaveEditorMessage",precondition:nZ.MESSAGE_VISIBLE,handler:t=>t.closeMessage(),kbOpts:{weight:130,primary:9}}));class rZ{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)}}ru(nZ.ID,nZ,4);var oZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},hZ=function(t,i){return function(e,s){i(e,s,t)}};const cZ="acceptSelectedCodeAction",lZ="previewSelectedCodeAction";class uZ{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 aZ=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=io.asClassName(t.group.icon),t.group.icon.color&&(e.icon.style.color=Em(t.group.icon.color.id))):(e.icon.className=io.asClassName(ys.lightBulb),e.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!t.item||!t.label)return;e.text.textContent=mZ(t.label),e.keybinding.set(t.keybinding),function(t,...i){t?Il(...i):Pl(...i)}(!!t.keybinding,e.keybinding.element);const o=null===(n=this._keybindingService.lookupKeybinding(cZ))||void 0===n?void 0:n.getLabel(),h=null===(r=this._keybindingService.lookupKeybinding(lZ))||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){}};aZ=oZ([hZ(1,kC)],aZ);class dZ extends UIEvent{constructor(){super("acceptSelectedAction")}}class fZ extends UIEvent{constructor(){super("previewSelectedAction")}}function gZ(t){if("action"===t.kind)return t.label}let pZ=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 aZ(i,this._keybindingService),new uZ],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:gZ},accessibilityProvider:{getAriaLabel:t=>{if("action"===t.kind){let i=t.label?mZ(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 fZ:new dZ;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 fZ):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 mZ(t){return t.replace(/\r\n|\r|\n/g," ")}pZ=oZ([hZ(4,ER),hZ(5,kC)],pZ);var vZ=function(t,i){return function(e,s){i(e,s,t)}};Lm("actionBar.toggledBackground",{dark:Hm,light:Hm,hcDark:Hm,hcLight:Hm},J(0,"Background color for toggled action items in action bar."));const wZ={Visible:new Go("codeActionMenuVisible",!1,J(0,"Whether the action widget list is visible"))},bZ=Jr("actionWidgetService");let yZ=class extends Hi{get isVisible(){return wZ.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=wZ.Visible.bindTo(this._contextKeyService),c=this._instantiationService.createInstance(pZ,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(Zc(h,xl.MOUSE_DOWN,(t=>t.stopPropagation())));const c=document.createElement("div"),l=t.appendChild(c);l.classList.add("context-view-pointerBlock"),r.add(Zc(l,xl.POINTER_MOVE,(()=>l.remove()))),r.add(Zc(l,xl.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(Al(t));return r.add(d.onDidBlur((()=>this.hide()))),r}_createActionBar(t,i){if(!i.length)return;const e=_l(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)}};yZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(0,ER),vZ(1,Zo),vZ(2,Zr)],yZ),$a(bZ,yZ,1);const kZ=1100;Dh(class extends xh{constructor(){super({id:"hideCodeActionWidget",title:{value:J(0,"Hide action widget"),original:"Hide action widget"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:9,secondary:[1033]}})}run(t){t.get(bZ).hide()}}),Dh(class extends xh{constructor(){super({id:"selectPrevCodeAction",title:{value:J(0,"Select previous action"),original:"Select previous action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.focusPrevious()}}),Dh(class extends xh{constructor(){super({id:"selectNextCodeAction",title:{value:J(0,"Select next action"),original:"Select next action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.focusNext()}}),Dh(class extends xh{constructor(){super({id:cZ,title:{value:J(0,"Accept selected action"),original:"Accept selected action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:3,secondary:[2137]}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.acceptSelected()}}),Dh(class extends xh{constructor(){super({id:lZ,title:{value:J(0,"Preview selected action"),original:"Preview selected action"},precondition:wZ.Visible,keybinding:{weight:kZ,primary:2051}})}run(t){const i=t.get(bZ);i instanceof yZ&&i.acceptSelected(!0)}});const CZ=new Go("supportedCodeAction","");class SZ 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 xu),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:xG.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 xZ;!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 DZ;throw t}))}cancel(){this._cancellablePromise.cancel()}}}(xZ||(xZ={}));const DZ=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1});class EZ 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=xZ.Empty,this._onDidChangeState=this._register(new ie),this.onDidChangeState=this._onDidChangeState.event,this._disposed=!1,this._supportedCodeActions=CZ.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(xZ.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(xZ.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 SZ(this._editor,this._markerService,(i=>{var e;if(!i)return void this.setState(xZ.Empty);const s=i.selection.getStartPosition(),n=mu((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===xG.QuickFix||(null===(n=null===(s=i.trigger.filter)||void 0===s?void 0:s.include)||void 0===n?void 0:n.contains(DG.QuickFix)))){const s=yield $G(this._registry,t,i.selection,i.trigger,nR.None,e);if(e.isCancellationRequested)return DZ;if(!(null===(r=s.validActions)||void 0===r?void 0:r.some((t=>!!t.action.kind&&DG.QuickFix.contains(new DG(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:DG.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 $G(this._registry,t,r,n,nR.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 $G(this._registry,t,i.selection,i.trigger,nR.None,e)}))));1===i.trigger.type&&(null===(e=this._progressService)||void 0===e||e.showWhile(n,250)),this.setState(new xZ.Triggered(i.trigger,s,n))}),void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:xG.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 AZ,MZ=function(t,i){return function(e,s){i(e,s,t)}},LZ=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 OZ=AZ=class extends Hi{static get(t){return t.getContribution(AZ.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 EZ(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(ZG.ID);return t&&this._register(t.onClick((t=>this.showCodeActionList(t.actions,t,{includeDisabledActions:!1,fromLightbulb:!0})))),t})),this._resolver=s.createInstance(zG),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=nZ.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 LZ(this,void 0,void 0,(function*(){try{yield this._instantiationService.invokeFunction(VG,t,WG.FromCodeActions,{preview:e,editor:this._editor})}finally{i&&this._trigger({type:2,triggerAction:xG.QuickFix,filter:{}})}}))}update(t){var i,e,s,n,r,o,h;return LZ(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=nZ.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=nZ.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 LZ(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)=>LZ(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)=>LZ(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:AZ.DECORATION}]);const n=t.action.diagnostics[0];sm(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:UG,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=KG.map((t=>({group:t,actions:[]})));for(const i of t){const t=i.action.kind?new DG(i.action.kind):DG.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=ol(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 FZ(t){return Mo.regex(CZ.keys()[0],new RegExp("(\\s|^)"+Rn(t.value)+"\\b"))}OZ.ID="editor.contrib.codeActionController",OZ.DECORATION=$M.register({description:"quickfix-highlight",className:"quickfix-edit-highlight"}),OZ=AZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([MZ(1,FN),MZ(2,Zo),MZ(3,Zr),MZ(4,$g),MZ(5,rR),MZ(6,lo),MZ(7,Oa),MZ(8,bZ),MZ(9,Zr)],OZ),yk(((t,i)=>{((t,e)=>{e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { background-color: ${e}; }`)})(0,t.getColor(Kv));const e=t.getColor(Zv);e&&i.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${ry(t.type)?"dotted":"solid"} ${e}; box-sizing: border-box; }`)}));const TZ={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 RZ(t,i,e,s,n=xG.Default){if(t.hasModel()){const r=OZ.get(t);null==r||r.manualTriggerAtCurrentPosition(i,n,e,s)}}ru(OZ.ID,OZ,3),ru(ZG.ID,ZG,4),su(class extends Yl{constructor(){super({id:FG,label:J(0,"Quick Fix..."),alias:"Quick Fix...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),kbOpts:{kbExpr:fS.textInputFocus,primary:2137,weight:100}})}run(t,i){return RZ(i,J(0,"No code actions available"),void 0,void 0,xG.QuickFix)}}),su(class extends Yl{constructor(){super({id:RG,label:J(0,"Refactor..."),alias:"Refactor...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),kbOpts:{kbExpr:fS.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:Mo.and(fS.writable,FZ(DG.Refactor))},description:{description:"Refactor...",args:[{name:"args",schema:TZ}]}})}run(t,i,e){const s=AG.fromUser(e,{kind:DG.Refactor,apply:"never"});return RZ(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:DG.Refactor.contains(s.kind)?s.kind:DG.None,onlyIncludePreferredActions:s.preferred},s.apply,xG.Refactor)}}),su(class extends Yl{constructor(){super({id:_G,label:J(0,"Source Action..."),alias:"Source Action...",precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:Mo.and(fS.writable,FZ(DG.Source))},description:{description:"Source Action...",args:[{name:"args",schema:TZ}]}})}run(t,i,e){const s=AG.fromUser(e,{kind:DG.Source,apply:"never"});return RZ(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:DG.Source.contains(s.kind)?s.kind:DG.None,includeSourceActions:!0,onlyIncludePreferredActions:s.preferred},s.apply,xG.SourceAction)}}),su(class extends Yl{constructor(){super({id:IG,label:J(0,"Organize Imports"),alias:"Organize Imports",precondition:Mo.and(fS.writable,FZ(DG.SourceOrganizeImports)),kbOpts:{kbExpr:fS.textInputFocus,primary:1581,weight:100}})}run(t,i){return RZ(i,J(0,"No organize imports action available"),{include:DG.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",xG.OrganizeImports)}}),su(class extends Yl{constructor(){super({id:TG,label:J(0,"Auto Fix..."),alias:"Auto Fix...",precondition:Mo.and(fS.writable,FZ(DG.QuickFix)),kbOpts:{kbExpr:fS.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(t,i){return RZ(i,J(0,"No auto fixes available"),{include:DG.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",xG.AutoFix)}}),su(class extends Yl{constructor(){super({id:PG,label:J(0,"Fix All"),alias:"Fix All",precondition:Mo.and(fS.writable,FZ(DG.SourceFixAll))})}run(t,i){return RZ(i,J(0,"No fix all action available"),{include:DG.SourceFixAll,includeSourceActions:!0},"ifSingle",xG.FixAll)}}),eu(new class extends Ql{constructor(){super({id:OG,precondition:Mo.and(fS.writable,fS.hasCodeActionsProvider),description:{description:"Trigger a code action",args:[{name:"args",schema:TZ}]}})}runEditorCommand(t,i,e){const s=AG.fromUser(e,{kind:DG.Empty,apply:"ifSingle"});return RZ(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)}}),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:5,description:J(0,"Enable/disable showing group headers in the Code Action menu."),default:!0}}})),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{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 _Z=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 IZ{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 PZ(t,i,e){return _Z(this,void 0,void 0,(function*(){const s=t.ordered(i),n=new Map,r=new IZ,o=s.map(((t,s)=>_Z(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}))}uo.registerCommand("_executeCodeLensProvider",(function(t,...i){let[e,s]=i;B(ss.isUri(e)),B("number"==typeof s||!s);const{codeLensProvider:n}=t.get($g),r=t.get(Yr).getModel(e);if(!r)throw Ti();const o=[],h=new Vi;return PZ(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 NZ=Jr("ICodeLensCache");class BZ{constructor(t,i){this.lineCount=t,this.data=i}}let $Z=class{constructor(t){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new hg(20,.75),Au((()=>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 IZ;s.add({lenses:e,dispose:()=>{}},this._fakeProvider);const n=new BZ(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 IZ;n.add({lenses:s,dispose(){}},this._fakeProvider),this._cache.set(t,new BZ(e.lineCount,n))}}catch(t){}}};$Z=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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)],$Z),$a(NZ,$Z,1);class jZ{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 WZ{constructor(t,i){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id="codelens.widget-"+WZ._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(_l("a",{id:String(i),title:n.command.tooltip,role:"button"},...s)),this._commands.set(String(i),n.command)):e.push(_l("span",{title:n.command.tooltip},...s)),i+1<t.length&&e.push(_l("span",void 0," | "))}}s?(Ol(this._domNode,...e),this._isEmpty&&i&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Ol(this._domNode,_l("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}}WZ._idPool=0;class VZ{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 HZ=$M.register({collapseOnReplaceEdit:!0,description:"codelens"});class zZ{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:HZ},(t=>this._decorationIds[i]=t)),o=o?ps.plusRange(o,t.symbol.range):ps.lift(t.symbol.range)})),this._viewZone=new jZ(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 WZ(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:HZ},(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 UZ=function(t,i){return function(e,s){i(e,s,t)}},KZ=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 qZ=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 Eu((()=>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(Cu((()=>{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 Eu((()=>{var i;const s=Date.now();null===(i=this._getCodeLensModelPromise)||void 0===i||i.cancel(),this._getCodeLensModelPromise=mu((i=>PZ(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 VZ;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=iU.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 VZ;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=iU.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations((t=>{this._editor.changeViewZones((i=>{const s=new VZ;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 zZ(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 zZ(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=mu((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 KZ(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}))}};qZ.ID="css.editor.codeLens",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(1,$g),UZ(2,FF),UZ(3,lo),UZ(4,vO),UZ(5,NZ)],qZ),ru(qZ.ID,qZ,1),su(class extends Yl{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:fS.hasCodeLensProvider,label:J(0,"Show CodeLens Commands For Current Line"),alias:"Show CodeLens Commands For Current Line"})}run(t,i){return KZ(this,void 0,void 0,(function*(){if(!i.hasModel())return;const e=t.get(Ij),s=t.get(lo),n=t.get(vO),r=i.getSelection().positionLineNumber,o=i.getContribution(qZ.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 GZ=function(t,i){return function(e,s){i(e,s,t)}};class ZZ{constructor(t,i){this._editorWorkerClient=new Zg(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 Eg(new Sg(Math.round(255*n.red),Math.round(255*n.green),Math.round(255*n.blue),r)),h=r?Eg.Format.CSS.formatRGB(o):Eg.Format.CSS.formatRGBA(o),c=r?Eg.Format.CSS.formatHSL(o):Eg.Format.CSS.formatHSLA(o),l=r?Eg.Format.CSS.formatHex(o):Eg.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 JZ=class extends Hi{constructor(t,i,e){super(),this._register(e.colorProvider.register("*",new ZZ(t,i)))}};JZ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Yr),GZ(1,cd),GZ(2,$g)],JZ),tH(JZ);var QZ=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 YZ(t,i,e,s=!0){return QZ(this,void 0,void 0,(function*(){return sJ(new tJ,t,i,e,s)}))}function XZ(t,i,e,s){return Promise.resolve(e.provideColorPresentations(t,i,s))}class tJ{constructor(){}compute(t,i,e,s){return QZ(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 iJ{constructor(){}compute(t,i,e,s){return QZ(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 eJ{constructor(t){this.colorInfo=t}compute(t,i,e,s){return QZ(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 sJ(t,i,e,s,n){return QZ(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 ZZ)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 nJ(t,i){const{colorProvider:e}=t.get($g),s=t.get(Yr).getModel(i);if(!s)throw Ti();return{model:s,colorProviderRegistry:e,isDefaultColorDecoratorsEnabled:t.get(Oa).getValue("editor.defaultColorDecorators",{resource:i})}}uo.registerCommand("_executeDocumentColorProvider",(function(t,...i){const[e]=i;if(!(e instanceof ss))throw Ti();const{model:s,colorProviderRegistry:n,isDefaultColorDecoratorsEnabled:r}=nJ(t,e);return sJ(new iJ,n,s,ue.None,r)})),uo.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}=nJ(t,n),[l,u,a,d]=e;return sJ(new eJ({range:r,color:{red:l,green:u,blue:a,alpha:d}}),h,o,ue.None,c)}));var rJ,oJ=function(t,i){return function(e,s){i(e,s,t)}},hJ=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 cJ=Object.create({});let lJ=rJ=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 zb(this._editor),this._decoratorLimitReporter=new uJ,this._colorDecorationClassRefs=this._register(new Vi),this._debounceInformation=s.for(e.colorProvider,"Document Colors",{min:rJ.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 xu,this._timeoutTimer.cancelAndSet((()=>{this._timeoutTimer=null,this.beginCompute()}),this._debounceInformation.get(t)))}))),this.beginCompute())}beginCompute(){return hJ(this,void 0,void 0,(function*(){this._computePromise=mu((t=>hJ(this,void 0,void 0,(function*(){const i=this._editor.getModel();if(!i)return[];const e=new Zi(!1),s=yield YZ(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 Sg(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:cJ}}})}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)}};lJ.ID="editor.contrib.colorDetector",lJ.RECOMPUTE_TIME=1e3,lJ=rJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([oJ(1,Oa),oJ(2,$g),oJ(3,FF)],lJ);class uJ{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())}}ru(lJ.ID,lJ,1);class aJ{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 dJ=_l;class fJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.showingStandaloneColorPicker=s,this._closeButton=null,this._domNode=dJ(".colorpicker-header"),Ml(t,this._domNode),this._pickedColorNode=Ml(this._domNode,dJ(".picked-color")),Ml(this._pickedColorNode,dJ("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Ml(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=Ml(this._domNode,dJ(".original-color")),this._originalColorNode.style.backgroundColor=Eg.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=e.getColorTheme().getColor(Qv)||Eg.white,this._register(e.onDidColorThemeChange((t=>{this.backgroundColor=t.getColor(Qv)||Eg.white}))),this._register(Zc(this._pickedColorNode,xl.CLICK,(()=>this.model.selectNextColorPresentation()))),this._register(Zc(this._originalColorNode,xl.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=Eg.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 gJ(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(t){this._pickedColorNode.style.backgroundColor=Eg.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 gJ 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"),Ml(t,this._button);const i=document.createElement("div");i.classList.add("close-button-inner-div"),Ml(this._button,i),Ml(i,dJ(".button"+io.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 pJ extends Hi{constructor(t,i,e,s=!1){super(),this.model=i,this.pixelRatio=e,this._insertButton=null,this._domNode=dJ(".colorpicker-body"),Ml(t,this._domNode),this._saturationBox=new mJ(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 wJ(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 bJ(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 yJ(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 Eg(new Dg(e.h,t,i,e.a))}onDidOpacityChange(t){const i=this.model.color.hsva;this.model.color=new Eg(new Dg(i.h,i.s,i.v,t))}onDidHueChange(t){const i=this.model.color.hsva,e=360*(1-t);this.model.color=new Eg(new Dg(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 mJ 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=dJ(".saturation-wrap"),Ml(t,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Ml(this._domNode,this._canvas),this.selection=dJ(".saturation-selection"),Ml(this._domNode,this.selection),this.layout(),this._register(Zc(this._domNode,xl.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 xm);const i=ol(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=Zc(t.target.ownerDocument,xl.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 Eg(new Dg(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=Eg.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 vJ 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=Ml(t,dJ(".standalone-strip")),this.overlay=Ml(this.domNode,dJ(".standalone-overlay"))):(this.domNode=Ml(t,dJ(".strip")),this.overlay=Ml(this.domNode,dJ(".overlay"))),this.slider=Ml(this.domNode,dJ(".slider")),this.slider.style.top="0px",this._register(Zc(this.domNode,xl.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 xm),e=ol(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=Zc(t.target.ownerDocument,xl.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 wJ extends vJ{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 Eg(new Sg(i,e,s,1)),r=new Eg(new Sg(i,e,s,0));this.overlay.style.background=`linear-gradient(to bottom, ${n} 0%, ${r} 100%)`}getValue(t){return t.hsva.a}}class bJ extends vJ{constructor(t,i,e=!1){super(t,i,e),this.domNode.classList.add("hue-strip")}getValue(t){return 1-t.hsva.h/360}}class yJ extends Hi{constructor(t){super(),this._onClicked=this._register(new ie),this.onClicked=this._onClicked.event,this._button=Ml(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 kJ extends Fy{constructor(t,i,e,s,n=!1){super(),this.model=i,this.pixelRatio=e,this._register(Ar.onDidChange((()=>this.layout())));const r=dJ(".colorpicker-widget");t.appendChild(r),this.header=this._register(new fJ(r,this.model,s,n)),this.body=this._register(new pJ(r,this.model,this.pixelRatio,n))}layout(){this.body.layout()}}var CJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},SJ=function(t,i){return function(e,s){i(e,s,t)}},xJ=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 DJ{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 EJ=class{constructor(t,i){this._editor=t,this._themeService=i,this.hoverOrdinal=2}computeSync(t,i){return[]}computeAsync(t,i,e){return Fu.fromPromise(this._computeAsync(t,i,e))}_computeAsync(t,i,e){return xJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return[];const t=lJ.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 LJ(this,this._editor.getModel(),i.colorInfo,i.provider)]}return[]}))}renderHoverParts(t,i){return OJ(this,this._editor,this._themeService,i,t)}};EJ=CJ([SJ(1,pk)],EJ);class AJ{constructor(t,i,e,s){this.owner=t,this.range=i,this.model=e,this.provider=s}}let MJ=class{constructor(t,i){this._editor=t,this._themeService=i,this._color=null}createColorHover(t,i,e){return xJ(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return null;if(!lJ.get(this._editor))return null;const s=yield YZ(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 LJ(this,this._editor.getModel(),o,h),foundInEditor:c}}))}updateEditorModel(t){return xJ(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 TJ(this._editor.getModel(),i,this._color,e,t),e=FJ(this._editor,e,i))}))}renderHoverParts(t,i){return OJ(this,this._editor,this._themeService,i,t)}set color(t){this._color=t}get color(){return this._color}};function LJ(t,i,e,s){return xJ(this,void 0,void 0,(function*(){const n=i.getValueInRange(e.range),{red:r,green:o,blue:h,alpha:c}=e.color,l=new Sg(Math.round(255*r),Math.round(255*o),Math.round(255*h),c),u=new Eg(l),a=yield XZ(i,e,s,ue.None),d=new aJ(u,[],0);return d.colorPresentations=a||[],d.guessColorPresentation(u,n),t instanceof EJ?new DJ(t,ps.lift(e.range),d,s):new AJ(t,ps.lift(e.range),d,s)}))}function OJ(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 nl(302,t))}const r=new Vi,o=s[0],h=i.getModel(),c=o.model,l=r.add(new kJ(n.fragment,c,i.getOption(141),e,t instanceof MJ));n.setColorPicker(l);let u=!1,a=new ps(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn);if(t instanceof MJ){const i=s[0].model.color;t.color=i,TJ(h,c,i,a,o),r.add(c.onColorFlushed((i=>{t.color=i})))}else r.add(c.onColorFlushed((t=>xJ(this,void 0,void 0,(function*(){yield TJ(h,c,t,a,o),u=!0,a=FJ(i,a,c,n)})))));return r.add(c.onDidChangeColor((t=>{TJ(h,c,t,a,o)}))),r.add(i.onDidChangeModelContent((()=>{u?u=!1:(n.hide(),i.focus())}))),r}function FJ(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 TJ(t,i,e,s,n){return xJ(this,void 0,void 0,(function*(){const r=yield XZ(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 RJ(t,i){return!!t[i]}MJ=CJ([SJ(1,pk)],MJ);class _J{constructor(t,i){this.target=t.target,this.isLeftClick=t.event.leftButton,this.isMiddleClick=t.event.middleButton,this.isRightClick=t.event.rightButton,this.hasTriggerModifier=RJ(t.event,i.triggerModifier),this.hasSideBySideModifier=RJ(t.event,i.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=t.event.detail<=1}}class IJ{constructor(t,i){this.keyCodeIsTriggerKey=t.keyCode===i.triggerKey,this.keyCodeIsSideBySideKey=t.keyCode===i.triggerSideBySideKey,this.hasTriggerModifier=RJ(t,i.triggerModifier)}}class PJ{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 NJ(t){return"altKey"===t?ft?new PJ(57,"metaKey",6,"altKey"):new PJ(5,"ctrlKey",6,"altKey"):ft?new PJ(6,"altKey",57,"metaKey"):new PJ(6,"altKey",5,"ctrlKey")}class BJ 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=NJ(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=NJ(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 _J(t,this._opts))))),this._register(this._editor.onMouseDown((t=>this._onEditorMouseDown(new _J(t,this._opts))))),this._register(this._editor.onMouseUp((t=>this._onEditorMouseUp(new _J(t,this._opts))))),this._register(this._editor.onKeyDown((t=>this._onEditorKeyDown(new IJ(t,this._opts))))),this._register(this._editor.onKeyUp((t=>this._onEditorKeyUp(new IJ(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 $J=function(t,i){return function(e,s){i(e,s,t)}};let jJ=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)}};jJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([$J(4,Zr),$J(5,Qr),$J(6,lo),$J(7,Zo),$J(8,pk),$J(9,vO),$J(10,fm),$J(11,cd),$J(12,$g)],jJ);const WJ=new Eg(new Sg(0,122,204)),VJ={showArrow:!0,showFrame:!0,className:"",frameColor:WJ,arrowColor:WJ,keepEditorSelection:!1};class HJ{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 zJ{constructor(t,i){this._id=t,this._domNode=i}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class UJ{constructor(t){this._editor=t,this._ruleName=UJ._IdGenerator.nextId(),this._decorations=this._editor.createDecorationsCollection(),this._color=null,this._height=-1}dispose(){this.hide(),Cl(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(){Cl(this._ruleName),kl(`.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()}}UJ._IdGenerator=new rI(".arrow-decoration-");class KJ{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,VJ,!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 UJ(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 HJ(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 zJ("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 qJ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},GJ=function(t,i){return function(e,s){i(e,s,t)}};const ZJ=Jr("IPeekViewService");var JJ;$a(ZJ,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 Go("inReferenceSearchEditor",!0,J(0,"Whether the current code editor is embedded inside peek")),t.notInPeekEditor=t.inPeekEditor.toNegated()}(JJ||(JJ={}));let QJ=class{constructor(t,i){t instanceof jJ&&JJ.inPeekEditor.bindTo(i)}dispose(){}};QJ.ID="editor.contrib.referenceController",QJ=qJ([GJ(1,Zo)],QJ),ru(QJ.ID,QJ,0);const YJ={headerBackgroundColor:Eg.white,primaryHeadingColor:Eg.fromHex("#333333"),secondaryHeadingColor:Eg.fromHex("#6c6c6cb3")};let XJ=class extends KJ{constructor(t,i,e){super(t,i),this.instantiationService=e,this._onDidClose=new ie,this.onDidClose=this._onDidClose.event,K(this.options,YJ,!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=_l(".head"),this._bodyElement=_l(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),t.appendChild(this._headElement),t.appendChild(this._bodyElement)}_fillHead(t,i){this._titleElement=_l(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Qc(this._titleElement,"click",(t=>this._onTitleClick(t)))),Ml(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_l("span.filename"),this._secondaryHeading=_l("span.dirname"),this._metaHeading=_l("span.meta"),Ml(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const e=_l(".peekview-actions");Ml(this._headElement,e);const s=this._getActionBarOptions();this._actionbarWidget=new cN(e,s),this._disposables.add(this._actionbarWidget),i||this._actionbarWidget.push(new so("peekview.close",J(0,"Close"),io.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:Kc(this._secondaryHeading))}setMetaTitle(t){this._metaHeading&&(t?(this._metaHeading.innerText=t,Il(this._metaHeading)):Pl(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`)}};XJ=qJ([GJ(2,Zr)],XJ);const tQ=Lm("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view title area.")),iQ=Lm("peekViewTitleLabel.foreground",{dark:Eg.white,light:Eg.black,hcDark:Eg.white,hcLight:Av},J(0,"Color of the peek view title.")),eQ=Lm("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},J(0,"Color of the peek view title info.")),sQ=Lm("peekView.border",{dark:Sv,light:Sv,hcDark:_m,hcLight:_m},J(0,"Color of the peek view borders and arrow.")),nQ=Lm("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view result list."));Lm("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color for line nodes in the peek view result list.")),Lm("peekViewResult.fileForeground",{dark:Eg.white,light:"#1E1E1E",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color for file nodes in the peek view result list.")),Lm("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},J(0,"Background color of the selected entry in the peek view result list.")),Lm("peekViewResult.selectionForeground",{dark:Eg.white,light:"#6C6C6C",hcDark:Eg.white,hcLight:Av},J(0,"Foreground color of the selected entry in the peek view result list."));const rQ=Lm("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:Eg.black,hcLight:Eg.white},J(0,"Background color of the peek view editor."));Lm("peekViewEditorGutter.background",{dark:rQ,light:rQ,hcDark:rQ,hcLight:rQ},J(0,"Background color of the gutter in the peek view editor.")),Lm("peekViewEditorStickyScroll.background",{dark:rQ,light:rQ,hcDark:rQ,hcLight:rQ},J(0,"Background color of sticky scroll in the peek view editor.")),Lm("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view result list.")),Lm("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},J(0,"Match highlight color in the peek view editor.")),Lm("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Im,hcLight:Im},J(0,"Match highlight border in the peek view editor."));class oQ{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 hQ{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 cQ{constructor(t,i){this.parent=t,this.uri=i,this.children=[],this._previews=new rg}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 hQ(e))}catch(t){Ei(t)}return this}))}}class lQ{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(lQ._compareReferences);for(const i of t)if(s&&ME.isEqual(s.uri,i.uri,!0)||(s=new cQ(this,i.uri),this.groups.push(s)),0===s.children.length||0!==lQ._compareReferences(i,s.children[s.children.length-1])){const t=new oQ(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 lQ(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 uQ,aQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},dQ=function(t,i){return function(e,s){i(e,s,t)}};let fQ=class{constructor(t){this._resolverService=t}hasChildren(t){return t instanceof lQ||t instanceof cQ}getChildren(t){if(t instanceof lQ)return t.groups;if(t instanceof cQ)return t.resolve(this._resolverService).then((t=>t.children));throw new Error("bad tree")}};fQ=aQ([dQ(0,Xr)],fQ);class gQ{getHeight(){return 23}getTemplateId(t){return t instanceof cQ?wQ.id:yQ.id}}let pQ=class{constructor(t){this._keybindingService=t}getKeyboardNavigationLabel(t){var i;if(t instanceof oQ){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)}};pQ=aQ([dQ(0,kC)],pQ);class mQ{getId(t){return t instanceof oQ?t.id:t.uri}}let vQ=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(Ml(e,_l(".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))}};vQ=aQ([dQ(1,eR)],vQ);let wQ=uQ=class{constructor(t){this._instantiationService=t,this.templateId=uQ.id}renderTemplate(t){return this._instantiationService.createInstance(vQ,t)}renderElement(t,i,e){e.set(t.element,v_(t.filterData))}disposeTemplate(t){t.dispose()}};wQ.id="FileReferencesRenderer",wQ=uQ=aQ([dQ(0,Zr)],wQ);class bQ{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 yQ{constructor(){this.templateId=yQ.id}renderTemplate(t){return new bQ(t)}renderElement(t,i,e){e.set(t.element,t.filterData)}disposeTemplate(){}}yQ.id="OneReferenceRenderer";class kQ{getWidgetAriaLabel(){return J(0,"References")}getAriaLabel(t){return t.ariaMessage}}var CQ=function(t,i){return function(e,s){i(e,s,t)}},SQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};class xQ{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:xQ.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()}}xQ.DecorationOptions=$M.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});class DQ{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 EQ extends xj{}let AQ=class extends XJ{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 nl(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(sQ)||Eg.transparent;this.style({arrowColor:i,frameColor:i,headerBackgroundColor:t.getColor(tQ)||Eg.transparent,primaryHeadingColor:t.getColor(iQ),secondaryHeadingColor:t.getColor(eQ)})}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=Ml(t,_l("div.messages")),Pl(this._messageContainer),this._splitView=new hB(t,{orientation:1}),this._previewContainer=Ml(t,_l("div.preview.inline")),this._preview=this._instantiationService.createInstance(jJ,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),Pl(this._previewContainer),this._previewNotAvailableMessage=new LM(J(0,"no preview available"),td,LM.DEFAULT_CREATION_OPTIONS,null,this._undoRedoService,this._languageService,this._languageConfigurationService),this._treeContainer=Ml(t,_l("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new kQ,keyboardNavigationLabelProvider:this._instantiationService.createInstance(pQ),identityProvider:new mQ,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:nQ}};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Qc(this._treeContainer,"keydown",(t=>{t.equals(9)&&(this._keybindingService.dispatchEvent(t,t.target),t.stopPropagation())}),!0)),this._tree=this._instantiationService.createInstance(EQ,"ReferencesWidget",this._treeContainer,new gQ,[this._instantiationService.createInstance(wQ),this._instantiationService.createInstance(yQ)],this._instantiationService.createInstance(fQ),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 oQ&&("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")})),Pl(this._treeContainer)}_onWidth(t){this._dim&&this._doLayoutBody(this._dim.height,t)}_doLayoutBody(t,i){super._doLayoutBody(t,i),this._dim=new nl(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"),Il(this._messageContainer),Promise.resolve(void 0)):(Pl(this._messageContainer),this._decorationsManager=new xQ(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"),Il(this._treeContainer),Il(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 oQ?t:t instanceof cQ&&t.children.length>0?t.children[0]:void 0}revealReference(t){return SQ(this,void 0,void 0,(function*(){yield this._revealReference(t,!1),this._onDidSelectReference.fire({element:t,kind:"goto",source:"tree"})}))}_revealReference(t,i){return SQ(this,void 0,void 0,(function*(){if(this._revealedReference===t)return;this._revealedReference=t,t.uri.scheme!==jc.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()}))}};AQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([CQ(3,pk),CQ(4,Xr),CQ(5,Zr),CQ(6,ZJ),CQ(7,eR),CQ(8,bM),CQ(9,kC),CQ(10,Pa),CQ(11,cd)],AQ);var MQ,LQ=function(t,i){return function(e,s){i(e,s,t)}},OQ=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 FQ=new Go("referenceSearchVisible",!1,J(0,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let TQ=MQ=class{static get(t){return t.getContribution(MQ.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=FQ.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=DQ.fromJSON(this._storageService.get(n,0,"{}"));this._widget=this._instantiationService.createInstance(AQ,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 OQ(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 OQ(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=MQ.get(t),n=this._model.clone();this.closeWidget(),t.focus(),null==e||e.toggleWidget(s,mu((()=>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 RQ(t,i){const e=function(t){const i=t.get(Qr).getFocusedCodeEditor();return i instanceof jJ?i.getParentEditor():i}(t);if(!e)return;const s=TQ.get(e);s&&i(s)}TQ.ID="editor.contrib.referencesController",TQ=MQ=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(2,Zo),LQ(3,Qr),LQ(4,vO),LQ(5,Zr),LQ(6,PP),LQ(7,Oa)],TQ),fh.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:xe(2089,60),when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.changeFocusBetweenPreviewAndReferences()}))}}),fh.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.goToNextOrPreviousReference(!0)}))}}),fh.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:Mo.or(FQ,JJ.inPeekEditor),handler(t){RQ(t,(t=>{t.goToNextOrPreviousReference(!1)}))}}),uo.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),uo.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),uo.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),uo.registerCommand("closeReferenceSearch",(t=>RQ(t,(t=>t.closeWidget())))),fh.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:Mo.and(JJ.inPeekEditor,Mo.not("config.editor.stablePeek"))}),fh.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:Mo.and(FQ,Mo.not("config.editor.stablePeek"))}),fh.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:Mo.and(FQ,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 oQ&&RQ(t,(t=>t.revealReference(e[0])))}}),fh.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:Mo.and(FQ,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 oQ&&RQ(t,(t=>t.openReference(e[0],!0,!0)))}}),uo.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 oQ&&RQ(t,(t=>t.openReference(e[0],!1,!0)))}));var _Q=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},IQ=function(t,i){return function(e,s){i(e,s,t)}};const PQ=new Go("hasSymbols",!1,J(0,"Whether there are symbol locations that can be navigated via keyboard-only.")),NQ=Jr("ISymbolNavigationService");let BQ=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=PQ.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 $Q(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)}};BQ=_Q([IQ(0,Zo),IQ(1,Qr),IQ(2,vO),IQ(3,kC)],BQ),$a(NQ,BQ,1),eu(new class extends Ql{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:PQ,kbOpts:{weight:100,primary:70}})}runEditorCommand(t,i){return t.get(NQ).revealNext(i)}}),fh.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:PQ,primary:9,handler(t){t.get(NQ).reset()}});let $Q=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)}};$Q=_Q([IQ(0,Qr)],$Q);var jQ=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function WQ(t,i,e,s){return jQ(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 VQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideDefinition(i,e,s)))}function HQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideDeclaration(i,e,s)))}function zQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideImplementation(i,e,s)))}function UQ(t,i,e,s){return WQ(i,e,t,((t,i,e)=>t.provideTypeDefinition(i,e,s)))}function KQ(t,i,e,s,n){return WQ(i,e,t,((t,i,e)=>jQ(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 qQ(t){return jQ(this,void 0,void 0,(function*(){const i=yield t(),e=new lQ(i,""),s=e.references.map((t=>t.link));return e.dispose(),s}))}iu("_executeDefinitionProvider",((t,i,e)=>{const s=VQ(t.get($g).definitionProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeTypeDefinitionProvider",((t,i,e)=>{const s=UQ(t.get($g).typeDefinitionProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeDeclarationProvider",((t,i,e)=>{const s=HQ(t.get($g).declarationProvider,i,e,ue.None);return qQ((()=>s))})),iu("_executeReferenceProvider",((t,i,e)=>{const s=KQ(t.get($g).referenceProvider,i,e,!1,ue.None);return qQ((()=>s))})),iu("_executeImplementationProvider",((t,i,e)=>{const s=zQ(t.get($g).implementationProvider,i,e,ue.None);return qQ((()=>s))}));var GQ,ZQ,JQ,QQ,YQ,XQ,tY,iY,eY=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())}))};kh.appendMenuItem(wh.EditorContext,{submenu:wh.EditorContextPeek,title:J(0,"Peek"),group:"navigation",order:100});class sY{static is(t){return!(!t||"object"!=typeof t)&&(t instanceof sY||!(!gs.isIPosition(t.position)||!t.model))}constructor(t,i){this.model=t,this.position=i}}class nY extends tu{static all(){return nY._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!==wh.EditorContext&&e.id!==wh.EditorContextPeek||(e.when=Mo.and(t.precondition,e.when));return i}constructor(t,i){super(nY._patchConfig(i)),this.configuration=t,nY._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(Qr),o=t.get(rR),h=t.get(NQ),c=t.get($g),l=t.get(Zr),u=i.getModel(),a=i.getPosition(),d=sY.is(e)?e:new sY(u,a),f=new cK(i,5),g=vu(this._getLocationModel(c,d.model,d.position,f.token),f.token).then((t=>eY(this,void 0,void 0,(function*(){var n;if(!t||f.token.isCancellationRequested)return;let o;if(em(t.ariaMessage),t.referenceAt(u.uri,a)){const t=this._getAlternativeCommand(i);!nY._activeAlternativeCommands.has(t)&&nY._allSymbolNavigationCommands.has(t)&&(o=nY._allSymbolNavigationCommands.get(t))}const c=t.references.length;if(0===c){if(!this.configuration.muteMessage){const t=u.getWordAtPosition(a);null===(n=nZ.get(i))||void 0===n||n.showMessage(this._getNoResultFoundMessage(t),a)}}else{if(1!==c||!o)return this._onResult(r,h,i,t,s);nY._activeAlternativeCommands.add(this.desc.id),l.invokeFunction((t=>o.runEditorCommand(t,i,e,s).finally((()=>{nY._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 eY(this,void 0,void 0,(function*(){const r=this._getGoToPreference(e);if(e instanceof jJ||!(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 eY(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=TQ.get(t);s&&t.hasModel()?s.toggleWidget(null!=e?e:t.getSelection(),mu((()=>Promise.resolve(i))),this.configuration.openInPeek):i.dispose()}}nY._allSymbolNavigationCommands=new Map,nY._activeAlternativeCommands=new Set;class rY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield VQ(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}}Dh(((GQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:GQ.id,title:{value:J(0,"Go to Definition"),original:"Go to Definition",mnemonicTitle:J(0,"Go to &&Definition")},precondition:Mo.and(fS.hasDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:fS.editorTextFocus,primary:70,weight:100},{when:Mo.and(fS.editorTextFocus,A$),primary:2118,weight:100}],menu:[{id:wh.EditorContext,group:"navigation",order:1.1},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),uo.registerCommandAlias("editor.action.goToDeclaration",GQ.id)}}).id="editor.action.revealDefinition",GQ)),Dh(((ZQ=class extends rY{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:ZQ.id,title:{value:J(0,"Open Definition to the Side"),original:"Open Definition to the Side"},precondition:Mo.and(fS.hasDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:[{when:fS.editorTextFocus,primary:xe(2089,70),weight:100},{when:Mo.and(fS.editorTextFocus,A$),primary:xe(2089,2118),weight:100}]}),uo.registerCommandAlias("editor.action.openDeclarationToTheSide",ZQ.id)}}).id="editor.action.revealDefinitionAside",ZQ)),Dh(((JQ=class extends rY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:JQ.id,title:{value:J(0,"Peek Definition"),original:"Peek Definition"},precondition:Mo.and(fS.hasDefinitionProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:wh.EditorContextPeek,group:"peek",order:2}}),uo.registerCommandAlias("editor.action.previewDeclaration",JQ.id)}}).id="editor.action.peekDefinition",JQ));class oY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield HQ(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}}Dh(((QQ=class extends oY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:QQ.id,title:{value:J(0,"Go to Declaration"),original:"Go to Declaration",mnemonicTitle:J(0,"Go to &&Declaration")},precondition:Mo.and(fS.hasDeclarationProvider,fS.isInWalkThroughSnippet.toNegated()),menu:[{id:wh.EditorContext,group:"navigation",order:1.3},{id:wh.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",QQ)),Dh(class extends oY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:{value:J(0,"Peek Declaration"),original:"Peek Declaration"},precondition:Mo.and(fS.hasDeclarationProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:3}})}});class hY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield UQ(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}}Dh(((YQ=class extends hY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:YQ.ID,title:{value:J(0,"Go to Type Definition"),original:"Go to Type Definition",mnemonicTitle:J(0,"Go to &&Type Definition")},precondition:Mo.and(fS.hasTypeDefinitionProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:0,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.4},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}}).ID="editor.action.goToTypeDefinition",YQ)),Dh(((XQ=class extends hY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:XQ.ID,title:{value:J(0,"Peek Type Definition"),original:"Peek Type Definition"},precondition:Mo.and(fS.hasTypeDefinitionProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:4}})}}).ID="editor.action.peekTypeDefinition",XQ));class cY extends nY{_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield zQ(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}}Dh(((tY=class extends cY{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:tY.ID,title:{value:J(0,"Go to Implementations"),original:"Go to Implementations",mnemonicTitle:J(0,"Go to &&Implementations")},precondition:Mo.and(fS.hasImplementationProvider,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:2118,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.45},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}}).ID="editor.action.goToImplementation",tY)),Dh(((iY=class extends cY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:iY.ID,title:{value:J(0,"Peek Implementations"),original:"Peek Implementations"},precondition:Mo.and(fS.hasImplementationProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:3142,weight:100},menu:{id:wh.EditorContextPeek,group:"peek",order:5}})}}).ID="editor.action.peekImplementation",iY));class lY extends nY{_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}}Dh(class extends lY{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:Mo.and(fS.hasReferenceProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),keybinding:{when:fS.editorTextFocus,primary:1094,weight:100},menu:[{id:wh.EditorContext,group:"navigation",order:1.45},{id:wh.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield KQ(t.referenceProvider,i,e,!0,s),J(0,"References"))}))}}),Dh(class extends lY{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:{value:J(0,"Peek References"),original:"Peek References"},precondition:Mo.and(fS.hasReferenceProvider,JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated()),menu:{id:wh.EditorContextPeek,group:"peek",order:6}})}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(yield KQ(t.referenceProvider,i,e,!1,s),J(0,"References"))}))}});class uY extends nY{constructor(t,i,e){super(t,{id:"editor.action.goToLocation",title:{value:J(0,"Go to Any Symbol"),original:"Go to Any Symbol"},precondition:Mo.and(JJ.notInPeekEditor,fS.isInWalkThroughSnippet.toNegated())}),this._references=i,this._gotoMultipleBehaviour=e}_getLocationModel(t,i,e,s){return eY(this,void 0,void 0,(function*(){return new lQ(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""}}uo.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)=>eY(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(Qr),c=yield h.openCodeEditor({resource:i},h.getFocusedCodeEditor());if(uK(c))return c.setPosition(e),c.revealPositionInCenterIfOutsideViewport(e,0),c.invokeWithinContext((t=>{const i=new class extends uY{_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)}))}))}),uo.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)=>eY(void 0,void 0,void 0,(function*(){t.get(lo).executeCommand("editor.action.goToLocations",i,e,s,n,void 0,!0)}))}),uo.registerCommand({id:"editor.action.findReferences",handler:(t,i,e)=>{B(ss.isUri(i)),B(gs.isIPosition(e));const s=t.get($g),n=t.get(Qr);return n.openCodeEditor({resource:i},n.getFocusedCodeEditor()).then((t=>{if(!uK(t)||!t.hasModel())return;const i=TQ.get(t);if(!i)return;const n=mu((i=>KQ(s.referenceProvider,t.getModel(),gs.lift(e),!1,i).then((t=>new lQ(t,J(0,"References")))))),r=new ps(e.lineNumber,e.column,e.lineNumber,e.column);return Promise.resolve(i.toggleWidget(r,n,!1))}))}}),uo.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var aY,dY=function(t,i){return function(e,s){i(e,s,t)}},fY=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 gY=aY=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 BJ(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(aY.ID)}startFindDefinitionFromCursor(t){return fY(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 fY(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 hK(this.editor,15);let n;this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=mu((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>=aY.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+aY.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?VQ(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 rY({openToSide:i,openInPeek:e,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t)}))}isInPeekEditor(t){const i=t.get(Zo);return JJ.inPeekEditor.getValue(i)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};gY.ID="editor.contrib.gotodefinitionatposition",gY.MAX_SOURCE_PREVIEW_LINES=8,gY=aY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,Xr),dY(2,Pa),dY(3,$g)],gY),ru(gY.ID,gY,2);const pY=_l;class mY 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 Gy(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}}class vY extends Hi{static render(t,i,e){return new vY(t,i,e)}constructor(t,i,e){super(),this.actionContainer=Ml(t,pY("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Ml(this.actionContainer,pY("a.action")),this.action.setAttribute("role","button"),i.iconClass&&Ml(this.action,pY(`span.icon.${i.iconClass}`)),Ml(this.action,pY("span")).textContent=e?`${i.label} (${e})`:i.label,this._register(Zc(this.actionContainer,xl.CLICK,(t=>{t.stopPropagation(),t.preventDefault(),i.run(this.actionContainer)}))),this._register(Zc(this.actionContainer,xl.KEY_DOWN,(t=>{const e=new Ph(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 wY{constructor(t,i,e){this.value=t,this.isComplete=i,this.hasLoadingMessage=e}}class bY 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 Eu((()=>this._triggerAsyncComputation()),0)),this._secondWaitScheduler=this._register(new Eu((()=>this._triggerSyncComputation()),0)),this._loadingMessageScheduler=this._register(new Eu((()=>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 Tu(i,(t=>fu(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=gu(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 wY(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 yY{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 kY{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 CY=new class{constructor(){this._participants=[]}register(t){this._participants.push(t)}getAll(){return this._participants}};class SY{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 nl(0,0),this._minSize=new nl(0,0),this._maxSize=new nl(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 nl(i,t);nl.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 xY extends Hi{constructor(t,i=new nl(10,10)){super(),this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new SY),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=nl.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 nl(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 ol(i).top+e.top-30}_availableVerticalSpaceBelow(t){const i=this._editor.getDomNode(),e=this._editor.getScrolledVisiblePosition(t);if(!i||!e)return;const s=ol(i);return el(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 DY,EY,AY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},MY=function(t,i){return function(e,s){i(e,s,t)}};const LY=_l;let OY=DY=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(_Y,this._editor)),this._participants=[];for(const t of CY.getAll())this._participants.push(this._instantiationService.createInstance(t,this._editor));this._participants.sort(((t,i)=>t.hoverOrdinal-i.hoverOrdinal)),this._computer=new PY(this._editor,this._participants),this._hoverOperation=this._register(new bY(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 FY(this._computer.anchor,i,t.isComplete))}))),this._register(Qc(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 yY(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 yY(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 yY(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}=DY.computeHoverRanges(this._editor,t.range,i),r=new Vi,o=r.add(new IY(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:DY._DECORATION_OPTIONS}]),r.add(Wi((()=>{t.clear()})))}this._widget.showAt(h,new RY(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()}};OY._DECORATION_OPTIONS=$M.register({description:"content-hover-highlight",className:"hoverHighlight"}),OY=DY=AY([MY(1,Zr),MY(2,kC)],OY);class FY{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 TY(this,this.anchor,i,this.isComplete)}}class TY extends FY{constructor(t,i,e,s){super(i,e,s),this.original=t}filter(t){return this.original.filter(t)}}class RY{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 _Y=EY=class extends xY{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 nl(150,r);super(t,o),this._configurationService=e,this._accessibilityService=s,this._keybindingService=n,this._hover=this._register(new mY),this._minimumSize=o,this._hoverVisibleKey=fS.hoverVisible.bindTo(i),this._hoverFocusedKey=fS.hoverFocused.bindTo(i),Ml(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(Al(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 EY.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 EY._applyDimensions(this._hover.contentsDomNode,t,i)}_setContainerDomNodeDimensions(t,i){return EY._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){EY._applyMaxDimensions(this._hover.contentsDomNode,t,i),EY._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 nl(e,s),this._setHoverWidgetMaxDimensions(e,s)}_resize(t){var i,e;EY._lastDimensions=new nl(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)?el(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=ol(this.getDomNode());void 0===this._visibleData.closestMouseDistance&&(this._visibleData.closestMouseDistance=NY(this._visibleData.initialMousePosX,this._visibleData.initialMousePosY,e.left,e.top,e.width,e.height));const s=NY(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,EY._lastDimensions.height),i=Math.max(.66*this._editor.getLayoutInfo().width,500,EY._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=ul(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 nl(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(hl(e),Math.min(n,t)),this._setContentsDomNodeDimensions(hl(s),Math.min(n,t-10))}setMinimumDimensions(t){this._minimumSize=new nl(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 nl(t,this._minimumSize.height)}onContentsChanged(){var t;this._removeConstraintsRenderNormally();const i=this._hover.containerDomNode;let e=ul(i),s=hl(i);if(this._resizableNode.layout(e,s),this._setHoverWidgetDimensions(s,e),e=ul(i),s=hl(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=ul(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})}};_Y.ID="editor.contrib.resizableContentHoverWidget",_Y._lastDimensions=new nl(0,0),_Y=EY=AY([MY(1,Zo),MY(2,Oa),MY(3,fm),MY(4,kC)],_Y);let IY=class extends Hi{get hasContent(){return this._hasContent}constructor(t){super(),this._keybindingService=t,this._hasContent=!1,this.hoverElement=LY("div.hover-row.status-bar"),this.actionsElement=Ml(this.hoverElement,LY("div.actions"))}addAction(t){const i=this._keybindingService.lookupKeybinding(t.commandId),e=i?i.getLabel():null;return this._hasContent=!0,this._register(vY.render(this.actionsElement,t,e))}append(t){const i=Ml(this.actionsElement,t);return this._hasContent=!0,i}};IY=AY([MY(0,kC)],IY);class PY{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 Fu.EMPTY;const e=PY._getLineDecorations(this._editor,i);return Fu.merge(this._participants.map((s=>s.computeAsync?s.computeAsync(i,e,t):Fu.EMPTY)))}computeSync(){if(!this._editor.hasModel()||!this._anchor)return[];const t=PY._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 NY(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 BY=_l;class $Y 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 mY),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=this._register(new XG({editor:this._editor},i,e)),this._computer=new jY(this._editor),this._hoverOperation=this._register(new bY(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 $Y.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=BY("div.hover-row.markdown-hover"),s=Ml(i,BY("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`}}$Y.ID="editor.contrib.modesGlyphHoverWidget";class jY{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 WY{constructor(t,i,e){this.provider=t,this.hover=i,this.ordinal=e}}function VY(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 WY(t,r,i)}catch(t){Ai(t)}}))}(t,n,i,e,s)));return Fu.fromPromises(n).coalesce()}iu("_executeHoverProvider",((t,i,e)=>function(t,i,e){return VY(t,i,e,ue.None).map((t=>t.hover)).toPromise()}(t.get($g).hoverProvider,i,e)));var HY=function(t,i){return function(e,s){i(e,s,t)}};const zY=_l;class UY{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 KY=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 UY(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 UY(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 UY(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 UY(this,l,b(c),d,o++))}return r}computeAsync(t,i,e){if(!this._editor.hasModel()||1!==t.type)return Fu.EMPTY;const s=this._editor.getModel();if(!this._languageFeaturesService.hoverProvider.has(s))return Fu.EMPTY;const n=new gs(t.range.startLineNumber,t.range.startColumn);return VY(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 UY(this,e,i.hover.contents,!1,i.ordinal)}))}renderHoverParts(t,i){return qY(t,i,this._editor,this._languageService,this._openerService)}};function qY(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=zY("div.hover-row.markdown-hover"),h=Ml(o,zY("div.hover-contents")),c=r.add(new XG({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}KY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([HY(1,Pa),HY(2,AF),HY(3,Oa),HY(4,$g)],KY);var GY=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},ZY=function(t,i){return function(e,s){i(e,s,t)}};class JY{constructor(t,i,e){this.marker=t,this.index=i,this.total=e}}let QY=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 JY(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 JY(this._markers[e],e+1,this._markers.length)}};QY=GY([ZY(1,FN),ZY(2,Oa)],QY);const YY=Jr("IMarkerNavigationService");let XY=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 QY(t,this._markerService,this._configService)}};var tX;XY=GY([ZY(0,FN),ZY(1,Oa)],XY),$a(YY,XY,1),function(t){t.className=function(t){switch(t){case pO.Ignore:return"severity-ignore "+io.asClassName(ys.info);case pO.Info:return io.asClassName(ys.info);case pO.Warning:return io.asClassName(ys.warning);case pO.Error:return io.asClassName(ys.error);default:return""}}}(tX||(tX={}));var iX,eX=function(t,i){return function(e,s){i(e,s,t)}};class sX{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(Qc(this._relatedBlock,"click",(t=>{t.preventDefault();const i=this._relatedDiagnostics.get(t.target);i&&e(i)}))),this._scrollable=new Ky(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)+2;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);Kc(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=_l("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()},Ml(this._codeLink,_l("span")).innerText=n.value,t.appendChild(this._codeLink)}if(Kc(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 nX=iX=class extends XJ{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=Eg.white,this._applyTheme(i.getColorTheme()),this._callOnDispose.add(i.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(t){this._backgroundColor=t.getColor(gX);let i=cX,e=lX;this._severity===LN.Warning?(i=uX,e=aX):this._severity===LN.Info&&(i=dX,e=fX);const s=t.getColor(i),n=t.getColor(e);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:n,primaryHeadingColor:t.getColor(iQ),secondaryHeadingColor:t.getColor(eQ)})}_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(iX.TitleMenu,this._contextKeyService);iN(e,void 0,i),this._actionbarWidget.push(i,{label:!1,icon:!0,index:0}),e.dispose()}_fillTitleIcon(t){this._icon=Ml(t,_l(""))}_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 sX(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 ${tX.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()}};nX.TitleMenu=new wh("gotoErrorTitleMenu"),nX=iX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([eX(1,pk),eX(2,AF),eX(3,bh),eX(4,Zr),eX(5,Zo),eX(6,eR)],nX);const rX=Mb(bv,yv),oX=Mb(kv,Cv),hX=Mb(Sv,xv),cX=Lm("editorMarkerNavigationError.background",{dark:rX,light:rX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget error color.")),lX=Lm("editorMarkerNavigationError.headerBackground",{dark:Ab(cX,.1),light:Ab(cX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget error heading background.")),uX=Lm("editorMarkerNavigationWarning.background",{dark:oX,light:oX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget warning color.")),aX=Lm("editorMarkerNavigationWarning.headerBackground",{dark:Ab(uX,.1),light:Ab(uX,.1),hcDark:"#0C141F",hcLight:Ab(uX,.2)},J(0,"Editor marker navigation widget warning heading background.")),dX=Lm("editorMarkerNavigationInfo.background",{dark:hX,light:hX,hcDark:_m,hcLight:_m},J(0,"Editor marker navigation widget info color.")),fX=Lm("editorMarkerNavigationInfo.headerBackground",{dark:Ab(dX,.1),light:Ab(dX,.1),hcDark:null,hcLight:null},J(0,"Editor marker navigation widget info heading background.")),gX=Lm("editorMarkerNavigation.background",{dark:Ev,light:Ev,hcDark:Ev,hcLight:Ev},J(0,"Editor marker navigation widget background."));var pX,mX=function(t,i){return function(e,s){i(e,s,t)}},vX=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 wX=pX=class{static get(t){return t.getContribution(pX.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=CX.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(nX,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 vX(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=pX.get(r))||void 0===e||e.close(),null===(s=pX.get(r))||void 0===s||s.nagivate(t,i))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}}))}};wX.ID="editor.contrib.markerController",wX=pX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([mX(1,YY),mX(2,Zo),mX(3,Qr),mX(4,Zr)],wX);class bX extends Yl{constructor(t,i,e){super(e),this._next=t,this._multiFile=i}run(t,i){var e;return vX(this,void 0,void 0,(function*(){i.hasModel()&&(null===(e=wX.get(i))||void 0===e||e.nagivate(this._next,this._multiFile))}))}}class yX extends bX{constructor(){super(!0,!1,{id:yX.ID,label:yX.LABEL,alias:"Go to Next Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:578,weight:100},menuOpts:{menuId:nX.TitleMenu,title:yX.LABEL,icon:GW("marker-navigation-next",ys.arrowDown,J(0,"Icon for goto next marker.")),group:"navigation",order:1}})}}yX.ID="editor.action.marker.next",yX.LABEL=J(0,"Go to Next Problem (Error, Warning, Info)");class kX extends bX{constructor(){super(!1,!1,{id:kX.ID,label:kX.LABEL,alias:"Go to Previous Problem (Error, Warning, Info)",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:1602,weight:100},menuOpts:{menuId:nX.TitleMenu,title:kX.LABEL,icon:GW("marker-navigation-previous",ys.arrowUp,J(0,"Icon for goto previous marker.")),group:"navigation",order:2}})}}kX.ID="editor.action.marker.prev",kX.LABEL=J(0,"Go to Previous Problem (Error, Warning, Info)"),ru(wX.ID,wX,4),su(yX),su(kX),su(class extends bX{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:fS.focus,primary:66,weight:100},menuOpts:{menuId:wh.MenubarGoMenu,title:J(0,"Next &&Problem"),group:"6_problem_nav",order:1}})}}),su(class extends bX{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:fS.focus,primary:1090,weight:100},menuOpts:{menuId:wh.MenubarGoMenu,title:J(0,"Previous &&Problem"),group:"6_problem_nav",order:2}})}});const CX=new Go("markersNavigationVisible",!1);eu(new(Ql.bindToContribution(wX.get))({id:"closeMarkersNavigation",precondition:CX,handler:t=>t.close(),kbOpts:{weight:150,kbExpr:fS.focus,primary:9,secondary:[1033]}}));var SX=function(t,i){return function(e,s){i(e,s,t)}};const xX=_l;class DX{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 EX={type:1,filter:{include:DG.QuickFix},triggerAction:xG.QuickFixHover};let AX=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 DX(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=xX("div.hover-row"),s=Ml(e,xX("div.marker.hover-contents")),{source:n,message:r,code:o,relatedInformation:h}=t.marker;this._editor.applyFontInfo(s);const c=Ml(s,xX("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,n||o)if(o&&"string"!=typeof o){const t=xX("span");n&&(Ml(t,xX("span")).innerText=n);const e=Ml(t,xX("a.code-link"));e.setAttribute("href",o.target.toString()),i.add(Zc(e,"click",(t=>{this._openerService.open(o.target,{allowCommands:!0}),t.preventDefault(),t.stopPropagation()}))),Ml(e,xX("span")).innerText=o.value;const r=Ml(s,t);r.style.opacity="0.6",r.style.paddingLeft="6px"}else{const t=Ml(s,xX("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=Ml(s,xX("div"));o.style.marginTop="8px";const h=Ml(o,xX("a"));h.innerText=`${FE(e)}(${n}, ${r}): `,h.style.cursor="pointer",i.add(Zc(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=Ml(o,xX("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:yX.ID,run:()=>{var e;t.hide(),null===(e=wX.get(this._editor))||void 0===e||e.showAtMarker(i.marker),this._editor.focus()}}),!this._editor.getOption(90)){const s=t.statusBar.append(xX("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(Cu((()=>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:FG,run:i=>{o=!0;const e=OZ.get(this._editor),s=ol(i);t.hide(),null==e||e.showCodeActions(EX,r,{x:s.left,y:s.top,width:s.width,height:s.height})}})}),Ei)}}getCodeActions(t){return mu((i=>$G(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),EX,nR.None,i)))}};AX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([SX(1,rm),SX(2,AF),SX(3,$g)],AX);const MX="editor.action.inlineSuggest.commit",LX="editor.action.inlineSuggest.showPrevious",OX="editor.action.inlineSuggest.showNext";class FX 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 TX((()=>{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===TX.ID)return this.toggleMenuActionViewItem=new LP(t,t.menuActions,i,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:io.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 oo){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 TX extends so{constructor(t,i){i=i||J(0,"More Actions..."),super(TX.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}}TX.ID="toolbar.toggle.more";var RX=function(t,i){return function(e,s){i(e,s,t)}};let _X=class extends FX{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 Sh||i instanceof Ch)&&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,ro.join(a,h)),c.length>0&&this._sessionDisposables.add(Zc(this.getElement(),"contextmenu",(t=>{var i,s,n,r,o;const h=new jh(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]=co({id:l.id,label:l.label,checked:!0,enabled:!1,run(){}});break}}if(!f&&(l instanceof Sh||l instanceof Ch)){if(!l.hideActions)return;a=l.hideActions.hide}else a=co({id:"label",label:J(0,"Hide"),enabled:!1,run(){}});const g=ro.join([a],c);(null===(s=this._options)||void 0===s?void 0:s.resetMenu)&&!e&&(e=[this._options.resetMenu]),d&&e&&(g.push(new ro),g.push(co({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})})))}};_X=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([RX(2,bh),RX(3,Zo),RX(4,AR),RX(5,kC),RX(6,Eh)],_X);var IX,PX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},NX=function(t,i){return function(e,s){i(e,s,t)}};let BX=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(WX,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()})))})))}};BX=PX([NX(2,Zr)],BX);const $X=GW("inline-suggestion-hints-next",ys.chevronRight,J(0,"Icon for show next parameter hint.")),jX=GW("inline-suggestion-hints-previous",ys.chevronLeft,J(0,"Icon for show previous parameter hint."));let WX=IX=class extends Hi{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(t,i,e){const s=new so(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"+IX.id++,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this.nodes=Kl("div.inlineSuggestionsHints",{className:this.withBorder?".withBorder":""},[Kl("div@toolBar")]),this.previousAction=this.createCommandAction(LX,J(0,"Previous"),io.asClassName(jX)),this.availableSuggestionCountAction=new so("inlineSuggestionHints.availableSuggestionCount","",void 0,!1),this.nextAction=this.createCommandAction(OX,J(0,"Next"),io.asClassName($X)),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(wh.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Eu((()=>{this.availableSuggestionCountAction.label=""}),100)),this.disableButtonsDebounced=this._register(new Eu((()=>{this.previousAction.enabled=this.nextAction.enabled=!1}),100)),this.lastCommands=[],this.toolBar=this._register(c.createInstance(zX,this.nodes.toolBar,wh.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:t=>t.startsWith("primary")},actionViewItemProvider:t=>{if(t instanceof Sh)return c.createInstance(HX,t,void 0);if(t===this.availableSuggestionCountAction){const i=new VX(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=>{IX._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 Sh&&s.push(t);s.length>0&&s.unshift(new ro),this.toolBar.setAdditionalSecondaryActions(s)})))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};WX._dropDownVisible=!1,WX.id=0,WX=IX=PX([NX(6,lo),NX(7,Zr),NX(8,kC),NX(9,Zo),NX(10,bh)],WX);class VX 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 HX extends sN{updateLabel(){const t=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!t)return super.updateLabel();if(this.label){const i=Kl("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 zX=class extends _X{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())}};zX=PX([NX(3,bh),NX(4,Zo),NX(5,AR),NX(6,kC),NX(7,Eh)],zX);var UX,KX=function(t,i){return function(e,s){i(e,s,t)}};let qX=UX=class extends Hi{static get(t){return t.getContribution(UX.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 Eu((()=>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!==_Y.ID?12===e.type&&e.detail===$Y.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!==_Y.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!==_Y.ID||!(null===(r=this._contentWidget)||void 0===r?void 0:r.isColorPickerVisible))&&(!this._isHoverSticky||12!==o.type||o.detail!==$Y.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 $Y(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)||WX.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(OY,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()}};qX.ID="editor.contrib.hover",qX=UX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([KX(1,Zr),KX(2,AF),KX(3,Pa),KX(4,kC)],qX),ru(qX.ID,qX,2),su(class extends Yl{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:fS.editorTextFocus,primary:xe(2089,2087),weight:100}})}run(t,i,e){if(!i.hasModel())return;const s=qX.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)}}),su(class extends Yl{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=qX.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=gY.get(i);r&&r.startFindDefinitionFromCursor(s).then((()=>{e.showContentHover(n,1,1,!0)}))}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollUpHover",label:J(0,"Scroll Up Hover"),alias:"Scroll Up Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:16,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollUp()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollDownHover",label:J(0,"Scroll Down Hover"),alias:"Scroll Down Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:18,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollDown()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollLeftHover",label:J(0,"Scroll Left Hover"),alias:"Scroll Left Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:15,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollLeft()}}),su(class extends Yl{constructor(){super({id:"editor.action.scrollRightHover",label:J(0,"Scroll Right Hover"),alias:"Scroll Right Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:17,weight:100}})}run(t,i){const e=qX.get(i);e&&e.scrollRight()}}),su(class extends Yl{constructor(){super({id:"editor.action.pageUpHover",label:J(0,"Page Up Hover"),alias:"Page Up Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:11,secondary:[528],weight:100}})}run(t,i){const e=qX.get(i);e&&e.pageUp()}}),su(class extends Yl{constructor(){super({id:"editor.action.pageDownHover",label:J(0,"Page Down Hover"),alias:"Page Down Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:12,secondary:[530],weight:100}})}run(t,i){const e=qX.get(i);e&&e.pageDown()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToTopHover",label:J(0,"Go To Top Hover"),alias:"Go To Bottom Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:14,secondary:[2064],weight:100}})}run(t,i){const e=qX.get(i);e&&e.goToTop()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToBottomHover",label:J(0,"Go To Bottom Hover"),alias:"Go To Bottom Hover",precondition:fS.hoverFocused,kbOpts:{kbExpr:fS.hoverFocused,primary:13,secondary:[2066],weight:100}})}run(t,i){const e=qX.get(i);e&&e.goToBottom()}}),CY.register(KY),CY.register(AX),yk(((t,i)=>{const e=t.getColor(Yv);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 GX 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!==cJ)return;if(!e.range)return;const s=this._editor.getContribution(qX.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)}}}GX.ID="editor.contrib.colorContribution",ru(GX.ID,GX,2),CY.register(EJ);var ZX,JX,QX=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},XX=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 t0=ZX=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=fS.standaloneColorPickerVisible.bindTo(i),this._standaloneColorPickerFocused=fS.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 i0(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(ZX.ID)}};t0.ID="editor.contrib.standaloneColorPickerController",t0=ZX=QX([YX(1,Zo),YX(2,Yr),YX(3,kC),YX(4,Zr),YX(5,$g),YX(6,cd)],t0),ru(t0.ID,t0,1);let i0=JX=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(MJ,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(Al(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 JX.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 XX(this,void 0,void 0,(function*(){const i=yield this._computeAsync(t);i&&this._onResult.fire(new e0(i.result,i.foundInEditor))}))}_computeAsync(t){return XX(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 ZZ(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 IY(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)}};i0.ID="editor.contrib.standaloneColorPickerWidget",i0=JX=QX([YX(3,Zr),YX(4,Yr),YX(5,kC),YX(6,$g),YX(7,cd)],i0);class e0{constructor(t,i){this.value=t,this.foundInEditor=i}}su(class extends Yl{constructor(){super({id:"editor.action.hideColorPicker",label:J(0,"Hide the Color Picker"),alias:"Hide the Color Picker",precondition:fS.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100}})}run(t,i){var e;null===(e=t0.get(i))||void 0===e||e.hide()}}),su(class extends Yl{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:J(0,"Insert Color with Standalone Color Picker"),alias:"Insert Color with Standalone Color Picker",precondition:fS.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100}})}run(t,i){var e;null===(e=t0.get(i))||void 0===e||e.insertColor()}}),Dh(class extends tu{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:wh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=t0.get(i))||void 0===e||e.showOrFocus()}});class s0{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=s0._createRemoveBlockCommentOperations(new ps(o,f+i.length+1,c,g+1),i,e)):(d=s0._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(FT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.endLineNumber,t.endColumn+e.length))):(s.push(FT.delete(new ps(t.startLineNumber,t.startColumn-i.length,t.startLineNumber,t.startColumn))),s.push(FT.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(FT.replace(new ps(t.startLineNumber,t.startColumn,t.endLineNumber,t.endColumn),i+" "+e)):(n.push(FT.insert(new gs(t.startLineNumber,t.startColumn),i+(s?" ":""))),n.push(FT.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 n0{constructor(t,i,e,s,n,r,o){this.languageConfigurationService=t,this._selection=i,this._tabSize=e,this._type=s,this._insertSpace=n,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(t,i,e,s){t.tokenization.tokenizeIfCheap(i);const n=t.getLanguageIdAtPosition(i,1),r=s.getLanguageConfiguration(n).comments,o=r?r.lineCommentToken:null;if(!o)return null;const h=[];for(let t=0,s=e-i+1;t<s;t++)h[t]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return h}static _analyzeLines(t,i,e,s,n,r,o,h){let c,l=!0;c=0===t||1!==t;for(let h=0,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&&!s0._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=n0._gatherPreflightCommentStrings(e,s,n,h);return null===c?{supported:!1}:n0._analyzeLines(t,i,e,c,s,r,o,h)}_executeLineComments(t,i,e,s){let n;e.shouldRemoveComments?n=n0._createRemoveLineCommentsOperations(e.lines,s.startLineNumber):(n0._normalizeInsertionPoint(t,e.lines,s.startLineNumber,this._tabSize),n=this._createAddLineCommentsOperations(e.lines,s.startLineNumber));const r=new 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?s0._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=s0._createAddBlockCommentOperations(new ps(e.startLineNumber,s+1,e.startLineNumber,i.length+1),r,o,this._insertSpace)}else h=s0._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=n0._gatherPreflightData(this._type,this._insertSpace,t,e.startLineNumber,e.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return s.supported?this._executeLineComments(t,i,s,e):this._executeBlockComment(t,i,e)}computeCursorState(t,i){let e=i.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(e=e.setEndPosition(e.endLineNumber+1,1)),new 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(FT.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(FT.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=n0.nextVisibleColumn(h,s,9===r.charCodeAt(t),1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let h=0,c=i.length;h<c;h++){if(i[h].ignore)continue;const c=t.getLineContent(e+h);let l=0;for(n=0,r=i[h].commentStrOffset;l<o&&n<r;n++)l=n0.nextVisibleColumn(l,s,9===c.charCodeAt(n),1);i[h].commentStrOffset=l>o?n-1:n}}}class r0 extends Yl{constructor(t,i){super(i),this._type=t}run(t,i){const e=t.get(cd);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 n0(e,t.selection,n.tabSize,this._type,r.insertSpace,r.ignoreEmptyLines,t.ignoreFirstLine));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}su(class extends r0{constructor(){super(0,{id:"editor.action.commentLine",label:J(0,"Toggle Line Comment"),alias:"Toggle Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"5_insert",title:J(0,"&&Toggle Line Comment"),order:1}})}}),su(class extends r0{constructor(){super(1,{id:"editor.action.addCommentLine",label:J(0,"Add Line Comment"),alias:"Add Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2081),weight:100}})}}),su(class extends r0{constructor(){super(2,{id:"editor.action.removeCommentLine",label:J(0,"Remove Line Comment"),alias:"Remove Line Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2099),weight:100}})}}),su(class extends Yl{constructor(){super({id:"editor.action.blockComment",label:J(0,"Toggle Block Comment"),alias:"Toggle Block Comment",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"5_insert",title:J(0,"Toggle &&Block Comment"),order:2}})}run(t,i){const e=t.get(cd);if(!i.hasModel())return;const s=i.getOption(23),n=[],r=i.getSelections();for(const t of r)n.push(new s0(t,s.insertSpace,e));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}});var o0,h0=function(t,i){return function(e,s){i(e,s,t)}};let c0=o0=class{static get(t){return t.getContribution(o0.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&&pl(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?wh.SimpleEditorContext:wh.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 Ch){const s=this._getMenuActions(t,i.item.submenu);s.length>0&&(e.push(new oo(i.id,i.label,s)),n++)}else e.push(i),n++;n&&e.push(new ro)}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=ol(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 oo("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 ro),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()}};c0.ID="editor.contrib.contextmenu",c0=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}([h0(1,AR),h0(2,ER),h0(3,Zo),h0(4,kC),h0(5,bh),h0(6,Oa),h0(7,dR)],c0),ru(c0.ID,c0,2),su(class extends Yl{constructor(){super({id:"editor.action.showContextMenu",label:J(0,"Show Editor Context Menu"),alias:"Show Editor Context Menu",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:1092,weight:100}})}run(t,i){var e;null===(e=c0.get(i))||void 0===e||e.showContextMenu()}});class l0{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 u0{constructor(t,i,e){this.cursorState=t,this.scrollTop=i,this.scrollLeft=e}}class a0 extends Hi{static get(t){return t.getContribution(a0.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 l0(i.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(e)||(this._undoStack.push(new u0(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 u0(new l0(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 u0(new l0(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}}a0.ID="editor.contrib.cursorUndoRedoController",ru(a0.ID,a0,0),su(class extends Yl{constructor(){super({id:"cursorUndo",label:J(0,"Cursor Undo"),alias:"Cursor Undo",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:2099,weight:100}})}run(t,i,e){var s;null===(s=a0.get(i))||void 0===s||s.cursorUndo()}}),su(class extends Yl{constructor(){super({id:"cursorRedo",label:J(0,"Cursor Redo"),alias:"Cursor Redo",precondition:void 0})}run(t,i,e){var s;null===(s=a0.get(i))||void 0===s||s.cursorRedo()}});class d0{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 f0(t){return ft?t.altKey:t.ctrlKey}class g0 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)&&(f0(t)&&(this._modifierPressed=!0),this._mouseDown&&f0(t)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(t){this._editor.getOption(35)&&!this._editor.getOption(22)&&(f0(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===g0.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]}f0(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)||(f0(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(i)||this._dragSelection.getStartPosition().equals(i)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(g0.ID,new d0(this._dragSelection,i,f0(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:g0._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()}}g0.ID="editor.contrib.dragAndDrop",g0.TRIGGER_KEY_VALUE=ft?6:5,g0._DECORATION_OPTIONS=$M.register({description:"dnd-target",className:"dnd-target"}),ru(g0.ID,g0,2);const p0=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 m0=function(t,i,e,s){return new(e||(e=Promise))((function(n,r){function o(t){try{c(s.next(t))}catch(t){r(t)}}function h(t){try{c(s.throw(t))}catch(t){r(t)}}function c(t){var i;t.done?n(t.value):(i=t.value,i instanceof e?i:new e((function(t){t(i)}))).then(o,h)}c((s=s.apply(t,i||[])).next())}))};function v0(t){return{asString:()=>m0(this,void 0,void 0,(function*(){return t})),asFile:()=>{},value:"string"==typeof t?t:void 0}}class w0{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"),k0(b0(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 b0(t)}}function b0(t){return t.toLowerCase()}function y0(t,i){return k0(b0(t),i.map(b0))}function k0(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 C0=Object.freeze({create:t=>d(t.map((t=>t.toString()))).join("\r\n"),split:t=>t.split("\r\n"),parse:t=>C0.split(t).filter((t=>!t.startsWith("#")))});ah.add("workbench.contributions.dragAndDrop",new class{});class S0{constructor(){}static getInstance(){return S0.INSTANCE}hasData(t){return t&&t===this.proto}getData(t){if(this.hasData(t))return this.data}}S0.INSTANCE=new S0;var x0=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 D0(t){const i=new w0;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,v0(s))}else if("file"===e.kind){const s=e.getAsFile();s&&i.append(t,E0(s))}}return i}function E0(t){const i=t.path?ss.parse(t.path):void 0;return function(t,i,e){const s={id:p0(),name:t,uri:i,data:e};return{asString:()=>m0(this,void 0,void 0,(function*(){return""})),asFile:()=>s,value:void 0}}(t.name,i,(()=>x0(this,void 0,void 0,(function*(){return new Uint8Array(yield t.arrayBuffer())}))))}const A0=Object.freeze(["CodeEditors","CodeFiles",UR.RESOURCES,UR.INTERNAL_URI_LIST]);function M0(t,i=!1){const e=D0(t),s=e.get(UR.INTERNAL_URI_LIST);if(s)e.replace(Wa.uriList,s);else if(i||!e.has(Wa.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(Wa.uriList,v0(C0.create(i)))}for(const t of A0)e.delete(t);return e}function L0(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 O0=$M.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}});class F0 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=_l(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=t;const i=_l("span.icon");this.domNode.append(i),i.classList.add(...io.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(Zc(this.domNode,xl.CLICK,(()=>{this.delegate.cancel()})))}getId(){return F0.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)}}F0.baseId="editor.widget.inlineProgressWidget";let T0=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=Cu((()=>{const s=ps.fromPositions(t);this._currentDecorations.set([{range:s,options:O0}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(F0,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()}};T0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(2,Zr)],T0);var R0,_0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},I0=function(t,i){return function(e,s){i(e,s,t)}},P0=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 N0=R0=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=_l(".post-edit-widget"),this.button=this._register(new Bj(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Zc(this.domNode,xl.CLICK,(()=>this.showSelector())))}getId(){return R0.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){this._contextMenuService.showContextMenu({getAnchor:()=>{const t=ol(this.button.element);return{x:t.left+t.width,y:t.top+t.height}},getActions:()=>this.edits.allEdits.map(((t,i)=>co({id:"",label:t.label,checked:i===this.edits.activeEditIndex,run:()=>{if(i!==this.edits.activeEditIndex)return this.onSelectNewEdit(i)}})))})}};N0.baseId="editor.widget.postEditWidget",N0=R0=_0([I0(7,AR),I0(8,Zo),I0(9,kC)],N0);let B0=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 P0(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 ST(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=>P0(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(N0,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()}};B0=_0([I0(4,Zr),I0(5,kT)],B0);var $0,j0=function(t,i){return function(e,s){i(e,s,t)}},W0=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 V0="editor.changePasteType",H0=new Go("pasteWidgetVisible",!1,J(0,"Whether the paste widget is showing")),z0="application/vnd.code.copyMetadata";let U0=$0=class extends Hi{static get(t){return t.getContribution($0.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(Zc(h,"copy",(t=>this.handleCopy(t)))),this._register(Zc(h,"cut",(t=>this.handleCopy(t)))),this._register(Zc(h,"paste",(t=>this.handlePaste(t)),!0)),this._pasteProgressManager=this._register(new T0("pasteIntoEditor",t,i)),this._postPasteWidgetManager=this._register(i.createInstance(B0,"pasteIntoEditor",t,H0,{id:V0,label:J(0,"Show paste options...")}))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}pasteAs(t){this._editor.focus();try{this._pasteAsActionContext={preferredId:t},vl().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=D0(t.clipboardData),f=a.flatMap((t=>{var i;return null!==(i=t.copyMimeTypes)&&void 0!==i?i:[]})),g=p0();this.setCopyMetadata(t.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:u});const p=mu((t=>W0(this,void 0,void 0,(function*(){const i=c(yield Promise.all(a.map((i=>W0(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 W0(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=M0(t.clipboardData);o.delete(z0);const h=[...t.clipboardData.types,...null!==(e=null==r?void 0:r.providerCopyMimeTypes)&&void 0!==e?e:[],Wa.uriList],c=this._languageFeaturesService.documentPasteEditProvider.ordered(s).filter((t=>{var i;return null===(i=t.pasteMimeTypes)||void 0===i?void 0:i.some((t=>y0(t,h)))}));c.length&&(t.preventDefault(),t.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferredId,c,n,o,r):this.doPasteInline(c,n,o,r))}))}doPasteInline(t,i,e,s){const n=mu((r=>W0(this,void 0,void 0,(function*(){const o=this._editor;if(!o.hasModel())return;const h=o.getModel(),c=new cK(o,3,void 0,r);try{if(yield this.mergeInDataFromCopy(e,s,c.token),c.token.isCancellationRequested)return;const n=t.filter((t=>K0(t,e)));if(!n.length||1===n.length&&"text"===n[0].id)return void(yield this.applyDefaultPasteHandler(e,s,c.token));const r=yield this.getPasteEdits(n,e,h,i,c.token);if(c.token.isCancellationRequested)return;if(1===r.length&&"text"===r[0].providerId)return void(yield this.applyDefaultPasteHandler(e,s,c.token));if(r.length){const t="afterPaste"===o.getOption(84).showPasteSelector;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(i,{activeEditIndex:0,allEdits:r},t,c.token)}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=mu((o=>W0(this,void 0,void 0,(function*(){const h=this._editor;if(!h.hasModel())return;const c=h.getModel(),l=new cK(h,3,void 0,o);try{if(yield this.mergeInDataFromCopy(s,n,l.token),l.token.isCancellationRequested)return;let r=i.filter((t=>K0(t,s)));t&&(r=r.filter((i=>i.id===t)));const o=yield this.getPasteEdits(r,s,c,e,l.token);if(l.token.isCancellationRequested)return;if(!o.length)return;let h;if(t)h=o.at(0);else{const t=yield this._quickInputService.pick(o.map((t=>({label:t.label,description:t.providerId,detail:t.detail,edit:t}))),{placeHolder:J(0,"Select Paste Action")});h=null==t?void 0:t.edit}if(!h)return;const u=function(t,i,e){var s,n;return{edits:[...i.map((i=>new ST(t,"string"==typeof e.insertText?{range:i,text:e.insertText,insertAsSnippet:!1}:{range:i,text:e.insertText.snippet,insertAsSnippet:!0}))),...null!==(n=null===(s=e.additionalEdit)||void 0===s?void 0:s.edits)&&void 0!==n?n:[]]}}(c.uri,e,h);yield this._bulkEditService.apply(u,{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(z0,JSON.stringify(i))}fetchCopyMetadata(t){var i;if(!t.clipboardData)return;const e=t.clipboardData.getData(z0);if(e)try{return JSON.parse(e)}catch(t){return}const[s,n]=lk.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 W0(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(Wa.uriList)){const i=yield this._clipboardService.readResources();if(e.isCancellationRequested)return;i.length&&t.append(Wa.uriList,v0(C0.create(i)))}}))}getPasteEdits(t,i,e,s,n){return W0(this,void 0,void 0,(function*(){const r=yield vu(Promise.all(t.map((t=>W0(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 L0(c(null!=r?r:[]))}))}applyDefaultPasteHandler(t,i,e){var s,n,r;return W0(this,void 0,void 0,(function*(){const o=null!==(s=t.get(Wa.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 K0(t,i){var e;return Boolean(null===(e=t.pasteMimeTypes)||void 0===e?void 0:e.some((t=>i.matches(t))))}U0.ID="editor.contrib.copyPasteActionController",U0=$0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([j0(1,Zr),j0(2,kT),j0(3,EV),j0(4,$g),j0(5,Ij),j0(6,sR)],U0);var q0=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},G0=function(t,i){return function(e,s){i(e,s,t)}},Z0=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 J0=J(0,"Built-in");class Q0{provideDocumentPasteEdits(t,i,e,s){return Z0(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 Z0(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 Y0 extends Q0{constructor(){super(...arguments),this.id="text",this.dropMimeTypes=[Wa.text],this.pasteMimeTypes=[Wa.text]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const i=t.get(Wa.text);if(!i)return;if(t.has(Wa.uriList))return;const e=yield i.asString();return{handledMimeType:Wa.text,label:J(0,"Insert Plain Text"),detail:J0,insertText:e}}))}}class X0 extends Q0{constructor(){super(...arguments),this.id="uri",this.dropMimeTypes=[Wa.uriList],this.pasteMimeTypes=[Wa.uriList]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const e=yield i1(t);if(!e.length||i.isCancellationRequested)return;let s=0;const n=e.map((({uri:t,originalText:i})=>t.scheme===jc.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:Wa.uriList,insertText:n,label:r,detail:J0}}))}}let t1=class extends Q0{constructor(t){super(),this._workspaceContextService=t,this.id="relativePath",this.dropMimeTypes=[Wa.uriList],this.pasteMimeTypes=[Wa.uriList]}getEdit(t,i){return Z0(this,void 0,void 0,(function*(){const e=yield i1(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:Wa.uriList,insertText:s.join(" "),label:J(0,e.length>1?"Insert Relative Paths":"Insert Relative Path"),detail:J0}:void 0}))}};function i1(t){return Z0(this,void 0,void 0,(function*(){const i=t.get(Wa.uriList);if(!i)return[];const e=yield i.asString(),s=[];for(const t of C0.parse(e))try{s.push({uri:ss.parse(t),originalText:t})}catch(t){}return s}))}t1=q0([G0(0,dR)],t1);let e1=class extends Hi{constructor(t,i){super(),this._register(t.documentOnDropEditProvider.register("*",new Y0)),this._register(t.documentOnDropEditProvider.register("*",new X0)),this._register(t.documentOnDropEditProvider.register("*",new t1(i)))}};e1=q0([G0(0,$g),G0(1,dR)],e1);let s1=class extends Hi{constructor(t,i){super(),this._register(t.documentPasteEditProvider.register("*",new Y0)),this._register(t.documentPasteEditProvider.register("*",new X0)),this._register(t.documentPasteEditProvider.register("*",new t1(i)))}};s1=q0([G0(0,$g),G0(1,dR)],s1),ru(U0.ID,U0,0),tH(s1),eu(new class extends Ql{constructor(){super({id:V0,precondition:H0,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;return null===(s=U0.get(i))||void 0===s?void 0:s.changePasteType()}}),su(class extends Yl{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=U0.get(i))||void 0===s?void 0:s.pasteAs(n)}});class n1{constructor(t){this.identifier=t}}const r1=Jr("treeViewsDndService");$a(r1,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 o1,h1=function(t,i){return function(e,s){i(e,s,t)}},c1=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 l1="editor.experimental.dropIntoEditor.defaultProvider",u1="editor.changeDropType",a1=new Go("dropWidgetVisible",!1,J(0,"Whether the drop widget is showing"));let d1=o1=class extends Hi{static get(t){return t.getContribution(o1.ID)}constructor(t,i,e,s,n){super(),this._configService=e,this._languageFeaturesService=s,this._treeViewsDragAndDropService=n,this.treeItemsTransfer=S0.getInstance(),this._dropProgressManager=this._register(i.createInstance(T0,"dropIntoEditor",t)),this._postDropWidgetManager=this._register(i.createInstance(B0,"dropIntoEditor",t,a1,{id:u1,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 c1(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=mu((s=>c1(this,void 0,void 0,(function*(){const r=new cK(t,1,void 0,s);try{const n=yield this.extractDataTransferData(e);if(0===n.size||r.token.isCancellationRequested)return;const o=t.getModel();if(!o)return;const h=this._languageFeaturesService.documentOnDropEditProvider.ordered(o).filter((t=>!t.dropMimeTypes||t.dropMimeTypes.some((t=>n.matches(t))))),c=yield this.getDropEdits(h,o,i,n,r);if(r.token.isCancellationRequested)return;if(c.length){const e=this.getInitialActiveEditIndex(o,c),n="afterDrop"===t.getOption(36).showDropSelector;yield this._postDropWidgetManager.applyEditAndShowIfNeeded([ps.fromPositions(i)],{activeEditIndex:e,allEdits:c},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 c1(this,void 0,void 0,(function*(){const r=yield vu(Promise.all(t.map((t=>c1(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 L0(c(null!=r?r:[]))}))}getInitialActiveEditIndex(t,i){const e=this._configService.getValue(l1,{resource:t.uri});for(const[t,s]of Object.entries(e)){const e=i.findIndex((i=>s===i.providerId&&i.handledMimeType&&y0(t,[i.handledMimeType])));if(e>=0)return e}return 0}extractDataTransferData(t){return c1(this,void 0,void 0,(function*(){if(!t.dataTransfer)return new w0;const i=M0(t.dataTransfer);if(this.treeItemsTransfer.hasData(n1.prototype)){const t=this.treeItemsTransfer.getData(n1.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}))}};d1.ID="editor.contrib.dropIntoEditorController",d1=o1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([h1(1,Zr),h1(2,Oa),h1(3,$g),h1(4,r1)],d1),ru(d1.ID,d1,2),eu(new class extends Ql{constructor(){super({id:u1,precondition:a1,kbOpts:{weight:100,primary:2137}})}runEditorCommand(t,i,e){var s;null===(s=d1.get(i))||void 0===s||s.changeDropType()}}),tH(e1),ah.as(za).registerConfiguration(Object.assign(Object.assign({},ET),{properties:{[l1]:{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 f1{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===f1._FIND_MATCH_DECORATION||i===f1._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,f1._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),null!==i&&(this._highlightedDecorationId=i,t.changeDecorationOptions(this._highlightedDecorationId,f1._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,f1._RANGE_HIGHLIGHT_DECORATION)}})),e}set(t,i){this._editor.changeDecorations((e=>{let s=f1._FIND_MATCH_DECORATION;const n=[];if(t.length>1e3){s=f1._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:f1._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),o=e.startLineNumber,h=e.endLineNumber)}n.push({range:new ps(o,1,h,1),options:f1._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,f1._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}}f1._CURRENT_FIND_MATCH_DECORATION=$M.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",showIfCollapsed:!0,overviewRuler:{color:mk(db),position:Qd.Center},minimap:{color:mk(gb),position:Xd.Inline}}),f1._FIND_MATCH_DECORATION=$M.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",showIfCollapsed:!0,overviewRuler:{color:mk(db),position:Qd.Center},minimap:{color:mk(gb),position:Xd.Inline}}),f1._FIND_MATCH_NO_OVERVIEW_DECORATION=$M.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),f1._FIND_MATCH_ONLY_OVERVIEW_DECORATION=$M.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:mk(db),position:Qd.Center}}),f1._RANGE_HIGHLIGHT_DECORATION=$M.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),f1._FIND_SCOPE_DECORATION=$M.register({description:"find-scope",className:"findScope",isWholeLine:!0});class g1{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 p1(t,i){if(t&&""!==t[0]){const e=m1(t,i,"-"),s=m1(t,i,"_");return e&&!s?v1(t,i,"-"):!e&&s?v1(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 m1(t,i,e){return-1!==t[0].indexOf(e)&&-1!==i.indexOf(e)&&t[0].split(e).length===i.split(e).length}function v1(t,i,e){const s=i.split(e),n=t[0].split(e);let r="";return s.forEach(((t,i)=>{r+=p1([n[i]],t)+e})),r.slice(0,-1)}class w1{constructor(t){this.staticValue=t,this.kind=0}}class b1{constructor(t){this.pieces=t,this.kind=1}}class y1{static fromStaticValue(t){return new y1([k1.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 w1(t[0].staticValue):new b1(t):new w1("")}buildReplaceString(t,i){if(0===this._state.kind)return i?p1(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=y1._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 k1{static staticValue(t){return new k1(t,-1,null)}static caseOps(t,i){return new k1(null,t,i)}constructor(t,i,e){this.staticValue=t,this.matchIndex=i,this.caseOps=e&&0!==e.length?e.slice(0):null}}class C1{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++]=k1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=k1.caseOps(t,e),this._lastCharIndex=i}finalize(){return this.emitUnchanged(this._source.length),0!==this._currentStaticPiece.length&&(this._result[this._resultLen++]=k1.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new y1(this._result)}}const S1=new Go("findWidgetVisible",!1);S1.toNegated();const x1=new Go("findInputFocussed",!1),D1=new Go("replaceInputFocussed",!1),E1={primary:545,mac:{primary:2593}},A1={primary:565,mac:{primary:2613}},M1={primary:560,mac:{primary:2608}},L1={primary:554,mac:{primary:2602}},O1={primary:558,mac:{primary:2606}},F1="editor.action.nextMatchFindAction",T1="editor.action.previousMatchFindAction",R1="closeFindWidget",_1="toggleFindCaseSensitive",I1="toggleFindWholeWord",P1="toggleFindRegex",N1="toggleFindInSelection",B1="togglePreserveCase",$1="editor.action.replaceOne",j1="editor.action.replaceAll",W1=19999;class V1{constructor(t,i){this._toDispose=new Vi,this._editor=t,this._state=i,this._isDisposed=!1,this._startSearchingTimer=new xu,this._decorations=new f1(t),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Eu((()=>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,W1);this._decorations.set(s,e);const n=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(n);if(0===r&&s.length>0){const t=Ef(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()<W1){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=V1._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()<W1){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=V1._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 y1(null);const i=[],e=new C1(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):y1.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 NC(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=>V1._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>=W1?this._largeReplaceAll():this._regularReplaceAll(t),this.research(!1)}_largeReplaceAll(){const t=new uf(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 WC(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 g1(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 H1 extends Fy{constructor(t,i,e){super(),this._hideSoon=this._register(new Eu((()=>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:Em(Vm),inputActiveOptionForeground:Em(zm),inputActiveOptionBackground:Em(Hm)};this.caseSensitive=this._register(new pB(Object.assign({appendTitle:this._keybindingLabelFor(_1),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(I1),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(P1),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(Zc(this._domNode,xl.MOUSE_LEAVE,(()=>this._onMouseLeave()))),this._register(Zc(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 H1.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 z1(t,i){return 1===t||2!==t&&i}H1.ID="editor.contrib.findOptionsWidget";class U1 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 z1(this._isRegexOverride,this._isRegex)}get wholeWord(){return z1(this._wholeWordOverride,this._wholeWord)}get matchCase(){return z1(this._matchCaseOverride,this._matchCase)}get preserveCase(){return z1(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>=W1}}const K1=J(0,"input"),q1=J(0,"Preserve Case");class G1 extends aB{constructor(t){super({icon:ys.preserveCase,title:q1+t.appendTitle,isChecked:t.isChecked,inputActiveOptionBorder:t.inputActiveOptionBorder,inputActiveOptionForeground:t.inputActiveOptionForeground,inputActiveOptionBackground:t.inputActiveOptionBackground})}}class Z1 extends Fy{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||K1;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 G1(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(),Dl(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 J1=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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 Y1=new Go("suggestWidgetVisible",!1,J(0,"Whether suggestion are visible")),X1="historyNavigationWidgetFocus",t2="historyNavigationForwardsEnabled",i2="historyNavigationBackwardsEnabled";let e2;const s2=[];function n2(t,i){if(s2.includes(i))throw new Error("Cannot register the same widget multiple times");s2.push(i);const e=new Vi,s=new Go(X1,!1).bindTo(t),n=new Go(t2,!0).bindTo(t),r=new Go(i2,!0).bindTo(t),o=()=>{s.set(!0),e2=i},h=()=>{s.set(!1),e2===i&&(e2=void 0)};return i.element===document.activeElement&&o(),e.add(i.onDidFocus((()=>o()))),e.add(i.onDidBlur((()=>h()))),e.add(Wi((()=>{s2.splice(s2.indexOf(i),1),h()}))),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:r,dispose(){e.dispose()}}}let r2=class extends xB{constructor(t,i,e,s){super(t,i,e);const n=this._register(s.createScoped(this.inputBox.element));this._register(n2(n,this.inputBox))}};r2=J1([Q1(3,Zo)],r2);let o2=class extends Z1{constructor(t,i,e,s,n=!1){super(t,i,n,e);const r=this._register(s.createScoped(this.inputBox.element));this._register(n2(r,this.inputBox))}};function h2(t){var i,e;return"Up"===(null===(i=t.lookupKeybinding("history.showPrevious"))||void 0===i?void 0:i.getElectronAccelerator())&&"Down"===(null===(e=t.lookupKeybinding("history.showNext"))||void 0===e?void 0:e.getElectronAccelerator())}o2=J1([Q1(3,Zo)],o2),fh.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:Mo.and(Mo.has(X1),Mo.equals(i2,!0),Mo.not("isComposing"),Y1.isEqualTo(!1)),primary:16,secondary:[528],handler:()=>{null==e2||e2.showPreviousValue()}}),fh.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:Mo.and(Mo.has(X1),Mo.equals(t2,!0),Mo.not("isComposing"),Y1.isEqualTo(!1)),primary:18,secondary:[530],handler:()=>{null==e2||e2.showNextValue()}});const c2=GW("find-selection",ys.selection,J(0,"Icon for 'Find in Selection' in the editor find widget.")),l2=GW("find-collapsed",ys.chevronRight,J(0,"Icon to indicate that the editor find widget is collapsed.")),u2=GW("find-expanded",ys.chevronDown,J(0,"Icon to indicate that the editor find widget is expanded.")),a2=GW("find-replace",ys.replace,J(0,"Icon for 'Replace' in the editor find widget.")),d2=GW("find-replace-all",ys.replaceAll,J(0,"Icon for 'Replace All' in the editor find widget.")),f2=GW("find-previous-match",ys.arrowUp,J(0,"Icon for 'Find Previous' in the editor find widget.")),g2=GW("find-next-match",ys.arrowDown,J(0,"Icon for 'Find Next' in the editor find widget.")),p2=J(0,"Find / Replace"),m2=J(0,"Find"),v2=J(0,"Find"),w2=J(0,"Previous Match"),b2=J(0,"Next Match"),y2=J(0,"Find in Selection"),k2=J(0,"Close"),C2=J(0,"Replace"),S2=J(0,"Replace"),x2=J(0,"Replace"),D2=J(0,"Replace All"),E2=J(0,"Toggle Replace"),A2=J(0,"Only the first {0} results are highlighted, but all find operations work on the entire text.",W1),M2=J(0,"{0} of {1}"),L2=J(0,"No results"),O2=419;let F2=69;const T2="ctrlEnterReplaceAll.windows.donotask",R2=ft?256:2048;class _2{constructor(t){this.afterLineNumber=t,this.heightInPx=33,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function I2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionStart>0&&t.stopPropagation()}function P2(t,i,e){const s=!!i.match(/\n/);e&&s&&e.selectionEnd<e.value.length&&t.stopPropagation()}class N2 extends Fy{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(T2,0),this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new bu(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 _2(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=x1.bindTo(r),this._findFocusTracker=this._register(Al(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=D1.bindTo(r),this._replaceFocusTracker=this._register(Al(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 _2(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 N2.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=hl(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=F2+"px",this._matchesCount.title=this._state.matchesCount>=W1?A2:"",this._matchesCount.firstChild&&this._matchesCount.removeChild(this._matchesCount.firstChild),this._state.matchesCount>0){let i=String(this._state.matchesCount);this._state.matchesCount>=W1&&(i+="+");let e=String(this._state.matchesPosition);"0"===e&&(e="?"),t=Fn(M2,e,i)}else t=L2;this._matchesCount.appendChild(document.createTextNode(t)),em(this._getAriaLabel(t,this._state.currentMatch,this._state.searchString)),F2=Math.max(F2,this._matchesCount.clientWidth)}_getAriaLabel(t,i,e){if(t===L2)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=ol(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=rl(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 _2(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(!qc(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&&hl(this._domNode)>O2)return this._domNode.style.maxWidth=i-28-e-15+"px",void(this._replaceInput.width=hl(this._findInput.domNode));if(447+e>=i&&(n=!0),447+e-F2>=i&&(r=!0),447+e-F2>=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=hl(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|R2)?(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)?I2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):t.equals(18)?P2(t,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea")):void 0}_onReplaceInputKeyDown(t){return t.equals(3|R2)?(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(T2,!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)?I2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):t.equals(18)?P2(t,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea")):void 0}getVerticalSashLeft(t){return 0}_keybindingLabelFor(t){const i=this._keybindingService.lookupKeybinding(t);return i?` (${i.getLabel()})`:""}_buildDomNode(){this._findInput=this._register(new r2(null,this._contextViewProvider,{width:221,label:m2,placeholder:v2,appendCaseSensitiveLabel:this._keybindingLabelFor(_1),appendWholeWordsLabel:this._keybindingLabelFor(I1),appendRegexLabel:this._keybindingLabelFor(P1),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:()=>h2(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 B2({label:w2+this._keybindingLabelFor(T1),icon:f2,onTrigger:()=>{$(this._codeEditor.getAction(T1)).run().then(void 0,Ei)}})),this._nextBtn=this._register(new B2({label:b2+this._keybindingLabelFor(F1),icon:g2,onTrigger:()=>{$(this._codeEditor.getAction(F1)).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:c2,title:y2+this._keybindingLabelFor(N1),isChecked:!1,inputActiveOptionBackground:Em(Hm),inputActiveOptionBorder:Em(Vm),inputActiveOptionForeground:Em(zm)})),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 B2({label:k2+this._keybindingLabelFor(R1),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 o2(null,void 0,{label:C2,placeholder:S2,appendPreserveCaseLabel:this._keybindingLabelFor(B1),history:[],flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>h2(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 B2({label:x2+this._keybindingLabelFor($1),icon:a2,onTrigger:()=>{this._controller.replace()},onKeyDown:t=>{t.equals(1026)&&(this._closeBtn.focus(),t.preventDefault())}})),this._replaceAllBtn=this._register(new B2({label:D2+this._keybindingLabelFor(j1),icon:d2,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 B2({label:E2,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=hl(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=p2,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=O2;this._register(this._resizeSash.onDidStart((()=>{n=hl(this._domNode)}))),this._register(this._resizeSash.onDidChange((t=>{this._resized=!0;const i=n+t.startX-t.currentX;i<O2||i>(parseFloat(il(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${i}px`,this._isReplaceVisible&&(this._replaceInput.width=hl(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())}))),this._register(this._resizeSash.onDidReset((()=>{const t=hl(this._domNode);if(t<O2)return;let i=O2;if(!this._resized||t===O2){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=hl(this._findInput.domNode)),this._findInput.inputBox.layout()})))}updateAccessibilitySupport(){const t=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(2!==t)}}N2.ID="editor.contrib.findWidget";class B2 extends Fy{constructor(t){super(),this._opts=t;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+io.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(...io.asClassNameArray(l2)),this._domNode.classList.add(...io.asClassNameArray(u2))):(this._domNode.classList.remove(...io.asClassNameArray(u2)),this._domNode.classList.add(...io.asClassNameArray(l2)))}}yk(((t,i)=>{const e=(t,e)=>{e&&i.addRule(`.monaco-editor ${t} { background-color: ${e}; }`)};e(".findMatch",t.getColor(Kv)),e(".currentFindMatch",t.getColor(Uv)),e(".findScope",t.getColor(qv)),e(".find-widget",t.getColor(Mv));const s=t.getColor(Nm);s&&i.addRule(`.monaco-editor .find-widget { box-shadow: 0 0 8px 2px ${s}; }`);const n=t.getColor(Bm);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(Zv);r&&i.addRule(`.monaco-editor .findMatch { border: 1px ${ry(t.type)?"dotted":"solid"} ${r}; box-sizing: border-box; }`);const o=t.getColor(Gv);o&&i.addRule(`.monaco-editor .currentFindMatch { border: 2px solid ${o}; padding: 1px; box-sizing: border-box; }`);const h=t.getColor(Jv);h&&i.addRule(`.monaco-editor .findScope { border: 1px ${ry(t.type)?"dashed":"solid"} ${h}; }`);const c=t.getColor(_m);c&&i.addRule(`.monaco-editor .find-widget { border: 1px solid ${c}; }`);const l=t.getColor(Lv);l&&i.addRule(`.monaco-editor .find-widget { color: ${l}; }`);const u=t.getColor(Fm);u&&i.addRule(`.monaco-editor .find-widget.no-results .matchesCount { color: ${u}; }`);const a=t.getColor(Fv);if(a)i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${a}; }`);else{const e=t.getColor(Ov);e&&i.addRule(`.monaco-editor .find-widget .monaco-sash { background-color: ${e}; }`)}const d=t.getColor(Xw);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(Rm);f&&i.addRule(`.monaco-editor .find-widget .monaco-inputbox.synthetic-focus { outline-color: ${f}; }`)}));var $2,j2=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},W2=function(t,i){return function(e,s){i(e,s,t)}},V2=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 H2(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 z2=$2=class extends Hi{get editor(){return this._editor}static get(t){return t.getContribution($2.ID)}constructor(t,i,e,s,n){super(),this._editor=t,this._findWidgetVisible=S1.bindTo(i),this._contextKeyService=i,this._storageService=e,this._clipboardService=s,this._notificationService=n,this._updateHistoryDelayer=new bu(500),this._state=this._register(new U1),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!!x1.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 V2(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=H2(this._editor,t.seedSearchStringFromSelection,t.seedSearchStringFromNonEmptySelection);i&&(e.searchString=this._state.isRegex?Rn(i):i)}else if("multiple"===t.seedSearchStringFromSelection&&!t.updateSearchScope){const i=H2(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 V1(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 V2(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)}};z2.ID="editor.contrib.findController",z2=$2=j2([W2(1,Zo),W2(2,PP),W2(3,EV),W2(4,vO)],z2);let U2=class extends z2{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 V2(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 N2(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._themeService,this._storageService,this._notificationService)),this._findOptionsWidget=this._register(new H1(this._editor,this._state,this._keybindingService))}};U2=j2([W2(1,ER),W2(2,Zo),W2(3,kC),W2(4,pk),W2(5,vO),W2(6,PP),W2(7,EV)],U2),nu(new Xl({id:"actions.find",label:J(0,"Find"),alias:"Find",precondition:Mo.or(fS.focus,Mo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"3_find",title:J(0,"&&Find"),order:1}})).addImplementation(0,((t,i)=>{const e=z2.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 K2={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 q2 extends Yl{run(t,i){return V2(this,void 0,void 0,(function*(){const t=z2.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 G2 extends Yl{run(t,i){return V2(this,void 0,void 0,(function*(){const t=z2.get(i);if(!t)return;const e=H2(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))}))}}nu(new Xl({id:"editor.action.startFindReplaceAction",label:J(0,"Replace"),alias:"Replace",precondition:Mo.or(fS.focus,Mo.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:wh.MenubarEditMenu,group:"3_find",title:J(0,"&&Replace"),order:2}})).addImplementation(0,((t,i)=>{if(!i.hasModel()||i.getOption(90))return!1;const e=z2.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})})),ru(z2.ID,U2,0),su(class extends Yl{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:K2})}run(t,i,e){return V2(this,void 0,void 0,(function*(){const t=z2.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)}}))}}),su(class extends Yl{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 V2(this,void 0,void 0,(function*(){const t=z2.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))}))}}),su(class extends q2{constructor(){super({id:F1,label:J(0,"Find Next"),alias:"Find Next",precondition:void 0,kbOpts:[{kbExpr:fS.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:Mo.and(fS.focus,x1),primary:3,weight:100}]})}_run(t){return!!t.moveToNextMatch()&&(t.editor.pushUndoStop(),!0)}}),su(class extends q2{constructor(){super({id:T1,label:J(0,"Find Previous"),alias:"Find Previous",precondition:void 0,kbOpts:[{kbExpr:fS.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:Mo.and(fS.focus,x1),primary:1027,weight:100}]})}_run(t){return t.moveToPrevMatch()}}),su(class extends Yl{constructor(){super({id:"editor.action.goToMatchFindAction",label:J(0,"Go to Match..."),alias:"Go to Match...",precondition:S1}),this._highlightDecorations=[]}run(t,i,e){const s=z2.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:mk(Gk),position:Qd.Full}}}])}))}}),su(class extends G2{constructor(){super({id:"editor.action.nextSelectionMatchFindAction",label:J(0,"Find Next Selection"),alias:"Find Next Selection",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:2109,weight:100}})}_run(t){return t.moveToNextMatch()}}),su(class extends G2{constructor(){super({id:"editor.action.previousSelectionMatchFindAction",label:J(0,"Find Previous Selection"),alias:"Find Previous Selection",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:3133,weight:100}})}_run(t){return t.moveToPrevMatch()}});const Z2=Ql.bindToContribution(z2.get);eu(new Z2({id:R1,precondition:S1,handler:t=>t.closeFindWidget(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:9,secondary:[1033]}})),eu(new Z2({id:_1,precondition:void 0,handler:t=>t.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:fS.focus,primary:E1.primary,mac:E1.mac,win:E1.win,linux:E1.linux}})),eu(new Z2({id:I1,precondition:void 0,handler:t=>t.toggleWholeWords(),kbOpts:{weight:105,kbExpr:fS.focus,primary:A1.primary,mac:A1.mac,win:A1.win,linux:A1.linux}})),eu(new Z2({id:P1,precondition:void 0,handler:t=>t.toggleRegex(),kbOpts:{weight:105,kbExpr:fS.focus,primary:M1.primary,mac:M1.mac,win:M1.win,linux:M1.linux}})),eu(new Z2({id:N1,precondition:void 0,handler:t=>t.toggleSearchScope(),kbOpts:{weight:105,kbExpr:fS.focus,primary:L1.primary,mac:L1.mac,win:L1.win,linux:L1.linux}})),eu(new Z2({id:B1,precondition:void 0,handler:t=>t.togglePreserveCase(),kbOpts:{weight:105,kbExpr:fS.focus,primary:O1.primary,mac:O1.mac,win:O1.win,linux:O1.linux}})),eu(new Z2({id:$1,precondition:S1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:fS.focus,primary:3094}})),eu(new Z2({id:$1,precondition:S1,handler:t=>t.replace(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,D1),primary:3}})),eu(new Z2({id:j1,precondition:S1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:fS.focus,primary:2563}})),eu(new Z2({id:j1,precondition:S1,handler:t=>t.replaceAll(),kbOpts:{weight:105,kbExpr:Mo.and(fS.focus,D1),primary:void 0,mac:{primary:2051}}})),eu(new Z2({id:"editor.action.selectAllMatches",precondition:S1,handler:t=>t.selectAllMatches(),kbOpts:{weight:105,kbExpr:fS.focus,primary:515}}));const J2={0:" ",1:"u",2:"r"},Q2=16777215,Y2=4278190080;class X2{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 t4{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 X2(t.length),this._userDefinedStates=new X2(t.length),this._recoveredStates=new X2(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 i4(this,t)}getParentIndex(t){this.ensureParentIndices();const i=((this._startIndexes[t]&Y2)>>>24)+((this._endIndexes[t]&Y2)>>>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]=`[${J2[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 t4(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 i4{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 e4{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 t4(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(t4.fromFoldRanges(i))}update(t,i=[]){const e=this._currentFoldedOrManualRanges(i),s=t4.sanitizeAndMerge(t,e,this._textModel.getLineCount());this.updatePost(t4.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=t4.sanitizeAndMerge(this._regions,s,n);this.updatePost(t4.fromFoldRanges(r))}_getLinesChecksum(t,i){return kd(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 s4(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 n4(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 r4(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 o4(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 h4(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 c4(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 l4{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!==oD(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!==u4(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=u4(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 u4(t,i){const e=Ef(t,(t=>i<t.startLineNumber))-1;return e>=0&&t[e].endLineNumber>=i?t[e]:null}class a4{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=f4){const n=t.getOptions().tabSize,r=new d4(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=qS(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 d4{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 t4(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=qS(t.getLineContent(l),n);(u<s||u===s&&e++<i)&&(r[c]=l,o[c]=this._endIndexes[h],c++)}return new t4(r,o)}}}const f4={limit:5e3,update:()=>{}},g4=Lm("editor.foldBackground",{light:Ab(Wv,.3),dark:Ab(Wv,.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);Lm("editorGutter.foldingControlForeground",{dark:Tm,light:Tm,hcDark:Tm,hcLight:Tm},J(0,"Color of the folding control in the editor gutter."));const p4=GW("folding-expanded",ys.chevronDown,J(0,"Icon for expanded ranges in the editor glyph margin.")),m4=GW("folding-collapsed",ys.chevronRight,J(0,"Icon for collapsed ranges in the editor glyph margin.")),v4=GW("folding-manual-collapsed",m4,J(0,"Icon for manually collapsed ranges in the editor glyph margin.")),w4=GW("folding-manual-expanded",p4,J(0,"Icon for manually expanded ranges in the editor glyph margin.")),b4={color:mk(g4),position:Xd.Inline};class y4{constructor(t){this.editor=t,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(t,i,e){return i?y4.HIDDEN_RANGE_DECORATION:"never"===this.showFoldingControls?t?this.showFoldingHighlights?y4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:y4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:y4.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?e?this.showFoldingHighlights?y4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:y4.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?y4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:y4.COLLAPSED_VISUAL_DECORATION:"mouseover"===this.showFoldingControls?e?y4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:y4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e?y4.MANUALLY_EXPANDED_VISUAL_DECORATION:y4.EXPANDED_VISUAL_DECORATION}changeDecorations(t){return this.editor.changeDecorations(t)}removeDecorations(t){this.editor.removeDecorations(t)}}y4.COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:io.asClassName(m4)}),y4.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(m4)}),y4.MANUALLY_COLLAPSED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,firstLineDecorationClassName:io.asClassName(v4)}),y4.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=$M.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(v4)}),y4.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0}),y4.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:b4,isWholeLine:!0}),y4.EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+io.asClassName(p4)}),y4.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(p4)}),y4.MANUALLY_EXPANDED_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+io.asClassName(w4)}),y4.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=$M.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:io.asClassName(w4)}),y4.NO_CONTROLS_EXPANDED_RANGE_DECORATION=$M.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),y4.HIDDEN_RANGE_DECORATION=$M.register({description:"folding-hidden-range-decoration",stickiness:1});const k4={};class C4{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,k4,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 S4(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 S4{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 t4(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 t4(s,n,r)}}}var x4,D4=function(t,i){return function(e,s){i(e,s,t)}};const E4=new Go("foldingEnabled",!1);let A4=x4=class extends Hi{static get(t){return t.getContribution(x4.ID)}static getFoldingRangeProviders(t,i){var e,s;const n=t.foldingRangeProvider.ordered(i);return null!==(s=null===(e=x4._foldingRangeSelector)||void 0===e?void 0:e.call(x4,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 M4(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 y4(t),this.foldingDecorationProvider.showFoldingControls=o.get(109),this.foldingDecorationProvider.showFoldingHighlights=o.get(45),this.foldingEnabled=E4.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 e4(t,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new l4(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((t=>this.onHiddenRangesChanges(t)))),this.updateScheduler=new bu(this.updateDebounceInfo.get(t)),this.cursorChangedScheduler=new Eu((()=>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 a4(t,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=i,this._useFoldingProviders&&this.foldingModel){const e=x4.getFoldingRangeProviders(this.languageFeaturesService,t);e.length>0&&(this.rangeProvider=new C4(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=mu((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=iU.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)}};A4.ID="editor.contrib.folding",A4=x4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([D4(1,Zo),D4(2,cd),D4(3,vO),D4(4,FF),D4(5,$g)],A4);class M4{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 L4 extends Yl{runEditorCommand(t,i,e){const s=t.get(cd),n=A4.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 O4(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 F4 extends L4{getFoldingLevel(){return parseInt(this.id.substr(F4.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))}}F4.ID_PREFIX="editor.foldLevel",F4.ID=t=>F4.ID_PREFIX+t,ru(A4.ID,A4,0),su(class extends L4{constructor(){super({id:"editor.unfold",label:J(0,"Unfold"),alias:"Unfold",precondition:E4,kbOpts:{kbExpr:fS.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:O4,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?r4(i,!1,n,r):n4(i,!1,n,r)}}),su(class extends L4{constructor(){super({id:"editor.unfoldRecursively",label:J(0,"Unfold Recursively"),alias:"Unfold Recursively",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2142),weight:100}})}invoke(t,i,e,s){n4(i,!1,Number.MAX_VALUE,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.fold",label:J(0,"Fold"),alias:"Fold",precondition:E4,kbOpts:{kbExpr:fS.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:O4,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?r4(i,!0,r||1,n):n4(i,!0,r||1,n)}}),su(class extends L4{constructor(){super({id:"editor.foldRecursively",label:J(0,"Fold Recursively"),alias:"Fold Recursively",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2140),weight:100}})}invoke(t,i,e){const s=this.getSelectedLines(e);n4(i,!0,Number.MAX_VALUE,s)}}),su(class extends L4{constructor(){super({id:"editor.foldAll",label:J(0,"Fold All"),alias:"Fold All",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2069),weight:100}})}invoke(t,i,e){n4(i,!0)}}),su(class extends L4{constructor(){super({id:"editor.unfoldAll",label:J(0,"Unfold All"),alias:"Unfold All",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2088),weight:100}})}invoke(t,i,e){n4(i,!1)}}),su(class extends L4{constructor(){super({id:"editor.foldAllBlockComments",label:J(0,"Fold All Block Comments"),alias:"Fold All Block Comments",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2138),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(i,Is.Comment.value,!0);else{const t=e.getModel();if(!t)return;const s=n.getLanguageConfiguration(t.getLanguageId()).comments;s&&s.blockCommentStartToken&&h4(i,new RegExp("^\\s*"+Rn(s.blockCommentStartToken)),!0)}}}),su(class extends L4{constructor(){super({id:"editor.foldAllMarkerRegions",label:J(0,"Fold All Regions"),alias:"Fold All Regions",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2077),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(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&&h4(i,new RegExp(s.markers.start),!0)}}}),su(class extends L4{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:J(0,"Unfold All Regions"),alias:"Unfold All Regions",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2078),weight:100}})}invoke(t,i,e,s,n){if(i.regions.hasTypes())c4(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&&h4(i,new RegExp(s.markers.start),!1)}}}),su(class extends L4{constructor(){super({id:"editor.foldAllExcept",label:J(0,"Fold All Except Selected"),alias:"Fold All Except Selected",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2136),weight:100}})}invoke(t,i,e){o4(i,!0,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.unfoldAllExcept",label:J(0,"Unfold All Except Selected"),alias:"Unfold All Except Selected",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2134),weight:100}})}invoke(t,i,e){o4(i,!1,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.toggleFold",label:J(0,"Toggle Fold"),alias:"Toggle Fold",precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2090),weight:100}})}invoke(t,i,e){s4(i,1,this.getSelectedLines(e))}}),su(class extends L4{constructor(){super({id:"editor.gotoParentFold",label:J(0,"Go to Parent Fold"),alias:"Go to Parent Fold",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.gotoPreviousFold",label:J(0,"Go to Previous Folding Range"),alias:"Go to Previous Folding Range",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.gotoNextFold",label:J(0,"Go to Next Folding Range"),alias:"Go to Next Folding Range",precondition:E4,kbOpts:{kbExpr:fS.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})}}}),su(class extends L4{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:J(0,"Create Folding Range from Selection"),alias:"Create Folding Range from Selection",precondition:E4,kbOpts:{kbExpr:fS.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=t4.sanitizeAndMerge(i.regions,n,null===(s=e.getModel())||void 0===s?void 0:s.getLineCount());i.updatePost(t4.fromFoldRanges(t))}}}}),su(class extends L4{constructor(){super({id:"editor.removeManualFoldingRanges",label:J(0,"Remove Manual Folding Ranges"),alias:"Remove Manual Folding Ranges",precondition:E4,kbOpts:{kbExpr:fS.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++)T4=new F4({id:F4.ID(t),label:J(0,"Fold Level {0}",t),alias:`Fold Level ${t}`,precondition:E4,kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2048|21+t),weight:100}}),hu.INSTANCE.registerEditorAction(T4);var T4;uo.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($g),n=t.get(Yr).getModel(e);if(!n)throw Ti();const r=t.get(Oa);if(!r.getValue("editor.folding",{resource:e}))return[];const o=t.get(cd),h=r.getValue("editor.foldingStrategy",{resource:e}),c={get limit(){return r.getValue("editor.foldingMaximumRegions",{resource:e})},update:()=>{}},l=new a4(n,o,c);let u=l;if("indentation"!==h){const t=A4.getFoldingRangeProviders(s,n);t.length&&(u=new C4(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()}}))})),su(class extends Yl{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)}}),su(class extends Yl{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)}}),su(class extends Yl{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 R4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=function(t,i){return function(e,s){i(e,s,t)}},I4=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 P4=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 Vd;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()}));xK(this._workerService,this._languageFeaturesService,i,e,t,i.getFormattingOptions(),s.token).then((t=>{s.token.isCancellationRequested||a(t)&&(fK.execute(this._editor,t,!0),vK(t))})).finally((()=>{n.dispose()}))}};P4.ID="editor.contrib.autoFormat",P4=R4([_4(1,$g),_4(2,MN)],P4);let N4=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(yK,this.editor,t,2,nR.None,ue.None).catch(Ei))}};N4.ID="editor.contrib.formatOnPaste",N4=R4([_4(1,$g),_4(2,Zr)],N4),ru(P4.ID,P4,2),ru(N4.ID,N4,2),su(class extends Yl{constructor(){super({id:"editor.action.formatDocument",label:J(0,"Format Document"),alias:"Format Document",precondition:Mo.and(fS.notInCompositeEditor,fS.writable,fS.hasDocumentFormattingProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}run(t,i){return I4(this,void 0,void 0,(function*(){if(i.hasModel()){const e=t.get(Zr),s=t.get(rR);yield s.showWhile(e.invokeFunction(CK,i,1,nR.None,ue.None),250)}}))}}),su(class extends Yl{constructor(){super({id:"editor.action.formatSelection",label:J(0,"Format Selection"),alias:"Format Selection",precondition:Mo.and(fS.writable,fS.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:xe(2089,2084),weight:100},contextMenuOpts:{when:fS.hasNonEmptySelection,group:"1_modification",order:1.31}})}run(t,i){return I4(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(rR);yield r.showWhile(e.invokeFunction(yK,i,n,1,nR.None,ue.None),250)}))}}),uo.registerCommand("editor.action.format",(t=>I4(void 0,void 0,void 0,(function*(){const i=t.get(Qr).getFocusedCodeEditor();if(!i||!i.hasModel())return;const e=t.get(lo);i.getSelection().isEmpty()?yield e.executeCommand("editor.action.formatDocument"):yield e.executeCommand("editor.action.formatSelection")}))));var B4=function(t,i){return function(e,s){i(e,s,t)}};class $4{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 j4 extends $4{constructor(t,i,e){super(),this.id=t,this.parent=i,this.symbol=e,this.children=new Map}}class W4 extends $4{constructor(t,i,e,s){super(),this.id=t,this.parent=i,this.label=e,this.order=s,this.children=new Map}}class V4 extends $4{static create(t,i,s){const n=new de(s),r=new V4(i.uri),o=t.ordered(i),h=o.map(((t,e)=>{var s;const o=$4.findId(`provider_${e}`,r),h=new W4(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||[])V4._makeOutlineElement(i,h);return h}),(t=>(Ai(t),h))).then((t=>{$4.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?V4.create(t,i,s):r._compact())).finally((()=>{n.dispose(),c.dispose(),n.dispose()}))}static _makeOutlineElement(t,i){const e=$4.findId(t,i),s=new j4(e,i,t);if(t.children)for(const i of t.children)V4._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 j4?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 V4._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&&V4._flattenDocumentSymbols(t,s.children,s.name)}}const H4=Jr("IOutlineModelService");let z4=class{constructor(t,i,e){this._languageFeaturesService=t,this._disposables=new Vi,this._cache=new hg(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:V4.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()}}))}};z4=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([B4(0,$g),B4(1,FF),B4(2,Yr)],z4),$a(H4,z4,1);uo.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(H4),n=t.get(Xr),r=yield n.createModelReference(e);try{return(yield s.getOrCreate(r.object.textEditorModel,ue.None)).getTopLevelSymbols()}finally{r.dispose()}}))}));class U4 extends Hi{constructor(t,i){super(),this.contextKeyService=t,this.model=i,this.inlineCompletionVisible=U4.inlineSuggestionVisible.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentation=U4.inlineSuggestionHasIndentation.bindTo(this.contextKeyService),this.inlineCompletionSuggestsIndentationLessThanTabSize=U4.inlineSuggestionHasIndentationLessThanTabSize.bindTo(this.contextKeyService),this.suppressSuggestions=U4.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=my.visibleColumnFromColumn(o,t+1,n)<n}}this.inlineCompletionSuggestsIndentation.set(e),this.inlineCompletionSuggestsIndentationLessThanTabSize.set(s)})))}}U4.inlineSuggestionVisible=new Go("inlineSuggestionVisible",!1,J(0,"Whether an inline suggestion is visible")),U4.inlineSuggestionHasIndentation=new Go("inlineSuggestionHasIndentation",!1,J(0,"Whether the inline suggestion starts with whitespace")),U4.inlineSuggestionHasIndentationLessThanTabSize=new Go("inlineSuggestionHasIndentationLessThanTabSize",!0,J(0,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),U4.suppressSuggestions=new Go("inlineSuggestionSuppressSuggestions",void 0,J(0,"Whether suggestions should be suppressed for the current suggestion"));class K4{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 q4=[];class G4{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 Z4(t,i){return new gs(t.lineNumber+i.lineNumber-1,1===i.lineNumber?t.column+i.column-1:i.column)}function J4(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 K4(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 Y4{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 X4{constructor(t,i,e,s=0){this.lineNumber=t,this.columnRange=i,this.newLines=e,this.additionalReservedLineCount=s,this.parts=[new Y4(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 t5(t,i){return t===i||!(!t||!i)&&(t instanceof Q4&&i instanceof Q4||t instanceof X4&&i instanceof X4)&&t.equals(i)}const i5="ghost-text";let e5=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 X4?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 np(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 np(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,i5),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 G4(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:i5,after:{content:t.text,inlineClassName:t.preview?"ghost-text-decoration-preview":"ghost-text-decoration",cursorStops:tf.Left},showIfCollapsed:!0}});return e})),this.additionalLinesWidget=this._register(new s5(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}};e5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Pa)],e5);class s5 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 ma(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=ep.createEmpty(d,n);gp(new up(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=n5?n5.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 n5=zu("editorGhostText",{createHTML:t=>t});class r5{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 o5{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=o5._table[s],"number"==typeof i)return this.pos+=1,{type:i,pos:t,len:1};if(o5.isDigitCharacter(s)){i=8;do{e+=1,s=this.value.charCodeAt(t+e)}while(o5.isDigitCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}if(o5.isVariableCharacter(s)){i=9;do{s=this.value.charCodeAt(t+ ++e)}while(o5.isVariableCharacter(s)||o5.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===o5._table[s]&&!o5.isDigitCharacter(s)&&!o5.isVariableCharacter(s));return this.pos+=e,{type:i,pos:t,len:e}}}o5._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};class h5{constructor(){this._children=[]}appendChild(t){return t instanceof c5&&this._children[this._children.length-1]instanceof c5?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 m5)return t;t=t.parent}}toString(){return this.children.reduce(((t,i)=>t+i.toString()),"")}len(){return 0}}class c5 extends h5{constructor(t){super(),this.value=t}toString(){return this.value}len(){return this.value.length}clone(){return new c5(this.value)}}class l5 extends h5{}class u5 extends l5{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 a5?this._children[0]:void 0}clone(){const t=new u5(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}class a5 extends h5{constructor(){super(...arguments),this.options=[]}appendChild(t){return t instanceof c5&&(t.parent=this,this.options.push(t)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const t=new a5;return this.options.forEach(t.appendChild,t),t}}class d5 extends h5{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 f5&&Boolean(t.elseValue)))&&(s=this._replace([])),s}_replace(t){let i="";for(const e of this._children)if(e instanceof f5){let s=t[e.index]||"";s=e.resolve(s),i+=s}else i+=e.toString();return i}toString(){return""}clone(){const t=new d5;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 f5 extends h5{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 f5(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class g5 extends l5{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 c5(i)],!0)}clone(){const t=new g5(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map((t=>t.clone())),t}}function p5(t,i){const e=[...t];for(;e.length>0;){const t=e.shift();if(!i(t))break;e.unshift(...t.children)}}class m5 extends h5{get placeholderInfo(){if(!this._placeholders){const t=[];let i;this.walk((function(e){return e instanceof u5&&(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 p5([t],(t=>(i+=t.len(),!0))),i}enclosingPlaceholders(t){const i=[];let{parent:e}=t;for(;e;)e instanceof u5&&i.push(e),e=e.parent;return i}resolveVariables(t){return this.walk((i=>(i instanceof g5&&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 m5;return this._children=this.children.map((t=>t.clone())),t}walk(t){p5(this.children,t)}}class v5{constructor(){this._scanner=new o5,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 m5;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 u5&&(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 u5(t.index);o.transform=t.transform;for(const t of n){const i=t.clone();o.appendChild(i),i instanceof u5&&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 u5(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 c5(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 u5(Number(i)):new g5(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 u5(Number(i));if(this._accept(1))for(;;){if(this._accept(4))return t.appendChild(s),!0;if(!this._parse(s))return t.appendChild(new c5("${"+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 a5;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 c5(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 g5(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 c5("${"+i+":")),s.children.forEach(t.appendChild,t),!0}}_parseTransform(t){const i=new d5;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 c5(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 f5(Number(s))),!0;if(this._accept(4))return t.appendChild(new f5(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 f5(Number(s),e)),!0):(this._backTo(i),!1)}if(this._accept(11)){const i=this._until(4);if(i)return t.appendChild(new f5(Number(s),void 0,i,void 0)),!0}else if(this._accept(12)){const i=this._until(4);if(i)return t.appendChild(new f5(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 f5(Number(s),void 0,i,e)),!0}}else{const i=this._until(4);if(i)return t.appendChild(new f5(Number(s),void 0,void 0,i)),!0}return this._backTo(i),!1}_parseAnything(t){return 14!==this._token.type&&(t.appendChild(new c5(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}}var w5=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 b5(t,i,e,s,n=ue.None,r){return w5(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 lg;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 Lu;return u.set(t,h.p),(()=>w5(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=>w5(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 k5(i,t.provider);m.push(s);for(const t of i.items){const i=C5.from(t,s,o,e,r);p.set(i.hash(),i)}}return new y5(Array.from(p.values()),new Set(p.keys()),m)}))}class y5{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 k5{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 C5{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=S5(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=S5(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 v5).parse(t.insertText.snippet);1===e.children.length&&e.children[0]instanceof c5?(r=e.children[0].value,o=void 0):(r=e.toString(),o={snippet:t.insertText.snippet,range:h})}else ch();return new C5(r,t.command,h,r,o,t.additionalTextEdits||q4,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 C5(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 S5(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 r5([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,aD),r}(o,s);return h}class x5{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=Z4(this.range.getStartPosition(),J4(s.substring(0,n))),o=this.text.substring(n),h=ps.fromPositions(r,this.range.getEndPosition());return new x5(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 x5(c,l)}const h=t.getValueInRange(n.range),c=function(t,i){if((null==D5?void 0:D5.originalValue)===t&&(null==D5?void 0:D5.newValue)===i)return null==D5?void 0:D5.changes;{let e=A5(t,i,!0);if(e){const s=E5(e);if(s>0){const n=A5(t,i,!1);n&&E5(n)<s&&(e=n)}}return D5={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 Y4(s,t,!1))}if(c.length>0){const t=Bn(c);u.push(new Y4(s,t,!0))}}return new Q4(l,u)}}let D5;function E5(t){let i=0;for(const e of t)i+=e.originalLength;return i}function A5(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 _d({getElements:()=>h},{getElements:()=>c}).ComputeDiff(!1).changes}var M5=function(t,i){return function(e,s){i(e,s,t)}};let L5=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 O5(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 b5(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 T5(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 F5(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()}};L5=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([M5(3,$g),M5(4,cd)],L5);class O5{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 F5{constructor(t,i,e){this.request=t,this.cancellationTokenSource=i,this.promise=e}dispose(){this.cancellationTokenSource.cancel()}}class T5{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 R5(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 R5(t,s,this._rangeVersionId,i)),this._prependedInlineCompletionItems.push(t)}}class R5{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 x5(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 x5(this._getUpdatedRange(t),this.inlineCompletion.filterText)}_isSmallerThanOriginal(t){return _5(this._getUpdatedRange(t)).isBefore(_5(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 _5(t){return t.startLineNumber===t.endLineNumber?new gs(1,1+t.endColumn-t.startColumn):new gs(1+t.endLineNumber-t.startLineNumber,t.endColumn)}var I5=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 P5={Visible:Y1,HasFocusedSuggestion:new Go("suggestWidgetHasFocusedSuggestion",!1,J(0,"Whether any suggestion is focused")),DetailsVisible:new Go("suggestWidgetDetailsVisible",!1,J(0,"Whether suggestion details are visible")),MultipleSuggestions:new Go("suggestWidgetMultipleSuggestions",!1,J(0,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new Go("suggestionMakesTextEdit",!0,J(0,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new Go("acceptSuggestionOnEnter",!0,J(0,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new Go("suggestionHasInsertAndReplaceRange",!1,J(0,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new Go("suggestionInsertMode",void 0,{type:"string",description:J(0,"Whether the default behaviour is to insert or replace")}),CanResolve:new Go("suggestionCanResolve",!1,J(0,"Whether the current suggestion supports to resolve further details"))},N5=new wh("suggestWidgetStatusBar");class B5{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 I5(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 $5{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}}$5.default=new $5;class j5{constructor(t,i,e,s){this.items=t,this.needsClipboard=i,this.durations=e,this.disposable=s}}function W5(t,i,e,s=$5.default,n={triggerKind:0},r=ue.None){return I5(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=v5.guessNeedsClipboard(n.insertText)),u.push(new B5(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=(()=>I5(this,void 0,void 0,(function*(){})))();for(const o of t.orderedGroups(i)){let t=!1;if(yield Promise.all(o.map((o=>I5(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 j5(u.sort(H5.get(s.snippetSortOrder)),f,{entries:d,elapsed:o.elapsed()},a)}))}function V5(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 H5=new Map;H5.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 V5(t,i)})),H5.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 V5(t,i)})),H5.set(1,V5),uo.registerCommand("_executeCompletionItemProvider",((t,...i)=>I5(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($g),h=yield t.get(Xr).createModelReference(e);try{const t={incomplete:!1,suggestions:[]},i=[],e=h.object.textEditorModel.validatePosition(s),c=yield W5(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 z5{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 U5(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 K5{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 q5{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 c5&&(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 G5{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 Z5{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 J5=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}};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)}}(2,cd)],J5);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 Y5{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)}:gR: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)||fR(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(fR(t))return Ge(t.uri.path);let i=Ge(t.configPath.path);return i.endsWith("code-workspace")&&(i=i.substr(0,i.length-14-1)),i}_resoveWorkspacePath(t){if(fR(t))return U5(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?U5(e):"/"}}class X5{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?p0():void 0}}var t3;class i3{constructor(t,i,e){this._editor=t,this._snippet=i,this._snippetLineLeadingWhitespace=e,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=r(i.placeholders,u5.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?i3._decor.inactiveFinal:i3._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(FT.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?i3._decor.activeFinal:i3._decor.active),e.add(n);for(const i of this._snippet.enclosingPlaceholders(n)){const s=this._placeholderDecorations.get(i);t.changeDecorationOptions(s,i.isFinalTabstop?i3._decor.activeFinal:i3._decor.active),e.add(i)}}for(const[i,s]of this._placeholderDecorations)e.has(i)||t.changeDecorationOptions(s,i.isFinalTabstop?i3._decor.inactiveFinal:i3._decor.inactive);return s}));return i?this.move(t):null!=e?e:[]}_hasPlaceholderBeenCollapsed(t){let i=t;for(;i;){if(i instanceof u5){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 a5,!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,i3._decor.inactive);this._placeholderDecorations.set(t,h)}}this._placeholderGroups=r(this._snippet.placeholders,u5.compareByIndex)}))}}i3._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 e3={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let s3=t3=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 c5)||i.parent instanceof a5)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 c5(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(dR))),f=t.invokeWithinContext((t=>new G5(t.get(eR),a))),g=()=>o,p=a.getValueInRange(t3.adjustSelection(a,t.getSelection(),e,0)),m=a.getValueInRange(t3.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=t3.adjustSelection(a,o,e,0),k=t3.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 v5).parse(i,!0,n),x=C.getStartPosition(),D=t3.adjustWhitespace(a,x,r||b>0&&v!==a.getLineFirstNonWhitespaceColumn(o.positionLineNumber),S);S.resolveVariables(new K5([f,new Z5(g,b,w.length,"spread"===t.getOption(78)),new q5(a,o,b,h),new J5(a,o,c),new Q5,new Y5(d),new X5])),l[b]=FT.replace(C,S.toString()),l[b].identifier={major:b,minor:0},l[b]._isTracked=!0,u[b]=new i3(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 v5,u=new m5,a=new K5([t.invokeWithinContext((t=>new G5(t.get(eR),c))),new Z5((()=>n),0,t.getSelections().length,"spread"===t.getOption(78)),new q5(c,t.getSelection(),0,r),new J5(c,t.getSelection(),o),new Q5,new Y5(t.invokeWithinContext((t=>t.get(dR)))),new X5]);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 c5(c.getValueInRange(s));u.appendChild(n),d+=n.value.length}const n=l.parseFragment(s,u);t3.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=FT.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 i3(t,u,"")]}}constructor(t,i,e=e3,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?t3.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):t3.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=e3){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,t]);const{edits:e,snippets:s}=t3.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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,cd)],s3);var n3,r3=function(t,i){return function(e,s){i(e,s,t)}};const o3={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let h3=n3=class{static get(t){return t.getContribution(n3.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=n3.InSnippetMode.bindTo(s),this._hasNextTabstop=n3.HasNextTabstop.bindTo(s),this._hasPrevTabstop=n3.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?o3:Object.assign(Object.assign({},o3),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 s3(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())}};h3.ID="snippetController2",h3.InSnippetMode=new Go("inSnippetMode",!1,J(0,"Whether the editor in current in snippet mode")),h3.HasNextTabstop=new Go("hasNextTabstop",!1,J(0,"Whether there is a next tab stop when in snippet mode")),h3.HasPrevTabstop=new Go("hasPrevTabstop",!1,J(0,"Whether there is a previous tab stop when in snippet mode")),h3=n3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([r3(1,Ah),r3(2,$g),r3(3,Zo),r3(4,cd)],h3),ru(h3.ID,h3,4);const c3=Ql.bindToContribution(h3.get);eu(new c3({id:"jumpToNextSnippetPlaceholder",precondition:Mo.and(h3.InSnippetMode,h3.HasNextTabstop),handler:t=>t.next(),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:2}})),eu(new c3({id:"jumpToPrevSnippetPlaceholder",precondition:Mo.and(h3.InSnippetMode,h3.HasPrevTabstop),handler:t=>t.prev(),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:1026}})),eu(new c3({id:"leaveSnippet",precondition:h3.InSnippetMode,handler:t=>t.cancel(!0),kbOpts:{weight:130,kbExpr:fS.editorTextFocus,primary:9,secondary:[1033]}})),eu(new c3({id:"acceptSnippet",precondition:h3.InSnippetMode,handler:t=>t.finish()}));var l3,u3=function(t,i){return function(e,s){i(e,s,t)}},a3=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"}(l3||(l3={}));let d3=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(L5,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([l3.Redo,l3.Undo,l3.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?t5(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:t5},(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 a3(this,void 0,void 0,(function*(){this._isActive.set(!0,t),yield this._fetchInlineCompletions.get()}))}triggerExplicitly(t){return a3(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 a3(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 a3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(1)}))}previous(){return a3(this,void 0,void 0,(function*(){yield this._deltaSelectedInlineCompletionIndex(-1)}))}accept(t){var i;return a3(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",[FT.replaceMove(s.range,""),...s.additionalTextEdits]),t.setPosition(s.snippetInfo.range.getStartPosition()),null===(i=h3.get(t))||void 0===i||i.insert(s.snippetInfo.snippet,{undoStopBefore:!1})):t.executeEdits("inlineSuggestion.accept",[FT.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 a3(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 a3(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 a3(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",[FT.replace(ps.fromPositions(o),l)]);const i=J4(l);t.setPosition(Z4(o,i))}finally{this._isAcceptingPartially=!1}if(n.source.provider.handlePartialAccept){const i=ps.fromPositions(n.range.getStartPosition(),Z4(o,J4(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)}};d3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(9,Zr),u3(10,lo),u3(11,cd)],d3);var f3,g3=function(t,i){return function(e,s){i(e,s,t)}};class p3{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 m3 extends p3{constructor(){super("first")}memorize(t,i,e){}toJSON(){}fromJSON(){}}let v3=f3=class{constructor(t,i){this._storageService=t,this._configService=i,this._disposables=new Vi,this._persistSoon=new Eu((()=>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=f3._strategyCtors.get(s)||m3;this._strategy=new t;try{const t=this._configService.getValue("editor.suggest.shareSuggestSelections"),i=this._storageService.get(`${f3._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(`${f3._storagePrefix}/${this._strategy.name}`,i,t,1)}}};v3._strategyCtors=new Map([["recentlyUsedByPrefix",class extends p3{constructor(){super("recentlyUsedByPrefix"),this._trie=aR.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 p3{constructor(){super("recentlyUsed"),this._cache=new hg(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",m3]]),v3._storagePrefix="suggest/memories",v3=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}([g3(0,PP),g3(1,Oa)],v3);const w3=Jr("ISuggestMemories");$a(w3,v3,1);var b3;let y3=b3=class{constructor(t,i){this._editor=t,this._enabled=!1,this._ckAtEnd=b3.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)}};y3.AtEnd=new Go("atEndOfWord",!1),y3=b3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zo)],y3);var k3;let C3=k3=class{constructor(t,i){this._editor=t,this._index=0,this._ckOtherSuggestions=k3.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&&k3._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=k3._moveIndex(t,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};C3.OtherSuggestions=new Go("hasOtherSuggestions",!1),C3=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zo)],C3);class S3{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 Vd;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 x3{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=>x3._bracketsRightYield(i,0,t,s,n))),yield new Promise((e=>x3._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>=x3._maxRounds){t();break}if(!s){t();break}const h=e.bracketPairs.findNextBracket(s);if(!h){t();break}if(Date.now()-o>x3._maxDuration){setTimeout((()=>x3._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>=x3._maxRounds&&0===n.size){t();break}if(!s){t();break}const c=e.bracketPairs.findPrevBracket(s);if(!c){t();break}if(Date.now()-h>x3._maxDuration){setTimeout((()=>x3._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}),x3._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())}))}}}x3._maxDuration=30,x3._maxRounds=2;class D3{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 D3.None;if(!i.hasModel())return D3.None;const e=i.getModel(),n=i.getPosition();if(!t.canComputeWordRanges(e.uri))return D3.None;const[r]=yield(new x3).provideSelectionRanges(e,[n]);if(0===r.length)return D3.None;const o=yield t.computeWordRanges(e.uri,r[0].range);if(!o)return D3.None;const h=e.getWordUntilPosition(n);return delete o[h.word],new class extends D3{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}}}))}}D3.None=new class extends D3{distance(){return 0}};class E3{constructor(t,i){this.leadingLineContent=t,this.characterCountDelta=i}}class A3{constructor(t,i,e,s,n,r,o=O_.default,h){this.clipboardText=h,this._snippetCompareFn=A3._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=A3._compareCompletionItemsSnippetsUp:"bottom"===r&&(this._snippetCompareFn=A3._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 A3._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 A3._compareCompletionItems(t,i)}}var M3,L3=function(t,i){return function(e,s){i(e,s,t)}};class O3{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 F3=M3=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 xu,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(U4.suppressSuggestions.key);return void 0!==e?!e:!t.getOption(62).suppressSuggestions}(this._editor,this._contextKeyService))return;if(O3.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;z5.isAllOff(this._editor.getOption(88))||this._editor.getOption(117).snippetsPreventQuickSuggestions&&(null===(t=h3.get(this._editor))||void 0===t?void 0:t.isInSnippet())||(this.cancel(),this._triggerQuickSuggest.cancelAndSet((()=>{if(void 0!==this._triggerState)return;if(!O3.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(!z5.isAllOff(e)){if(!z5.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"!==z5.valueFor(e,n))return}(function(t,i){if(!Boolean(i.getContextKeyValue(U4.inlineSuggestionVisible.key)))return!0;const e=i.getContextKeyValue(U4.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 O3(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 O3(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}=M3._createSuggestFilter(this._editor),f=new $5(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=D3.create(this._editorWorkerService,this._editor),p=W5(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 O3(r,this._editor.getPosition(),t),h=Object.assign(Object.assign({},O_.default),{firstMatchCanBeWeak:!this._editor.getOption(117).matchOnWordStartOnly});if(this._completionModel=new A3(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(O3.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=O3.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()}};F3=M3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(1,MN),L3(2,EV),L3(3,Eh),L3(4,Ah),L3(5,Zo),L3(6,Oa),L3(7,$g),L3(8,EF)],F3);class T3{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)>T3._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()}}T3._maxSelectionLength=51200;var R3=function(t,i){return function(e,s){i(e,s,t)}};class _3 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,_3.symbolPrintEnter(t)))}static symbolPrintEnter(t){var i;return null===(i=t.getLabel())||void 0===i?void 0:i.replace(/\benter\b/gi,"⏎")}}let I3=class{constructor(t,i,e,s,n){this._menuId=i,this._menuService=s,this._contextKeyService=n,this._menuDisposables=new Vi,this.element=Ml(t,_l(".suggest-status-bar"));const r=t=>t instanceof Sh?e.createInstance(_3,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()}};I3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([R3(2,Zr),R3(3,bh),R3(4,Zo)],I3);function P3(t){return!!t&&Boolean(t.completion.documentation||t.completion.detail&&t.completion.detail!==t.completion.label)}let N3=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 nl(330,0),this.domNode=_l(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=i.createInstance(XG,{editor:t}),this._body=_l(".body"),this._scrollbar=new Gy(this._body,{alwaysConsumeMouseWheel:!0}),Ml(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Ml(this._body,_l(".header")),this._close=Ml(this._header,_l("span"+io.asCSSSelector(ys.close))),this._close.title=J(0,"Close"),this._type=Ml(this._header,_l("p.type")),this._docs=Ml(this._body,_l("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||P3(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,Il(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(t))}else Kc(this._type),this._type.title="",Pl(this._type),this.domNode.classList.add("no-type");if(Kc(this._docs),"string"==typeof r)this._docs.classList.remove("markdown-docs"),this._docs.textContent=r;else if(r){this._docs.classList.add("markdown-docs"),Kc(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 nl(t,i);nl.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}};N3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,Zr)],N3);class B3{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 SY,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=el(this.getDomNode().ownerDocument.body),r=this.widget.getLayoutInfo(),o=new nl(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 nl(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 nl(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 nl(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 $3;!function(t){t[t.FILE=0]="FILE",t[t.FOLDER=1]="FOLDER",t[t.ROOT_FOLDER=2]="ROOT_FOLDER"}($3||($3={}));const j3=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function W3(t,i,e,s){const n=s===$3.ROOT_FOLDER?["rootfolder-icon"]:s===$3.FOLDER?["folder-icon"]:["file-icon"];if(e){let r;if(e.scheme===jc.data)r=jE.parseMetaData(e).get(jE.META_DATA_LABEL);else{const t=e.path.match(j3);t?(r=V3(t[2].toLowerCase()),t[1]&&n.push(`${V3(t[1].toLowerCase())}-name-dir-icon`)):r=V3(e.authority.toLowerCase())}if(s===$3.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===jc.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!==td?s:i.guessLanguageIdByFilepathOrFirstLine(e)}(t,i,e);s&&n.push(`${V3(s)}-lang-file-icon`)}}return n}function V3(t){return t.replace(/[\11\12\14\15\40]/g,"/")}var H3,z3=function(t,i){return function(e,s){i(e,s,t)}};function U3(t){return`suggest-aria-id:${t}`}const K3=GW("suggest-more-info",ys.chevronRight,J(0,"Icon for more information in the suggest widget.")),q3=new((H3=class{extract(t,i){if(t.textLabel.match(H3._regexStrict))return i[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(H3._regexStrict))return i[0]=t.completion.detail,!0;if("string"==typeof t.completion.documentation){const e=H3._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*\))/,H3._regexStrict=new RegExp(`^${H3._regexRelaxed.source}$`,"i"),H3);let G3=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=Ml(t,_l(".icon")),n=Ml(s,_l("span.colorspan")),r=Ml(t,_l(".contents")),o=Ml(r,_l(".main")),h=Ml(o,_l(".icon-label.codicon")),c=Ml(o,_l("span.left")),l=Ml(o,_l("span.right")),u=new Jj(c,{supportHighlights:!0,supportIcons:!0});i.add(u);const a=Ml(c,_l("span.signature-label")),d=Ml(c,_l("span.qualifier-label")),f=Ml(l,_l("span.details-label")),g=Ml(l,_l("span.readMore"+io.asCSSSelector(K3)));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=U3(i),e.colorspan.style.backgroundColor="";const n={labelEscapeNewLines:!0,matches:v_(t.score)},r=[];if(19===s.kind&&q3.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=W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),$3.FILE),r=W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),$3.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=[W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:t.textLabel}),$3.FOLDER),W3(this._modelService,this._languageService,ss.from({scheme:"fake",path:s.detail}),$3.FOLDER)].flat()):(e.icon.className="icon hide",e.iconContainer.className="",e.iconContainer.classList.add("suggest-icon",...io.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=Z3(s.detail||""),e.root.classList.add("string-label")):(e.parametersLabel.textContent=Z3(s.label.detail||""),e.detailsLabel.textContent=Z3(s.label.description||""),e.root.classList.remove("string-label")),this._editor.getOption(117).showInlineDetails?Il(e.detailsLabel):Pl(e.detailsLabel),P3(t)?(e.right.classList.add("can-expand-details"),Il(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"),Pl(e.readMore),e.readMore.onmousedown=null,e.readMore.onclick=null)}disposeTemplate(t){t.disposables.dispose()}};function Z3(t){return t.replace(/\r\n|\r|\n/g,"")}G3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([z3(1,Yr),z3(2,Pa),z3(3,pk)],G3);var J3,Q3=function(t,i){return function(e,s){i(e,s,t)}};Lm("editorSuggestWidget.background",{dark:Mv,light:Mv,hcDark:Mv,hcLight:Mv},J(0,"Background color of the suggest widget.")),Lm("editorSuggestWidget.border",{dark:Ov,light:Ov,hcDark:Ov,hcLight:Ov},J(0,"Border color of the suggest widget."));const Y3=Lm("editorSuggestWidget.foreground",{dark:Av,light:Av,hcDark:Av,hcLight:Av},J(0,"Foreground color of the suggest widget."));Lm("editorSuggestWidget.selectedForeground",{dark:Hw,light:Hw,hcDark:Hw,hcLight:Hw},J(0,"Foreground color of the selected entry in the suggest widget.")),Lm("editorSuggestWidget.selectedIconForeground",{dark:zw,light:zw,hcDark:zw,hcLight:zw},J(0,"Icon foreground color of the selected entry in the suggest widget."));const X3=Lm("editorSuggestWidget.selectedBackground",{dark:Uw,light:Uw,hcDark:Uw,hcLight:Uw},J(0,"Background color of the selected entry in the suggest widget."));Lm("editorSuggestWidget.highlightForeground",{dark:Aw,light:Aw,hcDark:Aw,hcLight:Aw},J(0,"Color of the match highlights in the suggest widget.")),Lm("editorSuggestWidget.focusHighlightForeground",{dark:Mw,light:Mw,hcDark:Mw,hcLight:Mw},J(0,"Color of the match highlights in the suggest widget when an item is focused.")),Lm("editorSuggestWidgetStatus.foreground",{dark:Ab(Y3,.5),light:Ab(Y3,.5),hcDark:Ab(Y3,.5),hcLight:Ab(Y3,.5)},J(0,"Foreground color of the suggest widget status."));class t6{constructor(t,i){this._service=t,this._key=`suggestWidget.size/${i.getEditorType()}/${i instanceof jJ}`}restore(){var t;const i=null!==(t=this._service.get(this._key,0))&&void 0!==t?t:"";try{const t=JSON.parse(i);if(nl.is(t))return nl.lift(t)}catch(t){}}store(t){this._service.store(this._key,JSON.stringify(t),0,1)}reset(){this._service.remove(this._key,0)}}let i6=J3=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 xu,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 SY,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new e6(this,t),this._persistedSize=new t6(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 nl(c,l))}this._contentWidget.unlockPreference(),o=void 0}}))),this._messageElement=Ml(this.element.domNode,_l(".message")),this._listElement=Ml(this.element.domNode,_l(".tree"));const h=this._disposables.add(n.createInstance(N3,this.editor));h.onDidClose(this.toggleDetails,this,this._disposables),this._details=new B3(h,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(117).showIcons);c();const l=n.createInstance(G3,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:X3,listInactiveFocusOutline:Im})),this._status=n.createInstance(I3,this.element.domNode,N5);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=P5.Visible.bindTo(e),this._ctxSuggestWidgetDetailsVisible=P5.DetailsVisible.bindTo(e),this._ctxSuggestWidgetMultipleSuggestions=P5.MultipleSuggestions.bindTo(e),this._ctxSuggestWidgetHasFocusedSuggestion=P5.HasFocusedSuggestion.bindTo(e),this._disposables.add(Qc(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=ry(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=mu((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=Cu((()=>{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:U3(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:Pl(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=J3.LOADING_MESSAGE,Pl(this._listElement,this._status.element),Il(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,sm(J3.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=J3.NO_SUGGESTIONS_MESSAGE,Pl(this._listElement,this._status.element),Il(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,sm(J3.NO_SUGGESTIONS_MESSAGE);break;case 3:case 4:Pl(this._messageElement),Il(this._listElement,this._status.element),this._show();break;case 5:Pl(this._messageElement),Il(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=Cu((()=>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=Yc((()=>{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")):!P3(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=Yc((()=>{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=el(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 nl(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=ol(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 nl(l,r.defaultSize.height),this.element.maxSize=new nl(c,v),this.element.minSize=new nl(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 nl(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}};i6.LOADING_MESSAGE=J(0,"Loading..."),i6.NO_SUGGESTIONS_MESSAGE=J(0,"No suggestions."),i6=J3=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Q3(1,PP),Q3(2,Zo),Q3(3,pk),Q3(4,Zr)],i6);class e6{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 nl(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 s6,n6=function(t,i){return function(e,s){i(e,s,t)}};class r6{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 o6=s6=class{static get(t){return t.getContribution(s6.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 h6((t=>t.priority)),this._onWillInsertSuggestItem=new ie,this.onWillInsertSuggestItem=this._onWillInsertSuggestItem.event,this.editor=t,this.model=n.createInstance(F3,this.editor),this._selectors.register({priority:0,select:(t,i,e)=>this._memoryService.select(t,i,e)});const h=P5.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 Mu((()=>{const t=this._instantiationService.createInstance(i6,this.editor);this._toDispose.add(t),this._toDispose.add(t.onDidSelect((t=>this._insertSuggestion(t,0)),this));const i=new S3(this.editor,t,this.model,(t=>this._insertSuggestion(t,2)));this._toDispose.add(i);const e=P5.MakesTextEdit.bindTo(this._contextKeyService),s=P5.HasInsertAndReplaceRange.bindTo(this._contextKeyService),n=P5.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 sh(!0,!1,!1,!1,33))||ft&&t.toKeyCodeChord().equals(new sh(!1,!1,!1,!0,33))?t.stopPropagation():t.toKeyCodeChord().isModifierKey()||this.editor.focus()}))),t}))),this._overtypingCapturer=this._toDispose.add(new Mu((()=>this._toDispose.add(new T3(this.editor,this.model))))),this._alternatives=this._toDispose.add(new Mu((()=>this._toDispose.add(new C3(this.editor,this._contextKeyService))))),this._toDispose.add(n.createInstance(y3,t)),this._toDispose.add(this.model.onDidTrigger((t=>{this.widget.value.showTriggered(t.auto,t.shy?250:50),this._lineSuffix.value=new r6(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=P5.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=h3.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=iU.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map((t=>FT.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=iU.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map((t=>FT.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=v5.escape(d)),this.model.cancel(),e.insert(d,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(1&r.completion.insertTextRules),clipboardText:t.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value}),2&i||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===c6.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:kd(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)&&em(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)}};o6.ID="editor.contrib.suggestController",o6=s6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([n6(1,w3),n6(2,lo),n6(3,Zo),n6(4,Zr),n6(5,Ah),n6(6,Eh)],o6);class h6{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 c6 extends Yl{constructor(){super({id:c6.id,label:J(0,"Trigger Suggest"),alias:"Trigger Suggest",precondition:Mo.and(fS.writable,fS.hasCompletionItemProvider,P5.Visible.toNegated()),kbOpts:{kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(t,i,e){const s=o6.get(i);if(!s)return;let n;e&&"object"==typeof e&&!0===e.auto&&(n=!0),s.triggerSuggest(void 0,n,void 0)}}c6.id="editor.action.triggerSuggest",ru(o6.ID,o6,2),su(c6);const l6=190,u6=Ql.bindToContribution(o6.get);eu(new u6({id:"acceptSelectedSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion),handler(t){t.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:Mo.and(P5.Visible,fS.textInputFocus),weight:l6},{primary:3,kbExpr:Mo.and(P5.Visible,fS.textInputFocus,P5.AcceptSuggestionsOnEnter,P5.MakesTextEdit),weight:l6}],menuOpts:[{menuId:N5,title:J(0,"Insert"),group:"left",order:1,when:P5.HasInsertAndReplaceRange.toNegated()},{menuId:N5,title:J(0,"Insert"),group:"left",order:1,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("insert"))},{menuId:N5,title:J(0,"Replace"),group:"left",order:1,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("replace"))}]})),eu(new u6({id:"acceptAlternativeSelectedSuggestion",precondition:Mo.and(P5.Visible,fS.textInputFocus,P5.HasFocusedSuggestion),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:1027,secondary:[1026]},handler(t){t.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:N5,group:"left",order:2,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("insert")),title:J(0,"Replace")},{menuId:N5,group:"left",order:2,when:Mo.and(P5.HasInsertAndReplaceRange,P5.InsertMode.isEqualTo("replace")),title:J(0,"Insert")}]})),uo.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),eu(new u6({id:"hideSuggestWidget",precondition:P5.Visible,handler:t=>t.cancelSuggestWidget(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:9,secondary:[1033]}})),eu(new u6({id:"selectNextSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),eu(new u6({id:"selectNextPageSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectNextPageSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:12,secondary:[2060]}})),eu(new u6({id:"selectLastSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectLastSuggestion()})),eu(new u6({id:"selectPrevSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),eu(new u6({id:"selectPrevPageSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectPrevPageSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:11,secondary:[2059]}})),eu(new u6({id:"selectFirstSuggestion",precondition:Mo.and(P5.Visible,Mo.or(P5.MultipleSuggestions,P5.HasFocusedSuggestion.negate())),handler:t=>t.selectFirstSuggestion()})),eu(new u6({id:"focusSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion.negate()),handler:t=>t.focusSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),eu(new u6({id:"focusAndAcceptSuggestion",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion.negate()),handler:t=>{t.focusSuggestion(),t.acceptSelectedSuggestion(!0,!1)}})),eu(new u6({id:"toggleSuggestionDetails",precondition:Mo.and(P5.Visible,P5.HasFocusedSuggestion),handler:t=>t.toggleSuggestionDetails(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:N5,group:"right",order:1,when:Mo.and(P5.DetailsVisible,P5.CanResolve),title:J(0,"show less")},{menuId:N5,group:"right",order:1,when:Mo.and(P5.DetailsVisible.toNegated(),P5.CanResolve),title:J(0,"show more")}]})),eu(new u6({id:"toggleExplainMode",precondition:P5.Visible,handler:t=>t.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),eu(new u6({id:"toggleSuggestionFocus",precondition:P5.Visible,handler:t=>t.toggleSuggestionFocus(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2570,mac:{primary:778}}})),eu(new u6({id:"insertBestCompletion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),y3.AtEnd,P5.Visible.toNegated(),C3.OtherSuggestions.toNegated(),h3.InSnippetMode.toNegated()),handler:(t,i)=>{t.triggerSuggestAndAcceptBest(O(i)?Object.assign({fallback:"tab"},i):{fallback:"tab"})},kbOpts:{weight:l6,primary:2}})),eu(new u6({id:"insertNextSuggestion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),C3.OtherSuggestions,P5.Visible.toNegated(),h3.InSnippetMode.toNegated()),handler:t=>t.acceptNextSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:2}})),eu(new u6({id:"insertPrevSuggestion",precondition:Mo.and(fS.textInputFocus,Mo.equals("config.editor.tabCompletion","on"),C3.OtherSuggestions,P5.Visible.toNegated(),h3.InSnippetMode.toNegated()),handler:t=>t.acceptPrevSuggestion(),kbOpts:{weight:l6,kbExpr:fS.textInputFocus,primary:1026}})),su(class extends Yl{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=o6.get(i))||void 0===e||e.resetWidgetSize()}});class a6 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=o6.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=Mf(e.map(((t,i)=>{const e=d6.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=d6.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=o6.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?d6.fromSuggestion(t,s,e,i.item,this.isShiftKeyPressed):void 0}stopForceRenderingAbove(){const t=o6.get(this.editor);null==t||t.stopForceRenderingAbove()}forceRenderingAbove(){const t=o6.get(this.editor);null==t||t.forceRenderingAbove()}}class d6{static fromSuggestion(t,i,e,s,n){let{insertText:r}=s.completion,o=!1;if(4&s.completion.insertTextRules){const t=(new v5).parse(r);t.children.length<100&&s3.adjustWhitespace(i,e,!0,t),r=t.toString(),o=!0}const h=t.getOverwriteInfo(s,n);return new d6(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 x5(this.range,this.insertText)}}var f6,g6=function(t,i){return function(e,s){i(e,s,t)}};let p6=f6=class extends Hi{static get(t){return t.getContribution(f6.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 a6(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,l3.Other)),(t=>{DH((i=>{var e;this.updateObservables(i,l3.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(e5,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 U4(this.contextKeyService,this.model)),this._register(Ji.runAndSubscribe(t.onDidChangeModel,(()=>DH((e=>{this.model.set(void 0,e),this.updateObservables(e,l3.Other);const s=t.getModel();if(s){const n=i.createInstance(d3,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?l3.Undo:t.isRedoing?l3.Redo:(null===(i=this.model.get())||void 0===i?void 0:i.isAcceptingPartially)?l3.AcceptWord:l3.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,l3.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,l3.Other),this._enabled.get()&&(null===(i=this.model.get())||void 0===i||i.trigger(t))}))))),this._register(this.commandService.onDidExecuteCommand((i=>{new Set([CS.Tab.id,CS.DeleteLeft.id,CS.DeleteRight.id,MX,"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||WX.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 BX(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())),em(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)}};p6.ID="editor.contrib.inlineCompletionsController",p6=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}([g6(1,Zr),g6(2,Zo),g6(3,Oa),g6(4,lo),g6(5,FF),g6(6,$g),g6(7,GV),g6(8,kC)],p6);var m6=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 v6 extends Yl{constructor(){super({id:v6.ID,label:J(0,"Show Next Inline Suggestion"),alias:"Show Next Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.next()}))}}v6.ID=OX;class w6 extends Yl{constructor(){super({id:w6.ID,label:J(0,"Show Previous Inline Suggestion"),alias:"Show Previous Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.previous()}))}}w6.ID=LX;class b6 extends Yl{constructor(){super({id:b6.ID,label:J(0,"Hide Inline Suggestion"),alias:"Hide Inline Suggestion",precondition:U4.inlineSuggestionVisible,kbOpts:{weight:100,primary:9}})}run(t,i){return m6(this,void 0,void 0,(function*(){const t=p6.get(i);DH((i=>{var e;null===(e=null==t?void 0:t.model.get())||void 0===e||e.stop(i)}))}))}}b6.ID="editor.action.inlineSuggest.hide";class y6 extends xh{constructor(){super({id:y6.ID,title:J(0,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:wh.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:Mo.equals("config.editor.inlineSuggest.showToolbar","always")})}run(t,i){return m6(this,void 0,void 0,(function*(){const i=t.get(Oa),e=i.getValue("editor.inlineSuggest.showToolbar");i.updateValue("editor.inlineSuggest.showToolbar","always"===e?"onHover":"always")}))}}y6.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";var k6=function(t,i){return function(e,s){i(e,s,t)}};class C6{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 S6=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=p6.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 kY(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 kY(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=p6.get(this._editor);return e&&e.shouldShowHoverAt(t.range)?[new C6(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(WX,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=_l,n=s("div.hover-row.markdown-hover"),r=Ml(n,s("div.hover-contents",{"aria-live":"assertive"})),o=e.add(new XG({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 Ol(r)}))),t.fragment.appendChild(n)}};function x6(t,i){let e=0;for(let s=0;s<t.length;s++)"\t"===t.charAt(s)?e+=i:e++;return e}function D6(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}S6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([k6(1,Pa),k6(2,AF),k6(3,fm),k6(4,Zr),k6(5,Eh)],S6),ru(p6.ID,p6,3),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:J(0,"Trigger Inline Suggestion"),alias:"Trigger Inline Suggestion",precondition:fS.writable})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);null===(e=null==t?void 0:t.model.get())||void 0===e||e.triggerExplicitly()}))}}),su(v6),su(w6),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:J(0,"Accept Next Word Of Inline Suggestion"),alias:"Accept Next Word Of Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:Mo.and(fS.writable,U4.inlineSuggestionVisible)},menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept Word"),group:"primary",order:2}]})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextWord(t.editor)}))}}),su(class extends Yl{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:J(0,"Accept Next Line Of Inline Suggestion"),alias:"Accept Next Line Of Inline Suggestion",precondition:Mo.and(fS.writable,U4.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept Line"),group:"secondary",order:2}]})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);yield null===(e=null==t?void 0:t.model.get())||void 0===e?void 0:e.acceptNextLine(t.editor)}))}}),su(class extends Yl{constructor(){super({id:MX,label:J(0,"Accept Inline Suggestion"),alias:"Accept Inline Suggestion",precondition:U4.inlineSuggestionVisible,menuOpts:[{menuId:wh.InlineSuggestionToolbar,title:J(0,"Accept"),group:"primary",order:1}],kbOpts:{primary:2,weight:200,kbExpr:Mo.and(U4.inlineSuggestionVisible,fS.tabMovesFocus.toNegated(),U4.inlineSuggestionHasIndentationLessThanTabSize,P5.Visible.toNegated(),fS.hoverFocused.toNegated())}})}run(t,i){var e;return m6(this,void 0,void 0,(function*(){const t=p6.get(i);t&&(null===(e=t.model.get())||void 0===e||e.accept(t.editor),t.editor.focus())}))}}),su(b6),Dh(y6),CY.register(S6);function E6(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)=>tS.shiftIndent(t,t.length+(i=i||1),o,h,c),u=(t,i)=>tS.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(FT.replaceMove(new ms(e,1,e,t.length+1),DC(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(FT.replaceMove(new ms(i,1,i,s.length+1),DC(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 A6 extends Yl{constructor(){super({id:A6.ID,label:J(0,"Convert Indentation to Spaces"),alias:"Convert Indentation to Spaces",precondition:fS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new N6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!0})}}A6.ID="editor.action.indentationToSpaces";class M6 extends Yl{constructor(){super({id:M6.ID,label:J(0,"Convert Indentation to Tabs"),alias:"Convert Indentation to Tabs",precondition:fS.writable})}run(t,i){const e=i.getModel();if(!e)return;const s=e.getOptions(),n=i.getSelection();if(!n)return;const r=new B6(n,s.tabSize);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop(),e.updateOptions({insertSpaces:!1})}}M6.ID="editor.action.indentationToTabs";class L6 extends Yl{constructor(t,i,e){super(e),this.insertSpaces=t,this.displaySizeOnly=i}run(t,i){const e=t.get(Ij),s=t.get(Yr),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 O6 extends L6{constructor(){super(!1,!1,{id:O6.ID,label:J(0,"Indent Using Tabs"),alias:"Indent Using Tabs",precondition:void 0})}}O6.ID="editor.action.indentUsingTabs";class F6 extends L6{constructor(){super(!0,!1,{id:F6.ID,label:J(0,"Indent Using Spaces"),alias:"Indent Using Spaces",precondition:void 0})}}F6.ID="editor.action.indentUsingSpaces";class T6 extends L6{constructor(){super(!0,!0,{id:T6.ID,label:J(0,"Change Tab Display Size"),alias:"Change Tab Display Size",precondition:void 0})}}T6.ID="editor.action.changeTabDisplaySize";class R6 extends Yl{constructor(){super({id:R6.ID,label:J(0,"Detect Indentation from Content"),alias:"Detect Indentation from Content",precondition:void 0})}run(t,i){const e=t.get(Yr),s=i.getModel();if(!s)return;const n=e.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(n.insertSpaces,n.tabSize)}}R6.ID="editor.action.detectIndentation";class _6{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 I6=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=>tS.shiftIndent(t,t.length+1,n,r,o),unshiftIndent:t=>tS.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=nS(s,e,e.getLanguageId(),l,c,this._languageConfigurationService);if(null!==t){const i=jn(u),s=x6(t,n);if(s!==x6(i,n)){const t=D6(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=rS(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=nS(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=x6(i,n),r=x6(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=D6(x6(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 _6(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 P6(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)}}I6.ID="editor.contrib.autoIndentOnPaste",I6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,cd)],I6);class N6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),P6(t,i,this.tabSize,!0)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}class B6{constructor(t,i){this.selection=t,this.tabSize=i,this.selectionId=null}getEditOperations(t,i){this.selectionId=i.trackSelection(this.selection),P6(t,i,this.tabSize,!1)}computeCursorState(t,i){return i.getTrackedSelection(this.selectionId)}}ru(I6.ID,I6,2),su(A6),su(M6),su(O6),su(F6),su(T6),su(R6),su(class extends Yl{constructor(){super({id:"editor.action.reindentlines",label:J(0,"Reindent Lines"),alias:"Reindent Lines",precondition:fS.writable})}run(t,i){const e=t.get(cd),s=i.getModel();if(!s)return;const n=E6(s,e,1,s.getLineCount());n.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,n),i.pushUndoStop())}}),su(class extends Yl{constructor(){super({id:"editor.action.reindentselectedlines",label:J(0,"Reindent Selected Lines"),alias:"Reindent Selected Lines",precondition:fS.writable})}run(t,i){const e=t.get(cd),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=E6(s,e,i,n);r.push(...o)}r.length>0&&(i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop())}});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())}))};class j6{constructor(t,i){this.range=t,this.direction=i}}class W6{constructor(t,i,e){this.hint=t,this.anchor=i,this.provider=e,this._isResolved=!1}with(t){const i=new W6(this.hint,t.anchor,this.provider);return i._isResolved=this._isResolved,i._currentResolve=this._currentResolve,i}resolve(t){return $6(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 $6(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 V6{static create(t,i,e,s){return $6(this,void 0,void 0,(function*(){const n=[],r=t.ordered(i).reverse().map((t=>e.map((e=>$6(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 V6(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=V6._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 W6(i,new j6(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 H6=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 z6(t,i,e,s){var n;return H6(this,void 0,void 0,(function*(){const r=t.get(Xr),o=t.get(AR),h=t.get(lo),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(kh.getMenuItems(wh.EditorContext).map((t=>vh(t)?t.command.id:p0())));for(const t of nY.all())d.has(t.desc.id)&&a.push(new so(t.desc.id,Sh.label(t.desc,{renderShortTitle:!0}),void 0,!0,(()=>H6(this,void 0,void 0,(function*(){const e=yield r.createModelReference(u.uri);try{const n=new sY(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 ro),a.push(new so(t.id,t.title,void 0,!0,(()=>H6(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=ol(e);return{x:t.left,y:t.top+t.height+8}},getActions:()=>a,onHide:()=>{i.focus()},autoSelectFirstItem:!0})}))}function U6(t,i,e,s){return H6(this,void 0,void 0,(function*(){const n=t.get(Xr),r=yield n.createModelReference(s.uri);yield e.invokeWithinContext((t=>H6(this,void 0,void 0,(function*(){const n=i.hasSideBySideModifier,o=t.get(Zo),h=JJ.inPeekEditor.getValue(o),c=!n&&e.getOption(87)&&!h;return new rY({openToSide:n,openInPeek:c,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(t,new sY(r.object.textEditorModel,ps.getStartPosition(s.range)),ps.lift(s.range))})))),r.dispose()}))}var K6,q6=function(t,i){return function(e,s){i(e,s,t)}},G6=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 Z6{constructor(){this._entries=new hg(50)}get(t){const i=Z6._key(t);return this._entries.get(i)}set(t,i){const e=Z6._key(t);this._entries.set(e,i)}static _key(t){return`${t.uri.toString()}/${t.getVersionId()}`}}const J6=Jr("IInlayHintsCache");$a(J6,Z6,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 Y6{constructor(t,i){this.part=t,this.hasTriggerModifier=i}}let X6=K6=class{static get(t){var i;return null!==(i=t.getContribution(K6.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 zb(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 Eu((()=>G6(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 e=s.token,o=yield V6.create(this._languageFeaturesService.inlayHintsProvider,i,this._getHintsRanges(),e);if(r.delay=this._debounceInfo.update(i,Date.now()-t),e.isCancellationRequested)return void o.dispose();for(const t of o.provider)"function"!=typeof t.onDidChangeInlayHints||n.has(t)||(n.add(t),this._sessionDisposables.add(t.onDidChangeInlayHints((()=>{r.isScheduled()||r.schedule()}))));this._sessionDisposables.add(o),this._updateHintsDecorators(o.ranges,o.items),this._cacheHintsForFastRestore(i)}catch(t){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(Hl.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 BJ(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 Y6(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=>G6(this,void 0,void 0,(function*(){const i=this._getInlayHintLabelPart(t);if(i){const e=i.part;e.location?this._instaService.invokeFunction(U6,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=>G6(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=>FT.replace(ps.lift(t.range),t.text)));this._editor.executeEdits("inlayHint.default",i),t()}}))))}_installContextMenu(){return this._editor.onContextMenu((t=>G6(this,void 0,void 0,(function*(){if(!(t.event.target instanceof HTMLElement))return;const i=this._getInlayHintLabelPart(t);i&&(yield this._instaService.invokeFunction(z6,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 G6(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 j6(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?tf.Right:tf.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=mk(Xv),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?tf.Right:tf.None,new Q6(t,s))}if(t.hint.paddingRight&&o(t,!0),n.length>K6._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=iU.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=mk(rw),t.color=mk(nw)):i.kind===_s.Type?(t.backgroundColor=mk(sw),t.color=mk(ew)):(t.backgroundColor=mk(iw),t.color=mk(tw))}_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()}};X6.ID="editor.contrib.InlayHints",X6._MAX_DECORATORS=1500,X6=K6=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([q6(1,$g),q6(2,FF),q6(3,J6),q6(4,lo),q6(5,vO),q6(6,Zr)],X6),uo.registerCommand("_executeInlayHintProvider",((t,...i)=>G6(void 0,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e)),B(ps.isIRange(s));const{inlayHintsProvider:n}=t.get($g),r=yield t.get(Xr).createModelReference(e);try{const t=yield V6.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 t9=function(t,i){return function(e,s){i(e,s,t)}},i9=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 extends kY{constructor(t,i,e,s){super(10,i,t.item.anchor.range,e,s,!0),this.part=t}}let s9=class extends KY{constructor(t,i,e,s,n,r){super(t,i,e,s,r),this._resolverService=n,this.hoverOrdinal=6}suggestHoverAnchor(t){var i;if(!X6.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 e9(e.attachedData,this,t.event.posx,t.event.posy):null}computeSync(){return[]}computeAsync(t,i,e){return t instanceof e9?new Fu((i=>i9(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 UY(this,t.range,[h],!1,0)),a(o.item.hint.textEdits)&&i.emitOne(new UY(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 UY(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:jc.command,path:l.id,query:l.arguments&&encodeURIComponent(JSON.stringify(l.arguments))}).toString()} "${o.part.command.title}") (${s})`,{isTrusted:!0})),e&&i.emitOne(new UY(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}}})))):Fu.EMPTY}_resolveInlayHintLabelPartHover(t,i){return i9(this,void 0,void 0,(function*(){if(!t.part.location)return Fu.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)?VY(this._languageFeaturesService.hoverProvider,e,new gs(s.startLineNumber,s.startColumn),i).filter((t=>!z_(t.hover.contents))).map((i=>new UY(this,t.item.anchor.range,i.hover.contents,!1,2+i.ordinal))):Fu.EMPTY}finally{n.dispose()}}))}};s9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([t9(1,Pa),t9(2,AF),t9(3,Oa),t9(4,Xr),t9(5,$g)],s9),ru(X6.ID,X6,1),CY.register(s9);class n9{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 r9;let o9=r9=class{static get(t){return t.getContribution(r9.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 hK(this.editor,5),h=n.uri;return this.editorWorkerService.canNavigateValueSet(h)?(this.currentRequest=mu((()=>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 n9(s,r,i.value);this.editor.pushUndoStop(),this.editor.executeCommand(t,c),this.editor.pushUndoStop(),this.decorations.set([{range:n,options:r9.DECORATION}]),null===(e=this.decorationRemover)||void 0===e||e.cancel(),this.decorationRemover=ku(350),this.decorationRemover.then((()=>this.decorations.clear())).catch(Ei)})).catch(Ei)):Promise.resolve(void 0)}};o9.ID="editor.contrib.inPlaceReplaceController",o9.DECORATION=$M.register({description:"in-place-replace",className:"valueSetReplacement"}),o9=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)}}(1,MN)],o9),ru(o9.ID,o9,4),su(class extends Yl{constructor(){super({id:"editor.action.inPlaceReplace.up",label:J(0,"Replace with Previous Value"),alias:"Replace with Previous Value",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3159,weight:100}})}run(t,i){const e=o9.get(i);return e?e.run(this.id,!1):Promise.resolve(void 0)}}),su(class extends Yl{constructor(){super({id:"editor.action.inPlaceReplace.down",label:J(0,"Replace with Next Value"),alias:"Replace with Next Value",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3161,weight:100}})}run(t,i){const e=o9.get(i);return e?e.run(this.id,!0):Promise.resolve(void 0)}}),su(class extends Yl{constructor(){super({id:"expandLineSelection",label:J(0,"Expand Line Selection"),alias:"Expand Line Selection",precondition:void 0,kbOpts:{weight:0,kbExpr:fS.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,GC.expandLineSelection(s,s.getCursorStates())),s.revealPrimaryCursor(e.source,!0)}});class h9{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++]=FT.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 c9{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 l9=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=D6(u+x6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber,h,this._languageConfigurationService);if(null!==i){const s=jn(t.getLineContent(e)),h=x6(i,n);if(h!==x6(s,n)){const t=D6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(e,1),s.startLineNumber+1,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=x6(r,n),c=x6(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=nS(this._autoIndent,c,t.getLanguageIdAtPosition(s.startLineNumber,1),e,h,this._languageConfigurationService);if(null!==r){const e=jn(t.getLineContent(s.startLineNumber)),h=x6(r,n),c=x6(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=>tS.shiftIndent(s,s.length+1,t,i,e),unshiftIndent:s=>tS.unshiftIndent(s,s.length+1,t,i,e)}}parseEnterResult(t,i,e,s,n){if(n){let r=n.indentation;n.indentAction===Gu.None||n.indentAction===Gu.Indent?r=n.indentation+n.appendText:n.indentAction===Gu.IndentOutdent?r=n.indentation:n.indentAction===Gu.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=rS(t,s,this._languageConfigurationService);return null!==h&&2&h&&(o=i.unshiftIndent(o)),x6(o,e)-x6(n,e)}}return null}matchEnterRuleMovingDown(t,i,e,s,n,r){if(Wn(r)>=0){const r=t.getLineMaxColumn(n),o=JC(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=JC(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=JC(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=D6(x6(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}};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}([function(t,i){return function(e,s){i(e,s,t)}}(3,cd)],l9);class u9{static getCollator(){return u9._COLLATOR||(u9._COLLATOR=new Intl.Collator),u9._COLLATOR}constructor(t,i){this.selection=t,this.descending=i,this.selectionId=null}getEditOperations(t,i){const e=function(t,i,e){const s=a9(t,i,e);return s?FT.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=a9(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 a9(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(u9.getCollator().compare),!0===e&&(o=o.reverse()),{startLineNumber:s,endLineNumber:n,before:r,after:o}}u9._COLLATOR=null;class d9 extends Yl{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 c9(t.selection,this.down,t.ignore));i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}class f9 extends Yl{constructor(t,i){super(i),this.down=t}run(t,i){const e=t.get(cd),s=[],n=i.getSelections()||[],r=i.getOption(12);for(const t of n)s.push(new l9(t,this.down,r,e));i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class g9 extends Yl{constructor(t,i){super(i),this.descending=t}run(t,i){const e=i.getSelections()||[];for(const t of e)if(!u9.canRun(i.getModel(),t,this.descending))return;const s=[];for(let t=0,i=e.length;t<i;t++)s[t]=new u9(e[t],this.descending);i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}class p9 extends Yl{constructor(){super({id:p9.ID,label:J(0,"Trim Trailing Whitespace"),alias:"Trim Trailing Whitespace",precondition:fS.writable,kbOpts:{kbExpr:fS.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 h9(n,s);i.pushUndoStop(),i.executeCommands(this.id,[r]),i.pushUndoStop()}}p9.ID="editor.action.trimTrailingWhitespace";class m9 extends Yl{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=>FT.replace(t,"")));i.pushUndoStop(),i.executeEdits(this.id,o,r),i.pushUndoStop()}}class v9 extends Yl{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(FT.replace(h,this._modifyText(c,n)))}else{const i=s.getValueInRange(t);r.push(FT.replace(t,this._modifyText(i,n)))}i.pushUndoStop(),i.executeEdits(this.id,r),i.pushUndoStop()}}class w9{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 b9 extends v9{constructor(){super({id:"editor.action.transformToTitlecase",label:J(0,"Transform to Title Case"),alias:"Transform to Title Case",precondition:fS.writable})}_modifyText(t,i){const e=b9.titleBoundary.get();return e?t.toLocaleLowerCase().replace(e,(t=>t.toLocaleUpperCase())):t}}b9.titleBoundary=new w9("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");class y9 extends v9{constructor(){super({id:"editor.action.transformToSnakecase",label:J(0,"Transform to Snake Case"),alias:"Transform to Snake Case",precondition:fS.writable})}_modifyText(t,i){const e=y9.caseBoundary.get(),s=y9.singleLetters.get();return e&&s?t.replace(e,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase():t}}y9.caseBoundary=new w9("(\\p{Ll})(\\p{Lu})","gmu"),y9.singleLetters=new w9("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");class k9 extends v9{constructor(){super({id:"editor.action.transformToCamelcase",label:J(0,"Transform to Camel Case"),alias:"Transform to Camel Case",precondition:fS.writable})}_modifyText(t,i){const e=k9.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("")}}k9.wordBoundary=new w9("[_\\s-]","gm");class C9 extends v9{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:fS.writable})}_modifyText(t,i){const e=C9.caseBoundary.get(),s=C9.singleLetters.get(),n=C9.underscoreBoundary.get();return e&&s&&n?t.replace(n,"$1-$3").replace(e,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase():t}}C9.caseBoundary=new w9("(\\p{Ll})(\\p{Lu})","gmu"),C9.singleLetters=new w9("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),C9.underscoreBoundary=new w9("(\\S)(_)(\\S)","gm"),su(class extends d9{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:J(0,"Copy Line Up"),alias:"Copy Line Up",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"&&Copy Line Up"),order:1}})}}),su(class extends d9{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:J(0,"Copy Line Down"),alias:"Copy Line Down",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Co&&py Line Down"),order:2}})}}),su(class extends Yl{constructor(){super({id:"editor.action.duplicateSelection",label:J(0,"Duplicate Selection"),alias:"Duplicate Selection",precondition:fS.writable,menuOpts:{menuId:wh.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 c9(t,!0));else{const i=new ms(t.endLineNumber,t.endColumn,t.endLineNumber,t.endColumn);s.push(new BC(i,r.getValueInRange(t)))}i.pushUndoStop(),i.executeCommands(this.id,s),i.pushUndoStop()}}),su(class extends f9{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:J(0,"Move Line Up"),alias:"Move Line Up",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Mo&&ve Line Up"),order:3}})}}),su(class extends f9{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:J(0,"Move Line Down"),alias:"Move Line Down",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"2_line",title:J(0,"Move &&Line Down"),order:4}})}}),su(class extends g9{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:J(0,"Sort Lines Ascending"),alias:"Sort Lines Ascending",precondition:fS.writable})}}),su(class extends g9{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:J(0,"Sort Lines Descending"),alias:"Sort Lines Descending",precondition:fS.writable})}}),su(class extends Yl{constructor(){super({id:"editor.action.removeDuplicateLines",label:J(0,"Delete Duplicate Lines"),alias:"Delete Duplicate Lines",precondition:fS.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(FT.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()}}),su(p9),su(class extends Yl{constructor(){super({id:"editor.action.deleteLines",label:J(0,"Delete Line"),alias:"Delete Line",precondition:fS.writable,kbOpts:{kbExpr:fS.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(FT.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}}),su(class extends Yl{constructor(){super({id:"editor.action.indentLines",label:J(0,"Indent Line"),alias:"Indent Line",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2142,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.indent(e.cursorConfig,i.getModel(),i.getSelections())),i.pushUndoStop())}}),su(class extends Yl{constructor(){super({id:"editor.action.outdentLines",label:J(0,"Outdent Line"),alias:"Outdent Line",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2140,weight:100}})}run(t,i){CS.Outdent.runEditorCommand(t,i,null)}}),su(class extends Yl{constructor(){super({id:"editor.action.insertLineBefore",label:J(0,"Insert Line Above"),alias:"Insert Line Above",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:3075,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.lineInsertBefore(e.cursorConfig,i.getModel(),i.getSelections())))}}),su(class extends Yl{constructor(){super({id:"editor.action.insertLineAfter",label:J(0,"Insert Line Below"),alias:"Insert Line Below",precondition:fS.writable,kbOpts:{kbExpr:fS.editorTextFocus,primary:2051,weight:100}})}run(t,i){const e=i._getViewModel();e&&(i.pushUndoStop(),i.executeCommands(this.id,oS.lineInsertAfter(e.cursorConfig,i.getModel(),i.getSelections())))}}),su(class extends m9{constructor(){super({id:"deleteAllLeft",label:J(0,"Delete All Left"),alias:"Delete All Left",precondition:fS.writable,kbOpts:{kbExpr:fS.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)}}),su(class extends m9{constructor(){super({id:"deleteAllRight",label:J(0,"Delete All Right"),alias:"Delete All Right",precondition:fS.writable,kbOpts:{kbExpr:fS.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}}),su(class extends Yl{constructor(){super({id:"editor.action.joinLines",label:J(0,"Join Lines"),alias:"Join Lines",precondition:fS.writable,kbOpts:{kbExpr:fS.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(FT.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(FT.replace(m,p)),t=new ms(i.startLineNumber-u,i.startColumn,i.endLineNumber-u,i.endColumn)):(h.push(FT.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()}}),su(class extends Yl{constructor(){super({id:"editor.action.transpose",label:J(0,"Transpose Characters around the Cursor"),alias:"Transpose Characters around the Cursor",precondition:fS.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 NC(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 WC(t,i,new ms(r.lineNumber,r.column+1,r.lineNumber,r.column+1)))}}i.pushUndoStop(),i.executeCommands(this.id,n),i.pushUndoStop()}}),su(class extends v9{constructor(){super({id:"editor.action.transformToUppercase",label:J(0,"Transform to Uppercase"),alias:"Transform to Uppercase",precondition:fS.writable})}_modifyText(t,i){return t.toLocaleUpperCase()}}),su(class extends v9{constructor(){super({id:"editor.action.transformToLowercase",label:J(0,"Transform to Lowercase"),alias:"Transform to Lowercase",precondition:fS.writable})}_modifyText(t,i){return t.toLocaleLowerCase()}}),y9.caseBoundary.isSupported()&&y9.singleLetters.isSupported()&&su(y9),k9.wordBoundary.isSupported()&&su(k9),b9.titleBoundary.isSupported()&&su(b9),C9.isSupported()&&su(C9);var S9,x9=function(t,i){return function(e,s){i(e,s,t)}},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())}))};const E9=new Go("LinkedEditingInputVisible",!1);let A9=S9=class extends Hi{static get(t){return t.getContribution(S9.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=E9.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 bu(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 bu(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 D9(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=mu((t=>D9(this,void 0,void 0,(function*(){try{const r=new Zi(!1),o=yield M9(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:S9.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 M9(t,i,e,s){return Su(t.ordered(i).map((t=>()=>D9(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)))}A9.ID="editor.contrib.linkedEditing",A9.DECORATION=$M.register({description:"linked-editing",stickiness:0,className:"linked-editing-decoration"}),A9=S9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([x9(1,Zo),x9(2,$g),x9(3,cd),x9(4,FF)],A9),eu(new(Ql.bindToContribution(A9.get))({id:"cancelLinkedEditingInput",precondition:E9,handler:t=>t.clearRanges(),kbOpts:{kbExpr:fS.editorTextFocus,weight:199,primary:9,secondary:[1033]}})),Lm("editor.linkedEditingBackground",{dark:Eg.fromHex("#f00").transparent(.3),light:Eg.fromHex("#f00").transparent(.3),hcDark:Eg.fromHex("#f00").transparent(.3),hcLight:Eg.white},J(0,"Background color when the editor auto renames on type.")),iu("_executeLinkedEditingProvider",((t,i,e)=>{const{linkedEditingRangeProvider:s}=t.get($g);return M9(s,i,e,ue.None)})),ru(A9.ID,A9,1),su(class extends Yl{constructor(){super({id:"editor.action.linkedEditing",label:J(0,"Start Linked Editing"),alias:"Start Linked Editing",precondition:Mo.and(fS.writable,fS.hasRenameProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:3132,weight:100}})}runCommand(t,i){const e=t.get(Qr),[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=A9.get(i);return e?Promise.resolve(e.updateRanges(!0)):Promise.resolve()}});var L9=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 O9{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 L9(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 F9{constructor(t){this._disposables=new Vi;let i=[];for(const[e,s]of t){const t=e.links.map((t=>new O9(t,s)));i=F9._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 T9(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 F9(c(s));return e.isCancellationRequested?(t.dispose(),new F9([])):t}))}uo.registerCommand("_executeLinkProvider",((t,...i)=>L9(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($g),r=t.get(Yr).getModel(e);if(!r)return[];const o=yield T9(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 R9,_9=function(t,i){return function(e,s){i(e,s,t)}};let I9=R9=class extends Hi{static get(t){return t.getContribution(R9.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 Eu((()=>this.computeLinksNow()),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new BJ(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=mu((i=>T9(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(N9.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 N9(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===jc.file&&t.startsWith(`${jc.file}:`)){const e=ss.parse(t);if(e.scheme===jc.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()}};I9.ID="editor.linkDetector",I9=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}([_9(1,AF),_9(2,vO),_9(3,$g),_9(4,FF)],I9);const P9={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 N9{static decoration(t,i){return{range:t.range,options:N9._getOptions(t,i,!1)}}static _getOptions(t,i,e){const s=Object.assign({},e?P9.active:P9.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,N9._getOptions(this.link,i,!0))}deactivate(t,i){t.changeDecorationOptions(this.decorationId,N9._getOptions(this.link,i,!1))}}ru(I9.ID,I9,1),su(class extends Yl{constructor(){super({id:"editor.action.openLink",label:J(0,"Open Link"),alias:"Open Link",precondition:void 0})}run(t,i){const e=I9.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 B9 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})})))}}B9.ID="editor.contrib.longLinesHelper",ru(B9.ID,B9,2);const $9=Lm("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);Lm("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),Lm("editor.wordHighlightTextBackground",{light:$9,dark:$9,hcDark:$9,hcLight:$9},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 j9=Lm("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Im,hcLight:Im},J(0,"Border color of a symbol during read-access, like reading a variable."));Lm("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Im,hcLight:Im},J(0,"Border color of a symbol during write-access, like writing to a variable.")),Lm("editor.wordHighlightTextBorder",{light:j9,dark:j9,hcDark:j9,hcLight:j9},J(0,"Border color of a textual occurrence for a symbol."));const W9=Lm("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),V9=Lm("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),H9=Lm("editorOverviewRuler.wordHighlightTextForeground",{dark:fb,light:fb,hcDark:fb,hcLight:fb},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),z9=$M.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:mk(V9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),U9=$M.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:mk(H9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),K9=$M.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:mk(fb),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}}),q9=$M.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),G9=$M.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:mk(W9),position:Qd.Center},minimap:{color:mk(pb),position:Xd.Inline}});function Z9(t){return t?q9:K9}yk(((t,i)=>{const e=t.getColor(zv);e&&i.addRule(`.monaco-editor .selectionHighlight { background-color: ${e.transparent(.5)}; }`)}));var J9;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(", ");sm(J(0,1===e.length?"Cursor added: {0}":"Cursors added: {0}",t))}}class Y9{constructor(t,i,e){this.selections=t,this.revealRange=i,this.revealScrollType=e}}class X9{static create(t,i){if(!t.hasModel())return null;const e=i.getState();if(!t.hasTextFocus()&&e.isRevealed&&e.searchString.length>0)return new X9(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 X9(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 Y9(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 Y9(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 Y9(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 Y9(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 t7 extends Hi{static get(t){return t.getContribution(t7.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=X9.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(!n7(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))))}}}t7.ID="editor.contrib.multiCursorController";class i7 extends Yl{run(t,i){const e=t7.get(i);if(!e)return;const s=i._getViewModel();if(s){const n=s.getCursorStates(),r=z2.get(i);if(r)this._run(e,r);else{const s=t.get(Zr).createInstance(z2,i);this._run(e,s),s.dispose()}Q9(n,s.getCursorStates())}}}class e7{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 s7=J9=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 Eu((()=>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=z2.get(t);e&&this._register(e.getState().onFindReplaceStateChange((()=>{this._update()}))),this.updateSoon.schedule()}_update(){this._setState(J9._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=t7.get(e);if(!n)return null;const r=z2.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(!n7(e.getModel(),t,i))return null}o=X9.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 e7(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:Z9(r)})));this._decorations.set(o)}dispose(){this._setState(null),super.dispose()}};function n7(t,i,e){const s=r7(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!==r7(t,r,!e))return!1}return!0}function r7(t,i,e){const s=t.getValueInRange(i);return e?s.toLowerCase():s}s7.ID="editor.contrib.selectionHighlighter",s7=J9=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([function(t,i){return function(e,s){i(e,s,t)}}(1,$g)],s7),ru(t7.ID,t7,4),ru(s7.ID,s7,1),su(class extends Yl{constructor(){super({id:"editor.action.insertCursorAbove",label:J(0,"Add Cursor Above"),alias:"Add Cursor Above",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:wh.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,GC.addCursorUp(n,r,s)),n.revealTopMostCursor(e.source),Q9(r,n.getCursorStates())}}),su(class extends Yl{constructor(){super({id:"editor.action.insertCursorBelow",label:J(0,"Add Cursor Below"),alias:"Add Cursor Below",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:wh.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,GC.addCursorDown(n,r,s)),n.revealBottomMostCursor(e.source),Q9(r,n.getCursorStates())}}),su(class extends Yl{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:fS.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:wh.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())}}),su(class extends i7{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:fS.focus,primary:2082,weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add &&Next Occurrence"),order:5}})}_run(t,i){t.addSelectionToNextFindMatch(i)}}),su(class extends i7{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:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Add P&&revious Occurrence"),order:6}})}_run(t,i){t.addSelectionToPreviousFindMatch(i)}}),su(class extends i7{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:fS.focus,primary:xe(2089,2082),weight:100}})}_run(t,i){t.moveSelectionToNextFindMatch(i)}}),su(class extends i7{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)}}),su(class extends i7{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:fS.focus,primary:3114,weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"3_multi",title:J(0,"Select All &&Occurrences"),order:7}})}_run(t,i){t.selectAll(i)}}),su(class extends i7{constructor(){super({id:"editor.action.changeAll",label:J(0,"Change All Occurrences"),alias:"Change All Occurrences",precondition:Mo.and(fS.writable,fS.editorTextFocus),kbOpts:{kbExpr:fS.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(t,i){t.selectAll(i)}}),su(class extends Yl{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())}}),su(class extends Yl{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())}}),su(class extends Yl{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()))}}),su(class extends Yl{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 o7=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 h7={Visible:new Go("parameterHintsVisible",!1),MultipleSignatures:new Go("parameterHintsMultipleSignatures",!1)};function c7(t,i,e,s,n){return o7(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)}}))}uo.registerCommand("_executeSignatureHelpProvider",((t,...i)=>o7(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($g),o=yield t.get(Xr).createModelReference(e);try{const t=yield c7(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 l7;!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}}}(l7||(l7={}));class u7 extends Hi{constructor(t,i,e=u7.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ie),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=l7.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new zi),this.triggerChars=new Vd,this.retriggerChars=new Vd,this.triggerId=0,this.editor=t,this.providers=i,this.throttledDelayer=new bu(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=l7.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 l7.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(a7);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 l7.Pending(mu((t=>c7(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 l7.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=l7.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 a7(t,i){switch(i.triggerKind){case Ss.Invoke:return i;case Ss.ContentChange:return t;default:return i}}u7.DEFAULT_DELAY=120;var d7,f7=function(t,i){return function(e,s){i(e,s,t)}};const g7=_l,p7=GW("parameter-hints-next",ys.chevronDown,J(0,"Icon for show next parameter hint.")),m7=GW("parameter-hints-previous",ys.chevronUp,J(0,"Icon for show previous parameter hint."));let v7=d7=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 XG({editor:t},n,s)),this.keyVisible=h7.Visible.bindTo(e),this.keyMultipleSignatures=h7.MultipleSignatures.bindTo(e)}createParameterHintDOMNodes(){const t=g7(".editor-widget.parameter-hints-widget"),i=Ml(t,g7(".phwrapper"));i.tabIndex=-1;const e=Ml(i,g7(".controls")),s=Ml(e,g7(".button"+io.asCSSSelector(m7))),n=Ml(e,g7(".overloads")),r=Ml(e,g7(".button"+io.asCSSSelector(p7)));this._register(Zc(s,"click",(t=>{Dl(t),this.previous()}))),this._register(Zc(r,"click",(t=>{Dl(t),this.next()})));const o=g7(".body"),h=new Gy(o,{alwaysConsumeMouseWheel:!0});this._register(h),i.appendChild(h.getDomNode());const c=Ml(o,g7(".signature")),l=Ml(o,g7(".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=Ml(this.domNodes.signature,g7(".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):Ml(n,g7("span")).textContent=s.label;const h=s.parameters[o];if(null==h?void 0:h.documentation){const t=g7("span.documentation");if("string"==typeof h.documentation)t.textContent=h.documentation;else{const i=this.renderMarkdownDocs(h.documentation);t.appendChild(i.element)}Ml(this.domNodes.docs,g7("p",{},t))}if(void 0===s.documentation);else if("string"==typeof s.documentation)Ml(this.domNodes.docs,g7("p",{},s.documentation));else{const t=this.renderMarkdownDocs(s.documentation);Ml(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&&(em(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),Ml(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 d7.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)}};v7.ID="editor.widget.parameterHintsWidget",v7=d7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([f7(2,Zo),f7(3,AF),f7(4,Pa)],v7),Lm("editorHoverWidget.highlightForeground",{dark:Aw,light:Aw,hcDark:Aw,hcLight:Aw},J(0,"Foreground color of the active item in the parameter hint."));var w7,b7=function(t,i){return function(e,s){i(e,s,t)}};let y7=w7=class extends Hi{static get(t){return t.getContribution(w7.ID)}constructor(t,i,e){super(),this.editor=t,this.model=this._register(new u7(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(v7,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)}};y7.ID="editor.controller.parameterHints",y7=w7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([b7(1,Zr),b7(2,$g)],y7),ru(y7.ID,y7,2),su(class extends Yl{constructor(){super({id:"editor.action.triggerParameterHints",label:J(0,"Trigger Parameter Hints"),alias:"Trigger Parameter Hints",precondition:fS.hasSignatureHelpProvider,kbOpts:{kbExpr:fS.editorTextFocus,primary:3082,weight:100}})}run(t,i){const e=y7.get(i);null==e||e.trigger({triggerKind:Ss.Invoke})}});const k7=Ql.bindToContribution(y7.get);eu(new k7({id:"closeParameterHints",precondition:h7.Visible,handler:t=>t.cancel(),kbOpts:{weight:175,kbExpr:fS.focus,primary:9,secondary:[1033]}})),eu(new k7({id:"showPrevParameterHint",precondition:Mo.and(h7.Visible,h7.MultipleSignatures),handler:t=>t.previous(),kbOpts:{weight:175,kbExpr:fS.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),eu(new k7({id:"showNextParameterHint",precondition:Mo.and(h7.Visible,h7.MultipleSignatures),handler:t=>t.next(),kbOpts:{weight:175,kbExpr:fS.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var C7=function(t,i){return function(e,s){i(e,s,t)}};const S7=new Go("renameInputVisible",!1,J(0,"Whether the rename input widget is visible"));let x7=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=S7.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(Nm),o=t.getColor(Bm);this._domNode.style.backgroundColor=String(null!==(i=t.getColor(Mv))&&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(jm))&&void 0!==e?e:""),this._input.style.backgroundColor=String(null!==(s=t.getColor($m))&&void 0!==s?s:"");const h=t.getColor(Wm);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)}};x7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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(2,pk),C7(3,kC),C7(4,Zo)],x7);var D7,E7=function(t,i){return function(e,s){i(e,s,t)}},A7=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 M7{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 A7(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 A7(this,void 0,void 0,(function*(){return this._provideRenameEdits(t,this._providerRenameIdx,[],i)}))}_provideRenameEdits(t,i,e,s){return A7(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 L7=D7=class{static get(t){return t.getContribution(D7.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(x7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}run(){var t,i;return A7(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 M7(this.editor.getModel(),e,this._languageFeaturesService.renameProvider);if(!s.hasProvider())return;const n=new cK(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=nZ.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=nZ.get(this.editor))||void 0===i||i.showMessage(r.rejectReason,e));if(n.token.isCancellationRequested)return;const o=new cK(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=vu(s.provideRenameEdits(a.newName,o.token),o.token).then((t=>A7(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&&em(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)}};L7.ID="editor.contrib.renameController",L7=D7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([E7(1,Zr),E7(2,vO),E7(3,kT),E7(4,rR),E7(5,Ah),E7(6,Ng),E7(7,$g)],L7),ru(L7.ID,L7,4),su(class extends Yl{constructor(){super({id:"editor.action.rename",label:J(0,"Rename Symbol"),alias:"Rename Symbol",precondition:Mo.and(fS.writable,fS.hasRenameProvider),kbOpts:{kbExpr:fS.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(t,i){const e=t.get(Qr),[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=L7.get(i);return e?e.run():Promise.resolve()}});const O7=Ql.bindToContribution(L7.get);function F7(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),ha.wrap(i)}(i)}eu(new O7({id:"acceptRenameInput",precondition:S7,handler:t=>t.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:3}})),eu(new O7({id:"acceptRenameInputWithPreview",precondition:Mo.and(S7,Mo.has("config.editor.rename.enablePreview")),handler:t=>t.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:Mo.and(fS.focus,Mo.not("isComposing")),primary:1027}})),eu(new O7({id:"cancelRenameInput",precondition:S7,handler:t=>t.cancelRenameInput(),kbOpts:{weight:199,kbExpr:fS.focus,primary:9,secondary:[1033]}})),iu("_executeDocumentRenameProvider",(function(t,i,e,...s){const[n]=s;B("string"==typeof n);const{renameProvider:r}=t.get($g);return function(t,i,e,s){return A7(this,void 0,void 0,(function*(){const n=new M7(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)})),iu("_executePrepareRename",(function(t,i,e){return A7(this,void 0,void 0,(function*(){const{renameProvider:s}=t.get($g),n=new M7(i,e,s),r=yield n.resolveRenameLocation(ue.None);if(null==r?void 0:r.rejectReason)throw new Error(r.rejectReason);return r}))})),ah.as(za).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 T7=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 R7(t){return t&&!!t.data}function _7(t){return t&&Array.isArray(t.edits)}class I7{constructor(t,i,e){this.provider=t,this.tokens=i,this.error=e}}function P7(t,i){return t.has(i)}function N7(t,i,e,s,n){return T7(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=>T7(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&&(R7(r)||_7(r))||(r=null),new I7(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 B7{constructor(t,i){this.provider=t,this.tokens=i}}function $7(t,i){const e=t.orderedGroups(i);return e.length>0?e[0]:[]}function j7(t,i,e,s){return T7(this,void 0,void 0,(function*(){const n=$7(t,i),r=yield Promise.all(n.map((t=>T7(this,void 0,void 0,(function*(){let n;try{n=yield t.provideDocumentRangeSemanticTokens(i,e,s)}catch(t){Ai(t),n=null}return n&&R7(n)||(n=null),new B7(t,n)})))));for(const t of r)if(t.tokens)return t;return r.length>0?r[0]:null}))}uo.registerCommand("_provideDocumentSemanticTokensLegend",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Yr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get($g),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(lo).executeCommand("_provideDocumentRangeSemanticTokensLegend",e)})))),uo.registerCommand("_provideDocumentSemanticTokens",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e]=i;B(e instanceof ss);const s=t.get(Yr).getModel(e);if(!s)return;const{documentSemanticTokensProvider:n}=t.get($g);if(!P7(n,s))return t.get(lo).executeCommand("_provideDocumentRangeSemanticTokens",e,s.getFullModelRange());const r=yield N7(n,s,null,null,ue.None);if(!r)return;const{provider:o,tokens:h}=r;if(!h||!R7(h))return;const c=F7({id:0,type:"full",data:h.data});return h.resultId&&o.releaseDocumentSemanticTokens(h.resultId),c})))),uo.registerCommand("_provideDocumentRangeSemanticTokensLegend",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss);const n=t.get(Yr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get($g),o=$7(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 j7(r,n,ps.lift(s),ue.None);return h?h.provider.getLegend():void 0})))),uo.registerCommand("_provideDocumentRangeSemanticTokens",((t,...i)=>T7(void 0,void 0,void 0,(function*(){const[e,s]=i;B(e instanceof ss),B(ps.isIRange(s));const n=t.get(Yr).getModel(e);if(!n)return;const{documentRangeSemanticTokensProvider:r}=t.get($g),o=yield j7(r,n,ps.lift(s),ue.None);return o&&o.tokens?F7({id:0,type:"full",data:o.tokens.data}):void 0}))));const W7="editor.semanticHighlighting";function V7(t,i,e){var s;const n=null===(s=e.getValue(W7,{overrideIdentifier:t.getLanguageId(),resource:t.uri}))||void 0===s?void 0:s.enabled;return"boolean"==typeof n?n:i.getColorTheme().semanticHighlighting}var H7,z7=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=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._watchers=Object.create(null);const o=i=>{this._watchers[i.uri.toString()]=new q7(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()];V7(t,e,s)?i||o(t):i&&h(t,i)}};this._register(i.onModelAdded((t=>{V7(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(W7)&&c()}))),this._register(e.onDidColorThemeChange(c))}dispose(){for(const t of Object.values(this._watchers))t.dispose();super.dispose()}};K7=z7([U7(0,zF),U7(1,Yr),U7(2,pk),U7(3,Oa),U7(4,FF),U7(5,$g)],K7);let q7=H7=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:H7.REQUEST_MIN_DELAY,max:H7.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Eu((()=>this._fetchDocumentSemanticTokensNow()),H7.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(!P7(this._provider,this._model))return void(this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1));if(!this._model.isAttachedToEditor())return;const t=new de,i=N7(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(_7(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&&(H7._copy(s,o-l,r,h-l,l),h-=l),c.data&&(H7._copy(c.data,0,r,h-c.data.length,c.data.length),h-=c.data.length),o=c.start}o>0&&H7._copy(s,0,r,0,o),i={resultId:i.resultId,data:r}}}if(R7(i)){this._currentDocumentResponse=new G7(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)}};q7.REQUEST_MIN_DELAY=300,q7.REQUEST_MAX_DELAY=2e3,q7=H7=z7([U7(1,zF),U7(2,pk),U7(3,FF),U7(4,$g)],q7);class G7{constructor(t,i,e){this.provider=t,this.resultId=i,this.data=e}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}tH(K7);var Z7=function(t,i){return function(e,s){i(e,s,t)}};let J7=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 Eu((()=>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(W7)&&(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(!V7(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=mu((e=>Promise.resolve(j7(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}};J7.ID="editor.contrib.viewportSemanticTokens",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}([Z7(1,zF),Z7(2,pk),Z7(3,Oa),Z7(4,FF),Z7(5,$g)],J7),ru(J7.ID,J7,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 Y7,X7=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 t8{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 t8(i,this.ranges);return e.ranges[i].equalsRange(this.ranges[this.index])?e.mov(t):e}}let i8=Y7=class{static get(t){return t.getContribution(Y7.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 X7(this,void 0,void 0,(function*(){if(!this._editor.hasModel())return;const i=this._editor.getSelections(),s=this._editor.getModel();if(this._state||(yield s8(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 t8(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}}))}};i8.ID="editor.contrib.smartSelectController",i8=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}([function(t,i){return function(e,s){i(e,s,t)}}(1,$g)],i8);class e8 extends Yl{constructor(t,i){super(i),this._forward=t}run(t,i){return X7(this,void 0,void 0,(function*(){const t=i8.get(i);t&&(yield t.run(this._forward))}))}}function s8(t,i,e,s,n){return X7(this,void 0,void 0,(function*(){const r=t.all(i).concat(new Q7(s.selectSubwords));1===r.length&&r.unshift(new x3);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}))}))}uo.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand"),ru(i8.ID,i8,4),su(class extends e8{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:J(0,"Expand Selection"),alias:"Expand Selection",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Expand Selection"),order:2}})}}),su(class extends e8{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:J(0,"Shrink Selection"),alias:"Shrink Selection",precondition:void 0,kbOpts:{kbExpr:fS.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:wh.MenubarSelectionMenu,group:"1_basic",title:J(0,"&&Shrink Selection"),order:3}})}}),uo.registerCommand("_executeSelectionRangeProvider",(function(t,...i){return X7(this,void 0,void 0,(function*(){const[e,s]=i;B(ss.isUri(e));const n=t.get($g).selectionRangeProvider,r=yield t.get(Xr).createModelReference(e);try{return s8(n,r.object.textEditorModel,s,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},ue.None)}finally{r.dispose()}}))}));const n8=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 r8{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 o8=zu("stickyScrollViewLayer",{createHTML:t=>t}),h8="data-sticky-line-index",c8="data-sticky-is-line",l8="data-sticky-is-folding-icon";class u8 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 jJ),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(),Kc(this._lineNumbersDomNode),Kc(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(Zc(this._lineNumbersDomNode,xl.MOUSE_ENTER,(()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)}))),this._foldingIconStore.add(Zc(this._lineNumbersDomNode,xl.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=np.filter(o.inlineDecorations,r,o.minColumn,o.maxColumn)}catch(t){c=[]}const l=new up(!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 ma(2e3),a=gp(l,u);let d;d=o8?o8.createHTML(u.build()):u.build();const f=document.createElement("span");f.setAttribute(h8,String(t)),f.setAttribute(c8,""),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(h8,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 a8(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 d8(o,r,s.getEndLineNumber(n),this._lineHeight);return h.setVisible(!!this._isOnGlyphMargin||o||"always"===e),h.domNode.setAttribute(l8,""),h}_updateMinContentWidth(){this._minContentWidthInPx=0;for(const t of this._stickyLines)t.lineDomNode.scrollWidth>this._minContentWidthInPx&&(this._minContentWidthInPx=t.lineDomNode.scrollWidth);this._minContentWidthInPx+=this._editor.getLayoutInfo().verticalScrollbarWidth}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:null}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(t){0<=t&&t<this._stickyLines.length&&this._stickyLines[t].lineDomNode.focus()}getEditorPositionFromNode(t){if(!t||t.children.length>0)return null;const i=this._getRenderedStickyLineFromChildDomNode(t);if(!i)return null;const e=py(i.characterMapping,t,0);return new 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,h8);return i?parseInt(i,10):null}isInStickyLine(t){return void 0!==this._getAttributeValue(t,c8)}isInFoldingIconDomNode(t){return void 0!==this._getAttributeValue(t,l8)}_getAttributeValue(t,i){for(;t&&t!==this._rootDomNode;){const e=t.getAttribute(i);if(null!==e)return e;t=t.parentElement}}}class a8{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 d8{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=io.asClassName(t?m4:p4)}setVisible(t){this.domNode.style.cursor=t?"pointer":"default",this.domNode.style.opacity=t?"1":"0"}}class f8{constructor(t,i){this.startLineNumber=t,this.endLineNumber=i}}class g8{constructor(t,i,e){this.range=t,this.children=i,this.parent=e}}class p8{constructor(t,i,e,s){this.uri=t,this.version=i,this.element=e,this.outlineProviderId=s}}var m8,v8,w8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},b8=function(t,i){return function(e,s){i(e,s,t)}},y8=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"}(m8||(m8={})),function(t){t[t.VALID=0]="VALID",t[t.INVALID=1]="INVALID",t[t.CANCELED=2]="CANCELED"}(v8||(v8={}));let k8=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 bu(300)),this._updateOperation=this._register(new Vi);const n=new S8(e),r=new E8(this._editor,e),o=new D8(this._editor,i);switch(s){case m8.OUTLINE_MODEL:this._modelProviders.push(n),this._modelProviders.push(r),this._modelProviders.push(o);break;case m8.FOLDING_PROVIDER_MODEL:this._modelProviders.push(r),this._modelProviders.push(o);break;case m8.INDENTATION_MODEL:this._modelProviders.push(o)}}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}update(t,i,e){return y8(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((()=>y8(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 v8.CANCELED:return this._updateOperation.clear(),null;case v8.VALID:return s.stickyModel}}return null})))).catch((t=>(Ei(t),null)))}))}};k8=w8([b8(1,cd),b8(2,$g)],k8);class C8{constructor(){this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,v8.INVALID}computeStickyModel(t,i,e){if(e.isCancellationRequested||!this.isProviderValid(t))return{statusPromise:this._invalid(),modelPromise:null};const s=mu((e=>this.createModelFromProvider(t,i,e)));return{statusPromise:s.then((s=>this.isModelValid(s)?e.isCancellationRequested?v8.CANCELED:(this._stickyModel=this.createStickyModel(t,i,e,s),v8.VALID):this._invalid())).then(void 0,(t=>(Ei(t),v8.CANCELED))),modelPromise:s}}isModelValid(t){return!0}isProviderValid(t){return!0}}let S8=class extends C8{constructor(t){super(),this._languageFeaturesService=t}createModelFromProvider(t,i,e){return V4.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 p8(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 W4){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 f8(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber),s=new f8(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 g8(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 f8(t.symbol.selectionRange.startLineNumber,t.symbol.range.endLineNumber);return new g8(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 j4?i+t.symbol.range.endLineNumber-t.symbol.selectionRange.startLineNumber:i}};S8=w8([b8(0,$g)],S8);class x8 extends C8{constructor(t){super(),this._foldingLimitReporter=new M4(t)}createStickyModel(t,i,e,s){const n=this._fromFoldingRegions(s);return new p8(t.uri,i,n,void 0)}isModelValid(t){return null!==t}_fromFoldingRegions(t){const i=t.length,e=[],s=new g8(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 g8(new f8(t.getStartLineNumber(n),t.getEndLineNumber(n)+1),[],r);r.children.push(o),e.push(o)}return s}}let D8=class extends x8{constructor(t,i){super(t),this._languageConfigurationService=i}createModelFromProvider(t,i,e){return new a4(t,this._languageConfigurationService,this._foldingLimitReporter).compute(e)}};D8=w8([b8(1,cd)],D8);let E8=class extends x8{constructor(t,i){super(t),this._languageFeaturesService=i}isProviderValid(t){return A4.getFoldingRangeProviders(this._languageFeaturesService,t).length>0}createModelFromProvider(t,i,e){const s=A4.getFoldingRangeProviders(this._languageFeaturesService,t);return new C4(t,s,(()=>this.createModelFromProvider(t,i,e)),this._foldingLimitReporter,void 0).compute(e)}};E8=w8([b8(1,$g)],E8);var A8=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())}))};class L8{constructor(t,i,e){this.startLineNumber=t,this.endLineNumber=i,this.nestingDepth=e}}let O8=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 Eu((()=>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 k8(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 M8(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 M8(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 L8(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}};O8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([A8(1,$g),A8(2,cd)],O8);var F8,T8=function(t,i){return function(e,s){i(e,s,t)}},R8=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 _8=F8=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 u8(this._editor),this._stickyLineCandidateProvider=new O8(this._editor,e,n),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=new r8([],[],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(Zc(h,xl.CONTEXT_MENU,(t=>R8(this,void 0,void 0,(function*(){this._onContextMenu(t)}))))),this._stickyScrollFocusedContextKey=fS.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=fS.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(Al(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(Zc(h,xl.MOUSE_DOWN,(()=>{this._onMouseDown=!0})))}static get(t){return t.getContribution(F8.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 BJ(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(Qc(s,xl.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(Qc(s,xl.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(Zc(s,xl.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)))),VQ(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=>R8(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(U6,t,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor}))})))))}_onContextMenu(t){const i=new jh(t);this._contextMenuService.showContextMenu({menuId:wh.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;s4(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 R8(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=A4.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 f8(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 r8(n,r,s,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};_8.ID="store.contrib.stickyScrollController",_8=F8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([T8(1,AR),T8(2,$g),T8(3,Zr),T8(4,cd),T8(5,FF),T8(6,Zo)],_8);const I8=100;ru(_8.ID,_8,1),Dh(class extends xh{constructor(){super({id:"editor.action.toggleStickyScroll",title:{value:J(0,"Toggle Sticky Scroll"),mnemonicTitle:J(0,"&&Toggle Sticky Scroll"),original:"Toggle Sticky Scroll"},category:n8.View,toggled:{condition:Mo.equals("config.editor.stickyScroll.enabled",!0),title:J(0,"Sticky Scroll"),mnemonicTitle:J(0,"&&Sticky Scroll")},menu:[{id:wh.CommandPalette},{id:wh.MenubarAppearanceMenu,group:"4_editor",order:3},{id:wh.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(Oa),e=!i.getValue("editor.stickyScroll.enabled");return i.updateValue("editor.stickyScroll.enabled",e)}))}}),Dh(class extends tu{constructor(){super({id:"editor.action.focusStickyScroll",title:{value:J(0,"Focus Sticky Scroll"),mnemonicTitle:J(0,"&&Focus Sticky Scroll"),original:"Focus Sticky Scroll"},precondition:Mo.and(Mo.has("config.editor.stickyScroll.enabled"),fS.stickyScrollVisible),menu:[{id:wh.CommandPalette}]})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focus()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:{value:J(0,"Select previous sticky scroll line"),original:"Select previous sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:16}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focusPrevious()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:{value:J(0,"Select next sticky scroll line"),original:"Select next sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:18}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.focusNext()}}),Dh(class extends tu{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:{value:J(0,"Go to focused sticky scroll line"),original:"Go to focused sticky scroll line"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:3}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.goToFocused()}}),Dh(class extends tu{constructor(){super({id:"editor.action.selectEditor",title:{value:J(0,"Select Editor"),original:"Select Editor"},precondition:fS.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:I8,primary:9}})}runEditorCommand(t,i){var e;null===(e=_8.get(i))||void 0===e||e.selectEditor()}});var P8,N8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},B8=function(t,i){return function(e,s){i(e,s,t)}};class $8{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 j8=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 $8(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}};j8=N8([B8(5,w3)],j8);let W8=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(z5.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"!==z5.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 E3(a,i.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=t,this._lastResult.acquire(),l=this._lastResult}else{const e=yield W5(this._languageFeatureService.completionProvider,t,i,new $5(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 A3(e.items,i.column,new E3(a,0),D3.None,this._getEditorOption(117,t),this._getEditorOption(111,t),{boostFullMatch:!1,firstMatchCanBeWeak:!1},n);l=new j8(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}}};W8=N8([B8(1,$g),B8(2,EV),B8(3,w3)],W8);let V8=P8=class{constructor(t,i,e,s){if(1==++P8._counter){const n=s.createInstance(W8,((i,s)=>{var n;return(null!==(n=e.listCodeEditors().find((t=>t.getModel()===s)))&&void 0!==n?n:t).getOption(i)}));P8._disposable=i.inlineCompletionsProvider.register("*",n)}}dispose(){var t;0==--P8._counter&&(null===(t=P8._disposable)||void 0===t||t.dispose(),P8._disposable=void 0)}};V8._counter=0,V8=P8=N8([B8(1,$g),B8(2,Qr),B8(3,Zr)],V8),ru("suggest.inlineCompletionsProvider",V8,0),su(class extends Yl{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 H8 extends xh{constructor(){super({id:H8.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=!dm.getTabFocusMode();dm.setTabFocusMode(t),em(J(0,t?"Pressing Tab will now move focus to the next focusable element":"Pressing Tab will now insert the tab character"))}}H8.ID="editor.action.toggleTabFocusMode",Dh(H8);let z8=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=Ml(t,_l("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 tk(this.el,"click")),o=this._register(new tk(this.el,"keypress")),h=Ji.chain(o.event,(t=>t.map((t=>new Ph(t))).filter((t=>3===t.keyCode)))),c=this._register(new tk(this.el,Cm.Tap)).event;this._register(Sm.addTarget(this.el));const l=Ji.any(r.event,h,c);this._register(l((t=>{this.enabled&&(Dl(t,!0),(null==e?void 0:e.opener)?e.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))}))),this.enabled=!0}};z8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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)],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)}};let q8=class extends Hi{constructor(t,i){super(),this._editor=t,this.instantiationService=i,this.banner=this._register(this.instantiationService.createInstance(G8))}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)}};q8=U8([K8(1,Zr)],q8);let G8=class extends Hi{constructor(t){super(),this.instantiationService=t,this.markdownRenderer=this.instantiationService.createInstance(XG,{}),this.element=_l("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=_l("span");return i.innerText=t,i}return this.markdownRenderer.render(t).element}clear(){Kc(this.element)}show(t){Kc(this.element);const i=this.getAriaLabel(t);i&&this.element.setAttribute("aria-label",i);const e=Ml(this.element,_l("div.icon-container"));e.setAttribute("aria-hidden","true"),t.icon&&e.appendChild(_l(`div${io.asCSSSelector(t.icon)}`));const s=Ml(this.element,_l("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(t.message)),this.messageActionsContainer=Ml(this.element,_l("div.message-actions-container")),t.actions)for(const i of t.actions)this._register(this.instantiationService.createInstance(z8,this.messageActionsContainer,Object.assign(Object.assign({},i),{tabIndex:-1}),{}));const n=Ml(this.element,_l("div.action-container"));this.actionBar=this._register(new cN(n)),this.actionBar.push(this._register(new so("banner.close","Close Banner",io.asClassName(XW),!0,(()=>{"function"==typeof t.onClose&&t.onClose()}))),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};G8=U8([K8(0,Zr)],G8);var Z8=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o},J8=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 Y8=GW("extensions-warning-message",ys.warning,J(0,"Icon shown with a warning message in the extensions editor."));let X8=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 att};else if(t.ambiguousCharacterCount>=i)e={message:J(0,"This document contains many ambiguous unicode characters"),command:new ltt};else{if(!(t.invisibleCharacterCount>=i))throw new Error("Unreachable");e={message:J(0,"This document contains many invisible unicode characters"),command:new utt}}this._bannerController.show({id:"unicodeHighlightBanner",message:e.message,icon:Y8,actions:[{label:e.command.shortLabel,href:`command:${e.command.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(q8,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 ttt(this._editor,i,this._updateState,this._editorWorkerService):new itt(this._editor,i,this._updateState)}getDecorationInfo(t){return this._highlighter?this._highlighter.getDecorationInfo(t):null}};X8.ID="editor.contrib.unicodeHighlighter",X8=Z8([J8(1,MN),J8(2,DR),J8(3,Zr)],X8);let ttt=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 Eu((()=>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:ott.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:rtt(i.getValueInRange(t.range),this._options),inComment:UL(i,t),inString:KL(i,t)}:null}};ttt=Z8([J8(3,MN)],ttt);class itt 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 Eu((()=>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=mf.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:ott.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:rtt(e,this._options),inComment:UL(i,t),inString:KL(i,t)}:null}}let ett=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(X8.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=ntt(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,ntt(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,ntt(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:${dtt.ID}?${encodeURIComponent(JSON.stringify(u))}`,f=new H_("",!0).appendMarkdown(l).appendText(" ").appendLink(d,a);n.push(new UY(this,t.range,[f],!1,o++))}return n}renderHoverParts(t,i){return qY(t,i,this._editor,this._languageService,this._openerService)}};function stt(t){return`U+${t.toString(16).padStart(4,"0")}`}function ntt(t){let i=`\`${stt(t)}\``;return Cr.isInvisibleCharacter(t)||(i+=` "${function(t){return 96===t?"`` ` ``":"`"+String.fromCodePoint(t)+"`"}(t)}"`),i}function rtt(t,i){return mf.computeUnicodeHighlightReason(t,i)}ett=Z8([J8(1,Pa),J8(2,AF)],ett);class ott{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}}ott.instance=new ott;class htt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(vi,!1,2)}))}}class ctt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(wi,!1,2)}))}}class ltt extends Yl{constructor(){super({id:ltt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(mi,!1,2)}))}}ltt.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";class utt extends Yl{constructor(){super({id:utt.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(gi,!1,2)}))}}utt.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";class att extends Yl{constructor(){super({id:att.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(Oa);i&&this.runAction(i)}))}runAction(t){return Q8(this,void 0,void 0,(function*(){yield t.updateValue(pi,!1,2)}))}}att.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";class dtt extends Yl{constructor(){super({id:dtt.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(Oa),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*(){ftt(c,[t])}))});if(l.push({label:function(t){return Cr.isInvisibleCharacter(t)?J(0,"Exclude {0} (invisible character) from being highlighted",stt(t)):J(0,"Exclude {0} from being highlighted",`${stt(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 htt;l.push({label:t.label,run:()=>Q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}else if(n){const t=new ctt;l.push({label:t.label,run:()=>Q8(this,void 0,void 0,(function*(){return t.runAction(c)}))})}if(0===s.kind){const t=new ltt;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 utt;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 att;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 ftt(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)}))}dtt.ID="editor.action.unicodeHighlight.showExcludeOptions",su(ltt),su(utt),su(att),su(dtt),ru(X8.ID,X8,1),CY.register(ett);var gtt=function(t,i){return function(e,s){i(e,s,t)}};const ptt="ignoreUnusualLineTerminators";let mtt=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,ptt)}(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,ptt,!0)}(this._codeEditorService,t)}))}};mtt.ID="editor.contrib.unusualLineTerminatorsDetector",mtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,lF),gtt(2,Qr)],mtt),ru(mtt.ID,mtt,1);var vtt,wtt=function(t,i){return function(e,s){i(e,s,t)}};const btt=new Go("hasWordHighlights",!1);function ytt(t,i,e,s){return Su(t.ordered(i).map((t=>()=>Promise.resolve(t.provideDocumentHighlights(i,e,s)).then(void 0,Ai))),a)}class ktt{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=mu((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 Ctt extends ktt{constructor(t,i,e,s){super(t,i,e),this._providers=s}_compute(t,i,e,s){return ytt(this._providers,t,i.getPosition(),s).then((t=>t||[]))}}class Stt extends ktt{constructor(t,i,e){super(t,i,e),this._selectionIsEmpty=i.isEmpty()}_compute(t,i,e,s){return ku(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)}}iu("_executeDocumentHighlights",((t,i,e)=>ytt(t.get($g).documentHighlightProvider,i,e,ue.None)));class xtt{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=btt.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&&em(`${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&&em(`${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 Ctt(i,e,s,t):new Stt(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?z9:i===xs.Text?U9:G9)});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 Dtt=vtt=class extends Hi{static get(t){return t.getContribution(vtt.ID)}constructor(t,i,e){super(),this.wordHighlighter=null,this.linkedContributions=new Set;const s=()=>{t.hasModel()&&!t.getModel().isTooLargeForTokenization()&&(this.wordHighlighter=new xtt(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()}};Dtt.ID="editor.contrib.wordHighlighter",Dtt=vtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([wtt(1,Zo),wtt(2,$g)],Dtt);class Ett extends Yl{constructor(t,i){super(i),this._isNext=t}run(t,i){const e=Dtt.get(i);e&&(this._isNext?e.moveNext():e.moveBack())}}ru(Dtt.ID,Dtt,0),su(class extends Ett{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:J(0,"Go to Next Symbol Highlight"),alias:"Go to Next Symbol Highlight",precondition:btt,kbOpts:{kbExpr:fS.editorTextFocus,primary:65,weight:100}})}}),su(class extends Ett{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:J(0,"Go to Previous Symbol Highlight"),alias:"Go to Previous Symbol Highlight",precondition:btt,kbOpts:{kbExpr:fS.editorTextFocus,primary:1089,weight:100}})}}),su(class extends Yl{constructor(){super({id:"editor.action.wordHighlight.trigger",label:J(0,"Trigger Symbol Highlight"),alias:"Trigger Symbol Highlight",precondition:btt.toNegated(),kbOpts:{kbExpr:fS.editorTextFocus,primary:0,weight:100}})}run(t,i,e){const s=Dtt.get(i);s&&s.restoreViewState(!0)}});class Att extends Ql{constructor(t){super(t),this._inSelectionMode=t.inSelectionMode,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){if(!i.hasModel())return;const s=Jd(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=>OC.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 Mtt extends Att{_move(t,i,e,s){return UC.moveWordLeft(t,i,e,s)}}class Ltt extends Att{_move(t,i,e,s){return UC.moveWordRight(t,i,e,s)}}class Ott extends Ql{constructor(t){super(t),this._whitespaceHeuristics=t.whitespaceHeuristics,this._wordNavigationType=t.wordNavigationType}runEditorCommand(t,i,e){const s=t.get(cd);if(!i.hasModel())return;const n=Jd(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 NC(e,"")}));i.pushUndoStop(),i.executeCommands(this.id,a),i.pushUndoStop()}}class Ftt extends Ott{_delete(t,i){return UC.deleteWordLeft(t,i)||new ps(1,1,1,1)}}class Ttt extends Ott{_delete(t,i){const e=UC.deleteWordRight(t,i);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}),eu(new class extends Mtt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:2063,mac:{primary:527},weight:100}})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:3087,mac:{primary:1551},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}),eu(new class extends Ltt{constructor(){var t;super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:2065,mac:{primary:529},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}),eu(new class extends Ltt{constructor(){var t;super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:Mo.and(fS.textInputFocus,null===(t=Mo.and(gm,E$))||void 0===t?void 0:t.negate()),primary:3089,mac:{primary:1553},weight:100}})}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Mtt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ltt{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(t,i,e,s){return super._move(Jd(xi.wordSeparators.defaultValue),i,e,s)}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:fS.writable})}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:fS.writable})}}),eu(new class extends Ftt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:fS.writable})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:fS.writable})}}),eu(new class extends Ttt{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}),su(class extends Yl{constructor(){super({id:"deleteInsideWord",precondition:fS.writable,label:J(0,"Delete Word"),alias:"Delete Word"})}run(t,i,e){if(!i.hasModel())return;const s=Jd(i.getOption(129)),n=i.getModel(),r=i.getSelections().map((t=>{const i=UC.deleteInsideWord(s,n,t);return new NC(i,"")}));i.pushUndoStop(),i.executeCommands(this.id,r),i.pushUndoStop()}});class Rtt extends Att{_move(t,i,e,s){return KC.moveWordPartLeft(t,i,e)}}uo.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft"),uo.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class _tt extends Att{_move(t,i,e,s){return KC.moveWordPartRight(t,i,e)}}eu(new class extends Ott{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(t,i){return KC.deleteWordPartLeft(t)||new ps(1,1,1,1)}}),eu(new class extends Ott{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:fS.writable,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(t,i){const e=KC.deleteWordPartRight(t);if(e)return e;const s=t.model.getLineCount(),n=t.model.getLineMaxColumn(s);return new ps(s,n,s,n)}}),eu(new class extends Rtt{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}),eu(new class extends Rtt{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}),eu(new class extends _tt{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}),eu(new class extends _tt{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:fS.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}});class Itt extends Hi{constructor(t){super(),this.editor=t,this._register(this.editor.onDidAttemptReadOnlyEdit((()=>this._onDidAttemptReadOnlyEdit())))}_onDidAttemptReadOnlyEdit(){const t=nZ.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())}}}Itt.ID="editor.contrib.readOnlyMessageController",ru(Itt.ID,Itt,2);class Ptt 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 Ntt(this.editor):this.widget&&!t&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}}Ptt.ID="editor.contrib.iPadShowKeyboard";class Ntt extends Hi{constructor(t){super(),this.editor=t,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Zc(this._domNode,"touchstart",(()=>{this.editor.focus()}))),this._register(Zc(this._domNode,"focus",(()=>{this.editor.focus()}))),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return Ntt.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}}Ntt.ID="editor.contrib.ShowKeyboardWidget",ru(Ptt.ID,Ptt,3);var Btt,$tt=function(t,i){return function(e,s){i(e,s,t)}};let jtt=Btt=class extends Hi{static get(t){return t.getContribution(Btt.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 Wtt(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};jtt.ID="editor.contrib.inspectTokens",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(1,aV),$tt(2,Pa)],jtt);class Wtt 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:()=>Yg,tokenize:(t,e,s)=>Xg(i,s),tokenizeEncoded:(t,i,e)=>tp(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 Wtt._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)),Ol(this._domNode,_l("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),_l("span.tm-token-length",void 0,`${r.length} ${1===r.length?"char":"chars"}`))),Ml(this._domNode,_l("hr.tokens-inspect-separator",{style:"clear:both"}));const o=1+(s<<1)<i.tokens2.length?this._decodeMetadata(i.tokens2[1+(s<<1)]):null;Ml(this._domNode,_l("table.tm-metadata-table",void 0,_l("tbody",void 0,_l("tr",void 0,_l("td.tm-metadata-key",void 0,"language"),_l("td.tm-metadata-value",void 0,`${o?o.languageId:"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"token type"),_l("td.tm-metadata-value",void 0,`${o?this._tokenTypeToString(o.tokenType):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"font style"),_l("td.tm-metadata-value",void 0,`${o?this._fontStyleToString(o.fontStyle):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"foreground"),_l("td.tm-metadata-value",void 0,`${o?Eg.Format.CSS.formatHex(o.foreground):"-?-"}`)),_l("tr",void 0,_l("td.tm-metadata-key",void 0,"background"),_l("td.tm-metadata-value",void 0,`${o?Eg.Format.CSS.formatHex(o.background):"-?-"}`))))),Ml(this._domNode,_l("hr.tokens-inspect-separator")),e<i.tokens1.length&&Ml(this._domNode,_l("span.tm-token-type",void 0,i.tokens1[e].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(t){const i=Ns.getColorMap(),e=ip.getLanguageId(t),s=ip.getTokenType(t),n=ip.getFontStyle(t),r=ip.getForeground(t),o=ip.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]}}}Wtt._ID="editor.contrib.inspectTokensWidget",ru(jtt.ID,jtt,4),su(class extends Yl{constructor(){super({id:"editor.action.inspectTokens",label:vR.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(t,i){const e=jtt.get(i);null==e||e.launch()}});var Vtt,Htt=function(t,i){return function(e,s){i(e,s,t)}};let ztt=Vtt=class{constructor(t,i){this.quickInputService=t,this.keybindingService=i,this.registry=ah.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(Vtt.PREFIX.length));i&&i.prefix&&i.prefix!==Vtt.PREFIX&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})}))),t.items=this.getQuickAccessProviders().filter((t=>t.prefix!==Vtt.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}}))}};ztt.PREFIX="?",ztt=Vtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Htt(0,Ij),Htt(1,kC)],ztt),ah.as(Fj).registerQuickAccessProvider({ctor:ztt,prefix:"",helpEntries:[{description:bR.helpQuickAccessActionLabel}]});class Utt{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=dK(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&&sm(`${e.getLineContent(i.range.startLineNumber)}`)}getModel(t){var i;return aK(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:mk(Gk),position:Qd.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 Ktt extends Utt{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(Ktt.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=dK(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}}Ktt.PREFIX=":";let qtt=class extends Ktt{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}};qtt=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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,Qr)],qtt);class Gtt extends Yl{constructor(){super({id:Gtt.ID,label:wR.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:2085,mac:{primary:293},weight:100}})}run(t){t.get(Ij).quickAccess.show(qtt.PREFIX)}}Gtt.ID="editor.action.gotoLine",su(Gtt),ah.as(Fj).registerQuickAccessProvider({ctor:qtt,prefix:qtt.PREFIX,helpEntries:[{description:wR.gotoLineActionLabel,commandId:Gtt.ID}]});const Ztt=[void 0,[]];function Jtt(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 Ztt;n+=i,r.push(...h)}return[n,Ytt(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)]:Ztt}function Ytt(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 Xtt(t){return t.startsWith('"')&&t.endsWith('"')}Object.freeze({score:0});const tit=" ";function iit(t){"string"!=typeof t&&(t="");const i=t.toLowerCase(),{pathNormalized:e,normalized:s,normalizedLowercase:n}=eit(t),r=e.indexOf(Je)>=0,o=Xtt(t);let h;const c=t.split(tit);if(c.length>1)for(const t of c){const i=Xtt(t),{pathNormalized:e,normalized:s,normalizedLowercase:n}=eit(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 eit(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 sit(t){return Array.isArray(t)?iit(t.map((t=>t.original)).join(tit)):iit(t.original)}var nit,rit=function(t,i){return function(e,s){i(e,s,t)}},oit=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 hit=nit=class extends Utt{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.")),(()=>{oit(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 oit(this,void 0,void 0,(function*(){if(this._languageFeaturesService.documentSymbolProvider.has(t))return!0;const e=new Lu,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=>oit(this,void 0,void 0,(function*(){null==c||c.dispose(!0),e.busy=!1,c=new de(s),e.busy=!0;try{const i=iit(e.value.substr(nit.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=Sf(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 oit(this,void 0,void 0,(function*(){const o=yield t;if(s.isCancellationRequested)return[];const h=0===i.original.indexOf(nit.SCOPE_PREFIX),c=h?1:0;let l,u,a;i.values&&i.values.length>1?(l=sit(i.values[0]),u=sit(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:io.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]=Jtt(k,Object.assign(Object.assign({},i),{values:void 0}),c,C),"number"==typeof S&&(L=!0)),"number"!=typeof S&&([S,x]=Jtt(k,l,c,C),"number"!=typeof S))continue;if(!L&&u){if(A&&u.original.length>0&&([D,E]=Jtt(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(lit[O]||cit,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=(lit[t.kind]||cit).localeCompare(lit[i.kind]||cit);return 0===e?this.compareByScore(t,i):e}getDocumentSymbols(t,i){return oit(this,void 0,void 0,(function*(){const e=yield this._outlineModelService.getOrCreate(t,i);return i.isCancellationRequested?[]:e.asListOfDocumentSymbols()}))}};hit.PREFIX="@",hit.SCOPE_PREFIX=":",hit.PREFIX_BY_CATEGORY=`${nit.PREFIX}${nit.SCOPE_PREFIX}`,hit=nit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([rit(0,$g),rit(1,H4)],hit);const cit=J(0,"properties ({0})"),lit={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 uit=function(t,i){return function(e,s){i(e,s,t)}};let ait=class extends hit{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}};ait=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([uit(0,Qr),uit(1,$g),uit(2,H4)],ait);class dit extends Yl{constructor(){super({id:dit.ID,label:kR.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:fS.hasDocumentSymbolProvider,kbOpts:{kbExpr:fS.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(t){t.get(Ij).quickAccess.show(hit.PREFIX,{itemActivation:_j.NONE})}}function fit(t,i){return i&&(t.stack||t.stacktrace)?J(0,"{0}: {1}",pit(t),git(t.stack)||git(t.stacktrace)):pit(t)}function git(t){return Array.isArray(t)?t.join("\n"):t}function pit(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 mit(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=mit(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 fit(e.error,i);if(e.exception)return fit(e.exception,i)}return t.stack?fit(t,i):t.message?t.message:J(0,"An unknown error occurred. Please consult the log for more details.")}dit.ID="editor.action.quickOutline",su(dit),ah.as(Fj).registerQuickAccessProvider({ctor:ait,prefix:hit.PREFIX,helpEntries:[{description:kR.quickOutlineActionLabel,prefix:hit.PREFIX,commandId:dit.ID},{description:kR.quickOutlineByCategoryActionLabel,prefix:hit.PREFIX_BY_CATEGORY}]});class vit{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}(vit.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=vit.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=vit.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 wit,bit=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 yit(t){return Array.isArray(t.items)}function kit(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"}(wit||(wit={}));class Cit 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=()=>bit(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(yit(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=>bit(this,void 0,void 0,(function*(){let e=!1,s=!1;yield Promise.all([(()=>bit(this,void 0,void 0,(function*(){"number"==typeof i.mergeDelay&&(yield ku(i.mergeDelay),n.isCancellationRequested)||s||(e=l(i.picks,!0))})))(),(()=>bit(this,void 0,void 0,(function*(){t.busy=!0;try{const s=yield i.additionalPicks;if(n.isCancellationRequested)return;let r,o,h,c;if(yit(i.picks)?(r=i.picks.items,o=i.picks.active):r=i.picks,yit(s)?(h=s.items,c=s.active):h=s,h.length>0||!e){let i;if(!o&&!c){const e=t.activeItems[0];e&&-1!==r.indexOf(e)&&(i=e)}l({items:[...r,...h],active:o||c||i})}}finally{n.isCancellationRequested||(t.busy=!1),s=!0}})))()])}));if(null===c);else if(kit(c))yield u(c);else if(c instanceof Promise){t.busy=!0;try{const t=yield c;if(n.isCancellationRequested)return;kit(t)?yield u(t):l(t)}finally{n.isCancellationRequested||(t.busy=!1)}}else l(c)}));return n.add(t.onDidChangeValue((()=>h()))),h(),n.add(t.onDidAccept((i=>{const[e]=t.selectedItems;"function"==typeof(null==e?void 0:e.accept)&&(i.inBackground||t.hide(),e.accept(t.keyMods,i))}))),n.add(t.onDidTriggerItemButton((({button:e,item:s})=>bit(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 wit.NO_ACTION:break;case wit.CLOSE_PICKER:t.hide();break;case wit.REFRESH_PICKER:h();break;case wit.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 Sit,xit,Dit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(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=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=Sit=class extends Cit{constructor(t,i,e,s,n,r){super(Sit.PREFIX,t),this.instantiationService=i,this.keybindingService=e,this.commandService=s,this.telemetryService=n,this.dialogService=r,this.commandsHistory=this._register(this.instantiationService.createInstance(Lit)),this.options=t}_getPicks(t,i,e,s){var n,r,o,h;return Ait(this,void 0,void 0,(function*(){const i=yield this.getCommandPicks(e);if(e.isCancellationRequested)return[];const c=Ni((()=>{const s=new vit;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>Sit.TFIDF_THRESHOLD)).slice(0,Sit.TFIDF_MAX_RESULTS)})),l=[];for(const s of i){const i=null!==(n=Sit.WORD_FILTER(t,s.label))&&void 0!==n?n:void 0,o=s.commandAlias&&null!==(r=Sit.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:(()=>Ait(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:()=>Ait(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),mit(i))}}))})}};Mit.PREFIX=">",Mit.TFIDF_THRESHOLD=.5,Mit.TFIDF_MAX_RESULTS=5,Mit.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),Mit=Sit=Dit([Eit(1,Zr),Eit(2,kC),Eit(3,lo),Eit(4,Eh),Eit(5,lF)],Mit);let Lit=xit=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=xit.getConfiguredCommandHistoryLength(this.configurationService),xit.cache&&xit.cache.limit!==this.configuredCommandsHistoryLength&&(xit.cache.limit=this.configuredCommandsHistoryLength,xit.saveState(this.storageService)))}load(){const t=this.storageService.get(xit.PREF_KEY_CACHE,0);let i;if(t)try{i=JSON.parse(t)}catch(t){}const e=xit.cache=new hg(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)))}xit.counter=this.storageService.getNumber(xit.PREF_KEY_COUNTER,0,xit.counter)}push(t){xit.cache&&(xit.cache.set(t,xit.counter++),xit.saveState(this.storageService))}peek(t){var i;return null===(i=xit.cache)||void 0===i?void 0:i.peek(t)}static saveState(t){if(!xit.cache)return;const i={usesLRU:!0,entries:[]};xit.cache.forEach(((t,e)=>i.entries.push({key:e,value:t}))),t.store(xit.PREF_KEY_CACHE,JSON.stringify(i),0,0),t.store(xit.PREF_KEY_COUNTER,xit.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:xit.DEFAULT_COMMANDS_HISTORY_LENGTH}};Lit.DEFAULT_COMMANDS_HISTORY_LENGTH=50,Lit.PREF_KEY_CACHE="commandPalette.mru.cache",Lit.PREF_KEY_COUNTER="commandPalette.mru.counter",Lit.counter=1,Lit=xit=Dit([Eit(0,PP),Eit(1,Oa)],Lit);class Oit extends Mit{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 Fit=function(t,i){return function(e,s){i(e,s,t)}},Tit=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 Rit=class extends Oit{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 Tit(this,void 0,void 0,(function*(){return this.getCodeEditorCommandPicks()}))}hasAdditionalCommandPicks(){return!1}getAdditionalCommandPicks(){return Tit(this,void 0,void 0,(function*(){return[]}))}};Rit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Fit(0,Zr),Fit(1,Qr),Fit(2,kC),Fit(3,lo),Fit(4,Eh),Fit(5,lF)],Rit);class _it extends Yl{constructor(){super({id:_it.ID,label:yR.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:fS.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(t){t.get(Ij).quickAccess.show(Rit.PREFIX)}}_it.ID="editor.action.quickCommand",su(_it),ah.as(Fj).registerQuickAccessProvider({ctor:Rit,prefix:Rit.PREFIX,helpEntries:[{description:yR.quickCommandHelp,commandId:_it.ID}]});var Iit=function(t,i){return function(e,s){i(e,s,t)}};let Pit=class extends TQ{constructor(t,i,e,s,n,r,o){super(!0,t,i,e,s,n,r,o)}};Pit=function(t,i,e,s){var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,i,e,s);else for(var h=t.length-1;h>=0;h--)(n=t[h])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o}([Iit(1,Zo),Iit(2,Qr),Iit(3,vO),Iit(4,Zr),Iit(5,PP),Iit(6,Oa)],Pit),ru(TQ.ID,Pit,4),su(class extends Yl{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();ry(s.type)?(e.setTheme(this._originalThemeName||(oy(s.type)?eV:iV)),this._originalThemeName=null):(e.setTheme(oy(s.type)?sV:nV),this._originalThemeName=s.themeName)}});var Nit="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Bit(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=Bit((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 jit="define"in window&&"function"==typeof window.define&&"amd"in window.define;function Wit(t){return new Promise((i=>window.require([t],(t=>{i(t)}))))}async function Vit(){return jit?Wit("esri/arcade"):await import("@arcgis/core/arcade.js")}async function Hit(){return jit?Wit("esri/request"):(await import("@arcgis/core/request.js")).default}async function zit(t){return new(await async function(){return jit?Wit("esri/layers/FeatureLayer"):(await import("@arcgis/core/layers/FeatureLayer.js")).default}())({...t,sublayerTitleMode:"service-name"})}function Uit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&t.declaredClass.startsWith("esri.layers.")}function Kit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.rest.support.FeatureSet"===t.declaredClass}function qit(t){return!!t&&"object"==typeof t&&"string"==typeof t.declaredClass&&"esri.layers.FeatureLayer"===t.declaredClass}function Git(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 Jit(t){return!!t&&"object"==typeof t&&null!=t.portalItem}function Qit(t){return!!t&&"object"==typeof t&&Array.isArray(t.fields)&&!("declaredClass"in t)}function Yit(t){return!!t&&"object"==typeof t&&"string"==typeof t.url&&!("declaredClass"in t)}function Xit(t){return!!t&&"object"==typeof t&&"string"==typeof t.id&&"object"==typeof t.definitions&&!Array.isArray(t.definitions)}var tet=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise(((t,i)=>{this.resolve=t,this.reject=i}))}};function iet(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 eet(t,i,e=(()=>{})){if(!i||i.length<=0)return;let s=new MutationObserver((i=>{for(let s of i)iet(t,s.target)&&e()}));return s.observe(document.documentElement,{attributes:!0,attributeFilter:i,subtree:!0}),s}function set(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 net(t){let i=set(t,":is(.calcite-mode-light, .calcite-mode-dark)");return i&&i.classList.contains("calcite-mode-dark")?"dark":"light"}function ret(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(ret(t.children[e],i))return!0;let e=t.shadowRoot;if(e)for(let t=0;t<e.children.length;t++)if(ret(e.children[t],i))return!0;return!1}function oet(t,i){if(!t||!t.shadowRoot)return;if(t.hasAttribute("hydrated")||t.hasAttribute("calcite-hydrated"))return void ret(t,i);let e=new MutationObserver((()=>{e.disconnect(),ret(t,i)}));e.observe(t,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]})}function het(t){let i="";for(let e=0;e<t;e++)i+=(65536*(1+Math.random())|0).toString(16).substring(1);return i}function cet(){return[het(2),het(1),het(1),het(1),het(3)].join("-")}var uet=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"]),aet=new Map;async function det(t,i,e=""){let s=`${i}/${e}${t}.json`;if(aet.has(s))return aet.get(s);try{let n=await fetch(s);if(n.ok){let t=await n.json();return aet.set(s,t),t}if("en"===t)return void aet.set(s,void 0);let r=await det("en",i,e);return aet.set(s,r),r}catch{return void aet.set(s,void 0)}}var fet=new WeakMap,get=new WeakMap,pet=new WeakMap;async function met(t,i,e){get.set(t,i),fet.set(t,eet(t._hostElement,["lang"],(()=>{wet(t,e)}))),await wet(t,e)}function vet(t){fet.get(t)?.disconnect(),fet.delete(t),get.delete(t)}async function wet(t,i){let{lang:e,t9nLocale:s}=function(t){let i=function(t,i,e){return set(t,`[${i}]`)?.getAttribute(i)??e}(t,"lang",navigator?.language||"en");if(uet.has(i))return{lang:i,t9nLocale:i};let e=i.slice(0,2);return{lang:i,t9nLocale:uet.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=pet.get(t);if(!n){let i=get.get(t)??"",e=t._hostElement.tagName.toLowerCase().replace("arcgis-",""),r=`${i}/${e}/t9n`,o=`${e}.t9n.`;n=await det(s,r,o)}t._t9nLocale=s,t._t9nStrings=n,await(i?.call(t))}function bet(t,i){return new Array(i+1).join(t)}function yet(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+bet(e,n.length/2)));let n=new RegExp("(^|[^\\\\])((?:\\\\{2})*)("+i+"+)","g");return t=t.replace(n,((t,e,s,n)=>e+s+bet("\\"+i,n.length))),i+t+i}function ket(t){let i=t?t.replaceAll(/[-[\]/{}()*+?.\\^$|]/g,"\\$&"):"^.*$";return new RegExp(i,"i")}function Cet(t,i={}){return(t??"").replace(/\{(.*?)\}/g,((t,e)=>i[e]??t))}function xet(t){return""+(t??"")+""}function Det(t){return null!==t}function Eet(t){return void 0!==t}function Aet(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 Met(t){try{return new URL(t),!0}catch{return!1}}function Let(t,i,e,s){if(!i)return[];const n=Array.isArray(i)?i:[i];if(!n.length)return[];const r=ket(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 Oet(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 Fet(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 Tet(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 Ret(t){return!!t?.typeIdField}function _et(t){return(i,e)=>{if("oid"===i.type)return-1;if("oid"===e.type)return 1;if(Ret(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 Iet(t,i,e){if(!i||"coded-value"!==i.type)return null;const s=i.codedValues.map((i=>new zet({profile:t,label:`${i.code}`,description:i.name,snippet:`"${i.code}"`,filterDescription:!0})));return new qet(t,e,s)}const Pet=new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);function Net(t,i=!0){return t.match(Pet)?`${i?".":""}${t}`:`["${t}"]`}function Bet(t,i){return t?`${t}${Net(i)}`:i}async function $et(t){if(!t)return null;let i=null;if(Uit(t)||Kit(t)||Qit(t))i=t;else if(i=await zit(t),!qit(i))return console.error("Invalid FeatureSetDefinition",t),null;return i?(e=i,"function"==typeof e?.load&&await i.load(),i):(console.error("Invalid FeatureSetDefinition",t),null);var e}function jet(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 Wet(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 Wet(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 Fet(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=Net(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 Vet{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?xet(this._label):Cet(this._profile?.intlStrings?.[this._label.code],this._label.formatValues)}getDescription(){return null==this.description?"":"string"==typeof this.description?this.description:Cet(this._profile?.intlStrings?.[this.description.code??""],this.description.formatValues)}passFilter(t){return!t||!!t.test(this.getLabel())||this.filterDescription&&t.test(this.getDescription())}}class Het extends Vet{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 zet extends Het{constructor(t){super(t),this.type="text",this.isCollection=!1,this.type=t?.declaration?.type??"text"}getDescription(){return null==this.description?Tet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}}class Uet extends Het{constructor(t){super(t),this.type="array",this.isCollection=!1,this.elementType=t.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return null==this.description?Tet(this._profile?.intlStrings,this.type.toLowerCase())??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}}class Ket extends Het{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 qet extends Vet{constructor(t,i,e=[]){super(t,i),this.variables=e,this.type="group",this.isCollection=!0}passFilter(){return!0}}class Get extends Ket{constructor(t){super(t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t?.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new qet(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=Bet(this.snippet,t.name);switch(t.type){case"number":case"text":case"boolean":case"date":case"geometry":return new zet({profile:this._profile,declaration:t,label:i,snippet:i});case"feature":return new Jet({profile:this._profile,declaration:t,label:i,snippet:i});case"featureSet":return new Qet({profile:this._profile,declaration:t,label:i,snippet:i},[new zet({profile:this._profile,label:i,description:"",snippet:i})]);case"featureSetCollection":return new Yet({profile:this._profile,declaration:t,label:i,snippet:i});case"dictionary":return new Get({profile:this._profile,declaration:t,label:i,snippet:i});case"array":return new Uet({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 Ket{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 Det(this._loadPromise)&&Eet(this._loadPromise)||(this._loadPromise=this._loadSource()),this._loadPromise}_getFieldProperty(t){const i=this._getSubtypesOrDomainValuesDictionary(t);if(i)return i;const e="feature"===this.type?Bet(this.snippet,t.name):t.name;return new zet({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:Oet(t),filterDescription:!0})}_getSubtypesOrDomainValuesDictionary(t){if(i=this._source,"function"!=typeof i?.getFieldDomain)return null;var i;const e="feature"===this.type?Bet(this.snippet,t.name):t.name,s=new Get({profile:this._profile,label:e,description:t.alias??t.name,snippet:e,icon:"form-dropdown"}),n=new qet(this._profile,t.alias??t.name,[new zet({profile:this._profile,label:e,description:"",snippet:e})]);if(s.variables=[n],Ret(this._source)&&t.name===this._source.typeIdField){const i=function(t,i,e){const s=Iet(t,e.domain,{code:"subtypes"});if(s)return s;const n=i.map((i=>new zet({profile:t,label:`${i.id}`,description:i.name,snippet:`"${i.id}"`})));return new qet(t,{code:"subtypes"},n)}(this._profile,this._source.types,t);return s.variables.push(i),s}if("feature"===this.type){const i=`DomainName(${this.snippet}, "${t.name}")`;n.variables.push(new zet({profile:this._profile,label:i,description:"",snippet:i}))}if(Ret(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=Iet(t,n,{code:"domainvaluesfortypeformat",formatValues:{fieldName:e.alias??e.name,typeName:i.name}});if(!r)return;const o=new Get({profile:t,label:`${i.id}`,snippet:`"${i.id}""`});o.variables=[r],s.push(o)})),s.length?new qet(t,{code:"domainvaluesbysubtypes"},s):null}(this._profile,this._source.types,t);return i?(s.variables.push(i),s):null}const r=Iet(this._profile,this._source.getFieldDomain?.(t.name),{code:"domainvalues"});return r?(s.variables.push(r),s):null}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;const t=this._source;if(i=t,!Array.isArray(i?.relationships)||"string"!=typeof i?.url)return null;var i;const e=new qet(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 qit(s)?s:null}(t,i);if(!qit(e))return null;if(i.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;const s=`FeatureSetByRelationshipName(${this.snippet}, "${i.name}")`;return new Qet({profile:this._profile,declaration:{definition:e},label:e.title,description:"",nonInteractive:!0},[new zet({profile:this._profile,label:s,description:"",snippet:s})],{exposeRelationships:!0,sourceTableId:t.layerId})})));return e.variables=s.filter(Det),e.variables.length?e:null}}class Jet extends Zet{constructor(t){super(t,{exposeRelationships:!0}),this.type="feature"}get title(){return Uit(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 i=Uit(this._source)?this._source.title:"";this.variables.push(new qet(this._profile,i,[new zet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));const e=new qet(this._profile,{code:"values"});if(this.variables.push(e),t=this._source,"boolean"==typeof t?.isTable&&!this._source.isTable){const t=`Geometry(${this.snippet})`,i=new zet({profile:this._profile,declaration:{name:t},label:t,description:"Geometry",snippet:t,icon:"shapes",filterDescription:!0});e.variables.push(i)}this._source.fields.sort(_et(this._source)).forEach((t=>{e.variables.push(this._getFieldProperty(t))}));const s=await this._getRelationshipsProperty();s&&this.variables.push(s)}catch(t){console.error("Loading issue",t,this),this._source=null}finally{this._loaded=!0}var t;return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Qet extends Zet{constructor(t,i=[],e){super(t,e),this.featureSetSnippets=i,this.type="featureSet"}get title(){return Uit(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 qet(this._profile,this.title,this.featureSetSnippets));const t=new qet(this._profile,{code:"fields"});this.variables.push(t),t.variables=this._source.fields.sort(_et(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 Yet extends Ket{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 Det(this._loadPromise)&&Eet(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 qet(this._profile,t,[new zet({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),e=new qet(this._profile,{code:"layers"},this._featureSetCollections.layers),s=new qet(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?Git(this._definition)?this._featureSetCollectionFromWebMap(this._definition):Uit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):Zit(this._definition)?this._featureSetCollectionFromPortalItem(this._definition.portalItem):Yit(this._definition)?this._featureSetCollectionFromUrl(this._definition.url):null:null}async _featureSetCollectionFromWebMap(t){const i=Git(t)?t:await async function(t){return new(await async function(){return jit?Wit("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 jit?Wit("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 Hit(),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:jet(s.layers,n),tables:jet(s.tables,n)}}(t),e=Promise.all(i.layers.map((async i=>{const e=await zit({url:`${t}/${i.id}`});return await e.load(),this._createFeatureSetVariable(e)}))),s=Promise.all(i.tables.map((async i=>{const e=await zit({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(qit(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 Qet({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 zet({profile:this._profile,label:i,description:"",snippet:i}),new zet({profile:this._profile,label:e,description:"",snippet:e})]}{const i=`FeatureSetById(${this.snippet}, "${t.layerId}")`;return[new zet({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}}class Xet extends Get{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 Wet(this.dictionaryVariables),hiddenApiItems:e?.map((t=>t.toLowerCase()))}}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map((t=>t.toProfileVariableDefinition()))}}}function tst(t){return qit(t)||Kit(t)||Yit(t)||Qit(t)||Jit(t)}async function ist(i="en"){const e=est.get(i);if(e)return e;if(!uet.has(i))return ist("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)})),est.set(t,e),e}(i,await e.json()):"en"===i?null:ist("en")}catch(t){return null}}const est=new Map;function sst(t){switch(t.type){case"dictionary":return{...t,type:t.type,properties:(i=t.properties,i?i.map(sst):[])};case"array":return{...t,type:t.type,elementType:{type:"number",name:"number"}};default:return{...t,type:t.type}}var i}async function nst(t,i="en"){if(!Xit(t))return;const e=await async function(t,i="en"){const e=await ist(i);return e?.get(t)??null}(t.id,i);if(!e)return;const s={bundles:[...e.bundles],variables:[],hiddenApiItems:t.hiddenApiItems?.map((t=>t.toLowerCase()))};var n;return e.variables.forEach((i=>{if(t.disabledVariables?.includes(i.name))return;const e=t.definitions[i.name];switch(i.type){case"dictionary":return s.variables.push(sst({...i,type:i.type,properties:Array.isArray(e)?[...e]:i.properties}));case"feature":return Uit(n=e)||Kit(n)||Yit(n)||Qit(n)||Jit(n)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});case"featureSet":return tst(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)||Git(t)||tst(t)}(e)?s.variables.push({...i,type:i.type,definition:e}):s.variables.push({...i,type:i.type});default:return s.variables.push(sst(i))}var n})),n=t,Array.isArray(n?.additionalVariables)&&s.variables.push(...t.additionalVariables??[]),s}const rst={locale:"en"},ost=new class{constructor(){this._languageId="arcade",this._languageOptions={},this._onDidChange=new AK,this._profileMap=new Map,this._apiContextMap=new Map,this._onModelContextDidChange=new AK,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 PK.isUri(t)||(t=PK.parse(t)),t.toString()}async setProfileForModel(i,e,s={locale:"en"}){Xit(e)&&(e=await nst(e,s.locale));const n=await det(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 Xet(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))??rst}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))}},hst={setProfileForModel:ost.setProfileForModel.bind(ost)};export{ket as B,AK as E,met as F,Cet as H,aV as I,MK as K,_K as M,oet as O,net as P,FK as R,kH as S,eet as T,PK as U,Aet as V,Met as X,hst as a,Nit as b,Bit as c,ost as d,BK as e,vet as f,jW as g,Let as h,Hit as i,Vit as j,cet as k,$K as l,LK as m,WK as n,$it as o,tet as p,xet as q,Fet as s,Zq as t,yet as z}
|