db-studio 2.0.1 → 2.2.0
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/index.js +79 -79
- package/dist/index.js.map +1 -1
- package/dist/web-dist/assets/_pathlessLayout-DSqP7uLw.js +1 -0
- package/dist/web-dist/assets/_pathlessLayout-sBYxFR0u.js +2 -0
- package/dist/web-dist/assets/_queryId-D-e6Pm3D.js +1 -0
- package/dist/web-dist/assets/_table-CUkeoJ5r.js +1 -0
- package/dist/web-dist/assets/_table-CuzwG7mZ.js +1 -0
- package/dist/web-dist/assets/_table-ziU6yws2.js +1 -0
- package/dist/web-dist/assets/{abap-DQayJW6v.js → abap-CNHfI6UP.js} +1 -1
- package/dist/web-dist/assets/{apex-Djzlm7in.js → apex-DTJWTIPK.js} +1 -1
- package/dist/web-dist/assets/{azcli-Bbikkqe4.js → azcli-Degrf7_O.js} +1 -1
- package/dist/web-dist/assets/{badge-HtbO9hWg.js → badge-BfsYSaL9.js} +1 -1
- package/dist/web-dist/assets/{bat-BUFda2RT.js → bat-og3u3-iX.js} +1 -1
- package/dist/web-dist/assets/{bicep-CuUgDHWX.js → bicep-DWKWUTZk.js} +1 -1
- package/dist/web-dist/assets/{browser-B6gU7HWo.js → browser-ZSYFt_6v.js} +1 -1
- package/dist/web-dist/assets/bundle-mjs-DBtz6MiX.js +1 -0
- package/dist/web-dist/assets/{cameligo-DITobApP.js → cameligo-wkA_VlQe.js} +1 -1
- package/dist/web-dist/assets/chat-sidebar-BzjjNUcW.js +161 -0
- package/dist/web-dist/assets/{clojure-DTFcSI8F.js → clojure-DOzhadKJ.js} +1 -1
- package/dist/web-dist/assets/{code-editor-BpsclD2u.js → code-editor-BMXfdFhg.js} +4 -4
- package/dist/web-dist/assets/{codicon-Brq4_Ui5.ttf → codicon-DF1abBS2.ttf} +0 -0
- package/dist/web-dist/assets/{coffee-CmIRg0oP.js → coffee-CS5CzV5M.js} +1 -1
- package/dist/web-dist/assets/connect-DGQjyh4c.js +1 -0
- package/dist/web-dist/assets/constants-iNJwkB3Z.js +20 -0
- package/dist/web-dist/assets/{cpp-BwBWpZT1.js → cpp-BMgiE7AJ.js} +1 -1
- package/dist/web-dist/assets/{csharp-BnWK75m3.js → csharp-Bsvbb6s9.js} +1 -1
- package/dist/web-dist/assets/{csp-Dohj3XYI.js → csp-BrZ2q231.js} +1 -1
- package/dist/web-dist/assets/{css-DN4GbnxY.js → css-Uqgocp1T.js} +1 -1
- package/dist/web-dist/assets/{css.worker-B-fFSVTK.js → css.worker-bHD0dlJO.js} +1507 -1453
- package/dist/web-dist/assets/cssMode-BoXwzMyE.js +1 -0
- package/dist/web-dist/assets/{cypher-CKAK8eD4.js → cypher-BtFHfHba.js} +1 -1
- package/dist/web-dist/assets/{dart-imWXBTLy.js → dart-C5lyYd0g.js} +1 -1
- package/dist/web-dist/assets/database.store-BbWvMDJ7.js +57 -0
- package/dist/web-dist/assets/dist-BbZuOizk.js +1 -0
- package/dist/web-dist/assets/dist-CISR_13N.js +2 -0
- package/dist/web-dist/assets/{dockerfile-CXOK4zpC.js → dockerfile-BvQ8yybz.js} +1 -1
- package/dist/web-dist/assets/{ecl-lOrW9o9k.js → ecl-DkR5NtXz.js} +1 -1
- package/dist/web-dist/assets/editor-g1MJRkXV.css +1 -0
- package/dist/web-dist/assets/editor.api-BQRmhEY6.js +926 -0
- package/dist/web-dist/assets/{editor.worker-BYfbSb3U.js → editor.worker-ByY_fgkM.js} +1328 -1274
- package/dist/web-dist/assets/{elixir-DgvzEwPU.js → elixir-DwgH4lv4.js} +1 -1
- package/dist/web-dist/assets/esm-DHn0u-mG.js +1 -0
- package/dist/web-dist/assets/{esm-DC8GK2En.js → esm-HKPuItQJ.js} +1 -1
- package/dist/web-dist/assets/{flow9-l3BJy5NQ.js → flow9-DdhMBw5Q.js} +1 -1
- package/dist/web-dist/assets/format-cell-value-CUgsp8Xn.js +1 -0
- package/dist/web-dist/assets/{freemarker2-73G2DeCz.js → freemarker2-g_nJsTeC.js} +2 -2
- package/dist/web-dist/assets/{fsharp-sfou20I_.js → fsharp-D3Xp09Vk.js} +1 -1
- package/dist/web-dist/assets/{go-DnjkNg4Q.js → go-DiDKwy3n.js} +1 -1
- package/dist/web-dist/assets/{graphql-BJFXvNDL.js → graphql-BgFph-jF.js} +1 -1
- package/dist/web-dist/assets/{handlebars-DXg2L0KG.js → handlebars-RA6uoaMW.js} +1 -1
- package/dist/web-dist/assets/{hcl-B4FYtDde.js → hcl-D4fzt9AB.js} +1 -1
- package/dist/web-dist/assets/highlighted-body-JLMTFACH-D8jkzP7m.js +1 -0
- package/dist/web-dist/assets/{html-BvAUQUXw.js → html-DchTZAEc.js} +1 -1
- package/dist/web-dist/assets/{html.worker-CdalOg9p.js → html.worker-CHVREBCJ.js} +1527 -1473
- package/dist/web-dist/assets/{htmlMode-hZ3EloXT.js → htmlMode-BcLYF6v1.js} +1 -1
- package/dist/web-dist/assets/icons-DKLzom80.js +1 -0
- package/dist/web-dist/assets/index-DTVRtzpz.css +2 -0
- package/dist/web-dist/assets/index-L3nylpEA.js +34 -0
- package/dist/web-dist/assets/indexes-B3M1QTrn.js +1 -0
- package/dist/web-dist/assets/{ini-H3EW14Oa.js → ini-CjG9jGLJ.js} +1 -1
- package/dist/web-dist/assets/{java-Cu5qHMXc.js → java-DitR3Nwd.js} +1 -1
- package/dist/web-dist/assets/{javascript-bJHYh6Or.js → javascript-l9pEcFVL.js} +1 -1
- package/dist/web-dist/assets/json-editor-CeBQ9FBf.js +1 -0
- package/dist/web-dist/assets/{json.worker-DI02pyM8.js → json.worker-BKCy_srb.js} +2747 -2693
- package/dist/web-dist/assets/{jsonMode-CDMOUPss.js → jsonMode-D4edoDNQ.js} +4 -4
- package/dist/web-dist/assets/{julia-CZ0npMib.js → julia-_g8mQYsr.js} +1 -1
- package/dist/web-dist/assets/{keys-By5o7bPm.js → keys-DhNPoWOm.js} +1 -1
- package/dist/web-dist/assets/{kotlin-BpW0qHIt.js → kotlin-3o4lP58u.js} +1 -1
- package/dist/web-dist/assets/{label-C93T1BbF.js → label-CavJMZd3.js} +1 -1
- package/dist/web-dist/assets/{less-DTBM-Kxp.js → less-CdRSAxY_.js} +1 -1
- package/dist/web-dist/assets/{lexon-CLOvNp8v.js → lexon-B1v3Gspe.js} +1 -1
- package/dist/web-dist/assets/{liquid-IpfBCIUY.js → liquid-3wMbC9OJ.js} +1 -1
- package/dist/web-dist/assets/{logs-CnLvqVtL.js → logs-C22dj_JT.js} +1 -1
- package/dist/web-dist/assets/{lspLanguageFeatures-CnYZSn_O.js → lspLanguageFeatures-TaH7V4jh.js} +1 -1
- package/dist/web-dist/assets/{lua-BERpVknn.js → lua-D3D-_pEE.js} +1 -1
- package/dist/web-dist/assets/{m3-B_gILjHh.js → m3-fsgnMtjU.js} +1 -1
- package/dist/web-dist/assets/{markdown-DamaZSqy.js → markdown-DTtmtPZi.js} +1 -1
- package/dist/web-dist/assets/{mdx-BTw_ghf-.js → mdx-B7jfJVLI.js} +1 -1
- package/dist/web-dist/assets/mermaid-WFAXDIZX-qzZppTtW.js +1 -0
- package/dist/web-dist/assets/middleware-DLeL20gb.js +1 -0
- package/dist/web-dist/assets/{mips-BkjI-_01.js → mips-BA6kSOEZ.js} +1 -1
- package/dist/web-dist/assets/module-B7dXHbVt.js +3 -0
- package/dist/web-dist/assets/monaco-theme-BwGcwpJl.js +68 -0
- package/dist/web-dist/assets/monaco-theme-DtsiNm_H.css +1 -0
- package/dist/web-dist/assets/{msdax-5OSOIuww.js → msdax-B96QDI_e.js} +1 -1
- package/dist/web-dist/assets/{mysql-CMtxQW5J.js → mysql-ZJG-Zmb7.js} +1 -1
- package/dist/web-dist/assets/{objective-c-CoW52So-.js → objective-c-D1BqZdFg.js} +1 -1
- package/dist/web-dist/assets/{overlay.store-BL-3zX6X.js → overlay.store-DoGHwFxO.js} +1 -1
- package/dist/web-dist/assets/{pascal-BxyU4sPJ.js → pascal-CXwopv-V.js} +1 -1
- package/dist/web-dist/assets/{pascaligo-C63_040U.js → pascaligo-DbxCO0kO.js} +1 -1
- package/dist/web-dist/assets/{perl-ayfptt23.js → perl-DL95F-1i.js} +1 -1
- package/dist/web-dist/assets/{personal-preferences.store-BIr71Re8.js → personal-preferences.store-BgUar1W1.js} +1 -1
- package/dist/web-dist/assets/{pgsql-CPGqMVI3.js → pgsql-D6V7y-We.js} +1 -1
- package/dist/web-dist/assets/{php-DA-YJ6wI.js → php-Cl4Rc77T.js} +1 -1
- package/dist/web-dist/assets/{pla-DesDCKWW.js → pla-C2-KEJLZ.js} +1 -1
- package/dist/web-dist/assets/{postiats-B8yhii_n.js → postiats-CnwS6VBM.js} +1 -1
- package/dist/web-dist/assets/{powerquery-CG8tCOct.js → powerquery-IxSHxxBc.js} +1 -1
- package/dist/web-dist/assets/{powershell-C68aZHza.js → powershell-DAkyXnxj.js} +1 -1
- package/dist/web-dist/assets/preload-helper-BmptvQqE.js +1 -0
- package/dist/web-dist/assets/{protobuf-OaVxpJrs.js → protobuf-FnPVBP5H.js} +1 -1
- package/dist/web-dist/assets/{pug-0lOSC2rA.js → pug-C_d8B8nZ.js} +1 -1
- package/dist/web-dist/assets/{python-C8ab8TeJ.js → python-DK9sRx0Y.js} +1 -1
- package/dist/web-dist/assets/{qsharp-BmHeDwNl.js → qsharp-DHzbHTnS.js} +1 -1
- package/dist/web-dist/assets/{queries.store-Dwdw-Gej.js → queries.store-CXQwDZiV.js} +1 -1
- package/dist/web-dist/assets/query-runner-D0LqVvy4.js +17 -0
- package/dist/web-dist/assets/{r-DoHxhOJg.js → r-BreUQjgc.js} +1 -1
- package/dist/web-dist/assets/radix-ui-CJhaEsHV.js +41 -0
- package/dist/web-dist/assets/{razor-DynaHCXX.js → razor-CI-yLdex.js} +1 -1
- package/dist/web-dist/assets/react-CGNcTA1t.js +1 -0
- package/dist/web-dist/assets/react-dom-Czf_u9MH.js +9 -0
- package/dist/web-dist/assets/{redis-CSL-jfR-.js → redis-BdhjrevD.js} +1 -1
- package/dist/web-dist/assets/redis-value-Cq8YBvSS.js +1 -0
- package/dist/web-dist/assets/{redshift-Cb-LWZ8f.js → redshift-CwVMUyQc.js} +1 -1
- package/dist/web-dist/assets/{restructuredtext-DTqnvYsu.js → restructuredtext-D6U9PIiF.js} +1 -1
- package/dist/web-dist/assets/rolldown-runtime-D_n5YsVB.js +1 -0
- package/dist/web-dist/assets/{ruby-DbgDuslH.js → ruby-D0QS81Wd.js} +1 -1
- package/dist/web-dist/assets/runner-BE2YTdi9.js +1 -0
- package/dist/web-dist/assets/{rust-CWzrsIL_.js → rust-Bsq9cLDY.js} +1 -1
- package/dist/web-dist/assets/{sb-BghszYt-.js → sb-DAQADLLd.js} +1 -1
- package/dist/web-dist/assets/{scala-Cw9RU1Qz.js → scala-oEMLo0pl.js} +1 -1
- package/dist/web-dist/assets/schema-B-jmgfHC.js +1 -0
- package/dist/web-dist/assets/schema-JCqbh3DE.js +1 -0
- package/dist/web-dist/assets/{scheme-DeYmvmAH.js → scheme-DDI6muad.js} +1 -1
- package/dist/web-dist/assets/{scss-D_S6B2H1.js → scss-BU9Ttlwm.js} +1 -1
- package/dist/web-dist/assets/{select-DU0HoKZ4.js → select-3l4LDMzT.js} +1 -1
- package/dist/web-dist/assets/{separator-CZgXYjVQ.js → separator-BD46sVx9.js} +1 -1
- package/dist/web-dist/assets/{sheet-sidebar-KvxY47ZZ.js → sheet-sidebar-CjbtFAKn.js} +1 -1
- package/dist/web-dist/assets/{shell-B59ItoUV.js → shell-BI6rOefn.js} +1 -1
- package/dist/web-dist/assets/{solidity-De0h6YhL.js → solidity-B17zzzu-.js} +1 -1
- package/dist/web-dist/assets/{sophia-DWmKHYE0.js → sophia-DQi6mooo.js} +1 -1
- package/dist/web-dist/assets/{sparql-0sKQlAae.js → sparql-DGFBDMPi.js} +1 -1
- package/dist/web-dist/assets/spinner-D7Cvt3BD.js +1 -0
- package/dist/web-dist/assets/{sql-Cafrv7gm.js → sql-DGzRlxQo.js} +1 -1
- package/dist/web-dist/assets/{st-qkFqcB41.js → st-Ceq2dhS_.js} +1 -1
- package/dist/web-dist/assets/{swift-CDPKFfVs.js → swift-8-FeeRSy.js} +1 -1
- package/dist/web-dist/assets/{systemverilog-rjtBmhAJ.js → systemverilog-mmioB6wo.js} +1 -1
- package/dist/web-dist/assets/table-sVAmZLcg.js +1 -0
- package/dist/web-dist/assets/tables-TW8L7_FW.js +16 -0
- package/dist/web-dist/assets/tanstack-D9GckDbx.js +5 -0
- package/dist/web-dist/assets/{tcl-C0NrUCCP.js → tcl-BTUJQo2X.js} +1 -1
- package/dist/web-dist/assets/{ts.worker-r_qbh1JO.js → ts.worker-BLC4EdqU.js} +18311 -18257
- package/dist/web-dist/assets/{tsMode-C2yuf0pi.js → tsMode-BRJ2WiSx.js} +4 -4
- package/dist/web-dist/assets/{twig-RBrBABOf.js → twig-C6ea54bM.js} +1 -1
- package/dist/web-dist/assets/{typescript-DWkZjHjp.js → typescript-U3aTTn2d.js} +1 -1
- package/dist/web-dist/assets/{typespec-DfQiGud4.js → typespec-B4z8l2XF.js} +1 -1
- package/dist/web-dist/assets/use-database-engine-CG7rZQXQ.js +1 -0
- package/dist/web-dist/assets/{use-theme-BLw5dtZV.js → use-theme-CKjVHAZg.js} +1 -1
- package/dist/web-dist/assets/utils-CZdosIsH.js +1 -0
- package/dist/web-dist/assets/{vb-BslxQW9i.js → vb-BbQNgbjG.js} +1 -1
- package/dist/web-dist/assets/visualizer-c23lRr6o.js +1 -0
- package/dist/web-dist/assets/{wgsl-Bq67ZIFU.js → wgsl-SWAFFAY4.js} +1 -1
- package/dist/web-dist/assets/{workers-rMl5Xrk2.js → workers-DeOJBffb.js} +1 -1
- package/dist/web-dist/assets/{xml-PfDqoe6w.js → xml-DM-qLhlQ.js} +1 -1
- package/dist/web-dist/assets/{yaml-CIuY3cB5.js → yaml-BB3LUpV7.js} +1 -1
- package/dist/web-dist/index.html +31 -31
- package/package.json +22 -22
- package/dist/web-dist/assets/_pathlessLayout-aKKQKRJX.js +0 -1
- package/dist/web-dist/assets/_pathlessLayout-s6cwJxH6.js +0 -2
- package/dist/web-dist/assets/_queryId-DnPgn-AJ.js +0 -1
- package/dist/web-dist/assets/_table-Bgt0zJ9m.js +0 -1
- package/dist/web-dist/assets/_table-CU8PHZQE.js +0 -1
- package/dist/web-dist/assets/_table-DIbpzW3q.js +0 -1
- package/dist/web-dist/assets/bundle-mjs-DEMZsBkP.js +0 -1
- package/dist/web-dist/assets/chat-sidebar-Cr2fVFDF.js +0 -132
- package/dist/web-dist/assets/connect-BM4hZPnz.js +0 -1
- package/dist/web-dist/assets/constants-BBxXyYPa.js +0 -12
- package/dist/web-dist/assets/cssMode-CiAtMuTk.js +0 -1
- package/dist/web-dist/assets/database.store-73Wsz2L5.js +0 -57
- package/dist/web-dist/assets/dist-D4HUXaJv.js +0 -1
- package/dist/web-dist/assets/dist-DwRWhVwY.js +0 -2
- package/dist/web-dist/assets/editor-1FQrmyyI.css +0 -1
- package/dist/web-dist/assets/editor.api-DSevzNN8.js +0 -865
- package/dist/web-dist/assets/format-cell-value-CuhjnBNV.js +0 -1
- package/dist/web-dist/assets/highlighted-body-OFNGDK62-Bi4CQl8I.js +0 -1
- package/dist/web-dist/assets/icons-CheF8KGp.js +0 -1
- package/dist/web-dist/assets/index-YCx2RIFq.js +0 -34
- package/dist/web-dist/assets/index-mbFBVmHb.css +0 -2
- package/dist/web-dist/assets/indexes-BYqaS45O.js +0 -1
- package/dist/web-dist/assets/json-editor-ZcSS1MRc.js +0 -1
- package/dist/web-dist/assets/mermaid-GHXKKRXX-B7fOqMvZ.js +0 -1
- package/dist/web-dist/assets/middleware-DKaxoFZs.js +0 -1
- package/dist/web-dist/assets/module-BbdCXsK0.js +0 -2
- package/dist/web-dist/assets/monaco-theme-BnSsSzUH.css +0 -1
- package/dist/web-dist/assets/monaco-theme-DkPj5STI.js +0 -64
- package/dist/web-dist/assets/preload-helper-DZhPwQp1.js +0 -1
- package/dist/web-dist/assets/query-runner-C430BH5I.js +0 -17
- package/dist/web-dist/assets/radix-ui-ByvuE8TW.js +0 -51
- package/dist/web-dist/assets/react-CKF1H7h0.js +0 -1
- package/dist/web-dist/assets/react-dom-DQQG0g0D.js +0 -9
- package/dist/web-dist/assets/redis-value-Bf0tOet0.js +0 -1
- package/dist/web-dist/assets/rolldown-runtime-0wqQW3ea.js +0 -1
- package/dist/web-dist/assets/runner-DFzqBXp0.js +0 -1
- package/dist/web-dist/assets/schema-B_EtHxTf.js +0 -1
- package/dist/web-dist/assets/schema-iTfBKwXl.js +0 -1
- package/dist/web-dist/assets/spinner-FJ-tXoFX.js +0 -1
- package/dist/web-dist/assets/table-DmoKTp5U.js +0 -1
- package/dist/web-dist/assets/tables-By-PTDwU.js +0 -13
- package/dist/web-dist/assets/tanstack-Cb7WFPRi.js +0 -8
- package/dist/web-dist/assets/use-database-engine-Mwmv8X7V.js +0 -1
- package/dist/web-dist/assets/utils-awMbhLwX.js +0 -1
- package/dist/web-dist/assets/visualizer-LoD_yU5U.js +0 -1
- package/dist/web-dist/assets/vscode-Ba8jYSS7.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/tsMode-BRJ2WiSx.js","assets/editor.api-BQRmhEY6.js","assets/preload-helper-BmptvQqE.js","assets/editor-g1MJRkXV.css","assets/workers-DeOJBffb.js","assets/freemarker2-g_nJsTeC.js","assets/handlebars-RA6uoaMW.js","assets/html-DchTZAEc.js","assets/javascript-l9pEcFVL.js","assets/typescript-U3aTTn2d.js","assets/liquid-3wMbC9OJ.js","assets/mdx-B7jfJVLI.js","assets/python-DK9sRx0Y.js","assets/razor-CI-yLdex.js","assets/xml-DM-qLhlQ.js","assets/yaml-BB3LUpV7.js","assets/cssMode-BoXwzMyE.js","assets/lspLanguageFeatures-TaH7V4jh.js","assets/htmlMode-BcLYF6v1.js","assets/jsonMode-D4edoDNQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e0,$a as Vn,$c as us,$d as TS,$i as Gc,$l as Oa,$n as t0,$o as i0,$r as PS,$s as hr,$t as kS,$u as he,A as Zc,Aa as zh,Ac as Mt,Ad as Rr,Ai as dm,Al as n0,An as Es,Ao as rn,Ar as He,As as s0,At as o0,Au as sv,B as r0,Ba as De,Bc as a0,Bd as Go,Bi as ov,Bl as cm,Bn as NS,Bo as l0,Br as MS,Bs as qi,Bt as d0,Bu as Xc,C as c0,Ca as h0,Cc as U,Cd as gs,Cf as Yd,Ci as rv,Cl as u0,Cn as Ri,Co as OS,Cr as av,Cs as Ti,Ct as hm,Cu as _d,D as lv,Da as g0,Dc as Jd,Dd as p0,Di as um,Dl as f0,Dn as gm,Do as m0,Dr as _0,Ds as v0,Dt as AS,Du as Yu,E as zi,Ea as b0,Ec as nr,Ed as Ju,Ei as jh,El as dv,En as C0,Eo as Be,Er as S0,Es as cv,Et as FS,Eu as Qd,F as ur,Fa as so,Fc as Si,Fd as m,Fi as Aa,Fl as vd,Fn as an,Fo as w0,Fr as Rt,Fs as Rs,Ft as hv,Fu as Qu,G as HS,Ga as WS,Gc as $,Gd as uv,Gi as VS,Gl as mt,Gn as BS,Go as bo,Gr as y0,Gs as pn,Gt as x0,Gu as x,H as Ye,Ha as pm,Hc as I0,Hd as L0,Hi as US,Hl as at,Hn as ec,Ho as Js,Hr as zS,Hs as D0,Ht as _s,Hu as E0,I as R0,Ia as cn,Ic as Nt,Id as L,Ii as jS,Il as Ct,In as T0,Io as P0,Ir as Yc,Is as lt,It as k0,Iu as qS,J as N0,Ja as gv,Jc as M0,Jd as oa,Ji as O0,Jl as gr,Jn as $S,Jo as KS,Jr as pl,Js as Ce,Jt as A0,Ju as sr,K as GS,Ka as F0,Kc as tc,Kd as fm,Ki as pv,Kl as ji,Kn as H0,Ko as ZS,Kr as XS,Ks as W0,Kt as YS,Ku as B,L as fv,La as mm,Lc as Fa,Ld as V0,Li as B0,Ll as U0,Ln as z0,Lo as j0,Lr as Fl,Ls as Ts,Lt as mv,Lu as q0,M as $0,Ma as K0,Mc as G0,Md as _m,Mi as bd,Ml as eg,Mn as Co,Mo as JS,Mr as or,Ms as Z0,Mt as X0,Mu as Y0,N as J0,Na as Q0,Nc as eE,Nd as tE,Ni as iE,Nl as Tr,Nn as nE,No as sE,Nr as oE,Ns as fl,Nt as rE,Nu as ti,O as Jc,Oa as vm,Oc as ml,Od as aE,Oi as lE,Ol as dE,On as cE,Oo as Cd,Or as Qc,Os as vs,Ot as hE,Ou as Pr,P as uE,Pa as gE,Pc as Zo,Pd as pE,Pi as _v,Pl as QS,Pn as eh,Po as fE,Pr as mE,Ps as Nn,Pt as ew,Pu as _E,Q as th,Qa as vE,Qc as bE,Qd as bm,Qi as vv,Ql as Cm,Qn as CE,Qo as ih,Qr as SE,Qs as ce,Qt as bv,Qu as tw,R as Sm,Ra as dt,Rc as ii,Rd as wE,Ri as tg,Rl as yE,Rn as xE,Ro as Ke,Rr as IE,Rs as K,Rt as Xo,Ru as ps,S as wm,Sa as LE,Sc as hn,Sd as Te,Sf as Cv,Si as Sv,Sl as DE,Sn as ym,So as iw,Sr as zr,Ss as ic,St as wt,Su as EE,T as je,Ta as RE,Tc as TE,Td as _l,Ti as PE,Tl as wv,Tn as kE,To as Ln,Tr as oo,Ts as xm,Tt as nw,Tu as nh,U as sw,Ua as W,Uc as hi,Ud as Tn,Ui as Im,Ul as vl,Un as NE,Uo as ln,Ur as Lm,Us as me,Ut as Dm,Uu as V,Va as Dn,Vc as ME,Vd as Ie,Vi as ow,Vl as bs,Vn as Ha,Vo as ig,Vr as rw,Vs as OE,Vt as aw,Vu as AE,W as bl,Wa as st,Wc as FE,Wd as HE,Wi as lw,Wl as WE,Wn as Wa,Wo as VE,Wr as BE,Ws as ai,Wt as UE,Wu as ie,X as kr,Xa as So,Xc as zE,Xd as jE,Xi as yv,Xl as qE,Xn as $E,Xo as ct,Xr as Sd,Xs as Me,Xt as dw,Xu as ng,Y as KE,Ya as Cl,Yc as GE,Yd as ZE,Yi as XE,Yl as YE,Yn as JE,Yo as xv,Yr as nt,Ys as ae,Yt as Iv,Yu as qh,Z as cw,Za as Lv,Zc as Li,Zd as QE,Zi as hw,Zl as sh,Zn as eR,Zo as tR,Zr as S,Zs as ht,Zt as iR,Zu as tt,_ as uw,_a as sg,_c as $h,_d as We,_f as nR,_i as sR,_l as oR,_n as rR,_o as wd,_r as aR,_s as lR,_t as pr,_u as Dv,a as Ev,aa as dR,ac as Ze,af as it,ai as Em,al as Rv,an as gw,ao as Nr,ar as Sl,as as Hl,at as Xe,au as cR,b as fr,ba as hR,bc as Q,bd as Pt,bf as ro,bi as pw,bl as Tv,bn as uR,bo as Mn,br as gR,bs as pR,bt as Pv,bu as fR,c as kv,ca as mR,cc as fw,cd as Rm,cf as og,ci as Kh,cl as _R,cn as oh,co as jr,cr as vR,cs as Ft,ct as wl,cu as Va,d as bR,da as CR,dc as Pe,dd as Ge,df as Ps,di as SR,dl as wR,dn as Ba,do as yR,dr as mw,ds as P,dt as Cs,du as It,ea as Yo,ec as Ua,ed as ot,ef as pt,ei as Ia,el as Nv,en as xR,eo as gi,er as IR,es as kt,et as _w,eu as vw,f as LR,fa as yl,fc as DR,fd as Mv,ff as ao,fi as ER,fl as rg,fn as Tm,fo as RR,fr as Pm,fs as Z,ft as TR,fu as bw,g as PR,ga as kR,gc as NR,gd as O,gf as Ov,gi as MR,gl as xl,gn as ki,go as ve,gr as OR,gs as rh,gt as AR,gu as Av,h as lo,ha as yd,hc as FR,hd as M,hf as $i,hi as HR,hl as WR,hn as VR,ho as BR,hr as Fv,hs as jt,ht as UR,hu as zR,i as os,ia as nc,ic as Yt,id as ra,if as Le,ii as jR,il as qR,in as Cw,io as mr,ir as $R,is as Sw,it as Mr,iu as Hv,j as sc,ja as ww,jc as KR,jd as GR,ji as yw,jl as km,jn as ZR,jo as ft,jr as qr,js as XR,jt as YR,ju as rs,k as ah,ka as xw,kc as JR,kd as On,ki as Il,kl as QR,kn as eT,ko as tT,kr as Iw,ks as iT,kt as nT,ku as ui,l as G,la as Lw,lc as sT,ld as za,lf as oT,li as Ll,ll as rT,ln as aT,lo as Dw,lr as lT,ls as Nm,lt as Ew,lu as ag,m as Rw,ma as Mm,mc as we,md as Tw,mf as dT,mi as oc,ml as ge,mn as Pw,mo as X,mr as rc,ms as cT,mt as Wv,mu as hT,na as eo,nc as uT,nd as gT,nf as Pn,ni as _r,nl as ks,nn as Om,no as kw,nr as Nw,ns as Bn,nt as lg,nu as Or,oa as pT,oc as ne,od as An,of as fT,oi as Dl,ol as ns,on as mT,oo as lh,or as dh,os as A,ot as Am,ou as _T,p as vT,pa as dg,pc as bt,pd as pi,pf as bT,pi as CT,pl as Vi,pn as Fm,po as ST,pr as oe,ps as de,pt as wT,pu as yT,q as xT,qa as IT,qc as Vv,qd as Mw,qi as LT,ql as Hm,qn as ch,qo as ac,qr as Dt,qs as k,qt as DT,qu as ke,ra as ET,rc as li,rd as hh,rf as Un,ri as Gh,rl as Wm,rn as ye,ro as Ow,rr as RT,rs as Ee,rt as TT,ru as Vm,sa as PT,sc as fn,sd as Bv,sf as Aw,si as uh,sl as Bt,sn as Fw,so as kT,sr as fi,ss as mi,st as NT,su as MT,t as ja,ta as Wl,tc as Jo,td as Uv,tf as Bm,ti as Hw,tl as OT,tn as cg,to as Ss,tr as Ww,ts as zn,tt as AT,tu as Vw,u as Bw,ua as FT,uc as H,ud as ee,uf as HT,ui as Uw,ul as Fe,un as oi,uo as WT,ur as Um,us as gh,ut as VT,uu as zm,v as zw,va as BT,vc as La,vd as UT,vf as Gt,vi as zT,vl as R,vn as jT,vo as vr,vr as qT,vs as Ot,vt as $T,vu as xd,w as KT,wa as zv,wc as ni,wd as jw,wi as jm,wl as ph,wn as GT,wo as jv,wr as ZT,ws as XT,wt as YT,wu as qw,x as $w,xa as JT,xc as QT,xd as qm,xf as eP,xi as tP,xl as nn,xn as Ni,xo as si,xr as iP,xs as nP,xt as fh,xu as $m,y as Kw,ya as sP,yc as oP,yd as Gw,yf as rP,yi as Zw,yl as Km,yn as aP,yo as lP,yr as dP,ys as cP,yt as En,yu as Fn,z as hP,za as uP,zc as zs,zd as Gm,zi as hg,zl as dn,zn as St,zo as Xw,zr as gP,zs as co,zt as br,zu as Yw}from"./editor.api-BQRmhEY6.js";import{t as z}from"./preload-helper-BmptvQqE.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"db-studio@2.2.0"};var e=new n.Error().stack;e&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[e]="8f8e6134-39e7-4601-9ac6-7a53deaa5aa8",n._sentryDebugIdIdentifier="sentry-dbid-8f8e6134-39e7-4601-9ac6-7a53deaa5aa8")}catch{}})();var pP=class extends lt{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:L(101,"Toggle Collapse Unchanged Regions"),icon:V.map,toggled:k.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:k.has("isInDiffEditor"),menu:{when:k.has("isInDiffEditor"),id:K.EditorTitle,order:22,group:"navigation"}})}run(n,...e){const t=n.get(Ee),i=!t.getValue("diffEditor.hideUnchangedRegions.enabled");t.updateValue("diffEditor.hideUnchangedRegions.enabled",i)}},Jw=class extends lt{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:L(102,"Toggle Show Moved Code Blocks"),precondition:k.has("isInDiffEditor")})}run(n,...e){const t=n.get(Ee),i=!t.getValue("diffEditor.experimental.showMoves");t.updateValue("diffEditor.experimental.showMoves",i)}},fP=class extends lt{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:L(103,"Toggle Use Inline View When Space Is Limited"),precondition:k.has("isInDiffEditor")})}run(n,...e){const t=n.get(Ee),i=!t.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");t.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",i)}},El=L(104,"Diff Editor"),mP=class extends mi{constructor(){super({id:"diffEditor.switchSide",title:L(105,"Switch Side"),icon:V.arrowSwap,precondition:k.has("isInDiffEditor"),f1:!0,category:El})}runEditorCommand(n,e,t){const i=wo(n);if(i instanceof fr){if(t&&t.dryRun)return{destinationSelection:i.mapToOtherSide().destinationSelection};i.switchSide()}}},_P=class extends mi{constructor(){super({id:"diffEditor.exitCompareMove",title:L(106,"Exit Compare Move"),icon:V.close,precondition:S.comparingMovedCode,f1:!1,category:El,keybinding:{weight:1e4,primary:9}})}runEditorCommand(n,e,...t){const i=wo(n);i instanceof fr&&i.exitCompareMove()}},vP=class extends mi{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:L(107,"Collapse All Unchanged Regions"),icon:V.fold,precondition:k.has("isInDiffEditor"),f1:!0,category:El})}runEditorCommand(n,e,...t){const i=wo(n);i instanceof fr&&i.collapseAllUnchangedRegions()}},bP=class extends mi{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:L(108,"Show All Unchanged Regions"),icon:V.unfold,precondition:k.has("isInDiffEditor"),f1:!0,category:El})}runEditorCommand(n,e,...t){const i=wo(n);i instanceof fr&&i.showAllUnchangedRegions()}},ug=class extends lt{constructor(){super({id:"diffEditor.revert",title:L(109,"Revert"),f1:!0,category:El,precondition:k.has("isInDiffEditor")})}run(n,e){return e?this.runViaToolbarContext(n,e):this.runViaCursorOrSelection(n)}runViaCursorOrSelection(n){const e=wo(n);e instanceof fr&&e.revertFocusedRangeMappings()}runViaToolbarContext(n,e){const t=CP(n,e.originalUri,e.modifiedUri);t instanceof fr&&t.revertRangeMappings(e.mapping.innerChanges??[])}},Qw=L(110,"Accessible Diff Viewer"),Zm=class ey extends lt{static{this.id="editor.action.accessibleDiffViewer.next"}constructor(){super({id:ey.id,title:L(111,"Go to Next Difference"),category:Qw,precondition:k.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){wo(e)?.accessibleDiffViewerNext()}},ty=class iy extends lt{static{this.id="editor.action.accessibleDiffViewer.prev"}constructor(){super({id:iy.id,title:L(112,"Go to Previous Difference"),category:Qw,precondition:k.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){wo(e)?.accessibleDiffViewerPrev()}};function CP(n,e,t){return n.get(Ze).listDiffEditors().find(i=>{const s=i.getModifiedEditor(),o=i.getOriginalEditor();return s&&s.getModel()?.uri.toString()===t.toString()&&o&&o.getModel()?.uri.toString()===e.toString()})||null}function wo(n){const e=n.get(Ze).listDiffEditors(),t=nr();if(t){for(const i of e)if(i.getContainerDomNode().contains(t))return i}return null}me(pP);me(Jw);me(fP);qi.appendMenuItem(K.EditorTitle,{command:{id:new Jw().desc.id,title:m(135,"Show Moved Code Blocks"),icon:V.move,toggled:W0.create("config.diffEditor.experimental.showMoves",!0),precondition:k.has("isInDiffEditor")},order:10,group:"1_diff",when:k.has("isInDiffEditor")});me(ug);for(const n of[{icon:V.arrowRight,key:S.diffEditorInlineMode.toNegated()},{icon:V.discard,key:S.diffEditorInlineMode}])qi.appendMenuItem(K.DiffEditorHunkToolbar,{command:{id:new ug().desc.id,title:m(136,"Revert Block"),icon:n.icon},when:k.and(S.diffEditorModifiedWritable,n.key),order:5,group:"primary"}),qi.appendMenuItem(K.DiffEditorSelectionToolbar,{command:{id:new ug().desc.id,title:m(137,"Revert Selection"),icon:n.icon},when:k.and(S.diffEditorModifiedWritable,n.key),order:5,group:"primary"});me(mP);me(_P);me(vP);me(bP);qi.appendMenuItem(K.EditorTitle,{command:{id:Zm.id,title:m(138,"Open Accessible Diff Viewer"),precondition:k.has("isInDiffEditor")},order:10,group:"2_diff",when:k.and(S.accessibleDiffViewerVisible.negate(),k.has("isInDiffEditor"))});Me.registerCommandAlias("editor.action.diffReview.next",Zm.id);me(Zm);Me.registerCommandAlias("editor.action.diffReview.prev",ty.id);me(ty);var SP=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},wP=function(n,e){return function(t,i){e(t,i,n)}},gg,mh=new ae("selectionAnchorSet",!1),ws=class{static{gg=this}static{this.ID="editor.contrib.selectionAnchorController"}static get(e){return e.getContribution(gg.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=mh.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(ie.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new St().appendText(m(849,"Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),gi(m(850,"Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(ie.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};ws=gg=SP([wP(1,Ce)],ws);var yP=class extends A{constructor(){super({id:"editor.action.setSelectionAnchor",label:L(851,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2080),weight:100}})}async run(n,e){ws.get(e)?.setSelectionAnchor()}},xP=class extends A{constructor(){super({id:"editor.action.goToSelectionAnchor",label:L(852,"Go to Selection Anchor"),precondition:mh})}async run(n,e){ws.get(e)?.goToSelectionAnchor()}},IP=class extends A{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:L(853,"Select from Anchor to Cursor"),precondition:mh,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2089),weight:100}})}async run(n,e){ws.get(e)?.selectFromAnchorToCursor()}},LP=class extends A{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:L(854,"Cancel Selection Anchor"),precondition:mh,kbOpts:{kbExpr:S.editorTextFocus,primary:9,weight:100}})}async run(n,e){ws.get(e)?.cancelSelectionAnchor()}};de(ws.ID,ws,4);P(yP);P(xP);P(IP);P(LP);var DP=W("editorOverviewRuler.bracketMatchForeground","#A0A0A0",m(855,"Overview ruler marker color for matching brackets.")),EP=class extends A{constructor(){super({id:"editor.action.jumpToBracket",label:L(857,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:3165,weight:100}})}run(n,e){qa.get(e)?.jumpToBracket()}},RP=class extends A{constructor(){super({id:"editor.action.selectToBracket",label:L(858,"Select to Bracket"),precondition:void 0,metadata:{description:L(859,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(n,e,t){let i=!0;t&&t.selectBrackets===!1&&(i=!1),qa.get(e)?.selectToBracket(i)}},TP=class extends A{constructor(){super({id:"editor.action.removeBrackets",label:L(860,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(n,e){qa.get(e)?.removeBrackets(this.id)}},PP=class{constructor(n,e,t){this.position=n,this.brackets=e,this.options=t}},qa=class Id extends M{static{this.ID="editor.contrib.bracketMatchingController"}static get(e){return e.getContribution(Id.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new at(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(80)&&(this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const s=i.getStartPosition(),o=e.bracketPairs.matchBracket(s);let r=null;if(o)o[0].containsPosition(s)&&!o[1].containsPosition(s)?r=o[1].getStartPosition():o[1].containsPosition(s)&&(r=o[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(s);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(s);l&&l.range&&(r=l.range.getStartPosition())}}return r?new ie(r.lineNumber,r.column,r.lineNumber,r.column):new ie(s.lineNumber,s.column,s.lineNumber,s.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(s=>{const o=s.getStartPosition();let r=t.bracketPairs.matchBracket(o);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(o),!r)){const d=t.bracketPairs.findNextBracket(o);d&&d.range&&(r=t.bracketPairs.matchBracket(d.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(x.compareRangesUsingStarts);const[d,c]=r;if(a=e?d.getStartPosition():d.getEndPosition(),l=e?c.getEndPosition():c.getStartPosition(),c.containsPosition(o)){const h=a;a=l,l=h}}a&&l&&i.push(new ie(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const s=i.getPosition();let o=t.bracketPairs.matchBracket(s);o||(o=t.bracketPairs.findEnclosingBrackets(s)),o&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:o[0],text:""},{range:o[1],text:""}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=oe.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:nt(DP),position:ln.Center}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=oe.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const s=i.brackets;s&&(e[t++]={range:s[0],options:i.options},e[t++]={range:s[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let s=[];this._lastVersionId===i&&(s=this._lastBracketsData);const o=[];let r=0;for(let h=0,u=e.length;h<u;h++){const g=e[h];g.isEmpty()&&(o[r++]=g.getStartPosition())}o.length>1&&o.sort(B.compare);const a=[];let l=0,d=0;const c=s.length;for(let h=0,u=o.length;h<u;h++){const g=o[h];for(;d<c&&s[d].position.isBefore(g);)d++;if(d<c&&s[d].position.equals(g))a[l++]=s[d];else{let p=t.bracketPairs.matchBracket(g,20),f=Id._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!p&&this._matchBrackets==="always"&&(p=t.bracketPairs.findEnclosingBrackets(g,20),f=Id._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new PP(g,p,f)}}this._lastBracketsData=a,this._lastVersionId=i}};de(qa.ID,qa,1);P(RP);P(EP);P(TP);qi.appendMenuItem(K.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:m(856,"Go to &&Bracket")},order:2});pl((n,e)=>{const t=n.getColor(BE);t&&e.addRule(`.monaco-editor .bracket-match-inline { color: ${t} !important; }`)});var kP=class{constructor(n,e){this._selection=n,this._isMovingLeft=e}getEditOperations(n,e){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const t=this._selection.startLineNumber,i=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&i===1)&&!(!this._isMovingLeft&&s===n.getLineMaxColumn(t)))if(this._isMovingLeft){const o=new x(t,i-1,t,i),r=n.getValueInRange(o);e.addEditOperation(o,null),e.addEditOperation(new x(t,s,t,s),r)}else{const o=new x(t,s,t,s+1),r=n.getValueInRange(o);e.addEditOperation(o,null),e.addEditOperation(new x(t,i,t,i),r)}}computeCursorState(n,e){return this._isMovingLeft?new ie(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ie(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}},ny=class extends A{constructor(n,e){super(e),this.left=n}run(n,e){if(!e.hasModel())return;const t=[],i=e.getSelections();for(const s of i)t.push(new kP(s,this.left));e.pushUndoStop(),e.executeCommands(this.id,t),e.pushUndoStop()}},NP=class extends ny{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:L(861,"Move Selected Text Left"),precondition:S.writable})}},MP=class extends ny{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:L(862,"Move Selected Text Right"),precondition:S.writable})}};P(NP);P(MP);var OP=class extends A{constructor(){super({id:"editor.action.transposeLetters",label:L(863,"Transpose Letters"),precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(n,e){if(!e.hasModel())return;const t=e.getModel(),i=[],s=e.getSelections();for(const o of s){if(!o.isEmpty())continue;const r=o.startLineNumber,a=o.startColumn,l=t.getLineMaxColumn(r);if(r===1&&(a===1||a===2&&l===2))continue;const d=a===l?o.getPosition():Kh.rightPosition(t,o.getPosition().lineNumber,o.getPosition().column),c=Kh.leftPosition(t,d),h=Kh.leftPosition(t,c),u=t.getValueInRange(x.fromPositions(h,c)),g=t.getValueInRange(x.fromPositions(c,d)),p=x.fromPositions(h,d);i.push(new Ll(p,g+u))}i.length>0&&(e.pushUndoStop(),e.executeCommands(this.id,i),e.pushUndoStop())}};P(OP);var ze=class Uo{static{this.sep="."}static{this.None=new Uo("@@none@@")}static{this.Empty=new Uo("")}constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+Uo.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new Uo((this.value?[this.value,...e]:e).join(Uo.sep))}},AP=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},FP=function(n,e){return function(t,i){e(t,i,n)}},HP=oe.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:" ",inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0,widthInEm:1}}),WP=class sy extends M{static{this.baseId="editor.widget.inlineProgressWidget"}constructor(e,t,i,s,o){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=o,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(s),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=H(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=H("span.icon");this.domNode.append(t),t.classList.add(...ce.asClassNameArray(V.loading),"codicon-modifier-spin");const i=()=>{const s=this.editor.getOption(75);this.domNode.style.height=`${s}px`,this.domNode.style.width=`${Math.ceil(.8*s)}px`};i(),this._register(this.editor.onDidChangeConfiguration(s=>{(s.hasChanged(61)||s.hasChanged(75))&&i()})),this._register(Q(this.domNode,we.CLICK,s=>{this.delegate.cancel()}))}getId(){return sy.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)}},lc=class extends M{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new We),this._currentWidget=this._register(new We),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,s,o){const r=this._operationIdPool++;this._currentOperation=r,this.clear(),this._showPromise.value=ji(()=>{const a=x.fromPositions(e);this._currentDecorations.set([{range:a,options:HP}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(WP,this.id,this._editor,a,t,s))},o??this._showDelay);try{return await i}finally{this._currentOperation===r&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};lc=AP([FP(2,ne)],lc);var VP=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},qv=function(n,e){return function(t,i){e(t,i,n)}},Ld,Zt=class{static{Ld=this}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new ae("messageVisible",!1,m(1353,"Whether the editor is currently showing an inline message"))}static get(e){return e.getContribution(Ld.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new We,this._messageListeners=new O,this._mouseOverMessage=!1,this._editor=e,this._visible=Ld.MESSAGE_VISIBLE.bindTo(t)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){if(gi(ec(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),ec(e)){const s=this._messageListeners.add(eh(e,{actionHandler:(o,r)=>{this.closeMessage(),ZR(this._openerService,o,r.isTrusted)}}));this._messageWidget.value=new Zh(this._editor,t,s.element)}else this._messageWidget.value=new Zh(this._editor,t,e);this._messageListeners.add(Ge.debounce(this._editor.onDidBlurEditorText,(s,o)=>o,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&a0(nr(),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(Q(this._messageWidget.value.getDomNode(),we.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(Q(this._messageWidget.value.getDomNode(),we.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(s=>{s.target.position&&(i?i.containsPosition(s.target.position)||this.closeMessage():i=new x(t.lineNumber-3,1,s.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Zh.fadeOut(this._messageWidget.value))}};Zt=Ld=VP([qv(1,Ce),qv(2,Co)],Zt);var BP=Ft.bindToContribution(Zt.get);Z(new BP({id:"leaveEditorMessage",precondition:Zt.MESSAGE_VISIBLE,handler:n=>n.closeMessage(),kbOpts:{weight:130,primary:9}}));var Zh=class{static fadeOut(n){const e=()=>{n.dispose(),clearTimeout(t),n.getDomNode().removeEventListener("animationend",e)},t=setTimeout(e,110);return n.getDomNode().addEventListener("animationend",e),n.getDomNode().classList.add("fadeOut"),{dispose:e}}constructor(n,{lineNumber:e,column:t},i){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=n,this._editor.revealLinesInCenterIfOutsideViewport(e,e,0),this._position={lineNumber:e,column:t},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const o=document.createElement("div");typeof i=="string"?(o.classList.add("message"),o.textContent=i):(i.classList.add("message"),o.appendChild(i)),this._domNode.appendChild(o);const r=document.createElement("div");r.classList.add("anchor","below"),this._domNode.appendChild(r),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(n){this._domNode.classList.toggle("below",n===2)}};de(Zt.ID,Zt,4);var Xm=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},$a=function(n,e){return function(t,i){e(t,i,n)}},Ym=class{constructor(n){this.copyMimeTypes=[],this.kind=n,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(n,e,t,i,s){const o=await this.getEdit(t,s);if(o)return{edits:[{insertText:o.insertText,title:o.title,kind:o.kind,handledMimeType:o.handledMimeType,yieldTo:o.yieldTo}],dispose(){}}}async provideDocumentDropEdits(n,e,t,i){const s=await this.getEdit(t,i);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}},Ka=class oy extends Ym{static{this.id="text"}constructor(){super(ze.Empty.append("text","plain")),this.id=oy.id,this.dropMimeTypes=[kt.text],this.pasteMimeTypes=[kt.text]}async getEdit(e,t){const i=e.get(kt.text);if(!i||e.has(kt.uriList))return;const s=await i.asString();return{handledMimeType:kt.text,title:m(980,"Insert Plain Text"),insertText:s,kind:this.kind}}},ry=class extends Ym{constructor(){super(ze.Empty.append("uri","path","absolute")),this.dropMimeTypes=[kt.uriList],this.pasteMimeTypes=[kt.uriList]}async getEdit(n,e){const t=await ay(n);if(!t.length||e.isCancellationRequested)return;let i=0;const s=t.map(({uri:r,originalText:a})=>r.scheme===Ct.file?r.fsPath:(i++,a)).join(" ");let o;return i>0?o=t.length>1?m(981,"Insert Uris"):m(982,"Insert Uri"):o=t.length>1?m(983,"Insert Paths"):m(984,"Insert Path"),{handledMimeType:kt.uriList,insertText:s,title:o,kind:this.kind}}},dc=class extends Ym{constructor(e){super(ze.Empty.append("uri","path","relative")),this._workspaceContextService=e,this.dropMimeTypes=[kt.uriList],this.pasteMimeTypes=[kt.uriList]}async getEdit(e,t){const i=await ay(e);if(!i.length||t.isCancellationRequested)return;const s=Ps(i.map(({uri:o})=>{const r=this._workspaceContextService.getWorkspaceFolder(o);return r?XR(r.uri,o):void 0}));if(s.length)return{handledMimeType:kt.uriList,insertText:s.join(" "),title:i.length>1?m(985,"Insert Relative Paths"):m(986,"Insert Relative Path"),kind:this.kind}}};dc=Xm([$a(0,Cs)],dc);var UP=class{constructor(){this.kind=new ze("html"),this.providedPasteEditKinds=[this.kind],this.copyMimeTypes=[],this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:kt.text}]}async provideDocumentPasteEdits(n,e,t,i,s){if(i.triggerKind!==Yu.PasteAs&&!i.only?.contains(this.kind))return;const o=await t.get("text/html")?.asString();if(!(!o||s.isCancellationRequested))return{dispose(){},edits:[{insertText:o,yieldTo:this._yieldTo,title:m(987,"Insert HTML"),kind:this.kind}]}}};async function ay(n){const e=n.get(kt.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const s of Zw.parse(t))try{i.push({uri:ke.parse(s),originalText:s})}catch{}return i}var to={scheme:"*",hasAccessToAllModels:!0},pg=class extends M{constructor(e,t){super(),this._register(e.documentDropEditProvider.register(to,new Ka)),this._register(e.documentDropEditProvider.register(to,new ry)),this._register(e.documentDropEditProvider.register(to,new dc(t)))}};pg=Xm([$a(0,X),$a(1,Cs)],pg);var fg=class extends M{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register(to,new Ka)),this._register(e.documentPasteEditProvider.register(to,new ry)),this._register(e.documentPasteEditProvider.register(to,new dc(t))),this._register(e.documentPasteEditProvider.register(to,new UP))}};fg=Xm([$a(0,X),$a(1,Cs)],fg);var zP=class Ji{constructor(){this.value="",this.pos=0}static{this._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13}}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),s;if(s=Ji._table[i],typeof s=="number")return this.pos+=1,{type:s,pos:e,len:1};if(Ji.isDigitCharacter(i)){s=8;do t+=1,i=this.value.charCodeAt(e+t);while(Ji.isDigitCharacter(i));return this.pos+=t,{type:s,pos:e,len:t}}if(Ji.isVariableCharacter(i)){s=9;do i=this.value.charCodeAt(e+ ++t);while(Ji.isVariableCharacter(i)||Ji.isDigitCharacter(i));return this.pos+=t,{type:s,pos:e,len:t}}s=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof Ji._table[i]>"u"&&!Ji.isDigitCharacter(i)&&!Ji.isVariableCharacter(i));return this.pos+=t,{type:s,pos:e,len:t}}},Ar=class{constructor(){this._children=[]}appendChild(n){return n instanceof Kt&&this._children[this._children.length-1]instanceof Kt?this._children[this._children.length-1].value+=n.value:(n.parent=this,this._children.push(n)),this}replace(n,e){const{parent:t}=n,i=t.children.indexOf(n),s=t.children.slice(0);s.splice(i,1,...e),t._children=s,(function o(r,a){for(const l of r)l.parent=a,o(l.children,l)})(e,t)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let n=this;for(;;){if(!n)return;if(n instanceof Jm)return n;n=n.parent}}toString(){return this.children.reduce((n,e)=>n+e.toString(),"")}len(){return 0}},Kt=class ly extends Ar{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new ly(this.value)}},dy=class extends Ar{},Wi=class cy extends dy{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof _h?this._children[0]:void 0}clone(){const e=new cy(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}},_h=class hy extends Ar{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Kt&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new hy;return this.options.forEach(e.appendChild,e),e}},jP=class uy extends Ar{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,s=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(o=>o instanceof yn&&!!o.elseValue)&&(s=this._replace([])),s}_replace(e){let t="";for(const i of this._children)if(i instanceof yn){let s=e[i.index]||"";s=i.resolve(s),t+=s}else t+=i.toString();return t}toString(){return""}clone(){const e=new uy;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}},yn=class gy extends Ar{constructor(e,t,i,s){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=s}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":this.shorthandName==="kebabcase"?e?this._toKebabCase(e):"":this.shorthandName==="snakecase"?e?this._toSnakeCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toKebabCase(e){if(!e.match(/[\p{L}0-9]+/gu))return e;if(!e.match(/[\p{L}0-9]/u))return e.trim().toLowerCase().replace(/^_+|_+$/g,"").replace(/[\s_]+/g,"-");const t=e.trim().replace(/^_+|_+$/g,""),i=t.match(/\p{Lu}{2,}(?=\p{Lu}\p{Ll}+[0-9]*|[\s_-]|$)|\p{Lu}?\p{Ll}+[0-9]*|\p{Lu}(?=\p{Lu}\p{Ll})|\p{Lu}(?=[\s_-]|$)|[0-9]+/gu);return i?i.map(s=>s.toLowerCase()).join("-"):t.split(/[\s_-]+/).filter(s=>s.length>0).map(s=>s.toLowerCase()).join("-")}_toPascalCase(e){const t=e.match(/[\p{L}0-9]+/gu);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[\p{L}0-9]+/gu);return t?t.map((i,s)=>s===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toSnakeCase(e){return e.replace(/(\p{Ll})(\p{Lu})/gu,"$1_$2").replace(/[\s\-]+/g,"_").toLowerCase()}clone(){return new gy(this.index,this.shorthandName,this.ifValue,this.elseValue)}},Ga=class py extends dy{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Kt(t)],!0):!1}clone(){const e=new py(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}};function $v(n,e){const t=[...n];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}var Jm=class fy extends Ar{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Wi&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(s=>s===e?(i=!0,!1):(t+=s.len(),!0)),i?t:-1}fullLen(e){let t=0;return $v([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Wi&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof Ga&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new fy;return e._children=this.children.map(t=>t.clone()),e}walk(e){$v(this.children,e)}},ho=class{constructor(){this._scanner=new zP,this._token={type:14,pos:0,len:0}}static escape(n){return n.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(n){return/\${?CLIPBOARD/.test(n)}parse(n,e,t){const i=new Jm;return this.parseFragment(n,i),this.ensureFinalTabstop(i,t??!1,e??!1),i}parseFragment(n,e){const t=e.children.length;for(this._scanner.text(n),this._token=this._scanner.next();this._parse(e););const i=new Map,s=[];e.walk(a=>(a instanceof Wi&&(a.isFinalTabstop?i.set(0,void 0):!i.has(a.index)&&a.children.length>0?i.set(a.index,a.children):s.push(a)),!0));const o=(a,l)=>{const d=i.get(a.index);if(!d)return;const c=new Wi(a.index);c.transform=a.transform;for(const h of d){const u=h.clone();c.appendChild(u),u instanceof Wi&&i.has(u.index)&&!l.has(u.index)&&(l.add(u.index),o(u,l),l.delete(u.index))}e.replace(a,[c])},r=new Set;for(const a of s)o(a,r);return e.children.slice(t)}ensureFinalTabstop(n,e,t){(e||t&&n.placeholders.length>0)&&(n.placeholders.find(i=>i.index===0)||n.appendChild(new Wi(0)))}_accept(n,e){if(n===void 0||this._token.type===n){const t=e?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),t}return!1}_backTo(n){return this._scanner.pos=n.pos+n.len,this._token=n,!1}_until(n){const e=this._token;for(;this._token.type!==n;){if(this._token.type===14)return!1;if(this._token.type===5){const i=this._scanner.next();if(i.type!==0&&i.type!==4&&i.type!==5)return!1}this._token=this._scanner.next()}const t=this._scanner.value.substring(e.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),t}_parse(n){return this._parseEscaped(n)||this._parseTabstopOrVariableName(n)||this._parseComplexPlaceholder(n)||this._parseComplexVariable(n)||this._parseAnything(n)}_parseEscaped(n){let e;return(e=this._accept(5,!0))?(e=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||e,n.appendChild(new Kt(e)),!0):!1}_parseTabstopOrVariableName(n){let e;const t=this._token;return this._accept(0)&&(e=this._accept(9,!0)||this._accept(8,!0))?(n.appendChild(/^\d+$/.test(e)?new Wi(Number(e)):new Ga(e)),!0):this._backTo(t)}_parseComplexPlaceholder(n){let e;const t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(8,!0))))return this._backTo(t);const i=new Wi(Number(e));if(this._accept(1))for(;;){if(this._accept(4))return n.appendChild(i),!0;if(!this._parse(i))return n.appendChild(new Kt("${"+e+":")),i.children.forEach(n.appendChild,n),!0}else if(i.index>0&&this._accept(7)){const s=new _h;for(;;){if(this._parseChoiceElement(s)){if(this._accept(2))continue;if(this._accept(7)&&(i.appendChild(s),this._accept(4)))return n.appendChild(i),!0}return this._backTo(t),!1}}else return this._accept(6)?this._parseTransform(i)?(n.appendChild(i),!0):(this._backTo(t),!1):this._accept(4)?(n.appendChild(i),!0):this._backTo(t)}_parseChoiceElement(n){const e=this._token,t=[];for(;!(this._token.type===2||this._token.type===7);){let i;if((i=this._accept(5,!0))?i=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||i:i=this._accept(void 0,!0),!i)return this._backTo(e),!1;t.push(i)}return t.length===0?(this._backTo(e),!1):(n.appendChild(new Kt(t.join(""))),!0)}_parseComplexVariable(n){let e;const t=this._token;if(!(this._accept(0)&&this._accept(3)&&(e=this._accept(9,!0))))return this._backTo(t);const i=new Ga(e);if(this._accept(1))for(;;){if(this._accept(4))return n.appendChild(i),!0;if(!this._parse(i))return n.appendChild(new Kt("${"+e+":")),i.children.forEach(n.appendChild,n),!0}else return this._accept(6)?this._parseTransform(i)?(n.appendChild(i),!0):(this._backTo(t),!1):this._accept(4)?(n.appendChild(i),!0):this._backTo(t)}_parseTransform(n){const e=new jP;let t="",i="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,t+=s;continue}if(this._token.type!==14){t+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,e.appendChild(new Kt(s));continue}if(!(this._parseFormatString(e)||this._parseAnything(e)))return!1}for(;!this._accept(4);){if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}try{e.regexp=new RegExp(t,i)}catch{return!1}return n.transform=e,!0}_parseFormatString(n){const e=this._token;if(!this._accept(0))return!1;let t=!1;this._accept(3)&&(t=!0);const i=this._accept(8,!0);if(i)if(t){if(this._accept(4))return n.appendChild(new yn(Number(i))),!0;if(!this._accept(1))return this._backTo(e),!1}else return n.appendChild(new yn(Number(i))),!0;else return this._backTo(e),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(e),!1):(n.appendChild(new yn(Number(i),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return n.appendChild(new yn(Number(i),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return n.appendChild(new yn(Number(i),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const o=this._until(4);if(o)return n.appendChild(new yn(Number(i),void 0,s,o)),!0}}else{const s=this._until(4);if(s)return n.appendChild(new yn(Number(i),void 0,void 0,s)),!0}return this._backTo(e),!1}_parseAnything(n){return this._token.type!==14?(n.appendChild(new Kt(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}};function my(n,e,t){return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:t.additionalEdit?.edits??[]}:{edits:[...e.map(i=>new Ew(n,{range:i,text:typeof t.insertText=="string"?ho.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...t.additionalEdit?.edits??[]]}}function _y(n){function e(r,a){return"mimeType"in r?r.mimeType===a.handledMimeType:!!a.kind&&r.kind.contains(a.kind)}const t=new Map;for(const r of n)for(const a of r.yieldTo??[])for(const l of n)if(l!==r&&e(a,l)){let d=t.get(r);d||(d=[],t.set(r,d)),d.push(l)}if(!t.size)return Array.from(n);const i=new Set,s=[];function o(r){if(!r.length)return[];const a=r[0];if(s.includes(a))return console.warn("Yield to cycle detected",a),r;if(i.has(a))return o(r.slice(1));let l=[];const d=t.get(a);return d&&(s.push(a),l=o(d),s.pop()),i.add(a),[...l,a,...o(r.slice(1))]}return o(Array.from(n))}function Xh(n,e){return e&&(n.stack||n.stacktrace)?m(33,"{0}: {1}",Gv(n),Kv(n.stack)||Kv(n.stacktrace)):Gv(n)}function Kv(n){return Array.isArray(n)?n.join(`
|
|
3
|
+
`):n}function Gv(n){return n.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${n.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof n.code=="string"&&typeof n.errno=="number"&&typeof n.syscall=="string"?m(34,"A system error occurred ({0})",n.message):n.message||m(35,"An unknown error occurred. Please consult the log for more details.")}function cc(n=null,e=!1){if(!n)return m(36,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(n)){const t=Ps(n),i=cc(t[0],e);return t.length>1?m(37,"{0} ({1} errors in total)",i,t.length):i}if(Mw(n))return n;if(n.detail){const t=n.detail;if(t.error)return Xh(t.error,e);if(t.exception)return Xh(t.exception,e)}return n.stack?Xh(n,e):n.message?n.message:m(38,"An unknown error occurred. Please consult the log for more details.")}var qP=class extends M{constructor(n){super(),this._onChange=this._register(new ee),this.onChange=this._onChange.event,this._checked=!!n.checked,this._title=n.title??n.ariaLabel,this.domNode=H("button.monaco-switch"),this.domNode.type="button",this.domNode.setAttribute("role","switch"),U(this.domNode,H(".monaco-switch-thumb")),this._register(Cw().setupDelayedHover(this.domNode,()=>({content:this._title,style:1}))),this.setAriaLabel(n.ariaLabel,n.title),this.disabled=!!n.disabled,this._applyState(),this._register(Q(this.domNode,we.CLICK,e=>{bt.stop(e,!0),!this.domNode.disabled&&(this._checked=!this._checked,this._applyState(),this._onChange.fire(this._checked))}))}get checked(){return this._checked}set checked(n){this._checked!==n&&(this._checked=n,this._applyState())}get disabled(){return this.domNode.disabled}set disabled(n){this.domNode.disabled=n}setAriaLabel(n,e=n){this.domNode.setAttribute("aria-label",n),this._title=e}_applyState(){this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked)}},$P=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Zv=function(n,e){return function(t,i){e(t,i,n)}},hc=class extends M{get enabled(){return this._enabled}set enabled(e){e?(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=e}constructor(e,t,i={},s,o){super(),this._link=t,this._hoverService=s,this._enabled=!0,this.el=U(e,H("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??gw("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new jh(this.el,"click")),a=this._register(new jh(this.el,"keydown")),l=Ge.chain(a.event,h=>h.map(u=>new Oa(u)).filter(u=>u.keyCode===3||u.keyCode===10)),d=this._register(new jh(this.el,dm.Tap)).event;this._register(yw.addTarget(this.el));const c=Ge.any(r.event,l,d);this._register(c(h=>{this.enabled&&(bt.stop(h,!0),i?.opener?i.opener(this._link.href):o.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};hc=$P([Zv(3,fi),Zv(4,Co)],hc);var Qm=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},fs=function(n,e){return function(t,i){e(t,i,n)}},mg,e_="acceptSelectedCodeAction",t_="previewSelectedCodeAction",KP=new Set([e_,t_,"toggleSectionCodeAction"]),GP="actionList.remove",ZP=class{get templateId(){return"header"}renderTemplate(n){n.classList.add("group-header");const e=document.createElement("span");return n.append(e),{container:n,text:e}}renderElement(n,e,t){t.text.textContent=n.group?.title??n.label??""}disposeTemplate(n){}},XP=class{get templateId(){return"separator"}renderTemplate(n){n.classList.add("separator");const e=document.createElement("span");return n.append(e),{container:n,text:e}}renderElement(n,e,t){t.container.classList.toggle("has-label",!!n.label),t.text.textContent=n.label??""}disposeTemplate(n){}};function vy(n){return!!n.submenuActions?.length&&!n.hover?.content||!!n.hover?.expandable}function by(n){return vy(n)&&n.hover?.showIndicator!==!1}var _g=class{get templateId(){return"action"}constructor(e,t,i,s,o,r,a,l,d,c,h,u){this._supportsPreview=e,this._onRemoveItem=t,this._onShowSubmenu=i,this._reservesSubmenuSpace=s,this._groupTitleByIndex=o,this._linkHandler=r,this._hideDefaultKeybindingTooltip=a,this._stopToolbarPointerPropagation=l,this._registerStandaloneToggle=d,this._registerToolbar=c,this._keybindingService=h,this._openerService=u}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const s=document.createElement("span");s.className="action-item-badge",s.ariaHidden="true",e.append(s);const o=document.createElement("span");o.className="description",e.append(o);const r=document.createElement("span");r.className="group-title",e.append(r);const a=document.createElement("span");a.className="detail",e.append(a);const l=new bl(e,_l),d=document.createElement("div");d.className="action-list-item-toolbar",e.append(d);const c=document.createElement("div");c.className="action-list-submenu-indicator",e.append(c);const h=document.createElement("div");return h.className="action-list-item-inline-toggle",e.append(h),{container:e,icon:t,text:i,detail:a,badge:s,description:o,groupTitle:r,keybinding:l,toolbar:d,submenuIndicator:c,inlineToggleContainer:h,elementDisposables:new O}}renderElement(e,t,i){if(i.elementDisposables.clear(),e.iconClasses?.length?(i.icon.className=["icon",...e.iconClasses].join(" "),i.icon.style.color=""):e.group?.icon?(i.icon.className=ce.asClassName(e.group.icon),i.icon.style.color=e.group.icon.color?De(e.group.icon.color.id):""):(i.icon.className=ce.asClassName(V.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item&&!e.standaloneToggle||!e.label)return;if(zE(!e.hideIcon,i.icon),e.isSectionToggle){const c=e.group?.icon===V.chevronDown;i.container.setAttribute("aria-expanded",String(c))}else i.container.removeAttribute("aria-expanded");i.previousClassNames?.length&&i.container.classList.remove(...i.previousClassNames);const s=e.className?.split(/\s+/).filter(c=>c.length>0)??[];if(i.container.classList.toggle("action-list-custom",s.length>0),s.length&&i.container.classList.add(...s),i.previousClassNames=s,i.text.textContent=wi(e.label),e.badge?(i.badge.textContent=e.badge,i.badge.style.display=""):(i.badge.textContent="",i.badge.style.display="none"),e.keybinding)i.description.textContent=e.keybinding.getLabel(),i.description.style.display="inline",i.description.style.letterSpacing="0.5px";else if(e.description){if(ni(i.description),typeof e.description=="string")i.description.textContent=wi(e.description);else{const c=eh(e.description,{actionHandler:h=>{const u=ke.parse(h);this._linkHandler?this._linkHandler(u,e):this._openerService.open(u,{allowCommands:!0})}});i.elementDisposables.add(c),i.description.appendChild(c.element)}i.description.style.display="inline"}else i.description.textContent="",i.description.style.display="none";const o=this._groupTitleByIndex.get(t);o?(i.groupTitle.textContent=o,i.groupTitle.style.display=""):(i.groupTitle.textContent="",i.groupTitle.style.display="none"),e.detail?(i.detail.textContent=wi(e.detail),i.detail.style.display=""):(i.detail.textContent="",i.detail.style.display="none"),i.container.classList.toggle("has-detail",!!e.detail),ni(i.inlineToggleContainer);const r=e.standaloneToggle??e.inlineToggle;if(r){const c=document.createElement("span");c.className="action-list-item-inline-toggle-label",c.textContent=wi(r.label),e.standaloneToggle||i.inlineToggleContainer.append(c),i.inlineToggleContainer.style.display="",i.container.classList.toggle("has-inline-toggle",!!e.inlineToggle),i.container.classList.toggle("has-standalone-toggle",!!e.standaloneToggle);const h=i.elementDisposables.add(new qP({ariaLabel:r.title??r.label,checked:r.checked,disabled:r.disabled}));i.inlineToggleContainer.append(h.domNode),e.standaloneToggle&&i.elementDisposables.add(this._registerStandaloneToggle(e,h)),i.elementDisposables.add(h.onChange(()=>r.onChange(h.checked))),i.elementDisposables.add(Q(i.inlineToggleContainer,we.CLICK,u=>u.stopPropagation()))}else i.inlineToggleContainer.style.display="none",i.container.classList.remove("has-inline-toggle"),i.container.classList.remove("has-standalone-toggle");const a=this._keybindingService.lookupKeybinding(e_)?.getLabel(),l=this._keybindingService.lookupKeybinding(t_)?.getLabel();i.container.classList.toggle("option-disabled",!!e.disabled),e.hover!==void 0?i.container.title="":e.tooltip?i.container.title=e.tooltip:e.disabled?i.container.title=e.label:e.standaloneToggle||this._hideDefaultKeybindingTooltip?i.container.title="":a&&l?this._supportsPreview&&e.canPreview?i.container.title=m(1731,"{0} to Apply, {1} to Preview",a,l):i.container.title=m(1732,"{0} to Apply",a):i.container.title="",ni(i.toolbar);const d=[...e.toolbarActions??[]];if(e.onRemove&&d.push(uT({id:GP,label:m(1733,"Remove"),class:ce.asClassName(V.close),run:async()=>{await e.onRemove(),this._onRemoveItem?.(e)}})),i.container.classList.toggle("has-toolbar",d.length>0),d.length>0){const c=new _s(i.toolbar);i.elementDisposables.add(c),this._stopToolbarPointerPropagation?(i.elementDisposables.add(La(i.toolbar,h=>{h.preventDefault(),h.stopPropagation()})),i.elementDisposables.add(Q(i.toolbar,we.CLICK,h=>h.stopPropagation())),i.elementDisposables.add(Q(i.toolbar,dm.Tap,h=>h.stopPropagation()))):i.elementDisposables.add(La(i.toolbar,h=>h.preventDefault())),c.push(d,{icon:!0,label:!1}),i.elementDisposables.add(this._registerToolbar(e,c))}by(e)?(i.submenuIndicator.className="action-list-submenu-indicator has-submenu "+ce.asClassName(V.chevronRight),i.submenuIndicator.style.display="",i.submenuIndicator.style.visibility="",i.elementDisposables.add(Q(i.submenuIndicator,we.CLICK,c=>{c.stopPropagation(),this._onShowSubmenu?.(e)}))):this._reservesSubmenuSpace()?(i.submenuIndicator.className="action-list-submenu-indicator",i.submenuIndicator.style.display="",i.submenuIndicator.style.visibility="hidden"):(i.submenuIndicator.className="action-list-submenu-indicator",i.submenuIndicator.style.display="none"),vy(e)?(i.container.setAttribute("aria-haspopup",e.hover?.expandable?"dialog":"menu"),i.container.setAttribute("aria-expanded","false")):(i.container.removeAttribute("aria-haspopup"),e.isSectionToggle||i.container.removeAttribute("aria-expanded"))}disposeTemplate(e){e.keybinding.dispose(),e.elementDisposables.dispose()}};_g=Qm([fs(10,He),fs(11,Co)],_g);var Xv=class extends UIEvent{constructor(){super("acceptSelectedAction")}},Yv=class extends UIEvent{constructor(){super("previewSelectedAction")}};function YP(n){if(n.kind==="action")return n.label}var vg=mg=class extends M{constructor(e,t,i,s,o,r,a,l,d){if(super(),this._supportsPreview=t,this._delegate=s,this._options=r,this._keybindingService=a,this._openerService=l,this._instantiationService=d,this._headerLineHeight=24,this._separatorLineHeight=8,this.cts=this._register(new ot),this._submenuDisposables=this._register(new O),this._submenuHoverActionElements=[],this._itemMoveAnimation=this._register(new We),this._collapsedSections=new Set,this._filterText="",this._imeSessionInProgress=!1,this._isMeasuringWidth=!1,this._suppressHover=!1,this._hoverEnabled=!0,this._ignoreInitialHover=!0,this._hasLaidOut=!1,this._filterCts=this._register(new We),this._groupTitleByIndex=new Map,this._standaloneToggles=new Map,this._itemToolbars=new Map,this._onDidRequestLayout=this._register(new ee),this.onDidRequestLayout=this._onDidRequestLayout.event,this._visibleMenuItems=i,this._initialFocusItemId=this._options?.initialFocusItemId,this._filterText=this._options?.showFilter?this._options.initialFilterValue??"":"",this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._options?.inlineDescription&&this.domNode.classList.add("inline-description"),this._options?.className){const g=this._options.className.split(/\s+/).filter(p=>p.length>0);g.length>0&&this.domNode.classList.add(...g)}if(this._actionLineHeight=24,this._submenuContainer=document.createElement("div"),this._submenuContainer.className="action-list-submenu-panel action-widget",this._submenuContainer.style.display="none",this._options?.persistentHover&&(this._submenuContainer.style.boxSizing="border-box"),this._submenuContainer.tabIndex=-1,this.domNode.append(this._submenuContainer),this._register(Q(this._submenuContainer,"keydown",g=>{if((g.key==="Enter"||g.key===" ")&&this._currentSubmenuElement?.hover?.tabThroughPanel){const f=hi(g.target)?g.target:void 0;if(f&&this._currentSubmenuElement.hover.getTabbableElements?.().includes(f)){g.stopPropagation();return}}if(g.key!=="ArrowLeft"&&g.key!=="Escape")return;bt.stop(g,!0);const p=g.key==="Escape"&&this._currentSubmenuWidget!==void 0;if(this._hideSubmenu(),p){this.hide();return}this._setKeyboardNavigation(!0),this._list.domFocus()})),this._register(Q(this._submenuContainer,"mouseenter",()=>{this._cancelSubmenuHide(),this._usesSubmenuPointerIntent()&&(this._cancelSubmenuShow(),this._resetSubmenuPointer())})),this._register(Q(this._submenuContainer,"mouseleave",()=>{this._scheduleSubmenuHide()})),this._register(Q(this.domNode,we.MOUSE_LEAVE,()=>{this._cancelSubmenuShow(),this._resetSubmenuPointer()})),this._usesSubmenuPointerIntent()&&this._register(Q(this.domNode,we.MOUSE_MOVE,g=>{hi(g.target)&&this._expandedTrigger?.contains(g.target)&&this._updateSubmenuPointer(g)})),this._register(Te(()=>{this._cancelSubmenuHide(),this._cancelSubmenuShow()})),this._options?.collapsedByDefault)for(const g of this._options.collapsedByDefault)this._collapsedSections.add(g);const c={getHeight:g=>this._getItemHeight(g),getTemplateId:g=>g.kind},h=()=>{const g=this._options?.reserveSubmenuSpace??!0;return g==="always"||g&&this._allMenuItems.some(by)};this._list=this._register(new Om(e,this.domNode,c,[new _g(this._supportsPreview,g=>this._removeItem(g),g=>this._showSubmenuForItem(g),h,this._groupTitleByIndex,this._options?.linkHandler,this._options?.hideDefaultKeybindingTooltip??!1,this._options?.stopToolbarPointerPropagation??!1,(g,p)=>(this._standaloneToggles.set(g,p),Te(()=>{this._standaloneToggles.get(g)===p&&this._standaloneToggles.delete(g)})),(g,p)=>(this._itemToolbars.set(g,p),this._updateToolbarFocusability(),Te(()=>{this._itemToolbars.get(g)===p&&this._itemToolbars.delete(g)})),this._keybindingService,this._openerService),new ZP,new XP],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter&&!this._options?.onType,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:YP},accessibilityProvider:{getAriaLabel:g=>{if(g.kind==="action"){let p=g.label?wi(g?.label):"";if(g.badge&&(p=p+", "+wi(g.badge)),g.detail&&(p=p+", "+wi(g.detail)),g.ariaDescription)p=p+", "+wi(g.ariaDescription);else if(g.description){const _=typeof g.description=="string"?g.description:g.description.value;p=p+", "+wi(_)}if(g.hover?.content&&!g.ariaDescription&&!g.description){const _=g.hover.content,v=typeof _=="string"?_:ec(_)?_.value:hi(_)?_.textContent??void 0:void 0;v&&(!g.detail||wi(g.detail)!==wi(v))&&(p=p+", "+wi(v))}g.group?.title&&(p=p+", "+g.group.title);const f=g.standaloneToggle??g.inlineToggle;return f&&(p=g.standaloneToggle?f.checked?m(1734,"{0}, on",f.label):m(1735,"{0}, off",f.label):p+", "+(f.checked?m(1736,"{0}, on",f.label):m(1737,"{0}, off",f.label))),g.disabled&&(p=m(1738,"{0}, Disabled Reason: {1}",p,g.disabled)),g.submenuActions?.length&&(p=m(1739,"{0}, use right arrow to access options",p)),p}return null},getWidgetAriaLabel:()=>m(1740,"Action Widget"),getSetSize:()=>this._visibleMenuItems.filter(g=>g.kind==="action").length,getPosInSet:(g,p)=>Math.max(this._visibleMenuItems.slice(0,p+1).filter(f=>f.kind==="action").length,1),getRole:g=>{switch(g.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...o}})),this._list.style(iR),this._register(this._list.onKeyDown(()=>this._setKeyboardNavigation(!0))),this._register(Q(this._list.getHTMLElement(),we.MOUSE_MOVE,g=>{(g.movementX!==0||g.movementY!==0)&&this._setKeyboardNavigation(!1)})),this._register(this._list.onMouseClick(g=>this.onListClick(g))),this._register(this._list.onMouseOver(g=>{this._ignoreInitialHover||this.onListHover(g)}));const u=this._register(new We);if(u.value=this._list.onMouseMove(g=>{(g.browserEvent.movementX!==0||g.browserEvent.movementY!==0)&&(u.clear(),this._ignoreInitialHover=!1,this.onListHover(g))}),this._register(this._list.onMouseDown(()=>{u.clear(),this._ignoreInitialHover=!1,this._setKeyboardNavigation(!1)})),this._register(this._list.onDidChangeFocus(()=>{this._updateToolbarFocusability(),this.onFocus()})),this._register(this._list.onDidChangeSelection(g=>this.onListSelection(g))),this._register(this._list.onDidScroll(()=>{this._isMeasuringWidth||this._layoutSubmenu?.()})),this._allMenuItems=[...i],this._options?.showFilter||this._options?.secondaryHeading){this._filterContainer=document.createElement("div"),this._filterContainer.className="action-list-filter";const g=U(this._filterContainer,H(".action-list-filter-row"));if(this._options?.showFilter){if(this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??m(1741,"Search..."),this._filterInput.value=this._filterText,this._filterInput.setAttribute("aria-label",m(1742,"Filter items")),g.appendChild(this._filterInput),this._register(Q(this._filterInput,we.KEY_DOWN,_=>{if(this._setKeyboardNavigation(!0),_.isComposing||!this._filterInput?.closest(".action-list-submenu-panel"))return;const v=this._keybindingService.softDispatch(new Oa(_),this._filterInput);(v.kind===2&&v.commandId!==null&&KP.has(v.commandId)||_.key.length===1&&!_.ctrlKey&&!_.metaKey&&!_.altKey)&&_.stopPropagation()})),this._register(Q(this._filterInput,we.MOUSE_DOWN,()=>this._setKeyboardNavigation(!1))),this._options.tabThroughItemActions&&this._register(Q(this._filterInput,"keydown",_=>this._handleTabThroughPanelKeyDown(_),!0)),this._options.filterAsCombobox){const _=this._list.getHTMLElement();_.id=this._list.domId,this._filterInput.setAttribute("role","combobox"),this._filterInput.setAttribute("aria-label",this._filterInput.placeholder),this._filterInput.setAttribute("aria-autocomplete","list"),this._filterInput.setAttribute("aria-expanded","true"),this._filterInput.setAttribute("aria-controls",_.id),this._register(this._list.onDidChangeFocus(()=>this._updateFilterActiveDescendant())),this._register(Q(this._filterInput,"focus",()=>this._updateFilterActiveDescendant())),this._register(Q(this._filterInput,"blur",()=>this._updateFilterActiveDescendant())),this._register(hn(this._filterInput,"keydown",v=>{if(this._imeSessionInProgress||v.browserEvent.isComposing||v.keyCode===114||v.keyCode===15||v.keyCode===17||v.keyCode===14||v.keyCode===13){v.stopPropagation();return}const C=v.keyCode===16||v.keyCode===18;if(!(!C&&v.keyCode!==3)){if(v.ctrlKey||v.metaKey||v.altKey||v.shiftKey){C&&v.stopPropagation();return}bt.stop(v,!0),v.keyCode===16?this.focusPrevious():v.keyCode===18?this.focusNext():this.acceptSelected()}}))}const p=this._options?.filterActions??[];if(p.length>0){const _=U(g,H(".action-list-filter-actions"));this._register(new _s(_)).push(p,{icon:!0,label:!1})}const f=()=>{const _=this._filterInput.value;this._imeSessionInProgress||_===this._filterText&&!this._filterCts.value?.token.isCancellationRequested||(this._filterText=_,this._applyOrUpdateFilter())};this._register(Q(this._filterInput,"compositionstart",()=>{this._imeSessionInProgress=!0,this._filterCts.value?.cancel()})),this._register(Q(this._filterInput,"compositionend",()=>{this._imeSessionInProgress=!1,f()})),this._register(Q(this._filterInput,"input",f))}if(this._options?.secondaryHeading){const p=U(g,H(".action-list-filter-label"));p.textContent=this._options.secondaryHeading}}if(this._options?.footerText&&(this._footerContainer=document.createElement("div"),this._footerContainer.className="action-list-footer",this._footerContainer.textContent=this._options.footerText),this._options?.headerText){if(this._headerContainer=document.createElement("div"),this._headerContainer.className="action-list-header",this._options.headerIcon){const p=U(this._headerContainer,H("span.action-list-header-icon"));p.classList.add(...ce.asClassNameArray(this._options.headerIcon)),p.setAttribute("aria-hidden","true")}const g=U(this._headerContainer,H("span.action-list-header-text"));if(g.textContent=this._options.headerText,this._register(Q(this._headerContainer,we.MOUSE_ENTER,()=>{this._options?.persistentHover?(this._cancelSubmenuShow(),this._resetSubmenuPointer()):this._hideSubmenu()})),this._options.headerLink){const{label:p,uri:f}=this._options.headerLink;g.textContent+=" ",this._register(this._instantiationService.createInstance(hc,g,{label:p,href:f.toString(!0)},{}))}if(this._options.headerDismiss){const p=this._options.headerDismiss,f=U(this._headerContainer,H("span.action-list-header-dismiss"));f.appendChild(H(ce.asCSSSelector(V.close))),f.tabIndex=0,f.setAttribute("role","button"),f.setAttribute("aria-label",m(1743,"Dismiss"));const _=()=>{p(),this.focus(),this._headerContainer?.remove(),this._headerContainer=void 0,this._onDidRequestLayout.fire()};this._register(oP(f,()=>_())),this._register(Q(f,we.KEY_DOWN,v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),_())}))}}this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._register(Q(this.domNode,"keydown",g=>{if(g.key==="ArrowRight"&&!g.isComposing){const p=this._list.getFocus();if(p.length>0){const f=this._list.element(p[0]);if(f?.submenuActions?.length||f?.hover?.expandable){bt.stop(g,!0);const _=this._getRowElement(p[0]);_&&(this._showSubmenuForElement(f,_),f.hover?.tabThroughPanel?this._focusFirstTabThroughPanelControl(f,_):this._currentSubmenuWidget?this._currentSubmenuWidget.focus():this._submenuContainer.focus())}}}})),this._register(Q(this.domNode,"keydown",g=>this._handleTabThroughPanelKeyDown(g),!0)),(this._filterInput||this._options?.onType)&&this._register(Q(this.domNode,"keydown",g=>{const p=g.target;(this._options?.onType||this._options?.filterAsCombobox)&&hi(p)&&(I0(p)||p.closest('button, a, [contenteditable="true"], .action-list-submenu-panel'))||(!this._filterInput||!zs(this._filterInput))&&!g.isComposing&&g.key.length===1&&g.key!==" "&&!g.ctrlKey&&!g.metaKey&&!g.altKey&&(g.preventDefault(),g.stopPropagation(),this._filterInput?(this._filterInput.focus(),this._filterInput.value=g.key,this._filterText=g.key,this._applyOrUpdateFilter()):this._options?.onType?.(g.key))}))}_toggleSection(e){const t=this._collapsedSections.has(e);if(t)this._collapsedSections.delete(e);else{this._collapsedSections.add(e);const i=this.getFocusedElement();if(i?.section===e&&!i.isSectionToggle){const s=this._visibleMenuItems.findIndex(o=>o.section===e&&o.isSectionToggle);s>=0&&this._list.setFocus([s])}}this._options?.onDidToggleSection?.(e,this._collapsedSections.has(e)),this._applyFilter(),t&&this._revealFirstItemOfSection(e)}_revealFirstItemOfSection(e){for(let t=0;t<this._list.length;t++){const i=this._list.element(t);if(i.section===e&&!i.isSectionToggle){this._list.reveal(t);return}}}_applyOrUpdateFilter(){if(!this._delegate.onFilter){this._applyFilter();return}const e=this._filterText;this._filterCts.value?.cancel();const t=new ot;this._filterCts.value=t,this._delegate.onFilter(e,t.token).then(i=>{t.token.isCancellationRequested||(this._allMenuItems=[...i],this._applyFilter(!0))}).catch(()=>{}).finally(()=>{this._filterCts.value===t&&!t.token.isCancellationRequested&&this._filterCts.clear()})}_applyFilter(e=!1,t=!0,i){this._itemMoveAnimation.clear();const s=e?"":this._filterText.toLowerCase(),o=!e&&s.length>0,r=[],a=this._list.getFocus();let l;if(a.length>0&&(l=this._list.element(a[0])),o){let f,_=[],v=!1;const C=()=>{f&&v&&r.push(f),r.push(..._),f=void 0,_=[],v=!1},w=y=>{const D=(y.label??"").toLowerCase(),b=typeof y.description=="string"?y.description:y.description?.value??"";return D.includes(s)||b.toLowerCase().includes(s)};for(const y of this._allMenuItems)if(y.kind!=="header"){if(y.kind==="separator"){C(),f=y.label?y:void 0;continue}if(y.showAlways){_.push(y);continue}if(!y.isSectionToggle){if(y.filterItems){const D=w(y)?y.filterItems:y.filterItems.filter(w);D.length>0&&(v=!0,_.push(...D));continue}w(y)&&(v=!0,_.push(y))}}C()}else for(const f of this._allMenuItems){if(f.kind==="header"){r.push(f);continue}if(f.kind==="separator"){if(f.section&&this._collapsedSections.has(f.section))continue;r.push(f);continue}if(f.isSectionToggle&&f.section){const _=this._collapsedSections.has(f.section);r.push({...f,group:{...f.group,icon:_?V.chevronRight:V.chevronDown}});continue}f.section&&this._collapsedSections.has(f.section)||r.push(f)}const d=[];let c=!1;for(let f=0;f<r.length;f++)d[f]=c,r[f].kind==="action"&&(c=!0);const h=[];let u=!1;for(let f=r.length-1;f>=0;f--){if(r[f].kind==="action"){u=!0;continue}r[f].kind==="separator"&&(h[f]=u,u=!1)}for(let f=r.length-1;f>=0;f--){const _=r[f];if(_.kind!=="separator")continue;const v=h[f],C=!_.label&&!d[f];(!v||C)&&r.splice(f,1)}this._options?.showGroupTitleOnFirstItem&&this._recomputeGroupTitles(r);const g=this._filterInput&&zs(this._filterInput),p=ME(this._list.getHTMLElement());if(this._visibleMenuItems=r,this._list.splice(0,this._list.length,r),t&&this._onDidRequestLayout.fire(),g)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._hasLaidOut&&(l||i)){const f=i??l?.item?.id;if(f){for(let _=0;_<this._list.length;_++)if(this._list.element(_).item?.id===f){this._list.setFocus([_]),this._list.reveal(_);break}p&&(this._focusCheckedOrFirst(),this._list.domFocus())}}}get filterContainer(){return this._filterContainer}get footerContainer(){return this._footerContainer}get headerContainer(){return this._headerContainer}get filterInput(){return this._filterInput}get closeAnimation(){return this._options?.closeAnimation}focusCondition(e){return!e.disabled&&e.kind==="action"}_setKeyboardNavigation(e){if(this._keyboardNavigation===e)return;this._keyboardNavigation=e;const t=this._list.getHTMLElement();t.classList.toggle("keyboard-navigation",e===!0),t.classList.toggle("mouse-navigation",e===!1)}_updateFilterActiveDescendant(){if(!this._filterInput)return;const[e]=this._list.getFocus();zs(this._filterInput)&&e!==void 0?this._filterInput.setAttribute("aria-activedescendant",this._list.getElementID(e)):this._filterInput.removeAttribute("aria-activedescendant")}focus(){if(this._setKeyboardNavigation(void 0),this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst(),this._showTabThroughPanelForFocusedItem()}clearFocus(){this._list.setFocus([])}getFocusedElement(){const e=this._list.getFocus();if(e.length>0)return this._list.element(e[0])}_updateToolbarFocusability(){if(!this._options?.tabThroughItemActions)return;const[e]=this._list.getFocus(),t=e!==void 0&&e<this._list.length?this._list.element(e):void 0;for(const[i,s]of this._itemToolbars)s.setFocusable(i===t)}_focusCheckedOrFirst(){const e=this._suppressHover;this._suppressHover=!0;try{const t=this._initialFocusItemId;if(this._initialFocusItemId=void 0,t)for(let o=0;o<this._list.length;o++){const r=this._list.element(o);if(this.focusCondition(r)&&r.item?.id===t){this._list.setFocus([o]),this._list.reveal(o);return}}const[i]=this._list.getFocus();if(i!==void 0){const o=this._list.element(i);if(o&&this.focusCondition(o)){this._list.reveal(i);return}}for(let o=0;o<this._list.length;o++){const r=this._list.element(o);if(this.focusCondition(r)&&r.item?.checked){this._list.setFocus([o]),this._list.reveal(o);return}}this._list.focusFirst(void 0,this.focusCondition);const s=this._list.getFocus();s.length>0&&this._list.reveal(s[0])}finally{this._suppressHover=e,this._options?.filterAsCombobox&&this._updateFilterActiveDescendant()}}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._filterCts.value?.cancel(),this._filterCts.clear(),this._hideSubmenu()}clearFilter(){return this._filterInput&&this._filterText?(this._filterInput.value="",this._filterText="",this._applyOrUpdateFilter(),!0):!1}get hasDynamicHeight(){return this._options?.showFilter?!0:this._allMenuItems.some(e=>e.isSectionToggle)}get lineHeight(){return this._actionLineHeight}_getItemHeight(e){return this._itemHeightWith(e,this._options)}_itemHeightWith(e,t){switch(e.kind){case"header":return this._headerLineHeight;case"separator":return e.label?this._actionLineHeight:this._separatorLineHeight;default:return e.inlineToggle?t?.inlineToggleItemHeight??70:e.detail?t?.detailItemHeight??48:this._actionLineHeight}}computeFullHeight(){return this.computeHeightForItems(this._allMenuItems,void 0,this._options)}computeHeightForItems(e,t,i){let s=0;for(const o of e)t&&o.section&&!o.isSectionToggle&&t.has(o.section)||(s+=this._itemHeightWith(o,i));return s}computeListHeight(){const e=this._list.length;let t=0;for(let i=0;i<e;i++){const s=this._list.element(i);t+=this._getItemHeight(s)}return t}layout(e,t){this._hasLaidOut=!0,this._list.layout(e,t),this.domNode.style.height=`${e}px`;const i=this.domNode.parentElement;i&&this._filterContainer?.parentElement===i&&i.insertBefore(this._filterContainer,this.domNode),this._layoutSubmenu?.()}computeMaxWidth(e){const t=this._list.length,i=Math.max(e,this._options?.minWidth??0),s=this._options?.maxWidth??Number.POSITIVE_INFINITY,o=Math.max(s,i),r=c=>Math.min(Math.max(c,i),o),a=this._allMenuItems.length;if(a>=50)return r(380);if(a>t){const c=[];for(let f=0;f<t;f++)c.push(this._list.element(f));const h=this._list.renderHeight,u=this._list.scrollTop,g=this._list.getFocus(),p=this._isMeasuringWidth;this._isMeasuringWidth=!0;try{const f=[...this._allMenuItems];this._list.splice(0,t,f);let _=0;for(const C of f)_+=this._getItemHeight(C);this._list.layout(_);const v=this._measureItemWidths(f);return r(Math.max(...v))}finally{try{this._list.splice(0,this._list.length,c),this._list.layout(h),this._list.scrollTop=u;const f=this._suppressHover;this._suppressHover=!0;try{this._list.setFocus(g)}finally{this._suppressHover=f}}finally{this._isMeasuringWidth=p}}}const l=[];for(let c=0;c<t;c++)l.push(this._list.element(c));const d=this._measureItemWidths(l);return r(Math.max(...d))}focusPrevious(){if(this._setKeyboardNavigation(!0),this._focusFilterResult("previous"))return;if(this._filterInput&&zs(this._filterInput)){this._list.domFocus();const i=this._list.getFocus();if(i.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);const s=this._list.getFocus();s.length>0&&s[0]>=i[0]?this._filterInput.focus():s.length>0&&this._list.reveal(s[0])}else{this._list.focusLast(void 0,this.focusCondition);const s=this._list.getFocus();s.length>0&&this._list.reveal(s[0])}return}const e=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);const t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]>e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}focusNext(){if(this._setKeyboardNavigation(!0),this._focusFilterResult("next"))return;if(this._filterInput&&zs(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);const i=this._list.getFocus();i.length>0&&this._list.reveal(i[0])}else{this._list.focusFirst(void 0,this.focusCondition);const i=this._list.getFocus();i.length>0&&this._list.reveal(i[0])}return}const e=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);const t=this._list.getFocus();if(t.length>0){if(this._filterInput&&e.length>0&&t[0]<e[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(t[0])}}_focusFilterResult(e){if(!this._options?.filterAsCombobox||!this._filterInput||!zs(this._filterInput))return!1;e==="previous"?this._list.focusPrevious(1,!0,void 0,this.focusCondition):this._list.focusNext(1,!0,void 0,this.focusCondition);const[t]=this._list.getFocus();return t!==void 0&&this._list.reveal(t),!0}collapseFocusedSection(){const e=this._getFocusedSection();e&&!this._collapsedSections.has(e)&&this._toggleSection(e)}expandFocusedSection(){const e=this._getFocusedSection();e&&this._collapsedSections.has(e)&&this._toggleSection(e)}toggleFocusedSection(){const e=this._list.getFocus();if(e.length===0)return!1;const t=this._list.element(e[0]);return t.isSectionToggle&&t.section?(this._toggleSection(t.section),!0):!1}_getFocusedSection(){const e=this._list.getFocus();if(e.length===0)return;const t=this._list.element(e[0]);return t.isSectionToggle&&t.section,t.section}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],s=this._list.element(i);if(!this.focusCondition(s))return;const o=e?new Yv:new Xv;this._list.setSelection([i],o)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];if(t.standaloneToggle){this._list.setSelection([]);const s=this._standaloneToggles.get(t);s&&!s.disabled&&(s.checked=!s.checked,t.standaloneToggle.onChange(s.checked));return}if(t.isSectionToggle&&t.section){this._list.setSelection([]);const s=t.section;queueMicrotask(()=>{this._toggleSection(s)});return}const i=FE(e.browserEvent)||e.browserEvent?.type===dm.Tap;if(i){const s=e.browserEvent.target;if(hi(s)&&(s.closest(".action-list-item-toolbar")||s.closest(".action-list-submenu-indicator")||s.closest(".action-list-item-inline-toggle"))){this._list.setSelection([]);return}}if(t.openSubmenuOnClick&&t.submenuActions?.length&&(i||e.browserEvent instanceof Xv)){this._list.setSelection([]),this._showSubmenuForItem(t),i||this._currentSubmenuWidget?.focus();return}if(t.item&&this.focusCondition(t)){const s=e.browserEvent instanceof Yv;this._delegate.onSelect(t.item,s&&this._supportsPreview)}else this._list.setSelection([])}onFocus(){const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);this._delegate.onFocus?.(i.item),this._suppressHover||(this._options?.persistentHover&&(this._cancelSubmenuShow(),this._resetSubmenuPointer(),this._list.reveal(t)),this._showHoverForElement(i,t))}_removeItem(e){const t=this._allMenuItems.indexOf(e);t>=0&&(this._allMenuItems.splice(t,1),this._applyFilter())}_recomputeGroupTitles(e){this._groupTitleByIndex.clear();const t=new Set;for(let i=0;i<e.length;i++){const s=e[i];s.kind==="action"&&s.group?.title&&!t.has(s.group.title)&&(t.add(s.group.title),this._groupTitleByIndex.set(i,s.group.title))}}_measureItemWidths(e){const t=[];for(let i=0;i<e.length;i++){const s=this._getRowElement(i);s&&(s.style.width="auto",t.push({element:s,item:e[i]}))}try{return t.map(({element:i,item:s})=>i.getBoundingClientRect().width+(s.detail?0:this._computeToolbarWidth(s)))}finally{for(const{element:i}of t)i.style.width=""}}_computeToolbarWidth(e){let t=e.toolbarActions?.length??0;return e.onRemove&&t++,t===0?0:t*22+6+10}_getRowElement(e){return e<0?null:this.domNode.ownerDocument.getElementById(this._list.getElementID(e))}_showTabThroughPanelForFocusedItem(){const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);if(!i.hover?.tabThroughPanel)return;const s=this._getRowElement(t);s&&this._showSubmenuForElement(i,s)}_getTabThroughPanelControls(e,t){return e.hover?.tabThroughPanel&&this._currentSubmenuElement!==e&&this._showSubmenuForElement(e,t),{toolbar:this._itemToolbars.get(e),panelControls:[...e.hover?.getTabbableElements?.()??[],...this._submenuHoverActionElements]}}_focusFirstTabThroughPanelControl(e,t){const i=this._getTabThroughPanelControls(e,t);i.toolbar?.length()?i.toolbar.focus(0):(i.panelControls[0]??this._list.getHTMLElement()).focus()}_handleTabThroughPanelKeyDown(e){if(e.isComposing)return;const t=this._list.getFocus();if(t.length===0)return;const i=t[0],s=this._list.element(i);if(!s.hover?.tabThroughPanel&&!this._options?.tabThroughItemActions)return;const o=this._getRowElement(i),r=nr();if(!o||!hi(r))return;const a=this._getTabThroughPanelControls(s,o),l=a.toolbar?.isFocused()??!1,d=this._submenuContainer.contains(r);if((e.key==="ArrowUp"||e.key==="ArrowDown")&&(l||d)){bt.stop(e,!0),this._list.domFocus(),e.key==="ArrowUp"?this.focusPrevious():this.focusNext();return}if(e.key!=="Tab"||e.ctrlKey||e.metaKey||e.altKey)return;let c;if(e.shiftKey){if(d){const h=a.panelControls.indexOf(r);if(h>0)c=a.panelControls[h-1];else if(a.toolbar?.length()){bt.stop(e,!0),a.toolbar.focus(a.toolbar.length()-1);return}else c=this._list.getHTMLElement()}else if(a.toolbar?.isFocused()){const h=a.toolbar.viewItems.findIndex((u,g)=>a.toolbar?.isFocused(g));if(h>0){bt.stop(e,!0),a.toolbar.focus(h-1);return}c=this._options?.filterAsCombobox?this._filterInput:this._list.getHTMLElement()}}else if(r===this._list.getHTMLElement()||r===this._filterInput){if(a.toolbar?.length()){bt.stop(e,!0),a.toolbar.focus(0);return}c=a.panelControls[0]}else if(a.toolbar?.isFocused()){const h=a.toolbar.viewItems.findIndex((u,g)=>a.toolbar?.isFocused(g));if(h+1<a.toolbar.length()){bt.stop(e,!0),a.toolbar.focus(h+1);return}c=a.panelControls[0]}else{const h=a.panelControls.indexOf(r);h>=0&&(c=a.panelControls[h+1]??this._list.getHTMLElement())}c&&(bt.stop(e,!0),c.focus())}_showHoverForElement(e,t){if(this._currentSubmenuElement===e)return;const i=!!e.hover?.content,s=!!e.submenuActions?.length;if(i||s){const o=this._getRowElement(t);o&&this._showSubmenuForElement(e,o);return}this._options?.persistentHover||this._hideSubmenu()}_showSubmenuForItem(e){const t=this._list.indexOf(e);if(t>=0){const i=this._getRowElement(t);i&&this._showSubmenuForElement(e,i)}}_showSubmenuForElement(e,t){if(!this._hoverEnabled||this._currentSubmenuElement===e)return;this._currentSubmenuElement=e,this._clearSubmenuContainer(),t.setAttribute("aria-expanded","true"),this._expandedTrigger=t,this._submenuPanelClassName=e.hover?.panelClassName,this._submenuPanelClassName&&this._submenuContainer.classList.add(this._submenuPanelClassName);const i=e.hover?.preserveVerticalPosition,s=!!e.submenuActions?.length,o=i?H(".action-list-submenu-content"):this._submenuContainer,r=i?H(".action-list-submenu-viewport",void 0,o):void 0,a=r&&!s?this._submenuDisposables.add(new um(r,{horizontal:2,vertical:1,consumeMouseWheelIfScrollbarIsNeeded:!0,useShadows:!1})):void 0;a&&r?(this._submenuContainer.appendChild(a.getDomNode()),this._submenuDisposables.add(Q(r,we.SCROLL,()=>a.scanDomNode())),this._submenuDisposables.add(Q(this._submenuContainer,we.KEY_DOWN,v=>{const C=new Oa(v);(C.equals(12)||C.equals(11))&&(bt.stop(v,!0),a.setScrollPosition({scrollTop:a.getScrollPosition().scrollTop+(C.equals(12)?1:-1)*r.clientHeight}))}))):r&&this._submenuContainer.appendChild(r);let l;const d=typeof e.hover?.content=="function"?e.hover.content():e.hover?.content;if(d){if(hi(d))l=d,e.hover?.disposable&&this._register(e.hover.disposable);else{const v=typeof d=="string"?new St(d):d,C=this._options?.linkHandler,w=eh(v,{actionHandler:y=>{const D=ke.parse(y);C?C(D,e):this._openerService.open(D,{allowCommands:!0})}});this._submenuDisposables.add(w),l=w.element}l.classList.add("action-list-submenu-hover-header"),l.classList.toggle("content-owns-padding",e.hover?.contentOwnsPadding===!0),e.submenuActions?.length&&l.classList.add("has-submenu"),o.appendChild(l)}if(e.hover?.actions?.length){const v=H(".hover-row.status-bar"),C=U(v,H(".actions"));for(const w of e.hover.actions){const y=this._keybindingService.lookupKeybinding(w.commandId),D=this._submenuDisposables.add(Ww.render(C,{label:w.label,commandId:w.commandId,run:b=>w.run(b),iconClass:w.iconClass},y?.getLabel()??null));this._submenuHoverActionElements.push(D.actionContainer)}this._submenuContainer.appendChild(v)}this._submenuContainer.style.display="",this._submenuContainer.style.position="absolute",e.hover?.expandable?(this._submenuContainer.setAttribute("role","dialog"),e.label&&this._submenuContainer.setAttribute("aria-label",e.label)):this._submenuContainer.removeAttribute("role");const c=Nt(this.domNode);let h=0,u=l?l.offsetWidth:0,g;if(s){const v=this._createSubmenuItems(e.submenuActions),C=this._submenuDisposables.add(this._instantiationService.createInstance(mg,"submenu",!1,v,{onHide:()=>{},onSelect:y=>{y.run();const D=this._currentSubmenuElement?.item;this._hideSubmenu(),D&&this._delegate.onSelect(D),this.hide()}},void 0,e.submenuOptions));g=C,C.headerContainer&&o.appendChild(C.headerContainer),C.filterContainer&&o.appendChild(C.filterContainer),o.appendChild(C.domNode),C.footerContainer&&o.appendChild(C.footerContainer),this._currentSubmenuWidget=C,C.clearFocus(),h=C.computeListHeight(),C.layout(h);const w=C.computeMaxWidth(0);u=Math.max(u,w,C.footerContainer?.offsetWidth??0),C.layout(h,u),C.domNode.style.width=`${u}px`,e.submenuOptions&&(this._submenuContainer.style.boxSizing="border-box",this._submenuContainer.style.width=`${u+10}px`),this._submenuDisposables.add(C.onDidRequestLayout(()=>{h=C.computeListHeight(),C.layout(h,u),this._layoutSubmenu?.()})),this._submenuDisposables.add(Q(o,"keydown",y=>{y.key==="Escape"?(bt.stop(y,!0),this._hideSubmenu(),this.hide()):y.key==="ArrowLeft"?(bt.stop(y,!0),this._hideSubmenu(),this._setKeyboardNavigation(!0),this._list.domFocus()):y.key==="Enter"||y.key===" "?(bt.stop(y,!0),C.acceptSelected()):y.key==="ArrowDown"?(bt.stop(y,!0),C.focusNext()):y.key==="ArrowUp"&&(bt.stop(y,!0),C.focusPrevious())}))}let p,f;const _=()=>{const v=this._currentSubmenuElement;if(!v||this._layoutSubmenu!==_)return;const C=this._list.indexOf(v),w=C>=0?this._getRowElement(C):null,y=this._options?.persistentHover;if(!w&&(!y||!this._allMenuItems.includes(v))){this._hideSubmenu();return}this._expandedTrigger!==w&&(this._expandedTrigger?.hasAttribute("aria-expanded")&&this._expandedTrigger.setAttribute("aria-expanded","false"),this._expandedTrigger=w??void 0),w?.setAttribute("aria-expanded","true");const D=this.domNode.getBoundingClientRect(),b=y||v.hover?.alignToParent,I=b?this.domNode.parentElement?.closest(".action-widget")?.getBoundingClientRect()??D:D,N=w?.getBoundingClientRect()??I,T=b||i?KR(this.domNode):1;y&&(this._submenuContainer.style.width=`${I.width/T}px`);const E=this._submenuContainer.getBoundingClientRect();let F=b?E.width:u+10;const q=c.innerWidth-(b?I.right:N.right),re=I.left,be=b?0:4,pe=4;if(!b){const Re=c.innerWidth-8;F>Re&&(F=Math.max(Re,0)),this._submenuContainer.style.boxSizing="border-box",this._submenuContainer.style.width=`${F}px`}let Y=q>=F||q>=re;y&&this._submenuSide&&(this._submenuSide==="right"?q:re)>=F&&(Y=this._submenuSide==="right"),y&&(this._submenuSide=Y?"right":"left");let ue=Y?I.right-D.left+be:I.left-D.left-F-be;const xe=D.left+ue;xe<pe?ue+=pe-xe:xe+F>c.innerWidth-pe&&(ue-=xe+F-(c.innerWidth-pe)),this._submenuContainer.style.left=`${ue/T}px`;const Oe=E.height;i&&(p??=Oe/T);const _e=p!==void 0?p*T:Oe;let Ue=f!==void 0?f*T:w&&v.hover?.alignToAnchorTop?N.top-D.top:w?N.top-D.top+(N.height-_e)/2:E.top-D.top;if(i&&v.hover?.alignToAnchorTop&&r&&g){const Re=E.height-r.getBoundingClientRect().height+((g.headerContainer?.offsetHeight??0)+(g.filterContainer?.offsetHeight??0)+(g.footerContainer?.offsetHeight??0)+h)*T;Ue=Math.min(Ue,c.innerHeight-D.top-Re-8)}const rt=D.top+Ue+_e;if(rt>c.innerHeight&&!(i&&v.hover?.alignToAnchorTop)&&(Ue-=rt-c.innerHeight+8),D.top+Ue<0&&(Ue=-D.top),i&&(f??=Ue/T),r&&a){const Re=(E.height-a.getDomNode().getBoundingClientRect().height)/T,Et=Math.max(0,(c.innerHeight-D.top-Ue-8)/T-Re);r.style.height=`${Math.min(o.getBoundingClientRect().height/T,Et)}px`,a.scanDomNode()}else if(r&&g){const Re=(E.height-r.getBoundingClientRect().height)/T,Et=Math.max(0,(c.innerHeight-D.top-Ue-8)/T-Re),qn=(g.headerContainer?.offsetHeight??0)+(g.filterContainer?.offsetHeight??0)+(g.footerContainer?.offsetHeight??0),qt=h===0?0:Math.max(this._actionLineHeight,Math.min(h,Et-qn));g.layout(qt,u),r.style.height=`${qn+qt}px`}this._submenuContainer.style.top=`${Ue/T}px`};if(this._layoutSubmenu=_,_(),(this._options?.persistentHover||e.hover?.alignToParent||e.hover?.tabThroughPanel||i)&&this._currentSubmenuElement===e){if(!g){const v=this._submenuDisposables.add(new We),C=this._submenuDisposables.add(new DR("ActionListWidget.hoverPanel",()=>{v.value||(v.value=GE(c,()=>{v.clear(),_()}))},c));this._submenuDisposables.add(C.observe(i?o:this._submenuContainer,{box:"border-box"}))}(this._options?.persistentHover||i)&&this._submenuDisposables.add(Q(c,we.RESIZE,()=>{this._cancelSubmenuShow(),this._resetSubmenuPointer(),_()}))}}_createSubmenuItems(e){const t=[],i=e.filter(s=>s instanceof Jo).filter(s=>s.actions.length>0);for(let s=0;s<i.length;s++){const o=i[s];o.label&&t.push({kind:"header",group:{title:o.label},label:o.label});for(const r of o.actions){const a=r,l=a.icon??ce.fromId(r.checked?V.check.id:V.blank.id),d=a.hoverContent,c=d?new St().appendText(`${r.label}
|
|
4
|
+
`).appendMarkdown(d):void 0;t.push({item:r,kind:"action",label:r.label,description:r.tooltip&&r.tooltip!==r.label?r.tooltip:void 0,group:{title:"",icon:l},hideIcon:!1,hover:c?{content:c}:void 0,tooltip:r.tooltip||r.label,onRemove:a.onRemove,submenuActions:r instanceof Jo?[new Jo(r.id,"",r.actions)]:void 0})}s<i.length-1&&t.push({kind:"separator",label:""})}for(const s of e)if(!(s instanceof Jo)){const o=s,r=o.icon??ce.fromId(s.checked?V.check.id:V.blank.id),a=o.hoverContent,l=a?new St().appendText(`${s.label}
|
|
5
|
+
`).appendMarkdown(a):void 0;t.push({item:s,kind:"action",label:s.label,description:s.tooltip&&s.tooltip!==s.label?s.tooltip:void 0,group:{title:"",icon:r},hideIcon:!1,hover:l?{content:l}:void 0,tooltip:s.tooltip||s.label,onRemove:o.onRemove})}return t}_hideSubmenu(){this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._currentSubmenuElement=void 0,this._submenuSide=void 0,this._clearSubmenuContainer(),this._submenuContainer.style.display="none"}_clearSubmenuContainer(){this._layoutSubmenu=void 0,this._resetSubmenuPointer(),this._submenuContainer.contains(nr())&&this._list.domFocus(),this._submenuDisposables.clear(),this._currentSubmenuWidget=void 0,this._submenuHoverActionElements=[],this._submenuPanelClassName&&(this._submenuContainer.classList.remove(this._submenuPanelClassName),this._submenuPanelClassName=void 0),this._submenuContainer.removeAttribute("role"),this._submenuContainer.removeAttribute("aria-label"),this._expandedTrigger?.hasAttribute("aria-expanded")&&this._expandedTrigger.setAttribute("aria-expanded","false"),this._expandedTrigger=void 0,ni(this._submenuContainer),this._submenuContainer.style.width="",this._submenuContainer.style.boxSizing=this._options?.persistentHover?"border-box":""}_scheduleSubmenuHide(){this._cancelSubmenuHide(),!this._options?.persistentHover&&(this._submenuHideTimeout=setTimeout(()=>{this._hideSubmenu()},300))}_cancelSubmenuHide(){this._submenuHideTimeout!==void 0&&(clearTimeout(this._submenuHideTimeout),this._submenuHideTimeout=void 0)}_scheduleSubmenuShow(e,t){this._cancelSubmenuShow();let i=this._options?.submenuHoverDelay??500;if(this._usesSubmenuPointerIntent()){i=0;const o=this._submenuPointerOrigin;if(o&&t.clientX!==o.x&&this._currentSubmenuElement&&new NR(o.x,o.y,this._submenuContainer).contains(t.clientX,t.clientY)){const r=Date.now();this._submenuPointerGraceDeadline??=r+200,i=Math.max(0,this._submenuPointerGraceDeadline-r)}}const s=()=>{this._submenuShowTimeout=void 0;const o=this._list.indexOf(e),r=o>=0?this._getRowElement(o):null;r&&(this._showSubmenuForElement(e,r),this._usesSubmenuPointerIntent()&&this._updateSubmenuPointer(t))};i===0?s():this._submenuShowTimeout=setTimeout(s,i)}_updateSubmenuPointer(e){this._submenuPointerOrigin={x:e.clientX,y:e.clientY},this._submenuPointerGraceDeadline=void 0}_resetSubmenuPointer(){this._submenuPointerOrigin=void 0,this._submenuPointerGraceDeadline=void 0}_usesSubmenuPointerIntent(){return this._options?.persistentHover===!0||this._options?.submenuPointerIntent===!0}_cancelSubmenuShow(){this._submenuShowTimeout!==void 0&&(clearTimeout(this._submenuShowTimeout),this._submenuShowTimeout=void 0)}async onListHover(e){this._setKeyboardNavigation(!1);const t=e.element;if(t&&t.item&&this.focusCondition(t)){const i=typeof e.index=="number"?[e.index]:[],s=nr();if(this._options?.tabThroughItemActions&&this._list.getFocus()[0]!==e.index&&hi(s)&&this.domNode.contains(s)&&s.closest(".action-list-item-toolbar")&&this._list.domFocus(),hi(e.browserEvent.target)&&e.browserEvent.target.closest(".action-list-item-toolbar")!==null){t.submenuActions?.length||this._cancelSubmenuShow(),this._list.setFocus(this._options?.tabThroughItemActions?i:[]);return}const o=!!(t.submenuActions?.length||t.hover?.content),r=this._suppressHover;(o||this._usesSubmenuPointerIntent())&&(this._suppressHover=!0);try{this._list.setFocus(i)}finally{this._suppressHover=r}if(o){this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._usesSubmenuPointerIntent()&&this._updateSubmenuPointer(e.browserEvent)):(this._usesSubmenuPointerIntent()||this._hideSubmenu(),this._scheduleSubmenuShow(t,e.browserEvent));return}if(this._currentSubmenuElement===t?this._cancelSubmenuHide():(this._cancelSubmenuShow(),this._options?.submenuPointerIntent?this._scheduleSubmenuHide():this._options?.persistentHover||this._hideSubmenu()),this._delegate.onHover&&!t.disabled&&t.kind==="action"&&this._currentSubmenuElement!==t){const a=await this._delegate.onHover(t.item,this.cts.token),l=a?a.canPreview:void 0;l!==t.canPreview&&(t.canPreview=l,typeof e.index=="number"&&(this._list.splice(e.index,1,[t]),this._list.setFocus([e.index])))}}else t&&t.hover?.content&&typeof e.index=="number"&&(this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow()):(this._options?.persistentHover||this._hideSubmenu(),this._scheduleSubmenuShow(t,e.browserEvent)))}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};vg=mg=Qm([fs(6,He),fs(7,Co),fs(8,ne)],vg);var bg=class extends M{get domNode(){return this._widget.domNode}get filterContainer(){return this._widget.filterContainer}get footerContainer(){return this._widget.footerContainer}get headerContainer(){return this._widget.headerContainer}get filterInput(){return this._widget.filterInput}get closeAnimation(){return this._widget.closeAnimation}get widgetClassName(){return this._widgetClassName}get anchorPosition(){if(this._preferredAnchorPosition!==void 0)return this._preferredAnchorPosition;if(this._showAbove!==void 0)return this._showAbove?1:0}constructor(e,t,i,s,o,r,a,l,d,c){super(),this._contextViewService=l,this._layoutService=d,this._lastMinWidth=0,this._hasLaidOut=!1,this._anchor=a,this._preferredAnchorPosition=r?.anchorPosition,this._useFullHeight=r?.useFullHeight??!1,this._widgetClassName=r?.widgetClassName,this._widget=this._register(c.createInstance(vg,e,t,i,s,o,r)),this._register(this._widget.onDidRequestLayout(()=>{this._hasLaidOut&&(this.layout(this._lastMinWidth),this._contextViewService.layout())}))}focus(){this._widget.focus()}hide(e,t=!0){this._widget.hide(e),t&&this._contextViewService.hideContextView()}clearFilter(){return this._widget.clearFilter()}focusPrevious(){this._widget.focusPrevious()}focusNext(){this._widget.focusNext()}collapseFocusedSection(){this._widget.collapseFocusedSection()}expandFocusedSection(){this._widget.expandFocusedSection()}toggleFocusedSection(){return this._widget.toggleFocusedSection()}acceptSelected(e){this._widget.acceptSelected(e)}hasDynamicHeight(){return this._widget.hasDynamicHeight}computeActionWidgetVerticalChromeHeight(){const e=this.domNode.parentElement?.closest(".action-widget");if(!e)return 0;const t=Nt(e).getComputedStyle(e),i=s=>Number.parseFloat(s)||0;return i(t.paddingTop)+i(t.paddingBottom)+i(t.borderTopWidth)+i(t.borderBottomWidth)}computeHeight(){const e=this._fixedContentHeight??this._widget.computeListHeight(),t=this._widget.filterContainer?36:0,i=this._widget.footerContainer?32:0,s=this._widget.headerContainer&&!this._widget.headerContainer.hidden?this._widget.headerContainer.offsetHeight||36:0,o=t+i+s,r=Nt(this.domNode);let a;if(this.hasDynamicHeight()||this._preferredAnchorPosition!==void 0){const h=r.innerHeight,u=eT(this._anchor),g=u.top-r.pageYOffset,p=h-g-u.height-30,f=g;if(this._showAbove===void 0){const _=this._fixedContentHeight??this._widget.computeFullHeight();this._showAbove=this._preferredAnchorPosition!==void 0?this._preferredAnchorPosition===1:o+_>p&&f>p}a=Math.max(0,(this._showAbove?f:p)-this.computeActionWidgetVerticalChromeHeight())}else{const u=this._layoutService.getContainer(r).clientHeight,g=this.domNode.getBoundingClientRect().top;a=g>0?u-g-10:u*.7}const l=this._useFullHeight?r.innerHeight:Math.floor(r.innerHeight*.6),d=this._widget.lineHeight;if(this._preferredAnchorPosition!==void 0){const h=Math.min(a,l),u=Math.min(e+o,Math.max(0,h));return Math.max(0,u-o)}const c=Math.min(Math.max(a,d*3+o),l);return Math.min(e+o,c)-o}layout(e,t){this._hasLaidOut=!0,this._lastMinWidth=e,t!==void 0&&(this._fixedContentHeight=t);const i=this.computeHeight();this._widget.layout(i);const s=this._widget.computeMaxWidth(e);return this._cachedMaxWidth=s,this._widget.layout(i,this._cachedMaxWidth),this._cachedMaxWidth}};bg=Qm([fs(7,dh),fs(8,cE),fs(9,ne)],bg);function wi(n){return n.replace(/\r\n|\r|\n/g," ")}var JP=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Yh=function(n,e){return function(t,i){e(t,i,n)}};W("actionBar.toggledBackground",Im,m(1744,"Background color for toggled action items in action bar."));var Jv="--action-widget-close-start-opacity",Qv="--action-widget-close-start-transform",Vt={Visible:new ae("codeActionMenuVisible",!1,m(1745,"Whether the action widget list is visible")),FilterFocused:new ae("codeActionMenuFilterFocused",!1,m(1746,"Whether the action widget filter input is focused"))},Mi=fn("actionWidgetService"),Ki=class extends M{get isVisible(){return Vt.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new We),this._closeAnimation=this._register(new We)}show(e,t,i,s,o,r,a,l,d){const c=Vt.Visible.bindTo(this._contextKeyService),h=this._instantiationService.createInstance(bg,e,t,i,s,l,d,o);this._contextViewService.showContextView({getAnchor:()=>o,render:u=>(c.set(!0),this._renderWidget(u,h,a??[],d)),onHide:u=>{c.reset(),this._onWidgetClosed(u)},get anchorPosition(){return h.anchorPosition},focus:()=>h.focus()},r,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}collapseSection(){this._list?.value?.collapseFocusedSection()}expandSection(){this._list?.value?.expandFocusedSection()}toggleSection(){return this._list?.value?.toggleFocusedSection()??!1}clearFilter(){return this._list?.value?.clearFilter()??!1}hide(e){const t=this._list.value,i=this._widgetElement;if(!t||this._closingList===t)return;const s=t.closeAnimation;if(!i||!s||s.duration<=0||!this._hasRequiredAncestorClasses(i,s.requiredAncestorClasses)){this._closingList=t,t.hide(e);return}this._closingList=t;const o=Nt(i).getComputedStyle(i);i.style.setProperty(Jv,o.opacity),i.style.setProperty(Qv,o.transform),i.classList.add(s.className),t.hide(e,!1),this._closeAnimation.value=ji(()=>{this._list.value===t&&this._contextViewService.hideContextView(e)},s.duration)}clear(){this._closeAnimation.clear(),this._closingList=void 0,this._widgetElement?.style.removeProperty(Jv),this._widgetElement?.style.removeProperty(Qv),this._widgetElement=void 0,this._list.clear()}_renderWidget(e,t,i,s){const o=document.createElement("div");o.classList.add("action-widget");const r=t.widgetClassName?.split(/\s+/).filter(Boolean);if(r?.length&&o.classList.add(...r),e.appendChild(o),this._widgetElement=o,this._list.value=t,this._list.value)this._list.value.headerContainer&&o.appendChild(this._list.value.headerContainer),this._list.value.filterContainer&&o.appendChild(this._list.value.filterContainer),o.appendChild(this._list.value.domNode),this._list.value.footerContainer&&o.appendChild(this._list.value.footerContainer);else throw new Error("List has no value");const a=new O;s?.filterAsCombobox&&a.add(hn(o,"keydown",v=>{v.keyCode===9&&!v.browserEvent.isComposing&&(bt.stop(v,!0),this.hide(!0))}));const l=this._list.value.headerContainer;l&&a.add(La(l,v=>v.preventDefault()));let d=0;a.add(La(o,()=>{d=Date.now()+1e3}));const c=document.createElement("div"),h=e.appendChild(c);h.classList.add("context-view-block"),a.add(La(h,v=>v.stopPropagation()));let u=0;if(i.length){const v=this._createActionBar(".action-widget-action-bar",i);v&&(o.appendChild(v.getContainer().parentElement),a.add(v),u=v.getContainer().offsetWidth)}const g=this._list.value?.layout(u);o.style.width=`${g}px`;const p=Vt.FilterFocused.bindTo(this._contextKeyService);if(a.add({dispose:()=>p.reset()}),this._list.value?.filterInput){const v=this._list.value.filterInput;a.add(Q(v,"focus",()=>p.set(!0))),a.add(Q(v,"blur",()=>p.set(!1)))}const f=a.add(us(e)),_=a.add(new We);return a.add(f.onDidFocus(()=>_.clear())),a.add(f.onDidBlur(()=>{const v=()=>{const C=d-Date.now();if(C>0){_.value=ji(v,C);return}const w=nr();w&&(e.contains(w)||w.closest(".action-widget-hover")||w.closest(".action-list-submenu-panel"))||this.hide(!0)};_.value=ji(v,75)})),a}_createActionBar(e,t){if(!t.length)return;const i=H(e),s=new _s(i);return s.push(t,{icon:!1,label:!0}),s}_hasRequiredAncestorClasses(e,t){if(!t?.length)return!0;for(let i=e;i;i=i.parentElement)if(t.every(s=>i.classList.contains(s)))return!0;return!1}_onWidgetClosed(e){if(this._closingList===this._list.value){this.clear();return}this._closeAnimation.clear(),this._closingList=void 0,this._widgetElement=void 0,this._list.value?.hide(e)}};Ki=JP([Yh(0,dh),Yh(1,Ce),Yh(2,ne)],Ki);zn(Mi,Ki,1);var Ns=1100;me(class extends lt{constructor(){super({id:"hideCodeActionWidget",title:L(1747,"Hide action widget"),precondition:Vt.Visible,keybinding:{weight:Ns,primary:9,secondary:[1033]}})}run(n){n.get(Mi).hide(!0)}});me(class extends lt{constructor(){super({id:"clearFilterCodeActionWidget",title:L(1748,"Clear action widget filter"),precondition:k.and(Vt.Visible,Vt.FilterFocused),keybinding:{weight:1101,primary:9}})}run(n){const e=n.get(Mi);e instanceof Ki&&(e.clearFilter()||e.hide(!0))}});me(class extends lt{constructor(){super({id:"selectPrevCodeAction",title:L(1749,"Select previous action"),precondition:Vt.Visible,keybinding:{weight:Ns,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.focusPrevious()}});me(class extends lt{constructor(){super({id:"selectNextCodeAction",title:L(1750,"Select next action"),precondition:Vt.Visible,keybinding:{weight:Ns,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.focusNext()}});me(class extends lt{constructor(){super({id:"collapseSectionCodeAction",title:L(1751,"Collapse section"),precondition:k.and(Vt.Visible,Vt.FilterFocused.negate()),keybinding:{weight:Ns,primary:15}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.collapseSection()}});me(class extends lt{constructor(){super({id:"expandSectionCodeAction",title:L(1752,"Expand section"),precondition:k.and(Vt.Visible,Vt.FilterFocused.negate()),keybinding:{weight:Ns,primary:17}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.expandSection()}});me(class extends lt{constructor(){super({id:"toggleSectionCodeAction",title:L(1753,"Toggle section"),precondition:k.and(Vt.Visible,Vt.FilterFocused.negate()),keybinding:{weight:Ns,primary:10}})}run(n){const e=n.get(Mi);e instanceof Ki&&(e.toggleSection()||e.acceptSelected())}});me(class extends lt{constructor(){super({id:e_,title:L(1754,"Accept selected action"),precondition:Vt.Visible,keybinding:{weight:Ns,primary:3,secondary:[2137]}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.acceptSelected()}});me(class extends lt{constructor(){super({id:t_,title:L(1755,"Preview selected action"),precondition:Vt.Visible,keybinding:{weight:Ns,primary:2051}})}run(n){const e=n.get(Mi);e instanceof Ki&&e.acceptSelected(!0)}});var Cy=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},rr=function(n,e){return function(t,i){e(t,i,n)}},Cg,Sg=class extends M{static{Cg=this}static{this.baseId="editor.widget.postEditWidget"}constructor(e,t,i,s,o,r,a,l,d,c,h){super(),this.typeId=e,this.editor=t,this.showCommand=s,this.range=o,this.edits=r,this.onSelectNewEdit=a,this.additionalActions=l,this._keybindingService=c,this._actionWidgetService=h,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(d),this.visibleContext.set(!0),this._register(Te(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(Te((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(u=>{this.dispose()})),this._register(Ge.runAndSubscribe(c.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=H(".post-edit-widget"),this.button=this._register(new KE(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(Q(this.domNode,we.CLICK,()=>this.showSelector()))}getId(){return Cg.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){const e=Mt(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((i,s)=>({kind:"action",item:i,label:i.title,disabled:!1,canPreview:!1,group:{title:"",icon:ce.fromId(s===this.edits.activeEditIndex?V.check.id:V.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:i=>{this._actionWidgetService.hide(!1);const s=this.edits.allEdits.findIndex(o=>o===i);if(s!==this.edits.activeEditIndex)return this.onSelectNewEdit(s)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}};Sg=Cg=Cy([rr(8,Ce),rr(9,He),rr(10,Mi)],Sg);var uc=class extends M{constructor(e,t,i,s,o,r,a,l){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=s,this._getAdditionalActions=o,this._instantiationService=r,this._bulkEditService=a,this._notificationService=l,this._currentWidget=this._register(new We),this._register(Ge.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,s,o){if(!e.length||!this._editor.hasModel())return;const r=this._editor.getModel(),a=t.allEdits.at(t.activeEditIndex);if(!a)return;const l=async v=>{const C=this._editor.getModel();C&&(await C.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:v,allEdits:t.allEdits},i,s,o))},d=(v,C)=>{Un(v)||(this._notificationService.error(C),i&&this.show(e[0],t,l))},c=new lo(this._editor,3,void 0,o);let h;try{h=await YE(s(a,c.token),c.token)}catch(v){return d(v,m(991,`Error resolving edit '{0}':
|
|
6
|
+
{1}`,a.title,cc(v)))}finally{c.dispose()}if(o.isCancellationRequested)return;const u=my(r.uri,e,h),g=e[0],p=r.deltaDecorations([],[{range:g,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let f,_;try{f=await this._bulkEditService.apply(u,{editor:this._editor,token:o}),_=r.getDecorationRange(p[0])}catch(v){return d(v,m(992,`Error applying edit '{0}':
|
|
7
|
+
{1}`,a.title,cc(v)))}finally{r.deltaDecorations(p,[])}o.isCancellationRequested||i&&f.isApplied&&t.allEdits.length>1&&this.show(_??g,t,l)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Sg,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};uc=Cy([rr(5,ne),rr(6,wl),rr(7,Rt)],uc);var QP=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},_n=function(n,e){return function(t,i){e(t,i,n)}},vi,Sy="editor.changePasteType",e1="editor.pasteAs.preferences",i_=new ae("pasteWidgetVisible",!1,m(971,"Whether the paste widget is showing")),Jh="application/vnd.code.copymetadata",Hn=class extends M{static{vi=this}static{this.ID="editor.contrib.copyPasteActionController"}static get(e){return e.getContribution(vi.ID)}constructor(e,t,i,s,o,r,a,l,d,c){super(),this._logService=i,this._bulkEditService=s,this._clipboardService=o,this._commandService=r,this._configService=a,this._languageFeaturesService=l,this._quickInputService=d,this._progressService=c,this._editor=e,this._register(e.onWillCopy(h=>this.handleCopy(h))),this._register(e.onWillCut(h=>this.handleCopy(h))),this._register(e.onWillPaste(h=>this.handlePaste(h))),this._pasteProgressManager=this._register(new lc("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(uc,"pasteIntoEditor",e,i_,{id:Sy,label:m(972,"Show paste options...")},()=>vi._configureDefaultAction?[vi._configureDefaultAction]:[]))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(e){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:e},await this._commandService.executeCommand("editor.action.clipboardPasteAction")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(97).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){if(this._logService.trace("CopyPasteController#handleCopy"),!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!this.isPasteAsEnabled()))return;const t=this._editor.getModel(),i=this._editor._getViewModel(),s=this._editor.getSelections();if(!t||!i||!s?.length)return;const o={multicursorText:e.dataToCopy.multicursorText??null,pasteOnNewLine:e.dataToCopy.isFromEmptySelection,mode:null},r=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(h=>!!h.prepareDocumentPaste);if(!r.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:o});return}const a=new pw,l=r.flatMap(h=>h.copyMimeTypes??[]),d=jm();this.setCopyMetadata(e.clipboardData,{id:d,providerCopyMimeTypes:l,defaultPastePayload:o});const c=r.map(h=>({providerMimeTypes:h.copyMimeTypes,operation:mt(u=>h.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,a,u).catch(g=>{console.error(g)}))}));vi._currentCopyOperation?.operations.forEach(h=>h.operation.cancel()),vi._currentCopyOperation={handle:d,operations:c}}async handlePaste(e){if(this._logService.trace("CopyPasteController#handlePaste for id : ",e.metadata?.id),!this._editor.hasTextFocus())return;const t=e.toExternalVSDataTransfer();if(!t)return;t.delete(Jh),Zt.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;const i=this._editor.getModel(),s=this._editor.getSelections();if(!s?.length||!i||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const o=this.fetchCopyMetadata(e);this._logService.trace("CopyPasteController#handlePaste with metadata : ",o?.id," and text.length : ",e.clipboardData.getData("text/plain").length);const r=Array.from(e.clipboardData.files).map(d=>d.type),a=[...e.clipboardData.types,...r,...o?.providerCopyMimeTypes??[],kt.uriList],l=this._languageFeaturesService.documentPasteEditProvider.ordered(i).filter(d=>{const c=this._pasteAsActionContext?.preferred;return c&&!this.providerMatchesPreference(d,c)?!1:d.pasteMimeTypes?.some(h=>Sv(h,a))});if(!l.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(s,this._pasteAsActionContext.preferred),e.setHandled());return}e.setHandled(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,l,s,t,o):this.doPasteInline(l,s,t,o,e.browserEvent)}showPasteAsNoEditMessage(e,t){const i="only"in t?t.only.value:"preferences"in t?t.preferences.length?t.preferences.map(s=>s.value).join(", "):m(973,"empty"):t.providerId;Zt.get(this._editor)?.showMessage(m(974,"No paste edits for '{0}' found",i),e[0].getStartPosition())}doPasteInline(e,t,i,s,o){this._logService.trace("CopyPasteController#doPasteInline");const r=this._editor;if(!r.hasModel())return;const a=new lo(r,3,void 0),l=mt(async d=>{const c=this._editor;if(!c.hasModel())return;const h=c.getModel(),u=new O,g=u.add(new ot(d));u.add(a.token.onCancellationRequested(()=>g.cancel()));const p=g.token;try{if(await this.mergeInDataFromCopy(e,i,s,p),p.isCancellationRequested)return;const f=e.filter(C=>this.isSupportedPasteProvider(C,i));if(!f.length||f.length===1&&f[0]instanceof Ka)return this.applyDefaultPasteHandler(i,s,p,o);const _={triggerKind:Yu.Automatic},v=await this.getPasteEdits(f,i,h,t,_,p);if(u.add(v),p.isCancellationRequested)return;if(v.edits.length===1&&v.edits[0].provider instanceof Ka)return this.applyDefaultPasteHandler(i,s,p,o);if(v.edits.length){const C=c.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(h,v.edits),allEdits:v.edits},C,async(w,y)=>{if(!w.provider.resolveDocumentPasteEdit)return w;const D=w.provider.resolveDocumentPasteEdit(w,y),b=new cm,I=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),m(975,"Resolving paste edit for '{0}'. Click to cancel",w.title),gr(Promise.race([b.p,D]),y),{cancel:()=>b.cancel()},0);return I&&(w.insertText=I.insertText,w.additionalEdit=I.additionalEdit),w},p)}await this.applyDefaultPasteHandler(i,s,p,o)}finally{u.dispose(),this._currentPasteOperation===l&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),m(976,"Running paste handlers. Click to cancel and do basic paste"),l,{cancel:async()=>{l.cancel(),!a.token.isCancellationRequested&&await this.applyDefaultPasteHandler(i,s,a.token,o)}}).finally(()=>{a.dispose()}),this._currentPasteOperation=l}showPasteAsPick(e,t,i,s,o){this._logService.trace("CopyPasteController#showPasteAsPick");const r=mt(async a=>{const l=this._editor;if(!l.hasModel())return;const d=l.getModel(),c=new O,h=c.add(new lo(l,3,void 0,a));try{if(await this.mergeInDataFromCopy(t,s,o,h.token),h.token.isCancellationRequested)return;let u=t.filter(v=>this.isSupportedPasteProvider(v,s,e));e&&(u=u.filter(v=>this.providerMatchesPreference(v,e)));const g={triggerKind:Yu.PasteAs,only:e&&"only"in e?e.only:void 0};let p=c.add(await this.getPasteEdits(u,s,d,i,g,h.token));if(h.token.isCancellationRequested)return;if(e&&(p={edits:p.edits.filter(v=>"only"in e?e.only.contains(v.kind):"preferences"in e?e.preferences.some(C=>C.contains(v.kind)):e.providerId===v.provider.id),dispose:p.dispose}),!p.edits.length){e&&this.showPasteAsNoEditMessage(i,e);return}let f;if(e)f=p.edits.at(0);else{const v={id:"editor.pasteAs.default",label:m(977,"Configure default paste action"),edit:void 0},C=await this._quickInputService.pick([...p.edits.map(w=>({label:w.title,description:w.kind?.value,edit:w})),...vi._configureDefaultAction?[ZE({type:"separator"}),{label:vi._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:m(978,"Select Paste Action")});if(C===v){vi._configureDefaultAction?.run();return}f=C?.edit}if(!f)return;const _=my(d.uri,i,f);await this._bulkEditService.apply(_,{editor:this._editor})}finally{c.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:m(979,"Running paste handlers")},()=>r)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(Jh,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace("CopyPasteController#fetchCopyMetadata");const t=e.clipboardData.getData(Jh);if(t)try{return JSON.parse(t)}catch{return}if(e.metadata)return{defaultPastePayload:{mode:e.metadata.mode,multicursorText:e.metadata.multicursorText??null,pasteOnNewLine:!!e.metadata.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i,s){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",i?.id),i?.id&&vi._currentCopyOperation?.handle===i.id){const o=vi._currentCopyOperation.operations.filter(a=>e.some(l=>l.pasteMimeTypes.some(d=>Sv(d,a.providerMimeTypes)))).map(a=>a.operation),r=await Promise.all(o);if(s.isCancellationRequested)return;for(const a of r.reverse())if(a)for(const[l,d]of a)t.replace(l,d)}if(!t.has(kt.uriList)){const o=await this._clipboardService.readResources();if(s.isCancellationRequested)return;o.length&&t.append(kt.uriList,tP(Zw.create(o)))}}async getPasteEdits(e,t,i,s,o,r){const a=new O,l=await gr(Promise.all(e.map(async c=>{try{const h=await c.provideDocumentPasteEdits?.(i,s,t,o,r);return h&&a.add(h),h?.edits?.map(u=>({...u,provider:c}))}catch(h){Un(h)||console.error(h);return}})),r),d=Ps(l??[]).flat().filter(c=>!o.only||o.only.contains(c.kind));return{edits:_y(d),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,s){const o=await(e.get(kt.text)??e.get("text"))?.asString()??"";if(i.isCancellationRequested)return;const r={clipboardEvent:s,text:o,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",t?.id),this._editor.trigger("keyboard","paste",r)}isSupportedPasteProvider(e,t,i){return e.pasteMimeTypes?.some(s=>t.matches(s))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return"only"in t?e.providedPasteEditKinds.some(i=>t.only.contains(i)):"preferences"in t?e.providedPasteEditKinds.some(i=>t.preferences.some(s=>s.contains(i))):e.id===t.providerId}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(e1,{resource:e.uri});for(const s of Array.isArray(i)?i:[]){const o=new ze(s),r=t.findIndex(a=>o.contains(a.kind));if(r>=0)return r}return 0}};Hn=vi=QP([_n(1,ne),_n(2,Ot),_n(3,wl),_n(4,oi),_n(5,ht),_n(6,Ee),_n(7,X),_n(8,Ri),_n(9,$T)],Hn);var uo="9_cutcopypaste",t1=Rr||document.queryCommandSupported&&document.queryCommandSupported("cut"),wy=Rr||document.queryCommandSupported&&document.queryCommandSupported("copy"),i1=typeof navigator.clipboard>"u"||vw?document.queryCommandSupported&&document.queryCommandSupported("paste"):!0;function n_(n){return n.register(),n}var n1=t1?n_(new Nm({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Rr?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:K.MenubarEditMenu,group:"2_ccp",title:m(864,"Cu&&t"),order:1},{menuId:K.EditorContext,group:uo,title:m(865,"Cut"),when:S.writable,order:1},{menuId:K.CommandPalette,group:"",title:m(866,"Cut"),order:1},{menuId:K.SimpleEditorContext,group:uo,title:m(867,"Cut"),when:S.writable,order:1}]})):void 0,s1=wy?n_(new Nm({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Rr?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:K.MenubarEditMenu,group:"2_ccp",title:m(868,"&&Copy"),order:2},{menuId:K.EditorContext,group:uo,title:m(869,"Copy"),order:2},{menuId:K.CommandPalette,group:"",title:m(870,"Copy"),order:1},{menuId:K.SimpleEditorContext,group:uo,title:m(871,"Copy"),order:2}]})):void 0;qi.appendMenuItem(K.MenubarEditMenu,{submenu:K.MenubarCopy,title:L(876,"Copy As"),group:"2_ccp",order:3});qi.appendMenuItem(K.EditorContext,{submenu:K.EditorContextCopy,title:L(877,"Copy As"),group:uo,order:3});qi.appendMenuItem(K.EditorContext,{submenu:K.EditorContextShare,title:L(878,"Share"),group:"11_share",order:-1,when:k.and(k.notEquals("resourceScheme","output"),S.editorTextFocus)});qi.appendMenuItem(K.ExplorerContext,{submenu:K.ExplorerContextShare,title:L(879,"Share"),group:"11_share",order:-1});var Qh=i1?n_(new Nm({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Rr?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:K.MenubarEditMenu,group:"2_ccp",title:m(872,"&&Paste"),order:4},{menuId:K.EditorContext,group:uo,title:m(873,"Paste"),when:S.writable,order:4},{menuId:K.CommandPalette,group:"",title:m(874,"Paste"),order:1},{menuId:K.SimpleEditorContext,group:uo,title:m(875,"Paste"),when:S.writable,order:4}]})):void 0,o1=class extends A{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:L(880,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:0,weight:100}})}run(n,e){const t=n.get(Ot),i=n.get(oi);t.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),e.hasModel()&&(!e.getOption(45)&&e.getSelection().isEmpty()||(oc.forceCopyWithSyntaxHighlighting=!0,e.focus(),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),wg(e,i),t.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),oc.forceCopyWithSyntaxHighlighting=!1))}};function wg(n,e){if(oc.electronBugWorkaroundCopyEventHasFired=!1,n.getContainerDomNode().ownerDocument.execCommand("copy"),Rr&&oc.electronBugWorkaroundCopyEventHasFired===!1){const{dataToCopy:t}=MR(n._getViewModel(),void 0,vw);e.writeText(t.text)}}function yy(n,e){n&&(n.addImplementation(1e4,"code-editor",(t,i)=>{const s=t.get(Ot),o=t.get(oi);s.trace("registerExecCommandImpl (addImplementation code-editor for : ",e,")");const r=t.get(Ze).getFocusedCodeEditor();if(r&&r.hasTextFocus()&&r.hasModel()){const a=r.getOption(45),l=r.getSelection();return l&&l.isEmpty()&&!a||(r.getOption(171)&&e==="cut"?(eb(r),s.trace("registerExecCommandImpl (before execCommand copy)"),wg(r,o),r.trigger(void 0,"cut",void 0),s.trace("registerExecCommandImpl (after execCommand copy)")):(eb(r),s.trace("registerExecCommandImpl (before execCommand "+e+")"),e==="copy"?wg(r,o):r.getContainerDomNode().ownerDocument.execCommand(e),s.trace("registerExecCommandImpl (after execCommand "+e+")"))),!0}return!1}),n.addImplementation(0,"generic-dom",(t,i)=>{const s=t.get(Ot);return s.trace("registerExecCommandImpl (addImplementation generic-dom for : ",e,")"),s.trace("registerExecCommandImpl (before execCommand "+e+")"),TE().execCommand(e),s.trace("registerExecCommandImpl (after execCommand "+e+")"),!0}))}function eb(n){if(n.getOption(171)){const e=Iw.get(n.getId());e&&e.handleWillCopy()}}yy(n1,"cut");yy(s1,"copy");Qh&&(Qh.addImplementation(1e4,"code-editor",(n,e)=>{const t=n.get(Ot);t.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");const i=n.get(Ze),s=n.get(oi),o=i.getFocusedCodeEditor();if(o&&o.hasModel()&&o.hasTextFocus()){if(o.getOption(171)){const a=Iw.get(o.getId());a&&a.handleWillPaste()}t.trace("registerExecCommandImpl (before triggerPaste)");const r=s.triggerPaste(Jd().vscodeWindowId);return r?(t.trace("registerExecCommandImpl (triggerPaste defined)"),r.then(async()=>(t.trace("registerExecCommandImpl (after triggerPaste)"),Hn.get(o)?.finishedPaste()??Promise.resolve()))):(t.trace("registerExecCommandImpl (triggerPaste undefined)"),GR?(t.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{const a=await s.readText();if(a!==""){const l=HR.INSTANCE.get(a);let d=!1,c=null,h=null;l&&(d=o.getOption(45)&&!!l.isFromEmptySelection,c=typeof l.multicursorText<"u"?l.multicursorText:null,h=l.mode),t.trace("registerExecCommandImpl (clipboardText.length : ",a.length," id : ",l?.id,")"),o.trigger("keyboard","paste",{text:a,pasteOnNewLine:d,multicursorText:c,mode:h})}})()):!0)}return!1}),Qh.addImplementation(0,"generic-dom",(n,e)=>(n.get(Ot).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),n.get(oi).triggerPaste(Jd().vscodeWindowId)??!1)));wy&&P(o1);var Ae=new class{constructor(){this.QuickFix=new ze("quickfix"),this.Refactor=new ze("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new ze("notebook"),this.Source=new ze("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}},Xt;(function(n){n.Refactor="refactor",n.RefactorPreview="refactor preview",n.Lightbulb="lightbulb",n.Default="other (default)",n.SourceAction="source action",n.QuickFix="quick fix action",n.FixAll="fix all",n.OrganizeImports="organize imports",n.AutoFix="auto fix",n.QuickFixHover="quick fix hover window",n.OnSave="save participants",n.ProblemsView="problems view"})(Xt||(Xt={}));function r1(n,e){return!(n.include&&!n.include.intersects(e)||n.excludes&&n.excludes.some(t=>xy(e,t,n.include))||!n.includeSourceActions&&Ae.Source.contains(e))}function a1(n,e){const t=e.kind?new ze(e.kind):void 0;return!(n.include&&(!t||!n.include.contains(t))||n.excludes&&t&&n.excludes.some(i=>xy(t,i,n.include))||!n.includeSourceActions&&t&&Ae.Source.contains(t)||n.onlyIncludePreferredActions&&!e.isPreferred)}function xy(n,e,t){return!(!e.contains(n)||t&&e.contains(t))}var vh=class zo{static fromUser(e,t){return!e||typeof e!="object"?new zo(t.kind,t.apply,!1):new zo(zo.getKindFromUser(e,t.kind),zo.getApplyFromUser(e,t.apply),zo.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new ze(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}},l1=class{constructor(n,e,t){this.action=n,this.provider=e,this.highlightRange=t}async resolve(n){if(this.provider?.resolveCodeAction&&!this.action.edit){let e;try{e=await this.provider.resolveCodeAction(this.action,n)}catch(t){it(t)}e&&(this.action.edit=e.edit)}return this}},Iy="editor.action.codeAction",Ly="editor.action.quickFix",d1="editor.action.autoFix",Dy="editor.action.refactor",Ey="editor.action.sourceAction",Ry="editor.action.organizeImports",Ty="editor.action.fixAll",c1=1e3,h1=class Dd extends M{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:Gt(e.diagnostics)?Gt(t.diagnostics)?Dd.codeActionsPreferredComparator(e,t):-1:Gt(t.diagnostics)?1:Dd.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(Dd.codeActionsComparator),this.validActions=this.allActions.filter(({action:s})=>!s.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Ae.QuickFix.contains(new ze(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},tb={actions:[],documentation:void 0};async function Qo(n,e,t,i,s,o){const r=i.filter||{},a={...r,excludes:[...r.excludes||[],Ae.Notebook]},l={only:r.include?.value,trigger:i.type},d=new PR(e,o),c=u1(n,e,i.type===2?a:r),h=new O,u=c.map(async p=>{const f=setTimeout(()=>s.report(p),1250);try{const _=await p.provideCodeActions(e,t,l,d.token);if(d.token.isCancellationRequested)return _?.dispose(),tb;_&&h.add(_);const v=(_?.actions||[]).filter(w=>w&&a1(r,w)),C=p1(p,v,r.include);return{actions:v.map(w=>new l1(w,p)),documentation:C}}catch(_){if(Un(_))throw _;return it(_),tb}finally{clearTimeout(f)}}),g=n.onDidChange(()=>{const p=n.all(e);$i(p,c)||d.cancel()});try{const p=await Promise.all(u),f=p.map(C=>C.actions).flat(),_=[...Ps(p.map(C=>C.documentation)),...g1(n,e,i,f)],v=new h1(f,_,h);return h.add(v),v}catch(p){throw h.dispose(),p}finally{g.dispose(),d.dispose()}}function u1(n,e,t){return n.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(s=>r1(t,new ze(s))):!0)}function*g1(n,e,t,i){if(e&&i.length)for(const s of n.all(e))s._getAdditionalMenuItems&&(yield*s._getAdditionalMenuItems?.({trigger:t.type,only:t.filter?.include?.value},i.map(o=>o.action)))}function p1(n,e,t){if(!n.documentation)return;const i=n.documentation.map(s=>({kind:new ze(s.kind),command:s.command}));if(t){let s;for(const o of i)o.kind.contains(t)&&(s?s.kind.contains(o.kind)&&(s=o):s=o);if(s)return s?.command}for(const s of e)if(s.kind){for(const o of i)if(o.kind.contains(new ze(s.kind)))return o.command}}var as;(function(n){n.OnSave="onSave",n.FromProblemsView="fromProblemsView",n.FromCodeActions="fromCodeActions",n.FromAILightbulb="fromAILightbulb",n.FromProblemsHover="fromProblemsHover"})(as||(as={}));async function f1(n,e,t,i,s=he.None){const o=n.get(wl),r=n.get(ht),a=n.get(Rs),l=n.get(Rt),d=n.get(Tm);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),d.playSignal(Ba.codeActionTriggered),await e.resolve(s),!s.isCancellationRequested&&!(e.action.edit?.edits.length&&!(await o.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==as.OnSave,showPreview:i?.preview,reason:oo.codeAction({kind:e.action.kind,providerId:qS.fromExtensionId(e.provider?.extensionId)})})).isApplied)){if(e.action.command)try{await r.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(c){const h=m1(c);l.error(typeof h=="string"?h:m(881,"An unknown error occurred while applying the code action"))}setTimeout(()=>d.playSignal(Ba.codeActionApplied),c1)}}function m1(n){return typeof n=="string"?n:n instanceof Error&&typeof n.message=="string"?n.message:void 0}Me.registerCommand("_executeCodeActionProvider",async function(n,e,t,i,s){if(!(e instanceof ke))throw Pn();const{codeActionProvider:o}=n.get(X),r=n.get(Yt).getModel(e);if(!r)throw Pn();const a=ie.isISelection(t)?ie.liftSelection(t):x.isIRange(t)?r.validateRange(t):void 0;if(!a)throw Pn();const l=typeof i=="string"?new ze(i):void 0,d=await Qo(o,r,a,{type:1,triggerAction:Xt.Default,filter:{includeSourceActions:!0,include:l}},En.None,he.None),c=[],h=Math.min(d.validActions.length,typeof s=="number"?s:0);for(let u=0;u<h;u++)c.push(d.validActions[u].resolve(he.None));try{return await Promise.all(c),d.validActions.map(u=>u.action)}finally{setTimeout(()=>d.dispose(),100)}});var _1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},v1=function(n,e){return function(t,i){e(t,i,n)}},yg,xg=class{static{yg=this}static{this.codeActionCommands=[Dy,Iy,Ey,Ry,Ty]}constructor(e){this.keybindingService=e}getResolver(){const e=new $m(()=>this.keybindingService.getKeybindings().filter(t=>yg.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command==="editor.action.organizeImports"?i={kind:Ae.SourceOrganizeImports.value}:t.command==="editor.action.fixAll"&&(i={kind:Ae.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...vh.fromUser(i,{kind:ze.None,apply:"never"})}}));return t=>{if(t.kind)return this.bestKeybindingForCodeAction(t,e.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new ze(e.kind);return t.filter(s=>s.kind.contains(i)).filter(s=>s.preferred?e.isPreferred:!0).reduceRight((s,o)=>s?s.kind.contains(o.kind)?o:s:o,void 0)}};xg=yg=_1([v1(0,He)],xg);W("symbolIcon.arrayForeground",dt,m(1569,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.booleanForeground",dt,m(1570,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},m(1571,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.colorForeground",dt,m(1572,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.constantForeground",dt,m(1573,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},m(1574,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},m(1575,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},m(1576,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},m(1577,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},m(1578,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.fileForeground",dt,m(1579,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.folderForeground",dt,m(1580,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},m(1581,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},m(1582,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.keyForeground",dt,m(1583,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.keywordForeground",dt,m(1584,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},m(1585,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.moduleForeground",dt,m(1586,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.namespaceForeground",dt,m(1587,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.nullForeground",dt,m(1588,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.numberForeground",dt,m(1589,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.objectForeground",dt,m(1590,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.operatorForeground",dt,m(1591,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.packageForeground",dt,m(1592,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.propertyForeground",dt,m(1593,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.referenceForeground",dt,m(1594,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.snippetForeground",dt,m(1595,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.stringForeground",dt,m(1596,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.structForeground",dt,m(1597,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.textForeground",dt,m(1598,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.typeParameterForeground",dt,m(1599,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.unitForeground",dt,m(1600,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));W("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},m(1601,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));var Py=Object.freeze({kind:ze.Empty,title:m(917,"More Actions...")}),b1=Object.freeze([{kind:Ae.QuickFix,title:m(918,"Quick Fix")},{kind:Ae.RefactorExtract,title:m(919,"Extract"),icon:V.wrench},{kind:Ae.RefactorInline,title:m(920,"Inline"),icon:V.wrench},{kind:Ae.RefactorRewrite,title:m(921,"Rewrite"),icon:V.wrench},{kind:Ae.RefactorMove,title:m(922,"Move"),icon:V.wrench},{kind:Ae.SurroundWith,title:m(923,"Surround With"),icon:V.surroundWith},{kind:Ae.Source,title:m(924,"Source Action"),icon:V.symbolFile},Py]);function C1(n,e,t){if(!e)return n.map(o=>({kind:"action",item:o,group:Py,disabled:!!o.action.disabled,label:o.action.disabled||o.action.title,canPreview:!!o.action.edit?.edits.length}));const i=b1.map(o=>({group:o,actions:[]}));for(const o of n){const r=o.action.kind?new ze(o.action.kind):ze.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(o);break}}const s=[];for(const o of i)if(o.actions.length){s.push({kind:"header",group:o.group});for(const r of o.actions){const a=o.group;s.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:V.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return s}var ky=new ae("supportedCodeAction","");var S1=class extends M{constructor(n,e,t,i=250){super(),this._editor=n,this._markerService=e,this._signalChange=t,this._delay=i,this._autoTriggerTimer=this._register(new vl),this.ignoreLightbulbOff=!1,this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(n){const e=this._getRangeOfSelectionUnlessWhitespaceEnclosed(n);this._signalChange(e?{trigger:n,selection:e}:void 0)}_onMarkerChanges(n){const e=this._editor.getModel();e&&n.some(t=>vs(t,e.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:Xt.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(n){if(!this._editor.hasModel())return;const e=this._editor.getSelection();if(n.type===1)return e;const t=this._editor.getOption(73).enabled;if(!(t===ra.Off&&!this.ignoreLightbulbOff)){{if(t===ra.Off||t===ra.On)return e;if(t===ra.OnCode){if(!e.isEmpty())return e;const i=this._editor.getModel(),{lineNumber:s,column:o}=e.getPosition(),r=i.getLineContent(s);if(r.length===0)return;if(o===1){if(/\s/.test(r[0]))return}else if(o===i.getLineMaxColumn(s)){if(/\s/.test(r[r.length-1]))return}else if(/\s/.test(r[o-2])&&/\s/.test(r[o-1]))return}}return e}}},Qs;(function(n){n.Empty={type:0};class e{constructor(i,s,o){this.trigger=i,this.position=s,this._cancellablePromise=o,this.type=1,this.actions=o.catch(r=>{if(Un(r))return aa;throw r})}cancel(){this._cancellablePromise.cancel()}}n.Triggered=e})(Qs||(Qs={}));var aa=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),w1=class extends M{constructor(n,e,t,i,s,o){super(),this._editor=n,this._registry=e,this._markerService=t,this._progressService=s,this._configurationService=o,this._codeActionOracle=this._register(new We),this._state=Qs.Empty,this._onDidChangeState=this._register(new ee),this.onDidChangeState=this._onDidChangeState.event,this.codeActionsDisposable=this._register(new We),this._disposed=!1,this._ignoreLightbulbOff=!1,this._supportedCodeActions=ky.bindTo(i),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(r=>{r.hasChanged(73)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Qs.Empty,!0))}_settingEnabledNearbyQuickfixes(){const n=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:n?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Qs.Empty),this.codeActionsDisposable.clear();const n=this._editor.getModel();if(n&&this._registry.has(n)&&!this._editor.getOption(104)){const e=this._registry.all(n).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(e.join(" "));const t=new S1(this._editor,this._markerService,i=>{if(!i){this.setState(Qs.Empty);return}const s=i.selection.getStartPosition(),o=mt(async l=>{if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===Xt.QuickFix||i.trigger.filter?.include?.contains(Ae.QuickFix))){const c=new O;let h=!1;try{const u=c.add(await Qo(this._registry,n,i.selection,i.trigger,En.None,l)),g=[...u.allActions];if(l.isCancellationRequested)return aa;const p=u.validActions?.some(_=>_.action.kind&&Ae.QuickFix.contains(new ze(_.action.kind))&&!_.action.isAI),f=this._markerService.read({resource:n.uri});if(p){for(const v of u.validActions)v.action.command?.arguments?.some(C=>typeof C=="string"&&C.includes("_typescript.applyFixAllCodeAction"))&&(v.action.diagnostics=[...f.filter(C=>C.relatedInformation)]);const _=this._setCodeActions({validActions:u.validActions,allActions:g,documentation:u.documentation,hasAutoFix:u.hasAutoFix,hasAIFix:u.hasAIFix,allAIFixes:u.allAIFixes,dispose:()=>c.dispose()});return h=!0,_}else if(!p&&f.length>0){const _=i.selection.getPosition();let v=_,C=Number.MAX_VALUE;const w=[...u.validActions];for(const b of f){const I=b.endColumn,N=b.endLineNumber,T=b.startLineNumber;if(N===_.lineNumber||T===_.lineNumber){v=new B(N,I);const E={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:i.trigger.filter?.include?i.trigger.filter?.include:Ae.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:i.trigger.context?.notAvailableMessage||"",position:v}},F=new ie(v.lineNumber,v.column,v.lineNumber,v.column),q=c.add(await Qo(this._registry,n,F,E,En.None,l));if(l.isCancellationRequested)return aa;if(q.validActions.length!==0){for(const re of q.validActions)re.action.command?.arguments?.some(be=>typeof be=="string"&&be.includes("_typescript.applyFixAllCodeAction"))&&(re.action.diagnostics=[...f.filter(be=>be.relatedInformation)]);u.allActions.length===0&&g.push(...q.allActions),Math.abs(_.column-I)<C?w.unshift(...q.validActions):w.push(...q.validActions)}C=Math.abs(_.column-I)}}const y=w.filter((b,I,N)=>N.findIndex(T=>T.action.title===b.action.title)===I);y.sort((b,I)=>b.action.isPreferred&&!I.action.isPreferred?-1:!b.action.isPreferred&&I.action.isPreferred||b.action.isAI&&!I.action.isAI?1:!b.action.isAI&&I.action.isAI?-1:0);const D=this._setCodeActions({validActions:y,allActions:g,documentation:u.documentation,hasAutoFix:u.hasAutoFix,hasAIFix:u.hasAIFix,allAIFixes:u.allAIFixes,dispose:()=>c.dispose()});return h=!0,D}}finally{h||c.dispose()}}if(i.trigger.type===1){const c=await Qo(this._registry,n,i.selection,i.trigger,En.None,l);return l.isCancellationRequested?(c.dispose(),aa):this._setCodeActions(c)}const d=await Qo(this._registry,n,i.selection,i.trigger,En.None,l);return l.isCancellationRequested?(d.dispose(),aa):this._setCodeActions(d)});i.trigger.type===1&&this._progressService?.showWhile(o,250);const r=new Qs.Triggered(i.trigger,s,o);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&r.type===1&&r.trigger.type===2&&this._state.position!==r.position),a?setTimeout(()=>{this.setState(r)},500):this.setState(r)},void 0);t.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=t,this._codeActionOracle.value.trigger({type:2,triggerAction:Xt.Default})}else this._supportedCodeActions.reset()}_setCodeActions(n){return this.codeActionsDisposable.value=n,n}takeCodeActions(n){if(this.codeActionsDisposable.value===n)return this.codeActionsDisposable.clearAndLeak(),n}trigger(n){this._codeActionOracle.value?.trigger(n),this.codeActionsDisposable.clear()}setState(n,e){n!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=n,!e&&!this._disposed&&this._onDidChangeState.fire(n))}},y1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},x1=function(n,e){return function(t,i){e(t,i,n)}},Xn,Ny=Ye("gutter-lightbulb",V.lightBulb,m(925,"Icon which spawns code actions menu from the gutter when there is no space in the editor.")),My=Ye("gutter-lightbulb-auto-fix",V.lightbulbAutofix,m(926,"Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),Oy=Ye("gutter-lightbulb-sparkle",V.lightbulbSparkle,m(927,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),Ay=Ye("gutter-lightbulb-aifix-auto-fix",V.lightbulbSparkleAutofix,m(928,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),Fy=Ye("gutter-lightbulb-sparkle-filled",V.sparkleFilled,m(929,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),Fi;(function(n){n.Hidden={type:0};class e{constructor(i,s,o,r){this.actions=i,this.trigger=s,this.editorPosition=o,this.widgetPosition=r,this.type=1}}n.Showing=e})(Fi||(Fi={}));function Hy(n,e,t,i,s=!1){if(n.validActions.length<=0)return;let o,r=!1;n.allAIFixes?(o=s?Fy:V.sparkleFilled,n.validActions.length===1&&(r=!0)):n.hasAutoFix?n.hasAIFix?o=s?Ay:V.lightbulbSparkleAutofix:o=s?My:V.lightbulbAutofix:n.hasAIFix?o=s?Oy:V.lightbulbSparkle:o=s?Ny:V.lightBulb;let a;return r?a=m(930,"Run: {0}",n.validActions[0].action.title):n.hasAutoFix&&t?a=m(931,"Show Code Actions. Preferred Quick Fix Available ({0})",t):!n.hasAutoFix&&i?a=m(932,"Show Code Actions ({0})",i):a=m(933,"Show Code Actions"),{actions:n,trigger:e,icon:o,autoRun:r,title:a,isGutter:s}}var Za=class extends M{static{Xn=this}static{this.GUTTER_DECORATION=oe.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:ce.asClassName(V.lightBulb),glyphMargin:{position:ig.Left},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}static _computeLightBulbInfo(e,t,i,s){if(e.type===1)return Hy(e.actions,e.trigger,i,s,t)}constructor(e,t){super(),this._editor=e,this._keybindingService=t,this.onlyWithEmptySelection=!1,this._onClick=this._register(new ee),this.onClick=this._onClick.event,this._state=Fe(this,Fi.Hidden),this._gutterState=Fe(this,Fi.Hidden),this._combinedInfo=R(this,i=>{const s=this._gutterState.read(i);if(s.type===1)return Xn._computeLightBulbInfo(s,!0,this._preferredKbLabel.read(i),this._quickFixKbLabel.read(i));const o=this._state.read(i);if(o.type===1)return Xn._computeLightBulbInfo(o,!1,this._preferredKbLabel.read(i),this._quickFixKbLabel.read(i))}),this._iconClasses=[],this.lightbulbClasses=["codicon-"+Ny.id,"codicon-"+Ay.id,"codicon-"+My.id,"codicon-"+Oy.id,"codicon-"+Fy.id],this._preferredKbLabel=Fe(this,void 0),this._quickFixKbLabel=Fe(this,void 0),this.gutterDecoration=Xn.GUTTER_DECORATION,this._domNode=H("div.lightBulbWidget"),this._domNode.role="listbox",this._register(yw.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const s=this._editor.getModel(),o=this._state.get();(o.type!==1||!s||o.editorPosition.lineNumber>=s.getLineCount())&&this.hide();const r=this._gutterState.get();(r.type!==1||!s||r.editorPosition.lineNumber>=s.getLineCount())&&this.gutterHide()})),this._register(QT(this._domNode,i=>{const s=this._state.get();if(s.type!==1)return;this._editor.focus(),i.preventDefault();const{top:o,height:r}=Mt(this._domNode),a=this._editor.getOption(75);let l=Math.floor(a/3);s.widgetPosition.position!==null&&s.widgetPosition.position.lineNumber<s.editorPosition.lineNumber&&(l+=a),this._onClick.fire({x:i.posx,y:o+r+l,actions:s.actions,trigger:s.trigger})})),this._register(Q(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(Ge.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding("editor.action.autoFix")?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding("editor.action.quickFix")?.getLabel()??void 0,void 0)})),this._register(ge(i=>{const s=this._combinedInfo.read(i);this._updateLightBulbTitleAndIcon(s),this._updateGutterDecorationOptions(s)})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(d=>i.target.element&&i.target.element.classList.contains(d)))return;const s=this._gutterState.get();if(s.type!==1)return;this._editor.focus();const{top:o,height:r}=Mt(i.target.element),a=this._editor.getOption(75);let l=Math.floor(a/3);s.widgetPosition.position!==null&&s.widgetPosition.position.lineNumber<s.editorPosition.lineNumber&&(l+=a),this._onClick.fire({x:i.event.posx,y:o+r+l,actions:s.actions,trigger:s.trigger})}))}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){const e=this._state.get();return e.type===1?e.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty())return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(this._editor.getOptions().get(73).enabled===ra.Off)return this.gutterHide(),this.hide();const s=this._editor.getModel();if(!s)return this.gutterHide(),this.hide();const{lineNumber:o,column:r}=s.validatePosition(i),a=s.getOptions().tabSize,l=this._editor.getOptions().get(59),d=s.getLineContent(o),c=Lm(d,a),h=l.spaceWidth*c>22,u=w=>w>2&&this._editor.getTopForLineNumber(w)===this._editor.getTopForLineNumber(w-1),g=this._editor.getLineDecorations(o);let p=!1;if(g)for(const w of g){const y=w.options.glyphMarginClassName;if(y&&!this.lightbulbClasses.some(D=>y.includes(D))){p=!0;break}}let f=o,_=1;if(!h){const w=y=>{const D=s.getLineContent(y);return/^\s*$|^\s+/.test(D)||D.length<=_};if(o>1&&!u(o-1)){const y=o===s.getLineCount(),D=o>1&&w(o-1),b=!y&&w(o+1),I=w(o),N=!b&&!D;if(!b&&!D&&!p)return this._gutterState.set(new Fi.Showing(e,t,i,{position:{lineNumber:f,column:_},preference:Xn._posPref}),void 0),this.renderGutterLightbub(),this.hide();D||y||D&&!I?f-=1:(b||N&&I)&&(f+=1)}else if(o===1&&(o===s.getLineCount()||!w(o+1)&&!w(o)))if(this._gutterState.set(new Fi.Showing(e,t,i,{position:{lineNumber:f,column:_},preference:Xn._posPref}),void 0),p)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(o<s.getLineCount()&&!u(o+1))f+=1;else if(r*l.spaceWidth<22)return this.hide();_=/^\S\s*$/.test(s.getLineContent(f))?2:1}this._state.set(new Fi.Showing(e,t,i,{position:{lineNumber:f,column:_},preference:Xn._posPref}),void 0),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const v=e.validActions,C=e.validActions[0].action.kind;if(v.length!==1||!C){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this._state.get()!==Fi.Hidden&&(this._state.set(Fi.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==Fi.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(Fi.Hidden,void 0))}_updateLightBulbTitleAndIcon(e){this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!(!e||e.isGutter)&&(this._domNode.title=e.title,this._iconClasses=ce.asClassNameArray(e.icon),this._domNode.classList.add(...this._iconClasses))}_updateGutterDecorationOptions(e){!e||!e.isGutter||(this.gutterDecoration=oe.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:ce.asClassName(e.icon),glyphMargin:{position:ig.Left},stickiness:1}))}renderGutterLightbub(){const e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new x(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new x(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}};Za=Xn=y1([x1(1,He)],Za);var I1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Oi=function(n,e){return function(t,i){e(t,i,n)}},jo,L1="quickfix-edit-highlight",go=class extends M{static{jo=this}static{this.ID="editor.contrib.codeActionController"}static get(e){return e.getContribution(jo.ID)}constructor(e,t,i,s,o,r,a,l,d,c,h,u){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=d,this._instantiationService=c,this._progressService=h,this._keybindingService=u,this._activeCodeActions=this._register(new We),this._showDisabled=!1,this._disposed=!1,this._onlyLightBulbWithEmptySelection=!1,this._lightBulbInfoObs=Fe(this,void 0),this._preferredKbLabel=Fe(this,void 0),this._quickFixKbLabel=Fe(this,void 0),this._editor=e,this._model=this._register(new w1(this._editor,o.codeActionProvider,t,i,r,l)),this._register(this._model.onDidChangeState(g=>this.update(g))),this._register(Ge.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding("editor.action.autoFix")?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding("editor.action.quickFix")?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new $m(()=>{const g=this._editor.getContribution(Za.ID);return g&&(this._register(g.onClick(p=>this.showCodeActionsFromLightbulb(p.actions,p))),g.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),g}),this._resolver=s.createInstance(xg),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],s=i.action.command;s&&s.id==="inlineChat.start"&&s.arguments&&s.arguments.length>=1&&s.arguments[0]&&(s.arguments[0]={...s.arguments[0],autoSend:!1}),await this.applyCodeAction(i,!1,!1,as.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,s){if(!this._editor.hasModel())return;Zt.get(this._editor)?.closeMessage();const o=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:s,context:{notAvailableMessage:e,position:o}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,i,s){const o=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(f1,e,s,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:Xt.QuickFix,filter:{}}),o.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==1){this.hideLightBulbWidget(),this._lightBulbInfoObs.set(void 0,void 0);return}let t;try{t=this._model.takeCodeActions(await e.actions)}catch(i){Le(i);return}if(t){if(this._disposed){t.dispose();return}if(this._editor.getSelection()?.startLineNumber!==e.position.lineNumber){t.dispose();return}if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),this._lightBulbInfoObs.set(Hy(t,e.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),e.trigger.type===1){if(e.trigger.filter?.include){const s=this.tryGetValidActionToApply(e.trigger,t);if(s){try{this.hideLightBulbWidget(),await this.applyCodeAction(s,!1,!1,as.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const o=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(o&&o.action.disabled){Zt.get(this._editor)?.showMessage(o.action.disabled,e.trigger.context.position),t.dispose();return}}}const i=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!i&&!t.validActions.length)){Zt.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:i,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}static{this.DECORATION=oe.register({description:"quickfix-highlight",className:L1})}async showCodeActionList(e,t,i){const s=this._editor.createDecorationsCollection(),o=this._editor.getDomNode();if(!o)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=B.isIPosition(t)?this.toCoords(t):t;this._actionWidgetService.show("codeActionWidget",!0,C1(r,this._shouldShowHeaders(),this._resolver.getResolver()),{onSelect:async(l,d)=>{this.applyCodeAction(l,!0,!!d,i.fromLightbulb?as.FromAILightbulb:as.FromCodeActions),this._actionWidgetService.hide(!1),s.clear()},onHide:l=>{this._editor?.focus(),s.clear()},onHover:async(l,d)=>{if(d.isCancellationRequested)return;let c=!1;const h=l.action.kind;if(h){const u=new ze(h);c=[Ae.RefactorExtract,Ae.RefactorInline,Ae.RefactorRewrite,Ae.RefactorMove,Ae.Source].some(g=>g.contains(u))}return{canPreview:c||!!l.action.edit?.edits.length}},onFocus:l=>{if(l&&l.action){const d=l.action.ranges,c=l.action.diagnostics;if(s.clear(),d&&d.length>0){const h=c&&c?.length>1?c.map(u=>({range:u,options:jo.DECORATION})):d.map(u=>({range:u,options:jo.DECORATION}));s.set(h)}else if(c&&c.length>0){const h=c.map(g=>({range:g,options:jo.DECORATION}));s.set(h);const u=c[0];if(u.startLineNumber&&u.startColumn){const g=this._editor.getModel()?.getWordAtPosition({lineNumber:u.startLineNumber,column:u.startColumn})?.word;Ss(m(914,"Context: {0} at line {1} and column {2}.",g,u.startLineNumber,u.startColumn))}}}else s.clear()}},a,o,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=Mt(this._editor.getDomNode());return{x:i.left+t.left,y:i.top+t.top+t.height}}_shouldShowHeaders(){const e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const s=e.documentation.map(o=>({id:o.id,label:o.title,tooltip:o.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(o.id,...o.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&s.push(this._showDisabled?{id:"hideMoreActions",label:m(915,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:m(916,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),s}};go=jo=I1([Oi(1,fh),Oi(2,Ce),Oi(3,ne),Oi(4,X),Oi(5,pr),Oi(6,ht),Oi(7,Ee),Oi(8,Mi),Oi(9,ne),Oi(10,pr),Oi(11,He)],go);pl((n,e)=>{((s,o)=>{o&&e.addRule(`.monaco-editor ${s} { background-color: ${o}; }`)})(".quickfix-edit-highlight",n.getColor(mR));const i=n.getColor(Lw);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Aa(n.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Rl(n){return k.regex(ky.keys()[0],new RegExp("(\\s|^)"+Va(n.value)+"\\b"))}var s_={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:m(882,"Kind of the code action to run.")},apply:{type:"string",description:m(883,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[m(884,"Always apply the first returned code action."),m(885,"Apply the first returned code action if it is the only one."),m(886,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:m(887,"Controls if only preferred code actions should be returned.")}}};function yo(n,e,t,i,s=Xt.Default){n.hasModel()&&go.get(n)?.manualTriggerAtCurrentPosition(e,s,t,i)}var D1=class extends mi{constructor(){super({id:Ly,title:L(904,"Quick Fix..."),precondition:k.and(S.writable,S.hasCodeActionsProvider),icon:V.lightBulb,f1:!0,keybinding:{when:S.textInputFocus,primary:2137,weight:100},menu:{id:K.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:k.and(S.writable,S.hasCodeActionsProvider)}})}runEditorCommand(n,e){return yo(e,m(888,"No code actions available"),void 0,void 0,Xt.QuickFix)}},E1=class extends Ft{constructor(){super({id:Iy,precondition:k.and(S.writable,S.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:s_}]}})}runEditorCommand(n,e,t){const i=vh.fromUser(t,{kind:ze.Empty,apply:"ifSingle"});return yo(e,typeof t?.kind=="string"?i.preferred?m(889,"No preferred code actions for '{0}' available",t.kind):m(890,"No code actions for '{0}' available",t.kind):i.preferred?m(891,"No preferred code actions available"):m(892,"No code actions available"),{include:i.kind,includeSourceActions:!0,onlyIncludePreferredActions:i.preferred},i.apply)}},R1=class extends A{constructor(){super({id:Dy,label:L(905,"Refactor..."),precondition:k.and(S.writable,S.hasCodeActionsProvider),kbOpts:{kbExpr:S.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:k.and(S.writable,Rl(Ae.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:s_}]}})}run(n,e,t){const i=vh.fromUser(t,{kind:Ae.Refactor,apply:"never"});return yo(e,typeof t?.kind=="string"?i.preferred?m(893,"No preferred refactorings for '{0}' available",t.kind):m(894,"No refactorings for '{0}' available",t.kind):i.preferred?m(895,"No preferred refactorings available"):m(896,"No refactorings available"),{include:Ae.Refactor.contains(i.kind)?i.kind:ze.None,onlyIncludePreferredActions:i.preferred},i.apply,Xt.Refactor)}},T1=class extends A{constructor(){super({id:Ey,label:L(906,"Source Action..."),precondition:k.and(S.writable,S.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:k.and(S.writable,Rl(Ae.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:s_}]}})}run(n,e,t){const i=vh.fromUser(t,{kind:Ae.Source,apply:"never"});return yo(e,typeof t?.kind=="string"?i.preferred?m(897,"No preferred source actions for '{0}' available",t.kind):m(898,"No source actions for '{0}' available",t.kind):i.preferred?m(899,"No preferred source actions available"):m(900,"No source actions available"),{include:Ae.Source.contains(i.kind)?i.kind:ze.None,includeSourceActions:!0,onlyIncludePreferredActions:i.preferred},i.apply,Xt.SourceAction)}},P1=class extends A{constructor(){super({id:Ry,label:L(907,"Organize Imports"),precondition:k.and(S.writable,Rl(Ae.SourceOrganizeImports)),kbOpts:{kbExpr:S.textInputFocus,primary:1581,weight:100},metadata:{description:L(908,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(n,e){return yo(e,m(901,"No organize imports action available"),{include:Ae.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",Xt.OrganizeImports)}},k1=class extends A{constructor(){super({id:Ty,label:L(909,"Fix All"),precondition:k.and(S.writable,Rl(Ae.SourceFixAll))})}run(n,e){return yo(e,m(902,"No fix all action available"),{include:Ae.SourceFixAll,includeSourceActions:!0},"ifSingle",Xt.FixAll)}},N1=class extends A{constructor(){super({id:d1,label:L(910,"Auto Fix..."),precondition:k.and(S.writable,Rl(Ae.QuickFix)),kbOpts:{kbExpr:S.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(n,e){return yo(e,m(903,"No auto fixes available"),{include:Ae.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",Xt.AutoFix)}};de(go.ID,go,3);de(Za.ID,Za,4);me(D1);P(R1);P(T1);P(P1);P(N1);P(k1);Z(new E1);pn.as(ih.Configuration).registerConfiguration({...Am,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:m(911,"Enable/disable showing group headers in the Code Action menu."),default:!0}}});pn.as(ih.Configuration).registerConfiguration({...Am,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:m(912,"Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});pn.as(ih.Configuration).registerConfiguration({...Am,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:m(913,"Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var gc=class Wy{constructor(){this.lenses=[]}static{this.Empty=new Wy}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(e,t){qm(e)&&(this._store??=new O,this._store.add(e));for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}};async function Vy(n,e,t){const i=n.ordered(e),s=new Map,o=new gc,r=i.map(async(a,l)=>{s.set(a,l);try{const d=await Promise.resolve(a.provideCodeLenses(e,t));d&&o.add(d,a)}catch(d){it(d)}});return await Promise.all(r),t.isCancellationRequested?(o.dispose(),gc.Empty):(o.lenses=o.lenses.sort((a,l)=>a.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:s.get(a.provider)<s.get(l.provider)?-1:s.get(a.provider)>s.get(l.provider)?1:a.symbol.range.startColumn<l.symbol.range.startColumn?-1:a.symbol.range.startColumn>l.symbol.range.startColumn?1:0),o)}Me.registerCommand("_executeCodeLensProvider",function(n,...e){let[t,i]=e;Ie(ke.isUri(t)),Ie(typeof i=="number"||!i);const{codeLensProvider:s}=n.get(X),o=n.get(Yt).getModel(t);if(!o)throw Pn();const r=[],a=new O;return Vy(s,o,he.None).then(l=>{a.add(l);const d=[];for(const c of l.lenses)i==null||c.symbol.command?r.push(c.symbol):i-- >0&&c.provider.resolveCodeLens&&d.push(Promise.resolve(c.provider.resolveCodeLens(o,c.symbol,he.None)).then(h=>r.push(h||c.symbol)));return Promise.all(d)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var M1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},O1=function(n,e){return function(t,i){e(t,i,n)}},By=fn("ICodeLensCache"),ib=class{constructor(n,e){this.lineCount=n,this.data=e}},Ig=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new fl(20,.75);const t="codelens/cache";M0(_d,()=>e.remove(t,1));const i="codelens/cache2",s=e.get(i,1,"{}");this._deserialize(s);const o=Ge.filter(e.onWillSaveState,r=>r.reason===ym.SHUTDOWN);Ge.once(o)(r=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>({range:r.symbol.range,command:r.symbol.command&&{id:"",title:r.symbol.command?.title}})),s=new gc;s.add({lenses:i},this._fakeProvider);const o=new ib(e.getLineCount(),s);this._cache.set(e.uri.toString(),o)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const s=new Set;for(const o of i.data.lenses)s.add(o.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...s.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const s=t[i],o=[];for(const a of s.lines)o.push({range:new x(a,1,a,11)});const r=new gc;r.add({lenses:o},this._fakeProvider),this._cache.set(i,new ib(s.lineCount,r))}}catch{}}};Ig=M1([O1(0,Ni)],Ig);zn(By,Ig,1);var A1=class{constructor(n,e,t){this.afterColumn=1073741824,this.afterLineNumber=n,this.heightInPx=e,this._onHeight=t,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(n){this._lastHeight===void 0?this._lastHeight=n:this._lastHeight!==n&&(this._lastHeight=n,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}},F1=class Lg{static{this._idPool=0}constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${Lg._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let s=!1;for(let o=0;o<e.length;o++){const r=e[o];if(r&&(s=!0,r.command)){const a=T0(r.command.title.trim());if(r.command.id){const l=`c${Lg._idPool++}`;i.push(H("a",{id:l,title:r.command.tooltip,role:"button"},...a)),this._commands.set(l,r.command)}else i.push(H("span",{title:r.command.tooltip},...a));o+1<e.length&&i.push(H("span",void 0," | "))}}s?(tc(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):tc(this._domNode,H("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}},eu=class{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(n,e){this._addDecorations.push(n),this._addDecorationsCallbacks.push(e)}removeDecoration(n){this._removeDecorations.push(n)}commit(n){const e=n.deltaDecorations(this._removeDecorations,this._addDecorations);for(let t=0,i=e.length;t<i;t++)this._addDecorationsCallbacks[t](e[t])}},nb=oe.register({collapseOnReplaceEdit:!0,description:"codelens"}),sb=class{constructor(n,e,t,i,s,o){this._isDisposed=!1,this._editor=e,this._data=n,this._decorationIds=[];let r;const a=[];this._data.forEach((l,d)=>{l.symbol.command&&a.push(l.symbol),t.addDecoration({range:l.symbol.range,options:nb},c=>this._decorationIds[d]=c),r?r=x.plusRange(r,l.symbol.range):r=x.lift(l.symbol.range)}),this._viewZone=new A1(r.startLineNumber-1,s,o),this._viewZoneId=i.addZone(this._viewZone),a.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(a,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new F1(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(n,e){this._decorationIds.forEach(n.removeDecoration,n),this._decorationIds=[],e?.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((n,e)=>{const t=this._editor.getModel().getDecorationRange(n),i=this._data[e].symbol;return!!(t&&x.isEmpty(i.range)===t.isEmpty())})}updateCodeLensSymbols(n,e){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],this._data=n,this._data.forEach((t,i)=>{e.addDecoration({range:t.symbol.range,options:nb},s=>this._decorationIds[i]=s)})}updateHeight(n,e){this._viewZone.heightInPx=n,e.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(n){if(!this._viewZone.isVisible())return null;for(let e=0;e<this._decorationIds.length;e++){const t=n.getDecorationRange(this._decorationIds[e]);t&&(this._data[e].symbol.range=t)}return this._data}updateCommands(n){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(n,!0);for(let e=0;e<this._data.length;e++){const t=n[e];if(t){const{symbol:i}=this._data[e];i.command=t.command||i.command}}}getCommand(n){return this._contentWidget?.getCommand(n)}getLineNumber(){const n=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return n?n.startLineNumber:-1}update(n){if(this.isValid()){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);e&&(this._viewZone.afterLineNumber=e.startLineNumber-1,n.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(e.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}},H1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},$r=function(n,e){return function(t,i){e(t,i,n)}},Xa=class{static{this.ID="css.editor.codeLens"}constructor(e,t,i,s,o,r){this._editor=e,this._languageFeaturesService=t,this._commandService=s,this._notificationService=o,this._codeLensCache=r,this._disposables=new O,this._localToDispose=new O,this._lenses=[],this._oldCodeLensModels=new O,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new at(()=>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(a=>{(a.hasChanged(59)||a.hasChanged(25)||a.hasChanged(24))&&this._updateLensStyle(),a.hasChanged(23)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){this._localDispose(),this._localToDispose.dispose(),this._disposables.dispose(),this._resolveCodeLensesScheduler.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61));let t=this._editor.getOption(25);return(!t||t<5)&&(t=this._editor.getOption(61)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(24),s=this._editor.getOption(59),{style:o}=this._editor.getContainerDomNode();o.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),o.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),o.setProperty("--vscode-editorCodeLens-fontFeatureSettings",s.fontFeatureSettings),i&&(o.setProperty("--vscode-editorCodeLens-fontFamily",i),o.setProperty("--vscode-editorCodeLens-fontFamilyDefault",Rm.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(23)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&ji(()=>{const s=this._codeLensCache.get(e);t===s&&(this._codeLensCache.delete(e),this._onModelChange())},3e4,this._localToDispose);return}for(const s of this._languageFeaturesService.codeLensProvider.all(e))if(typeof s.onDidChange=="function"){const o=s.onDidChange(()=>i.schedule());this._localToDispose.add(o)}const i=new at(()=>{const s=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=mt(o=>Vy(this._languageFeaturesService.codeLensProvider,e,o)),this._getCodeLensModelPromise.then(o=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=o,this._codeLensCache.put(e,o);const r=this._provideCodeLensDebounce.update(e,Date.now()-s);i.delay=r,this._renderCodeLensSymbols(o),this._resolveCodeLensesInViewportSoon()},Le)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(Te(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(s=>{this._editor.changeViewZones(o=>{const r=[];let a=-1;this._lenses.forEach(d=>{!d.isValid()||a===d.getLineNumber()?r.push(d):(d.update(o),a=d.getLineNumber())});const l=new eu;r.forEach(d=>{d.dispose(l,o),this._lenses.splice(this._lenses.indexOf(d),1)}),l.commit(s)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(s=>{s.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(Te(()=>{if(this._editor.getModel()){const s=ur.capture(this._editor);this._editor.changeDecorations(o=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(o,r)})}),s.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(s=>{if(s.target.type!==9)return;let o=s.target.element;if(o?.tagName==="SPAN"&&(o=o.parentElement),o?.tagName==="A")for(const r of this._lenses){const a=r.getCommand(o);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new eu;for(const s of this._lenses)s.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let s;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(s&&s[s.length-1].symbol.range.startLineNumber===l?s.push(a):(s=[a],i.push(s)))}if(!i.length&&!this._lenses.length)return;const o=ur.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const d=new eu;let c=0,h=0;for(;h<i.length&&c<this._lenses.length;){const u=i[h][0].symbol.range.startLineNumber,g=this._lenses[c].getLineNumber();g<u?(this._lenses[c].dispose(d,l),this._lenses.splice(c,1)):g===u?(this._lenses[c].updateCodeLensSymbols(i[h],d),h++,c++):(this._lenses.splice(c,0,new sb(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),c++,h++)}for(;c<this._lenses.length;)this._lenses[c].dispose(d,l),this._lenses.splice(c,1);for(;h<i.length;)this._lenses.push(new sb(i[h],this._editor,d,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),h++;d.commit(a)})}),o.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(r=>{const a=r.computeIfNecessary(e);a&&(t.push(a),i.push(r))}),t.length===0){this._oldCodeLensModels.clear();return}const s=Date.now(),o=mt(r=>{const a=t.map((l,d)=>{const c=new Array(l.length),h=l.map((u,g)=>!u.symbol.command&&typeof u.provider.resolveCodeLens=="function"?Promise.resolve(u.provider.resolveCodeLens(e,u.symbol,r)).then(p=>{c[g]=p},it):(c[g]=u.symbol,Promise.resolve(void 0)));return Promise.all(h).then(()=>{!r.isCancellationRequested&&!i[d].isDisposed()&&i[d].updateCommands(c)})});return Promise.all(a)});this._resolveCodeLensesPromise=o,this._resolveCodeLensesPromise.then(()=>{const r=this._resolveCodeLensesDebounce.update(e,Date.now()-s);this._resolveCodeLensesScheduler.delay=r,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),o===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},r=>{Le(r),o===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};Xa=H1([$r(1,X),$r(2,ki),$r(3,ht),$r(4,Rt),$r(5,By)],Xa);de(Xa.ID,Xa,1);P(class extends A{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:S.hasCodeLensProvider,label:L(935,"Show CodeLens Commands for Current Line")})}async run(e,t){if(!t.hasModel())return;const i=e.get(Ri),s=e.get(ht),o=e.get(Rt),r=t.getSelection().positionLineNumber,a=t.getContribution(Xa.ID);if(!a)return;const l=await a.getModel();if(!l)return;const d=[];for(const u of l.lenses)u.symbol.command&&u.symbol.range.startLineNumber===r&&d.push({label:u.symbol.command.title,command:u.symbol.command});if(d.length===0)return;const c=await i.pick(d,{canPickMany:!1,placeHolder:m(934,"Select a command")});if(!c)return;let h=c.command;if(l.isDisposed){const u=(await a.getModel())?.lenses.find(g=>g.symbol.range.startLineNumber===r&&g.symbol.command?.title===h.title);if(!u||!u.symbol.command)return;h=u.symbol.command}try{await s.executeCommand(h.id,...h.arguments||[])}catch(u){o.error(u)}}});var tu=class{constructor(n,e,t,i){this.priority=n,this.range=e,this.initialMousePosX=t,this.initialMousePosY=i,this.type=1}equals(n){return n.type===1&&this.range.equalsRange(n.range)}canAdoptVisibleHover(n,e){return n.type===1&&e.lineNumber===this.range.startLineNumber}},la=class{constructor(n,e,t,i,s,o){this.priority=n,this.owner=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=s,this.supportsMarkerHover=o,this.type=2}equals(n){return n.type===2&&this.owner===n.owner}canAdoptVisibleHover(n,e){return n.type===2&&this.owner===n.owner}},po=class{constructor(n,e){this.renderedHoverParts=n,this.disposables=e}dispose(){for(const n of this.renderedHoverParts)n.dispose();this.disposables?.dispose()}},xo=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}},Uy=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Dg=function(n,e){return function(t,i){e(t,i,n)}},Ya=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const s=t.range,o=t.color,r=new ve(new vr(Math.round(255*o.red),Math.round(255*o.green),Math.round(255*o.blue),o.alpha)),a=ve.Format.CSS.formatRGB(r),l=ve.Format.CSS.formatHSL(r),d=ve.Format.CSS.formatHexA(r,!0),c=[];return c.push({label:a,textEdit:{range:s,text:a}}),c.push({label:l,textEdit:{range:s,text:l}}),c.push({label:d,textEdit:{range:s,text:d}}),c}};Ya=Uy([Dg(0,Vn)],Ya);var Eg=class extends M{constructor(e,t){super(),this._register(e.colorProvider.register("*",new Ya(t)))}};Eg=Uy([Dg(0,X),Dg(1,Vn)],Eg);async function zy(n,e,t,i="auto"){return o_(new W1,n,e,t,i)}function jy(n,e,t,i){return Promise.resolve(t.provideColorPresentations(n,e,i))}var W1=class{constructor(){}async compute(n,e,t,i){const s=await n.provideDocumentColors(e,t);if(Array.isArray(s))for(const o of s)i.push({colorInfo:o,provider:n});return Array.isArray(s)}},V1=class{constructor(){}async compute(n,e,t,i){const s=await n.provideDocumentColors(e,t);if(Array.isArray(s))for(const o of s)i.push({range:o.range,color:[o.color.red,o.color.green,o.color.blue,o.color.alpha]});return Array.isArray(s)}},B1=class{constructor(n){this.colorInfo=n}async compute(n,e,t,i){const s=await n.provideColorPresentations(e,this.colorInfo,he.None);return Array.isArray(s)&&i.push(...s),Array.isArray(s)}};async function o_(n,e,t,i,s){let o=!1,r;const a=[],l=e.ordered(t);for(let d=l.length-1;d>=0;d--){const c=l[d];if(s!=="always"&&c instanceof Ya)r=c;else try{await n.compute(c,t,i,a)&&(o=!0)}catch(h){it(h)}}return o?a:r&&s!=="never"?(await n.compute(r,t,i,a),a):[]}function qy(n,e){const{colorProvider:t}=n.get(X),i=n.get(Yt).getModel(e);if(!i)throw Pn();return{model:i,colorProviderRegistry:t,defaultColorDecoratorsEnablement:n.get(Ee).getValue("editor.defaultColorDecorators",{resource:e})}}var U1=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},iu=function(n,e){return function(t,i){e(t,i,n)}},js,$y=Object.create({}),Cr=class extends M{static{js=this}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1e3}static{this.colorDecoratorInnerWidthInEm=.8}static{this.colorDecoratorMarginInEm=.2}constructor(e,t,i,s){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new O),this._decorationsIds=[],this._colorDatas=new Map,this._decoratorLimitReporter=this._register(new z1),this._colorDecorationClassRefs=this._register(new O),this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new jS(this._editor));const o=this._editor.getContainerDomNode();o.style.setProperty("--vscode-colorPicker-colorDecoratorWidth",`${js.colorDecoratorInnerWidthInEm}em`),o.style.setProperty("--vscode-colorPicker-colorDecoratorMargin",`${js.colorDecoratorMarginInEm}em`),this._register(Te(()=>{o.style.removeProperty("--vscode-colorPicker-colorDecoratorWidth"),o.style.removeProperty("--vscode-colorPicker-colorDecoratorMargin")})),this._debounceInformation=s.for(i.colorProvider,"Document Colors",{min:js.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(r=>{const a=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(168);const l=a!==this._isColorDecoratorsEnabled||r.hasChanged(27),d=r.hasChanged(168);(l||d)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(168),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const s=i.colorDecorators;if(s&&s.enable!==void 0&&!s.enable)return s.enable}return this._editor.getOption(26)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled){this.removeAllDecorations();return}const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new vl,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=mt(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new pi(!1),s=await zy(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,i.elapsed()),s});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Le(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:oe.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((s,o)=>this._colorDatas.set(s,e[o]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=js.colorDecoratorInnerWidthInEm+2*js.colorDecoratorMarginInEm,s=this._editor.getOption(27);for(let r=0;r<e.length&&t.length<s;r++){const{red:a,green:l,blue:d,alpha:c}=e[r].colorInfo.color,h=new vr(Math.round(a*255),Math.round(l*255),Math.round(d*255),c),u=`rgba(${h.r}, ${h.g}, ${h.b}, ${h.a})`,g=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:u}));t.push({range:{startLineNumber:e[r].colorInfo.range.startLineNumber,startColumn:e[r].colorInfo.range.startColumn,endLineNumber:e[r].colorInfo.range.endLineNumber,endColumn:e[r].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:" ",inlineClassName:`${g.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:$y,widthInEm:i}}})}const o=s<e.length?s:!1;this._decoratorLimitReporter.update(e.length,o),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(x.fromPositions(e,e)).filter(s=>this._colorDatas.has(s.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};Cr=js=U1([iu(1,Ee),iu(2,X),iu(3,ki)],Cr);var z1=class extends M{constructor(){super(...arguments),this._onDidChange=this._register(new ee),this._computed=0,this._limited=!1}update(n,e){(n!==this._computed||e!==this._limited)&&(this._computed=n,this._limited=e,this._onDidChange.fire())}},j1="editor.action.showHover",q1="editor.action.showDefinitionPreviewHover",$1="editor.action.hideHover",K1="editor.action.scrollUpHover",G1="editor.action.scrollDownHover",Z1="editor.action.scrollLeftHover",X1="editor.action.scrollRightHover",Y1="editor.action.pageUpHover",J1="editor.action.pageDownHover",Q1="editor.action.goToTopHover",ek="editor.action.goToBottomHover",r_="editor.action.increaseHoverVerbosityLevel",tk=m(1160,"Increase Hover Verbosity Level"),a_="editor.action.decreaseHoverVerbosityLevel",ik=m(1161,"Decrease Hover Verbosity Level"),Rg="editor.action.hideLongLineWarningHover",Sr="editor.action.inlineSuggest.commit",bh="editor.action.inlineSuggest.commitAlternativeAction",Ky="editor.action.inlineSuggest.showPrevious",Gy="editor.action.inlineSuggest.showNext",l_="editor.action.inlineSuggest.jump",Zy="editor.action.inlineSuggest.hide",Tg="editor.action.inlineSuggest.toggleShowCollapsed",ob="editor.action.inlineSuggest.renameSymbol",d_=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},yi=function(n,e){return function(t,i){e(t,i,n)}},Ed,Pg=class extends M{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=Bt(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=R(this,s=>{const o=this.model.read(s)?.primaryGhostText.read(s);if(!this.alwaysShowToolbar.read(s)||!o||o.parts.length===0)return this.sessionPosition=void 0,null;const r=o.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==o.lineNumber&&(this.sessionPosition=void 0);const a=new B(o.lineNumber,Math.min(r,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(xl((s,o)=>{const r=this.model.read(s);if(!r||!this.alwaysShowToolbar.read(s))return;const a=R(d=>{const c=d.store.add(this.instantiationService.createInstance(wr.hot.read(d),this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands,r.warning,()=>{}));return e.addContentWidget(c),d.store.add(Te(()=>e.removeContentWidget(c))),d.store.add(ge(h=>{this.position.read(h)&&r.lastTriggerKind.read(h)!==ti.Explicit&&r.triggerExplicitly()})),c}),l=ks(this,(d,c)=>!!this.position.read(d)||!!c);o.add(ge(d=>{l.read(d)&&a.read(d)}))}))}};Pg=d_([yi(2,ne)],Pg);var nk=Ye("inline-suggestion-hints-next",V.chevronRight,m(1270,"Icon for show next parameter hint.")),sk=Ye("inline-suggestion-hints-previous",V.chevronLeft,m(1271,"Icon for show previous parameter hint.")),wr=class extends M{static{Ed=this}static{this.hot=Sm(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,i){const s=new hr(e,t,i,!0,()=>this._commandService.executeCommand(e));return s.tooltip=this.keybindingService.appendKeybinding(t,e,this._contextKeyService),s}constructor(e,t,i,s,o,r,a,l,d,c,h,u,g){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=s,this._suggestionCount=o,this._extraCommands=r,this._warning=a,this._relayout=l,this._commandService=d,this.keybindingService=h,this._contextKeyService=u,this._menuService=g,this.id=`InlineSuggestionHintsContentWidget${Ed.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=R(p=>{const f=this._warning.read(p);if(f)return typeof f.message=="string"?f.message:p.store.add(eh(f.message)).element}),this._warningMessageNode=$.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:R(p=>this._warning.read(p)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=Fa("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,Fa("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(Ky,m(1272,"Previous"),ce.asClassName(sk))),this.availableSuggestionCountAction=this._register(new hr("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(Gy,m(1273,"Next"),ce.asClassName(nk))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(K.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new at(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new at(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(ge(p=>{this._warningMessageContentNode.read(p),this._warningMessageNode.readEffect(p),this._relayout()})),this.toolBar=this._register(c.createInstance(kg,this.nodes.toolBar,K.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:p=>p.startsWith("primary")},actionViewItemProvider:(p,f)=>{if(p instanceof co)return c.createInstance(rk,p,void 0);if(p===this.availableSuggestionCountAction){const _=new ok(void 0,p,{label:!0,icon:!1});return _.setClass("availableSuggestionCount"),_}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(p=>{Ed._dropDownVisible=p})),this._register(ge(p=>{this._position.read(p),this.editor.layoutContentWidget(this)})),this._register(ge(p=>{const f=this._suggestionCount.read(p),_=this._currentSuggestionIdx.read(p);f!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${_+1}/${f}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),f!==void 0&&f>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(ge(p=>{const f=this._extraCommands.read(p).map(_=>({class:void 0,id:_.command.id,enabled:!0,tooltip:_.command.tooltip||"",label:_.command.title,run:()=>this._commandService.executeCommand(_.command.id,..._.command.arguments??[])}));for(const[_,v]of this.inlineCompletionsActionsMenus.getActions())for(const C of v)C instanceof co&&f.push(C);f.length>0&&f.unshift(new Ua),this.toolBar.setAdditionalSecondaryActions(f)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};wr=Ed=d_([yi(8,ht),yi(9,ne),yi(10,He),yi(11,Ce),yi(12,Ts)],wr);var ok=class extends cg{constructor(){super(...arguments),this._className=void 0}setClass(n){this._className=n}render(n){super.render(n),this._className&&n.classList.add(this._className)}updateTooltip(){}},rk=class extends Dm{updateLabel(){const n=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!n)return super.updateLabel();if(this.label){const e=Fa("div.keybinding").root;this._register(new bl(e,_l,{disableTitle:!0,...HS})).set(n),this.label.textContent=this._action.label,this.label.appendChild(e),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}},kg=class extends KT{constructor(e,t,i,s,o,r,a,l,d){super(e,{resetMenu:t,...i},s,o,r,a,l,d),this.menuId=t,this.options2=i,this.menuService=s,this.contextKeyService=o,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this.additionalPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const{primary:e,secondary:t}=YS(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),e.push(...this.additionalPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){$i(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){$i(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};kg=d_([yi(3,Ts),yi(4,Ce),yi(5,Sl),yi(6,He),yi(7,ht),yi(8,Rs)],kg);function Ch(n,e,t){const i=Mt(n);return!(e<i.left+3||e>i.left+i.width-3||t<i.top+3||t>i.top+i.height-3)}function Xy(n,e,t){return n==="on"?!0:n==="off"?!1:c_(e,t.event)}function c_(n,e){return n==="altKey"?e.ctrlKey||e.metaKey:e.altKey}var ak=class{constructor(n,e,t,i){this.value=n,this.isComplete=e,this.hasLoadingMessage=t,this.options=i}},Yy=class extends M{constructor(n,e){super(),this._editor=n,this._computer=e,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._asyncComputationScheduler=this._register(new nu(t=>this._triggerAsyncComputation(t),0)),this._syncComputationScheduler=this._register(new nu(t=>this._triggerSyncComputation(t),0)),this._loadingMessageScheduler=this._register(new nu(t=>this._triggerLoadingMessage(t),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(n,e){this._options=e,this._state=n,this._fireResult(e)}_triggerAsyncComputation(n){this._setState(2,n),this._syncComputationScheduler.schedule(n,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=WE(e=>this._computer.computeAsync(n,e)),(async()=>{try{for await(const e of this._asyncIterable)e&&(this._result.push(e),this._fireResult(n));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,n)}catch(e){Le(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(n){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(n))),this._setState(this._asyncIterableDone?0:3,n)}_triggerLoadingMessage(n){this._state===3&&this._setState(4,n)}_fireResult(n){if(this._state===1||this._state===2)return;const e=this._state===0,t=this._state===4;this._onResult.fire(new ak(this._result.slice(0),e,t,n))}start(n,e){if(n===0)this._state===0&&(this._setState(1,e),this._asyncComputationScheduler.schedule(e,this._firstWaitTime),this._loadingMessageScheduler.schedule(e,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(e),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(e);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(e)}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}},nu=class extends M{constructor(n,e){super(),this._scheduler=this._register(new at(()=>n(this._options),e))}schedule(n,e){this._options=n,this._scheduler.schedule(e)}cancel(){this._scheduler.cancel()}},h_=class{get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}constructor(){this._onDidWillResize=new ee,this._onDidResize=new ee,this._sashListener=new O,this._size=new Pe(0,0),this._minSize=new Pe(0,0),this._maxSize=new Pe(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new Xo(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Xo(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Xo(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:mv.North}),this._southSash=new Xo(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:mv.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let n,e=0,t=0;this._sashListener.add(Ge.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{n===void 0&&(this._onDidWillResize.fire(),n=this._size,e=0,t=0)})),this._sashListener.add(Ge.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{n!==void 0&&(n=void 0,e=0,t=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(i=>{n&&(t=i.currentX-i.startX,this.layout(n.height+e,n.width+t),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(i=>{n&&(t=-(i.currentX-i.startX),this.layout(n.height+e,n.width+t),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(i=>{n&&(e=-(i.currentY-i.startY),this.layout(n.height+e,n.width+t),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(i=>{n&&(e=i.currentY-i.startY,this.layout(n.height+e,n.width+t),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(Ge.any(this._eastSash.onDidReset,this._westSash.onDidReset)(i=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(Ge.any(this._northSash.onDidReset,this._southSash.onDidReset)(i=>{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(n,e,t,i){this._northSash.state=n?3:0,this._eastSash.state=e?3:0,this._southSash.state=t?3:0,this._westSash.state=i?3:0}layout(n=this.size.height,e=this.size.width){const{height:t,width:i}=this._minSize,{height:s,width:o}=this._maxSize;n=Math.max(t,Math.min(s,n)),e=Math.max(i,Math.min(o,e));const r=new Pe(e,n);Pe.equals(r,this._size)||(this.domNode.style.height=n+"px",this.domNode.style.width=e+"px",this._size=r,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(n){this._maxSize=n}get maxSize(){return this._maxSize}set minSize(n){this._minSize=n}get minSize(){return this._minSize}set preferredSize(n){this._preferredSize=n}get preferredSize(){return this._preferredSize}},lk=30,dk=24,ck=class extends M{constructor(n,e=new Pe(10,10)){super(),this._editor=n,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new h_),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=Pe.lift(e),this._resizableNode.layout(e.height,e.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(t=>{this._resize(new Pe(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(){return this._contentPosition?.position?B.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(n){const e=this._editor.getDomNode(),t=this._editor.getScrolledVisiblePosition(n);if(!(!e||!t))return Mt(e).top+t.top-lk}_availableVerticalSpaceBelow(n){const e=this._editor.getDomNode(),t=this._editor.getScrolledVisiblePosition(n);if(!e||!t)return;const i=Mt(e),s=ml(e.ownerDocument.body),o=i.top+t.top+t.height;return s.height-o-dk}_findPositionPreference(n,e){const t=Math.min(this._availableVerticalSpaceBelow(e)??1/0,n),i=Math.min(this._availableVerticalSpaceAbove(e)??1/0,n),s=Math.min(n,Math.min(Math.max(i,t),n));let o;return this._editor.getOption(69).above?o=s<=i?1:2:o=s<=t?2:1,o===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),o}_resize(n){this._resizableNode.layout(n.height,n.width)}},hk=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Vl=function(n,e){return function(t,i){e(t,i,n)}},bi,rb=30,Ng=class extends ck{static{bi=this}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new Pe(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,s,o){const r=e.getOption(75)+8,a=new Pe(150,r);super(e,a),this._configurationService=i,this._accessibilityService=s,this._keybindingService=o,this._hover=this._register(new Nw(!0)),this._onDidResize=this._register(new ee),this.onDidResize=this._onDidResize.event,this._onDidScroll=this._register(new ee),this.onDidScroll=this._onDidScroll.event,this._onContentsChanged=this._register(new ee),this.onContentsChanged=this._onContentsChanged.event,this._minimumSize=a,this._hoverVisibleKey=S.hoverVisible.bindTo(t),this._hoverFocusedKey=S.hoverFocused.bindTo(t),U(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(d=>{d.hasChanged(59)&&this._updateFont()}));const l=this._register(us(this._resizableNode.domNode));this._register(l.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(l.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(d=>{this._onDidScroll.fire(d)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return bi.ID}static _applyDimensions(e,t,i){const s=typeof t=="number"?`${t}px`:t,o=typeof i=="number"?`${i}px`:i;e.style.width=s,e.style.height=o}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return bi._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return bi._applyDimensions(i,e,t)}_setScrollableElementDimensions(e,t){const i=this._hover.scrollbar.getDomNode();return bi._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const s=typeof t=="number"?`${t}px`:t,o=typeof i=="number"?`${i}px`:i;e.style.maxWidth=s,e.style.maxHeight=o}_setHoverWidgetMaxDimensions(e,t){bi._applyMaxDimensions(this._hover.contentsDomNode,e,t),bi._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),bi._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(e.width,e.height)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new Pe(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){bi._lastDimensions=new Pe(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){const e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let t=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(i=>{t+=i.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=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"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?ml(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;const i=Mt(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=ab(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const s=ab(e,t,i.left,i.top,i.width,i.height);return s>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,s),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(59),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,bi._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,bi._lastDimensions.width);this._resizableNode.maxSize=new Pe(t,e),this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=Zo(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&$R(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new Pe(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new Pe(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new Pe(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();const e=this._hover.contentsDomNode;let t=Zo(e),i=Si(e)+2;if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Zo(e),i=Si(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),this._renderedHover?.showAtPosition){const s=Zo(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(s,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-rb})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+rb})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Ng=bi=hk([Vl(1,Ce),Vl(2,Ee),Vl(3,So),Vl(4,He)],Ng);function ab(n,e,t,i,s,o){const r=t+s/2,a=i+o/2,l=Math.max(Math.abs(n-r)-s/2,0),d=Math.max(Math.abs(e-a)-o/2,0);return Math.sqrt(l*l+d*d)}var uk=class Mg{constructor(e,t){this._editor=e,this._participants=t}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),s=t.range.startLineNumber;if(s>i.getLineCount())return[];const o=i.getLineMaxColumn(s);return e.getLineDecorations(s).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===s?r.range.startColumn:1,l=r.range.endLineNumber===s?r.range.endColumn:o;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e,t){const i=e.anchor;if(!this._editor.hasModel()||!i)return dn.EMPTY;const s=Mg._getLineDecorations(this._editor,i);return dn.merge(this._participants.map(o=>o.computeAsync?o.computeAsync(i,s,e.source,t):dn.EMPTY))}computeSync(e){if(!this._editor.hasModel())return[];const t=e.anchor,i=Mg._getLineDecorations(this._editor,t);let s=[];for(const o of this._participants)s=s.concat(o.computeSync(t,i,e.source));return Ps(s)}},Jy=class{constructor(n,e,t){this.hoverParts=n,this.isComplete=e,this.options=t}filter(n){const e=this.hoverParts.filter(t=>t.isValidForHoverAnchor(n));return e.length===this.hoverParts.length?this:new gk(this,e,this.isComplete,this.options)}},gk=class extends Jy{constructor(n,e,t,i){super(e,t,i),this.original=n}filter(n){return this.original.filter(n)}},pk=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},lb=function(n,e){return function(t,i){e(t,i,n)}},db=H,pc=class extends M{get hasContent(){return this._hasContent}constructor(e,t){super(),this._keybindingService=e,this._hoverService=t,this.actions=[],this._hasContent=!1,this.hoverElement=db("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=U(this.hoverElement,db("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const s=this._register(Ww.render(this.actionsElement,e,i));return this._register(this._hoverService.setupManagedHover(gw("element"),s.actionContainer,s.actionRenderedLabel)),this.actions.push(s),s}append(e){const t=U(this.actionsElement,e);return this._hasContent=!0,t}};pc=pk([lb(0,He),lb(1,fi)],pc);var fk=class Ci{constructor(e){this._editor=e,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 e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(e){const t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const s=i.options;if(s===Ci._FIND_MATCH_DECORATION||s===Ci._FIND_MATCH_NO_OVERVIEW_DECORATION||s===Ci._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let s=0,o=this._decorations.length;s<o;s++){const r=this._editor.getModel().getDecorationRange(this._decorations[s]);if(e.equalsRange(r)){t=this._decorations[s],i=s+1;break}}return(this._highlightedDecorationId!==null||t!==null)&&this._editor.changeDecorations(s=>{if(this._highlightedDecorationId!==null&&(s.changeDecorationOptions(this._highlightedDecorationId,Ci._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,s.changeDecorationOptions(this._highlightedDecorationId,Ci._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(s.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let o=this._editor.getModel().getDecorationRange(t);if(o.startLineNumber!==o.endLineNumber&&o.endColumn===1){const r=o.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);o=new x(o.startLineNumber,o.startColumn,r,a)}this._rangeHighlightDecorationId=s.addDecoration(o,Ci._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let s=Ci._FIND_MATCH_DECORATION;const o=[];if(e.length>1e3){s=Ci._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),l=this._editor.getLayoutInfo().height/a,d=Math.max(2,Math.ceil(3/l));let c=e[0].range.startLineNumber,h=e[0].range.endLineNumber;for(let u=1,g=e.length;u<g;u++){const p=e[u].range;h+d>=p.startLineNumber?p.endLineNumber>h&&(h=p.endLineNumber):(o.push({range:new x(c,1,h,1),options:Ci._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),c=p.startLineNumber,h=p.endLineNumber)}o.push({range:new x(c,1,h,1),options:Ci._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,l=e.length;a<l;a++)r[a]={range:e[a].range,options:s};this._decorations=i.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,o),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(a=>i.removeDecoration(a)),this._findScopeDecorationIds=[]),t?.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,Ci._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],s=this._editor.getModel().getDecorationRange(i);if(!(!s||s.endLineNumber>e.lineNumber)){if(s.endLineNumber<e.lineNumber)return s;if(!(s.endColumn>e.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;t<i;t++){const s=this._decorations[t],o=this._editor.getModel().getDecorationRange(s);if(!(!o||o.startLineNumber<e.lineNumber)){if(o.startLineNumber>e.lineNumber)return o;if(!(o.startColumn<e.column))return o}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}static{this._CURRENT_FIND_MATCH_DECORATION=oe.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:nt(zh),position:ln.Center},minimap:{color:nt(vv),position:1}})}static{this._FIND_MATCH_DECORATION=oe.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:nt(zh),position:ln.Center},minimap:{color:nt(vv),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=oe.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=oe.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:nt(zh),position:ln.Center}})}static{this._RANGE_HIGHLIGHT_DECORATION=oe.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=oe.register({description:"find-scope",className:"findScope",isWholeLine:!0})}},mk=class{constructor(n,e,t){this._editorSelection=n,this._ranges=e,this._replaceStrings=t,this._trackedEditorSelectionId=null}getEditOperations(n,e){if(this._ranges.length>0){const t=[];for(let o=0;o<this._ranges.length;o++)t.push({range:this._ranges[o],text:this._replaceStrings[o]});t.sort((o,r)=>x.compareRangesUsingStarts(o.range,r.range));const i=[];let s=t[0];for(let o=1;o<t.length;o++)s.range.endLineNumber===t[o].range.startLineNumber&&s.range.endColumn===t[o].range.startColumn?(s.range=s.range.plusRange(t[o].range),s.text=s.text+t[o].text):(i.push(s),s=t[o]);i.push(s);for(const o of i)e.addEditOperation(o.range,o.text)}this._trackedEditorSelectionId=e.trackSelection(this._editorSelection)}computeCursorState(n,e){return e.getTrackedSelection(this._trackedEditorSelectionId)}};function Qy(n,e){if(n&&n[0]!==""){const t=cb(n,e,"-"),i=cb(n,e,"_");return t&&!i?hb(n,e,"-"):!t&&i?hb(n,e,"_"):n[0].toUpperCase()===n[0]?e.toUpperCase():n[0].toLowerCase()===n[0]?e.toLowerCase():MT(n[0][0])&&e.length>0?e[0].toUpperCase()+e.substr(1):n[0][0].toUpperCase()!==n[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function cb(n,e,t){return n[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&n[0].split(t).length===e.split(t).length}function hb(n,e,t){const i=e.split(t),s=n[0].split(t);let o="";return i.forEach((r,a)=>{o+=Qy([s[a]],r)+t}),o.slice(0,-1)}var ub=class{constructor(n){this.staticValue=n,this.kind=0}},_k=class{constructor(n){this.pieces=n,this.kind=1}},u_=class Og{static fromStaticValue(e){return new Og([Rd.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new ub(""):e.length===1&&e[0].staticValue!==null?this._state=new ub(e[0].staticValue):this._state=new _k(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?Qy(e,this._state.staticValue):this._state.staticValue;let i="";for(let s=0,o=this._state.pieces.length;s<o;s++){const r=this._state.pieces[s];if(r.staticValue!==null){i+=r.staticValue;continue}let a=Og._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const l=[],d=r.caseOps.length;let c=0;for(let h=0,u=a.length;h<u;h++){if(c>=d){l.push(a.slice(h));break}switch(r.caseOps[c]){case"U":l.push(a[h].toUpperCase());break;case"u":l.push(a[h].toUpperCase()),c++;break;case"L":l.push(a[h].toLowerCase());break;case"l":l.push(a[h].toLowerCase()),c++;break;default:l.push(a[h])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e<t.length)return(t[e]||"")+i;i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}},Rd=class Ag{static staticValue(e){return new Ag(e,-1,null)}static caseOps(e,t){return new Ag(null,e,t)}constructor(e,t,i){this.staticValue=e,this.matchIndex=t,!i||i.length===0?this.caseOps=null:this.caseOps=i.slice(0)}},vk=class{constructor(n){this._source=n,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(n){this._emitStatic(this._source.substring(this._lastCharIndex,n)),this._lastCharIndex=n}emitStatic(n,e){this._emitStatic(n),this._lastCharIndex=e}_emitStatic(n){n.length!==0&&(this._currentStaticPiece+=n)}emitMatchIndex(n,e,t){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Rd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Rd.caseOps(n,t),this._lastCharIndex=e}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Rd.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new u_(this._result)}};function bk(n){if(!n||n.length===0)return new u_(null);const e=[],t=new vk(n);for(let i=0,s=n.length;i<s;i++){const o=n.charCodeAt(i);if(o===92){if(i++,i>=s)break;const r=n.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
|
|
8
|
+
`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(r))}continue}if(o===36){if(i++,i>=s)break;const r=n.charCodeAt(i);if(r===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(r===48||r===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=r&&r<=57){let a=r-48;if(i+1<s){const l=n.charCodeAt(i+1);if(48<=l&&l<=57){i++,a=a*10+(l-48),t.emitUnchanged(i-2),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}t.emitUnchanged(i-1),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}}return t.finalize()}var jn=new ae("findWidgetVisible",!1);jn.toNegated();var Sh=new ae("findInputFocussed",!1),g_=new ae("replaceInputFocussed",!1),Ck=new ae("findWidgetFocused",!1),Bl={primary:545,mac:{primary:2593}},Ul={primary:565,mac:{primary:2613}},zl={primary:560,mac:{primary:2608}},jl={primary:554,mac:{primary:2602}},ql={primary:558,mac:{primary:2606}},Ne={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},ex=19999,Sk=240,wk=class Td{constructor(e,t){this._toDispose=new O,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new vl,this._decorations=new fk(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new at(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Pt(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},Sk)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let l=a.endLineNumber;return a.endColumn===1&&(l=l-1),new x(a.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return a}));const s=this._findMatches(i,!1,ex);this._decorations.set(s,i);const o=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(o);if(r===0&&s.length>0){const a=JS(s.map(l=>l.range),l=>x.compareRangesUsingStarts(l,o)>=0);r=a>0?a-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),e&&this._editor.getOption(50).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:s}=e;const o=this._editor.getModel();return t||s===1?(i===1?i=o.getLineCount():i--,s=o.getLineMaxColumn(i)):s--,new B(i,s)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const c=this._decorations.matchAfterPosition(e);c&&this._setCurrentFindMatch(c);return}if(this._decorations.getCount()<19999){let c=this._decorations.matchBeforePosition(e);c&&c.isEmpty()&&c.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),c=this._decorations.matchBeforePosition(e)),c&&this._setCurrentFindMatch(c);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),s=Td._getSearchRange(this._editor.getModel(),i);s.getEndPosition().isBefore(e)&&(e=s.getEndPosition()),e.isBefore(s.getStartPosition())&&(e=s.getEndPosition());const{lineNumber:o,column:r}=e,a=this._editor.getModel();let l=new B(o,r),d=a.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(d&&d.range.isEmpty()&&d.range.getStartPosition().equals(l)&&(l=this._prevSearchPosition(l),d=a.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),!!d){if(!t&&!s.containsRange(d.range))return this._moveToPrevMatch(d.range.getStartPosition(),!0);this._setCurrentFindMatch(d.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:s}=e;const o=this._editor.getModel();return t||s===o.getLineMaxColumn(i)?(i===o.getLineCount()?i=1:i++,s=1):s++,new B(i,s)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<19999){let i=this._decorations.matchAfterPosition(e);i&&i.isEmpty()&&i.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),i=this._decorations.matchAfterPosition(e)),i&&this._setCurrentFindMatch(i);return}const t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(e,t,i,s=!1){if(this._cannotFind())return null;const o=this._decorations.getFindScope(),r=Td._getSearchRange(this._editor.getModel(),o);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:l}=e,d=this._editor.getModel();let c=new B(a,l),h=d.findNextMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t);return i&&h&&h.range.isEmpty()&&h.range.getStartPosition().equals(c)&&(c=this._nextSearchPosition(c),h=d.findNextMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t)),h?!s&&!r.containsRange(h.range)?this._getNextMatch(h.range.getEndPosition(),t,i,!0):h:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(e){const t=this._decorations.getDecorationRangeAt(e);t&&this._setCurrentFindMatch(t)}moveToMatch(e){this._moveToMatch(e)}_getReplacePattern(){return this._state.isRegex?bk(this._state.replaceString):u_.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const e=this._getReplacePattern(),t=this._editor.getSelection(),i=this._getNextMatch(t.getStartPosition(),!0,!1);if(i)if(t.equalsRange(i.range)){const s=e.buildReplaceString(i.matches,this._state.preserveCase),o=new Ll(t,s);this._executeEditorCommand("replace",o),this._decorations.setStartPosition(new B(t.startLineNumber,t.startColumn+s.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(i.range)}_findMatches(e,t,i){const s=(e||[null]).map(o=>Td._getSearchRange(this._editor.getModel(),o));return this._editor.getModel().findMatches(this._state.searchString,s,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=19999?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const e=new l0(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!e)return;let t=e.regex;if(!t.multiline){let c="mu";t.ignoreCase&&(c+="i"),t.global&&(c+="g"),t=new RegExp(t.source,c)}const i=this._editor.getModel(),s=i.getValue(1),o=i.getFullModelRange(),r=this._getReplacePattern();let a;const l=this._state.preserveCase;r.hasReplacementPatterns||l?a=s.replace(t,function(){return r.buildReplaceString(arguments,l)}):a=s.replace(t,r.buildReplaceString(null,l));const d=new Uw(o,a,this._editor.getSelection());this._executeEditorCommand("replaceAll",d)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),s=[];for(let r=0,a=i.length;r<a;r++)s[r]=t.buildReplaceString(i[r].matches,this._state.preserveCase);const o=new mk(this._editor.getSelection(),i.map(r=>r.range),s);this._executeEditorCommand("replaceAll",o)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let t=this._findMatches(e,!1,1073741824).map(s=>new ie(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const i=this._editor.getSelection();for(let s=0,o=t.length;s<o;s++)if(t[s].equalsRange(i)){t=[i].concat(t.slice(0,s)).concat(t.slice(s+1));break}this._editor.setSelections(t)}_executeEditorCommand(e,t){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(e,t),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}},yk=m(5,"input"),xk=m(6,"Preserve Case"),Ik=class extends ew{constructor(n){super({icon:V.preserveCase,title:xk+n.appendTitle,isChecked:n.isChecked,hoverLifecycleOptions:n.hoverLifecycleOptions,inputActiveOptionBorder:n.inputActiveOptionBorder,inputActiveOptionForeground:n.inputActiveOptionForeground,inputActiveOptionBackground:n.inputActiveOptionBackground})}},Lk=class extends Il{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}constructor(n,e,t,i){super(),this._showOptionButtons=t,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new ee),this._onKeyDown=this._register(new ee),this._onMouseDown=this._register(new ee),this._onInput=this._register(new ee),this._onKeyUp=this._register(new ee),this._onPreserveCaseKeyDown=this._register(new ee),this.contextViewProvider=e,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||yk;const s=i.appendPreserveCaseLabel||"",o=i.history||new Set([]),r=!!i.flexibleHeight,a=!!i.flexibleWidth,l=i.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new nT(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:o,showHistoryHint:i.showHistoryHint,flexibleHeight:r,flexibleWidth:a,flexibleMaxHeight:l,inputBoxStyles:i.inputBoxStyles})),this.preserveCase=this._register(new Ik({appendTitle:s,isChecked:!1,hoverLifecycleOptions:i.hoverLifecycleOptions,...i.toggleStyles})),this._register(this.preserveCase.onChange(h=>{this._onDidOptionChange.fire(h),!h&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(h=>{this._onPreserveCaseKeyDown.fire(h)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const d=[this.preserveCase.domNode];this.onkeydown(this.domNode,h=>{rE(h,this.domNode,()=>d,()=>this.inputBox.focus())});const c=document.createElement("div");c.className="controls",c.style.display=this._showOptionButtons?"block":"none",c.appendChild(this.preserveCase.domNode),this.domNode.appendChild(c),n?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}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(n){n?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(n){this.preserveCase.checked=n}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(n){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=n+"px"}},tx=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ix=function(n,e){return function(t,i){e(t,i,n)}},p_=new ae("suggestWidgetVisible",!1,m(1793,"Whether suggestion are visible")),f_="historyNavigationWidgetFocus",nx="historyNavigationForwardsEnabled",sx="historyNavigationBackwardsEnabled",Da=void 0,$l=[];function ox(n,e){if($l.includes(e))throw new Error("Cannot register the same widget multiple times");$l.push(e);const t=new O,i=new ae(f_,!1).bindTo(n),s=new ae(nx,!0).bindTo(n),o=new ae(sx,!0).bindTo(n),r=()=>{i.set(!0),Da=e},a=()=>{i.set(!1),Da===e&&(Da=void 0)};return zs(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(Te(()=>{$l.splice($l.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:s,historyNavigationBackwardsEnablement:o,dispose(){t.dispose()}}}var Fg=class extends hE{constructor(e,t,i,s){super(e,t,i);const o=this._register(s.createScoped(this.inputBox.element));this._register(ox(o,this.inputBox))}};Fg=tx([ix(3,Ce)],Fg);var Hg=class extends Lk{constructor(e,t,i,s,o=!1){super(e,t,o,i);const r=this._register(s.createScoped(this.inputBox.element));this._register(ox(r,this.inputBox))}};Hg=tx([ix(3,Ce)],Hg);ai.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:k.and(k.has(f_),k.equals(sx,!0),p_.isEqualTo(!1)),primary:16,secondary:[528],handler:n=>{Da?.showPreviousValue()}});ai.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:k.and(k.has(f_),k.equals(nx,!0),p_.isEqualTo(!1)),primary:18,secondary:[530],handler:n=>{Da?.showNextValue()}});function gb(n){return n.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&n.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var pb=Ye("find-collapsed",V.chevronRight,m(1011,"Icon to indicate that the editor find widget is collapsed.")),fb=Ye("find-expanded",V.chevronDown,m(1012,"Icon to indicate that the editor find widget is expanded.")),Dk=Ye("find-selection",V.selection,m(1013,"Icon for 'Find in Selection' in the editor find widget.")),Ek=Ye("find-replace",V.replace,m(1014,"Icon for 'Replace' in the editor find widget.")),Rk=Ye("find-replace-all",V.replaceAll,m(1015,"Icon for 'Replace All' in the editor find widget.")),Tk=Ye("find-previous-match",V.arrowUp,m(1016,"Icon for 'Find Previous' in the editor find widget.")),Pk=Ye("find-next-match",V.arrowDown,m(1017,"Icon for 'Find Next' in the editor find widget.")),kk=m(1018,"Find / Replace"),su=m(1019,"Find"),Nk=m(1020,"Find"),Mk=m(1021,"Previous Match"),Ok=m(1022,"Next Match"),Ak=m(1023,"Find in Selection"),Fk=m(1024,"Close"),ou=m(1025,"Replace"),Hk=m(1026,"Replace"),Wk=m(1027,"Replace"),Vk=m(1028,"Replace All"),Bk=m(1029,"Toggle Replace"),Uk=m(1030,"Only the first {0} results are highlighted, but all find operations work on the entire text.",ex),zk=m(1031,"{0} of {1}"),Wg=m(1032,"No results"),Fs=419,jk=221,Kr=69,qk=33,mb=On?256:2048,ru=class{constructor(n){this.afterLineNumber=n,this.heightInPx=qk,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}};function _b(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){n.stopPropagation();return}}function vb(n,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){n.stopPropagation();return}}var qs=class rx extends Il{static{this.ID="editor.contrib.findWidget"}constructor(e,t,i,s,o,r,a,l,d,c,h){super(),this._hoverService=a,this._findWidgetSearchHistory=l,this._replaceWidgetHistory=d,this._configurationService=c,this._accessibilityService=h,this._cachedHeight=null,this._lastFocusedInputWasReplace=!1,this._lastFocusedElement=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=i,this._contextViewProvider=s,this._keybindingService=o,this._contextKeyService=r,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new bs(500),this._register(Te(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(u=>this._onStateChanged(u))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(u=>{if(u.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),u.hasChanged(166)&&this._tryUpdateWidgetWidth(),u.hasChanged(2)&&this.updateAccessibilitySupport(),u.hasChanged(50)){const g=this._codeEditor.getOption(50).loop;this._state.change({loop:g},!1);const p=this._codeEditor.getOption(50).addExtraSpaceOnTop;p&&!this._viewZone&&(this._viewZone=new ru(0),this._showViewZone()),!p&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const u=await this._controller.getGlobalBufferTerm();u&&u!==this._state.searchString&&(this._state.change({searchString:u},!1),this._findInput.select())}})),this._findInputFocused=Sh.bindTo(r),this._findFocusTracker=this._register(us(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._lastFocusedInputWasReplace=!1,this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=g_.bindTo(r),this._replaceFocusTracker=this._register(us(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._lastFocusedInputWasReplace=!0,this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._findWidgetFocused=Ck.bindTo(r),this._widgetFocusTracker=this._register(us(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register(Q(this._domNode,"focusin",u=>{hi(u.target)&&(this._lastFocusedElement=u.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new ru(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(u=>{if(u.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return rx.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(104)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=Si(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,Le)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=Kr+"px",this._state.matchesCount>=19999?this._matchesCount.title=Uk:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=19999&&(t+="+");let i=String(this._state.matchesPosition);i==="0"&&(i="?"),e=zm(zk,i,t)}else e=Wg;this._matchesCount.appendChild(document.createTextNode(e)),gi(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),Kr=Math.max(Kr,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){let s;if(e===Wg)s=i===""?m(1033,"{0} found",e):m(1034,"{0} found for '{1}'",e,i);else if(t){const o=m(1035,"{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),r=this._codeEditor.getModel();r&&t.startLineNumber<=r.getLineCount()&&t.startLineNumber>=1?s=`${r.getLineContent(t.startLineNumber)}, ${o}`:s=o}else s=m(1036,"{0} found for '{1}'",e,i);return s}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?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 e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(50).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false"),this._updateFindInputAriaLabel()},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const s=Mt(i),o=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),r=s.left+(o?o.left:0),a=o?o.top:0;if(this._viewZone&&a<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);const l=eE(this._domNode).left;r>l&&(t=!1);const d=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());s.left+(d?d.left:0)>l&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._accessibilityHelpHintAnnounced=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const t=this._viewZone;this._viewZoneId!==void 0||!t||this._codeEditor.changeViewZones(i=>{t.heightInPx=this._getHeight(),this._viewZoneId=i.addZone(t),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+t.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new ru(0));const t=this._viewZone;this._codeEditor.changeViewZones(i=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===t.heightInPx)return;const o=s-t.heightInPx;t.heightInPx=s,i.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+o);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(96).top,s<=0)return;t.heightInPx=s,this._viewZoneId=i.addZone(t),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.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||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const t=e.width,i=e.minimap.minimapWidth;let s=!1,o=!1,r=!1;if(this._resized&&Si(this._domNode)>Fs){this._domNode.style.maxWidth=`${t-28-i-15}px`,this._replaceInput.width=Si(this._findInput.domNode);return}if(447+i>=t&&(o=!0),447+i-Kr>=t&&(r=!0),447+i-Kr>=t+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",o),!r&&!s&&(this._domNode.style.maxWidth=`${t-28-i-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:r,reducedFindWidget:o}),this._resized){const a=this._findInput.inputBox.element.clientWidth;a>0&&(this._replaceInput.width=a)}else this._isReplaceVisible&&(this._replaceInput.width=Si(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}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 e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!x.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(mb|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
|
|
9
|
+
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return _b(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return vb(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(mb|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
|
|
10
|
+
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return _b(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return vb(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}_buildDomNode(){const i=this._codeEditor.getOption(50).history,s=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new Fg(null,this._contextViewProvider,{width:jk,label:su,placeholder:Nk,appendCaseSensitiveLabel:this._keybindingLabelFor(Ne.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Ne.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Ne.ToggleRegexCommand),validation:h=>{if(h.length===0||!this._findInput.getRegex())return null;try{return new RegExp(h,"gu"),null}catch(u){return{content:u.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>gb(this._keybindingService),inputBoxStyles:Iv,toggleStyles:bv,history:i==="workspace"?this._findWidgetSearchHistory:new Set([])},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(h=>{h.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(h)})),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType||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(h=>{h.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),h.preventDefault())})),this._register(this._findInput.onRegexKeyDown(h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),h.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(h=>{this._tryUpdateHeight()&&this._showViewZone()})),p0&&this._register(this._findInput.onMouseDown(h=>this._onFindInputMouseDown(h))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const o={groupId:"find-widget"};this._prevBtn=this._register(new $s({label:Mk+this._keybindingLabelFor(Ne.PreviousMatchFindAction),icon:Tk,hoverLifecycleOptions:o,onTrigger:()=>{Go(this._codeEditor.getAction(Ne.PreviousMatchFindAction)).run().then(void 0,Le)}},this._hoverService)),this._nextBtn=this._register(new $s({label:Ok+this._keybindingLabelFor(Ne.NextMatchFindAction),icon:Pk,hoverLifecycleOptions:o,onTrigger:()=>{Go(this._codeEditor.getAction(Ne.NextMatchFindAction)).run().then(void 0,Le)}},this._hoverService));const r=document.createElement("div");r.className="find-part",r.appendChild(this._findInput.domNode);const a=document.createElement("div");a.className="find-actions",r.appendChild(a),a.appendChild(this._matchesCount),a.appendChild(this._prevBtn.domNode),a.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new ew({icon:Dk,title:Ak+this._keybindingLabelFor(Ne.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:o,inputActiveOptionBackground:De(Im),inputActiveOptionBorder:De(lw),inputActiveOptionForeground:De(VS)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let h=this._codeEditor.getSelections();h=h.map(u=>(u.endColumn===1&&u.endLineNumber>u.startLineNumber&&(u=u.setEndPosition(u.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(u.endLineNumber-1))),u.isEmpty()?null:u)).filter(u=>!!u),h.length&&this._state.change({searchScope:h},!0)}}else this._state.change({searchScope:null},!0)})),a.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new $s({label:Fk+this._keybindingLabelFor(Ne.CloseFindWidgetCommand),icon:sw,hoverLifecycleOptions:o,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:h=>{h.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),h.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Hg(null,void 0,{label:ou,placeholder:Hk,appendPreserveCaseLabel:this._keybindingLabelFor(Ne.TogglePreserveCaseCommand),history:s==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>gb(this._keybindingService),inputBoxStyles:Iv,toggleStyles:bv,hoverLifecycleOptions:o},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(h=>this._onReplaceInputKeyDown(h))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(h=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(h=>{h.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(),h.preventDefault())})),this._replaceBtn=this._register(new $s({label:Wk+this._keybindingLabelFor(Ne.ReplaceOneAction),icon:Ek,hoverLifecycleOptions:o,onTrigger:()=>{this._controller.replace()},onKeyDown:h=>{h.equals(1026)&&(this._closeBtn.focus(),h.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new $s({label:Vk+this._keybindingLabelFor(Ne.ReplaceAllAction),icon:Rk,hoverLifecycleOptions:o,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const l=document.createElement("div");l.className="replace-part",l.appendChild(this._replaceInput.domNode);const d=document.createElement("div");d.className="replace-actions",l.appendChild(d),d.appendChild(this._replaceBtn.domNode),d.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new $s({label:Bk,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=Si(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),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=kk,this._domNode.role="dialog",this._domNode.style.width=`${Fs}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(r),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(l),this._resizeSash=this._register(new Xo(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let c=Fs;this._register(this._resizeSash.onDidStart(()=>{c=Si(this._domNode)})),this._register(this._resizeSash.onDidChange(h=>{this._resized=!0;const u=c+h.startX-h.currentX;u<Fs||u>(parseFloat(JR(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${u}px`,this._isReplaceVisible&&(this._replaceInput.width=Si(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const h=Si(this._domNode);if(h<Fs)return;let u=Fs;if(!this._resized||h===Fs){const g=this._codeEditor.getLayoutInfo();u=g.width-28-g.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${u}px`,this._isReplaceVisible&&(this._replaceInput.width=Si(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=su,t=ou;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){const i=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();if(i){const s=m(1037,"Press {0} for accessibility help",i);e=m(1038,"{0}, {1}",e,s),t=m(1039,"{0}, {1}",t,s)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=ji(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(su),this._replaceInput.inputBox.setAriaLabel(ou))},1e3)}this._findInput.inputBox.setAriaLabel(e),this._replaceInput.inputBox.setAriaLabel(t)}getViewState(){let e=!1;return this._viewZone&&this._viewZoneId&&(e=this._viewZone.heightInPx>this._codeEditor.getScrollTop()),{widgetViewZoneVisible:e,scrollTop:this._codeEditor.getScrollTop()}}setViewState(e){e&&e.widgetViewZoneVisible&&this._layoutViewZone(e.scrollTop)}},$s=class extends Il{constructor(n,e){super(),this._opts=n;let t="button";this._opts.className&&(t=t+" "+this._opts.className),this._opts.icon&&(t=t+" "+ce.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=t,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(e.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},n.hoverLifecycleOptions)),this.onclick(this._domNode,i=>{this._opts.onTrigger(),i.preventDefault()}),this.onkeydown(this._domNode,i=>{if(i.equals(10)||i.equals(3)){this._opts.onTrigger(),i.preventDefault();return}this._opts.onKeyDown?.(i)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(n){this._domNode.classList.toggle("disabled",!n),this._domNode.setAttribute("aria-disabled",String(!n)),this._domNode.tabIndex=n?0:-1}setExpanded(n){this._domNode.setAttribute("aria-expanded",String(!!n)),n?(this._domNode.classList.remove(...ce.asClassNameArray(pb)),this._domNode.classList.add(...ce.asClassNameArray(fb))):(this._domNode.classList.remove(...ce.asClassNameArray(fb)),this._domNode.classList.add(...ce.asClassNameArray(pb)))}};pl((n,e)=>{const t=n.getColor(Lw);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Aa(n.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=n.getColor(CR);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Aa(n.type)?"dashed":"solid"} ${i}; }`);const s=n.getColor(cn);s&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${s}; }`);const o=n.getColor(PT);o&&e.addRule(`.monaco-editor .findMatchInline { color: ${o}; }`);const r=n.getColor(FT);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var $k=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},bb=function(n,e){return function(t,i){e(t,i,n)}},Vg=class extends M{constructor(e,t,i,s){super(),this._container=e,this._getContent=t,this._clipboardService=i,this._hoverService=s,this._container.classList.add("hover-row-with-copy"),this._button=this._register(new $s({label:m(1186,"Copy"),icon:V.copy,onTrigger:()=>this._copyContent(),className:"hover-copy-button"},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){const e=this._getContent();e&&(await this._clipboardService.writeText(e),Ss(m(1187,"Copied to clipboard")))}};Vg=$k([bb(2,oi),bb(3,fi)],Vg);var Kk=class{constructor(n,e,t){this.provider=n,this.hover=e,this.ordinal=t}};async function Gk(n,e,t,i,s){const o=await Promise.resolve(n.provideHover(t,i,s)).catch(it);if(!(!o||!Zk(o)))return new Kk(n,o,e)}function m_(n,e,t,i,s=!1){const o=n.ordered(e,s).map((r,a)=>Gk(r,a,e,t,i));return dn.fromPromisesResolveOrder(o).coalesce()}async function ax(n,e,t,i,s=!1){const o=[];for await(const r of m_(n,e,t,i,s))o.push(r.hover);return o}jt("_executeHoverProvider",(n,e,t)=>ax(n.get(X).hoverProvider,e,t,he.None));jt("_executeHoverProvider_recursive",(n,e,t)=>ax(n.get(X).hoverProvider,e,t,he.None,!0));function Zk(n){const e=typeof n.range<"u",t=typeof n.contents<"u"&&n.contents&&n.contents.length>0;return e&&t}var Xk=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ro=function(n,e){return function(t,i){e(t,i,n)}},io=H,Yk=Ye("hover-increase-verbosity",V.addSmall,m(1188,"Icon for increaseing hover verbosity.")),Jk=Ye("hover-decrease-verbosity",V.removeSmall,m(1189,"Icon for decreasing hover verbosity.")),Di=class{constructor(n,e,t,i,s,o=void 0){this.owner=n,this.range=e,this.contents=t,this.isBeforeContent=i,this.ordinal=s,this.source=o}isValidForHoverAnchor(n){return n.type===1&&this.range.startColumn<=n.range.startColumn&&this.range.endColumn>=n.range.endColumn}},lx=class{constructor(n,e,t){this.hover=n,this.hoverProvider=e,this.hoverPosition=t}supportsVerbosityAction(n){switch(n){case ui.Increase:return this.hover.canIncreaseVerbosity??!1;case ui.Decrease:return this.hover.canDecreaseVerbosity??!1}}},Ja=class{constructor(e,t,i,s,o,r,a){this._editor=e,this._markdownRendererService=t,this._configurationService=i,this._languageFeaturesService=s,this._keybindingService=o,this._hoverService=r,this._commandService=a,this.hoverOrdinal=3}createLoadingMessage(e){return new Di(this,e.range,[new St().appendText(m(1190,"Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),s=e.range.startLineNumber,o=i.getLineMaxColumn(s),r=[];let a=1e3;const l=i.getLineLength(s),d=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),c=this._editor.getOption(133),h=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:d}),u=this._editor.getOption(69).showLongLineWarning;let g=!1;c>=0&&l>c&&e.range.startColumn>=c&&(g=!0,u&&r.push(new Di(this,e.range,[{value:m(1191,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`. [Don't Show Again](command:{0})",Rg),isTrusted:!0}],!1,a++))),!g&&typeof h=="number"&&l>=h&&u&&r.push(new Di(this,e.range,[{value:m(1192,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`. [Don't Show Again](command:{0})",Rg),isTrusted:!0}],!1,a++));let p=!1;for(const f of t){const _=f.range.startLineNumber===s?f.range.startColumn:1,v=f.range.endLineNumber===s?f.range.endColumn:o,C=f.options.hoverMessage;if(!C||Ha(C))continue;f.options.beforeContentClassName&&(p=!0);const w=new x(e.range.startLineNumber,_,e.range.startLineNumber,v);r.push(new Di(this,w,Aw(C),p,a++))}return r}computeAsync(e,t,i,s){if(!this._editor.hasModel()||e.type!==1)return dn.EMPTY;const o=this._editor.getModel(),r=this._languageFeaturesService.hoverProvider;return r.has(o)?this._getMarkdownHovers(r,o,e,s):dn.EMPTY}async*_getMarkdownHovers(e,t,i,s){const o=i.range.getStartPosition(),r=m_(e,t,o,s);for await(const a of r)if(!Ha(a.hover.contents)){const l=a.hover.range?x.lift(a.hover.range):i.range,d=new lx(a.hover,a.provider,o);yield new Di(this,l,a.hover.contents,!1,a.ordinal,d)}}renderHoverParts(e,t){return this._renderedHoverParts=new Qk(t,e.fragment,this,this._editor,this._commandService,this._keybindingService,this._hoverService,this._configurationService,this._markdownRendererService,e.onContentsChanged),this._renderedHoverParts}handleScroll(e){this._renderedHoverParts?.handleScroll(e)}getAccessibleContent(e){return this._renderedHoverParts?.getAccessibleContent(e)??""}updateMarkdownHoverVerbosityLevel(e,t){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e,t))}};Ja=Xk([Ro(1,Es),Ro(2,Ee),Ro(3,X),Ro(4,He),Ro(5,fi),Ro(6,ht)],Ja);var Kl=class{constructor(n,e,t,i){this.hoverPart=n,this.hoverElement=e,this.disposables=t,this.actionsContainer=i}dispose(){this.disposables.dispose()}},Qk=class{constructor(n,e,t,i,s,o,r,a,l,d){this._hoverParticipant=t,this._editor=i,this._commandService=s,this._keybindingService=o,this._hoverService=r,this._configurationService=a,this._markdownRendererService=l,this._onFinishedRendering=d,this._ongoingHoverOperations=new Map,this._disposables=new O,this.renderedHoverParts=this._renderHoverParts(n,e,this._onFinishedRendering),this._disposables.add(Te(()=>{this.renderedHoverParts.forEach(c=>{c.dispose()}),this._ongoingHoverOperations.forEach(c=>{c.tokenSource.dispose(!0)})}))}_renderHoverParts(n,e,t){return n.sort(ao(i=>i.ordinal,ro)),n.map(i=>{const s=this._renderHoverPart(i,t);return e.appendChild(s.hoverElement),s})}_renderHoverPart(n,e){const t=this._renderMarkdownHover(n,e),i=t.hoverElement,s=n.source,o=new O;if(o.add(t),!s)return new Kl(n,i,o);const r=s.supportsVerbosityAction(ui.Increase),a=s.supportsVerbosityAction(ui.Decrease);if(!r&&!a)return new Kl(n,i,o);const l=io("div.verbosity-actions");i.prepend(l);const d=io("div.verbosity-actions-inner");return l.append(d),o.add(this._renderHoverExpansionAction(d,ui.Increase,r)),o.add(this._renderHoverExpansionAction(d,ui.Decrease,a)),new Kl(n,i,o,d)}_renderMarkdownHover(n,e){return dx(this._editor,n,this._markdownRendererService,e)}_renderHoverExpansionAction(n,e,t){const i=new O,s=e===ui.Increase,o=U(n,io(ce.asCSSSelector(s?Yk:Jk)));o.tabIndex=0;const r=i.add(new vR("mouse",void 0,{target:n,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(i.add(this._hoverService.setupManagedHover(r,o,tN(this._keybindingService,e))),!t)return o.classList.add("disabled"),i;o.classList.add("enabled");const a=()=>this._commandService.executeCommand(e===ui.Increase?r_:a_,{focus:!0});return i.add(new IR(o,a)),i.add(new RT(o,a,[3,10])),i}handleScroll(n){this.renderedHoverParts.forEach(e=>{const t=e.actionsContainer;if(!t)return;const i=e.hoverElement,s=n.scrollTop+n.height,o=i.offsetTop,r=i.clientHeight,a=o+r,l=22;let d;a<=s||o>=s?d=r-l:d=s-o-l,t.style.top=`${d}px`})}async updateMarkdownHoverPartVerbosityLevel(n,e){const t=this._editor.getModel();if(!t)return;const i=this._getRenderedHoverPartAtIndex(e),s=i?.hoverPart.source;if(!i||!s?.supportsVerbosityAction(n))return;const o=await this._fetchHover(s,t,n);if(!o)return;const r=new lx(o,s.hoverProvider,s.hoverPosition),a=i.hoverPart,l=new Di(this._hoverParticipant,a.range,o.contents,a.isBeforeContent,a.ordinal,r),d=this._updateRenderedHoverPart(e,l);if(d)return{hoverPart:l,hoverElement:d.hoverElement}}getAccessibleContent(n){const e=this.renderedHoverParts.findIndex(i=>i.hoverPart===n);if(e===-1)return;const t=this._getRenderedHoverPartAtIndex(e);if(t)return t.hoverElement.innerText.replace(/[^\S\n\r]+/gu," ")}async _fetchHover(n,e,t){let i=t===ui.Increase?1:-1;const s=n.hoverProvider,o=this._ongoingHoverOperations.get(s);o&&(o.tokenSource.cancel(),i+=o.verbosityDelta);const r=new ot;this._ongoingHoverOperations.set(s,{verbosityDelta:i,tokenSource:r});const a={verbosityRequest:{verbosityDelta:i,previousHover:n.hover}};let l;try{l=await Promise.resolve(s.provideHover(e,n.hoverPosition,r.token,a))}catch(d){it(d)}return r.dispose(),this._ongoingHoverOperations.delete(s),l}_updateRenderedHoverPart(n,e){if(n>=this.renderedHoverParts.length||n<0)return;const t=this._renderHoverPart(e,this._onFinishedRendering),i=this.renderedHoverParts[n],s=i.hoverElement,o=t.hoverElement,r=Array.from(o.children);s.replaceChildren(...r);const a=new Kl(e,s,t.disposables,t.actionsContainer);return i.dispose(),this.renderedHoverParts[n]=a,a}_getRenderedHoverPartAtIndex(n){return this.renderedHoverParts[n]}dispose(){this._disposables.dispose()}};function eN(n,e,t,i){e.sort(ao(o=>o.ordinal,ro));const s=[];for(const o of e){const r=dx(t,o,i,n.onContentsChanged);n.fragment.appendChild(r.hoverElement),s.push(r)}return new po(s)}function dx(n,e,t,i){const s=new O,o=io("div.hover-row"),r=io("div.hover-row-contents");o.appendChild(r);const a=e.contents;for(const l of a){if(Ha(l))continue;const d=io("div.markdown-hover"),c=U(d,io("div.hover-contents")),h=s.add(t.render(l,{context:n,asyncRenderCallback:()=>{c.className="hover-contents code-hover-contents",i()}}));c.appendChild(h.element),r.appendChild(d)}return{hoverPart:e,hoverElement:o,dispose(){s.dispose()}}}function tN(n,e){switch(e){case ui.Increase:return n.appendKeybinding(m(1193,"Increase Hover Verbosity"),r_);case ui.Decrease:return n.appendKeybinding(m(1194,"Decrease Hover Verbosity"),a_)}}var Cb=H,iN=class extends M{constructor(n,e,t){super(),this.model=e,this.pixelRatio=t,this._onDidChange=this._register(new ee),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new ee),this.onColorFlushed=this._onColorFlushed.event,this._domNode=Cb(".saturation-wrap"),U(n,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",U(this._domNode,this._canvas),this.selection=Cb(".saturation-selection"),U(this._domNode,this.selection),this.layout(),this._register(Q(this._domNode,we.POINTER_DOWN,i=>this.onPointerDown(i))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(n){if(!n.target||!(n.target instanceof Element))return;this.monitor=this._register(new WS);const e=Mt(this._domNode);n.target!==this.selection&&this.onDidChangePosition(n.offsetX,n.offsetY),this.monitor.startMonitoring(n.target,n.pointerId,n.buttons,i=>this.onDidChangePosition(i.pageX-e.left,i.pageY-e.top),()=>null);const t=Q(n.target.ownerDocument,we.POINTER_UP,()=>{this._onColorFlushed.fire(),t.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(n,e){const t=Math.max(0,Math.min(1,n/this.width)),i=Math.max(0,Math.min(1,1-e/this.height));this.paintSelection(t,i),this._onDidChange.fire({s:t,v:i})}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 n=this.model.color.hsva;this.paintSelection(n.s,n.v)}paint(){const n=this.model.color.hsva,e=new ve(new wd(n.h,1,1,1)),t=this._canvas.getContext("2d"),i=t.createLinearGradient(0,0,this._canvas.width,0);i.addColorStop(0,"rgba(255, 255, 255, 1)"),i.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),i.addColorStop(1,"rgba(255, 255, 255, 0)");const s=t.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),t.rect(0,0,this._canvas.width,this._canvas.height),t.fillStyle=ve.Format.CSS.format(e),t.fill(),t.fillStyle=i,t.fill(),t.fillStyle=s,t.fill()}paintSelection(n,e){this.selection.style.left=`${n*this.width}px`,this.selection.style.top=`${this.height-e*this.height}px`}onDidChangeColor(n){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const e=n.hsva;this.paintSelection(e.s,e.v)}},nN=class extends M{constructor(n){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=U(n,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(Q(this._button,we.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}},Gr=H,cx=class extends M{constructor(n,e,t){super(),this.model=e,this._onDidChange=this._register(new ee),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new ee),this.onColorFlushed=this._onColorFlushed.event,t==="standalone"?(this.domNode=U(n,Gr(".standalone-strip")),this.overlay=U(this.domNode,Gr(".standalone-overlay"))):(this.domNode=U(n,Gr(".strip")),this.overlay=U(this.domNode,Gr(".overlay"))),this.slider=U(this.domNode,Gr(".slider")),this.slider.style.top="0px",this._register(Q(this.domNode,we.POINTER_DOWN,i=>this.onPointerDown(i))),this._register(e.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const n=this.getValue(this.model.color);this.updateSliderPosition(n)}onDidChangeColor(n){const e=this.getValue(n);this.updateSliderPosition(e)}onPointerDown(n){if(!n.target||!(n.target instanceof Element))return;const e=this._register(new WS),t=Mt(this.domNode);this.domNode.classList.add("grabbing"),n.target!==this.slider&&this.onDidChangeTop(n.offsetY),e.startMonitoring(n.target,n.pointerId,n.buttons,s=>this.onDidChangeTop(s.pageY-t.top),()=>null);const i=Q(n.target.ownerDocument,we.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),e.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(n){const e=Math.max(0,Math.min(1,1-n/this.height));this.updateSliderPosition(e),this._onDidChange.fire(e)}updateSliderPosition(n){this.slider.style.top=`${(1-n)*this.height}px`}},sN=class extends cx{constructor(n,e,t){super(n,e,t),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(n){super.onDidChangeColor(n);const{r:e,g:t,b:i}=n.rgba,s=new ve(new vr(e,t,i,1)),o=new ve(new vr(e,t,i,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${o} 100%)`}getValue(n){return n.hsva.a}},oN=class extends cx{constructor(n,e,t){super(n,e,t),this.domNode.classList.add("hue-strip")}getValue(n){return 1-n.hsva.h/360}},rN=H,aN=class extends M{constructor(n,e,t,i){super(),this.model=e,this.pixelRatio=t,this._insertButton=null,this._domNode=rN(".colorpicker-body"),U(n,this._domNode),this._saturationBox=new iN(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 sN(this._domNode,this.model,i),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new oN(this._domNode,this.model,i),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),i==="standalone"&&(this._insertButton=this._register(new nN(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:n,v:e}){const t=this.model.color.hsva;this.model.color=new ve(new wd(t.h,n,e,t.a))}onDidOpacityChange(n){const e=this.model.color.hsva;this.model.color=new ve(new wd(e.h,e.s,e.v,n))}onDidHueChange(n){const e=this.model.color.hsva,t=(1-n)*360;this.model.color=new ve(new wd(t===360?0:t,e.s,e.v,e.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()}},lN=H,dN=class extends M{constructor(n){super(),this._onClicked=this._register(new ee),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),U(n,this._button);const e=document.createElement("div");e.classList.add("close-button-inner-div"),U(this._button,e),U(e,lN(".button"+ce.asCSSSelector(Ye("color-picker-close",V.close,m(936,"Icon to close the color picker"))))).classList.add("close-icon"),this._register(Q(this._button,we.CLICK,()=>{this._onClicked.fire()}))}},Gl=H,cN=class extends M{constructor(n,e,t,i){super(),this.model=e,this.type=i,this._closeButton=null,this._domNode=Gl(".colorpicker-header"),U(n,this._domNode),this._pickedColorNode=U(this._domNode,Gl(".picked-color")),U(this._pickedColorNode,Gl("span.codicon.codicon-color-mode")),this._pickedColorPresentation=U(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=m(937,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=U(this._domNode,Gl(".original-color")),this._originalColorNode.style.backgroundColor=ve.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=t.getColorTheme().getColor(dg)||ve.white,this._register(t.onDidColorThemeChange(o=>{this.backgroundColor=o.getColor(dg)||ve.white})),this._register(Q(this._pickedColorNode,we.CLICK,()=>this.model.selectNextColorPresentation())),this._register(Q(this._originalColorNode,we.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(e.onDidChangeColor(this.onDidChangeColor,this)),this._register(e.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=ve.Format.CSS.format(e.color)||"",this._pickedColorNode.classList.toggle("light",e.color.rgba.a<.5?this.backgroundColor.isLighter():e.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone"&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new dN(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(n){this._pickedColorNode.style.backgroundColor=ve.Format.CSS.format(n)||"",this._pickedColorNode.classList.toggle("light",n.rgba.a<.5?this.backgroundColor.isLighter():n.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}},hN=H,hx=class extends Il{constructor(n,e,t,i,s){super(),this.model=e,this.pixelRatio=t,this._register(sT.getInstance(Nt(n)).onDidChange(()=>this.layout())),this._domNode=hN(".colorpicker-widget"),n.appendChild(this._domNode),this.header=this._register(new cN(this._domNode,this.model,i,s)),this.body=this._register(new aN(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}},uN=class extends M{get color(){return this._color}set color(n){this._color.equals(n)||(this._color=n,this._onDidChangeColor.fire(n))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(n){this._colorPresentations=n,this.presentationIndex>n.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(n,e,t){super(),this.presentationIndex=t,this._onColorFlushed=this._register(new ee),this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=this._register(new ee),this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=this._register(new ee),this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=n,this._color=n,this._colorPresentations=e}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(n,e){let t=-1;for(let i=0;i<this.colorPresentations.length;i++)if(e.toLowerCase()===this.colorPresentations[i].label){t=i;break}if(t===-1){const i=e.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(i)){t=s;break}}t!==-1&&t!==this.presentationIndex&&(this.presentationIndex=t,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}};async function ux(n,e,t){const i=n.getValueInRange(e.range),{red:s,green:o,blue:r,alpha:a}=e.color,l=new vr(Math.round(s*255),Math.round(o*255),Math.round(r*255),a),d=new ve(l),c=await jy(n,e,t,he.None),h=new uN(d,[],0);return h.colorPresentations=c||[],h.guessColorPresentation(d,i),{range:x.lift(e.range),model:h,provider:t}}function gx(n,e,t,i){const s=[],o=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};t.presentation.additionalTextEdits&&s.push(...t.presentation.additionalTextEdits);const r=x.lift(o.range),a=n.getModel()._setTrackedRange(null,r,3);return i?s.push(...i.map(l=>({range:l,text:o.text,forceMoveMarkers:!1}))):s.push(o),n.executeEdits("colorpicker",s),n.pushUndoStop(),n.getModel()._getTrackedRange(a)??r}async function Qa(n,e,t,i,s){e.colorPresentations=await jy(n,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},s.provider,he.None)||[]}var gN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},pN=function(n,e){return function(t,i){e(t,i,n)}},Bg=class px{constructor(e,t,i,s){this.owner=e,this.range=t,this.model=i,this.provider=s,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}static fromBaseColor(e,t){return new px(e,t.range,t.model,t.provider)}},fc=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t,i){return[]}computeAsync(e,t,i,s){return dn.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];if(!this._isValidRequest(i))return[];const s=Cr.get(this._editor);if(!s)return[];for(const o of t){if(!s.isColorDecoration(o))continue;const r=s.getColorData(o.range.getStartPosition());if(r)return[Bg.fromBaseColor(this,await ux(this._editor.getModel(),r.colorInfo,r.provider))]}return[]}_isValidRequest(e){const t=this._editor.getOption(169);switch(e){case 0:return t==="hover"||t==="clickAndHover";case 1:return t==="click"||t==="clickAndHover";case 2:return!0}}renderHoverParts(e,t){const i=this._editor;if(t.length===0||!i.hasModel())return new po([]);const s=i.getOption(75)+8;e.setMinimumDimensions(new Pe(302,s));const o=new O,r=t[0],a=i.getModel(),l=r.model;this._colorPicker=o.add(new hx(e.fragment,l,i.getOption(164),this._themeService,"hover"));let d=!1,c=new x(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);o.add(l.onColorFlushed(async u=>{await Qa(a,l,u,c,r),d=!0,c=gx(i,c,l)})),o.add(l.onDidChangeColor(u=>{Qa(a,l,u,c,r)})),o.add(i.onDidChangeModelContent(u=>{d?d=!1:(e.hide(),i.focus())}));const h={hoverPart:Bg.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){o.dispose()}};return new po([h])}getAccessibleContent(e){return m(938,"There is a color picker here.")}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};fc=gN([pN(1,Dt)],fc);function Ug(n,e){return!!n[e]}var au=class{constructor(n,e){this.target=n.target,this.isLeftClick=n.event.leftButton,this.isMiddleClick=n.event.middleButton,this.isRightClick=n.event.rightButton,this.mouseMiddleClickAction=e.mouseMiddleClickAction,this.hasTriggerModifier=Ug(n.event,e.triggerModifier),this.isMiddleClick&&e.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=Ug(n.event,e.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=n.event.detail<=1}},Sb=class{constructor(n,e){this.keyCodeIsTriggerKey=n.keyCode===e.triggerKey,this.keyCodeIsSideBySideKey=n.keyCode===e.triggerSideBySideKey,this.hasTriggerModifier=Ug(n,e.triggerModifier)}},Zl=class{constructor(n,e,t,i,s){this.mouseMiddleClickAction=s,this.triggerKey=n,this.triggerModifier=e,this.triggerSideBySideKey=t,this.triggerSideBySideModifier=i}equals(n){return this.triggerKey===n.triggerKey&&this.triggerModifier===n.triggerModifier&&this.triggerSideBySideKey===n.triggerSideBySideKey&&this.triggerSideBySideModifier===n.triggerSideBySideModifier&&this.mouseMiddleClickAction===n.mouseMiddleClickAction}};function wb(n,e){return n==="altKey"?On?new Zl(57,"metaKey",6,"altKey",e):new Zl(5,"ctrlKey",6,"altKey",e):On?new Zl(6,"altKey",57,"metaKey",e):new Zl(6,"altKey",5,"ctrlKey",e)}var wh=class extends M{constructor(n,e){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new ee),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new ee),this.onExecute=this._onExecute.event,this._onCancel=this._register(new ee),this.onCancel=this._onCancel.event,this._editor=n,this._extractLineNumberFromMouseEvent=e?.extractLineNumberFromMouseEvent??(t=>t.target.position?t.target.position.lineNumber:0),this._opts=wb(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(t=>{if(t.hasChanged(86)||t.hasChanged(87)){const i=wb(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(i))return;this._opts=i,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(t=>this._onEditorMouseMove(new au(t,this._opts)))),this._register(this._editor.onMouseDown(t=>this._onEditorMouseDown(new au(t,this._opts)))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(new au(t,this._opts)))),this._register(this._editor.onKeyDown(t=>this._onEditorKeyDown(new Sb(t,this._opts)))),this._register(this._editor.onKeyUp(t=>this._onEditorKeyUp(new Sb(t,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(t=>this._onDidChangeCursorSelection(t))),this._register(this._editor.onDidChangeModel(t=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(t=>{(t.scrollTopChanged||t.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(n){n.selection&&n.selection.startColumn!==n.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(n){this._lastMouseMoveEvent=n,this._onMouseMoveOrRelevantKeyDown.fire([n,null])}_onEditorMouseDown(n){this._hasTriggerKeyOnMouseDown=n.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(n)}_onEditorMouseUp(n){const e=this._extractLineNumberFromMouseEvent(n);this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===e&&(this._hasTriggerKeyOnMouseDown||n.isMiddleClick&&n.mouseMiddleClickAction==="openLink")&&this._onExecute.fire(n)}_onEditorKeyDown(n){this._lastMouseMoveEvent&&(n.keyCodeIsTriggerKey||n.keyCodeIsSideBySideKey&&n.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,n]):n.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(n){n.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}},fx=class{constructor(n,e){this.range=n,this.direction=e}},fN=class mx{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new mx(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=t?.tooltip??this.hint.tooltip,this.hint.label=t?.label??this.hint.label,this.hint.textEdits=t?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(t){it(t),this._isResolved=!1}}},_x=class Pd{static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(e,t,i,s){const o=[],r=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const d=await a.provideInlayHints(t,l,s);(d?.hints.length||a.onDidChangeInlayHints)&&o.push([d??Pd._emptyInlayHintList,a])}catch(d){it(d)}}));if(await Promise.all(r.flat()),s.isCancellationRequested||t.isDisposed())throw new Bm;return new Pd(i,o,t)}constructor(e,t,i){this._disposables=new O,this.ranges=e,this.provider=new Set;const s=[];for(const[o,r]of t){this._disposables.add(o),this.provider.add(r);for(const a of o.hints){const l=i.validatePosition(a.position);let d="before";const c=Pd._getRangeAtPosition(i,l);let h;c.getStartPosition().isBefore(l)?(h=x.fromPositions(c.getStartPosition(),l),d="after"):(h=x.fromPositions(l,c.getEndPosition()),d="before"),s.push(new fN(a,new fx(h,d),r))}}this.items=s.sort((o,r)=>B.compare(o.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,s=e.getWordAtPosition(t);if(s)return new x(i,s.startColumn,i,s.endColumn);e.tokenization.tokenizeIfCheap(i);const o=e.tokenization.getLineTokens(i),r=t.column-1,a=o.findTokenIndexAtOffset(r);let l=o.getStartOffset(a),d=o.getEndOffset(a);return d-l===1&&(l===r&&a>1?(l=o.getStartOffset(a-1),d=o.getEndOffset(a-1)):d===r&&a<o.getCount()-1&&(l=o.getStartOffset(a+1),d=o.getEndOffset(a+1))),new x(i,l+1,i,d+1)}};function mN(n){return NS(n.id,...n.arguments??[]).toString()}var _N=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Yi=function(n,e){return function(t,i){e(t,i,n)}},un=class extends Um{constructor(e,t,i,s,o,r,a,l,d,c,h,u,g,p){super(e,{...s.getRawOptions(),overflowWidgetsDomNode:s.getOverflowWidgetsDomNode()},i,o,r,a,l,d,c,h,u,g,p),this._parentEditor=s,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(s.onDidChangeConfiguration(f=>this._onParentConfigurationChanged(f)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Gm(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};un=_N([Yi(4,ne),Yi(5,Ze),Yi(6,ht),Yi(7,Ce),Yi(8,Dt),Yi(9,Rt),Yi(10,So),Yi(11,ct),Yi(12,X),Yi(13,Qc)],un);function vx(n){const e=n.get(Ze).getFocusedCodeEditor();return e instanceof un?e.getParentEditor():e}var yb=new ve(new vr(0,122,204)),vN={showArrow:!0,showFrame:!0,className:"",frameColor:yb,arrowColor:yb,keepEditorSelection:!1},bN="vs.editor.contrib.zoneWidget",CN=class{constructor(n,e,t,i,s,o,r,a){this.id="",this.domNode=n,this.afterLineNumber=e,this.afterColumn=t,this.heightInLines=i,this.showInHiddenAreas=r,this.ordinal=a,this._onDomNodeTop=s,this._onComputedHeight=o}onDomNodeTop(n){this._onDomNodeTop(n)}onComputedHeight(n){this._onComputedHeight(n)}},SN=class{constructor(n,e){this._id=n,this._domNode=e}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},wN=class bx{static{this._IdGenerator=new z0(".arrow-decoration-")}constructor(e){this._editor=e,this._ruleName=bx._IdGenerator.nextId(),this._color=null,this._height=-1,this._decorations=this._editor.createDecorationsCollection()}dispose(){this.hide(),gv(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){gv(this._ruleName),F0(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:x.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}},yN=class{constructor(n,e={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._isSashResizeHeight=!1,this._viewZone=null,this._disposables=new O,this.container=null,this._isShowing=!1,this.editor=n,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=wE(e),Gm(this.options,vN,!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(n=>{this._viewZone&&n.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 wN(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(n){n.frameColor&&(this.options.frameColor=n.frameColor),n.arrowColor&&(this.options.arrowColor=n.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const n=this.options.frameColor.toString();this.container.style.borderTopColor=n,this.container.style.borderBottomColor=n}if(this._arrow&&this.options.arrowColor){const n=this.options.arrowColor.toString();this._arrow.color=n}}_getWidth(n){return n.width-n.minimap.minimapWidth-n.verticalScrollbarWidth}_getLeft(n){return n.minimap.minimapWidth>0&&n.minimap.minimapLeft===0?n.minimap.minimapWidth:0}_onViewZoneTop(n){this.domNode.style.top=n+"px"}_onViewZoneHeight(n){if(this.domNode.style.height=`${n}px`,this.container){const e=n-this._decoratingElementsHeight();this.container.style.height=`${e}px`;const t=this.editor.getLayoutInfo();this._doLayout(e,this._getWidth(t))}this._resizeSash?.layout()}get position(){const n=this._positionMarkerId.getRange(0);if(n)return n.getStartPosition()}show(n,e){const t=x.isIRange(n)?x.lift(n):x.fromPositions(n);this._isShowing=!0,this._showImpl(t,e),this._isShowing=!1,this._positionMarkerId.set([{range:t,options:oe.EMPTY}])}hide(){this._viewZone&&(this.editor.changeViewZones(n=>{this._viewZone&&n.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){const n=this.editor.getOption(75);let e=0;if(this.options.showArrow){const t=Math.round(n/3);e+=2*t}if(this.options.showFrame){const t=this.options.frameWidth??Math.round(n/9);e+=2*t}return e}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(n,e){const t=n.getStartPosition(),i=this.editor.getLayoutInfo(),s=this._getWidth(i);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(i)+"px";const o=document.createElement("div");o.style.overflow="hidden";const r=this.editor.getOption(75),a=this._getMaximumHeightInLines();a!==void 0&&(e=Math.min(e,a));let l=0,d=0;if(this._arrow&&this.options.showArrow&&(l=Math.round(r/3),this._arrow.height=l,this._arrow.show(t)),this.options.showFrame&&(d=Math.round(r/9)),this.editor.changeViewZones(u=>{this._viewZone&&u.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new CN(o,t.lineNumber,t.column,e,g=>this._onViewZoneTop(g),g=>this._onViewZoneHeight(g),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=u.addZone(this._viewZone),this._overlayWidget=new SN(bN+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){const u=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=u+"px",this.container.style.borderBottomWidth=u+"px"}const c=e*r-this._decoratingElementsHeight();this.container&&(this.container.style.top=l+"px",this.container.style.height=c+"px",this.container.style.overflow="hidden"),this._doLayout(c,s),this.options.keepEditorSelection||this.editor.setSelection(n);const h=this.editor.getModel();if(h){const u=h.validateRange(new x(n.startLineNumber,1,n.endLineNumber+1,1));this.revealRange(u,u.startLineNumber===h.getLineCount())}}revealRange(n,e){e?this.editor.revealLineNearTop(n.endLineNumber,0):this.editor.revealRange(n,0)}setCssClass(n,e){this.container&&(e&&this.container.classList.remove(e),this.container.classList.add(n))}_onWidth(n){}_doLayout(n,e){}_relayout(n,e){const t=this._getMaximumHeightInLines(),i=e&&t!==void 0?Math.min(t,n):n;this._viewZone&&this._viewZone.heightInLines!==i&&(this.editor.changeViewZones(s=>{this._viewZone&&(this._viewZone.heightInLines=i,s.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new Xo(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let n;this._disposables.add(this._resizeSash.onDidStart(e=>{this._viewZone&&(n={startY:e.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{n=void 0})),this._disposables.add(this._resizeSash.onDidChange(e=>{if(n){const t=(e.currentY-n.startY)/this.editor.getOption(75),i=t<0?Math.ceil(t):Math.floor(t),s=n.heightInLines+i;s>n.minLines&&s<n.maxLines&&(this._isSashResizeHeight=!0,this._relayout(s))}}))}_updateSashEnablement(){if(this._resizeSash){const{minLines:n,maxLines:e}=this._getResizeBounds();this._resizeSash.state=n===e?0:3}}_getResizeBounds(){return{minLines:5,maxLines:35}}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const n=this.editor.getLayoutInfo();return n.width-n.minimap.minimapWidth}},Cx=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Sx=function(n,e){return function(t,i){e(t,i,n)}},wx=fn("IPeekViewService");zn(wx,class{constructor(){this._widgets=new Map}addExclusiveWidget(n,e){const t=this._widgets.get(n);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const s=this._widgets.get(n);s&&s.widget===e&&(s.listener.dispose(),this._widgets.delete(n))};this._widgets.set(n,{widget:e,listener:e.onDidClose(i)})}},1);var Ut;(function(n){n.inPeekEditor=new ae("inReferenceSearchEditor",!0,m(1382,"Whether the current code editor is embedded inside peek")),n.notInPeekEditor=n.inPeekEditor.toNegated()})(Ut||(Ut={}));var mc=class{static{this.ID="editor.contrib.referenceController"}constructor(e,t){e instanceof un&&Ut.inPeekEditor.bindTo(t)}dispose(){}};mc=Cx([Sx(1,Ce)],mc);de(mc.ID,mc,0);var xN={headerBackgroundColor:ve.white,primaryHeadingColor:ve.fromHex("#333333"),secondaryHeadingColor:ve.fromHex("#6c6c6cb3")},_c=class extends yN{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,Gm(this.options,xN,!1);const s=je(this.editor);s.openedPeekWidgets.set(s.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();const e=je(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=H(".head"),this._bodyElement=H(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=H(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),hn(this._titleElement,"click",o=>this._onTitleClick(o))),U(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=H("span.filename"),this._secondaryHeading=H("span.dirname"),this._metaHeading=H("span.meta"),U(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=H(".peekview-actions");U(this._headElement,i);const s=this._getActionBarOptions();this._actionbarWidget=new _s(i,s),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new hr("peekview.close",m(1383,"Close"),ce.asClassName(V.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:x0.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:ni(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Li(this._metaHeading)):ii(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(75)*1.2),s=Math.round(e-(i+1));this._doLayoutHead(i,t),this._doLayoutBody(s,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};_c=Cx([Sx(2,ne)],_c);var IN=W("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:ve.black,hcLight:ve.white},m(1384,"Background color of the peek view title area.")),yx=W("peekViewTitleLabel.foreground",{dark:ve.white,light:ve.black,hcDark:ve.white,hcLight:yl},m(1385,"Color of the peek view title.")),xx=W("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},m(1386,"Color of the peek view title info.")),LN=W("peekView.border",{dark:sg,light:sg,hcDark:cn,hcLight:cn},m(1387,"Color of the peek view borders and arrow.")),DN=W("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:ve.black,hcLight:ve.white},m(1388,"Background color of the peek view result list."));W("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:ve.white,hcLight:yl},m(1389,"Foreground color for line nodes in the peek view result list."));W("peekViewResult.fileForeground",{dark:ve.white,light:"#1E1E1E",hcDark:ve.white,hcLight:yl},m(1390,"Foreground color for file nodes in the peek view result list."));W("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},m(1391,"Background color of the selected entry in the peek view result list."));W("peekViewResult.selectionForeground",{dark:ve.white,light:"#6C6C6C",hcDark:ve.white,hcLight:yl},m(1392,"Foreground color of the selected entry in the peek view result list."));var __=W("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:ve.black,hcLight:ve.white},m(1393,"Background color of the peek view editor."));W("peekViewEditorGutter.background",__,m(1394,"Background color of the gutter in the peek view editor."));W("peekViewEditorStickyScroll.background",__,m(1395,"Background color of sticky scroll in the peek view editor."));W("peekViewEditorStickyScrollGutter.background",__,m(1396,"Background color of the gutter part of sticky scroll in the peek view editor."));W("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},m(1397,"Match highlight color in the peek view result list."));W("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},m(1398,"Match highlight color in the peek view editor."));W("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:so,hcLight:so},m(1399,"Match highlight border in the peek view editor."));var Wn=class{constructor(n,e,t,i){this.isProviderFirst=n,this.parent=e,this.link=t,this._rangeCallback=i,this.id=xE.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(n){this._range=n,this._rangeCallback(this)}get ariaMessage(){const n=this.parent.getPreview(this)?.preview(this.range);return n?m(1146,"{0} in {1} on line {2} at column {3}",n.value,Ti(this.uri),this.range.startLineNumber,this.range.startColumn):m(1145,"in {0} on line {1} at column {2}",Ti(this.uri),this.range.startLineNumber,this.range.startColumn)}},EN=class{constructor(n){this._modelReference=n}dispose(){this._modelReference.dispose()}preview(n,e=8){const t=this._modelReference.object.textEditorModel;if(!t)return;const{startLineNumber:i,startColumn:s,endLineNumber:o,endColumn:r}=n,a=t.getWordUntilPosition({lineNumber:i,column:s-e}),l=new x(i,a.startColumn,i,s),d=new x(o,r,o,1073741824),c=t.getValueInRange(l).replace(/^\s+/,""),h=t.getValueInRange(n),u=t.getValueInRange(d).replace(/\s+$/,"");return{value:c+h+u,highlight:{start:c.length,end:c.length+h.length}}}},yr=class{constructor(n,e){this.parent=n,this.uri=e,this.children=[],this._previews=new Nn}dispose(){Pt(this._previews.values()),this._previews.clear()}getPreview(n){return this._previews.get(n.uri)}get ariaMessage(){const n=this.children.length;return n===1?m(1147,"1 symbol in {0}, full path {1}",Ti(this.uri),this.uri.fsPath):m(1148,"{0} symbols in {1}, full path {2}",n,Ti(this.uri),this.uri.fsPath)}async resolve(n){if(this._previews.size!==0)return this;for(const e of this.children)if(!this._previews.has(e.uri))try{const t=await n.createModelReference(e.uri);this._previews.set(e.uri,new EN(t))}catch(t){Le(t)}return this}},Gi=class kd{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new ee,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(kd._compareReferences);let s;for(const o of e)if((!s||!cv.isEqual(s.uri,o.uri,!0))&&(s=new yr(this,o.uri),this.groups.push(s)),s.children.length===0||kd._compareReferences(o,s.children[s.children.length-1])!==0){const r=new Wn(i===o,s,o,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),s.children.push(r)}}dispose(){Pt(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new kd(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?m(1149,"No results found"):this.references.length===1?m(1150,"Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?m(1151,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):m(1152,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let s=i.children.indexOf(e);const o=i.children.length,r=i.parent.groups.length;return r===1||t&&s+1<o||!t&&s>0?(t?s=(s+1)%o:s=(s+o-1)%o,i.children[s]):(s=i.parent.groups.indexOf(i),t?(s=(s+1)%r,i.parent.groups[s].children[0]):(s=(s+r-1)%r,i.parent.groups[s].children[i.parent.groups[s].children.length-1]))}nearestReference(e,t){const i=this.references.map((s,o)=>({idx:o,prefixLen:Or(s.uri.toString(),e.toString()),offsetDist:Math.abs(s.range.startLineNumber-t.lineNumber)*100+Math.abs(s.range.startColumn-t.column)})).sort((s,o)=>s.prefixLen>o.prefixLen?-1:s.prefixLen<o.prefixLen?1:s.offsetDist<o.offsetDist?-1:s.offsetDist>o.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&x.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return cv.compare(e.uri,t.uri)||x.compareRangesUsingStarts(e.range,t.range)}},yh=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},xh=function(n,e){return function(t,i){e(t,i,n)}},zg,jg=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Gi||e instanceof yr}getChildren(e){if(e instanceof Gi)return e.groups;if(e instanceof yr)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};jg=yh([xh(0,li)],jg);var RN=class{getHeight(){return 23}getTemplateId(n){return n instanceof yr?vc.id:Ix.id}},qg=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){if(e instanceof Wn){const t=e.parent.getPreview(e)?.preview(e.range);if(t)return t.value}return Ti(e.uri)}};qg=yh([xh(0,He)],qg);var TN=class{getId(n){return n instanceof Wn?n.id:n.uri}},$g=class extends M{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new GS(i,{supportHighlights:!0})),this.badge=this._register(new N0(U(i,H(".count")),{},A0)),e.appendChild(i)}set(e,t){const i=xm(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const s=e.children.length;this.badge.setCount(s),s>1?this.badge.setTitleFormat(m(1139,"{0} references",s)):this.badge.setTitleFormat(m(1140,"{0} reference",s))}};$g=yh([xh(1,br)],$g);var vc=class{static{zg=this}static{this.id="FileReferencesRenderer"}constructor(e){this._instantiationService=e,this.templateId=zg.id}renderTemplate(e){return this._instantiationService.createInstance($g,e)}renderElement(e,t,i){i.set(e.element,ch(e.filterData))}disposeTemplate(e){e.dispose()}};vc=zg=yh([xh(0,ne)],vc);var PN=class extends M{constructor(n){super(),this.label=this._register(new xT(n))}set(n,e){const t=n.parent.getPreview(n)?.preview(n.range);if(!t||!t.value)this.label.set(`${Ti(n.uri)}:${n.range.startLineNumber+1}:${n.range.startColumn+1}`);else{const{value:i,highlight:s}=t;e&&!Wa.isDefault(e)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(i,ch(e))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(i,[s]))}}},Ix=class Lx{constructor(){this.templateId=Lx.id}static{this.id="OneReferenceRenderer"}renderTemplate(e){return new PN(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}},kN=class{getWidgetAriaLabel(){return m(1141,"References")}getAriaLabel(n){return n.ariaMessage}},Dx=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ks=function(n,e){return function(t,i){e(t,i,n)}},NN=class Ex{static{this.DecorationOptions=oe.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new O,this._callOnModelChange=new O,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let s=0,o=e.children.length;s<o;s++){const r=e.children[s];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:Ex.DecorationOptions}),i.push(s))}this._editor.changeDecorations(s=>{const o=s.deltaDecorations([],t);for(let r=0;r<o.length;r++)this._decorations.set(o[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,s]of this._decorations){const o=t.getDecorationRange(i);if(!o)continue;let r=!1;x.equalsRange(o,s.range)||((x.spansMultipleLines(o)||s.range.endColumn-s.range.startColumn!==o.endColumn-o.startColumn)&&(r=!0),r?(this._decorationIgnoreSet.add(s.id),e.push(i)):s.range=o)}for(let i=0,s=e.length;i<s;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}},MN=class{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(n){let e,t;try{const i=JSON.parse(n);e=i.ratio,t=i.heightInLines}catch{}return{ratio:e||.7,heightInLines:t||18}}},ON=class extends YT{},Kg=class{constructor(e){this.labelService=e,this.disposables=new O}getDragURI(e){return e instanceof yr?e.uri.toString():e instanceof Wn?nE(e.uri,e.range).toString():null}getDragLabel(e){if(e.length!==0)return e.map(t=>this.labelService.getUriBasenameLabel(t.uri)).join(", ")}onDragStart(e,t){if(!t.dataTransfer)return;const i=e.elements.map(s=>this.getDragURI(s)).filter(Boolean);i.length&&(t.dataTransfer.setData(rv.RESOURCES,JSON.stringify(i)),t.dataTransfer.setData(rv.TEXT,i.join(`
|
|
11
|
+
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};Kg=Dx([Ks(0,br)],Kg);var Gg=class extends _c{constructor(e,t,i,s,o,r,a,l,d){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=o,this._instantiationService=r,this._peekViewService=a,this._uriLabel=l,this._keybindingService=d,this._disposeOnNewModel=new O,this._callOnDispose=new O,this._onDidSelectReference=this._callOnDispose.add(new ee),this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new Pe(0,0),this._isClosing=!1,this._applyTheme(s.getColorTheme()),this._callOnDispose.add(s.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Pt(this._preview),Pt(this._previewNotAvailableMessage),Pt(this._tree),Pt(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(LN)||ve.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(IN)||ve.transparent,primaryHeadingColor:e.getColor(yx),secondaryHeadingColor:e.getColor(xx)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=U(e,H("div.messages")),ii(this._messageContainer),this._splitView=new k0(e,{orientation:1}),this._previewContainer=U(e,H("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(un,this._previewContainer,t,{},this.editor),ii(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(rc,m(1142,"no preview available"),tR,rc.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=U(e,H("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new kN,keyboardNavigationLabelProvider:this._instantiationService.createInstance(qg),identityProvider:new TN,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:DN},dnd:this._instantiationService.createInstance(Kg)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(hn(this._treeContainer,"keydown",o=>{o.equals(9)&&(this._keybindingService.dispatchEvent(o,o.target),o.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(ON,"ReferencesWidget",this._treeContainer,new RN,[this._instantiationService.createInstance(vc),this._instantiationService.createInstance(Ix)],this._instantiationService.createInstance(jg),i),this._splitView.addView({onDidChange:Ge.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:o=>{this._preview.layout({height:this._dim.height,width:o})}},hv.Distribute),this._splitView.addView({onDidChange:Ge.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:o=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${o}px`,this._tree.layout(this._dim.height,o)}},hv.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const s=(o,r)=>{o instanceof Wn&&(r==="show"&&this._revealReference(o,!1),this._onDidSelectReference.fire({element:o,kind:r,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(o=>{o.sideBySide?s(o.element,"side"):o.editorOptions.pinned?s(o.element,"goto"):s(o.element,"show")})),ii(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new Pe(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=m(1143,"No results"),Li(this._messageContainer),Promise.resolve(void 0)):(ii(this._messageContainer),this._decorationsManager=new NN(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const s=this._getFocusedReference();s&&this._onDidSelectReference.fire({element:{uri:s.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Li(this._treeContainer),Li(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Wn)return e;if(e instanceof yr&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==Ct.inMemory?this.setTitle(XT(e.uri),this._uriLabel.getUriLabel(xm(e.uri))):this.setTitle(m(1144,"References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const s=await i;if(!this._model){s.dispose();return}Pt(this._previewModelReference);const o=s.object;if(o){const r=this._preview.getModel()===o.textEditorModel?0:1,a=x.lift(e.range).collapseToStart();this._previewModelReference=s,this._preview.setModel(o.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),s.dispose()}};Gg=Dx([Ks(3,Dt),Ks(4,li),Ks(5,ne),Ks(6,wx),Ks(7,br),Ks(8,He)],Gg);var AN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},To=function(n,e){return function(t,i){e(t,i,n)}},Nd,Io=new ae("referenceSearchVisible",!1,m(1136,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'")),fo=class{static{Nd=this}static{this.ID="editor.contrib.referencesController"}static get(e){return e.getContribution(Nd.ID)}constructor(e,t,i,s,o,r,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=s,this._notificationService=o,this._instantiationService=r,this._storageService=a,this._configurationService=l,this._disposables=new O,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=Io.bindTo(i)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let s;if(this._widget&&(s=this._widget.position),this.closeWidget(),s&&e.containsPosition(s))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const o="peekViewLayout",r=MN.fromJSON(this._storageService.get(o,0,"{}"));this._widget=this._instantiationService.createInstance(Gg,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(m(1137,"Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(o,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:d,kind:c}=l;if(d)switch(c){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(d,!1,!1);break;case"side":this.openReference(d,!0,!1);break;case"goto":i?this._gotoReference(d,!0):this.openReference(d,!1,!0)}}));const a=++this._requestIdPool;t.then(l=>{if(a!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(m(1138,"{0} ({1})",this._model.title,this._model.references.length));const d=this._editor.getModel().uri,c=new B(e.startLineNumber,e.startColumn),h=this._model.nearestReference(d,c);if(h)return this._widget.setSelection(h).then(()=>{this._widget&&this._editor.getOption(99)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const s=this._model.nextOrPreviousReference(i,e),o=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(s),await this._gotoReference(s,!1),o?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){this._widget?.hide(),this._ignoreModelChangeEvent=!0;const i=x.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(s=>{if(this._ignoreModelChangeEvent=!1,!s||!this._widget){this.closeWidget();return}if(this._editor===s)this._widget.show(i),this._widget.focusOnReferenceTree();else{const o=Nd.get(s),r=this._model.clone();this.closeWidget(),s.focus(),o?.toggleWidget(i,mt(a=>Promise.resolve(r)),this._peekMode??!1)}},s=>{this._ignoreModelChangeEvent=!1,Le(s)})}openReference(e,t,i){t||this.closeWidget();const{uri:s,range:o}=e;this._editorService.openCodeEditor({resource:s,options:{selection:o,selectionSource:"code.jump",pinned:i}},this._editor,t)}};fo=Nd=AN([To(2,Ce),To(3,Ze),To(4,Rt),To(5,ne),To(6,Ni),To(7,Ee)],fo);function Lo(n,e){const t=vx(n);if(!t)return;const i=fo.get(t);i&&e(i)}ai.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:tt(2089,60),when:k.or(Io,Ut.inPeekEditor),handler(n){Lo(n,e=>{e.changeFocusBetweenPreviewAndReferences()})}});ai.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:k.or(Io,Ut.inPeekEditor),handler(n){Lo(n,e=>{e.goToNextOrPreviousReference(!0)})}});ai.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:k.or(Io,Ut.inPeekEditor),handler(n){Lo(n,e=>{e.goToNextOrPreviousReference(!1)})}});Me.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");Me.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");Me.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");Me.registerCommand("closeReferenceSearch",n=>Lo(n,e=>e.closeWidget()));ai.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:k.and(Ut.inPeekEditor,k.not("config.editor.stablePeek"))});ai.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:k.and(Io,k.not("config.editor.stablePeek"),k.or(S.editorTextFocus,mT.negate()))});ai.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:k.and(Io,nw,FS.negate(),AS.negate()),handler(n){const e=n.get(hm).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof Wn&&Lo(n,t=>t.revealReference(e[0]))}});ai.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:k.and(Io,nw,FS.negate(),AS.negate()),handler(n){const e=n.get(hm).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof Wn&&Lo(n,t=>t.openReference(e[0],!0,!0))}});Me.registerCommand("openReference",n=>{const e=n.get(hm).lastFocusedList?.getFocus();Array.isArray(e)&&e[0]instanceof Wn&&Lo(n,t=>t.openReference(e[0],!1,!0))});var Rx=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},da=function(n,e){return function(t,i){e(t,i,n)}},v_=new ae("hasSymbols",!1,m(1153,"Whether there are symbol locations that can be navigated via keyboard-only.")),Ih=fn("ISymbolNavigationService"),Zg=class{constructor(e,t,i,s){this._editorService=t,this._notificationService=i,this._keybindingService=s,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=v_.bindTo(e)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new Xg(this._editorService),s=i.onDidChange(o=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),l=r.getPosition();if(!a||!l)return;let d=!1,c=!1;for(const h of t.references)if(vs(h.uri,a.uri))d=!0,c=c||x.containsPosition(h.range,l);else if(d)break;(!d||!c)&&this.reset()});this._currentState=Gw(i,s)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:x.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?m(1154,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):m(1155,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};Zg=Rx([da(0,Ce),da(1,Ze),da(2,Rt),da(3,He)],Zg);zn(Ih,Zg,1);Z(new class extends Ft{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:v_,kbOpts:{weight:100,primary:70}})}runEditorCommand(n,e){return n.get(Ih).revealNext(e)}});ai.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:v_,primary:9,handler(n){n.get(Ih).reset()}});var Xg=class{constructor(e){this._listener=new Map,this._disposables=new O,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Pt(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,Gw(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){this._listener.get(e)?.dispose(),this._listener.delete(e)}};Xg=Rx([da(0,Ze)],Xg);function Yg(n,e){return e.uri.scheme===n.uri.scheme?!0:!yE(e.uri,Ct.walkThroughSnippet,Ct.vscodeChatCodeBlock,Ct.vscodeChatCodeCompareBlock)}async function Tl(n,e,t,i,s){const o=t.ordered(n,i).map(a=>Promise.resolve(s(a,n,e)).then(void 0,l=>{it(l)})),r=await Promise.all(o);return Ps(r.flat()).filter(a=>Yg(n,a))}function Pl(n,e,t,i,s){return Tl(e,t,n,i,(o,r,a)=>o.provideDefinition(r,a,s))}function b_(n,e,t,i,s){return Tl(e,t,n,i,(o,r,a)=>o.provideDeclaration(r,a,s))}function C_(n,e,t,i,s){return Tl(e,t,n,i,(o,r,a)=>o.provideImplementation(r,a,s))}function S_(n,e,t,i,s){return Tl(e,t,n,i,(o,r,a)=>o.provideTypeDefinition(r,a,s))}function kl(n,e,t,i,s,o){return Tl(e,t,n,s,async(r,a,l)=>{const d=(await r.provideReferences(a,l,{includeDeclaration:!0},o))?.filter(h=>Yg(a,h));if(!i||!d||d.length!==2)return d;const c=(await r.provideReferences(a,l,{includeDeclaration:!1},o))?.filter(h=>Yg(a,h));return c&&c.length===1?c:d})}async function mn(n){const e=await n(),t=new Gi(e,""),i=t.references.map(s=>s.link);return t.dispose(),i}jt("_executeDefinitionProvider",(n,e,t)=>{const i=Pl(n.get(X).definitionProvider,e,t,!1,he.None);return mn(()=>i)});jt("_executeDefinitionProvider_recursive",(n,e,t)=>{const i=Pl(n.get(X).definitionProvider,e,t,!0,he.None);return mn(()=>i)});jt("_executeTypeDefinitionProvider",(n,e,t)=>{const i=S_(n.get(X).typeDefinitionProvider,e,t,!1,he.None);return mn(()=>i)});jt("_executeTypeDefinitionProvider_recursive",(n,e,t)=>{const i=S_(n.get(X).typeDefinitionProvider,e,t,!0,he.None);return mn(()=>i)});jt("_executeDeclarationProvider",(n,e,t)=>{const i=b_(n.get(X).declarationProvider,e,t,!1,he.None);return mn(()=>i)});jt("_executeDeclarationProvider_recursive",(n,e,t)=>{const i=b_(n.get(X).declarationProvider,e,t,!0,he.None);return mn(()=>i)});jt("_executeReferenceProvider",(n,e,t)=>{const i=kl(n.get(X).referenceProvider,e,t,!1,!1,he.None);return mn(()=>i)});jt("_executeReferenceProvider_recursive",(n,e,t)=>{const i=kl(n.get(X).referenceProvider,e,t,!1,!0,he.None);return mn(()=>i)});jt("_executeImplementationProvider",(n,e,t)=>{const i=C_(n.get(X).implementationProvider,e,t,!1,he.None);return mn(()=>i)});jt("_executeImplementationProvider_recursive",(n,e,t)=>{const i=C_(n.get(X).implementationProvider,e,t,!0,he.None);return mn(()=>i)});qi.appendMenuItem(K.EditorContext,{submenu:K.EditorContextPeek,title:m(1096,"Peek"),group:"navigation",order:100});var bc=class Tx{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof Tx||B.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}},Do=class Sn extends mi{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return Sn._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of gs.wrap(t.menu))(i.id===K.EditorContext||i.id===K.EditorContextPeek)&&(i.when=k.and(e.precondition,i.when));return t}constructor(e,t){super(Sn._patchConfig(t)),this.configuration=e,Sn._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,s){if(!t.hasModel())return Promise.resolve(void 0);const o=e.get(Rt),r=e.get(Ze),a=e.get(pr),l=e.get(Ih),d=e.get(X),c=e.get(ne),h=t.getModel(),u=t.getPosition(),g=bc.is(i)?i:new bc(h,u),p=new lo(t,5),f=gr(this._getLocationModel(d,g.model,g.position,p.token),p.token).then(async _=>{if(!_||p.token.isCancellationRequested)return;gi(_.ariaMessage);let v;if(_.referenceAt(h.uri,u)){const w=this._getAlternativeCommand(t);w!==void 0&&!Sn._activeAlternativeCommands.has(w)&&Sn._allSymbolNavigationCommands.has(w)&&(v=Sn._allSymbolNavigationCommands.get(w))}const C=_.references.length;if(C===0){if(!this.configuration.muteMessage){const w=h.getWordAtPosition(u);Zt.get(t)?.showMessage(this._getNoResultFoundMessage(w),u)}}else if(C===1&&v)Sn._activeAlternativeCommands.add(this.desc.id),c.invokeFunction(w=>v.runEditorCommand(w,t,i,s).finally(()=>{Sn._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,t,_,s)},_=>{o.error(_)}).finally(()=>{p.dispose()});return a.showWhile(f,250),f}async _onResult(e,t,i,s,o){const r=this._getGoToPreference(i);if(!(i instanceof un)&&(this.configuration.openInPeek||r==="peek"&&s.references.length>1))this._openInPeek(i,s,o);else{const a=s.firstReference(),l=s.references.length>1&&r==="gotoAndPeek",d=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&d?this._openInPeek(d,s,o):s.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,s,o){let r;if(E0(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:x.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,s);if(a){if(o){const l=a.getModel(),d=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&d.clear()},350)}return a}}_openInPeek(e,t,i){const s=fo.get(e);s&&e.hasModel()?s.toggleWidget(i??e.getSelection(),mt(o=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}},Nl=class extends Do{async _getLocationModel(n,e,t,i){return new Gi(await Pl(n.definitionProvider,e,t,!1,i),m(1097,"Definitions"))}_getNoResultFoundMessage(n){return n&&n.word?m(1098,"No definition found for '{0}'",n.word):m(1099,"No definition found")}_getAlternativeCommand(n){return n.getOption(67).alternativeDefinitionCommand}_getGoToPreference(n){return n.getOption(67).multipleDefinitions}};me(class Jg extends Nl{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Jg.id,title:{...L(1123,"Go to Definition"),mnemonicTitle:m(1100,"Go to &&Definition")},precondition:S.hasDefinitionProvider,keybinding:[{when:S.editorTextFocus,primary:70,weight:100},{when:k.and(S.editorTextFocus,Fw),primary:2118,weight:100}],menu:[{id:K.EditorContext,group:"navigation",order:1.1},{id:K.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Me.registerCommandAlias("editor.action.goToDeclaration",Jg.id)}});me(class Qg extends Nl{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Qg.id,title:L(1124,"Open Definition to the Side"),precondition:k.and(S.hasDefinitionProvider,S.isInEmbeddedEditor.toNegated()),keybinding:[{when:S.editorTextFocus,primary:tt(2089,70),weight:100},{when:k.and(S.editorTextFocus,Fw),primary:tt(2089,2118),weight:100}]}),Me.registerCommandAlias("editor.action.openDeclarationToTheSide",Qg.id)}});me(class ep extends Nl{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:ep.id,title:L(1125,"Peek Definition"),precondition:k.and(S.hasDefinitionProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),keybinding:{when:S.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:K.EditorContextPeek,group:"peek",order:2}}),Me.registerCommandAlias("editor.action.previewDeclaration",ep.id)}});var Px=class extends Do{async _getLocationModel(n,e,t,i){return new Gi(await b_(n.declarationProvider,e,t,!1,i),m(1101,"Declarations"))}_getNoResultFoundMessage(n){return n&&n.word?m(1102,"No declaration found for '{0}'",n.word):m(1103,"No declaration found")}_getAlternativeCommand(n){return n.getOption(67).alternativeDeclarationCommand}_getGoToPreference(n){return n.getOption(67).multipleDeclarations}};me(class kx extends Px{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:kx.id,title:{...L(1126,"Go to Declaration"),mnemonicTitle:m(1104,"Go to &&Declaration")},precondition:k.and(S.hasDeclarationProvider,S.isInEmbeddedEditor.toNegated()),menu:[{id:K.EditorContext,group:"navigation",order:1.3},{id:K.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?m(1105,"No declaration found for '{0}'",e.word):m(1106,"No declaration found")}});me(class extends Px{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:L(1127,"Peek Declaration"),precondition:k.and(S.hasDeclarationProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),menu:{id:K.EditorContextPeek,group:"peek",order:3}})}});var Nx=class extends Do{async _getLocationModel(n,e,t,i){return new Gi(await S_(n.typeDefinitionProvider,e,t,!1,i),m(1107,"Type Definitions"))}_getNoResultFoundMessage(n){return n&&n.word?m(1108,"No type definition found for '{0}'",n.word):m(1109,"No type definition found")}_getAlternativeCommand(n){return n.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(n){return n.getOption(67).multipleTypeDefinitions}};me(class Mx extends Nx{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Mx.ID,title:{...L(1128,"Go to Type Definition"),mnemonicTitle:m(1110,"Go to &&Type Definition")},precondition:S.hasTypeDefinitionProvider,keybinding:{when:S.editorTextFocus,primary:0,weight:100},menu:[{id:K.EditorContext,group:"navigation",order:1.4},{id:K.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});me(class Ox extends Nx{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Ox.ID,title:L(1129,"Peek Type Definition"),precondition:k.and(S.hasTypeDefinitionProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),menu:{id:K.EditorContextPeek,group:"peek",order:4}})}});var Ax=class extends Do{async _getLocationModel(n,e,t,i){return new Gi(await C_(n.implementationProvider,e,t,!1,i),m(1111,"Implementations"))}_getNoResultFoundMessage(n){return n&&n.word?m(1112,"No implementation found for '{0}'",n.word):m(1113,"No implementation found")}_getAlternativeCommand(n){return n.getOption(67).alternativeImplementationCommand}_getGoToPreference(n){return n.getOption(67).multipleImplementations}};me(class Fx extends Ax{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Fx.ID,title:{...L(1130,"Go to Implementations"),mnemonicTitle:m(1114,"Go to &&Implementations")},precondition:S.hasImplementationProvider,keybinding:{when:S.editorTextFocus,primary:2118,weight:100},menu:[{id:K.EditorContext,group:"navigation",order:1.45},{id:K.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});me(class Hx extends Ax{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Hx.ID,title:L(1131,"Peek Implementations"),precondition:k.and(S.hasImplementationProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),keybinding:{when:S.editorTextFocus,primary:3142,weight:100},menu:{id:K.EditorContextPeek,group:"peek",order:5}})}});var Wx=class extends Do{_getNoResultFoundMessage(n){return n?m(1115,"No references found for '{0}'",n.word):m(1116,"No references found")}_getAlternativeCommand(n){return n.getOption(67).alternativeReferenceCommand}_getGoToPreference(n){return n.getOption(67).multipleReferences}};me(class extends Wx{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...L(1132,"Go to References"),mnemonicTitle:m(1117,"Go to &&References")},precondition:k.and(S.hasReferenceProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),keybinding:{when:S.editorTextFocus,primary:1094,weight:100},menu:[{id:K.EditorContext,group:"navigation",order:1.45},{id:K.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,s){return new Gi(await kl(e.referenceProvider,t,i,!0,!1,s),m(1118,"References"))}});me(class extends Wx{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:L(1133,"Peek References"),precondition:k.and(S.hasReferenceProvider,Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated()),menu:{id:K.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,s){return new Gi(await kl(e.referenceProvider,t,i,!1,!1,s),m(1119,"References"))}});var FN=class extends Do{constructor(n,e,t){super(n,{id:"editor.action.goToLocation",title:L(1134,"Go to Any Symbol"),precondition:k.and(Ut.notInPeekEditor,S.isInEmbeddedEditor.toNegated())}),this._references=e,this._gotoMultipleBehaviour=t}async _getLocationModel(n,e,t,i){return new Gi(this._references,m(1120,"Locations"))}_getNoResultFoundMessage(n){return n&&m(1121,"No results for '{0}'",n.word)||""}_getGoToPreference(n){return this._gotoMultipleBehaviour??n.getOption(67).multipleReferences}_getAlternativeCommand(){}};Me.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:ke},{name:"position",description:"The position at which to start",constraint:B.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(n,e,t,i,s,o,r)=>{Ie(ke.isUri(e)),Ie(B.isIPosition(t)),Ie(Array.isArray(i)),Ie(typeof s>"u"||typeof s=="string"),Ie(typeof r>"u"||typeof r=="boolean");const a=n.get(Ze),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if(zw(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(d=>{const c=new class extends FN{_getNoResultFoundMessage(h){return o||super._getNoResultFoundMessage(h)}}({muteMessage:!o,openInPeek:!!r,openToSide:!1},i,s);d.get(ne).invokeFunction(c.run.bind(c),l)})}});Me.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:ke},{name:"position",description:"The position at which to start",constraint:B.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(n,e,t,i,s)=>{n.get(ht).executeCommand("editor.action.goToLocations",e,t,i,s,void 0,!0)}});Me.registerCommand({id:"editor.action.findReferences",handler:(n,e,t)=>{Ie(ke.isUri(e)),Ie(B.isIPosition(t));const i=n.get(X),s=n.get(Ze);return s.openCodeEditor({resource:e},s.getFocusedCodeEditor()).then(o=>{if(!zw(o)||!o.hasModel())return;const r=fo.get(o);if(!r)return;const a=mt(d=>kl(i.referenceProvider,o.getModel(),B.lift(t),!1,!1,d).then(c=>new Gi(c,m(1122,"References")))),l=new x(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(l,a,!1))})}});Me.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function HN(n,e,t,i){const s=n.get(li),o=n.get(Sl),r=n.get(ht),a=n.get(ne),l=n.get(Rt);if(await i.item.resolve(he.None),!i.part.location)return;const d=i.part.location,c=[],h=new Set(qi.getMenuItems(K.EditorContext).map(g=>D0(g)?g.command.id:jm()));for(const g of Do.all())h.has(g.desc.id)&&c.push(new hr(g.desc.id,co.label(g.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const p=await s.createModelReference(d.uri);try{const f=new bc(p.object.textEditorModel,x.getStartPosition(d.range)),_=i.item.anchor.range;await a.invokeFunction(g.runEditorCommand.bind(g),e,f,_)}finally{p.dispose()}}));if(i.part.command){const{command:g}=i.part;c.push(new Ua),c.push(new hr(g.id,g.title,void 0,!0,async()=>{try{await r.executeCommand(g.id,...g.arguments??[])}catch(p){l.notify({severity:Yc.Error,source:i.item.provider.displayName,message:p})}}))}const u=e.getOption(144);o.showContextMenu({domForShadowRoot:u?e.getDomNode()??void 0:void 0,getAnchor:()=>{const g=Mt(t);return{x:g.left,y:g.top+g.height+8}},getActions:()=>c,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function Vx(n,e,t,i){const s=await n.get(li).createModelReference(i.uri);await t.invokeWithinContext(async o=>{const r=e.hasSideBySideModifier,a=o.get(Ce),l=Ut.inPeekEditor.getValue(a),d=!r&&t.getOption(101)&&!l;return new Nl({openToSide:r,openInPeek:d,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(o,new bc(s.object.textEditorModel,x.getStartPosition(i.range)),x.lift(i.range))}),s.dispose()}var WN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Po=function(n,e){return function(t,i){e(t,i,n)}},qo,VN=class tp{constructor(){this._entries=new fl(50)}get(e){const t=tp._key(e);return this._entries.get(t)}set(e,t){const i=tp._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}},Bx=fn("IInlayHintsCache");zn(Bx,VN,1);var ip=class{constructor(n,e){this.item=n,this.index=e}get part(){const n=this.item.hint.label;return typeof n=="string"?{label:n}:n[this.index]}},BN=class{constructor(n,e){this.part=n,this.hasTriggerModifier=e}},UN=class{constructor(){this._store=new We,this._tokenSource=new ot}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new ot,this._store.value=new O,{store:this._store.value,token:this._tokenSource.token}}},el=class{static{qo=this}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(e){return e.getContribution(qo.ID)??void 0}constructor(e,t,i,s,o,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=s,this._commandService=o,this._notificationService=r,this._instaService=a,this._disposables=new O,this._sessionDisposables=new O,this._decorationsMetadata=new Map,this._activeRenderMode=0,this._ruleFactory=this._disposables.add(new jS(this._editor)),this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(159)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(159);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let l,d;e.enabled==="onUnlessPressed"?(l=0,d=1):(l=1,d=0),this._activeRenderMode=l,this._sessionDisposables.add(FR.getInstance().event(c=>{if(!this._editor.hasModel())return;const h=c.altKey&&c.ctrlKey&&!(c.shiftKey||c.metaKey)?d:l;if(h!==this._activeRenderMode){this._activeRenderMode=h;const u=this._editor.getModel(),g=this._copyInlayHintsWithCurrentAnchor(u);this._updateHintsDecorators([u.getFullModelRange()],g),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(Te(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));const s=new Set;this._sessionDisposables.add(t.onWillDispose(()=>{}));const o=this._sessionDisposables.add(new UN),r=new at(async()=>{const l=Date.now(),{store:d,token:c}=o.reset();try{const h=await _x.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),c);if(r.delay=this._debounceInfo.update(t,Date.now()-l),c.isCancellationRequested){h.dispose();return}for(const u of h.provider)typeof u.onDidChangeInlayHints=="function"&&!s.has(u)&&(s.add(u),d.add(u.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));d.add(h),d.add(Te(()=>s.clear())),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(t)}catch(h){Le(h)}},this._debounceInfo.get(t));this._sessionDisposables.add(r),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(l=>{(l.scrollTopChanged||!r.isScheduled())&&r.schedule()}));const a=this._sessionDisposables.add(new We);this._sessionDisposables.add(this._editor.onDidChangeModelContent(l=>{const d=Math.max(r.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+d},a.value=ji(()=>r.schedule(0),d),r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(159)&&r.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new O,t=e.add(new wh(this._editor)),i=new O;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(s=>{const[o]=s,r=this._getInlayHintLabelPart(o),a=this._editor.getModel();if(!r||!a){i.clear();return}const l=new ot;i.add(Te(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new BN(r,o.hasTriggerModifier):void 0;const d=a.validatePosition(r.item.hint.position).lineNumber,c=new x(d,1,d,a.getLineMaxColumn(d)),h=this._getInlineHintsForRange(c);this._updateHintsDecorators([c],h),i.add(Te(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([c],h)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async s=>{const o=this._getInlayHintLabelPart(s);if(o){const r=o.part;r.location?this._instaService.invokeFunction(Vx,s,this._editor,r.location):qw.is(r.command)&&await this._invokeCommand(r.command,o.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(he.None),Gt(i.item.hint.textEdits))){const s=i.item.hint.textEdits.map(o=>Xe.replace(x.lift(o.range),o.text));this._editor.executeEdits("inlayHint.default",s),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!hi(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(HN,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){if(e.target.type!==6)return;const t=e.target.detail.injectedText?.options;if(t instanceof Pm&&t?.attachedData instanceof ip)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:Yc.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,s]of this._decorationsMetadata){if(t.has(s.item))continue;const o=e.getDecorationRange(i);if(o){const r=new fx(o,s.item.anchor.direction),a=s.item.with({anchor:r});t.set(s.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),s=[];for(const o of i.sort(x.compareRangesUsingStarts)){const r=t.validateRange(new x(o.startLineNumber-30,o.startColumn,o.endLineNumber+30,o.endColumn));s.length===0||!x.areIntersectingOrTouching(s[s.length-1],r)?s.push(r):s[s.length-1]=x.plusRange(s[s.length-1],r)}return s}_updateHintsDecorators(e,t){const i=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&e.some(v=>v.containsPosition(this._cursorInfo.position))){const{position:v}=this._cursorInfo;this._cursorInfo=void 0;const C=new Map;for(const b of this._editor.getLineDecorations(v.lineNumber)??[]){const I=this._decorationsMetadata.get(b.id);if(b.range.startColumn>v.column)continue;const N=I?.decoration.options[I.item.anchor.direction];if(N&&N.attachedData!==qo._whitespaceData){const T=C.get(I.item)??0;C.set(I.item,T+N.content.length)}}const w=t.filter(b=>b.anchor.range.startLineNumber===v.lineNumber&&b.anchor.range.endColumn<=v.column),y=Array.from(C.values());let D;for(;;){const b=w.shift(),I=y.shift();if(!I&&!b)break;if(b)i.set(b,I??0),D=b;else if(D&&I){let N=i.get(D);N+=I,N+=y.reduce((T,E)=>T+E,0),y.length=0;break}}}const{fontSize:s,fontFamily:o,padding:r,isUniform:a}=this._getLayoutInfo(),l=this._editor.getOption(61),d=[],c=(v,C,w,y,D,b)=>{const I={content:w,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:C.className,cursorStops:y,attachedData:D,widthInEm:b};d.push({item:v,classNameRef:C,decoration:{range:v.anchor.range,options:{description:"InlayHint",showIfCollapsed:v.anchor.range.isEmpty(),collapseOnReplaceEdit:!v.anchor.range.isEmpty(),stickiness:0,[v.anchor.direction]:this._activeRenderMode===0?I:void 0}}})},h=(v,C)=>{const w=s/3|0,y=w/l,D=this._ruleFactory.createClassNameRef({width:`${w}px`,display:"inline-block"});c(v,D,"",C?Js.Right:Js.None,qo._whitespaceData,y)},u=this._editor.getOption(159).maximumLength,g="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(g,o);let p={line:0,totalLen:0};for(let v=0;v<t.length;v++){const C=t[v];if(p.line!==C.anchor.range.startLineNumber&&(p={line:C.anchor.range.startLineNumber,totalLen:0}),u&&p.totalLen>u)continue;C.hint.paddingLeft&&h(C,!1);const w=typeof C.hint.label=="string"?[{label:C.hint.label}]:C.hint.label,y=i.get(C);let D=0;for(let b=0;b<w.length;b++){const I=w[b],N=b===0,T=b===w.length-1,E={fontSize:`${s}px`,fontFamily:`var(${g}), ${Rm.fontFamily}`,verticalAlign:a?"baseline":"middle",unicodeBidi:"isolate"};Gt(C.hint.textEdits)&&(E.cursor="default"),this._fillInColors(E,C.hint),(I.command||I.location)&&this._activeInlayHintPart?.part.item===C&&this._activeInlayHintPart.part.index===b&&(E.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(E.color=nt(ET),E.cursor="pointer"));let F=I.label;p.totalLen+=F.length;let q=!1;const re=u!==0?p.totalLen-u:0;if(re>0&&(F=F.slice(0,-re)+"…",q=!0),D+=F.length,y!==void 0){const be=D-y;be>=0&&(D-=be,F=F.slice(0,-(1+be))+"…",q=!0)}if(r&&(N&&(T||q)?(E.padding=`1px ${Math.max(1,s/4)|0}px`,E.borderRadius=`${s/4|0}px`):N?(E.padding=`1px 0 1px ${Math.max(1,s/4)|0}px`,E.borderRadius=`${s/4|0}px 0 0 ${s/4|0}px`):T||q?(E.padding=`1px ${Math.max(1,s/4)|0}px 1px 0`,E.borderRadius=`0 ${s/4|0}px ${s/4|0}px 0`):E.padding="1px 0 1px 0"),c(C,this._ruleFactory.createClassNameRef(E),zN(F),T&&!C.hint.paddingRight?Js.Right:Js.None,new ip(C,b)),q)break}if(y!==void 0&&D<y){const b=y-D;c(C,this._ruleFactory.createClassNameRef({})," ".repeat(b),Js.None)}if(C.hint.paddingRight&&h(C,!0),d.length>qo._MAX_DECORATORS)break}const f=[];for(const[v,C]of this._decorationsMetadata){const w=this._editor.getModel()?.getDecorationRange(v);w&&e.some(y=>y.containsRange(w))&&(f.push(v),C.classNameRef.dispose(),this._decorationsMetadata.delete(v))}const _=ur.capture(this._editor);this._editor.changeDecorations(v=>{const C=v.deltaDecorations(f,d.map(w=>w.decoration));for(let w=0;w<C.length;w++){const y=d[w];this._decorationsMetadata.set(C[w],y)}}),_.restore(this._editor)}_fillInColors(e,t){t.kind===sv.Parameter?(e.backgroundColor=nt(hR),e.color=nt(JT)):t.kind===sv.Type?(e.backgroundColor=nt(LE),e.color=nt(h0)):(e.backgroundColor=nt(BT),e.color=nt(sP))}_getLayoutInfo(){const e=this._editor.getOption(159),t=e.padding,i=this._editor.getOption(61),s=this._editor.getOption(58);let o=e.fontSize;(!o||o<5||o>i)&&(o=i);const r=e.fontFamily||s;return{fontSize:o,fontFamily:r,padding:t,isUniform:!t&&r===s&&o===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};el=qo=WN([Po(1,X),Po(2,ki),Po(3,Bx),Po(4,ht),Po(5,Rt),Po(6,ne)],el);function zN(n){return n.replace(/[ \t]/g," ")}Me.registerCommand("_executeInlayHintProvider",async(n,...e)=>{const[t,i]=e;Ie(ke.isUri(t)),Ie(x.isIRange(i));const{inlayHintsProvider:s}=n.get(X),o=await n.get(li).createModelReference(t);try{const r=await _x.create(s,o.object.textEditorModel,[x.lift(i)],he.None),a=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),a}finally{o.dispose()}});var jN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Hs=function(n,e){return function(t,i){e(t,i,n)}},xb=class extends la{constructor(n,e,t,i){super(10,e,n.item.anchor.range,t,i,!0),this.part=n}},Cc=class extends Ja{constructor(e,t,i,s,o,r,a,l){super(e,t,o,a,i,s,l),this._resolverService=r,this.hoverOrdinal=6}suggestHoverAnchor(e){if(!el.get(this._editor)||e.target.type!==6)return null;const t=e.target.detail.injectedText?.options;return t instanceof Pm&&t.attachedData instanceof ip?new xb(t.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i,s){return e instanceof xb?new dn(async o=>{const{part:r}=e;if(await r.item.resolve(s),s.isCancellationRequested)return;let a;typeof r.item.hint.tooltip=="string"?a=new St().appendText(r.item.hint.tooltip):r.item.hint.tooltip&&(a=r.item.hint.tooltip),a&&o.emitOne(new Di(this,e.range,[a],!1,0)),Gt(r.item.hint.textEdits)&&o.emitOne(new Di(this,e.range,[new St().appendText(m(1220,"Double-click to insert"))],!1,10001));let l;if(typeof r.part.tooltip=="string"?l=new St().appendText(r.part.tooltip):r.part.tooltip&&(l=r.part.tooltip),l&&o.emitOne(new Di(this,e.range,[l],!1,1)),r.part.location||r.part.command){let c;const h=this._editor.getOption(86)==="altKey"?On?m(1221,"cmd + click"):m(1222,"ctrl + click"):On?m(1223,"option + click"):m(1224,"alt + click");r.part.location&&r.part.command?c=new St().appendText(m(1225,"Go to Definition ({0}), right click for more",h)):r.part.location?c=new St().appendText(m(1226,"Go to Definition ({0})",h)):r.part.command&&(c=new St(`[${m(1227,"Execute Command")}](${mN(r.part.command)} "${r.part.command.title}") (${h})`,{isTrusted:!0})),c&&o.emitOne(new Di(this,e.range,[c],!1,1e4))}const d=this._resolveInlayHintLabelPartHover(r,s);for await(const c of d)o.emitOne(c)}):dn.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;const{uri:i,range:s}=e.part.location,o=await this._resolverService.createModelReference(i);try{const r=o.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(r))return;for await(const a of m_(this._languageFeaturesService.hoverProvider,r,new B(s.startLineNumber,s.startColumn),t))Ha(a.hover.contents)||(yield new Di(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal))}finally{o.dispose()}}};Cc=jN([Hs(1,Es),Hs(2,He),Hs(3,fi),Hs(4,Ee),Hs(5,li),Hs(6,X),Hs(7,ht)],Cc);var Ux=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ar=function(n,e){return function(t,i){e(t,i,n)}},np,sp,op=np=class extends M{constructor(e,t,i,s,o,r,a){super();const l=t.hoverParts;this._renderedHoverParts=this._register(new rp(e,i,l,s,o,r,a));const d=t.options,c=d.anchor,{showAtPosition:h,showAtSecondaryPosition:u}=np.computeHoverPositions(e,c.range,l);this.shouldAppearBeforeContent=l.some(g=>g.isBeforeContent),this.showAtPosition=h,this.showAtSecondaryPosition=u,this.initialMousePosX=c.initialMousePosX,this.initialMousePosY=c.initialMousePosY,this.shouldFocus=d.shouldFocus,this.source=d.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}get hoverPartsCount(){return this._renderedHoverParts.hoverPartsCount}focusHoverPartWithIndex(e){this._renderedHoverParts.focusHoverPartWithIndex(e)}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let s=1;if(e.hasModel()){const c=e._getViewModel(),h=c.coordinatesConverter,u=h.convertModelRangeToViewRange(t),g=c.getLineMinColumn(u.startLineNumber),p=new B(u.startLineNumber,g);s=h.convertViewPositionToModelPosition(p).column}const o=t.startLineNumber;let r=t.startColumn,a;for(const c of i){const h=c.range,u=h.startLineNumber===o,g=h.endLineNumber===o;if(u&&g){const p=h.startColumn;r=Math.max(Math.min(r,p),s)}c.forceShowAtRange&&(a=h)}let l,d;if(a){const c=a.getStartPosition();l=c,d=c}else l=t.getStartPosition(),d=new B(o,r);return{showAtPosition:l,showAtSecondaryPosition:d}}};op=np=Ux([ar(4,He),ar(5,fi),ar(6,oi)],op);var qN=class{constructor(n,e){this._statusBar=e,n.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}},rp=class extends M{static{sp=this}static{this._DECORATION_OPTIONS=oe.register({description:"content-hover-highlight",className:"hoverHighlight"})}constructor(e,t,i,s,o,r,a){super(),this._hoverService=r,this._clipboardService=a,this._renderedParts=[],this._perPartDisposables=new Map,this._focusedHoverPartIndex=-1,this._context=s,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,s,o,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return M.None;let i=t[0].range;for(const o of t){const r=o.range;i=x.plusRange(i,r)}const s=e.createDecorationsCollection();return s.set([{range:i,options:sp._DECORATION_OPTIONS}]),Te(()=>{s.clear()})}_renderParts(e,t,i,s,o){const r=new pc(s,o),a={fragment:this._fragment,statusBar:r,...i},l=new O;l.add(r);for(const c of e){const h=this._renderHoverPartsForParticipant(t,c,a);l.add(h);for(const u of h.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:c,hoverPart:u.hoverPart,hoverElement:u.hoverElement})}const d=this._renderStatusBar(this._fragment,r);return d&&(l.add(d),this._renderedParts.push({type:"statusBar",hoverElement:d.hoverElement,actions:d.actions})),l}_renderHoverPartsForParticipant(e,t,i){const s=e.filter(o=>o.owner===t);return s.length>0?t.renderHoverParts(i,s):new po([])}_renderStatusBar(e,t){if(t.hasContent)return new qN(e,t)}_registerListenersOnRenderedParts(){return this._renderedParts.forEach((e,t)=>{this._createListenersForPart(t,e)}),Te(()=>{for(const e of this._perPartDisposables.values())e.dispose();this._perPartDisposables.clear()})}_createListenersForPart(e,t){const i=new O,s=t.hoverElement;s.tabIndex=0,i.add(Q(s,we.FOCUS_IN,o=>{o.stopPropagation(),this._focusedHoverPartIndex=e})),i.add(Q(s,we.FOCUS_OUT,o=>{o.stopPropagation(),this._focusedHoverPartIndex=-1})),t.type==="hoverPart"&&!(t.hoverPart instanceof Bg)&&!t.participant.hideCopyButton&&i.add(new Vg(s,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService)),this._perPartDisposables.set(e,i)}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Ja&&!(i instanceof Cc));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof fc)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;let s;t>=0?s={start:t,endExclusive:t+1}:s=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let o=s.start;o<s.endExclusive;o++){const r=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,o);if(r===void 0)continue;const a=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,r);if(!a)continue;const l=this._perPartDisposables.get(o);l&&(l.dispose(),this._perPartDisposables.delete(o)),this._renderedParts[o]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:a.hoverPart,hoverElement:a.hoverElement},this._createListenersForPart(o,this._renderedParts[o])}i&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||i.participant!==e)return;const s=this._renderedParts.findIndex(o=>o.type==="hoverPart"&&o.participant===e);if(s===-1)throw new pt;return t-s}_findRangeOfMarkdownHoverParts(e){const t=this._renderedParts.slice(),i=t.findIndex(o=>o.type==="hoverPart"&&o.participant===e),s=t.reverse().findIndex(o=>o.type==="hoverPart"&&o.participant===e);return{start:i,endExclusive:(s>=0?t.length-s:s)+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};rp=sp=Ux([ar(4,He),ar(5,fi),ar(6,oi)],rp);var $N=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Xl=function(n,e){return function(t,i){e(t,i,n)}},ap=class extends M{constructor(e,t,i,s,o){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._hoverService=s,this._clipboardService=o,this._currentResult=null,this._renderedContentHover=this._register(new We),this._onContentsChanged=this._register(new ee),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(Ng,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new Yy(this._editor,new uk(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of xo.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(t=>{this._participants.forEach(i=>i.handleScroll?.(t))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(t=>t.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{const i=t.hasLoadingMessage?this._addLoadingMessage(t):t.value;this._withResult(new Jy(i,t.isComplete,t.options))}));const e=this._contentHoverWidget.getDomNode();this._register(hn(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(hn(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(Xc.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,i,s,o){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,s,!1),!0):!1;const r=this._editor.getOption(69).sticky,a=o&&this._contentHoverWidget.isMouseGettingCloser(o.event.posx,o.event.posy);return r&&a?(e&&this._startHoverOperationIfNecessary(e,t,i,s,!0),!0):e?this._currentResult&&this._currentResult.options.anchor.equals(e)?!0:this._currentResult&&e.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)?(this._currentResult&&this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,s,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,s,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,s,o){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();const r={anchor:e,source:i,shouldFocus:s,insistOnKeepingHoverVisible:o};this._hoverOperation.start(t,r)}_setCurrentResult(e){let t=e;this._currentResult!==t&&(t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover())}_addLoadingMessage(e){for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(e.options.anchor);if(i)return e.value.slice(0).concat([i])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const t=e.hoverParts.length===0,i=e.options.insistOnKeepingHoverVisible;t&&i||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover.value=new op(this._editor,e,this._participants,t,this._keybindingService,this._hoverService,this._clipboardService),this._renderedContentHover.value.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover.value):this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach(e=>e.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:o=>{this._contentHoverWidget.setMinimumDimensions(o)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing||this._isMouseOnCodeActionWidget(e))return!0;const t=this._findHoverAnchorCandidates(e);if(!(t.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const i=t[0];return this._startShowingOrUpdateHover(i,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const s of this._participants){if(!s.suggestHoverAnchor)continue;const o=s.suggestHoverAnchor(e);o&&t.push(o)}const i=e.target;switch(i.type){case 6:t.push(new tu(0,i.range,e.event.posx,e.event.posy));break;case 7:{const s=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<s))break;t.push(new tu(0,i.range,e.event.posx,e.event.posy));break}}return t.sort((s,o)=>o.priority-s.priority),t}_isMouseOnCodeActionWidget(e){const t=e.event.browserEvent.target;return!!(t instanceof Element&&t.closest(".action-widget"))}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!Ch(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,s){this._startShowingOrUpdateHover(new tu(0,e,void 0,void 0),t,i,s,null)}async updateHoverVerbosityLevel(e,t,i){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(e){this._renderedContentHover.value?.focusHoverPartWithIndex(e)}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover.value?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};ap=$N([Xl(1,ne),Xl(2,He),Xl(3,fi),Xl(4,oi)],ap);function zx(n){const e=n.target;return!!e&&e.type===6&&e.detail.injectedText?.options.attachedData===$y}var KN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},lu=function(n,e){return function(t,i){e(t,i,n)}},lp,Lt=class extends M{static{lp=this}static{this.ID="editor.contrib.contentHover"}constructor(e,t,i,s){super(),this._editor=e,this._instantiationService=i,this._keybindingService=s,this._onHoverContentsChanged=this._register(new ee),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new O,this._isMouseDown=!1,this._ignoreMouseEvents=!1,this._reactToEditorMouseMoveRunner=this._register(new at(()=>{this._mouseMoveEvent&&this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(t.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(t.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(o=>{o.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(lp.ID)}_hookListeners(){const e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled==="off"&&this._cancelSchedulerAndHide(),this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){this._ignoreMouseEvents||(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideContentHover()}_onEditorMouseDown(e){this._ignoreMouseEvents||(this._isMouseDown=!0,!this._shouldKeepHoverWidgetVisible(e)&&this.hideContentHover())}_shouldKeepHoverWidgetVisible(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()||zx(e)}_isMouseOnContentHoverWidget(e){return!this._contentWidget||!this._contentWidget.getDomNode().isConnected?!1:Ch(this._contentWidget.getDomNode(),e.event.posx,e.event.posy)}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),!this._shouldKeepHoverWidgetVisible(e)&&this.hideContentHover())}_shouldKeepCurrentHover(e){const t=this._contentWidget;if(!t)return!1;const i=this._hoverSettings.sticky,s=(c,h)=>{const u=this._isMouseOnContentHoverWidget(c);return h&&u},o=c=>{const h=t.isColorPickerVisible,u=this._isMouseOnContentHoverWidget(c),g=h&&u,p=h&&this._isMouseDown;return g||p},r=(c,h)=>{const u=c.event.browserEvent.view;return u?h&&t.containsNode(u.document.activeElement)&&!u.getSelection()?.isCollapsed:!1},a=t.isFocused,l=t.isResizing,d=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||a||l||d||s(e,i)||o(e)||r(e,i)}_onEditorMouseMove(e){if(!this._ignoreMouseEvents){if(this._isMouseDown&&!this._shouldKeepHoverWidgetVisible(e)){this._cancelSchedulerAndHide();return}if(this._mouseMoveEvent=e,this._shouldKeepCurrentHover(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(e)}}_shouldRescheduleHoverComputation(){const e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){Xy(this._hoverSettings.enabled,this._editor.getOption(86),e)&&this._getOrCreateContentWidget().showsOrWillShow(e)||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&c_(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}const t=this._isPotentialKeyboardShortcut(e),i=tw(e.keyCode);t||i||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1,s=t.kind===2&&(t.commandId==="editor.action.showHover"||t.commandId==="editor.action.increaseHoverVerbosityLevel"||t.commandId==="editor.action.decreaseHoverVerbosityLevel")&&this._contentWidget.isVisible;return i||s}hideContentHover(){wr.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(ap,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,s){this._getOrCreateContentWidget().startShowingAtRange(e,t,i,s)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){this._contentWidget?.focus()}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}};Lt=lp=KN([lu(1,Sl),lu(2,ne),lu(3,He)],Lt);var Ib=class extends M{static{this.ID="editor.contrib.colorContribution"}constructor(n){super(),this._editor=n,this._register(n.onMouseDown(e=>this.onMouseDown(e)))}dispose(){super.dispose()}onMouseDown(n){const e=this._editor.getOption(169);if(e!=="click"&&e!=="clickAndHover"||!zx(n))return;const t=this._editor.getContribution(Lt.ID);if(!t||t.isColorPickerVisible)return;const i=n.target.range;if(!i)return;const s=new x(i.startLineNumber,i.startColumn+1,i.endLineNumber,i.endColumn+1);t.showContentHover(s,1,1,!1)}},GN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ZN=function(n,e){return function(t,i){e(t,i,n)}},XN=class jx{constructor(e,t,i,s){this.owner=e,this.range=t,this.model=i,this.provider=s}static fromBaseColor(e,t){return new jx(e,t.range,t.model,t.provider)}},YN=class extends M{constructor(n,e,t,i){super();const s=n.getModel(),o=t.model;this.color=t.model.color,this.colorPicker=this._register(new hx(e.fragment,o,n.getOption(164),i,"standalone")),this._register(o.onColorFlushed(r=>{this.color=r})),this._register(o.onDidChangeColor(r=>{Qa(s,o,r,t.range,t)})),this._register(n.onDidChangeModelContent(r=>{e.hide(),n.focus()})),Qa(s,o,this.color,t.range,t)}},dp=class{constructor(e,t){this._editor=e,this._themeService=t}async createColorHover(e,t,i){if(!this._editor.hasModel()||!Cr.get(this._editor))return null;const s=await zy(i,this._editor.getModel(),he.None);let o=null,r=null;for(const c of s){const h=c.colorInfo;x.containsRange(h.range,e.range)&&(o=h,r=c.provider)}const a=o??e,l=r??t,d=!!o;return{colorHover:XN.fromBaseColor(this,await ux(this._editor.getModel(),a,l)),foundInEditor:d}}async updateEditorModel(e,t){if(!this._editor.hasModel())return;const i=e.model;let s=new x(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await Qa(this._editor.getModel(),i,this._color,s,e),s=gx(this._editor,s,i,t))}renderHoverParts(e,t){if(!(t.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(e),this._renderedParts=new YN(this._editor,e,t[0],this._themeService),this._renderedParts}_setMinimumDimensions(e){const t=this._editor.getOption(75)+8;e.setMinimumDimensions(new Pe(302,t))}get _color(){return this._renderedParts?.color}};dp=GN([ZN(1,Dt)],dp);var JN=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Zr=function(n,e){return function(t,i){e(t,i,n)}},cp,QN=class{constructor(n,e){this.value=n,this.foundInEditor=e}},Lb=8,eM=22,hp=class extends M{static{cp=this}static{this.ID="editor.contrib.standaloneColorPickerWidget"}constructor(e,t,i,s,o,r,a,l){super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=o,this._languageFeaturesService=r,this._editorWorkerService=a,this._hoverService=l,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new ee),this.onResult=this._onResult.event,this._renderedHoverParts=this._register(new We),this._renderedStatusBar=this._register(new We),this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=s.createInstance(dp,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;const d=this._editor.getSelection();this._selections=this._editor.getSelections()??[];const c=d?{startLineNumber:d.startLineNumber,startColumn:d.startColumn,endLineNumber:d.endLineNumber,endColumn:d.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(us(this._body));this._register(h.onDidBlur(u=>{this.hide()})),this._register(h.onDidFocus(u=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide(),this._selections=this._editor.getSelections()??[]})),this._register(this._editor.onMouseMove(u=>{const g=u.target.element?.classList;g&&g.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(u=>{this._render(u.value,u.foundInEditor)})),this._start(c),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover,this._selections)}getId(){return cp.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(69).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new QN(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new Ya(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new pc(this._keybindingService,this._hoverService));const s={fragment:i,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(s,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}const o=this._renderedHoverParts.value.colorPicker;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(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),o.layout();const r=o.body,a=r.saturationBox.domNode.clientWidth,l=r.domNode.clientWidth-a-eM-Lb,d=o.body.enterButton;d?.onClicked(()=>{this.updateEditor(),this.hide()});const c=o.header,h=c.pickedColorNode;h.style.width=a+Lb+"px";const u=c.originalColorNode;u.style.width=l+"px",o.header.closeButton?.onClicked(()=>{this.hide()}),t&&(d&&(d.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};hp=cp=JN([Zr(3,ne),Zr(4,He),Zr(5,X),Zr(6,Vn),Zr(7,fi)],hp);var tM=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Db=function(n,e){return function(t,i){e(t,i,n)}},up,mo=class extends M{static{up=this}static{this.ID="editor.contrib.standaloneColorPickerController"}constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=S.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=S.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(hp,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(up.ID)}};mo=up=tM([Db(1,Ce),Db(2,ne)],mo);var iM=class extends mi{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...L(940,"Show or Focus Standalone Color Picker"),mnemonicTitle:m(939,"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:K.CommandPalette}],metadata:{description:L(941,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(n,e){mo.get(e)?.showOrFocus()}},nM=class extends A{constructor(){super({id:"editor.action.hideColorPicker",label:L(942,"Hide the Color Picker"),precondition:S.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:L(943,"Hide the standalone color picker.")}})}run(n,e){mo.get(e)?.hide()}},sM=class extends A{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:L(944,"Insert Color with Standalone Color Picker"),precondition:S.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:L(945,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(n,e){mo.get(e)?.insertColor()}};P(nM);P(sM);me(iM);de(Ib.ID,Ib,2);de(mo.ID,mo,1);de(Cr.ID,Cr,1);Mr(Eg);xo.register(fc);Me.registerCommand("_executeDocumentColorProvider",function(n,...e){const[t]=e;if(!(t instanceof ke))throw Pn();const{model:i,colorProviderRegistry:s,defaultColorDecoratorsEnablement:o}=qy(n,t);return o_(new V1,s,i,he.None,o)});Me.registerCommand("_executeColorPresentationProvider",function(n,...e){const[t,i]=e;if(!i)return;const{uri:s,range:o}=i;if(!(s instanceof ke)||!Array.isArray(t)||t.length!==4||!x.isIRange(o))throw Pn();const{model:r,colorProviderRegistry:a,defaultColorDecoratorsEnablement:l}=qy(n,s),[d,c,h,u]=t;return o_(new B1({range:o,color:{red:d,green:c,blue:h,alpha:u}}),a,r,he.None,l)});var ca=class gp{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const s=t.length,o=e.length;if(i+s>o)return!1;for(let r=0;r<s;r++){const a=e.charCodeAt(i+r),l=t.charCodeAt(r);if(a!==l&&!(a>=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,s,o,r){const a=e.startLineNumber,l=e.startColumn,d=e.endLineNumber,c=e.endColumn,h=o.getLineContent(a),u=o.getLineContent(d);let g=h.lastIndexOf(t,l-1+t.length),p=u.indexOf(i,c-1-i.length);if(g!==-1&&p!==-1)if(a===d)h.substring(g+t.length,p).indexOf(i)>=0&&(g=-1,p=-1);else{const _=h.substring(g+t.length),v=u.substring(0,p);(_.indexOf(i)>=0||v.indexOf(i)>=0)&&(g=-1,p=-1)}let f;g!==-1&&p!==-1?(s&&g+t.length<h.length&&h.charCodeAt(g+t.length)===32&&(t=t+" "),s&&p>0&&u.charCodeAt(p-1)===32&&(i=" "+i,p-=1),f=gp._createRemoveBlockCommentOperations(new x(a,g+t.length+1,d,p+1),t,i)):(f=gp._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=f.length===1?i:null);for(const _ of f)r.addTrackedEditOperation(_.range,_.text)}static _createRemoveBlockCommentOperations(e,t,i){const s=[];return x.isEmpty(e)?s.push(Xe.delete(new x(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(s.push(Xe.delete(new x(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),s.push(Xe.delete(new x(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),s}static _createAddBlockCommentOperations(e,t,i,s){const o=[];return x.isEmpty(e)?o.push(Xe.replace(new x(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(o.push(Xe.insert(new B(e.startLineNumber,e.startColumn),t+(s?" ":""))),o.push(Xe.insert(new B(e.endLineNumber,e.endColumn),(s?" ":"")+i))),o}getEditOperations(e,t){const i=this._selection.startLineNumber,s=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const o=e.getLanguageIdAtPosition(i,s),r=this.languageConfigurationService.getLanguageConfiguration(o).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const s=i[0],o=i[1];return new ie(s.range.endLineNumber,s.range.endColumn,o.range.startLineNumber,o.range.startColumn)}else{const s=i[0].range,o=this._usedEndToken?-this._usedEndToken.length-1:0;return new ie(s.endLineNumber,s.endColumn+o,s.endLineNumber,s.endColumn+o)}}},oM=class Yn{constructor(e,t,i,s,o,r,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=s,this._insertSpace=o,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,s){e.tokenization.tokenizeIfCheap(t);const o=e.getLanguageIdAtPosition(t,1),r=s.getLanguageConfiguration(o).comments,a=r?r.lineCommentToken:null;if(!a)return null;const l=[];for(let d=0,c=i-t+1;d<c;d++)l[d]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return l}static _analyzeLines(e,t,i,s,o,r,a,l,d){let c=!0;const h=l.getLanguageConfiguration(d).comments?.lineCommentNoIndent??!1;let u;e===0?u=!0:e===1?u=!1:u=!0;for(let g=0,p=s.length;g<p;g++){const f=s[g],_=o+g;if(_===o&&a){f.ignore=!0;continue}const v=i.getLineContent(_),C=ag(v);if(C===-1){f.ignore=r,f.commentStrOffset=h?0:v.length;continue}c=!1;const w=h?0:C;if(f.ignore=!1,f.commentStrOffset=w,u&&!ca._haystackHasNeedleAtOffset(v,f.commentStr,w)&&(e===0?u=!1:e===1||(f.ignore=!0)),u&&t){const y=C+f.commentStrLength;y<v.length&&v.charCodeAt(y)===32&&(f.commentStrLength+=1)}}if(e===0&&c){u=!1;for(let g=0,p=s.length;g<p;g++)s[g].ignore=!1}return{supported:!0,shouldRemoveComments:u,lines:s}}static _gatherPreflightData(e,t,i,s,o,r,a,l){const d=Yn._gatherPreflightCommentStrings(i,s,o,l),c=i.getLanguageIdAtPosition(s,1);return d===null?{supported:!1}:Yn._analyzeLines(e,t,i,d,s,r,a,l,c)}_executeLineComments(e,t,i,s){let o;i.shouldRemoveComments?o=Yn._createRemoveLineCommentsOperations(i.lines,s.startLineNumber):(Yn._normalizeInsertionPoint(e,i.lines,s.startLineNumber,this._indentSize),o=this._createAddLineCommentsOperations(i.lines,s.startLineNumber));const r=new B(s.positionLineNumber,s.positionColumn);for(let a=0,l=o.length;a<l;a++)t.addEditOperation(o[a].range,o[a].text),x.isEmpty(o[a].range)&&x.getStartPosition(o[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(o[a].text||"").length);this._selectionId=t.trackSelection(s)}_attemptRemoveBlockComment(e,t,i,s){let o=t.startLineNumber,r=t.endLineNumber;const a=s.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let l=e.getLineContent(o).lastIndexOf(i,a-1),d=e.getLineContent(r).indexOf(s,t.endColumn-1-i.length);return l!==-1&&d===-1&&(d=e.getLineContent(o).indexOf(s,l+i.length),r=o),l===-1&&d!==-1&&(l=e.getLineContent(r).lastIndexOf(i,d),o=r),t.isEmpty()&&(l===-1||d===-1)&&(l=e.getLineContent(o).indexOf(i),l!==-1&&(d=e.getLineContent(o).indexOf(s,l+i.length))),l!==-1&&e.getLineContent(o).charCodeAt(l+i.length)===32&&(i+=" "),d!==-1&&e.getLineContent(r).charCodeAt(d-1)===32&&(s=" "+s,d-=1),l!==-1&&d!==-1?ca._createRemoveBlockCommentOperations(new x(o,l+i.length+1,r,d+1),i,s):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const s=e.getLanguageIdAtPosition(i.startLineNumber,1),o=this.languageConfigurationService.getLanguageConfiguration(s).comments;if(!o||!o.blockCommentStartToken||!o.blockCommentEndToken)return;const r=o.blockCommentStartToken,a=o.blockCommentEndToken;let l=this._attemptRemoveBlockComment(e,i,r,a);if(!l){if(i.isEmpty()){const d=e.getLineContent(i.startLineNumber);let c=ag(d);c===-1&&(c=d.length),l=ca._createAddBlockCommentOperations(new x(i.startLineNumber,c+1,i.startLineNumber,d.length+1),r,a,this._insertSpace)}else l=ca._createAddBlockCommentOperations(new x(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const d of l)t.addEditOperation(d.range,d.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new x(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
|
|
12
|
+
`),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const s=Yn._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return s.supported?this._executeLineComments(e,t,s,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new ie(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let s=0,o=e.length;s<o;s++){const r=e[s];r.ignore||i.push(Xe.delete(new x(t+s,r.commentStrOffset+1,t+s,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],s=this._insertSpace?" ":"";for(let o=0,r=e.length;o<r;o++){const a=e[o];a.ignore||i.push(Xe.insert(new B(t+o,a.commentStrOffset+1),a.commentStr+s))}return i}static nextVisibleColumn(e,t,i,s){return i?e+(t-e%t):e+s}static _normalizeInsertionPoint(e,t,i,s){let o=1073741824,r,a;for(let l=0,d=t.length;l<d;l++){if(t[l].ignore)continue;const c=e.getLineContent(i+l);let h=0;for(let u=0,g=t[l].commentStrOffset;h<o&&u<g;u++)h=Yn.nextVisibleColumn(h,s,c.charCodeAt(u)===9,1);h<o&&(o=h)}o=Math.floor(o/s)*s;for(let l=0,d=t.length;l<d;l++){if(t[l].ignore)continue;const c=e.getLineContent(i+l);let h=0;for(r=0,a=t[l].commentStrOffset;h<o&&r<a;r++)h=Yn.nextVisibleColumn(h,s,c.charCodeAt(r)===9,1);h>o?t[l].commentStrOffset=r-1:t[l].commentStrOffset=r}}},w_=class extends A{constructor(n,e){super(e),this._type=n}run(n,e){const t=n.get(ct);if(!e.hasModel())return;const i=e.getModel(),s=[],o=i.getOptions(),r=e.getOption(29),a=e.getSelections().map((d,c)=>({selection:d,index:c,ignoreFirstLine:!1}));a.sort((d,c)=>x.compareRangesUsingStarts(d.selection,c.selection));let l=a[0];for(let d=1;d<a.length;d++){const c=a[d];l.selection.endLineNumber===c.selection.startLineNumber&&(l.index<c.index?c.ignoreFirstLine=!0:(l.ignoreFirstLine=!0,l=c))}for(const d of a)s.push(new oM(t,d.selection,o.indentSize,this._type,r.insertSpace,r.ignoreEmptyLines,d.ignoreFirstLine));e.pushUndoStop(),e.executeCommands(this.id,s),e.pushUndoStop()}},rM=class extends w_{constructor(){super(0,{id:"editor.action.commentLine",label:L(948,"Toggle Line Comment"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:K.MenubarEditMenu,group:"5_insert",title:m(946,"&&Toggle Line Comment"),order:1},canTriggerInlineEdits:!0})}},aM=class extends w_{constructor(){super(1,{id:"editor.action.addCommentLine",label:L(949,"Add Line Comment"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2081),weight:100},canTriggerInlineEdits:!0})}},lM=class extends w_{constructor(){super(2,{id:"editor.action.removeCommentLine",label:L(950,"Remove Line Comment"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2099),weight:100},canTriggerInlineEdits:!0})}},dM=class extends A{constructor(){super({id:"editor.action.blockComment",label:L(951,"Toggle Block Comment"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:K.MenubarEditMenu,group:"5_insert",title:m(947,"Toggle &&Block Comment"),order:2},canTriggerInlineEdits:!0})}run(n,e){const t=n.get(ct);if(!e.hasModel())return;const i=e.getOption(29),s=[],o=e.getSelections();for(const r of o)s.push(new ca(r,i.insertSpace,t));e.pushUndoStop(),e.executeCommands(this.id,s),e.pushUndoStop()}};P(rM);P(aM);P(lM);P(dM);var cM=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ws=function(n,e){return function(t,i){e(t,i,n)}},pp,tl=class{static{pp=this}static{this.ID="editor.contrib.contextmenu"}static get(e){return e.getContribution(pp.ID)}constructor(e,t,i,s,o,r,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=s,this._keybindingService=o,this._menuService=r,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new O,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(d=>this._onContextMenu(d))),this._toDispose.add(this._editor.onMouseWheel(d=>{if(this._contextMenuIsBeingShownCount>0){const c=this._contextViewService.getContextViewElement(),h=d.srcElement;h.shadowRoot&&G0(c)===h.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(d=>{this._editor.getOption(30)&&d.keyCode===58&&(d.preventDefault(),d.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const s of this._editor.getSelections())if(s.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(30)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],s=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const o of s){const[,r]=o;let a=0;for(const l of r)if(l instanceof OE){const d=this._getMenuActions(e,l.item.submenu);d.length>0&&(i.push(new Jo(l.id,l.label,d)),a++)}else i.push(l),a++;a&&i.push(new Ua)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;let i=t;if(!i){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const o=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),r=Mt(this._editor.getDomNode());i={x:r.left+o.left,y:r.top+o.top+o.height}}const s=this._editor.getOption(144)&&!Ju;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,useWindowContainerForShadowRoot:s&&this._editor.getOption(51),getAnchor:()=>i,getActions:()=>e,getActionViewItem:o=>{const r=this._keybindingFor(o);if(r)return new cg(o,o,{label:!0,keybinding:r.getLabel(),isMenu:!0});const a=o;return typeof a.getActionViewItem=="function"?a.getActionViewItem():new cg(o,o,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:o=>this._keybindingFor(o),onHide:o=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||UR(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(81);let i=0;const s=d=>({id:`menu-action-${++i}`,label:d.label,tooltip:"",class:void 0,enabled:typeof d.enabled>"u"?!0:d.enabled,checked:d.checked,run:d.run}),o=(d,c)=>new Jo(`menu-action-${++i}`,d,c,void 0),r=(d,c,h,u,g)=>{if(!c)return s({label:d,enabled:c,run:()=>{}});const p=_=>()=>{this._configurationService.updateValue(h,_)},f=[];for(const _ of g)f.push(s({label:_.label,checked:u===_.value,run:p(_.value)}));return o(d,f)},a=[];a.push(s({label:m(952,"Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new Ua),a.push(s({label:m(953,"Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(m(954,"Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:m(955,"Proportional"),value:"proportional"},{label:m(956,"Fill"),value:"fill"},{label:m(957,"Fit"),value:"fit"}])),a.push(r(m(958,"Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:m(959,"Mouse Over"),value:"mouseover"},{label:m(960,"Always"),value:"always"}])),a.push(r(m(961,"Side"),t.enabled,"editor.minimap.side",t.side,[{label:m(962,"Right"),value:"right"},{label:m(963,"Left"),value:"left"}]));const l=this._editor.getOption(144)&&!Ju;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,useWindowContainerForShadowRoot:l&&this._editor.getOption(51),getAnchor:()=>e,getActions:()=>a,onHide:d=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};tl=pp=cM([Ws(1,Sl),Ws(2,dh),Ws(3,Ce),Ws(4,He),Ws(5,Ts),Ws(6,Ee),Ws(7,Cs)],tl);var hM=class extends A{constructor(){super({id:"editor.action.showContextMenu",label:L(964,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:1092,weight:100}})}run(n,e){tl.get(e)?.showContextMenu()}};de(tl.ID,tl,2);P(hM);var du=class{constructor(n){this.selections=n}equals(n){const e=this.selections.length;if(e!==n.selections.length)return!1;for(let t=0;t<e;t++)if(!this.selections[t].equalsSelection(n.selections[t]))return!1;return!0}},cu=class{constructor(n,e,t){this.cursorState=n,this.scrollTop=e,this.scrollLeft=t}},Sc=class qx extends M{static{this.ID="editor.contrib.cursorUndoRedoController"}static get(e){return e.getContribution(qx.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new du(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new cu(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new cu(new du(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new cu(new du(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}},uM=class extends A{constructor(){super({id:"cursorUndo",label:L(965,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:2099,weight:100}})}run(n,e,t){Sc.get(e)?.cursorUndo()}},gM=class extends A{constructor(){super({id:"cursorRedo",label:L(966,"Cursor Redo"),precondition:void 0})}run(n,e,t){Sc.get(e)?.cursorRedo()}};de(Sc.ID,Sc,0);P(uM);P(gM);var pM=class{constructor(n,e,t){this.selection=n,this.targetPosition=e,this.copy=t,this.targetSelection=null}getEditOperations(n,e){const t=n.getValueInRange(this.selection);if(this.copy||e.addEditOperation(this.selection,null),e.addEditOperation(new x(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),t),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new ie(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);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new ie(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);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new ie(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);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new ie(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.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new ie(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(n,e){return this.targetSelection}};function ko(n){return On?n.altKey:n.ctrlKey}var Eb=class Md extends M{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=On?6:5}constructor(e){super(),this._editor=e,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(e){!this._editor.getOption(42)||this._editor.getOption(28)||(ko(e)&&(this._modifierPressed=!0),this._mouseDown&&ko(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(42)||this._editor.getOption(28)||(ko(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Md.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const i=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(i.length===1)this._dragSelection=i[0];else return}ko(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new B(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const s=this._editor.getSelection();if(s){const{selectionStartLineNumber:o,selectionStartColumn:r}=s;i=[new ie(o,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(s=>s.containsPosition(t)?new ie(t.lineNumber,t.column,t.lineNumber,t.column):s);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(ko(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Md.ID,new pM(this._dragSelection,t,ko(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=oe.register({description:"dnd-target",className:"dnd-target"})}showAt(e){this._dndDecorationIds.set([{range:new x(e.lineNumber,e.column,e.lineNumber,e.column),options:Md._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};de(Eb.ID,Eb,2);var fM="editor.action.pasteAs";de(Hn.ID,Hn,0);Mr(fg);Z(new class extends Ft{constructor(){super({id:Sy,precondition:i_,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e){return Hn.get(e)?.changePasteType()}});Z(new class extends Ft{constructor(){super({id:"editor.hidePasteWidget",precondition:i_,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e){Hn.get(e)?.clearWidgets()}});P(class $x extends A{static{this.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:m(967,`The kind of the paste edit to try pasting with.
|
|
13
|
+
If there are multiple edits for this kind, the editor will show a picker. If there are no edits of this kind, the editor will show an error message.`)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:m(968,`List of preferred paste edit kind to try applying.
|
|
14
|
+
The first edit matching the preferences will be applied.`),items:{type:"string"}}}}]}}constructor(){super({id:fM,label:L(969,"Paste As..."),precondition:S.writable,metadata:{description:"Paste as",args:[{name:"args",schema:$x.argsSchema}]},canTriggerInlineEdits:!0})}run(e,t,i){let s;return i&&("kind"in i?s={only:new ze(i.kind)}:"preferences"in i&&(s={preferences:i.preferences.map(o=>new ze(o))})),Hn.get(t)?.pasteAs(s)}});P(class extends A{constructor(){super({id:"editor.action.pasteAsText",label:L(970,"Paste as Text"),precondition:S.writable,canTriggerInlineEdits:!0})}run(n,e){return Hn.get(e)?.pasteAs({providerId:Ka.id})}});var mM=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(n){if(n&&this._dragOperations.has(n)){const e=this._dragOperations.get(n);return this._dragOperations.delete(n),e}}},Rb=class{constructor(n){this.identifier=n}},Kx=fn("treeViewsDndService");zn(Kx,mM,1);var _M=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Yl=function(n,e){return function(t,i){e(t,i,n)}},wn,vM="editor.dropIntoEditor.preferences",Gx="editor.changeDropType",y_=new ae("dropWidgetVisible",!1,m(988,"Whether the drop widget is showing")),xr=class extends M{static{wn=this}static{this.ID="editor.contrib.dropIntoEditorController"}static get(e){return e.getContribution(wn.ID)}constructor(e,t,i,s,o){super(),this._configService=i,this._languageFeaturesService=s,this._treeViewsDragAndDropService=o,this.treeItemsTransfer=zT.getInstance(),this._dropProgressManager=this._register(t.createInstance(lc,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(uc,"dropIntoEditor",e,y_,{id:Gx,label:m(989,"Show drop options...")},()=>wn._configureDefaultAction?[wn._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){if(!i.dataTransfer||!e.hasModel())return;wn._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);const s=mt(async o=>{const r=new O,a=r.add(new lo(e,1,void 0,o));try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const d=e.getModel();if(!d)return;const c=this._languageFeaturesService.documentDropEditProvider.ordered(d).filter(u=>u.dropMimeTypes?u.dropMimeTypes.some(g=>l.matches(g)):!0),h=r.add(await this.getDropEdits(c,d,t,l,a.token));if(a.token.isCancellationRequested)return;if(h.edits.length){const u=this.getInitialActiveEditIndex(d,h.edits),g=e.getOption(43).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([x.fromPositions(t)],{activeEditIndex:u,allEdits:h.edits},g,async p=>p,o)}}finally{r.dispose(),wn._currentDropOperation===s&&(wn._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,m(990,"Running drop handlers. Click to cancel"),s,{cancel:()=>s.cancel()}),wn._currentDropOperation=s}async getDropEdits(e,t,i,s,o){const r=new O,a=await gr(Promise.all(e.map(async d=>{try{const c=await d.provideDocumentDropEdits(t,i,s,o);return c&&r.add(c),c?.edits.map(h=>({...h,providerId:d.id}))}catch(c){Un(c)||console.error(c),console.error(c)}})),o),l=Ps(a??[]).flat();return{edits:_y(l),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(vM,{resource:e.uri});for(const s of Array.isArray(i)?i:[]){const o=new ze(s),r=t.findIndex(a=>a.kind&&o.contains(a.kind));if(r>=0)return r}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new pw;const t=sR(e.dataTransfer);if(this.treeItemsTransfer.hasData(Rb.prototype)){const i=this.treeItemsTransfer.getData(Rb.prototype);if(Array.isArray(i))for(const s of i){const o=await this._treeViewsDragAndDropService.removeDragOperationTransfer(s.identifier);if(o)for(const[r,a]of o)t.replace(r,a)}}return t}};xr=wn=_M([Yl(1,ne),Yl(2,Ee),Yl(3,X),Yl(4,Kx)],xr);de(xr.ID,xr,2);Mr(pg);Z(new class extends Ft{constructor(){super({id:Gx,precondition:y_,kbOpts:{weight:100,primary:2137}})}runEditorCommand(n,e,t){xr.get(e)?.changeDropType()}});Z(new class extends Ft{constructor(){super({id:"editor.hideDropWidget",precondition:y_,kbOpts:{weight:100,primary:9}})}runEditorCommand(n,e,t){xr.get(e)?.clearWidgets()}});var bM=class Zx extends Il{static{this.ID="editor.contrib.findOptionsWidget"}constructor(e,t,i){super(),this._hideSoon=this._register(new at(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,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:De(lw),inputActiveOptionForeground:De(VS),inputActiveOptionBackground:De(Im)},o={groupId:"find-options-widget"};this.caseSensitive=this._register(new o0({appendTitle:this._keybindingLabelFor(Ne.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:o,...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 X0({appendTitle:this._keybindingLabelFor(Ne.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:o,...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 YR({appendTitle:this._keybindingLabelFor(Ne.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:o,...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(r=>{let a=!1;r.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),r.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),r.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(Q(this._domNode,we.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(Q(this._domNode,"mouseover",r=>this._onMouseOver()))}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding("",e)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Zx.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 Jl(n,e){return n===1?!0:n===2?!1:e}var CM=class extends M{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Jl(this._isRegexOverride,this._isRegex)}get wholeWord(){return Jl(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Jl(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Jl(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new ee),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(n,e,t){const i={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 s=!1;e===0&&(n=0),n>e&&(n=e),this._matchesPosition!==n&&(this._matchesPosition=n,i.matchesPosition=!0,s=!0),this._matchesCount!==e&&(this._matchesCount=e,i.matchesCount=!0,s=!0),typeof t<"u"&&(x.equalsRange(this._currentMatch,t)||(this._currentMatch=t,i.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(i)}change(n,e,t=!0){const i={moveCursor:e,updateHistory:t,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 s=!1;const o=this.isRegex,r=this.wholeWord,a=this.matchCase,l=this.preserveCase;typeof n.searchString<"u"&&this._searchString!==n.searchString&&(this._searchString=n.searchString,i.searchString=!0,s=!0),typeof n.replaceString<"u"&&this._replaceString!==n.replaceString&&(this._replaceString=n.replaceString,i.replaceString=!0,s=!0),typeof n.isRevealed<"u"&&this._isRevealed!==n.isRevealed&&(this._isRevealed=n.isRevealed,i.isRevealed=!0,s=!0),typeof n.isReplaceRevealed<"u"&&this._isReplaceRevealed!==n.isReplaceRevealed&&(this._isReplaceRevealed=n.isReplaceRevealed,i.isReplaceRevealed=!0,s=!0),typeof n.isRegex<"u"&&(this._isRegex=n.isRegex),typeof n.wholeWord<"u"&&(this._wholeWord=n.wholeWord),typeof n.matchCase<"u"&&(this._matchCase=n.matchCase),typeof n.preserveCase<"u"&&(this._preserveCase=n.preserveCase),typeof n.searchScope<"u"&&(n.searchScope?.every(d=>this._searchScope?.some(c=>!x.equalsRange(c,d)))||(this._searchScope=n.searchScope,i.searchScope=!0,s=!0)),typeof n.loop<"u"&&this._loop!==n.loop&&(this._loop=n.loop,i.loop=!0,s=!0),typeof n.isSearching<"u"&&this._isSearching!==n.isSearching&&(this._isSearching=n.isSearching,i.isSearching=!0,s=!0),typeof n.filters<"u"&&(this._filters?this._filters.update(n.filters):this._filters=n.filters,i.filters=!0,s=!0),this._isRegexOverride=typeof n.isRegexOverride<"u"?n.isRegexOverride:0,this._wholeWordOverride=typeof n.wholeWordOverride<"u"?n.wholeWordOverride:0,this._matchCaseOverride=typeof n.matchCaseOverride<"u"?n.matchCaseOverride:0,this._preserveCaseOverride=typeof n.preserveCaseOverride<"u"?n.preserveCaseOverride:0,o!==this.isRegex&&(s=!0,i.isRegex=!0),r!==this.wholeWord&&(s=!0,i.wholeWord=!0),a!==this.matchCase&&(s=!0,i.matchCase=!0),l!==this.preserveCase&&(s=!0,i.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(i)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=19999}},SM=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},wM=function(n,e){return function(t,i){e(t,i,n)}},Jn,fp=class{static{Jn=this}static{this.FIND_HISTORY_KEY="workbench.find.history"}static{this._instance=null}static getOrCreate(e){return Jn._instance||(Jn._instance=new Jn(e)),Jn._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new ee,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){const t=this.inMemoryValues.delete(e);return this.save(),t}add(e){return this.inMemoryValues.add(e),this.save(),this}has(e){return this.inMemoryValues.has(e)}forEach(e,t){return this.load(),this.inMemoryValues.forEach(e)}replace(e){this.inMemoryValues=new Set(e),this.save()}load(){let e;const t=this.storageService.get(Jn.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){const e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(Jn.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}};fp=Jn=SM([wM(0,Ni)],fp);var yM=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},xM=function(n,e){return function(t,i){e(t,i,n)}},Qn,mp=class{static{Qn=this}static{this.FIND_HISTORY_KEY="workbench.replace.history"}static{this._instance=null}static getOrCreate(e){return Qn._instance||(Qn._instance=new Qn(e)),Qn._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new ee,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){const t=this.inMemoryValues.delete(e);return this.save(),t}add(e){return this.inMemoryValues.add(e),this.save(),this}has(e){return this.inMemoryValues.has(e)}forEach(e,t){return this.load(),this.inMemoryValues.forEach(e)}replace(e){this.inMemoryValues=new Set(e),this.save()}load(){let e;const t=this.storageService.get(Qn.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){const e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(Qn.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}};mp=Qn=yM([xM(0,Ni)],mp);var Xx=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ei=function(n,e){return function(t,i){e(t,i,n)}},_p,IM=524288;function vp(n,e="single",t=!1){if(!n.hasModel())return null;const i=n.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const s=n.getConfiguredWordAtPosition(i.getStartPosition());if(s&&t===!1)return s.word}else if(n.getModel().getValueLengthInRange(i)<IM)return n.getModel().getValueInRange(i)}return null}var zt=class extends M{static{_p=this}static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(e){return e.getContribution(_p.ID)}constructor(e,t,i,s,o,r){super(),this._editor=e,this._findWidgetVisible=jn.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=s,this._notificationService=o,this._hoverService=r,this._updateHistoryDelayer=this._register(new bs(500)),this._state=this._register(new CM),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(a=>this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=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),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(50).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.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!!Sh.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()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=Va(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const s=vp(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);s&&(this._state.isRegex?i.searchString=Va(s):i.searchString=s)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const s=vp(this._editor,e.seedSearchStringFromSelection);s&&(i.searchString=s)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const s=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;s&&(i.searchString=s)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const s=this._editor.getSelections();s.some(o=>!o.isEmpty())&&(i.searchScope=s)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new wk(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(m(994,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}};zt=_p=Xx([ei(1,Ce),ei(2,Ni),ei(3,oi),ei(4,Rt),ei(5,fi)],zt);var bp=class extends zt{constructor(e,t,i,s,o,r,a,l,d,c){super(e,i,r,a,o,l),this._contextViewService=t,this._keybindingService=s,this._configurationService=d,this._accessibilityService=c,this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=fp.getOrCreate(r),this._replaceWidgetHistory=mp.getOrCreate(r)}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let s=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":s=!0;break;case"never":s=!1;break;case"multiline":s=!!i&&i.startLineNumber!==i.endLineNumber}e.updateSearchScope=e.updateSearchScope||s,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new qs(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._hoverService,this._findWidgetSearchHistory,this._replaceWidgetHistory,this._configurationService,this._accessibilityService)),this._findOptionsWidget=this._register(new bM(this._editor,this._state,this._keybindingService))}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};bp=Xx([ei(1,dh),ei(2,Ce),ei(3,He),ei(4,Rt),ei(5,Ni),ei(6,oi),ei(7,fi),ei(8,Ee),ei(9,So)],bp);var LM=rh(new gh({id:Ne.StartFindAction,label:L(1002,"Find"),precondition:k.or(S.focus,k.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:K.MenubarEditMenu,group:"3_find",title:m(995,"&&Find"),order:1}}));LM.addImplementation(0,(n,e,t)=>{const i=zt.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}):!1});var DM={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"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]},EM=class extends A{constructor(){super({id:Ne.StartFindWithArgs,label:L(1003,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:DM})}async run(n,e,t){const i=zt.get(e);if(i){const s=t?{searchString:t.searchString,replaceString:t.replaceString,isReplaceRevealed:t.replaceString!==void 0,isRegex:t.isRegex,wholeWord:t.matchWholeWord,matchCase:t.isCaseSensitive,preserveCase:t.preserveCase}:{};await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:t?.findInSelection||!1,loop:e.getOption(50).loop},s),i.setGlobalBufferTerm(i.getState().searchString)}}},RM=class extends A{constructor(){super({id:Ne.StartFindWithSelection,label:L(1004,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(n,e){const t=zt.get(e);t&&(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),t.setGlobalBufferTerm(t.getState().searchString))}};async function Yx(n,e){const t=zt.get(n);if(!t)return;const i=n.getOption(50).closeOnResult,s=t.getState().isRevealed,o=()=>{const r=t.editor.getSelection(),a=e?t.moveToNextMatch():t.moveToPrevMatch();let l=!1;if(a){const d=t.editor.getSelection();(!r&&d||r&&d&&!r.equalsSelection(d))&&(l=!0)}return l?(t.editor.pushUndoStop(),i&&s&&t.isFindInputFocused()&&t.closeFindWidget(),!0):!1};if(!o()&&(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:t.getState().searchString.length===0&&n.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:n.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:n.getOption(50).loop}),!o())){const r=t.getState();s&&r.matchesCount===0&&r.searchString&&gi(m(996,"{0} found for '{1}'",Wg,r.searchString))}}var TM=rh(new gh({id:Ne.NextMatchFindAction,label:L(1005,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:S.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:k.and(S.focus,Sh),primary:3,weight:100}]}));TM.addImplementation(0,async(n,e,t)=>Yx(e,!0));var PM=rh(new gh({id:Ne.PreviousMatchFindAction,label:L(1006,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:S.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:k.and(S.focus,Sh),primary:1027,weight:100}]}));PM.addImplementation(0,async(n,e,t)=>Yx(e,!1));var kM=class extends A{constructor(){super({id:Ne.GoToMatchFindAction,label:L(1007,"Go to Match..."),precondition:jn}),this._highlightDecorations=[]}run(n,e){const t=zt.get(e);if(!t)return;const i=t.getState().matchesCount;if(i<1){n.get(Rt).notify({severity:Yc.Warning,message:m(997,"No matches. Try searching for something else.")});return}const s=n.get(Ri),o=new O,r=o.add(s.createInputBox());r.placeholder=m(998,"Type a number to go to a specific match (between 1 and {0})",i);const a=d=>{const c=parseInt(d);if(isNaN(c))return;const h=t.getState().matchesCount;if(c>0&&c<=h)return c-1;if(c<0&&c>=-h)return h+c},l=d=>{const c=a(d);if(typeof c=="number"){r.validationMessage=void 0,t.goToMatch(c);const h=t.getState().currentMatch;h&&this.addDecorations(e,h)}else r.validationMessage=m(999,"Please type a number between 1 and {0}",t.getState().matchesCount),this.clearDecorations(e)};o.add(r.onDidChangeValue(d=>{l(d)})),o.add(r.onDidAccept(()=>{const d=a(r.value);typeof d=="number"?(t.goToMatch(d),r.hide()):r.validationMessage=m(1e3,"Please type a number between 1 and {0}",t.getState().matchesCount)})),o.add(r.onDidHide(()=>{this.clearDecorations(e),o.dispose()})),r.show()}clearDecorations(n){n.changeDecorations(e=>{this._highlightDecorations=e.deltaDecorations(this._highlightDecorations,[])})}addDecorations(n,e){n.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[{range:e,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:e,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:nt(XS),position:ln.Full}}}])})}},Jx=class extends A{async run(n,e){const t=zt.get(e);if(!t)return;const i=vp(e,"single",!1);i&&t.setSearchString(i),this._run(t)||(await t.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),this._run(t))}},NM=class extends Jx{constructor(){super({id:Ne.NextSelectionMatchFindAction,label:L(1008,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:2109,weight:100}})}_run(n){return n.moveToNextMatch()}},MM=class extends Jx{constructor(){super({id:Ne.PreviousSelectionMatchFindAction,label:L(1009,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:3133,weight:100}})}_run(n){return n.moveToPrevMatch()}},OM=rh(new gh({id:Ne.StartFindReplaceAction,label:L(1010,"Replace"),precondition:k.or(S.focus,k.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:K.MenubarEditMenu,group:"3_find",title:m(1001,"&&Replace"),order:2}}));OM.addImplementation(0,(n,e,t)=>{if(!e.hasModel()||e.getOption(104))return!1;const i=zt.get(e);if(!i)return!1;const s=e.getSelection(),o=i.isFindInputFocused(),r=!s.isEmpty()&&s.startLineNumber===s.endLineNumber&&e.getOption(50).seedSearchStringFromSelection!=="never"&&!o,a=o||r?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop})});de(zt.ID,bp,0);P(EM);P(RM);P(kM);P(NM);P(MM);var Zi=Ft.bindToContribution(zt.get);Z(new Zi({id:Ne.CloseFindWidgetCommand,precondition:jn,handler:n=>n.closeFindWidget(),kbOpts:{weight:105,kbExpr:S.focus,primary:9,secondary:[1033]}}));Z(new Zi({id:Ne.ToggleCaseSensitiveCommand,precondition:void 0,handler:n=>n.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:S.focus,primary:Bl.primary,mac:Bl.mac,win:Bl.win,linux:Bl.linux}}));Z(new Zi({id:Ne.ToggleWholeWordCommand,precondition:void 0,handler:n=>n.toggleWholeWords(),kbOpts:{weight:105,kbExpr:S.focus,primary:Ul.primary,mac:Ul.mac,win:Ul.win,linux:Ul.linux}}));Z(new Zi({id:Ne.ToggleRegexCommand,precondition:void 0,handler:n=>n.toggleRegex(),kbOpts:{weight:105,kbExpr:S.focus,primary:zl.primary,mac:zl.mac,win:zl.win,linux:zl.linux}}));Z(new Zi({id:Ne.ToggleSearchScopeCommand,precondition:void 0,handler:n=>n.toggleSearchScope(),kbOpts:{weight:105,kbExpr:S.focus,primary:jl.primary,mac:jl.mac,win:jl.win,linux:jl.linux}}));Z(new Zi({id:Ne.TogglePreserveCaseCommand,precondition:void 0,handler:n=>n.togglePreserveCase(),kbOpts:{weight:105,kbExpr:S.focus,primary:ql.primary,mac:ql.mac,win:ql.win,linux:ql.linux}}));Z(new Zi({id:Ne.ReplaceOneAction,precondition:jn,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:S.focus,primary:3094}}));Z(new Zi({id:Ne.ReplaceOneAction,precondition:jn,handler:n=>n.replace(),kbOpts:{weight:105,kbExpr:k.and(S.focus,g_),primary:3}}));Z(new Zi({id:Ne.ReplaceAllAction,precondition:jn,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:S.focus,primary:2563}}));Z(new Zi({id:Ne.ReplaceAllAction,precondition:jn,handler:n=>n.replaceAll(),kbOpts:{weight:105,kbExpr:k.and(S.focus,g_),primary:void 0,mac:{primary:2051}}}));Z(new Zi({id:Ne.SelectAllMatchesAction,precondition:jn,handler:n=>n.selectAllMatches(),kbOpts:{weight:105,kbExpr:S.focus,primary:515}}));var AM={0:" ",1:"u",2:"r"};var Ql=16777215,Tb=4278190080,hu=class{constructor(n){const e=Math.ceil(n/32);this._states=new Uint32Array(e)}get(n){const e=n/32|0,t=n%32;return(this._states[e]&1<<t)!==0}set(n,e){const t=n/32|0,i=n%32,s=this._states[t];e?this._states[t]=s|1<<i:this._states[t]=s&~(1<<i)}},xi=class Qx{constructor(e,t,i){if(e.length!==t.length||e.length>65535)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new hu(e.length),this._userDefinedStates=new hu(e.length),this._recoveredStates=new hu(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,s)=>{const o=e[e.length-1];return this.getStartLineNumber(o)<=i&&this.getEndLineNumber(o)>=s};for(let i=0,s=this._startIndexes.length;i<s;i++){const o=this._startIndexes[i],r=this._endIndexes[i];if(o>16777215||r>16777215)throw new Error("startLineNumber or endLineNumber must not exceed 16777215");for(;e.length>0&&!t(o,r);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=o+((a&255)<<24),this._endIndexes[i]=r+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&Ql}getEndLineNumber(e){return this._endIndexes[e]&Ql}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let s=0;s<this._types.length;s++)this._types[s]===e&&(this.setCollapsed(s,t),i=!0);return i}toRegion(e){return new FM(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&Tb)>>>24)+((this._endIndexes[e]&Tb)>>>16);return t===65535?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t<i;){const s=Math.floor((t+i)/2);e<this.getStartLineNumber(s)?i=s:t=s+1}return t-1}findRange(e){let t=this.findIndex(e);if(t>=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;t<this.length;t++)e[t]=`[${AM[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&Ql,endLineNumber:this._endIndexes[e]&Ql,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(e){const t=e.length,i=new Uint32Array(t),s=new Uint32Array(t);let o=[],r=!1;for(let l=0;l<t;l++){const d=e[l];i[l]=d.startLineNumber,s[l]=d.endLineNumber,o.push(d.type),d.type&&(r=!0)}r||(o=void 0);const a=new Qx(i,s,o);for(let l=0;l<t;l++)e[l].isCollapsed&&a.setCollapsed(l,!0),a.setSource(l,e[l].source);return a}static sanitizeAndMerge(e,t,i,s){i=i??Number.MAX_VALUE;const o=(_,v)=>Array.isArray(_)?(C=>C<v?_[C]:void 0):(C=>C<v?_.toFoldRange(C):void 0),r=o(e,e.length),a=o(t,t.length);let l=0,d=0,c=r(0),h=a(0);const u=[];let g,p=0;const f=[];for(;c||h;){let _;if(h&&(!c||c.startLineNumber>=h.startLineNumber))c&&c.startLineNumber===h.startLineNumber?(h.source===1?_=h:(_=c,_.isCollapsed=h.isCollapsed&&(c.endLineNumber===h.endLineNumber||!s?.startsInside(c.startLineNumber+1,c.endLineNumber+1)),_.source=0),c=r(++l)):(_=h,h.isCollapsed&&h.source===0&&(_.source=2)),h=a(++d);else{let v=d,C=h;for(;;){if(!C||C.startLineNumber>c.endLineNumber){_=c;break}if(C.source===1&&C.endLineNumber>c.endLineNumber)break;C=a(++v)}c=r(++l)}if(_){for(;g&&g.endLineNumber<_.startLineNumber;)g=u.pop();_.endLineNumber>_.startLineNumber&&_.startLineNumber>p&&_.endLineNumber<=i&&(!g||g.endLineNumber>=_.endLineNumber)&&(f.push(_),p=_.startLineNumber,g&&u.push(g),g=_)}}return f}},FM=class{constructor(n,e){this.ranges=n,this.index=e}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(n){return n.startLineNumber<=this.startLineNumber&&n.endLineNumber>=this.endLineNumber}containsLine(n){return this.startLineNumber<=n&&n<=this.endLineNumber}},HM=class{get regions(){return this._regions}get textModel(){return this._textModel}constructor(n,e){this._updateEventEmitter=new ee,this.onDidChange=this._updateEventEmitter.event,this._textModel=n,this._decorationProvider=e,this._regions=new xi(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(n){if(!n.length)return;n=n.sort((t,i)=>t.regionIndex-i.regionIndex);const e={};this._decorationProvider.changeDecorations(t=>{let i=0,s=-1,o=-1;const r=a=>{for(;i<a;){const l=this._regions.getEndLineNumber(i),d=this._regions.isCollapsed(i);if(l<=s){const c=this.regions.getSource(i)!==0;t.changeDecorationOptions(this._editorDecorationIds[i],this._decorationProvider.getDecorationOption(d,l<=o,c))}d&&l>o&&(o=l),i++}};for(const a of n){const l=a.regionIndex,d=this._editorDecorationIds[l];if(d&&!e[d]){e[d]=!0,r(l);const c=!this._regions.isCollapsed(l);this._regions.setCollapsed(l,c),s=Math.max(s,this._regions.getEndLineNumber(l))}}r(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:n})}removeManualRanges(n){const e=new Set;let t=!1;for(const o of n)if(x.isEmpty(o)){let r=this._regions.findRange(o.startLineNumber);for(;r!==-1&&this._regions.getSource(r)===0;)r=this._regions.getParentIndex(r);r===-1?t=!0:e.add(r)}const i=new Array,s=o=>{for(const r of n)if(!x.isEmpty(r)&&!(r.startLineNumber>o.endLineNumber||o.startLineNumber>r.endLineNumber))return!0;return!1};for(let o=0;o<this._regions.length;o++){const r=this._regions.toFoldRange(o);(r.source===0||!t&&!e.has(o)&&!s(r))&&i.push(r)}this.updatePost(xi.fromFoldRanges(i))}update(n,e){const t=this._currentFoldedOrManualRanges(e),i=xi.sanitizeAndMerge(n,t,this._textModel.getLineCount(),e);this.updatePost(xi.fromFoldRanges(i))}updatePost(n){const e=[];let t=-1;for(let i=0,s=n.length;i<s;i++){const o=n.getStartLineNumber(i),r=n.getEndLineNumber(i),a=n.isCollapsed(i),l=n.getSource(i)!==0,d={startLineNumber:o,startColumn:this._textModel.getLineMaxColumn(o),endLineNumber:r,endColumn:this._textModel.getLineMaxColumn(r)+1};e.push({range:d,options:this._decorationProvider.getDecorationOption(a,r<=t,l)}),a&&r>t&&(t=r)}this._decorationProvider.changeDecorations(i=>this._editorDecorationIds=i.deltaDecorations(this._editorDecorationIds,e)),this._regions=n,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(n){const e=[];for(let t=0,i=this._regions.length;t<i;t++){let s=this.regions.isCollapsed(t);const o=this.regions.getSource(t);if(s||o!==0){const r=this._regions.toFoldRange(t),a=this._textModel.getDecorationRange(this._editorDecorationIds[t]);a&&(s&&n?.startsInside(a.startLineNumber+1,a.endLineNumber)&&(s=!1),e.push({startLineNumber:a.startLineNumber,endLineNumber:a.endLineNumber,type:r.type,isCollapsed:s,source:o}))}}return e}getMemento(){const n=this._currentFoldedOrManualRanges(),e=[],t=this._textModel.getLineCount();for(let i=0,s=n.length;i<s;i++){const o=n[i];if(o.startLineNumber>=o.endLineNumber||o.startLineNumber<1||o.endLineNumber>t)continue;const r=this._getLinesChecksum(o.startLineNumber+1,o.endLineNumber);e.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,isCollapsed:o.isCollapsed,source:o.source,checksum:r})}return e.length>0?e:void 0}applyMemento(n){if(!Array.isArray(n))return;const e=[],t=this._textModel.getLineCount();for(const s of n){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>t)continue;const o=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||o===s.checksum)&&e.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const i=xi.sanitizeAndMerge(this._regions,e,t);this.updatePost(xi.fromFoldRanges(i))}_getLinesChecksum(n,e){return QS(this._textModel.getLineContent(n)+this._textModel.getLineContent(e))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(n,e){const t=[];if(this._regions){let i=this._regions.findRange(n),s=1;for(;i>=0;){const o=this._regions.toRegion(i);(!e||e(o,s))&&t.push(o),s++,i=o.parentIndex}}return t}getRegionAtLine(n){if(this._regions){const e=this._regions.findRange(n);if(e>=0)return this._regions.toRegion(e)}return null}getRegionsInside(n,e){const t=[],i=n?n.regionIndex+1:0,s=n?n.endLineNumber:Number.MAX_VALUE;if(e&&e.length===2){const o=[];for(let r=i,a=this._regions.length;r<a;r++){const l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s){for(;o.length>0&&!l.containedBy(o[o.length-1]);)o.pop();o.push(l),e(l,o.length)&&t.push(l)}else break}}else for(let o=i,r=this._regions.length;o<r;o++){const a=this._regions.toRegion(o);if(this._regions.getStartLineNumber(o)<s)(!e||e(a))&&t.push(a);else break}return t}};function x_(n,e,t){const i=[];for(const s of t){const o=n.getRegionAtLine(s);if(o){const r=!o.isCollapsed;if(i.push(o),e>1){const a=n.getRegionsInside(o,(l,d)=>l.isCollapsed!==r&&d<e);i.push(...a)}}}n.toggleCollapseState(i)}function Fr(n,e,t=Number.MAX_VALUE,i){const s=[];if(i&&i.length>0)for(const o of i){const r=n.getRegionAtLine(o);if(r&&(r.isCollapsed!==e&&s.push(r),t>1)){const a=n.getRegionsInside(r,(l,d)=>l.isCollapsed!==e&&d<t);s.push(...a)}}else{const o=n.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);s.push(...o)}n.toggleCollapseState(s)}function eI(n,e,t,i){const s=[];for(const o of i){const r=n.getAllRegionsAtLine(o,(a,l)=>a.isCollapsed!==e&&l<=t);s.push(...r)}n.toggleCollapseState(s)}function WM(n,e,t){const i=[];for(const s of t){const o=n.getAllRegionsAtLine(s,r=>r.isCollapsed!==e);o.length>0&&i.push(o[0])}n.toggleCollapseState(i)}function VM(n,e,t,i){const s=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(l=>r.containsLine(l)),o=n.getRegionsInside(null,s);n.toggleCollapseState(o)}function tI(n,e,t){const i=[];for(const r of t){const a=n.getAllRegionsAtLine(r,void 0);a.length>0&&i.push(a[0])}const s=r=>i.every(a=>!a.containedBy(r)&&!r.containedBy(a))&&r.isCollapsed!==e,o=n.getRegionsInside(null,s);n.toggleCollapseState(o)}function I_(n,e,t){const i=n.textModel,s=n.regions,o=[];for(let r=s.length-1;r>=0;r--)if(t!==s.isCollapsed(r)){const a=s.getStartLineNumber(r);e.test(i.getLineContent(a))&&o.push(s.toRegion(r))}n.toggleCollapseState(o)}function L_(n,e,t){const i=n.regions,s=[];for(let o=i.length-1;o>=0;o--)t!==i.isCollapsed(o)&&e===i.getType(o)&&s.push(i.toRegion(o));n.toggleCollapseState(s)}function BM(n,e){let t=null;const i=e.getRegionAtLine(n);if(i!==null&&(t=i.startLineNumber,n===t)){const s=i.parentIndex;s!==-1?t=e.regions.getStartLineNumber(s):t=null}return t}function UM(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){if(n!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let s=0;for(i!==-1&&(s=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=s)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber<n)return t.startLineNumber;t.regionIndex>0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function zM(n,e){let t=e.getRegionAtLine(n);if(t!==null&&t.startLineNumber===n){const i=t.parentIndex;let s=0;if(i!==-1)s=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;s=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex<e.regions.length){if(t=e.regions.toRegion(t.regionIndex+1),t.startLineNumber>=s)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>n)return t.startLineNumber;t.regionIndex<e.regions.length?t=e.regions.toRegion(t.regionIndex+1):t=null}return null}var jM=class{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(n){this._updateEventEmitter=new ee,this._hasLineChanges=!1,this._foldingModel=n,this._foldingModelListener=n.onDidChange(e=>this.updateHiddenRanges()),this._hiddenRanges=[],n.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(n){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=n.changes.some(e=>e.range.endLineNumber!==e.range.startLineNumber||S0(e.text)[0]!==0))}updateHiddenRanges(){let n=!1;const e=[];let t=0,i=0,s=Number.MAX_VALUE,o=-1;const r=this._foldingModel.regions;for(;t<r.length;t++){if(!r.isCollapsed(t))continue;const a=r.getStartLineNumber(t)+1,l=r.getEndLineNumber(t);s<=a&&l<=o||(!n&&i<this._hiddenRanges.length&&this._hiddenRanges[i].startLineNumber===a&&this._hiddenRanges[i].endLineNumber===l?(e.push(this._hiddenRanges[i]),i++):(n=!0,e.push(new x(a,1,l,1))),s=a,o=l)}(this._hasLineChanges||n||i<this._hiddenRanges.length)&&this.applyHiddenRanges(e)}applyHiddenRanges(n){this._hiddenRanges=n,this._hasLineChanges=!1,this._updateEventEmitter.fire(n)}hasRanges(){return this._hiddenRanges.length>0}isHidden(n){return Pb(this._hiddenRanges,n)!==null}adjustSelections(n){let e=!1;const t=this._foldingModel.textModel;let i=null;const s=o=>((!i||!qM(o,i))&&(i=Pb(this._hiddenRanges,o)),i?i.startLineNumber-1:null);for(let o=0,r=n.length;o<r;o++){let a=n[o];const l=s(a.startLineNumber);l&&(a=a.setStartPosition(l,t.getLineMaxColumn(l)),e=!0);const d=s(a.endLineNumber);d&&(a=a.setEndPosition(d,t.getLineMaxColumn(d)),e=!0),n[o]=a}return e}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null),this._updateEventEmitter.dispose()}};function qM(n,e){return n>=e.startLineNumber&&n<=e.endLineNumber}function Pb(n,e){const t=JS(n,i=>e<i.startLineNumber)-1;return t>=0&&n[t].endLineNumber>=e?n[t]:null}var $M=5e3,KM="indent",D_=class{constructor(n,e,t){this.editorModel=n,this.languageConfigurationService=e,this.foldingRangesLimit=t,this.id=KM}dispose(){}compute(n){const e=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,t=e&&!!e.offSide,i=e&&e.markers;return Promise.resolve(XM(this.editorModel,t,i,this.foldingRangesLimit))}},GM=class{constructor(n){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=n}insertFirst(n,e,t){if(n>16777215||e>16777215)return;const i=this._length;this._startIndexes[i]=n,this._endIndexes[i]=e,this._length++,t<1e3&&(this._indentOccurrences[t]=(this._indentOccurrences[t]||0)+1)}toIndentRanges(n){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let s=this._length-1,o=0;s>=0;s--,o++)t[o]=this._startIndexes[s],i[o]=this._endIndexes[s];return new xi(t,i)}else{this._foldingRangesLimit.update(this._length,e);let t=0,i=this._indentOccurrences.length;for(let a=0;a<this._indentOccurrences.length;a++){const l=this._indentOccurrences[a];if(l){if(l+t>e){i=a;break}t+=l}}const s=n.getOptions().tabSize,o=new Uint32Array(e),r=new Uint32Array(e);for(let a=this._length-1,l=0;a>=0;a--){const d=this._startIndexes[a],c=n.getLineContent(d),h=Lm(c,s);(h<i||h===i&&t++<e)&&(o[l]=d,r[l]=this._endIndexes[a],l++)}return new xi(o,r)}}},ZM={limit:$M,update:()=>{}};function XM(n,e,t,i=ZM){const s=n.getOptions().tabSize,o=new GM(i);let r,a,l;t&&(t.start.flags===t.end.flags?r=new RegExp(`(${t.start.source})|(?:${t.end.source})`,t.start.flags):(a=t.start,l=t.end));const d=[],c=n.getLineCount()+1;d.push({indent:-1,endAbove:c,line:c});for(let h=n.getLineCount();h>0;h--){const u=n.getLineContent(h),g=Lm(u,s);let p=d[d.length-1];if(g===-1){e&&(p.endAbove=h);continue}let f=!1,_=!1,v;if(r?(r.lastIndex=0,(v=r.exec(u))&&(f=!!v[1],_=!f)):(a&&(a.lastIndex=0,f=a.test(u)),!f&&l&&(l.lastIndex=0,_=l.test(u))),f||_)if(f){let C=d.length-1;for(;C>0&&d[C].indent!==-2;)C--;if(C>0){d.length=C+1,p=d[C],o.insertFirst(h,p.line,g),p.line=h,p.indent=g,p.endAbove=h;continue}}else{d.push({indent:-2,endAbove:h,line:h});continue}if(p.indent>g){do d.pop(),p=d[d.length-1];while(p.indent>g);const C=p.endAbove-1;C-h>=1&&o.insertFirst(h,C,g)}p.indent===g?p.endAbove=h:d.push({indent:g,endAbove:h,line:h})}return o.toIndentRanges(n)}var YM=W("editor.foldBackground",{light:st(zv,.3),dark:st(zv,.3),hcDark:null,hcLight:null},m(1060,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);W("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},m(1061,"Color of the collapsed text after the first line of a folded range."));W("editorGutter.foldingControlForeground",uP,m(1062,"Color of the folding control in the editor gutter."));var wc=Ye("folding-expanded",V.chevronDown,m(1063,"Icon for expanded ranges in the editor glyph margin.")),yc=Ye("folding-collapsed",V.chevronRight,m(1064,"Icon for collapsed ranges in the editor glyph margin.")),kb=Ye("folding-manual-collapsed",yc,m(1065,"Icon for manually collapsed ranges in the editor glyph margin.")),Nb=Ye("folding-manual-expanded",wc,m(1066,"Icon for manually expanded ranges in the editor glyph margin.")),uu={color:nt(YM),position:1},No=m(1067,"Click to expand the range."),ed=m(1068,"Click to collapse the range."),JM=class ci{static{this.COLLAPSED_VISUAL_DECORATION=oe.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:No,firstLineDecorationClassName:ce.asClassName(yc)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=oe.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:uu,isWholeLine:!0,linesDecorationsTooltip:No,firstLineDecorationClassName:ce.asClassName(yc)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=oe.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:No,firstLineDecorationClassName:ce.asClassName(kb)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=oe.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:uu,isWholeLine:!0,linesDecorationsTooltip:No,firstLineDecorationClassName:ce.asClassName(kb)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=oe.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:No})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=oe.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:uu,isWholeLine:!0,linesDecorationsTooltip:No})}static{this.EXPANDED_VISUAL_DECORATION=oe.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+ce.asClassName(wc),linesDecorationsTooltip:ed})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=oe.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:ce.asClassName(wc),linesDecorationsTooltip:ed})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=oe.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+ce.asClassName(Nb),linesDecorationsTooltip:ed})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=oe.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:ce.asClassName(Nb),linesDecorationsTooltip:ed})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=oe.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=oe.register({description:"folding-hidden-range-decoration",stickiness:1})}constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?ci.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?ci.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:ci.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:ci.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?ci.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:ci.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?ci.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:ci.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?ci.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:ci.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?ci.MANUALLY_EXPANDED_VISUAL_DECORATION:ci.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}},QM={},eO="syntax",E_=class{constructor(n,e,t,i,s){this.editorModel=n,this.providers=e,this.handleFoldingRangesChange=t,this.foldingRangesLimit=i,this.fallbackRangeProvider=s,this.id=eO,this.disposables=new O,s&&this.disposables.add(s);for(const o of e)typeof o.onDidChange=="function"&&this.disposables.add(o.onDidChange(t))}compute(n){return tO(this.providers,this.editorModel,n).then(e=>this.editorModel.isDisposed()?null:e?nO(e,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(n)??null)}dispose(){this.disposables.dispose()}};function tO(n,e,t){let i=null;const s=n.map((o,r)=>Promise.resolve(o.provideFoldingRanges(e,QM,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const l=e.getLineCount();for(const d of a)d.start>0&&d.end>d.start&&d.end<=l&&i.push({start:d.start,end:d.end,rank:r,kind:d.kind})}},it));return Promise.all(s).then(o=>i)}var iO=class{constructor(n){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=n}add(n,e,t,i){if(n>16777215||e>16777215)return;const s=this._length;this._startIndexes[s]=n,this._endIndexes[s]=e,this._nestingLevels[s]=i,this._types[s]=t,this._length++,i<30&&(this._nestingLevelCounts[i]=(this._nestingLevelCounts[i]||0)+1)}toIndentRanges(){const n=this._foldingRangesLimit.limit;if(this._length<=n){this._foldingRangesLimit.update(this._length,!1);const e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let i=0;i<this._length;i++)e[i]=this._startIndexes[i],t[i]=this._endIndexes[i];return new xi(e,t,this._types)}else{this._foldingRangesLimit.update(this._length,n);let e=0,t=this._nestingLevelCounts.length;for(let r=0;r<this._nestingLevelCounts.length;r++){const a=this._nestingLevelCounts[r];if(a){if(a+e>n){t=r;break}e+=a}}const i=new Uint32Array(n),s=new Uint32Array(n),o=[];for(let r=0,a=0;r<this._length;r++){const l=this._nestingLevels[r];(l<t||l===t&&e++<n)&&(i[a]=this._startIndexes[r],s[a]=this._endIndexes[r],o[a]=this._types[r],a++)}return new xi(i,s,o)}}};function nO(n,e){const t=n.sort((r,a)=>{let l=r.start-a.start;return l===0&&(l=r.rank-a.rank),l}),i=new iO(e);let s;const o=[];for(const r of t)if(!s)s=r,i.add(r.start,r.end,r.kind&&r.kind.value,o.length);else if(r.start>s.start)if(r.end<=s.end)o.push(s),s=r,i.add(r.start,r.end,r.kind&&r.kind.value,o.length);else{if(r.start>s.end){do s=o.pop();while(s&&r.start>s.end);s&&o.push(s),s=r}i.add(r.start,r.end,r.kind&&r.kind.value,o.length)}return i.toIndentRanges()}var sO=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Xr=function(n,e){return function(t,i){e(t,i,n)}},ha,vt=new ae("foldingEnabled",!1),ys=class extends M{static{ha=this}static{this.ID="editor.contrib.folding"}static get(e){return e.getContribution(ha.ID)}static getFoldingRangeProviders(e,t){const i=e.foldingRangeProvider.ordered(t);return ha._foldingRangeSelector?.(i,t)??i}constructor(e,t,i,s,o,r){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=r,this.localToDispose=this._register(new O),this.editor=e,this._foldingLimitReporter=this._register(new iI(e));const a=this.editor.getOptions();this._isEnabled=a.get(52),this._useFoldingProviders=a.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(55),this.updateDebounceInfo=o.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 JM(e),this.foldingDecorationProvider.showFoldingControls=a.get(126),this.foldingDecorationProvider.showFoldingHighlights=a.get(54),this.foldingEnabled=vt.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(l=>{if(l.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),l.hasChanged(56)&&this.onModelChanged(),l.hasChanged(126)||l.hasChanged(54)){const d=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=d.get(126),this.foldingDecorationProvider.showFoldingHighlights=d.get(54),this.triggerFoldingModelChanged()}l.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged()),l.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),l.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new HM(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new jM(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new bs(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new at(()=>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:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new D_(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=ha.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new E_(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new pi,i=this.getRangeProvider(e.textModel),s=this.foldingRegionPromise=mt(o=>i.compute(o));return s.then(o=>{if(o&&s===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const d=o.setCollapsedAllOfType(Pr.Imports.value,!0);d&&(r=ur.capture(this.editor),this._currentModelHasFoldedImports=d)}const a=this.editor.getSelections();e.update(o,oO(a)),r?.restore(this.editor);const l=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=l)}return e})}).then(void 0,e=>(Le(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const s=[];for(const o of i){const r=o.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(r)&&s.push(...t.getAllRegionsAtLine(r,a=>a.isCollapsed&&r>a.startLineNumber))}s.length&&(t.toggleCollapseState(s),this.reveal(i[0].getPosition()))}}}).then(void 0,Le)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const s=e.target.detail,o=e.target.element.offsetLeft;if(s.offsetX-o<4)return;i=!0;break}case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){const s=this.editor.getModel();if(s&&t.startColumn===s.getLineMaxColumn(t.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,s=this.mouseDownInfo.iconClicked,o=e.target.range;if(!o||o.startLineNumber!==i)return;if(s){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||o.startColumn!==a.getLineMaxColumn(i))return}const r=t.getRegionAtLine(i);if(r&&r.startLineNumber===i){const a=r.isCollapsed;if(s||a){const l=e.event.altKey;let d=[];if(l){const c=u=>!u.containedBy(r)&&!r.containedBy(u),h=t.getRegionsInside(null,c);for(const u of h)u.isCollapsed&&d.push(u);d.length===0&&(d=h)}else{const c=e.event.middleButton||e.event.shiftKey;if(c)for(const h of t.getRegionsInside(r))h.isCollapsed===a&&d.push(h);(a||!c||d.length===0)&&d.push(r)}t.toggleCollapseState(d),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};ys=ha=sO([Xr(1,Ce),Xr(2,ct),Xr(3,Rt),Xr(4,ki),Xr(5,X)],ys);var iI=class extends M{constructor(n){super(),this.editor=n,this._onDidChange=this._register(new ee),this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(56)}update(n,e){(n!==this._computed||e!==this._limited)&&(this._computed=n,this._limited=e,this._onDidChange.fire())}},yt=class extends A{runEditorCommand(n,e,t){const i=n.get(ct),s=ys.get(e);if(!s)return;const o=s.getFoldingModel();if(o)return this.reportTelemetry(n,e),o.then(r=>{if(r){this.invoke(s,r,e,t,i);const a=e.getSelection();a&&s.reveal(a.getStartPosition())}})}getSelectedLines(n){const e=n.getSelections();return e?e.map(t=>t.startLineNumber):[]}getLineNumbers(n,e){return n&&n.selectionLines?n.selectionLines.map(t=>t+1):this.getSelectedLines(e)}run(n,e){}};function oO(n){return!n||n.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of n){const s=i.startLineNumber;if(s>=e&&s<=t)return!0}return!1}}}function nI(n){if(!oa(n)){if(!fm(n))return!1;const e=n;if(!oa(e.levels)&&!uv(e.levels)||!oa(e.direction)&&!Mw(e.direction)||!oa(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(uv)))return!1}return!0}var rO=class extends yt{constructor(){super({id:"editor.unfold",label:L(1040,"Unfold"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
|
|
15
|
+
* 'levels': Number of levels to unfold. If not set, defaults to 1.
|
|
16
|
+
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
|
|
17
|
+
* '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.
|
|
18
|
+
`,constraint:nI,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(n,e,t,i){const s=i&&i.levels||1,o=this.getLineNumbers(i,t);i&&i.direction==="up"?eI(e,!1,s,o):Fr(e,!1,s,o)}},aO=class extends yt{constructor(){super({id:"editor.unfoldRecursively",label:L(1041,"Unfold Recursively"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2142),weight:100}})}invoke(n,e,t,i){Fr(e,!1,Number.MAX_VALUE,this.getSelectedLines(t))}},lO=class extends yt{constructor(){super({id:"editor.fold",label:L(1042,"Fold"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
|
|
19
|
+
* 'levels': Number of levels to fold.
|
|
20
|
+
* 'direction': If 'up', folds given number of levels up otherwise folds down.
|
|
21
|
+
* '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.
|
|
22
|
+
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
|
|
23
|
+
`,constraint:nI,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(n,e,t,i){const s=this.getLineNumbers(i,t),o=i&&i.levels,r=i&&i.direction;typeof o!="number"&&typeof r!="string"?WM(e,!0,s):r==="up"?eI(e,!0,o||1,s):Fr(e,!0,o||1,s)}},dO=class extends yt{constructor(){super({id:"editor.toggleFold",label:L(1043,"Toggle Fold"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2090),weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);x_(e,1,i)}},cO=class extends yt{constructor(){super({id:"editor.foldRecursively",label:L(1044,"Fold Recursively"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2140),weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);Fr(e,!0,Number.MAX_VALUE,i)}},hO=class extends yt{constructor(){super({id:"editor.toggleFoldRecursively",label:L(1045,"Toggle Fold Recursively"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,3114),weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);x_(e,Number.MAX_VALUE,i)}},uO=class extends yt{constructor(){super({id:"editor.foldAllBlockComments",label:L(1046,"Fold All Block Comments"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2138),weight:100}})}invoke(n,e,t,i,s){if(e.regions.hasTypes())L_(e,Pr.Comment.value,!0);else{const o=t.getModel();if(!o)return;const r=s.getLanguageConfiguration(o.getLanguageId()).comments;if(r&&r.blockCommentStartToken){const a=new RegExp("^\\s*"+Va(r.blockCommentStartToken));I_(e,a,!0)}}}},gO=class extends yt{constructor(){super({id:"editor.foldAllMarkerRegions",label:L(1047,"Fold All Regions"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2077),weight:100}})}invoke(n,e,t,i,s){if(e.regions.hasTypes())L_(e,Pr.Region.value,!0);else{const o=t.getModel();if(!o)return;const r=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(r&&r.markers&&r.markers.start){const a=new RegExp(r.markers.start);I_(e,a,!0)}}}},pO=class extends yt{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:L(1048,"Unfold All Regions"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2078),weight:100}})}invoke(n,e,t,i,s){if(e.regions.hasTypes())L_(e,Pr.Region.value,!1);else{const o=t.getModel();if(!o)return;const r=s.getLanguageConfiguration(o.getLanguageId()).foldingRules;if(r&&r.markers&&r.markers.start){const a=new RegExp(r.markers.start);I_(e,a,!1)}}}},fO=class extends yt{constructor(){super({id:"editor.foldAllExcept",label:L(1049,"Fold All Except Selected"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2136),weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);tI(e,!0,i)}},mO=class extends yt{constructor(){super({id:"editor.unfoldAllExcept",label:L(1050,"Unfold All Except Selected"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2134),weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);tI(e,!1,i)}},_O=class extends yt{constructor(){super({id:"editor.foldAll",label:L(1051,"Fold All"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2069),weight:100}})}invoke(n,e,t){Fr(e,!0)}},vO=class extends yt{constructor(){super({id:"editor.unfoldAll",label:L(1052,"Unfold All"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2088),weight:100}})}invoke(n,e,t){Fr(e,!1)}},Mb=class Cp extends yt{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=e=>Cp.ID_PREFIX+e}getFoldingLevel(){return parseInt(this.id.substr(Cp.ID_PREFIX.length))}invoke(e,t,i){VM(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}},bO=class extends yt{constructor(){super({id:"editor.gotoParentFold",label:L(1053,"Go to Parent Fold"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);if(i.length>0){const s=BM(i[0],e);s!==null&&t.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}},CO=class extends yt{constructor(){super({id:"editor.gotoPreviousFold",label:L(1054,"Go to Previous Folding Range"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);if(i.length>0){const s=UM(i[0],e);s!==null&&t.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}},SO=class extends yt{constructor(){super({id:"editor.gotoNextFold",label:L(1055,"Go to Next Folding Range"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,weight:100}})}invoke(n,e,t){const i=this.getSelectedLines(t);if(i.length>0){const s=zM(i[0],e);s!==null&&t.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}},wO=class extends yt{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:L(1056,"Create Folding Range from Selection"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2135),weight:100}})}invoke(n,e,t){const i=[],s=t.getSelections();if(s){for(const o of s){let r=o.endLineNumber;o.endColumn===1&&--r,r>o.startLineNumber&&(i.push({startLineNumber:o.startLineNumber,endLineNumber:r,type:void 0,isCollapsed:!0,source:1}),t.setSelection({startLineNumber:o.startLineNumber,startColumn:1,endLineNumber:o.startLineNumber,endColumn:1}))}if(i.length>0){i.sort((r,a)=>r.startLineNumber-a.startLineNumber);const o=xi.sanitizeAndMerge(e.regions,i,t.getModel()?.getLineCount());e.updatePost(xi.fromFoldRanges(o))}}}},yO=class extends yt{constructor(){super({id:"editor.removeManualFoldingRanges",label:L(1057,"Remove Manual Folding Ranges"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2137),weight:100}})}invoke(n,e,t){const i=t.getSelections();i&&(e.removeManualRanges(i),n.triggerFoldingModelChanged())}},xO=class extends yt{constructor(){super({id:"editor.toggleImportFold",label:L(1058,"Toggle Import Fold"),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,weight:100}})}async invoke(n,e){const t=[],i=e.regions;for(let s=i.length-1;s>=0;s--)i.getType(s)===Pr.Imports.value&&t.push(i.toRegion(s));e.toggleCollapseState(t),n.triggerFoldingModelChanged()}};de(ys.ID,ys,0);P(rO);P(aO);P(lO);P(cO);P(hO);P(_O);P(vO);P(uO);P(gO);P(pO);P(fO);P(mO);P(dO);P(bO);P(CO);P(SO);P(wO);P(yO);P(xO);for(let n=1;n<=7;n++)cT(new Mb({id:Mb.ID(n),label:L(1059,"Fold Level {0}",n),precondition:vt,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2048|21+n),weight:100}}));Me.registerCommand("_executeFoldingRangeProvider",async function(n,...e){const[t]=e;if(!(t instanceof ke))throw Pn();const i=n.get(X),s=n.get(Yt).getModel(t);if(!s)throw Pn();const o=n.get(Ee);if(!o.getValue("editor.folding",{resource:t}))return[];const r=n.get(ct),a=o.getValue("editor.foldingStrategy",{resource:t}),l={get limit(){return o.getValue("editor.foldingMaximumRegions",{resource:t})},update:(g,p)=>{}},d=new D_(s,r,l);let c=d;if(a!=="indentation"){const g=ys.getFoldingRangeProviders(i,s);g.length&&(c=new E_(s,g,()=>{},l,d))}const h=await c.compute(he.None),u=[];try{if(h)for(let g=0;g<h.length;g++){const p=h.getType(g);u.push({start:h.getStartLineNumber(g),end:h.getEndLineNumber(g),kind:p?Pr.fromValue(p):void 0})}return u}finally{c.dispose()}});var IO=class extends A{constructor(){super({id:"editor.action.fontZoomIn",label:L(1069,"Increase Editor Font Size"),precondition:void 0})}run(n,e){za.setZoomLevel(za.getZoomLevel()+1)}},LO=class extends A{constructor(){super({id:"editor.action.fontZoomOut",label:L(1070,"Decrease Editor Font Size"),precondition:void 0})}run(n,e){za.setZoomLevel(za.getZoomLevel()-1)}},DO=class extends A{constructor(){super({id:"editor.action.fontZoomReset",label:L(1071,"Reset Editor Font Size"),precondition:void 0})}run(n,e){za.setZoomLevel(0)}};P(IO);P(LO);P(DO);var sI=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ea=function(n,e){return function(t,i){e(t,i,n)}},xc=class{static{this.ID="editor.contrib.autoFormat"}constructor(e,t,i,s){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=s,this._disposables=new O,this._sessionDisposables=new O,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(o=>{o.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new ac;for(const s of t.autoFormatTriggerCharacters)i.add(s.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(s=>{const o=s.charCodeAt(s.length-1);i.has(o)&&this._trigger(String.fromCharCode(o))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),s=new ot,o=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){s.cancel(),o.dispose();return}for(let a=0,l=r.changes.length;a<l;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){s.cancel(),o.dispose();return}});LR(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),s.token).then(r=>{s.token.isCancellationRequested||Gt(r)&&(this._accessibilitySignalService.playSignal(Ba.format,{userGesture:!1}),vT.execute(this._editor,r,!0))}).finally(()=>{o.dispose()})}};xc=sI([Ea(1,X),Ea(2,Vn),Ea(3,Tm)],xc);var Ic=class{static{this.ID="editor.contrib.formatOnPaste"}constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new O,this._callOnModel=new O,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(64)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(Bw,this.editor,e,2,En.None,he.None,!1).catch(Le))}};Ic=sI([Ea(1,X),Ea(2,ne)],Ic);var EO=class extends A{constructor(){super({id:"editor.action.formatDocument",label:L(1072,"Format Document"),precondition:k.and(S.notInCompositeEditor,S.writable,S.hasDocumentFormattingProvider),kbOpts:{kbExpr:S.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(n,e){if(e.hasModel()){const t=n.get(ne);await n.get(pr).showWhile(t.invokeFunction(bR,e,1,En.None,he.None,!0),250)}}},RO=class extends A{constructor(){super({id:"editor.action.formatSelection",label:L(1073,"Format Selection"),precondition:k.and(S.writable,S.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2084),weight:100},contextMenuOpts:{when:S.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(n,e){if(!e.hasModel())return;const t=n.get(ne),i=e.getModel(),s=e.getSelections().map(o=>o.isEmpty()?new x(o.startLineNumber,1,o.startLineNumber,i.getLineMaxColumn(o.startLineNumber)):o);await n.get(pr).showWhile(t.invokeFunction(Bw,e,s,1,En.None,he.None,!0),250)}};de(xc.ID,xc,2);de(Ic.ID,Ic,2);P(EO);P(RO);Me.registerCommand("editor.action.format",async n=>{const e=n.get(Ze).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=n.get(ht);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var TO=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},gu=function(n,e){return function(t,i){e(t,i,n)}},er=class{remove(){this.parent?.children.delete(this.id)}static findId(n,e){let t;typeof n=="string"?t=`${e.id}/${n}`:(t=`${e.id}/${n.name}`,e.children.get(t)!==void 0&&(t=`${e.id}/${n.name}_${n.range.startLineNumber}_${n.range.startColumn}`));let i=t;for(let s=0;e.children.get(i)!==void 0;s++)i=`${t}_${s}`;return i}static empty(n){return n.children.size===0}},Sp=class extends er{constructor(n,e,t){super(),this.id=n,this.parent=e,this.symbol=t,this.children=new Map}},oI=class extends er{constructor(n,e,t,i){super(),this.id=n,this.parent=e,this.label=t,this.order=i,this.children=new Map}},rI=class Gs extends er{static create(e,t,i){const s=new ot(i),o=new Gs(t.uri),r=e.ordered(t),a=r.map((d,c)=>{const h=er.findId(`provider_${c}`,o),u=new oI(h,o,d.displayName??"Unknown Outline Provider",c);return Promise.resolve(d.provideDocumentSymbols(t,s.token)).then(g=>{for(const p of g||[])Gs._makeOutlineElement(p,u);return u},g=>(it(g),u)).then(g=>{er.empty(g)?g.remove():o._groups.set(h,g)})}),l=e.onDidChange(()=>{const d=e.ordered(t);$i(d,r)||s.cancel()});return Promise.all(a).then(()=>s.token.isCancellationRequested&&!i.isCancellationRequested?Gs.create(e,t,i):o._compact()).finally(()=>{s.dispose(),l.dispose(),s.dispose()})}static _makeOutlineElement(e,t){const i=er.findId(e,t),s=new Sp(i,t,e);if(e.children)for(const o of e.children)Gs._makeOutlineElement(o,s);t.children.set(s.id,s)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=gs.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof Sp?e.push(t.symbol):e.push(...gs.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>x.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return Gs._flattenDocumentSymbols(t,e,""),t.sort((i,s)=>B.compare(x.getStartPosition(i.range),x.getStartPosition(s.range))||B.compare(x.getEndPosition(s.range),x.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const s of t)e.push({kind:s.kind,tags:s.tags,name:s.name,detail:s.detail,containerName:s.containerName||i,range:s.range,selectionRange:s.selectionRange,children:void 0}),s.children&&Gs._flattenDocumentSymbols(e,s.children,s.name)}},Ml=fn("IOutlineModelService"),wp=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new O,this._cache=new fl(15,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(s=>{this._cache.delete(s.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,s=i.ordered(e);let o=this._cache.get(e.id);if(!o||o.versionId!==e.getVersionId()||!$i(o.provider,s)){const a=new ot;o={versionId:e.getVersionId(),provider:s,promiseCnt:0,source:a,promise:rI.create(i,e,a.token),model:void 0},this._cache.set(e.id,o);const l=Date.now();o.promise.then(d=>{o.model=d,this._debounceInformation.update(e,Date.now()-l)}).catch(d=>{this._cache.delete(e.id)})}if(o.model)return o.model;o.promiseCnt+=1;const r=t.onCancellationRequested(()=>{--o.promiseCnt===0&&(o.source.cancel(),this._cache.delete(e.id))});try{return await o.promise}finally{r.dispose()}}};wp=TO([gu(0,X),gu(1,ki),gu(2,Yt)],wp);zn(Ml,wp,1);Me.registerCommand("_executeDocumentSymbolProvider",async function(n,...e){const[t]=e;Ie(ke.isUri(t));const i=n.get(Ml),s=await n.get(li).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,he.None)).getTopLevelSymbols()}finally{s.dispose()}});var Lh=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}},PO=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},kO=function(n,e){return function(t,i){e(t,i,n)}};function NO(n){return n instanceof aI?n._instance:n}var aI=class{constructor(n){this.instantiationService=n}init(...n){}};function MO(n){return n.get()}var Ob=class extends aI{constructor(e,t){super(t),this.init(e)}};Ob=PO([kO(1,ne)],Ob);var Hr=class{validateOrThrow(n){const e=this.validate(n);if(e.error)throw new Error(e.error.message);return e.content}},Dh=class extends Hr{constructor(n){super(),this.type=n}validate(n){return typeof n!==this.type?{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof n}`}}:{content:n,error:void 0}}getJSONSchema(){return{type:this.type}}},OO=new Dh("string");function AO(){return OO}new Dh("number");var FO=new Dh("boolean");function Ab(){return FO}new Dh("object");var HO=class extends Hr{validate(n){return{content:n,error:void 0}}getJSONSchema(){return{}}};function WO(){return new HO}var lI=class extends Hr{validate(n){return n!==void 0?{content:void 0,error:{message:`Expected undefined, but got ${typeof n}`}}:{content:void 0,error:void 0}}getJSONSchema(){return{}}};function VO(){return new lI}var yp=class{constructor(n){this.validator=n}};function td(n){return new yp(n)}var BO=class extends Hr{constructor(n){super(),this.properties=n}validate(n){if(typeof n!="object"||n===null)return{content:void 0,error:{message:"Expected object"}};const e={};for(const t in this.properties){const i=this.properties[t],s=n[t],o=i instanceof yp,r=o?i.validator:i;if(o&&s===void 0)continue;const{content:a,error:l}=r.validate(s);if(l)return{content:void 0,error:{message:`Error in property '${t}': ${l.message}`}};e[t]=a}return{content:e,error:void 0}}getJSONSchema(){const n=[],e={};for(const[t,i]of Object.entries(this.properties)){const s=i instanceof yp;e[t]=(s?i.validator:i).getJSONSchema(),s||n.push(t)}return{type:"object",properties:e,...n.length>0?{required:n}:{}}}};function UO(n){return new BO(n)}var zO=class extends Hr{constructor(n){super(),this.validators=n}validate(n){let e;for(const t of this.validators){const{content:i,error:s}=t.validate(n);if(!s)return{content:i,error:void 0};e=s}return{content:void 0,error:e}}getJSONSchema(){return{oneOf:rP(this.validators,n=>{if(!(n instanceof lI))return n.getJSONSchema()})}}};function jO(...n){return new zO(n)}var qO=class extends Hr{constructor(n,e){super(),this._ref=n,this._validator=e}validate(n){return this._validator.validate(n)}getJSONSchema(){return{$ref:this._ref}}};function $O(n,e){return new qO(n,e)}var J={Visible:p_,HasFocusedSuggestion:new ae("suggestWidgetHasFocusedSuggestion",!1,m(1525,"Whether any suggestion is focused")),DetailsVisible:new ae("suggestWidgetDetailsVisible",!1,m(1526,"Whether suggestion details are visible")),DetailsFocused:new ae("suggestWidgetDetailsFocused",!1,m(1527,"Whether the details pane of the suggest widget has focus")),MultipleSuggestions:new ae("suggestWidgetMultipleSuggestions",!1,m(1528,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new ae("suggestionMakesTextEdit",!0,m(1529,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new ae("acceptSuggestionOnEnter",!0,m(1530,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new ae("suggestionHasInsertAndReplaceRange",!1,m(1531,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new ae("suggestionInsertMode",void 0,{type:"string",description:m(1532,"Whether the default behaviour is to insert or replace")}),CanResolve:new ae("suggestionCanResolve",!1,m(1533,"Whether the current suggestion supports to resolve further details"))},kn=new K("suggestWidgetStatusBar"),KO=class{constructor(n,e,t,i){this.position=n,this.completion=e,this.container=t,this.provider=i,this.isInvalid=!1,this.score=Wa.Default,this.distance=0,this.textLabel=typeof e.label=="string"?e.label:e.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=e.sortText&&e.sortText.toLowerCase(),this.filterTextLow=e.filterText&&e.filterText.toLowerCase(),this.extensionId=e.extensionId,x.isIRange(e.range)?(this.editStart=new B(e.range.startLineNumber,e.range.startColumn),this.editInsertEnd=new B(e.range.endLineNumber,e.range.endColumn),this.editReplaceEnd=new B(e.range.endLineNumber,e.range.endColumn),this.isInvalid=this.isInvalid||x.spansMultipleLines(e.range)||e.range.startLineNumber!==n.lineNumber):(this.editStart=new B(e.range.insert.startLineNumber,e.range.insert.startColumn),this.editInsertEnd=new B(e.range.insert.endLineNumber,e.range.insert.endColumn),this.editReplaceEnd=new B(e.range.replace.endLineNumber,e.range.replace.endColumn),this.isInvalid=this.isInvalid||x.spansMultipleLines(e.range.insert)||x.spansMultipleLines(e.range.replace)||e.range.insert.startLineNumber!==n.lineNumber||e.range.replace.startLineNumber!==n.lineNumber||e.range.insert.startColumn!==e.range.replace.startColumn),typeof i.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(n){if(!this._resolveCache){const e=n.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),t=new pi(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,n)).then(i=>{Object.assign(this.completion,i),this._resolveDuration=t.elapsed()},i=>{Un(i)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{e.dispose()})}return this._resolveCache}},R_=class dI{static{this.default=new dI}constructor(e=2,t=new Set,i=new Set,s=new Map,o=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=s,this.showDeprecated=o}},GO=class{constructor(n,e,t,i){this.items=n,this.needsClipboard=e,this.durations=t,this.disposable=i}};async function T_(n,e,t,i=R_.default,s={triggerKind:0},o=he.None){const r=new pi;t=t.clone();const a=e.getWordAtPosition(t),l=a?new x(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):x.fromPositions(t),d={replace:l,insert:l.setEndPosition(t.lineNumber,t.column)},c=[],h=new O,u=[];let g=!1;const p=(_,v,C)=>{let w=!1;if(!v)return w;for(const y of v.suggestions)if(!i.kindFilter.has(y.kind)){if(!i.showDeprecated&&y?.tags?.includes(1))continue;y.range||(y.range=d),y.sortText||(y.sortText=typeof y.label=="string"?y.label:y.label.label),!g&&y.insertTextRules&&y.insertTextRules&4&&(g=ho.guessNeedsClipboard(y.insertText)),c.push(new KO(t,y,v,_)),w=!0}return qm(v)&&h.add(v),u.push({providerName:_._debugDisplayName??"unknown_provider",elapsedProvider:v.duration??-1,elapsedOverall:C.elapsed()}),w},f=(async()=>{})();for(const _ of n.orderedGroups(e)){let v=!1;if(await Promise.all(_.map(async C=>{if(i.providerItemsToReuse.has(C)){const w=i.providerItemsToReuse.get(C);w.forEach(y=>c.push(y)),v=v||w.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(C)))try{const w=new pi,y=await C.provideCompletionItems(e,t,s,o);v=p(C,y,w)||v}catch(w){it(w)}})),v||o.isCancellationRequested)break}return await f,o.isCancellationRequested?(h.dispose(),Promise.reject(new Bm)):new GO(c.sort(YO(i.snippetSortOrder)),g,{entries:u,elapsed:r.elapsed()},h)}function P_(n,e){if(n.sortTextLow&&e.sortTextLow){if(n.sortTextLow<e.sortTextLow)return-1;if(n.sortTextLow>e.sortTextLow)return 1}return n.textLabel<e.textLabel?-1:n.textLabel>e.textLabel?1:n.completion.kind-e.completion.kind}function ZO(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===28)return-1;if(e.completion.kind===28)return 1}return P_(n,e)}function XO(n,e){if(n.completion.kind!==e.completion.kind){if(n.completion.kind===28)return 1;if(e.completion.kind===28)return-1}return P_(n,e)}var Eh=new Map;Eh.set(0,ZO);Eh.set(2,XO);Eh.set(1,P_);function YO(n){return Eh.get(n)}Me.registerCommand("_executeCompletionItemProvider",async(n,...e)=>{const[t,i,s,o]=e;Ie(ke.isUri(t)),Ie(B.isIPosition(i)),Ie(typeof s=="string"||!s),Ie(typeof o=="number"||!o);const{completionProvider:r}=n.get(X),a=await n.get(li).createModelReference(t);try{const l={incomplete:!1,suggestions:[]},d=[],c=a.object.textEditorModel.validatePosition(i),h=await T_(r,a.object.textEditorModel,c,void 0,{triggerCharacter:s??void 0,triggerKind:s?1:0});for(const u of h.items)d.length<(o??0)&&d.push(u.resolve(he.None)),l.incomplete=l.incomplete||u.container.incomplete,l.suggestions.push(u.completion);try{return await Promise.all(d),l}finally{setTimeout(()=>h.disposable.dispose(),100)}}finally{a.dispose()}});function JO(n,e){n.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(e),void 0,!0)}var tr=class{static isAllOff(n){return n.other==="off"&&n.comments==="off"&&n.strings==="off"}static isAllOn(n){return n.other==="on"&&n.comments==="on"&&n.strings==="on"}static valueFor(n,e){switch(e){case 1:return n.comments;case 2:return n.strings;default:return n.other}}},Se=class{static{this.inlineSuggestionVisible=new ae("inlineSuggestionVisible",!1,m(1249,"Whether an inline suggestion is visible"))}static{this.inlineSuggestionAlternativeActionVisible=new ae("inlineSuggestionAlternativeActionVisible",!1,m(1250,"Whether an alternative action for the inline suggestion is visible."))}static{this.inlineSuggestionHasIndentation=new ae("inlineSuggestionHasIndentation",!1,m(1251,"Whether the inline suggestion starts with whitespace"))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new ae("inlineSuggestionHasIndentationLessThanTabSize",!0,m(1252,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab"))}static{this.suppressSuggestions=new ae("inlineSuggestionSuppressSuggestions",void 0,m(1253,"Whether suggestions should be suppressed for the current suggestion"))}static{this.cursorBeforeGhostText=new ae("cursorBeforeGhostText",!1,m(1254,"Whether the cursor is at ghost text"))}static{this.cursorInIndentation=new ae("cursorInIndentation",!1,m(1255,"Whether the cursor is in indentation"))}static{this.hasSelection=new ae("editor.hasSelection",!1,m(1256,"Whether the editor has a selection"))}static{this.cursorAtInlineEdit=new ae("cursorAtInlineEdit",!1,m(1257,"Whether the cursor is at an inline edit"))}static{this.inlineEditVisible=new ae("inlineEditIsVisible",!1,m(1258,"Whether an inline edit is visible"))}static{this.tabShouldJumpToInlineEdit=new ae("tabShouldJumpToInlineEdit",!1,m(1259,"Whether tab should jump to an inline edit."))}static{this.tabShouldAcceptInlineEdit=new ae("tabShouldAcceptInlineEdit",!1,m(1260,"Whether tab should accept the inline edit."))}static{this.inInlineEditsPreviewEditor=new ae("inInlineEditsPreviewEditor",!0,m(1261,"Whether the current code editor is showing an inline edits preview"))}},cI=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Lc=function(n,e){return function(t,i){e(t,i,n)}},Fb=class{constructor(n,e,t){this.marker=n,this.index=e,this.total=t}},xp=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new ee,this.onDidChange=this._onDidChange.event,this._dispoables=new O,this._markers=[],this._nextIdx=-1,ke.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const s=this._configService.getValue("problems.sortOrder"),o=(a,l)=>{let d=Hv(a.resource.toString(),l.resource.toString());return d===0&&(s==="position"?d=x.compareRangesUsingStarts(a,l)||wt.compare(a.severity,l.severity):d=wt.compare(a.severity,l.severity)||x.compareRangesUsingStarts(a,l)),d},r=()=>{let a=this._markerService.read({resource:ke.isUri(e)?e:void 0,severities:wt.Error|wt.Warning|wt.Info});return typeof e=="function"&&(a=a.filter(l=>this._resourceFilter(l.resource))),a.sort(o),$i(a,this._markers,(l,d)=>l.resource.toString()===d.resource.toString()&&l.startLineNumber===d.startLineNumber&&l.startColumn===d.startColumn&&l.endLineNumber===d.endLineNumber&&l.endColumn===d.endColumn&&l.severity===d.severity&&l.message===d.message)?!1:(this._markers=a,!0)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&r()&&(this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new Fb(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let s=this._markers.findIndex(o=>vs(o.resource,e.uri));if(s<0)s=oT(this._markers.length,o=>Hv(this._markers[o].resource.toString(),e.uri.toString())),s<0&&(s=~s),i?this._nextIdx=s:this._nextIdx=(this._markers.length+s-1)%this._markers.length;else{let o=!1,r=!1;for(let a=s;a<this._markers.length;a++){let l=x.lift(this._markers[a]);if(l.isEmpty()){const d=e.getWordAtPosition(l.getStartPosition());d&&(l=new x(l.startLineNumber,d.startColumn,l.startLineNumber,d.endColumn))}if(t&&(l.containsPosition(t)||t.isBeforeOrEqual(l.getStartPosition()))){this._nextIdx=a,o=!0,r=!l.containsPosition(t);break}if(this._markers[a].resource.toString()!==e.uri.toString())break}o?r&&!i&&(this._nextIdx-=1):this._nextIdx=i?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const s=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),s!==this._nextIdx}find(e,t){let i=this._markers.findIndex(s=>s.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(x.containsPosition(this._markers[i],t))return new Fb(this._markers[i],i+1,this._markers.length)}}};xp=cI([Lc(1,fh),Lc(2,Ee)],xp);var hI=fn("IMarkerNavigationService"),Ip=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new Tw}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new xp(e,this._markerService,this._configService)}};Ip=cI([Lc(0,fh),Lc(1,Ee)],Ip);zn(hI,Ip,1);var Lp;(function(n){function e(t){switch(t){case Fl.Ignore:return"severity-ignore "+ce.asClassName(V.info);case Fl.Info:return ce.asClassName(V.info);case Fl.Warning:return ce.asClassName(V.warning);case Fl.Error:return ce.asClassName(V.error);default:return""}}n.className=e})(Lp||(Lp={}));var QO=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Mo=function(n,e){return function(t,i){e(t,i,n)}},Dp,eA=class{constructor(n,e,t,i,s){this._openerService=i,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new O,this._editor=e;const o=document.createElement("div");o.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),o.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),o.appendChild(this._relatedBlock),this._disposables.add(hn(this._relatedBlock,"click",r=>{r.preventDefault();const a=this._relatedDiagnostics.get(r.target);a&&t(a)})),this._scrollable=new lE(o,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),n.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(r=>{o.style.left=`-${r.scrollLeft}px`,o.style.top=`-${r.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Pt(this._disposables)}update(n){const{source:e,message:t,relatedInformation:i,code:s}=n;let o=(e?.length||0)+2;s&&(typeof s=="string"?o+=s.length:o+=s.value.length);const r=Fn(t);this._lines=r.length,this._longestLineLength=0;for(const h of r)this._longestLineLength=Math.max(h.length+o,this._longestLineLength);ni(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(n)),Ss(this.getAriaLabel(n)),this._editor.applyFontInfo(this._messageBlock);let a=this._messageBlock;for(const h of r)a=document.createElement("div"),a.innerText=h,h===""&&(a.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(a);if(e||s){const h=document.createElement("span");if(h.classList.add("details"),a.appendChild(h),e){const u=document.createElement("span");u.innerText=e,u.classList.add("source"),h.appendChild(u)}if(s)if(typeof s=="string"){const u=document.createElement("span");u.innerText=`(${s})`,u.classList.add("code"),h.appendChild(u)}else{this._codeLink=H("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=g=>{this._openerService.open(s.target),g.preventDefault(),g.stopPropagation()};const u=U(this._codeLink,H("span"));u.innerText=s.value,h.appendChild(this._codeLink)}}if(ni(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Gt(i)){const h=this._relatedBlock.appendChild(document.createElement("div"));h.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(const u of i){const g=document.createElement("div"),p=document.createElement("a");p.classList.add("filename"),p.innerText=`${this._labelService.getUriBasenameLabel(u.resource)}(${u.startLineNumber}, ${u.startColumn}): `,p.title=this._labelService.getUriLabel(u.resource),this._relatedDiagnostics.set(p,u);const f=document.createElement("span");f.innerText=u.message,g.appendChild(p),g.appendChild(f),this._lines+=1,h.appendChild(g)}}const l=this._editor.getOption(59),d=Math.ceil(l.typicalFullwidthCharacterWidth*this._longestLineLength*.75),c=l.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:d,scrollHeight:c})}layout(n,e){this._scrollable.getDomNode().style.height=`${n}px`,this._scrollable.getDomNode().style.width=`${e}px`,this._scrollable.setScrollDimensions({width:e,height:n})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(n){let e="";switch(n.severity){case wt.Error:e=m(1082,"Error");break;case wt.Warning:e=m(1083,"Warning");break;case wt.Info:e=m(1084,"Info");break;case wt.Hint:e=m(1085,"Hint")}let t=m(1086,"{0}: {1} at {2}. ",e,n.message,n.startLineNumber+":"+n.startColumn);const i=this._editor.getModel();return i&&n.startLineNumber<=i.getLineCount()&&n.startLineNumber>=1&&(t=`${i.getLineContent(n.startLineNumber)}, ${t}`),t}},il=class extends _c{static{Dp=this}static{this.TitleMenu=new K("gotoErrorTitleMenu")}constructor(e,t,i,s,o,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},o),this._themeService=t,this._openerService=i,this._menuService=s,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new O,this._onDidSelectRelatedInformation=new ee,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=wt.Warning,this._backgroundColor=ve.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(sA);let t=Ep,i=tA;this._severity===wt.Warning?(t=Od,i=iA):this._severity===wt.Info&&(t=Rp,i=nA);const s=e.getColor(t),o=e.getColor(i);this.style({arrowColor:s,frameColor:s,headerBackgroundColor:o,primaryHeadingColor:e.getColor(yx),secondaryHeadingColor:e.getColor(xx)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),this._onDidSelectRelatedInformation.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(s=>this.editor.focus()));const t=this._menuService.getMenuActions(Dp.TitleMenu,this._contextKeyService),i=DT(t);this._actionbarWidget.push(i,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=U(e,H(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new eA(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(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const s=x.lift(e),o=this.editor.getPosition(),r=o&&s.containsPosition(o)?o:s.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?m(1087,"{0} of {1} problems",t,i):m(1088,"{0} of {1} problem",t,i);this.setTitle(Ti(a.uri),l)}this._icon.className=`codicon ${Lp.className(wt.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};il=Dp=QO([Mo(1,Dt),Mo(2,Co),Mo(3,Ts),Mo(4,ne),Mo(5,Ce),Mo(6,br)],il);var Hb=pm(pT,dR),Wb=pm(g0,b0),Vb=pm(sg,kR),Ep=W("editorMarkerNavigationError.background",{dark:Hb,light:Hb,hcDark:cn,hcLight:cn},m(1089,"Editor marker navigation widget error color.")),tA=W("editorMarkerNavigationError.headerBackground",{dark:st(Ep,.1),light:st(Ep,.1),hcDark:null,hcLight:null},m(1090,"Editor marker navigation widget error heading background.")),Od=W("editorMarkerNavigationWarning.background",{dark:Wb,light:Wb,hcDark:cn,hcLight:cn},m(1091,"Editor marker navigation widget warning color.")),iA=W("editorMarkerNavigationWarning.headerBackground",{dark:st(Od,.1),light:st(Od,.1),hcDark:"#0C141F",hcLight:st(Od,.2)},m(1092,"Editor marker navigation widget warning heading background.")),Rp=W("editorMarkerNavigationInfo.background",{dark:Vb,light:Vb,hcDark:cn,hcLight:cn},m(1093,"Editor marker navigation widget info color.")),nA=W("editorMarkerNavigationInfo.headerBackground",{dark:st(Rp,.1),light:st(Rp,.1),hcDark:null,hcLight:null},m(1094,"Editor marker navigation widget info heading background.")),sA=W("editorMarkerNavigation.background",nc,m(1095,"Editor marker navigation widget background.")),oA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},id=function(n,e){return function(t,i){e(t,i,n)}},ua,_o=class{static{ua=this}static{this.ID="editor.contrib.markerController"}static get(e){return e.getContribution(ua.ID)}constructor(e,t,i,s,o){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=s,this._instantiationService=o,this._sessionDispoables=new O,this._editor=e,this._widgetVisible=_I.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(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(il,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(i=>{(!this._model?.selected||!x.containsPosition(this._model?.selected.marker,i.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:x.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._getOrCreateModel(t.uri);i.resetIndex(),i.move(!0,t,new B(e.startLineNumber,e.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}async navigate(e,t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),s=this._getOrCreateModel(t?void 0:i.uri);if(s.move(e,i,this._editor.getPosition()),!!s.selected)if(s.selected.marker.resource.toString()!==i.uri.toString()){this._cleanUp();const o=await this._editorService.openCodeEditor({resource:s.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:s.selected.marker}},this._editor);o&&(ua.get(o)?.close(),ua.get(o)?.navigate(e,t))}else this._widget.showAtMarker(s.selected.marker,s.selected.index,s.selected.total)}};_o=ua=oA([id(1,hI),id(2,Ce),id(3,Ze),id(4,ne)],_o);var Rh=class extends A{constructor(n,e,t){super(t),this._next=n,this._multiFile=e}async run(n,e){e.hasModel()&&await _o.get(e)?.navigate(this._next,this._multiFile)}},k_=class Ad extends Rh{static{this.ID="editor.action.marker.next"}static{this.LABEL=L(1078,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:Ad.ID,label:Ad.LABEL,precondition:void 0,kbOpts:{kbExpr:S.focus,primary:578,weight:100},menuOpts:{menuId:il.TitleMenu,title:Ad.LABEL.value,icon:Ye("marker-navigation-next",V.arrowDown,m(1074,"Icon for goto next marker.")),group:"navigation",order:1}})}},uI=class Fd extends Rh{static{this.ID="editor.action.marker.prev"}static{this.LABEL=L(1079,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:Fd.ID,label:Fd.LABEL,precondition:void 0,kbOpts:{kbExpr:S.focus,primary:1602,weight:100},menuOpts:{menuId:il.TitleMenu,title:Fd.LABEL.value,icon:Ye("marker-navigation-previous",V.arrowUp,m(1075,"Icon for goto previous marker.")),group:"navigation",order:2}})}},gI=class pI extends Rh{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:pI.ID,label:L(1080,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:66,weight:100},menuOpts:{menuId:K.MenubarGoMenu,title:m(1076,"Next &&Problem"),group:"6_problem_nav",order:1}})}},fI=class mI extends Rh{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:mI.ID,label:L(1081,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:1090,weight:100},menuOpts:{menuId:K.MenubarGoMenu,title:m(1077,"Previous &&Problem"),group:"6_problem_nav",order:2}})}};de(_o.ID,_o,4);P(k_);P(uI);P(gI);P(fI);var _I=new ae("markersNavigationVisible",!1),rA=Ft.bindToContribution(_o.get);Z(new rA({id:"closeMarkersNavigation",precondition:_I,handler:n=>n.close(),kbOpts:{weight:150,kbExpr:S.focus,primary:9,secondary:[1033]}}));var aA=class{constructor(n,e,t){this._selection=n,this._cursors=e,this._selectionId=null,this._trimInRegexesAndStrings=t}getEditOperations(n,e){const t=lA(n,this._cursors,this._trimInRegexesAndStrings);for(let i=0,s=t.length;i<s;i++){const o=t[i];e.addEditOperation(o.range,o.text)}this._selectionId=e.trackSelection(this._selection)}computeCursorState(n,e){return e.getTrackedSelection(this._selectionId)}};function lA(n,e,t){e.sort((a,l)=>a.lineNumber===l.lineNumber?a.column-l.column:a.lineNumber-l.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let s=0,o=0;const r=e.length;for(let a=1,l=n.getLineCount();a<=l;a++){const d=n.getLineContent(a),c=d.length+1;let h=0;if(o<r&&e[o].lineNumber===a&&(h=e[o].column,o++,h===c)||d.length===0)continue;const u=xd(d);let g=0;if(u===-1)g=1;else if(u!==d.length-1)g=u+2;else continue;if(!t){if(!n.tokenization.hasAccurateTokensForLine(a))continue;const p=n.tokenization.getLineTokens(a),f=p.getStandardTokenType(p.findTokenIndexAtOffset(g));if(f===2||f===3)continue}g=Math.max(h,g),i[s++]=Xe.delete(new x(a,g,a,c))}return i}var vI=class{constructor(n,e,t){this._selection=n,this._isCopyingDown=e,this._noop=t||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(n,e){let t=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,t.startLineNumber<t.endLineNumber&&t.endColumn===1&&(this._endLineNumberDelta=1,t=t.setEndPosition(t.endLineNumber-1,n.getLineMaxColumn(t.endLineNumber-1)));const i=[];for(let o=t.startLineNumber;o<=t.endLineNumber;o++)i.push(n.getLineContent(o));const s=i.join(`
|
|
24
|
+
`);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?e.addEditOperation(new x(t.endLineNumber,n.getLineMaxColumn(t.endLineNumber),t.endLineNumber+1,1),t.endLineNumber===n.getLineCount()?"":`
|
|
25
|
+
`):this._isCopyingDown?e.addEditOperation(new x(t.startLineNumber,1,t.startLineNumber,1),s+`
|
|
26
|
+
`):e.addEditOperation(new x(t.endLineNumber,n.getLineMaxColumn(t.endLineNumber),t.endLineNumber,n.getLineMaxColumn(t.endLineNumber)),`
|
|
27
|
+
`+s),this._selectionId=e.trackSelection(t),this._selectionDirection=this._selection.getDirection()}computeCursorState(n,e){let t=e.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let i=t.startLineNumber,s=t.startColumn,o=t.endLineNumber,r=t.endColumn;this._startLineNumberDelta!==0&&(i=i+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(o=o+this._endLineNumberDelta,r=1),t=ie.createWithDirection(i,s,o,r,this._selectionDirection)}return t}};function $t(n,e){let t=0;for(let i=0;i<n.length;i++)n.charAt(i)===" "?t+=e:t++;return t}function Ra(n,e,t){n=n<0?0:n;let i="";if(!t){const s=Math.floor(n/e);n=n%e;for(let o=0;o<s;o++)i+=" "}for(let s=0;s<n;s++)i+=" ";return i}var dA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},cA=function(n,e){return function(t,i){e(t,i,n)}},Tp=class{constructor(e,t,i,s){this._languageConfigurationService=s,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(e,t,i){return{tokenization:{getLineTokens:s=>e.tokenization.getLineTokens(t(s)),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(s,o)=>e.getLanguageIdAtPosition(s,o)},getLineContent:s=>{const o=i?.(s);return o!==void 0?o:e.getLineContent(t(s))}}}getEditOperations(e,t){const i=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===i){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let s=this._selection;s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(this._moveEndPositionDown=!0,s=s.setEndPosition(s.endLineNumber-1,e.getLineMaxColumn(s.endLineNumber-1)));const{tabSize:o,indentSize:r,insertSpaces:a}=e.getOptions(),l=this.buildIndentConverter(o,r,a);if(s.startLineNumber===s.endLineNumber&&e.getLineMaxColumn(s.startLineNumber)===1){const d=s.startLineNumber,c=this._isMovingDown?d+1:d-1;e.getLineMaxColumn(c)===1?t.addEditOperation(new x(1,1,1,1),null):(t.addEditOperation(new x(d,1,d,1),e.getLineContent(c)),t.addEditOperation(new x(c,1,c,e.getLineMaxColumn(c)),null)),s=new ie(c,1,c,1)}else{let d,c;if(this._isMovingDown){d=s.endLineNumber+1,c=e.getLineContent(d),t.addEditOperation(new x(d-1,e.getLineMaxColumn(d-1),d,e.getLineMaxColumn(d)),null);let h=c;if(this.shouldAutoIndent(e,s)){const u=this.matchEnterRule(e,l,o,d,s.startLineNumber-1);if(u!==null){const p=It(e.getLineContent(d)),f=u+$t(p,o);h=Ra(f,o,a)+this.trimStart(c)}else{const p=this.createVirtualModel(e,_=>_===s.startLineNumber?d:_),f=Ia(this._autoIndent,p,e.getLanguageIdAtPosition(d,1),s.startLineNumber,l,this._languageConfigurationService);if(f!==null){const _=It(e.getLineContent(d)),v=$t(f,o);v!==$t(_,o)&&(h=Ra(v,o,a)+this.trimStart(c))}}t.addEditOperation(new x(s.startLineNumber,1,s.startLineNumber,1),h+`
|
|
28
|
+
`);const g=this.matchEnterRuleMovingDown(e,l,o,s.startLineNumber,d,h);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(e,t,s,o,a,g);else{const p=this.createVirtualModel(e,_=>_===s.startLineNumber?d:_>=s.startLineNumber+1&&_<=s.endLineNumber+1?_-1:_,_=>_===s.startLineNumber?h:void 0),f=Ia(this._autoIndent,p,e.getLanguageIdAtPosition(d,1),s.startLineNumber+1,l,this._languageConfigurationService);if(f!==null){const _=It(e.getLineContent(s.startLineNumber)),v=$t(f,o),C=$t(_,o);if(v!==C){const w=v-C;this.getIndentEditsOfMovingBlock(e,t,s,o,a,w)}}}}else t.addEditOperation(new x(s.startLineNumber,1,s.startLineNumber,1),h+`
|
|
29
|
+
`)}else if(d=s.startLineNumber-1,c=e.getLineContent(d),t.addEditOperation(new x(d,1,d+1,1),null),t.addEditOperation(new x(s.endLineNumber,e.getLineMaxColumn(s.endLineNumber),s.endLineNumber,e.getLineMaxColumn(s.endLineNumber)),`
|
|
30
|
+
`+c),this.shouldAutoIndent(e,s)){const h=this.createVirtualModel(e,g=>g===d?s.startLineNumber:g),u=this.matchEnterRule(e,l,o,s.startLineNumber,s.startLineNumber-2);if(u!==null)u!==0&&this.getIndentEditsOfMovingBlock(e,t,s,o,a,u);else{const g=Ia(this._autoIndent,h,e.getLanguageIdAtPosition(s.startLineNumber,1),d,l,this._languageConfigurationService);if(g!==null){const p=It(e.getLineContent(s.startLineNumber)),f=$t(g,o),_=$t(p,o);if(f!==_){const v=f-_;this.getIndentEditsOfMovingBlock(e,t,s,o,a,v)}}}}}this._selectionId=t.trackSelection(s)}buildIndentConverter(e,t,i){return{shiftIndent:s=>_r.shiftIndent(s,s.length+1,e,t,i),unshiftIndent:s=>_r.unshiftIndent(s,s.length+1,e,t,i)}}parseEnterResult(e,t,i,s,o){if(o){let r=o.indentation;o.indentAction===Hl.None||o.indentAction===Hl.Indent?r=o.indentation+o.appendText:o.indentAction===Hl.IndentOutdent?r=o.indentation:o.indentAction===Hl.Outdent&&(r=t.unshiftIndent(o.indentation)+o.appendText);const a=e.getLineContent(s);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const l=It(e.getLineContent(s));let d=It(r);const c=Hw(e,s,this._languageConfigurationService);return c!==null&&c&2&&(d=t.unshiftIndent(d)),$t(d,i)-$t(l,i)}}return null}matchEnterRuleMovingDown(e,t,i,s,o,r){if(xd(r)>=0){const a=e.getLineMaxColumn(o),l=Gh(this._autoIndent,e,new x(o,a,o,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,s,l)}else{let a=s-1;for(;a>=1;){const c=e.getLineContent(a);if(xd(c)>=0)break;a--}if(a<1||s>e.getLineCount())return null;const l=e.getLineMaxColumn(a),d=Gh(this._autoIndent,e,new x(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,s,d)}}matchEnterRule(e,t,i,s,o,r){let a=o;for(;a>=1;){let c;if(a===o&&r!==void 0?c=r:c=e.getLineContent(a),xd(c)>=0)break;a--}if(a<1||s>e.getLineCount())return null;const l=e.getLineMaxColumn(a),d=Gh(this._autoIndent,e,new x(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,s,d)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1);return!(i!==e.getLanguageIdAtPosition(t.endLineNumber,1)||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,s,o,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const l=e.getLineContent(a),d=It(l),c=$t(d,s)+r,h=Ra(c,s,o);h!==d&&(t.addEditOperation(new x(a,1,a,d.length+1),h),a===i.endLineNumber&&i.endColumn<=d.length+1&&h===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};Tp=dA([cA(3,ct)],Tp);var Pp=class{static{this._COLLATOR=ZS.Collator()}constructor(n,e){this.selection=n,this.descending=e,this.selectionId=null}getEditOperations(n,e){const t=hA(n,this.selection,this.descending);t&&e.addEditOperation(t.range,t.text),this.selectionId=e.trackSelection(this.selection)}computeCursorState(n,e){return e.getTrackedSelection(this.selectionId)}static canRun(n,e,t){if(n===null)return!1;const i=bI(n,e,t);if(!i)return!1;for(let s=0,o=i.before.length;s<o;s++)if(i.before[s]!==i.after[s])return!0;return!1}};function bI(n,e,t){const i=e.startLineNumber;let s=e.endLineNumber;if(e.endColumn===1&&s--,i>=s)return null;const o=[];for(let a=i;a<=s;a++)o.push(n.getLineContent(a));let r=o.slice(0);return r.sort(Pp._COLLATOR.value.compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:s,before:o,after:r}}function hA(n,e,t){const i=bI(n,e,t);return i?Xe.replace(new x(i.startLineNumber,1,i.endLineNumber,n.getLineMaxColumn(i.endLineNumber)),i.after.join(`
|
|
31
|
+
`)):null}var CI=class extends A{constructor(n,e){super(e),this.down=n}run(n,e){if(!e.hasModel())return;const t=e.getSelections().map((o,r)=>({selection:o,index:r,ignore:!1}));t.sort((o,r)=>x.compareRangesUsingStarts(o.selection,r.selection));let i=t[0];for(let o=1;o<t.length;o++){const r=t[o];i.selection.endLineNumber===r.selection.startLineNumber&&(i.index<r.index?r.ignore=!0:(i.ignore=!0,i=r))}const s=[];for(const o of t)s.push(new vI(o.selection,this.down,o.ignore));e.pushUndoStop(),e.executeCommands(this.id,s),e.pushUndoStop()}},uA=class extends CI{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:L(1315,"Copy Line Up"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"2_line",title:m(1310,"&&Copy Line Up"),order:1},canTriggerInlineEdits:!0})}},gA=class extends CI{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:L(1316,"Copy Line Down"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"2_line",title:m(1311,"Co&&py Line Down"),order:2},canTriggerInlineEdits:!0})}},pA=class extends A{constructor(){super({id:"editor.action.duplicateSelection",label:L(1317,"Duplicate Selection"),precondition:S.writable,menuOpts:{menuId:K.MenubarSelectionMenu,group:"2_line",title:m(1312,"&&Duplicate Selection"),order:5},canTriggerInlineEdits:!0})}run(n,e,t){if(!e.hasModel())return;const i=[],s=e.getSelections(),o=e.getModel();for(const r of s)if(r.isEmpty())i.push(new vI(r,!0));else{const a=new ie(r.endLineNumber,r.endColumn,r.endLineNumber,r.endColumn);i.push(new SR(a,o.getValueInRange(r)))}e.pushUndoStop(),e.executeCommands(this.id,i),e.pushUndoStop()}},SI=class extends A{constructor(n,e){super(e),this.down=n}run(n,e){const t=n.get(ct),i=[],s=e.getSelections()||[],o=e.getOption(16);for(const r of s)i.push(new Tp(r,this.down,o,t));e.pushUndoStop(),e.executeCommands(this.id,i),e.pushUndoStop()}},fA=class extends SI{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:L(1318,"Move Line Up"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"2_line",title:m(1313,"Mo&&ve Line Up"),order:3},canTriggerInlineEdits:!0})}},mA=class extends SI{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:L(1319,"Move Line Down"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"2_line",title:m(1314,"Move &&Line Down"),order:4},canTriggerInlineEdits:!0})}},wI=class extends A{constructor(n,e){super(e),this.descending=n}run(n,e){if(!e.hasModel())return;const t=e.getModel();let i=e.getSelections();i.length===1&&i[0].isSingleLine()&&(i=[new ie(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);for(const o of i)if(!Pp.canRun(e.getModel(),o,this.descending))return;const s=[];for(let o=0,r=i.length;o<r;o++)s[o]=new Pp(i[o],this.descending);e.pushUndoStop(),e.executeCommands(this.id,s),e.pushUndoStop()}},_A=class extends wI{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:L(1320,"Sort Lines Ascending"),precondition:S.writable,canTriggerInlineEdits:!0})}},vA=class extends wI{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:L(1321,"Sort Lines Descending"),precondition:S.writable,canTriggerInlineEdits:!0})}},bA=class extends A{constructor(){super({id:"editor.action.removeDuplicateLines",label:L(1322,"Delete Duplicate Lines"),precondition:S.writable,canTriggerInlineEdits:!0})}run(n,e){if(!e.hasModel())return;const t=e.getModel();if(t.getLineCount()===1&&t.getLineMaxColumn(1)===1)return;const i=[],s=[];let o=0,r=!0,a=e.getSelections();a.length===1&&a[0].isSingleLine()&&(a=[new ie(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))],r=!1);for(const l of a){const d=new Set,c=[];for(let p=l.startLineNumber;p<=l.endLineNumber;p++){const f=t.getLineContent(p);d.has(f)||(c.push(f),d.add(f))}const h=new ie(l.startLineNumber,1,l.endLineNumber,t.getLineMaxColumn(l.endLineNumber)),u=l.startLineNumber-o,g=new ie(u,1,u+c.length-1,c[c.length-1].length+1);i.push(Xe.replace(h,c.join(`
|
|
32
|
+
`))),s.push(g),o+=l.endLineNumber-l.startLineNumber+1-c.length}e.pushUndoStop(),e.executeEdits(this.id,i,r?s:void 0),e.pushUndoStop()}},CA=class extends A{constructor(){super({id:"editor.action.reverseLines",label:L(1323,"Reverse lines"),precondition:S.writable,canTriggerInlineEdits:!0})}run(n,e){if(!e.hasModel())return;const t=e.getModel(),i=e.getSelections();let s=i;s.length===1&&s[0].isSingleLine()&&(s=[new ie(1,1,t.getLineCount(),t.getLineMaxColumn(t.getLineCount()))]);const o=[],r=[];for(let a=0;a<s.length;a++){const l=s[a],d=i[a];let c=l.endLineNumber;l.startLineNumber<l.endLineNumber&&l.endColumn===1&&c--;let h=new x(l.startLineNumber,1,c,t.getLineMaxColumn(c));c===t.getLineCount()&&t.getLineContent(h.endLineNumber)===""&&(h=h.setEndPosition(h.endLineNumber-1,t.getLineMaxColumn(h.endLineNumber-1)));const u=[];for(let _=h.endLineNumber;_>=h.startLineNumber;_--)u.push(t.getLineContent(_));const g=Xe.replace(h,u.join(`
|
|
33
|
+
`));o.push(g);const p=function(_){return _<=h.endLineNumber?h.endLineNumber-_+h.startLineNumber:_},f=function(_){if(_.isEmpty())return new ie(p(_.positionLineNumber),_.positionColumn,p(_.positionLineNumber),_.positionColumn);{const v=p(_.selectionStartLineNumber),C=p(_.positionLineNumber),w=_.selectionStartColumn,y=_.positionColumn;return new ie(v,w,C,y)}};r.push(f(d))}e.pushUndoStop(),e.executeEdits(this.id,o,r),e.pushUndoStop()}},SA=class yI extends A{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:yI.ID,label:L(1324,"Trim Trailing Whitespace"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2102),weight:100}})}run(e,t,i){let s=[];i.reason==="auto-save"&&(s=(t.getSelections()||[]).map(c=>new B(c.positionLineNumber,c.positionColumn)));const o=t.getSelection();if(o===null)return;const r=e.get(Ee),a=t.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a?.getLanguageId(),resource:a?.uri}),d=new aA(o,s,l);t.pushUndoStop(),t.executeCommands(this.id,[d]),t.pushUndoStop()}},wA=class extends A{constructor(){super({id:"editor.action.deleteLines",label:L(1325,"Delete Line"),precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(n,e){if(!e.hasModel())return;const t=this._getLinesToRemove(e),i=e.getModel();if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return;let s=0;const o=[],r=[];for(let a=0,l=t.length;a<l;a++){const d=t[a];let c=d.startLineNumber,h=d.endLineNumber,u=1,g=i.getLineMaxColumn(h);h<i.getLineCount()?(h+=1,g=1):c>1&&(c-=1,u=i.getLineMaxColumn(c)),o.push(Xe.replace(new ie(c,u,h,g),"")),r.push(new ie(c-s,d.positionColumn,c-s,d.positionColumn)),s+=d.endLineNumber-d.startLineNumber+1}e.pushUndoStop(),e.executeEdits(this.id,o,r),e.revealAllCursors(!0),e.pushUndoStop()}_getLinesToRemove(n){const e=n.getSelections().map(s=>{let o=s.endLineNumber;return s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(o-=1),{startLineNumber:s.startLineNumber,selectionStartColumn:s.selectionStartColumn,endLineNumber:o,positionColumn:s.positionColumn}});e.sort((s,o)=>s.startLineNumber===o.startLineNumber?s.endLineNumber-o.endLineNumber:s.startLineNumber-o.startLineNumber);const t=[];let i=e[0];for(let s=1;s<e.length;s++)i.endLineNumber+1>=e[s].startLineNumber?i.endLineNumber=e[s].endLineNumber:(t.push(i),i=e[s]);return t.push(i),t}},yA=class extends A{constructor(){super({id:"editor.action.indentLines",label:L(1326,"Indent Line"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(n,e){const t=e._getViewModel();t&&(e.pushUndoStop(),e.executeCommands(this.id,SE.indent(t.cursorConfig,e.getModel(),e.getSelections())),e.pushUndoStop())}},xA=class extends A{constructor(){super({id:"editor.action.outdentLines",label:L(1327,"Outdent Line"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(n,e){Sd.Outdent.runEditorCommand(n,e,null)}},xI=class II extends A{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:II.ID,label:L(1328,"Insert Line Above"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,PS.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}},LI=class DI extends A{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:DI.ID,label:L(1329,"Insert Line Below"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,PS.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}},EI=class extends A{run(n,e){if(!e.hasModel())return;const t=e.getSelection(),i=this._getRangesToDelete(e),s=[];for(let a=0,l=i.length-1;a<l;a++){const d=i[a],c=i[a+1];x.intersectRanges(d,c)===null?s.push(d):i[a+1]=x.plusRange(d,c)}s.push(i[i.length-1]);const o=this._getEndCursorState(t,s),r=s.map(a=>Xe.replace(a,""));e.pushUndoStop(),e.executeEdits(this.id,r,o),e.pushUndoStop()}},IA=class extends EI{constructor(){super({id:"deleteAllLeft",label:L(1330,"Delete All Left"),precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(n,e){let t=null;const i=[];let s=0;return e.forEach(o=>{let r;if(o.endColumn===1&&s>0){const a=o.startLineNumber-s;r=new ie(a,o.startColumn,a,o.startColumn)}else r=new ie(o.startLineNumber,o.startColumn,o.startLineNumber,o.startColumn);s+=o.endLineNumber-o.startLineNumber,o.intersectRanges(n)?t=r:i.push(r)}),t&&i.unshift(t),i}_getRangesToDelete(n){const e=n.getSelections();if(e===null)return[];let t=e;const i=n.getModel();return i===null?[]:(t.sort(x.compareRangesUsingStarts),t=t.map(s=>{if(s.isEmpty())if(s.startColumn===1){const o=Math.max(1,s.startLineNumber-1),r=s.startLineNumber===1?1:i.getLineLength(o)+1;return new x(o,r,s.startLineNumber,1)}else return new x(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new x(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),t)}},LA=class extends EI{constructor(){super({id:"deleteAllRight",label:L(1331,"Delete All Right"),precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(n,e){let t=null;const i=[];for(let s=0,o=e.length,r=0;s<o;s++){const a=e[s],l=new ie(a.startLineNumber-r,a.startColumn,a.startLineNumber-r,a.startColumn);a.intersectRanges(n)?t=l:i.push(l)}return t&&i.unshift(t),i}_getRangesToDelete(n){const e=n.getModel();if(e===null)return[];const t=n.getSelections();if(t===null)return[];const i=t.map(s=>{if(s.isEmpty()){const o=e.getLineMaxColumn(s.startLineNumber);return s.startColumn===o?new x(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new x(s.startLineNumber,s.startColumn,s.startLineNumber,o)}return s});return i.sort(x.compareRangesUsingStarts),i}},DA=class extends A{constructor(){super({id:"editor.action.joinLines",label:L(1332,"Join Lines"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(n,e){const t=e.getSelections();if(t===null)return;let i=e.getSelection();if(i===null)return;t.sort(x.compareRangesUsingStarts);const s=[],o=t.reduce((h,u)=>h.isEmpty()?h.endLineNumber===u.startLineNumber?(i.equalsSelection(h)&&(i=u),u):u.startLineNumber>h.endLineNumber+1?(s.push(h),u):new ie(h.startLineNumber,h.startColumn,u.endLineNumber,u.endColumn):u.startLineNumber>h.endLineNumber?(s.push(h),u):new ie(h.startLineNumber,h.startColumn,u.endLineNumber,u.endColumn));s.push(o);const r=e.getModel();if(r===null)return;const a=[],l=[];let d=i,c=0;for(let h=0,u=s.length;h<u;h++){const g=s[h],p=g.startLineNumber,f=1;let _=0,v,C;const w=r.getLineLength(g.endLineNumber)-g.endColumn;if(g.isEmpty()||g.startLineNumber===g.endLineNumber){const b=g.getStartPosition();b.lineNumber<r.getLineCount()?(v=p+1,C=r.getLineMaxColumn(v)):(v=b.lineNumber,C=r.getLineMaxColumn(b.lineNumber))}else v=g.endLineNumber,C=r.getLineMaxColumn(v);let y=r.getLineContent(p);for(let b=p+1;b<=v;b++){const I=r.getLineContent(b),N=r.getLineFirstNonWhitespaceColumn(b);if(N>=1){let T=!0;y===""&&(T=!1),T&&(y.charAt(y.length-1)===" "||y.charAt(y.length-1)===" ")&&(T=!1,y=y.replace(/[\s\uFEFF\xA0]+$/g," "));const E=I.substr(N-1);y+=(T?" ":"")+E,T?_=E.length+1:_=E.length}else _=0}const D=new x(p,f,v,C);if(!D.isEmpty()){let b;g.isEmpty()?(a.push(Xe.replace(D,y)),b=new ie(D.startLineNumber-c,y.length-_+1,p-c,y.length-_+1)):g.startLineNumber===g.endLineNumber?(a.push(Xe.replace(D,y)),b=new ie(g.startLineNumber-c,g.startColumn,g.endLineNumber-c,g.endColumn)):(a.push(Xe.replace(D,y)),b=new ie(g.startLineNumber-c,g.startColumn,g.startLineNumber-c,y.length-w)),x.intersectRanges(D,i)!==null?d=b:l.push(b)}c+=D.endLineNumber-D.startLineNumber}l.unshift(d),e.pushUndoStop(),e.executeEdits(this.id,a,l),e.pushUndoStop()}},EA=class extends A{constructor(){super({id:"editor.action.transpose",label:L(1333,"Transpose Characters around the Cursor"),precondition:S.writable,canTriggerInlineEdits:!0})}run(n,e){const t=e.getSelections();if(t===null)return;const i=e.getModel();if(i===null)return;const s=[];for(let o=0,r=t.length;o<r;o++){const a=t[o];if(!a.isEmpty())continue;const l=a.getStartPosition(),d=i.getLineMaxColumn(l.lineNumber);if(l.column>=d){if(l.lineNumber===i.getLineCount())continue;const c=new x(l.lineNumber,Math.max(1,l.column-1),l.lineNumber+1,1),h=i.getValueInRange(c).split("").reverse().join("");s.push(new Ll(new ie(l.lineNumber,Math.max(1,l.column-1),l.lineNumber+1,1),h))}else{const c=new x(l.lineNumber,Math.max(1,l.column-1),l.lineNumber,l.column+1),h=i.getValueInRange(c).split("").reverse().join("");s.push(new Uw(c,h,new ie(l.lineNumber,l.column+1,l.lineNumber,l.column+1)))}}e.pushUndoStop(),e.executeCommands(this.id,s),e.pushUndoStop()}},Eo=class extends A{run(n,e){const t=e.getSelections();if(t===null)return;const i=e.getModel();if(i===null)return;const s=e.getOption(148),o=[];for(const r of t)if(r.isEmpty()){const a=r.getStartPosition(),l=e.getConfiguredWordAtPosition(a);if(!l)continue;const d=new x(a.lineNumber,l.startColumn,a.lineNumber,l.endColumn),c=i.getValueInRange(d);o.push(Xe.replace(d,this._modifyText(c,s)))}else{const a=i.getValueInRange(r);o.push(Xe.replace(r,this._modifyText(a,s)))}e.pushUndoStop(),e.executeEdits(this.id,o),e.pushUndoStop()}},RA=class extends Eo{constructor(){super({id:"editor.action.transformToUppercase",label:L(1334,"Transform to Uppercase"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(n,e){return n.toLocaleUpperCase()}},TA=class extends Eo{constructor(){super({id:"editor.action.transformToLowercase",label:L(1335,"Transform to Lowercase"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(n,e){return n.toLocaleLowerCase()}},Ei=class{constructor(n,e){this._pattern=n,this._flags=e,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}},Bb=class RI extends Eo{static{this.titleBoundary=new Ei("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:L(1336,"Transform to Title Case"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){const i=RI.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,s=>s.toLocaleUpperCase()):e}},pu=class kp extends Eo{static{this.caseBoundary=new Ei("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new Ei("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:L(1337,"Transform to Snake Case"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){const i=kp.caseBoundary.get(),s=kp.singleLetters.get();return!i||!s?e:e.replace(i,"$1_$2").replace(s,"$1_$2$3").toLocaleLowerCase()}},fu=class Hd extends Eo{static{this.singleLineWordBoundary=new Ei("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new Ei("[_-]+","gm")}static{this.validWordStart=new Ei("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:L(1338,"Transform to Camel Case"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){const i=/\r\n|\r|\n/.test(e)?Hd.multiLineWordBoundary.get():Hd.singleLineWordBoundary.get(),s=Hd.validWordStart.get();if(!i||!s)return e;const o=e.split(i);return o.shift()?.replace(s,r=>r.toLocaleLowerCase())+o.map(r=>r.substring(0,1).toLocaleUpperCase()+r.substring(1)).join("")}},Ub=class Wd extends Eo{static{this.wordBoundary=new Ei("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new Ei("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new Ei("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:L(1339,"Transform to Pascal Case"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){const i=Wd.wordBoundary.get(),s=Wd.wordBoundaryToMaintain.get(),o=Wd.upperCaseWordMatcher.get();return!i||!s||!o?e:e.split(s).map(r=>r.split(i)).flat().map(r=>{const a=r.charAt(0).toLocaleUpperCase()+r.slice(1);return a.length>1&&o.test(a)?a.charAt(0)+a.slice(1).toLocaleLowerCase():a}).join("")}},zb=class Vd extends Eo{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new Ei("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new Ei("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new Ei("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:L(1340,"Transform to Kebab Case"),precondition:S.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){const i=Vd.caseBoundary.get(),s=Vd.singleLetters.get(),o=Vd.underscoreBoundary.get();return!i||!s||!o?e:e.replace(o,"$1-$3").replace(i,"$1-$2").replace(s,"$1-$2").toLocaleLowerCase()}};P(uA);P(gA);P(pA);P(fA);P(mA);P(_A);P(vA);P(bA);P(SA);P(wA);P(yA);P(xA);P(xI);P(LI);P(IA);P(LA);P(DA);P(EA);P(RA);P(TA);P(CA);pu.caseBoundary.isSupported()&&pu.singleLetters.isSupported()&&P(pu);fu.singleLineWordBoundary.isSupported()&&fu.multiLineWordBoundary.isSupported()&&P(fu);Ub.wordBoundary.isSupported()&&P(Ub);Bb.titleBoundary.isSupported()&&P(Bb);zb.isSupported()&&P(zb);var PA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},jb=function(n,e){return function(t,i){e(t,i,n)}};function kA(n){return n.sourceId+" @@ "+JSON.stringify({...n,modelUri:n.modelUri?.toString(),sourceId:void 0})}var Dc=class extends M{static cast(){return this}constructor(e,t,i){super(),this._key=e,this._contextKeyService=t,this._dataChannelService=i,this._isEnabledContextKeyValue=NA("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(s=>s!==void 0)}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(e),!0):!1}};Dc=PA([jb(1,Ce),jb(2,aw)],Dc);function NA(n,e){return Bt(e.onDidChangeContext,()=>e.getContextKeyValue(n))}var MA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},qb=function(n,e){return function(t,i){e(t,i,n)}},Np=class extends M{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._loggerService=i,this._structuredLogger=this._register(this._instantiationService.createInstance(Dc.cast(),"editor.inlineSuggest.logChangeReason.commandId"));const s=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),o=Bt(this,s.onDidChangeLogLevel,()=>s.getLevel());this._register(ge(r=>{nP(o.read(r),pR.Trace)&&r.store.add(this._editor.onDidChangeModelContent(a=>{this._editor.getModel()?.uri.scheme!=="output"&&s.trace("onDidChangeModelContent: "+a.detailedReasons.map(l=>l.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(ge(r=>{this._editor instanceof Um&&this._structuredLogger.isEnabled.read(r)&&r.store.add(this._editor.onDidChangeModelContent(a=>{const l=this._editor.getModel();if(!l)return;const d=a.detailedReasons[0],c={...d.metadata,sourceId:"TextModel.setChangeReason",source:d.metadata.source,time:Date.now(),modelUri:l.uri,modelVersion:l.getVersionId()};setTimeout(()=>{this._structuredLogger.log(c)},0)}))}))}};Np=MA([qb(1,ne),qb(2,cP)],Np);function $b(n,e=_m){return Z0(n,e)?n.charAt(0).toUpperCase()+n.slice(1):n}var OA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},AA=function(n,e){return function(t,i){e(t,i,n)}},Kb=class{constructor(n){this._delegates=n}resolve(n){for(const e of this._delegates){const t=e.resolve(n);if(t!==void 0)return t}}},Gb=class{constructor(n,e,t,i){this._model=n,this._selection=e,this._selectionIdx=t,this._overtypingCapturer=i}resolve(n){const{name:e}=n;if(e==="SELECTION"||e==="TM_SELECTED_TEXT"){let t=this._model.getValueInRange(this._selection)||void 0,i=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(t=s.value,i=s.multiline)}if(t&&i&&n.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),o=It(s,0,this._selection.startColumn-1);let r=o;n.snippet.walk(l=>l===n?!1:(l instanceof Kt&&(r=It(Fn(l.value).pop())),!0));const a=Or(r,o);t=t.replace(/(\r\n|\r|\n)(.*)/g,(l,d,c)=>`${d}${r.substr(a)}${c}`)}return t}else{if(e==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(e==="TM_CURRENT_WORD"){const t=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return t&&t.word||void 0}else{if(e==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(e==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(e==="CURSOR_INDEX")return String(this._selectionIdx);if(e==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}},Zb=class{constructor(n,e){this._labelService=n,this._model=e}resolve(n){const{name:e}=n;if(e==="TM_FILENAME")return sr(this._model.uri.fsPath);if(e==="TM_FILENAME_BASE"){const t=sr(this._model.uri.fsPath),i=t.lastIndexOf(".");return i<=0?t:t.slice(0,i)}else{if(e==="TM_DIRECTORY")return qh(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(xm(this._model.uri));if(e==="TM_DIRECTORY_BASE")return qh(this._model.uri.fsPath)==="."?"":sr(qh(this._model.uri.fsPath));if(e==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(e==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}},Xb=class{constructor(n,e,t,i){this._readClipboardText=n,this._selectionIdx=e,this._selectionCount=t,this._spread=i}resolve(n){if(n.name!=="CLIPBOARD")return;const e=this._readClipboardText();if(e){if(this._spread){const t=e.split(/\r\n|\n|\r/).filter(i=>!yT(i));if(t.length===this._selectionCount)return t[this._selectionIdx]}return e}}},Ec=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),s=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(s){if(t==="LINE_COMMENT")return s.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return s.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return s.blockCommentEndToken||void 0}}};Ec=OA([AA(2,ct)],Ec);var Yb=class ga{constructor(){this._date=new Date}static{this.dayNames=[m(1476,"Sunday"),m(1477,"Monday"),m(1478,"Tuesday"),m(1479,"Wednesday"),m(1480,"Thursday"),m(1481,"Friday"),m(1482,"Saturday")]}static{this.dayNamesShort=[m(1483,"Sun"),m(1484,"Mon"),m(1485,"Tue"),m(1486,"Wed"),m(1487,"Thu"),m(1488,"Fri"),m(1489,"Sat")]}static{this.monthNames=[m(1490,"January"),m(1491,"February"),m(1492,"March"),m(1493,"April"),m(1494,"May"),m(1495,"June"),m(1496,"July"),m(1497,"August"),m(1498,"September"),m(1499,"October"),m(1500,"November"),m(1501,"December")]}static{this.monthNamesShort=[m(1502,"Jan"),m(1503,"Feb"),m(1504,"Mar"),m(1505,"Apr"),m(1506,"May"),m(1507,"Jun"),m(1508,"Jul"),m(1509,"Aug"),m(1510,"Sep"),m(1511,"Oct"),m(1512,"Nov"),m(1513,"Dec")]}resolve(e){const{name:t}=e;switch(t){case"CURRENT_YEAR":return String(this._date.getFullYear());case"CURRENT_YEAR_SHORT":return String(this._date.getFullYear()).slice(-2);case"CURRENT_MONTH":return String(this._date.getMonth().valueOf()+1).padStart(2,"0");case"CURRENT_DATE":return String(this._date.getDate().valueOf()).padStart(2,"0");case"CURRENT_HOUR":return String(this._date.getHours().valueOf()).padStart(2,"0");case"CURRENT_MINUTE":return String(this._date.getMinutes().valueOf()).padStart(2,"0");case"CURRENT_SECOND":return String(this._date.getSeconds().valueOf()).padStart(2,"0");case"CURRENT_MILLISECOND":return String(this._date.getMilliseconds().valueOf()).padStart(3,"0");case"CURRENT_DAY_NAME":return ga.dayNames[this._date.getDay()];case"CURRENT_DAY_NAME_SHORT":return ga.dayNamesShort[this._date.getDay()];case"CURRENT_MONTH_NAME":return ga.monthNames[this._date.getMonth()];case"CURRENT_MONTH_NAME_SHORT":return ga.monthNamesShort[this._date.getMonth()];case"CURRENT_SECONDS_UNIX":return String(Math.floor(this._date.getTime()/1e3));case"CURRENT_MILLISECONDS_UNIX":return String(this._date.getTime());case"CURRENT_TIMEZONE_OFFSET":{const i=this._date.getTimezoneOffset(),s=i>0?"-":"+",o=Math.trunc(Math.abs(i/60)),r=o<10?"0"+o:o,a=Math.abs(i)-o*60,l=a<10?"0"+a:a;return s+r+":"+l}case"CURRENT_TIMEZONE_NAME":return this._timezoneName??=Intl.DateTimeFormat().resolvedOptions().timeZone}}},Jb=class{constructor(n){this._workspaceService=n}resolve(n){if(!this._workspaceService)return;const e=AR(this._workspaceService.getWorkspace());if(!wT(e)){if(n.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(e);if(n.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(e)}}_resolveWorkspaceName(n){if(Wv(n))return sr(n.uri.path);let e=sr(n.configPath.path);return e.endsWith("code-workspace")&&(e=e.substr(0,e.length-TR.length-1)),e}_resoveWorkspacePath(n){if(Wv(n))return $b(n.uri.fsPath);const e=sr(n.configPath.path);let t=n.configPath.fsPath;return t.endsWith(e)&&(t=t.substr(0,t.length-e.length-1)),t?$b(t):"/"}},Qb=class{resolve(n){const{name:e}=n;if(e==="RANDOM")return Math.random().toString().slice(-6);if(e==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(e==="UUID")return jm()}},FA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},HA=function(n,e){return function(t,i){e(t,i,n)}},Ai,eC=class Qi{static{this._decor={active:oe.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:oe.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:oe.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:oe.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=Ov(t.placeholders,Wi.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const s=this._snippet.offset(i),o=this._snippet.fullLen(i),r=x.fromPositions(e.getPositionAt(this._offset+s),e.getPositionAt(this._offset+s+o)),a=i.isFinalTabstop?Qi._decor.inactiveFinal:Qi._decor.inactive,l=t.addDecoration(r,a);this._placeholderDecorations.set(i,l)}})}move(e){if(!this._editor.hasModel())return[];this._initDecorations();const t=this._editor.getModel();if(this._placeholderGroupsIdx>=0){const o=[];for(const r of this._placeholderGroups[this._placeholderGroupsIdx])if(r.transform){const a=this._placeholderDecorations.get(r),l=a?t.getDecorationRange(a):null;if(l){const d=t.getValueInRange(l),c=r.transform.resolve(d).split(/\r\n|\r|\n/);for(let h=1;h<c.length;h++)c[h]=t.normalizeIndentation(this._snippetLineLeadingWhitespace+c[h]);o.push(Xe.replace(l,c.join(t.getEOL())))}}o.length>0&&this._editor.executeEdits("snippet.placeholderTransform",o)}let i=!1;e===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,i=!0):e===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,i=!0);const s=t.changeDecorations(o=>{const r=new Set,a=[];for(const l of this._placeholderGroups[this._placeholderGroupsIdx]){const d=this._placeholderDecorations.get(l),c=d?t.getDecorationRange(d):null;if(i=i&&this._hasPlaceholderBeenCollapsed(l),!(!d||!c)){a.push(new ie(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),o.changeDecorationOptions(d,l.isFinalTabstop?Qi._decor.activeFinal:Qi._decor.active),r.add(l);for(const h of this._snippet.enclosingPlaceholders(l)){const u=this._placeholderDecorations.get(h);u&&(o.changeDecorationOptions(u,h.isFinalTabstop?Qi._decor.activeFinal:Qi._decor.active),r.add(h))}}}for(const[l,d]of this._placeholderDecorations)r.has(l)||o.changeDecorationOptions(d,l.isFinalTabstop?Qi._decor.inactiveFinal:Qi._decor.inactive);return a});return i?this.move(e):s??[]}_hasPlaceholderBeenCollapsed(e){const t=this._editor.getModel();let i=e;for(;i;){if(i instanceof Wi){const s=this._placeholderDecorations.get(i),o=s?t.getDecorationRange(s):null;if((!o||o.isEmpty())&&i.toString().length>0)return!0}i=i.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const s of t){if(s.isFinalTabstop)break;i||(i=[],e.set(s.index,i));const o=this._placeholderDecorations.get(s),r=this._editor.getModel().getDecorationRange(o);if(!r){e.delete(s.index);break}i.push(r)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof _h,!e)),e}get activePlaceholderCount(){return this._placeholderGroupsIdx<0?0:this._placeholderGroups[this._placeholderGroupsIdx].length}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const s of this._placeholderGroups[this._placeholderGroupsIdx]){const o=e.shift();console.assert(o._offset!==-1),console.assert(!o._placeholderDecorations);const r=o._snippet.placeholderInfo.last.index;for(const l of o._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=s.index+(r+1)/this._nestingLevel:l.index=s.index+l.index/this._nestingLevel;this._snippet.replace(s,o._snippet.children);const a=this._placeholderDecorations.get(s);i.removeDecoration(a),this._placeholderDecorations.delete(s);for(const l of o._snippet.placeholders){const d=o._snippet.offset(l),c=o._snippet.fullLen(l),h=x.fromPositions(t.getPositionAt(o._offset+d),t.getPositionAt(o._offset+d+c)),u=i.addDecoration(h,Qi._decor.inactive);this._placeholderDecorations.set(l,u)}}this._renormalizePlaceholderIndices(),this._placeholderGroups=Ov(this._snippet.placeholders,Wi.compareByIndex)})}_renormalizePlaceholderIndices(){const e=this._snippet.placeholders,t=new Set;for(const o of e)o.isFinalTabstop||t.add(o.index);const i=[...t].sort((o,r)=>o-r),s=new Map;for(let o=0;o<i.length;o++)s.set(i[o],o+1);for(const o of e)o.isFinalTabstop||(o.index=s.get(o.index));this._nestingLevel=1}},tC={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},Rc=Ai=class{static adjustWhitespace(e,t,i,s,o){const r=e.getLineContent(t.lineNumber),a=It(r,0,t.column-1);let l;return s.walk(d=>{if(!(d instanceof Kt)||d.parent instanceof _h||o&&!o.has(d))return!0;const c=d.value.split(/\r\n|\r|\n/);if(i){const u=s.offset(d);if(u===0)c[0]=e.normalizeIndentation(c[0]);else{l=l??s.toString();const g=l.charCodeAt(u-1);(g===10||g===13)&&(c[0]=e.normalizeIndentation(a+c[0]))}for(let g=1;g<c.length;g++)c[g]=e.normalizeIndentation(a+c[g])}const h=c.join(e.getEOL());return h!==d.value&&(d.parent.replace(d,[new Kt(h)]),l=void 0),!0}),a}static adjustSelection(e,t,i,s){if(i!==0||s!==0){const{positionLineNumber:o,positionColumn:r}=t,a=r-i,l=r+s,d=e.validateRange({startLineNumber:o,startColumn:a,endLineNumber:o,endColumn:l});t=ie.createWithDirection(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,s,o,r,a,l,d){const c=[],h=[];if(!e.hasModel())return{edits:c,snippets:h};const u=e.getModel(),g=e.invokeWithinContext(y=>y.get(Cs)),p=e.invokeWithinContext(y=>new Zb(y.get(br),u)),f=()=>a,_=u.getValueInRange(Ai.adjustSelection(u,e.getSelection(),i,0)),v=u.getValueInRange(Ai.adjustSelection(u,e.getSelection(),0,s)),C=u.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),w=e.getSelections().map((y,D)=>({selection:y,idx:D})).sort((y,D)=>x.compareRangesUsingStarts(y.selection,D.selection));for(const{selection:y,idx:D}of w){let b=Ai.adjustSelection(u,y,i,0),I=Ai.adjustSelection(u,y,0,s);_!==u.getValueInRange(b)&&(b=y),v!==u.getValueInRange(I)&&(I=y);const N=y.setStartPosition(b.startLineNumber,b.startColumn).setEndPosition(I.endLineNumber,I.endColumn),T=new ho().parse(t,!0,o),E=N.getStartPosition(),F=Ai.adjustWhitespace(u,E,r||D>0&&C!==u.getLineFirstNonWhitespaceColumn(y.positionLineNumber),T);T.resolveVariables(new Kb([p,new Xb(f,D,w.length,e.getOption(88)==="spread"),new Gb(u,y,D,l),new Ec(u,y,d),new Yb,new Jb(g),new Qb])),c[D]=Xe.replace(N,T.toString()),c[D].identifier={major:D,minor:0},c[D]._isTracked=!0,h[D]=new eC(e,T,F)}return{edits:c,snippets:h}}static createEditsAndSnippetsFromEdits(e,t,i,s,o,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const l=[],d=e.getModel(),c=new ho,h=new Jm,u=e.invokeWithinContext(y=>new Zb(y.get(br),d)),g=new Yb,p=new Jb(e.invokeWithinContext(y=>y.get(Cs))),f=new Qb,_=()=>o,v=e.getOption(88)==="spread",C=t.map((y,D)=>({edit:y,idx:D})).sort((y,D)=>x.compareRangesUsingStarts(y.edit.range,D.edit.range));let w=0;for(let y=0;y<C.length;y++){const{edit:{range:D,template:b,keepWhitespace:I},idx:N}=C[y];if(y>0){const Y=C[y-1].edit.range,ue=x.fromPositions(Y.getEndPosition(),D.getStartPosition()),xe=new Kt(d.getValueInRange(ue));h.appendChild(xe),w+=xe.value.length}const T=new Set;h.walk(Y=>(Y instanceof Ga&&T.add(Y),!0));const E=c.parseFragment(b,h);Ai.adjustWhitespace(d,D.getStartPosition(),I!==void 0?!I:s,h,new Set(E));const F=ie.fromRange(D,0),q=new Kb([u,new Xb(_,N,C.length,v),new Gb(d,F,N,r),new Ec(d,F,a),g,p,f]);h.walk(Y=>(Y instanceof Ga&&!T.has(Y)&&Y.resolve(q),!0));const re=h.toString(),be=re.slice(w);w=re.length;const pe=Xe.replace(D,be);pe.identifier={major:y,minor:0},pe._isTracked=!0,l.push(pe)}return c.ensureFinalTabstop(h,i,!0),{edits:l,snippets:[new eC(e,h,"")]}}constructor(e,t,i=tC,s){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=s,this._templateMerges=[],this._snippets=[]}dispose(){Pt(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(e){if(!this._editor.hasModel())return;const{edits:t,snippets:i}=typeof this._template=="string"?Ai.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Ai.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits(e??oo.snippet(),t,s=>{const o=s.filter(r=>!!r.identifier);for(let r=0;r<i.length;r++)i[r].initialize(o[r].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):o.map(r=>ie.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=tC){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:s}=Ai.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,o=>{const r=o.filter(d=>!!d.identifier);for(let d=0;d<s.length;d++)s[d].initialize(r[d].textChange);const a=s[0].isTrivialSnippet,l=s.length===this._snippets.reduce((d,c)=>d+c.activePlaceholderCount,0);if(!a&&l){for(const d of this._snippets)d.merge(s);console.assert(s.length===0)}return this._snippets[0].hasPlaceholder&&!a&&l?this._move(void 0):r.map(d=>ie.fromPositions(d.range.getEndPosition()))})}next(){const e=this._move(!0);e.length>0&&(this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition()))}prev(){const e=this._move(!1);e.length>0&&(this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition()))}_move(e){const t=[];for(const i of this._snippets){const s=i.move(e);t.push(...s)}return t}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 e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;const t=new Map;for(const i of this._snippets){const s=i.computePossibleSelections();if(t.size===0)for(const[o,r]of s){r.sort(x.compareRangesUsingStarts);for(const a of e)if(r[0].containsRange(a)){t.set(o,[]);break}}if(t.size===0)return!1;t.forEach((o,r)=>{o.push(...s.get(r))})}e.sort(x.compareRangesUsingStarts);for(const[i,s]of t){if(s.length!==e.length){t.delete(i);continue}s.sort(x.compareRangesUsingStarts);for(let o=0;o<s.length;o++)if(!s[o].containsRange(e[o])){t.delete(i);continue}}return t.size>0}};Rc=Ai=FA([HA(3,ct)],Rc);var WA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},nd=function(n,e){return function(t,i){e(t,i,n)}},Zs,iC={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},_t=class{static{Zs=this}static{this.ID="snippetController2"}static get(e){return e.getContribution(Zs.ID)}static{this.InSnippetMode=new ae("inSnippetMode",!1,m(1471,"Whether the editor in current in snippet mode"))}static{this.HasNextTabstop=new ae("hasNextTabstop",!1,m(1472,"Whether there is a next tab stop when in snippet mode"))}static{this.HasPrevTabstop=new ae("hasPrevTabstop",!1,m(1473,"Whether there is a previous tab stop when in snippet mode"))}static{this.InSnippetChoice=new ae("inSnippetChoice",!1,m(1474,"Whether the current snippet tab stop is a choice"))}constructor(e,t,i,s,o){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=o,this._inSnippetObservable=Fe(this,!1),this._snippetListener=new O,this._modelVersionId=-1,this._inSnippet=Zs.InSnippetMode.bindTo(s),this._hasNextTabstop=Zs.HasNextTabstop.bindTo(s),this._hasPrevTabstop=Zs.HasPrevTabstop.bindTo(s),this._inSnippetChoice=Zs.InSnippetChoice.bindTo(s)}dispose(){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._inSnippetChoice.reset(),this._session?.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?iC:{...iC,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(e,t){if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(Ie(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new Rc(this._editor,e,t,this._languageConfigurationService),this._session.insert(t.reason)),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){const i={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(d,c)=>{if(!this._session||d!==this._editor.getModel()||!B.equals(this._editor.getPosition(),c))return;const{activeChoice:h}=this._session;if(!h||h.choice.options.length===0)return;const u=d.getValueInRange(h.range),g=!!h.choice.options.find(f=>f.value===u),p=[];for(let f=0;f<h.choice.options.length;f++){const _=h.choice.options[f];p.push({kind:13,label:_.value,insertText:_.value,sortText:"a".repeat(f+1),range:h.range,filterText:g?`${u}_${_.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:m(1475,"Go to next placeholder...")}})}return{suggestions:p}}},s=this._editor.getModel();let o,r=!1;const a=()=>{o?.dispose(),r=!1},l=()=>{r||(o=this._languageFeaturesService.completionProvider.register({language:s.getLanguageId(),pattern:s.uri.fsPath,scheme:s.uri.scheme,exclusive:!0},i),this._snippetListener.add(o),r=!0)};this._choiceCompletions={provider:i,enable:l,disable:a}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(i=>i.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._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0,this._inSnippetChoice.reset();return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0,this._inSnippetChoice.reset();return}this._inSnippetChoice.set(!0),this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{JO(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._inSnippetChoice.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}get isInSnippetObservable(){return this._inSnippetObservable}};_t=Zs=WA([nd(1,Ot),nd(2,X),nd(3,Ce),nd(4,ct)],_t);de(_t.ID,_t,4);var Th=Ft.bindToContribution(_t.get);Z(new Th({id:"jumpToNextSnippetPlaceholder",precondition:k.and(_t.InSnippetMode,_t.HasNextTabstop),handler:n=>n.next(),kbOpts:{weight:130,kbExpr:S.textInputFocus,primary:2}}));Z(new Th({id:"jumpToPrevSnippetPlaceholder",precondition:k.and(_t.InSnippetMode,_t.HasPrevTabstop),handler:n=>n.prev(),kbOpts:{weight:130,kbExpr:S.textInputFocus,primary:1026}}));ai.registerKeybindingRule({id:"jumpToPrevSnippetPlaceholder",weight:191,when:k.and(_t.InSnippetMode,_t.HasPrevTabstop,_t.InSnippetChoice,S.textInputFocus),primary:1026});Z(new Th({id:"leaveSnippet",precondition:_t.InSnippetMode,handler:n=>n.cancel(!0),kbOpts:{weight:130,kbExpr:S.textInputFocus,primary:9,secondary:[1033]}}));Z(new Th({id:"acceptSnippet",precondition:_t.InSnippetMode,handler:n=>n.finish()}));function Ph(n){return new VA(n)}var VA=class extends tT{constructor(n){super(),this._textModel=n}getOffset(n){return this._textModel.getOffsetAt(n)}getPosition(n){return this._textModel.getPositionAt(n)}},BA=[];function UA(){return BA}function nC(n){return zA(n).map(e=>e.getEndPosition())}function zA(n){const e=fT.createSortPermutation(n,ao(i=>i.range,x.compareRangesUsingStarts)),t=new Ln(e.apply(n)).getNewRanges();return e.inverse().apply(t)}function jA(n,e){const t=Ph(e),i=e.getValue();return n.map(s=>t.getStringReplacement(s)).map(s=>s.removeCommonSuffixPrefix(i)).map(s=>t.getTextReplacement(s))}function qA(n,e){const t=Fe("result",[]),i=[];return e.add(ge(s=>{const o=n.read(s);Vi(r=>{if(o.length!==i.length){i.length=o.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Fe("item",o[a]));t.set([...i],r)}i.forEach((a,l)=>a.set(o[l],r))})})),t}var $A=class{constructor(n){this._contextKeyService=n}bind(n,e){return R0(n,this._contextKeyService,e instanceof Function?e:t=>e.read(t))}};function sC(n,e){return new Promise(t=>{let i;const s=setTimeout(()=>{i&&i.dispose(),t()},n);e&&(i=e.onCancellationRequested(()=>{clearTimeout(s),i&&i.dispose(),t()}))})}var TI=class Mp{static message(e){return new Mp(void 0,e)}constructor(e,t=void 0){this.error=e,this.message=t}static is(e){return e instanceof Mp}logError(){this.message?console.error(`ErrorResult: ${this.message}`,this.error):console.error("ErrorResult: An unexpected error-case occurred, usually caused by invalid input.",this.error)}},KA=class PI{static startNow(e,t,i,s=oC){return new PI(e,t,i,Date.now(),s)}constructor(e,t,i,s,o=oC){this.startValue=e,this.endValue=t,this.durationMs=i,this.startTimeMs=s,this._interpolationFunction=o,e===t&&(this.durationMs=0)}isFinished(e){return e>=this.startTimeMs+this.durationMs}getValue(e){const t=e-this.startTimeMs;return t>=this.durationMs?this.endValue:this._interpolationFunction(t,this.startValue,this.endValue-this.startValue,this.durationMs)}};function oC(n,e,t,i){return n===i?e+t:t*(-Math.pow(2,-10*n/i)+1)+e}function GA(n,e,t,i){return t*((n=n/i-1)*n*n+1)+e}var ZA=class{constructor(n){this._value=n}getValue(n){const e=Date.now();return this._value.isFinished(e)||Op.instance.invalidateOnNextAnimationFrame(n),this._value.getValue(e)}isFinished(n){const e=Date.now(),t=this._value.isFinished(e);return t||Op.instance.invalidateOnNextAnimationFrame(n),t}},Op=class kI{constructor(){this._counter=ns(this),this._isScheduled=!1}static{this.instance=new kI}invalidateOnNextAnimationFrame(e){this._counter.read(e),this._isScheduled||(this._isScheduled=!0,Jd().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}},nl=class{constructor(n,e){this.lineNumber=n,this.parts=e,QE(()=>TS(e,(t,i)=>t.column<=i.column))}equals(n){return this.lineNumber===n.lineNumber&&this.parts.length===n.parts.length&&this.parts.every((e,t)=>e.equals(n.parts[t]))}renderForScreenReader(n){if(this.parts.length===0)return"";const e=this.parts[this.parts.length-1],t=n.substr(0,e.column-1);return new Ln([...this.parts.map(i=>new Be(x.fromPositions(new B(1,i.column)),i.lines.map(s=>s.line).join(`
|
|
34
|
+
`)))]).applyToString(t).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(n=>n.lines.length===0)}get lineCount(){return 1+this.parts.reduce((n,e)=>n+e.lines.length-1,0)}},Tc=class{constructor(n,e,t,i=[]){this.column=n,this.text=e,this.preview=t,this._inlineDecorations=i,this.lines=Fn(this.text).map((s,o)=>({line:s,lineDecorations:mr.filter(this._inlineDecorations,o+1,1,s.length+1)}))}equals(n){return this.column===n.column&&this.lines.length===n.lines.length&&this.lines.every((e,t)=>e.line===n.lines[t].line&&mr.equalsArr(e.lineDecorations,n.lines[t].lineDecorations))}},Ap=class{constructor(n,e,t,i=0){this.lineNumber=n,this.columnRange=e,this.text=t,this.additionalReservedLineCount=i,this.parts=[new Tc(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=Fn(this.text)}renderForScreenReader(n){return this.newLines.join(`
|
|
35
|
+
`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(n=>n.lines.length===0)}equals(n){return this.lineNumber===n.lineNumber&&this.columnRange.equals(n.columnRange)&&this.newLines.length===n.newLines.length&&this.newLines.every((e,t)=>e===n.newLines[t])&&this.additionalReservedLineCount===n.additionalReservedLineCount}};function rC(n,e){return $i(n,e,NI)}function NI(n,e){return n===e?!0:!n||!e?!1:n instanceof nl&&e instanceof nl||n instanceof Ap&&e instanceof Ap?n.equals(e):!1}function ms(n,e,t){const i=t?n.range.intersectRanges(t):n.range;if(!i)return n;const s=n.text.replaceAll(`\r
|
|
36
|
+
`,`
|
|
37
|
+
`),o=e.getValueInRange(i,1),r=Or(o,s),a=rn.ofText(o.substring(0,r)).addToPosition(n.range.getStartPosition()),l=s.substring(r),d=x.fromPositions(a,n.range.getEndPosition());return new Be(d,l)}function MI(n,e){return n.text.startsWith(e.text)&&XA(n.range,e.range)}function XA(n,e){return e.getStartPosition().equals(n.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(n.getEndPosition())}function aC(n,e,t,i,s=0){let o=ms(n,e);if(o.range.endLineNumber!==o.range.startLineNumber)return;const r=e.getLineContent(o.range.startLineNumber),a=It(r).length;if(o.range.startColumn-1<=a){const g=It(o.text).length,p=r.substring(o.range.startColumn-1,a),[f,_]=[o.range.getStartPosition(),o.range.getEndPosition()],v=f.column+p.length<=_.column?f.delta(0,p.length):_,C=x.fromPositions(v,_),w=o.text.startsWith(p)?o.text.substring(p.length):o.text.substring(g);o=new Be(C,w)}const l=e.getValueInRange(o.range),d=YA(l,o.text);if(!d)return;const c=o.range.startLineNumber,h=new Array;if(t==="prefix"){const g=d.filter(p=>p.originalLength===0);if(g.length>1||g.length===1&&g[0].originalStart!==l.length)return}const u=o.text.length-s;for(const g of d){const p=o.range.startColumn+g.originalStart+g.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===o.range.startLineNumber&&p<i.column||g.originalLength>0)return;if(g.modifiedLength===0)continue;const f=g.modifiedStart+g.modifiedLength,_=Math.max(g.modifiedStart,Math.min(f,u)),v=o.text.substring(g.modifiedStart,_),C=o.text.substring(_,Math.max(g.modifiedStart,f));v.length>0&&h.push(new Tc(p,v,!1)),C.length>0&&h.push(new Tc(p,C,!0))}return new nl(c,h)}var sd=void 0;function YA(n,e){if(sd?.originalValue===n&&sd?.newValue===e)return sd?.changes;{let t=dC(n,e,!0);if(t){const i=lC(t);if(i>0){const s=dC(n,e,!1);s&&lC(s)<i&&(t=s)}}return sd={originalValue:n,newValue:e,changes:t},t}}function lC(n){let e=0;for(const t of n)e+=t.originalLength;return e}function dC(n,e,t){if(n.length>5e3||e.length>5e3)return;function i(d){let c=0;for(let h=0,u=d.length;h<u;h++){const g=d.charCodeAt(h);g>c&&(c=g)}return c}const s=Math.max(i(n),i(e));function o(d){if(d<0)throw new Error("unexpected");return s+d+1}function r(d){let c=0,h=0;const u=new Int32Array(d.length);for(let g=0,p=d.length;g<p;g++)if(t&&d[g]==="("){const f=h*100+c;u[g]=o(2*f),c++}else if(t&&d[g]===")"){c=Math.max(c-1,0);const f=h*100+c;u[g]=o(2*f+1),c===0&&h++}else u[g]=d.charCodeAt(g);return u}const a=r(n),l=r(e);return new KS({getElements:()=>a},{getElements:()=>l}).ComputeDiff(!1).changes}function JA(n,e){let t,i=!1;const s=new DE(new u0(n,void 0,e.update),(o,r)=>{i||(t=e.initial instanceof Function?e.initial():e.initial,i=!0);const a=e.update(o,t,r);return t=a,a},e.changeTracker,()=>{i&&(e.disposeFinal?.(t),i=!1)},e.equalityComparer??QR,(o,r,a)=>{if(!i)throw new pt("Can only set when there is a listener! This is to prevent leaks.");rg(r,l=>{t=o,s.setValue(o,l,a)})},ph.ofCaller());return s}var QA=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},cC=function(n,e){return function(t,i){e(t,i,n)}},eF=class{constructor(n,e){this._baseService=n,this._intercept=e}publicLog2(n,e){this._intercept(n,e),this._baseService.publicLog2(n,e)}},Fp=class extends eF{constructor(e,t){super(e,(i,s)=>{let o=!0;s&&Hp in s&&(o=!!s[Hp]),o&&t.getDataChannel("editTelemetry").sendData({eventName:i,data:s??{}})})}};Fp=QA([cC(0,Rs),cC(1,aw)],Fp);var Hp=Symbol("shouldForwardToChannel");function tF(n){return{[Hp]:n}}function hC(n){if(!n)return!1;const e=n.toLowerCase();return e==="github.copilot"||e==="github.copilot-chat"}function iF(n,e){n.publicLog2("inlineCompletion.endOfLife",e)}var nF=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function sF(n){return nF.has(n)}function oF(n){return/[a-zA-Z0-9_]/.test(n)}function rF(n){return n===" "||n===" "}function Pc(n){const e=n.split(/\r\n|\r|\n/);if(e.length>1)return{kind:"multiLine",lineCount:e.length};const t=n.length===1;let i;t&&(sF(n)?i="syntactical":oF(n)?i="identifier":rF(n)&&(i="whitespace"));const s=n.match(/[ \t]+/g)||[],o=s.some(c=>c.length>1),r=s.some(c=>c.includes(" ")||c.includes(" ")),a=n.split(/\s+/).filter(c=>c.length>0),l=a.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(a[0]),d=a.length>1;return{kind:"singleLine",isSingleCharacter:t,singleCharacterKind:i,isWord:l,isMultipleWords:d,isMultipleWhitespace:o,hasDuplicatedWhitespace:r}}var aF=class{constructor(n){this.edits=n}toString(){return JSON.stringify({edits:this.edits})}};function OI(n,e,t){if(n.replacements.length!==0)return new aF(n.replacements.map(i=>lF(i,e)))}function mu(n){return n.length===0?0:n.split(/\r\n|\r|\n/).length-1}function lF(n,e,t){const i=n.replaceRange,s=n.newText,o=i.length,r=s.length,a=mu(s);switch(i.isEmpty?"insert":s.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:dF(i.start,s,e),charactersInserted:r,charactersDeleted:0,linesInserted:a,linesDeleted:0};case"delete":{const l=e.getValue().substring(i.start,i.endExclusive);return{operation:"delete",properties:cF(i.start,i.endExclusive,e),charactersInserted:0,charactersDeleted:o,linesInserted:0,linesDeleted:mu(l)}}case"replace":{const l=e.getValue().substring(i.start,i.endExclusive);return{operation:"replace",properties:hF(l,s),charactersInserted:r,charactersDeleted:o,linesInserted:a,linesDeleted:mu(l)}}}}function dF(n,e,t,i){const s=Pc(e),o=t.getPositionAt(n),r=t.getLineContent(o.lineNumber),a=r.length;let l;const d=r.trim().length===0,c=o.column>a,h=o.column===1;return d?l="emptyLine":c?l="endOfLine":h?l="startOfLine":l="middleOfLine",{textShape:s,locationShape:l,relativeToCursor:void 0}}function cF(n,e,t){const i=Pc(t.getValue().substring(n,e)),s=t.getPositionAt(n),o=t.getPositionAt(e),r=t.getLineContent(o.lineNumber);return{textShape:i,isAtEndOfLine:o.column>r.length,deletesEntireLineContent:s.lineNumber===o.lineNumber&&s.column===1&&o.column>r.length}}function hF(n,e){const t=Pc(n),i=Pc(e),s=t.kind==="singleLine"&&t.isWord,o=i.kind==="singleLine"&&i.isWord;return{isWordToWordReplacement:s&&o,isAdditive:e.length>n.length,isSubtractive:e.length<n.length,isSingleLineToSingleLine:t.kind==="singleLine"&&i.kind==="singleLine",isSingleLineToMultiLine:t.kind==="singleLine"&&i.kind==="multiLine",isMultiLineToSingleLine:t.kind==="multiLine"&&i.kind==="singleLine"}}function AI(n,e,t,i){const s=ms(n,t),o=n.range;if(!o||e&&!e.getStartPosition().equals(o.getStartPosition())||i.lineNumber!==s.range.startLineNumber||s.isEmpty)return!1;const r=t.getValueInRange(s.range,1),a=s.text,l=Math.max(0,i.column-s.range.startColumn);let d=a.substring(0,l),c=a.substring(l),h=r.substring(0,l),u=r.substring(l);const g=t.getLineIndentColumn(s.range.startLineNumber);return s.range.startColumn<=g&&(h=h.trimStart(),h.length===0&&(u=u.trimStart()),d=d.trimStart(),d.length===0&&(c=c.trimStart())),d.startsWith(h)&&!!eR(u,c)}var Wp;(function(n){function e(t){return t?.command.id??void 0}n.toString=e})(Wp||(Wp={}));var kh=class FI extends m0{static snapshot(e){return new FI(e)}constructor(e){super(),this._textModel=e,this._version=e.getVersionId()}get uri(){return this._textModel.uri}_assertValid(){this._textModel.getVersionId()!==this._version&&Le(new Error(`TextModel has changed: expected version ${this._version}, got ${this._textModel.getVersionId()}`))}targets(e){return this._textModel.uri.toString()===e.uri.toString()}getValueOfRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getLineLength(e){return this._assertValid(),this._textModel.getLineLength(e)}get length(){this._assertValid();const e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new rn(e-1,t)}getEOL(){return this._assertValid(),this._textModel.getEOL()}getPositionAt(e){return this._assertValid(),this._textModel.getPositionAt(e)}getValueInRange(e){return this._assertValid(),this._textModel.getValueInRange(e)}getVersionId(){return this._version}dangerouslyGetUnderlyingModel(){return this._textModel}},kc;(function(n){function e(t,i,s=!0){return!t.isInlineEdit&&!t.action?.uri&&t.action?.kind==="edit"?gF.create(t,i,t.action):pF.create(t,i,s)}n.create=e})(kc||(kc={}));function uF(n){const e=n?.kind==="edit"?{...n,alternativeAction:Wp.toString(n.alternativeAction),target:n?.target.uri.toString()}:{...n,target:n?.target.uri.toString()};return JSON.stringify(e)}var HI=class{constructor(n,e,t,i){this._data=n,this.identity=e,this.hint=t,this.originalTextRef=i}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===ti.Explicit}get forwardStable(){return this.source.inlineSuggestions.enableForwardStability??!1}get targetRange(){if(this.hint)return this.hint.range;if(this.action?.kind==="edit")return this.action.textReplacement.range;if(this.action?.kind==="jumpTo")return x.fromPositions(this.action.position);throw new pt("InlineSuggestionItem: Either hint or action must be set")}get semanticId(){return this.hash}get gutterMenuLinkAction(){return this._sourceInlineCompletion.gutterMenuLinkAction}get command(){return this._sourceInlineCompletion.command}get supportsRename(){return this._data.supportsRename}get warning(){return this._sourceInlineCompletion.warning}get showInlineEditMenu(){return!!this._sourceInlineCompletion.showInlineEditMenu}get hash(){return uF(this.action)}get requestUuid(){return this._data.context.requestUuid}get partialAccepts(){return this._data.partialAccepts}get _sourceInlineCompletion(){return this._data.sourceInlineCompletion}addRef(){this.identity.addRef(),this.source.addRef()}removeRef(){this.identity.removeRef(),this.source.removeRef()}reportInlineEditShown(n,e,t,i,s){const o=this.action?.kind==="edit"?this.action.textReplacement.text:"";this._data.reportInlineEditShown(n,o,e,t,this.computeEditKind(i),s)}reportPartialAccept(n,e,t){this._data.reportPartialAccept(n,e,t)}reportEndOfLife(n){this._data.reportEndOfLife(n)}setEndOfLifeReason(n){this._data.setEndOfLifeReason(n)}setIsPreceeded(n){this._data.setIsPreceeded(n.partialAccepts)}setNotShownReasonIfNotSet(n){this._data.setNotShownReason(n)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(n){this._data.setRenameProcessingInfo(n)}withAction(n){return this._data.withAction(n)}addPerformanceMarker(n){this._data.addPerformanceMarker(n)}},WI=class VI{constructor(){this._onDispose=ns(this),this.onDispose=this._onDispose,this._jumpedTo=Fe(this,!1),this._refCount=0,this.id="InlineCompletionIdentity"+VI.idCounter++}static{this.idCounter=0}get jumpedTo(){return this._jumpedTo}addRef(){this._refCount++}removeRef(){this._refCount--,this._refCount===0&&this._onDispose.trigger(void 0)}setJumpTo(e){this._jumpedTo.set(!0,e)}},BI=class Vp{static create(e){return new Vp(x.lift(e.range),e.content,e.style)}constructor(e,t,i){this.range=e,this.content=t,this.style=i}withEdit(e,t){const i=new Ke(t.getOffset(this.range.getStartPosition()),t.getOffset(this.range.getEndPosition())),s=iw([i],e)[0];if(!s)return;const o=t.getRange(s);return new Vp(o,this.content,this.style)}},gF=class Bd extends HI{static create(e,t,i){const s=new WI,o=t.getTransformer(),r=i.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),a=vF(new si(o.getOffsetRange(i.range),r),t),l=a.removeCommonSuffixAndPrefix(t.getValue()),d=o.getTextReplacement(a),c=e.hint?BI.create(e.hint):void 0;return new Bd(a,l,d,d.range,i.snippetInfo,e.additionalTextEdits,e,s,c,t)}constructor(e,t,i,s,o,r,a,l,d,c){super(a,l,d,c),this._edit=e,this._trimmedEdit=t,this._textEdit=i,this._originalRange=s,this.snippetInfo=o,this.additionalTextEdits=r,this.isInlineEdit=!1}get action(){return{kind:"edit",textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new Mn([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new Bd(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,e,this.hint,this.originalTextRef)}withEdit(e,t){if(!this.originalTextRef.targets(t))return this;const i=iw([this._edit.replaceRange],e);if(i.length===0)return;const s=new si(i[0],this._textEdit.text),o=Ph(t),r=o.getTextReplacement(s);let a=this.hint;if(a&&(a=a.withEdit(e,o),!a))return;const l=s.removeCommonSuffixAndPrefix(t.getValue());return new Bd(s,l,r,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,a,this.originalTextRef)}canBeReused(e,t){const i=this._textEdit.range;return!!i&&i.containsPosition(t)&&this.isVisible(e,t)&&rn.ofRange(i).isGreaterThanOrEqualTo(rn.ofRange(this._originalRange))}isVisible(e,t){const i=this.getSingleTextEdit();return AI(i,this._originalRange,e,t)}computeEditKind(e){return OI(new Mn([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}},pF=class Ud extends HI{static create(e,t,i=!0){let s,o=[];if(e.action?.kind==="edit"){const l=i?fF(t,e.action.range,e.action.insertText):mF(t,e.action.range,e.action.insertText),d=Ln.fromStringEdit(l,t),c=l.isEmpty()?new Be(new x(1,1,1,1),""):d.toReplacement(t);o=l.replacements.map(h=>{const u=x.fromPositions(t.getPositionAt(h.replaceRange.start),t.getTransformer().getPosition(h.replaceRange.endExclusive)),g=t.getValueInRange(u);return _F.create(h,g)}),s={kind:"edit",snippetInfo:e.action.snippetInfo,stringEdit:l,textReplacement:c,alternativeAction:e.action.alternativeAction,target:t}}else if(e.action?.kind==="jumpTo")s={kind:"jumpTo",position:e.action.position,offset:t.getTransformer().getOffset(e.action.position),target:t};else if(s=void 0,!e.hint)throw new pt("InlineEditItem: action is undefined and no hint is provided");const r=new WI,a=e.hint?BI.create(e.hint):void 0;return new Ud(s,e,r,o,a,!1,t.getVersionId(),t)}constructor(e,t,i,s,o,r=!1,a,l){super(t,i,o,l),this._action=e,this._edits=s,this._lastChangePartOfInlineEdit=r,this._inlineEditModelVersion=a,this.snippetInfo=void 0,this.additionalTextEdits=[],this.isInlineEdit=!0}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(e){return new Ud(this._action,this._data,e,this._edits,this.hint,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion,this.originalTextRef)}canBeReused(e,t){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===e.getVersionId()}withEdit(e,t){return this.originalTextRef.targets(t)?this._applyTextModelChanges(e,this._edits,t):this}_applyTextModelChanges(e,t,i){const s=Ph(i);let o=!1,r=this._inlineEditModelVersion,a;const l=kh.snapshot(i);if(this.action?.kind==="edit"){if(t=t.map(u=>u.applyTextModelChanges(e)),t.some(u=>u.edit===void 0))return;const c=i.getVersionId();if(o=t.some(u=>u.lastChangeUpdatedEdit),o&&(r=c??-1),c===null||r+20<c||(t=t.filter(u=>!u.edit.isEmpty),t.length===0))return;const h=new Mn(t.map(u=>u.edit));a={kind:"edit",textReplacement:s.getTextEdit(h).toReplacement(new wm(i)),snippetInfo:this.snippetInfo,stringEdit:h,alternativeAction:this.action.alternativeAction,target:l}}else if(this.action?.kind==="jumpTo"){const c=this.action.offset,h=e.applyToOffsetOrUndefined(c);if(h===void 0)return;a={kind:"jumpTo",position:s.getPosition(h),offset:h,target:l}}else a=void 0;let d=this.hint;if(!(d&&(d=d.withEdit(e,s),!d)))return new Ud(a,this._data,this.identity,t,d,o,r,l)}computeEditKind(e){const t=this.action?.kind==="edit"?this.action.stringEdit:void 0;if(t)return OI(t,e)}};function fF(n,e,t){const i=n.getEOL(),s=n.getValueOfRange(e),o=t.replace(/\r\n|\r|\n/g,i),r=lP.getDefault().computeDiff(Fn(s),Fn(o),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(d=>d.innerChanges??[]);function a(d,c){const h=rn.fromPosition(c.getStartPosition());return rn.ofRange(c).createRange(h.addToPosition(d))}const l=new Cd(o);return new Mn(r.map(d=>{const c=a(e.getStartPosition(),d.originalRange),h=n.getTransformer().getOffsetRange(c),u=l.getValueOfRange(d.modifiedRange);return bF(new si(h,u),n.getValueOfRange(c),r.length,n)}))}function mF(n,e,t){return new Mn([new si(n.getTransformer().getOffsetRange(e),t)])}var _F=class Bp{static create(e,t){const i=Or(e.newText,t),s=Vm(e.newText,t),o=e.newText.substring(i,e.newText.length-s);return new Bp(e,o,i,s)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}constructor(e,t,i,s,o=!1){this._edit=e,this._trimmedNewText=t,this._prefixLength=i,this._suffixLength=s,this._lastChangeUpdatedEdit=o}applyTextModelChanges(e){const t=this._clone();return t._applyTextModelChanges(e),t}_clone(){return new Bp(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(e){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new pt("UpdatedInnerEdits: No edit to apply changes to");const t=this._applyChanges(this._edit,e);if(!t){this._edit=void 0;return}this._edit=t.edit,this._lastChangeUpdatedEdit=t.editHasChanged}_applyChanges(e,t){let i=e.replaceRange.start,s=e.replaceRange.endExclusive,o=e.newText,r=!1;const a=this._prefixLength>0||this._suffixLength>0;for(let l=t.replacements.length-1;l>=0;l--){const d=t.replacements[l],c=d.newText.length>0&&d.replaceRange.isEmpty;if(c&&!a&&d.replaceRange.start===i&&o.startsWith(d.newText)){i+=d.newText.length,o=o.substring(d.newText.length),s+=d.newText.length,r=!0;continue}if(c&&a&&d.replaceRange.start===i+this._prefixLength&&this._trimmedNewText.startsWith(d.newText)){s+=d.newText.length,r=!0,this._prefixLength+=d.newText.length,this._trimmedNewText=this._trimmedNewText.substring(d.newText.length);continue}if(d.newText.length===0&&d.replaceRange.length>0&&d.replaceRange.start>=i+this._prefixLength&&d.replaceRange.endExclusive<=s-this._suffixLength){s-=d.replaceRange.length,r=!0;continue}if(d.equals(e)){r=!0,i=d.replaceRange.endExclusive,o="";continue}if(!(d.replaceRange.start>s)){if(d.replaceRange.endExclusive<i){i+=d.newText.length-d.replaceRange.length,s+=d.newText.length-d.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&i+this._prefixLength===s-this._suffixLength?{edit:new si(new Ke(i+this._prefixLength,i+this._prefixLength),""),editHasChanged:!0}:{edit:new si(new Ke(i,s),o),editHasChanged:r}}};function vF(n,e){const t=e.getEOL();return n.replaceRange.isEmpty&&n.newText.includes(t)&&(n=UI(n,e)),n}function bF(n,e,t,i){const s=i.getEOL();if(n.newText.endsWith(s)&&e.endsWith(s)&&(n=new si(n.replaceRange.deltaEnd(-s.length),n.newText.slice(0,-s.length))),t===1&&n.replaceRange.isEmpty&&n.newText.includes(s)){const o=i.getTransformer().getPosition(n.replaceRange.start);i.getLineLength(o.lineNumber)!==0&&(n=UI(n,i))}if(t===1){const o=Or(e,n.newText),r=Vm(e.slice(o),n.newText.slice(o));if(o+r===e.length)return new si(n.replaceRange.deltaStart(o).deltaEnd(-r),n.newText.substring(o,n.newText.length-r));if(o+r===n.newText.length)return new si(n.replaceRange.deltaStart(o).deltaEnd(-r),"")}return n}function UI(n,e){if(!n.replaceRange.isEmpty)throw new pt("Unexpected original range");if(n.replaceRange.start===0)return n;const t=e.getEOL(),i=e.getTransformer().getPosition(n.replaceRange.start),s=i.column,o=i.lineNumber;return s===1&&o>1&&n.newText.endsWith(t)&&!n.newText.startsWith(t)?new si(n.replaceRange.delta(-1),t+n.newText.slice(0,-t.length)):n}function CF(n,e){const t=new iP,i=new dP(t,d=>e.getLanguageConfiguration(d)),s=new gR(new SF([n]),i),o=qT(s,[],void 0,!0);let r="";const a=n.getLineContent();function l(d,c){if(d.kind===2)if(l(d.openingBracket,c),c=zr(c,d.openingBracket.length),d.child&&(l(d.child,c),c=zr(c,d.child.length)),d.closingBracket)l(d.closingBracket,c),c=zr(c,d.closingBracket.length);else{const h=i.getSingleLanguageBracketTokens(d.openingBracket.languageId).findClosingTokenText(d.openingBracket.bracketIds);r+=h}else if(d.kind!==3){if(d.kind===0||d.kind===1)r+=a.substring(av(c),av(zr(c,d.length)));else if(d.kind===4)for(const h of d.children)l(h,c),c=zr(c,h.length)}}return l(o,0),r}var SF=class{constructor(n){this.lines=n,this.tokenization={getLineTokens:e=>this.lines[e-1]}}getLineCount(){return this.lines.length}getLineLength(n){return this.lines[n-1].getLineContent().length}},Qe;(function(n){n.Jump="jump",n.Accept="accept",n.Inactive="inactive"})(Qe||(Qe={}));var Wr=class zI{static create(e,t=!1){return new zI(new Cm(Nt(e),e),t)}constructor(e,t=!1){this.event=e,this.alternativeAction=t}},le;(function(n){n.GhostText="ghostText",n.Custom="custom",n.SideBySide="sideBySide",n.Deletion="deletion",n.InsertionInline="insertionInline",n.InsertionMultiLine="insertionMultiLine",n.WordReplacements="wordReplacements",n.LineReplacement="lineReplacement",n.Collapsed="collapsed",n.JumpTo="jumpTo"})(le||(le={}));var N_=class{constructor(n,e,t,i,s,o,r,a){this.cursorColumnDistance=n,this.cursorLineDistance=e,this.lineCountOriginal=t,this.lineCountModified=i,this.characterCountOriginal=s,this.characterCountModified=o,this.disjointReplacements=r,this.sameShapeReplacements=a,this.longDistanceHintVisible=void 0,this.longDistanceHintDistance=void 0,this.isForAnotherDocument=void 0}setLongDistanceViewData(n,e){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(e-n)}getData(){return{cursorColumnDistance:this.cursorColumnDistance,cursorLineDistance:this.cursorLineDistance,lineCountOriginal:this.lineCountOriginal,lineCountModified:this.lineCountModified,characterCountOriginal:this.characterCountOriginal,characterCountModified:this.characterCountModified,disjointReplacements:this.disjointReplacements,sameShapeReplacements:this.sameShapeReplacements,longDistanceHintVisible:this.longDistanceHintVisible,longDistanceHintDistance:this.longDistanceHintDistance,isForAnotherDocument:this.isForAnotherDocument}}},wF=class jI{constructor(){this._nodes=new Set,this._outgoingEdges=new Map}static from(e,t){const i=new jI;for(const s of e)i._nodes.add(s);for(const s of e){const o=t(s);if(o.length>0){const r=new Set;for(const a of o)r.add(a);i._outgoingEdges.set(s,r)}}return i}removeCycles(){const e=[],t=new Set,i=new Set,s=[],o=r=>{t.add(r),i.add(r);const a=this._outgoingEdges.get(r);if(a)for(const l of a)t.has(l)?i.has(l)&&(e.push(l),s.push({from:r,to:l})):o(l);i.delete(r)};for(const r of this._nodes)t.has(r)||o(r);for(const{from:r,to:a}of s){const l=this._outgoingEdges.get(r);l&&l.delete(a)}return{foundCycles:e}}getOutgoing(e){const t=this._outgoingEdges.get(e);return t?Array.from(t):[]}};function yF(n,e,t,i,s,o){const r=PE("icr"),a=new ot;let l;const d={...i,requestUuid:r},c=EF(e,t),h=_0(n,_=>_.groupId),u=wF.from(n,_=>_.yieldsToGroupIds?.flatMap(v=>h.get(v)??[])??[]),{foundCycles:g}=u.removeCycles();g.length>0&&it(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${g.map(_=>_.toString?_.toString():""+_).join(" -> ")}`));let p=0;const f=new EE(async _=>{try{if(p++,a.token.isCancellationRequested)return;const v=u.getOutgoing(_);for(const I of v){const N=await f.get(I);if(N)for(const T of N.inlineSuggestions.items){if(T.isInlineEdit||typeof T.insertText!="string"&&T.insertText!==void 0)return;if(T.insertText!==void 0){const E=new Be(x.lift(T.range)??c,T.insertText);if(AI(E,void 0,t,e))return}}}let C;const w=Date.now();try{C=await _.provideInlineCompletions(t,e,d,a.token)}catch(I){it(I);return}const y=Date.now();if(!C)return;const D=[],b=new DF(C,D,_);if(b.addRef(),qI(a.token,()=>b.removeRef(l)),a.token.isCancellationRequested)return;for(const I of C.items){const N=xF(I,b,c,t,o,d,s,{startTime:w,endTime:y});if(TI.is(N)){N.logError();continue}D.push(N)}return b}finally{p--}});return{contextWithUuid:d,get didAllProvidersReturn(){return p===0},lists:dn.fromPromisesResolveOrder(n.map(_=>f.get(_))).filter(Tn),cancelAndDispose:_=>{l===void 0&&(l=_,a.dispose(!0))}}}function qI(n,e){if(n.isCancellationRequested)return e(),M.None;{const t=n.onCancellationRequested(()=>{t.dispose(),e()});return{dispose:()=>t.dispose()}}}function xF(n,e,t,i,s,o,r,a){let l;const d=n.uri?ke.revive(n.uri):void 0;if(n.jumpToPosition!==void 0)l={kind:"jumpTo",position:B.lift(n.jumpToPosition),uri:d};else if(n.insertText!==void 0){let c,h,u=n.range?x.lift(n.range):t;if(typeof n.insertText=="string"){if(c=n.insertText,s&&n.completeBracketPairs){c=uC(c,u.getStartPosition(),i,s);const g=c.length-n.insertText.length;g!==0&&(u=new x(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn+g))}h=void 0}else if("snippet"in n.insertText){const g=n.insertText.snippet.length;if(s&&n.completeBracketPairs){n.insertText.snippet=uC(n.insertText.snippet,u.getStartPosition(),i,s);const f=n.insertText.snippet.length-g;f!==0&&(u=new x(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn+f))}const p=new ho().parse(n.insertText.snippet);p.children.length===1&&p.children[0]instanceof Kt?(c=p.children[0].value,h=void 0):(c=p.toString(),h={snippet:n.insertText.snippet,range:u})}else bm(n.insertText);l={kind:"edit",range:u,insertText:c,snippetInfo:h,uri:d,alternativeAction:void 0}}else if(l=void 0,!n.hint)return TI.message("Inline completion has no insertText, jumpToPosition nor hint.");return new IF(l,n.hint,n.additionalTextEdits||UA(),n,e,o,n.isInlineEdit??!1,n.supportsRename??!1,r,a,n.correlationId)}var IF=class{get action(){return this._action}constructor(n,e,t,i,s,o,r,a,l,d,c){this._action=n,this.hint=e,this.additionalTextEdits=t,this.sourceInlineCompletion=i,this.source=s,this.context=o,this.isInlineEdit=r,this.supportsRename=a,this._requestInfo=l,this._providerRequestInfo=d,this._correlationId=c,this._didShow=!1,this._timeUntilShown=void 0,this._timeUntilActuallyShown=void 0,this._showStartTime=void 0,this._shownDuration=0,this._showUncollapsedStartTime=void 0,this._showUncollapsedDuration=0,this._notShownReason=void 0,this._didReportEndOfLife=!1,this._lastSetEndOfLifeReason=void 0,this._isPreceeded=!1,this._partiallyAcceptedCount=0,this._partiallyAcceptedSinceOriginal={characters:0,ratio:0,count:0},this._renameInfo=void 0,this._editKind=void 0,this.performance=new LF,this._viewData={editorType:l.editorType}}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(n,e,t,i,s,o){if(this.updateShownDuration(t),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker("shown"),this._didShow=!0,this._editKind=s,this._viewData.viewKind=t,this._viewData.renderData=i,this._timeUntilShown=o-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;const r=new ZT(i.lineCountModified,i.lineCountOriginal,i.characterCountModified,i.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,r),this.sourceInlineCompletion.shownCommand&&await n.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(n,e,t){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=t.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*t.ratio,1),this._partiallyAcceptedSinceOriginal.count+=t.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,n,e)}reportEndOfLife(n){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),n||(n=this._lastSetEndOfLifeReason??{kind:rs.Ignored,userTypingDisagreed:!1,supersededBy:void 0}),n.kind===rs.Rejected&&!this._didShow&&(n={kind:rs.Ignored,userTypingDisagreed:!1,supersededBy:void 0}),n.kind===rs.Rejected&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){const e={requestUuid:this.context.requestUuid,correlationId:this._correlationId,selectedSuggestionInfo:!!this.context.selectedSuggestionInfo,partiallyAccepted:this._partiallyAcceptedCount,partiallyAcceptedCountSinceOriginal:this._partiallyAcceptedSinceOriginal.count,partiallyAcceptedRatioSinceOriginal:this._partiallyAcceptedSinceOriginal.ratio,partiallyAcceptedCharactersSinceOriginal:this._partiallyAcceptedSinceOriginal.characters,shown:this._didShow,shownDuration:this._shownDuration,shownDurationUncollapsed:this._showUncollapsedDuration,editKind:this._editKind?.toString(),preceeded:this._isPreceeded,timeUntilShown:this._timeUntilShown,timeUntilActuallyShown:this._timeUntilActuallyShown,timeUntilProviderRequest:this._providerRequestInfo.startTime-this._requestInfo.startTime,timeUntilProviderResponse:this._providerRequestInfo.endTime-this._requestInfo.startTime,editorType:this._viewData.editorType,languageId:this._requestInfo.languageId,requestReason:this._requestInfo.reason,viewKind:this._viewData.viewKind,notShownReason:this._notShownReason,performanceMarkers:this.performance.toString(),renameCreated:this._renameInfo?.createdRename,renameDuration:this._renameInfo?.duration,renameTimedOut:this._renameInfo?.timedOut,renameDroppedOtherEdits:this._renameInfo?.droppedOtherEdits,renameDroppedRenameEdits:this._renameInfo?.droppedRenameEdits,typingInterval:this._requestInfo.typingInterval,typingIntervalCharacterCount:this._requestInfo.typingIntervalCharacterCount,skuPlan:this._requestInfo.sku?.plan,skuType:this._requestInfo.sku?.type,availableProviders:this._requestInfo.availableProviders.map(t=>t.toString()).join(","),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,n,e)}}setIsPreceeded(n){this._isPreceeded=!0,(this._partiallyAcceptedSinceOriginal.characters!==0||this._partiallyAcceptedSinceOriginal.ratio!==0||this._partiallyAcceptedSinceOriginal.count!==0)&&console.warn("Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded."),this._partiallyAcceptedSinceOriginal=n}setNotShownReason(n){this._notShownReason??=n}setEndOfLifeReason(n){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=n}updateShownDuration(n){const e=Date.now();this._showStartTime||(this._showStartTime=e);const t=n===le.Collapsed;!t&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=e),t&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;const n=Date.now();this._shownDuration+=n-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=n-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}setRenameProcessingInfo(n){if(this._renameInfo)throw new pt("Rename info has already been set.");this._renameInfo=n}withAction(n){return this._action=n,this}addPerformanceMarker(n){this.performance.mark(n)}},LF=class{constructor(){this.markers=[],this.markers.push({name:"start",timeStamp:Date.now()})}mark(n){this.markers.push({name:n,timeStamp:Date.now()})}toString(){const n=[];for(let e=1;e<this.markers.length;e++){const t=this.markers[e].timeStamp-this.markers[e-1].timeStamp;n.push({[this.markers[e].name]:t})}return JSON.stringify(n)}},gt;(function(n){n.TextEditor="textEditor",n.DiffEditor="diffEditor",n.Notebook="notebook"})(gt||(gt={}));var DF=class{constructor(n,e,t){this.inlineSuggestions=n,this.inlineSuggestionsData=e,this.provider=t,this.refCount=0}addRef(){this.refCount++}removeRef(n={kind:"other"}){if(this.refCount--,this.refCount===0){for(const e of this.inlineSuggestionsData)e.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,n)}else this.refCount<0&&Le(new pt(`InlineSuggestionList (provider=${this.provider.providerId?.toString()}) refCount went negative (${this.refCount}) — more removeRef than addRef calls.`))}};function EF(n,e){const t=e.getWordAtPosition(n),i=e.getLineMaxColumn(n.lineNumber);return t?new x(n.lineNumber,t.startColumn,n.lineNumber,i):x.fromPositions(n,n.with(void 0,i))}function uC(n,e,t,i){const s=t.getLineContent(e.lineNumber),o=si.replace(new Ke(e.column-1,s.length),n),r=t.tokenization.tokenizeLinesAt(e.lineNumber,[o.replace(s)])?.[0].sliceZeroCopy(o.getRangeAfterReplace());return r?CF(r,i):n}var RF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},od=function(n,e){return function(t,i){e(t,i,n)}},Vr=new ae("renameInputVisible",!1,m(1460,"Whether the rename input widget is visible"));new ae("renameInputFocused",!1,m(1461,"Whether the rename input widget is focused"));var Up=class{constructor(e,t,i,s,o,r){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=s,this._logService=r,this.allowEditorOverflow=!0,this._disposables=new O,this._visibleContextKey=Vr.bindTo(o),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new pi,this._inputWithButton=new PF,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(59)&&this._updateFont()})),this._disposables.add(i.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._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new TF(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),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(e){if(!this._domNode)return;const t=e.getColor(Q0),i=e.getColor(K0);this._domNode.style.backgroundColor=String(e.getColor(vm)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(O0)??"");const s=e.getColor(LT);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(pv)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(pv)??""),this._inputWithButton.domNode.style.borderWidth=s?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=s?"solid":"none",this._inputWithButton.domNode.style.borderColor=s?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;Ie(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=ml(this.getDomNode().ownerDocument.body),t=Mt(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const s=this._editor.getOption(75),{totalHeight:o}=zp.getLayoutInfo({lineHeight:s}),r=this._nPxAvailableBelow>o*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){const[e,t]=this._acceptKeybindings;return this._label.innerText=m(1462,"{0} to Rename, {1} to Preview",this._keybindingService.lookupKeybinding(e)?.getLabel(),this._keybindingService.lookupKeybinding(t)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;Ie(this._renameCandidateListView),Ie(this._nPxAvailableAbove!==void 0),Ie(this._nPxAvailableBelow!==void 0);const t=Zo(this._inputWithButton.domNode),i=Zo(this._label);let s;e===2?s=this._nPxAvailableBelow:s=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:s-i-t,width:Si(this._inputWithButton.domNode)})}acceptInput(e){this._trace("invoking acceptInput"),this._currentAcceptInput?.(e)}cancelInput(e,t){this._currentCancelInput?.(e)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,s,o){const{start:r,end:a}=this._getSelection(e,t);this._renameCts=o;const l=new O;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,s===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=s,this._requestRenameCandidates(t,!1),l.add(Q(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),l.add(Q(this._inputWithButton.button,we.KEY_DOWN,c=>{const h=new Oa(c);(h.equals(3)||h.equals(10))&&(h.stopPropagation(),h.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new B(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(Te(()=>{this._renameCts=void 0,o.dispose(!0)})),l.add(Te(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(Te(()=>this._candidates.clear()));const d=new cm;return d.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=c=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),d.complete(c),!0),this._currentAcceptInput=c=>{this._trace("invoking _currentAcceptInput"),Ie(this._renameCandidateListView!==void 0);const h=this._renameCandidateListView.nCandidates;let u,g;const p=this._renameCandidateListView.focusedCandidate;if(p!==void 0?(this._trace("using new name from renameSuggestion"),u=p,g={k:"renameSuggestion"}):(this._trace("using new name from inputField"),u=this._inputWithButton.input.value,g=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),u===t||u.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),d.complete({newName:u,wantsPreview:i&&c,stats:{source:g,nRenameSuggestions:h,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(o.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),d.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Ie(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new ot;const i=t?Qu.Invoke:Qu.Automatic,s=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(s.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(s,e,this._renameCts.token)}}_getSelection(e,t){Ie(this._editor.hasModel());const i=this._editor.getSelection();let s=0,o=t.length;return!x.isEmpty(i)&&!x.spansMultipleLines(i)&&x.containsRange(e,i)&&(s=Math.max(0,i.startColumn-e.startColumn),o=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:s,end:o}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const s=(...d)=>this._trace("_updateRenameCandidates",...d);s("start");const o=await gr(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),o===void 0){s("returning early - received updateRenameCandidates results - undefined");return}const r=o.flatMap(d=>d.status==="fulfilled"&&Tn(d.value)?d.value:[]);s(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=dT(r,d=>d.newSymbolName);s(`distinct candidates - ${a.length} candidates.`);const l=a.filter(({newSymbolName:d})=>d.trim().length>0&&d!==this._inputWithButton.input.value&&d!==t&&!this._candidates.has(d));if(s(`valid distinct candidates - ${r.length} candidates.`),l.forEach(d=>this._candidates.add(d.newSymbolName)),l.length<1){s("returning early - no valid distinct candidates");return}s("setting candidates"),this._renameCandidateListView.setCandidates(l),s("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};Up=RF([od(2,Dt),od(3,He),od(4,Ce),od(5,Ot)],Up);var TF=class $I{constructor(e,t){this._disposables=new O,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=$I._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(kS({listInactiveFocusForeground:hg,listInactiveFocusBackground:tg}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,Ss(m(1463,"Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=zp.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(i=>i.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const s=new class{getTemplateId(r){return"candidate"}getHeight(r){return t}},o=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new zp(r,i)}renderElement(r,a,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new Om("NewSymbolNameCandidates",e,s,[o],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},PF=class{constructor(){this._buttonHoverContent="",this._disposables=new O,this._onDidInputChange=this._disposables.add(new ee),this.onDidInputChange=this._onDidInputChange.event}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",m(1464,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=m(1465,"Generate New Name Suggestions"),this._buttonCancelHoverText=m(1466,"Cancel"),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(Cw().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(Q(this.input,we.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(Q(this.input,we.KEY_DOWN,n=>{const e=new Oa(n);(e.keyCode===15||e.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(Q(this.input,we.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(Q(this.input,we.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(Q(this.input,we.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return Ie(this._inputNode),this._inputNode}get button(){return Ie(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=an(V.sparkle),ni(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHoverContent=this._buttonGenHoverText,this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=an(V.stopCircle),ni(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHoverContent=this._buttonCancelHoverText,this.input.focus()}dispose(){this._disposables.dispose()}},zp=class jp{static{this._PADDING=2}constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${jp._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=an(V.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),fw(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){const t=!!e.tags?.includes(_E.AIGenerated);this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+jp._PADDING*2}}dispose(){}},kF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Vs=function(n,e){return function(t,i){e(t,i,n)}},qp,Nh=class{constructor(n,e,t){this.model=n,this.position=e,this._providerRenameIdx=0,this._providers=t.ordered(n)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(n){const e=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const i=this._providers[this._providerRenameIdx];if(!i.resolveRenameLocation)break;const s=await i.resolveRenameLocation(this.model,this.position,n);if(s){if(s.rejectReason){e.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const t=this.model.getWordAtPosition(this.position);return t?{range:new x(this.position.lineNumber,t.startColumn,this.position.lineNumber,t.endColumn),text:t.word,rejectReason:e.length>0?e.join(`
|
|
38
|
+
`):void 0}:{range:x.fromPositions(this.position),text:"",rejectReason:e.length>0?e.join(`
|
|
39
|
+
`):void 0}}async provideRenameEdits(n,e){return this._provideRenameEdits(n,this._providerRenameIdx,[],e)}async _provideRenameEdits(n,e,t,i){const s=this._providers[e];if(!s)return{edits:[],rejectReason:t.join(`
|
|
40
|
+
`)};const o=await s.provideRenameEdits(this.model,this.position,n,i);if(o){if(o.rejectReason)return this._provideRenameEdits(n,e+1,t.concat(o.rejectReason),i)}else return this._provideRenameEdits(n,e+1,t.concat(m(1449,"No result.")),i);return o}};function NF(n,e){return n.ordered(e).length>0}async function MF(n,e,t,i,s){return new Nh(e,t,n).provideRenameEdits(i,s??he.None)}async function OF(n,e,t,i){const s=new Nh(e,t,n),o=await s.resolveRenameLocation(he.None);return o?.rejectReason?{edits:[],rejectReason:o.rejectReason}:s.provideRenameEdits(i,he.None)}var xs=class{static{qp=this}static{this.ID="editor.contrib.renameController"}static get(e){return e.getContribution(qp.ID)}constructor(e,t,i,s,o,r,a,l){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=s,this._progressService=o,this._logService=r,this._configService=a,this._languageFeaturesService=l,this._disposableStore=new O,this._cts=new ot,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(Up,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new ot,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new Nh(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const s=new lo(this.editor,5,void 0,this._cts.token);let o;try{e("resolving rename location");const p=i.resolveRenameLocation(s.token);this._progressService.showWhile(p,250),o=await p,e("resolved rename location")}catch(p){p instanceof Bm?e("resolve rename location cancelled",JSON.stringify(p,null," ")):(e("resolve rename location failed",p instanceof Error?p:JSON.stringify(p,null," ")),(typeof p=="string"||ec(p))&&Zt.get(this.editor)?.showMessage(p||m(1450,"An unknown error occurred while resolving rename location"),t));return}finally{s.dispose()}if(!o){e("returning early - no loc");return}if(o.rejectReason){e(`returning early - rejected with reason: ${o.rejectReason}`,o.rejectReason),Zt.get(this.editor)?.showMessage(o.rejectReason,t);return}if(s.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new lo(this.editor,5,o.range,this._cts.token),a=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(a),d=await Promise.all(l.map(async p=>[p,await p.supportsAutomaticNewSymbolNamesTriggerKind??!1])),c=(p,f)=>{let _=d.slice();return p===Qu.Automatic&&(_=_.filter(([v,C])=>C)),_.map(([v])=>v.provideNewSymbolNames(a,o.range,p,f))};e("creating rename input field and awaiting its result");const h=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameWidget.getInput(o.range,o.text,h,l.length>0?c:void 0,r);if(e("received response from rename input field"),typeof u=="boolean"){e(`returning early - rename input field response - ${u}`),u&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const g=gr(i.provideRenameEdits(u.newName,r.token),r.token).then(async p=>{if(!p){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(p.rejectReason){e(`returning early - rejected with reason: ${p.rejectReason}`),this._notificationService.info(p.rejectReason);return}this.editor.setSelection(x.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(p,{editor:this.editor,showPreview:u.wantsPreview,label:m(1451,"Renaming '{0}' to '{1}'",o?.text,u.newName),code:"undoredo.rename",quotableLabel:m(1452,"Renaming {0} to {1}",o?.text,u.newName),respectAutoSaveConfig:!0,reason:oo.rename(o?.text,u.newName)}).then(f=>{e("edits applied"),f.ariaSummary&&gi(m(1453,"Successfully renamed '{0}' to '{1}'. Summary: {2}",o.text,u.newName,f.ariaSummary))}).catch(f=>{e(`error when applying edits ${JSON.stringify(f,null," ")}`),this._notificationService.error(m(1454,"Rename failed to apply edits")),this._logService.error(f)})},p=>{e("error when providing rename edits",JSON.stringify(p,null," ")),this._notificationService.error(m(1455,"Rename failed to compute edits")),this._logService.error(p)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(g,250),g}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};xs=qp=kF([Vs(1,ne),Vs(2,Rt),Vs(3,wl),Vs(4,pr),Vs(5,Ot),Vs(6,BR),Vs(7,X)],xs);var AF=class extends A{constructor(){super({id:"editor.action.rename",label:L(1457,"Rename Symbol"),precondition:k.and(S.writable,S.hasRenameProvider),kbOpts:{kbExpr:S.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(n,e){const t=n.get(Ze),[i,s]=Array.isArray(e)&&e||[void 0,void 0];return ke.isUri(i)&&B.isIPosition(s)?t.openCodeEditor({resource:i},t.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(r=>(this.reportTelemetry(r,o),this.run(r,o))))},Le):super.runCommand(n,e)}run(n,e){const t=n.get(Ot),i=xs.get(e);return i?(t.trace("[RenameAction] got controller, running..."),i.run()):(t.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}};de(xs.ID,xs,4);P(AF);var M_=Ft.bindToContribution(xs.get);Z(new M_({id:"acceptRenameInput",precondition:Vr,handler:n=>n.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:S.focus,primary:3}}));Z(new M_({id:"acceptRenameInputWithPreview",precondition:k.and(Vr,k.has("config.editor.rename.enablePreview")),handler:n=>n.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:S.focus,primary:2051}}));Z(new M_({id:"cancelRenameInput",precondition:Vr,handler:n=>n.cancelRenameInput(),kbOpts:{weight:199,kbExpr:S.focus,primary:9,secondary:[1033]}}));me(class extends lt{constructor(){super({id:"focusNextRenameSuggestion",title:{...L(1458,"Focus Next Rename Suggestion")},precondition:Vr,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(Ze).getFocusedCodeEditor();if(!t)return;const i=xs.get(t);i&&i.focusNextRenameSuggestion()}});me(class extends lt{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...L(1459,"Focus Previous Rename Suggestion")},precondition:Vr,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(Ze).getFocusedCodeEditor();if(!t)return;const i=xs.get(t);i&&i.focusPreviousRenameSuggestion()}});jt("_executeDocumentRenameProvider",function(n,e,t,...i){const[s]=i;Ie(typeof s=="string");const{renameProvider:o}=n.get(X);return OF(o,e,t,s)});jt("_executePrepareRename",async function(n,e,t){const{renameProvider:i}=n.get(X),s=await new Nh(e,t,i).resolveRenameLocation(he.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s});pn.as(ih.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:m(1456,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var FF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Oo=function(n,e){return function(t,i){e(t,i,n)}},In;(function(n){n.no="no",n.yes="yes",n.maybe="maybe"})(In||(In={}));(function(n){function e(t){switch(t){case"no":return n.no;case"yes":return n.yes;case"maybe":return n.maybe;default:return n.no}}n.fromString=e})(In||(In={}));var HF=class{constructor(){}inferRename(n,e,t,i){const s=new x(e.startLineNumber,1,e.endLineNumber,n.getLineMaxColumn(e.endLineNumber)),o=e.startColumn-s.startColumn,r=s.endColumn-e.endColumn,a=n.getValueInRange(s),l=n.getValueInRange(new x(s.startLineNumber,s.startColumn,s.startLineNumber,s.startColumn+o))+t+n.getValueInRange(new x(s.endLineNumber,s.endColumn-r,s.endLineNumber,s.endColumn)),d=[],c=[];let h,u,g;const p=n.getOffsetAt(s.getStartPosition()),{changes:f}=new KS(new xv(a),new xv(l)).ComputeDiff(!0);if(f.length===0)return;const _=[];for(const w of f){if(_.length===0){_.push(w);continue}const y=_[_.length-1],D=w.originalStart-(y.originalStart+y.originalLength);if(D>0){const b=p+y.originalStart+y.originalLength,I=n.getPositionAt(b),N=n.getWordAtPosition(I);if(N){const T=n.getOffsetAt(new B(I.lineNumber,N.startColumn)),E=n.getOffsetAt(new B(I.lineNumber,N.endColumn)),F=b+D;if(T<=b&&F<=E&&T<=F&&F<=E){y.originalLength=w.originalStart+w.originalLength-y.originalStart,y.modifiedLength=w.modifiedStart+w.modifiedLength-y.modifiedStart;continue}}}_.push(w)}let v=0;for(const w of _){const y=a.substring(w.originalStart,w.originalStart+w.originalLength),D=l.substring(w.modifiedStart,w.modifiedStart+w.modifiedLength),b=p+w.originalStart,I=n.getPositionAt(b),N=b+w.originalLength,T=n.getPositionAt(N),E=x.fromPositions(I,T),F=D.length-w.originalLength;if(/\s/.test(y)){d.push(new Be(E,D)),v+=F;continue}if(y.length>0){i.lastIndex=0;const Y=i.exec(y);if(Y===null||Y.index!==0||Y[0].length!==y.length){d.push(new Be(E,D)),v+=F;continue}}if(/\s/.test(D)){d.push(new Be(E,D)),v+=F;continue}if(D.length>0){i.lastIndex=0;const Y=i.exec(D);if(Y===null||Y.index!==0||Y[0].length!==D.length){d.push(new Be(E,D)),v+=F;continue}}const q=n.getWordAtPosition(I);if(q===null){d.push(new Be(E,D)),v+=F;continue}const re=w.originalStart+1,be=w.originalLength===0&&w.modifiedLength>0;let pe;if(be&&re===q.endColumn&&q.endColumn>q.startColumn?pe=this.getTokenAtPosition(n,new B(I.lineNumber,q.startColumn)):pe=this.getTokenAtPosition(n,I),q.startColumn!==pe.range.startColumn||q.endColumn!==pe.range.endColumn){d.push(new Be(E,D)),v+=F;continue}if(pe.type===0){let Y=n.getValueInRange(pe.range);if(Y.length===0){d.push(new Be(E,D)),v+=F;continue}if(h===void 0)h=Y;else if(h!==Y){d.push(new Be(E,D)),v+=F;continue}const ue=n.getOffsetAt(pe.range.getStartPosition())-p+v,xe=n.getOffsetAt(pe.range.getEndPosition())-p+v;if(Y=l.substring(ue,xe+F),Y.length===0){d.push(new Be(E,D)),v+=F;continue}if(u===void 0)u=Y;else if(u!==Y){d.push(new Be(E,D)),v+=F;continue}g===void 0&&(g=pe.range.getStartPosition()),h!==void 0&&u!==void 0&&h.length>0&&u.length>0&&h!==u?c.push(new Be(pe.range,u)):c.push(new Be(E,D)),v+=F}else d.push(new Be(E,D)),v+=D.length-w.originalLength}if(h===void 0||u===void 0||g===void 0||h.length===0||u.length===0||h===u)return;i.lastIndex=0;let C=i.exec(h);if(!(C===null||C.index!==0||C[0].length!==h.length)&&(i.lastIndex=0,C=i.exec(u),!(C===null||C.index!==0||C[0].length!==u.length)))return{renames:{edits:c,position:g,oldName:h,newName:u},others:{edits:d}}}getTokenAtPosition(n,e){n.tokenization.tokenizeIfCheap(e.lineNumber);const t=n.tokenization.getLineTokens(e.lineNumber),i=t.findTokenIndexAtOffset(e.column-1);return{type:t.getStandardTokenType(i),range:new x(e.lineNumber,1+t.getStartOffset(i),e.lineNumber,1+t.getEndOffset(i))}}},$p=class KI{static create(e,t){const i=e.getFocusedCodeEditor();if(i!==null&&i.getModel()===t)return new KI(i,t.getVersionId())}constructor(e,t){this.editor=e,this.versionId=t}equals(e){return e===void 0?!1:this.editor===e.editor&&this.versionId===e.versionId}},WF=class{constructor(n,e,t,i,s,o,r,a,l){if(this._result=void 0,this._commandService=e,this._textModel=i,this._state=s,this._requestUuid=t,this._cancellationTokenSource=new ot,a===void 0||l===void 0){this._promise=MF(n.renameProvider,i,o,r,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(i,o,l,r,a)}get requestUuid(){return this._requestUuid}isValid(n){return this._state.equals($p.create(n,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;const n=await this.getResult();return n===void 0||this._cancellationTokenSource.token.isCancellationRequested?0:n.edits.length}async getWorkspaceEdit(){return this.getResult()}async getResult(){if(!this._cancellationTokenSource.token.isCancellationRequested&&(this._result===void 0&&(this._result=await this._promise),!(this._result.rejectReason||this._cancellationTokenSource.token.isCancellationRequested)))return this._result}async sendNesRenameRequest(n,e,t,i,s){try{const o=await this._commandService.executeCommand("github.copilot.nes.postRename",n.uri,e,t,i,s);if(o===void 0)return{rejectReason:"Rename failed",edits:[]};const r=[];for(const a of o)for(const l of a.changes){const d=new x(l.range.start.line+1,l.range.start.character+1,l.range.end.line+1,l.range.end.character+1),c=new Ew(a.file,new Be(d,l.newText??i));r.push(c)}return{edits:r}}catch{return{rejectReason:"Rename failed",edits:[]}}}},Kp=class extends M{constructor(e,t,i,s,o,r){super(),this._commandService=e,this._languageFeaturesService=t,this._languageConfigurationService=i,this._renameSymbolTrackerService=o,this._codeEditorService=r,this._renameInferenceEngine=new HF,this._renameRunnable=void 0,this._register(Me.registerCommand(ob,async(a,l,d)=>{if(!(d===void 0||!d.isValid(this._codeEditorService)))try{const c=await d.getWorkspaceEdit();if(c===void 0)return;s.apply(c,{reason:l})}finally{this._renameRunnable===d&&(this._renameRunnable=void 0)}}))}async proposeRenameRefactoring(e,t,i){if(!t.supportsRename||t.action?.kind!=="edit"||i.selectedSuggestionInfo||!NF(this._languageFeaturesService.renameProvider,e))return t;const s=$p.create(this._codeEditorService,e);if(s===void 0)return t;const o=Date.now(),r=t.action.textReplacement,a=this._languageConfigurationService.getLanguageConfiguration(e.getLanguageId()),l=this._renameInferenceEngine.inferRename(e,r.range,r.text,a.wordDefinition);if(l===void 0||l.renames.edits.length===0)return t;const{oldName:d,newName:c,position:h,edits:u}=l.renames,g=this._renameSymbolTrackerService.trackedWord.get();let p;g!==void 0&&g.model===e&&g.originalWord===d&&g.currentWord===c&&(p=g.currentRange);let f=!1;const _=await qE(this.checkRenamePrecondition(t,e,h,d,c,p),100,()=>{f=!0}),v=this.isRenamePossible(t,_,s,e);if(t.setRenameProcessingInfo({createdRename:v,duration:Date.now()-o,timedOut:f,droppedOtherEdits:v?l.others.edits.length:void 0,droppedRenameEdits:v?u.length-1:void 0}),!v)return t;this._renameRunnable===void 0&&(this._renameRunnable=new WF(this._languageFeaturesService,this._commandService,t.requestUuid,e,s,h,c,p,p!==void 0?d:void 0));const C=oo.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),w={id:ob,title:m(1274,"Rename"),arguments:[C,this._renameRunnable]},y={label:m(1275,"Rename"),icon:V.replaceAll,command:w,count:this._renameRunnable.getCount()},D={kind:"edit",range:u[0].range,insertText:u[0].text,snippetInfo:t.snippetInfo,alternativeAction:y,uri:e.uri},b=kh.snapshot(e);return kc.create(t.withAction(D),b,!1)}async checkRenamePrecondition(e,t,i,s,o,r){const a={canRename:In.no,timedOut:!1};try{const l=await this._commandService.executeCommand("github.copilot.nes.prepareRename",t.uri,i,s,o,e.requestUuid,r);if(l===void 0)return a;if(typeof l=="string"){const d=In.fromString(l);return d===In.yes||d===In.maybe?{canRename:d,oldName:s,onOldState:!1}:{canRename:d,timedOut:!1}}else return l}catch{return a}}isRenamePossible(e,t,i,s){return t===void 0||t.canRename===In.no||!i.equals($p.create(this._codeEditorService,s))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};Kp=FF([Oo(0,ht),Oo(1,X),Oo(2,ct),Oo(3,wl),Oo(4,NT),Oo(5,Ze)],Kp);var VF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ao=function(n,e){return function(t,i){e(t,i,n)}},Gp,Zp=class extends M{static{Gp=this}static{this._requestId=0}constructor(e,t,i,s,o,r,a,l,d,c,h){super(),this._textModel=e,this._versionId=t,this._debounceValue=i,this._cursorPosition=s,this._languageConfigurationService=r,this._logService=a,this._configurationService=l,this._instantiationService=d,this._contextKeyService=c,this._textModelService=h,this._updateOperation=this._register(new We),this._state=JA(this,{initial:()=>({inlineCompletions:vn.createEmpty(),suggestWidgetInlineCompletions:vn.createEmpty()}),disposeFinal:u=>{u.inlineCompletions.dispose(),u.suggestWidgetInlineCompletions.dispose()},changeTracker:OR(()=>({versionId:this._versionId})),update:(u,g,p)=>{const f=Mn.compose(p.changes.map(_=>_.change?aR(_.change.changes):Mn.empty).filter(Tn));if(f.isEmpty())return g;try{return{inlineCompletions:g.inlineCompletions.createStateWithAppliedEdit(f,this._textModel),suggestWidgetInlineCompletions:g.suggestWidgetInlineCompletions.createStateWithAppliedEdit(f,this._textModel)}}finally{g.inlineCompletions.dispose(),g.suggestWidgetInlineCompletions.dispose()}}}),this.inlineCompletions=this._state.map(this,u=>u.inlineCompletions),this.suggestWidgetInlineCompletions=this._state.map(this,u=>u.suggestWidgetInlineCompletions),this._completionsEnabled=void 0,this.clearOperationOnTextModelChange=R(this,u=>{this._versionId.read(u),this._updateOperation.clear()}),this._loadingCount=Fe(this,0),this.loading=this._loadingCount.map(this,u=>u>0),this._dataChannelTelemetryService=this._instantiationService.createInstance(Fp),this._loggingEnabled=fv("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=fv("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(Dc.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(Kp)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store),o&&(this._updateCompletionsEnablement(o),this._register(this._configurationService.onDidChangeConfiguration(u=>{u.affectsConfiguration(o)&&this._updateCompletionsEnablement(o)}))),this._state.recomputeInitiallyAndOnChange(this._store)}_updateCompletionsEnablement(e){const t=this._configurationService.getValue(e);fm(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(kA(e)),this._structuredFetchLogger.log(e)}fetch(e,t,i,s,o,r,a){const l=this._cursorPosition.get(),d=new BF(l,i,this._textModel.getVersionId(),new Set(e)),c=i.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(d))return this._updateOperation.value.promise;if(c?.request?.satisfies(d))return Promise.resolve(!0);const h=!!this._updateOperation.value;this._updateOperation.clear();const u=new ot,g=(async()=>{const f=new O;this._loadingCount.set(this._loadingCount.get()+1,void 0);let _=!1;const v=()=>{_||(_=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0))};f.add(new at(()=>v(),1e4)).schedule();const C=e.filter(y=>y.providerId),w=new UF(i,a,C);try{const y=this._debounceValue.get(this._textModel),D=P0(e.map(Y=>Y.debounceDelayMs),bT(ro))??y;if((h||o&&i.triggerKind===ti.Automatic)&&await sC(D,u.token),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==d.versionId)return w.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;const b=Gp._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:b,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:i.triggerKind,suggestInfo:i.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});const I=new Date,N=yF(e,this._cursorPosition.get(),this._textModel,i,a,this._languageConfigurationService);qI(u.token,()=>N.cancelAndDispose({kind:"tokenCancellation"}));let T=!1,E=!1;const F=[];for await(const Y of N.lists)if(Y){Y.addRef(),f.add(Te(()=>Y.removeRef(Y.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(const ue of Y.inlineSuggestionsData){if(E=!0,!i.includeInlineEdits&&(ue.isInlineEdit||ue.showInlineEditMenu)){ue.setNotShownReason("notInlineEditRequested");continue}if(!i.includeInlineCompletions&&!(ue.isInlineEdit||ue.showInlineEditMenu)){ue.setNotShownReason("notInlineCompletionRequested");continue}ue.addPerformanceMarker("providerReturned");const xe=ue.action?.uri;let Oe,_e;if(xe&&xe.toString()!==this._textModel.uri.toString()){const Re=await this._textModelService.createModelReference(xe);Oe=Re.object.textEditorModel,_e=Re}else Oe=this._textModel,_e=void 0;const Ue=kh.snapshot(Oe),rt=kc.create(ue,Ue);if(_e){const Re=or(rt.identity.onDispose,()=>{_e?.dispose(),Re.dispose()})}ue.addPerformanceMarker("itemCreated"),F.push(rt),!rt.isInlineEdit&&!rt.showInlineEditMenu&&i.triggerKind===ti.Automatic&&rt.isVisible(this._textModel,this._cursorPosition.get())&&(T=!0)}if(T)break}F.forEach(Y=>Y.addPerformanceMarker("providersResolved"));const q=await Promise.all(F.map(async Y=>this._renameProcessor.proposeRenameRefactoring(this._textModel,Y,i)));if(q.forEach(Y=>Y.addPerformanceMarker("renameProcessed")),N.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){const Y=N.didAllProvidersReturn;let ue;(u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==d.versionId)&&(ue="canceled");const xe=q.map(Oe=>{const _e=Oe.getSourceCompletion();if(_e.doNotLog)return;const Ue={insertText:_e.insertText,range:_e.range,additionalTextEdits:_e.additionalTextEdits,uri:_e.uri,command:_e.command,gutterMenuLinkAction:_e.gutterMenuLinkAction,shownCommand:_e.shownCommand,completeBracketPairs:_e.completeBracketPairs,isInlineEdit:_e.isInlineEdit,showInlineEditMenu:_e.showInlineEditMenu,showRange:_e.showRange,warning:_e.warning,hint:_e.hint,supportsRename:_e.supportsRename,correlationId:_e.correlationId,jumpToPosition:_e.jumpToPosition};return{...V0(Ue,rt=>x.isIRange(rt)?x.lift(rt).toString():B.isIPosition(rt)?B.lift(rt).toString():qw.is(rt)?{$commandId:rt.id}:rt),$providerId:Oe.source.provider.providerId?.toString()}}).filter(Oe=>Oe!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:b,durationMs:Date.now()-I.getTime(),error:ue,result:xe,time:Date.now(),didAllProvidersReturn:Y})}if(w.setRequestUuid(N.contextWithUuid.requestUuid),E)w.setHasProducedSuggestion(),q.length>0&&u.token.isCancellationRequested&&q.forEach(Y=>Y.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"));else if(u.token.isCancellationRequested)w.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{const Y=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");w.setNoSuggestionReasonIfNotSet(Y?"completionsQuotaExceeded":"noSuggestion")}const re=i.earliestShownDateTime-Date.now();if(re>0&&await sC(re,u.token),q.forEach(Y=>Y.addPerformanceMarker("minShowDelayPassed")),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==d.versionId||r.get()){const Y=u.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==d.versionId?"canceled:documentChanged":r.get()?"canceled:userJumped":"unknown";return q.forEach(ue=>ue.setNotShownReasonIfNotSet(Y)),!1}const be=new Date;this._debounceValue.update(this._textModel,be.getTime()-I.getTime());const pe=this._cursorPosition.get();this._updateOperation.clear(),Vi(Y=>{const ue=this._state.get();i.selectedSuggestionInfo?this._state.set({inlineCompletions:vn.createEmpty(),suggestWidgetInlineCompletions:ue.suggestWidgetInlineCompletions.createStateWithAppliedResults(q,d,this._textModel,pe,s)},Y):this._state.set({inlineCompletions:ue.inlineCompletions.createStateWithAppliedResults(q,d,this._textModel,pe,s),suggestWidgetInlineCompletions:vn.createEmpty()},Y),ue.inlineCompletions.dispose(),ue.suggestWidgetInlineCompletions.dispose()})}finally{f.dispose(),v(),this._sendInlineCompletionsRequestTelemetry(w)}return!0})(),p=new jF(d,u,g);return this._updateOperation.value=p,g}clear(e){if(this._store.isDisposed)return;this._updateOperation.clear();const t=this._state.get();this._state.set({inlineCompletions:vn.createEmpty(),suggestWidgetInlineCompletions:vn.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){const e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Vi(i=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();const s=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:vn.createEmpty()},i),s.inlineCompletions.dispose(),s.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(i)})}seedWithCompletion(e,t){const i=this._state.get();this._state.set({inlineCompletions:new vn([e],void 0),suggestWidgetInlineCompletions:vn.createEmpty()},t),i.inlineCompletions.dispose(),i.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment")||e.requestUuid===void 0||e.hasProducedSuggestion||!ST(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(i=>hC(i.providerId?.extensionId)))return;const t={opportunityId:e.requestUuid,noSuggestionReason:e.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,skuPlan:e.requestInfo.sku?.plan,skuType:e.requestInfo.sku?.type,editorType:e.requestInfo.editorType,requestReason:e.requestInfo.reason,typingInterval:e.requestInfo.typingInterval,typingIntervalCharacterCount:e.requestInfo.typingIntervalCharacterCount,languageId:e.requestInfo.languageId,selectedSuggestionInfo:!!e.context.selectedSuggestionInfo,availableProviders:e.providers.map(i=>i.providerId?.toString()).filter(Tn).join(","),...tF(e.providers.some(i=>hC(i.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,superseded:void 0,reason:void 0,acceptedAlternativeAction:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,longDistanceHintVisible:void 0,longDistanceHintDistance:void 0,isForAnotherDocument:void 0,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0};iF(this._dataChannelTelemetryService,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};Zp=Gp=VF([Ao(5,ct),Ao(6,Ot),Ao(7,Ee),Ao(8,ne),Ao(9,Ce),Ao(10,li)],Zp);var BF=class{constructor(n,e,t,i){this.position=n,this.context=e,this.versionId=t,this.providers=i}satisfies(n){return this.position.equals(n.position)&&f0(this.context.selectedSuggestionInfo,n.context.selectedSuggestionInfo,km())&&(n.context.triggerKind===ti.Automatic||this.context.triggerKind===ti.Explicit)&&this.versionId===n.versionId&&zF(n.providers,this.providers)}},UF=class{constructor(n,e,t){this.context=n,this.requestInfo=e,this.providers=t,this.hasProducedSuggestion=!1}setRequestUuid(n){this.requestUuid=n}setNoSuggestionReasonIfNotSet(n){this.noSuggestionReason??=n}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}};function zF(n,e){return[...n].every(t=>e.has(t))}var jF=class{constructor(n,e,t){this.request=n,this.cancellationTokenSource=e,this.promise=t}dispose(){this.cancellationTokenSource.cancel()}},vn=class pa extends M{static createEmpty(){return new pa([],void 0)}constructor(e,t){super(),this.inlineCompletions=e,this.request=t;for(const i of this.inlineCompletions)i.addRef();this._register({dispose:()=>{for(const i of this.inlineCompletions)i.removeRef()}})}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(e,t){const i=this.inlineCompletions.map(s=>s.withEdit(e,t)).filter(Tn);return new pa(i,this.request)}createStateWithAppliedResults(e,t,i,s,o){let r;if(o){const d=this._findById(o);if(d&&d.canBeReused(i,t.position)){r=d;const c=e.find(h=>h.hash===d.hash);c?e=$F(c,e):e=[d,...e]}}const a=r?!r.isInlineEdit:e.some(d=>!d.isInlineEdit&&d.isVisible(i,s));let l=[];for(const d of e){const c=this._findByHash(d.hash);let h;c&&c!==d?(h=d.withIdentity(c.identity),d.setIsPreceeded(c),c.setEndOfLifeReason({kind:rs.Ignored,userTypingDisagreed:!1,supersededBy:d.getSourceCompletion()})):h=d,a!==h.isInlineEdit&&l.push(h)}return l.sort(ao(d=>d.showInlineEditMenu,HT)),l=qF(l,d=>d.semanticId),new pa(l,t)}clone(){return new pa(this.inlineCompletions,this.request)}};function qF(n,e){const t=new Set;return n.filter(i=>{const s=e(i);return t.has(s)?!1:(t.add(s),!0)})}function $F(n,e){const t=e.indexOf(n);return t>-1?[n,...e.slice(0,t),...e.slice(t+1)]:e}var KF=class Xs extends M{static{this.MAX_SESSION_GAP_MS=3e3}static{this.MIN_SESSION_DURATION_MS=1e3}static{this.SESSION_HISTORY_LIMIT=50}static{this.TYPING_SPEED_WINDOW_MS=3e5}static{this.MIN_CHARS_FOR_RELIABLE_SPEED=20}getTypingInterval(){return(this._cacheInvalidated||this._cachedTypingIntervalResult===null)&&(this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1),this._cachedTypingIntervalResult}constructor(e){super(),this._textModel=e,this._typingSessions=[],this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0,this._register(this._textModel.onDidChangeContent(t=>this._updateTypingSpeed(t)))}_updateTypingSpeed(e){const t=Date.now();if(!this._isUserTyping(e)){this._finalizeCurrentSession();return}this._currentSession&&t-this._lastChangeTime>Xs.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||(this._currentSession={startTime:t,endTime:t,characterCount:0}),this._currentSession.endTime=t,this._currentSession.characterCount+=this._getActualCharacterCount(e),this._lastChangeTime=t,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(const i of e.changes)t+=Math.max(i.text.length,i.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(const t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;if(e.metadata.source==="cursor"){const t=e.metadata.kind;return t==="type"||t==="compositionType"||t==="compositionEnd"}else return!1}_finalizeCurrentSession(){this._currentSession&&(this._currentSession.endTime-this._currentSession.startTime>=Xs.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>Xs.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),this._currentSession=null)}_calculateTypingInterval(){if(this._currentSession){const e={...this._currentSession};if(e.endTime-e.startTime>=Xs.MIN_SESSION_DURATION_MS&&e.characterCount>0){const t=[...this._typingSessions,e];return this._calculateSpeedFromSessions(t)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(e){if(e.length===0)return{averageInterval:0,characterCount:0};const t=[...e].sort((d,c)=>c.endTime-d.endTime),i=Date.now()-Xs.TYPING_SPEED_WINDOW_MS,s=t.filter(d=>d.endTime>i),o=t.splice(s.length);let r=Yd(s.map(d=>d.characterCount));for(let d=0;d<o.length&&r<Xs.MIN_CHARS_FOR_RELIABLE_SPEED;d++)s.push(o[d]),r+=o[d].characterCount;const a=Yd(s.map(d=>d.endTime-d.startTime));if(a===0||r<=1)return{averageInterval:0,characterCount:r};const l=a/Math.max(1,r-1);return{averageInterval:Math.round(l),characterCount:r}}dispose(){this._finalizeCurrentSession(),super.dispose()}},GI;function ZI(n){return GI?.(n)??null}function GF(n){GI=n}var ZF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},$n=function(n,e){return function(t,i){e(t,i,n)}},Xp=class extends M{get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}constructor(e,t,i,s,o,r,a,l,d,c,h,u,g,p,f,_){super(),this.textModel=e,this._selectedSuggestItem=t,this._textModelVersionId=i,this._positions=s,this._debounceValue=o,this._enabled=r,this._isSuppressed=a,this._editor=l,this._instantiationService=d,this._commandService=c,this._languageConfigurationService=h,this._accessibilityService=u,this._languageFeaturesService=g,this._codeEditorService=p,this._inlineCompletionsService=f,this._isActive=Fe(this,!1),this._onlyRequestInlineEditsSignal=ns(this),this._forceUpdateExplicitlySignal=ns(this),this._noDelaySignal=ns(this),this._fetchSpecificProviderSignal=ns(this),this._selectedInlineCompletionId=Fe(this,void 0),this.primaryPosition=R(this,b=>this._positions.read(b)[0]??new B(1,1)),this.allPositions=R(this,b=>this._positions.read(b)),this.sku=Fe(this,void 0),this._isAcceptingPartially=!1,this._appearedInsideViewport=R(this,b=>{const I=this.state.read(b);return!I||!I.inlineSuggestion?!1:XI(this._editor,I.inlineSuggestion,b)}),this._onDidAccept=this._register(new ee),this.onDidAccept=this._onDidAccept.event,this._lastShownInlineCompletionInfo=void 0,this._lastAcceptedInlineCompletionInfo=void 0,this._didUndoInlineEdits=Tv({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(b,I)=>(I.didUndo=b.didChange(this._textModelVersionId)&&!!b.change?.isUndoing,!0)}},(b,I)=>{const N=this._textModelVersionId.read(b);return N!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===N-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&I.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1}),this._preserveCurrentCompletionReasons=new Set([xn.Redo,xn.Undo,xn.AcceptWord]),this.dontRefetchSignal=ns(this),this._fetchInlineCompletionsPromise=Tv({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:ti.Automatic,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:""}),handleChange:(b,I)=>{if(b.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(b.change))&&(I.preserveCurrentCompletion=!0);const N=b.change?.detailedReasons??[];I.changeReason=N.length>0?N[0].getType():"",I.textChange=!0}else b.didChange(this._forceUpdateExplicitlySignal)?(I.preserveCurrentCompletion=!0,I.inlineCompletionTriggerKind=ti.Explicit):b.didChange(this.dontRefetchSignal)?I.dontRefetch=!0:b.didChange(this._onlyRequestInlineEditsSignal)?I.onlyRequestInlineEdits=!0:b.didChange(this._fetchSpecificProviderSignal)&&(I.provider=b.change?.provider,I.changeHint=b.change?.changeHint);return!0}}},(b,I)=>{if(this._source.clearOperationOnTextModelChange.read(b),this._noDelaySignal.read(b),this.dontRefetchSignal.read(b),this._onlyRequestInlineEditsSignal.read(b),this._forceUpdateExplicitlySignal.read(b),this._fetchSpecificProviderSignal.read(b),!(!this._isSuppressed()&&(this._enabled.read(b)&&this._selectedSuggestItem.read(b)||this._isActive.read(b))&&(!this._inlineCompletionsService.isSnoozing()||I.inlineCompletionTriggerKind===ti.Explicit))){this._source.cancelUpdate();return}this._textModelVersionId.read(b);const N=this._source.suggestWidgetInlineCompletions.read(void 0);let T=this._selectedSuggestItem.read(b);if(this._shouldShowOnSuggestConflict.read(void 0)&&(T=void 0),N&&!T&&this._source.seedInlineCompletionsWithSuggestWidget(),I.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(b)&&I.inlineCompletionTriggerKind!==ti.Explicit){Vi(Oe=>{this._source.clear(Oe)});return}let E="";I.provider?E+="providerOnDidChange":I.inlineCompletionTriggerKind===ti.Explicit&&(E+="explicit"),I.changeReason&&(E+=E.length>0?`:${I.changeReason}`:I.changeReason);const F=this._typing.getTypingInterval(),q={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:E,typingInterval:F.averageInterval,typingIntervalCharacterCount:F.characterCount,availableProviders:[],sku:this.sku.read(void 0)};let re={triggerKind:I.inlineCompletionTriggerKind,selectedSuggestionInfo:T?.toSelectedSuggestionInfo(),includeInlineCompletions:!I.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(b),requestIssuedDateTime:q.startTime,earliestShownDateTime:q.startTime+(I.inlineCompletionTriggerKind===ti.Explicit||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:I.changeHint};re.triggerKind===ti.Automatic&&I.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(re={...re,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});const be=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,pe=I.preserveCurrentCompletion||be?.forwardStable?be:void 0,Y=this._jumpedToId.map(Oe=>!!Oe&&Oe===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),ue=I.provider?{providers:[I.provider],label:"single:"+I.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},xe=this.getAvailableProviders(ue.providers);return q.availableProviders=xe.map(Oe=>Oe.providerId).filter(Tn),this._source.fetch(xe,ue.label,re,pe?.identity,I.shouldDebounce,Y,q)}),this._inlineSuggestionItems=nn({owner:this},b=>{const I=this._source.inlineCompletions.read(b);if(!I)return;const N=this.primaryPosition.read(b);let T;const E=[];for(const F of I.inlineCompletions)F.isInlineEdit?T=F:F.isVisible(this.textModel,N)&&E.push(F);return E.length!==0&&(T=void 0),{inlineCompletions:E,inlineEdit:T}}),this._inlineCompletionItems=nn({owner:this,equalsFn:wv()},b=>this._inlineSuggestionItems.read(b)?.inlineCompletions??[]),this.selectedInlineCompletionIndex=R(this,b=>{const I=this._selectedInlineCompletionId.read(b),N=this._inlineCompletionItems.read(b),T=this._selectedInlineCompletionId===void 0?-1:N.findIndex(E=>E.semanticId===I);return T===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):T}),this.selectedInlineCompletion=R(this,b=>this._inlineCompletionItems.read(b)[this.selectedInlineCompletionIndex.read(b)]),this.activeCommands=nn({owner:this,equalsFn:wv()},b=>this.selectedInlineCompletion.read(b)?.source.inlineSuggestions.commands??[]),this.inlineCompletionsCount=R(this,b=>{if(this.lastTriggerKind.read(b)===ti.Explicit)return this._inlineCompletionItems.read(b).length}),this._hasVisiblePeekWidgets=R(this,b=>this._editorObs.openedPeekWidgets.read(b)>0),this._shouldShowOnSuggestConflict=R(this,b=>{const I=this._showOnSuggestConflict.read(b);if(I!=="never"&&this.selectedInlineCompletion.read(b)){const N=this._selectedSuggestItem.read(b);return N?I==="whenSuggestListIsIncomplete"?N.listIncomplete:!0:!1}return!1}),this.state=nn({owner:this,equalsFn:(b,I)=>!b||!I?b===I:b.kind==="ghostText"&&I.kind==="ghostText"?rC(b.ghostTexts,I.ghostTexts)&&b.inlineSuggestion===I.inlineSuggestion&&b.suggestItem===I.suggestItem:b.kind==="inlineEdit"&&I.kind==="inlineEdit"?b.inlineSuggestion===I.inlineSuggestion:!1},b=>{const I=this.textModel;if(this._suppressInSnippetMode.read(b)&&this._isInSnippetMode.read(b))return;const N=this._inlineSuggestionItems.read(b),T=N?.inlineEdit;if(T){if(this._hasVisiblePeekWidgets.read(b))return;const F=this.primaryPosition.map(pe=>ft.fromRangeInclusive(T.targetRange).addMargin(1,1).contains(pe.lineNumber)),q=T.action?.kind==="edit"?T.action.stringEdit:void 0,re=q?Ln.fromStringEdit(q,new wm(this.textModel)).replacements:[];let be=(N.inlineEdit?.command?.id==="vscode.open"||N.inlineEdit?.command?.id==="_workbench.open")&&N.inlineEdit?.command.arguments?.length?ke.from(N.inlineEdit?.command.arguments[0]):void 0;return T.originalTextRef.targets(this.textModel)||(be=T.originalTextRef.uri),{kind:"inlineEdit",inlineSuggestion:T,edits:re,cursorAtInlineEdit:F,nextEditUri:be}}const E=this._selectedSuggestItem.read(b);if(!this._shouldShowOnSuggestConflict.read(b)&&E){const F=ms(E.getSingleTextEdit(),I),q=this._computeAugmentation(F,b);if(!this._suggestPreviewEnabled.read(b)&&!q)return;const re=q?.edit??F,be=q?q.edit.text.length-F.text.length:0,pe=this._suggestPreviewMode.read(b),Y=this._positions.read(b),ue=[re,..._u(this.textModel,Y,re)].map((_e,Ue)=>({edit:_e,ghostText:_e?aC(_e,I,pe,Y[Ue],be):void 0})).filter(({edit:_e,ghostText:Ue})=>_e!==void 0&&Ue!==void 0),xe=ue.map(({edit:_e})=>_e),Oe=ue.map(({ghostText:_e})=>_e);return{kind:"ghostText",edits:xe,primaryGhostText:Oe[0]??new nl(re.range.endLineNumber,[]),ghostTexts:Oe,inlineSuggestion:q?.completion,suggestItem:E}}else{if(!this._isActive.read(b))return;const F=this.selectedInlineCompletion.read(b);if(!F)return;const q=F.getSingleTextEdit(),re=this._inlineSuggestMode.read(b),be=this._positions.read(b),pe=[q,..._u(this.textModel,be,q)].map((xe,Oe)=>({edit:xe,ghostText:xe?aC(xe,I,re,be[Oe],0):void 0})).filter(({edit:xe,ghostText:Oe})=>xe!==void 0&&Oe!==void 0),Y=pe.map(({edit:xe})=>xe),ue=pe.map(({ghostText:xe})=>xe);return ue[0]?{kind:"ghostText",edits:Y,primaryGhostText:ue[0],ghostTexts:ue,inlineSuggestion:F,suggestItem:void 0}:void 0}}),this.status=R(this,b=>{if(this._source.loading.read(b))return"loading";const I=this.state.read(b);return I?.kind==="ghostText"?"ghostText":I?.kind==="inlineEdit"?"inlineEdit":"noSuggestion"}),this.inlineCompletionState=R(this,b=>{const I=this.state.read(b);if(!(!I||I.kind!=="ghostText")&&!this._editorObs.inComposition.read(b))return I}),this.inlineEditState=R(this,b=>{const I=this.state.read(b);if(!(!I||I.kind!=="inlineEdit"))return I}),this.inlineEditAvailable=R(this,b=>!!this.inlineEditState.read(b)),this.warning=R(this,b=>this.inlineCompletionState.read(b)?.inlineSuggestion?.warning),this.ghostTexts=nn({owner:this,equalsFn:rC},b=>{const I=this.inlineCompletionState.read(b);if(I)return I.ghostTexts}),this.primaryGhostText=nn({owner:this,equalsFn:NI},b=>{const I=this.inlineCompletionState.read(b);if(I)return I?.primaryGhostText}),this.showCollapsed=R(this,b=>{const I=this.state.read(b);if(!I||I.kind!=="inlineEdit"||I.inlineSuggestion.hint||I.inlineSuggestion.action?.kind==="jumpTo")return!1;const N=I.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(b);return(this._inlineEditsShowCollapsedEnabled.read(b)||!N)&&this._jumpedToId.read(b)!==I.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(b)}),this._tabShouldIndent=R(this,b=>{if(this._inAcceptFlow.read(b))return!1;function I(T){return T.startLineNumber!==T.endLineNumber}function N(T,E){const F=T.getLineIndentColumn(E),q=T.getLineLastNonWhitespaceColumn(E);return new x(E,F,E,Math.max(q,F))}return this._editorObs.selections.read(b)?.some(T=>T.isEmpty()?this.textModel.getLineLength(T.startLineNumber)===0:I(T)||T.containsRange(N(this.textModel,T.startLineNumber)))}),this.tabShouldJumpToInlineEdit=R(this,b=>{if(this._tabShouldIndent.read(b))return!1;const I=this.inlineEditState.read(b);return I?I.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(b)?!0:this._inAcceptFlow.read(b)&&this._appearedInsideViewport.read(b)?!1:!I.cursorAtInlineEdit.read(b):!1}),this.tabShouldAcceptInlineEdit=R(this,b=>{const I=this.inlineEditState.read(b);return!I||I.inlineSuggestion.action?.kind==="jumpTo"||this.showCollapsed.read(b)||this._tabShouldIndent.read(b)?!1:this._inAcceptFlow.read(b)&&this._appearedInsideViewport.read(b)||I.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(b)||this._jumpedToId.read(b)===I.inlineSuggestion.semanticId?!0:I.cursorAtInlineEdit.read(b)}),this._jumpedToId=Fe(this,void 0),this._inAcceptFlow=Fe(this,!1),this.inAcceptFlow=this._inAcceptFlow,this._source=this._register(this._instantiationService.createInstance(Zp,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition,i0.defaultChatAgent?.completionsEnablementSetting)),this.lastTriggerKind=this._source.inlineCompletions.map(this,b=>b?.request?.context.triggerKind),this._editorObs=je(this._editor);const v=this._editorObs.getOption(134);this._suggestPreviewEnabled=v.map(b=>b.preview),this._suggestPreviewMode=v.map(b=>b.previewMode);const C=this._editorObs.getOption(71);this._inlineSuggestMode=C.map(b=>b.mode),this._suppressedInlineCompletionGroupIds=C.map(b=>new Set(b.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=C.map(b=>!!b.edits.enabled),this._inlineEditsShowCollapsedEnabled=C.map(b=>b.edits.showCollapsed),this._triggerCommandOnProviderChange=C.map(b=>b.triggerCommandOnProviderChange),this._minShowDelay=C.map(b=>b.minShowDelay),this._showOnSuggestConflict=C.map(b=>b.experimental.showOnSuggestConflict),this._suppressInSnippetMode=C.map(b=>b.suppressInSnippetMode);const w=_t.get(this._editor);this._isInSnippetMode=w?.isInSnippetObservable??ye(!1),_.getDefaultAccount().then(JF(b=>this.sku.set(gC(b),void 0),this._store)),this._register(_.onDidChangeDefaultAccount(b=>this.sku.set(gC(b),void 0))),this._typing=this._register(new KF(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(b=>{b&&this.stop()}));{const b=this.textModel.uri.scheme===Ct.vscodeNotebookCell,[I]=this._codeEditorService.listDiffEditors().filter(N=>N.getOriginalEditor().getId()===this._editor.getId()||N.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!I,this.editorType=b?gt.Notebook:this.isInDiffEditor?gt.DiffEditor:gt.TextEditor}this._register(Rv(this.state,b=>{b&&b.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(b.inlineSuggestion.requestUuid)})),this._register(Rv(this._fetchInlineCompletionsPromise)),this._register(ge(b=>{this._editorObs.versionId.read(b),this._inAcceptFlow.set(!1,void 0)})),this._register(ge(b=>{this.state.map((I,N)=>!I||I.kind==="inlineEdit"&&!I.cursorAtInlineEdit.read(N)).read(b)&&this._jumpedToId.set(void 0,void 0)})),this._register(ge(b=>{const I=this.state.map(N=>N?.inlineSuggestion).read(b);I&&I.addPerformanceMarker("activeSuggestion")}));const y=this.inlineEditState.map(b=>b?.inlineSuggestion.semanticId);this._register(ge(b=>{y.read(b)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion})}));const D=Bt(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));Wm(this,D,(b,I)=>{b.onDidChangeInlineCompletions&&I.add(b.onDidChangeInlineCompletions(N=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}const T=this.state.get();T&&(T.inlineSuggestion||T.edits)&&T.inlineSuggestion?.source.provider!==b||Vi(E=>{this._fetchSpecificProviderSignal.trigger(E,{provider:b,changeHint:N??void 0}),this.trigger(E)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}getIndentationInfo(e){let t=!1,i=!0;const s=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&s&&s.parts.length>0){const{column:o,lines:r}=s.parts[0],a=r[0].line;if(o<=this.textModel.getLineIndentColumn(s.lineNumber)){let l=ag(a);l===-1&&(l=a.length-1),t=l>0;const d=this.textModel.getOptions().tabSize;i=bd.visibleColumnFromColumn(a,l+1,d)<d}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:i}}_getReason(e){return e?.isUndoing?xn.Undo:e?.isRedoing?xn.Redo:this.isAcceptingPartially?xn.AcceptWord:xn.Other}getAvailableProviders(e){const t=this._suppressedInlineCompletionGroupIds.get(),i=e.filter(r=>!(r.groupId&&t.has(r.groupId))),s=new Set;for(const r of i)r.excludesGroupIds?.forEach(a=>s.add(a));const o=[];for(const r of i)r.groupId&&s.has(r.groupId)||o.push(r);return o}async trigger(e,t={}){rg(e,i=>{t.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(i),t.noDelay&&this._noDelaySignal.trigger(i),this._isActive.set(!0,i),t.explicit&&(this._inAcceptFlow.set(!0,i),this._forceUpdateExplicitlySignal.trigger(i)),t.provider&&this._fetchSpecificProviderSignal.trigger(i,{provider:t.provider,changeHint:t.changeHint})}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e,t=!1){return this.trigger(e,{onlyFetchInlineEdits:t,explicit:!0})}stop(e="automatic",t){rg(t,i=>{if(e==="explicitCancel"){const s=this.state.get()?.inlineSuggestion;s&&s.reportEndOfLife({kind:rs.Rejected})}this._isActive.set(!1,i),this._source.clear(i)})}_computeAugmentation(e,t){const i=this.textModel,s=this._source.suggestWidgetInlineCompletions.read(t),o=s?s.inlineCompletions.filter(r=>!r.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(Tn);return j0(o,r=>{let a=r.getSingleTextEdit();return a=ms(a,i,x.fromPositions(a.range.getStartPosition(),e.range.getEndPosition())),MI(a,e)?{completion:r,edit:a}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._inlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(e,t,i=void 0){return i?oo.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:i,correlationId:e.getSourceCompletion().correlationId}):oo.inlineCompletionAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,correlationId:e.getSourceCompletion().correlationId,providerId:e.source.provider.providerId,languageId:t})}async accept(e=this._editor,t=!1){if(e.getModel()!==this.textModel)throw new pt;let i,s=!1;const o=this.state.get();if(o?.kind==="ghostText"){if(!o||o.primaryGhostText.isEmpty()||!o.inlineSuggestion)return;i=o.inlineSuggestion}else if(o?.kind==="inlineEdit")i=o.inlineSuggestion,s=!!o.nextEditUri;else return;i.addRef();try{let r=!1;if(e.pushUndoStop(),i.originalTextRef.targets(this.textModel)){if(!s){if(i.action?.kind==="edit"){const a=i.action;if(t&&a.alternativeAction){r=!0;const l=a.alternativeAction.command;await this._commandService.executeCommand(l.id,...l.arguments||[]).then(void 0,it)}else if(a.snippetInfo){const l=Be.delete(a.textReplacement.range),d=i.additionalTextEdits.map(h=>new Be(x.lift(h.range),h.text??"")),c=Ln.fromParallelReplacementsUnsorted([l,...d]);e.edit(c,this._getMetadata(i,this.textModel.getLanguageId())),e.setPosition(a.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),_t.get(e)?.insert(a.snippetInfo.snippet,{undoStopBefore:!1})}else{const l=o.edits;let d=l;o.kind==="ghostText"&&(d=jA(l,this.textModel));const c=nC(d).map(g=>ie.fromPositions(g)),h=i.additionalTextEdits.map(g=>new Be(x.lift(g.range),g.text??"")),u=Ln.fromParallelReplacementsUnsorted([...l,...h]);if(e.edit(u,this._getMetadata(i,this.textModel.getLanguageId())),i.hint===void 0&&e.setSelections(o.kind==="inlineEdit"?c.slice(-1):c,"inlineCompletionAccept"),o.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){const g=u.getNewRanges(),p=this._store.add(new XF(e,g,()=>{this._store.delete(p)}))}}}}}else{const a=await this._codeEditorService.openCodeEditor({resource:i.originalTextRef.uri},this._editor);if(a){const l=ZI(a)?.model.get();a.focus(),l?.transplantCompletion(i),a.revealLineInCenter(i.targetRange.startLineNumber)}}this._onDidAccept.fire(),this.stop(),i.command&&await this._commandService.executeCommand(i.command.id,...i.command.arguments||[]).then(void 0,it),r&&this.trigger(void 0),i.reportEndOfLife({kind:rs.Accepted,alternativeAction:t})}finally{i.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:i}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(e,t)=>{const i=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),s=this._languageConfigurationService.getLanguageConfiguration(i),o=new RegExp(s.wordDefinition.source,s.wordDefinition.flags.replace("g","")),r=t.match(o);let a=0;r&&r.index!==void 0?r.index===0?a=r[0].length:a=r.index:a=t.length;const l=/\s+/g.exec(t);return l&&l.index!==void 0&&l.index+l[0].length<a&&(a=l.index+l[0].length),a},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(e,t)=>{const i=t.match(/\n/);return i&&i.index!==void 0?i.index+1:t.length},1)}async _acceptNext(e,t,i,s){if(e.getModel()!==this.textModel)throw new pt;const o=this.inlineCompletionState.get();if(!o||o.primaryGhostText.isEmpty()||!o.inlineSuggestion)return;const r=o.primaryGhostText,a=o.inlineSuggestion;if(a.snippetInfo){await this.accept(e);return}const l=r.parts[0],d=new B(r.lineNumber,l.column),c=l.text,h=i(d,c);if(h===c.length&&r.parts.length===1){this.accept(e);return}const u=c.substring(0,h),g=this._positions.get(),p=g[0];a.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const v=x.fromPositions(p,d),C=e.getModel().getValueInRange(v)+u,w=new Be(v,C),y=[w,..._u(this.textModel,g,w)].filter(Tn),D=nC(y).map(b=>ie.fromPositions(b));e.edit(Ln.fromParallelReplacementsUnsorted(y),this._getMetadata(a,this.textModel.getLanguageId(),t)),e.setSelections(D,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}const f=x.fromPositions(a.editRange.getStartPosition(),rn.ofText(u).addToPosition(d)),_=e.getModel().getValueInRange(f,1).length;a.reportPartialAccept(_,{kind:s,acceptedLength:_},{characters:h,ratio:h/c.length,count:1})}finally{a.removeRef()}}handleSuggestAccepted(e){const t=ms(e.getSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const s=this.textModel.getValueInRange(i.completion.editRange,1).length+t.text.length;i.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:s},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){return{documentValue:this.textModel.getValue(),inlineCompletion:this.state.get()?.inlineSuggestion?.getSourceCompletion()}}jump(){const e=this.inlineEditState.get();if(!e)return;const t=e.inlineSuggestion;if(!t.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}t.addRef();try{Vi(i=>{t.action?.kind==="jumpTo"&&(this.stop(void 0,i),t.reportEndOfLife({kind:rs.Accepted,alternativeAction:!1})),this._jumpedToId.set(e.inlineSuggestion.semanticId,i),this.dontRefetchSignal.trigger(i);const s=e.inlineSuggestion.targetRange,o=s.getStartPosition();if(this._editor.setPosition(o,"inlineCompletions.jump"),s.isSingleLine()&&(e.inlineSuggestion.hint||e.inlineSuggestion.action?.kind==="edit"&&!e.inlineSuggestion.action.textReplacement.text.includes(`
|
|
41
|
+
`))||e.inlineSuggestion.action?.kind==="jumpTo")this._editor.revealPosition(o,0);else{const r=new x(s.startLineNumber-1,1,s.endLineNumber+1,1);this._editor.revealRange(r,0)}e.inlineSuggestion.identity.setJumpTo(i),this._editor.focus()})}finally{t.removeRef()}}async handleInlineSuggestionShown(e,t,i,s){await e.reportInlineEditShown(this._commandService,t,i,this.textModel,s)}transplantCompletion(e){Vi(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};Xp=ZF([$n(8,ne),$n(9,ht),$n(10,ct),$n(11,So),$n(12,X),$n(13,Ze),$n(14,aP),$n(15,d0)],Xp);var xn;(function(n){n[n.Undo=0]="Undo",n[n.Redo=1]="Redo",n[n.AcceptWord=2]="AcceptWord",n[n.Other=3]="Other"})(xn||(xn={}));function _u(n,e,t){if(e.length===1)return[];const i=new wm(n),s=i.getTransformer(),o=s.getOffset(e[0]),r=e.slice(1).map(h=>s.getOffset(h));t=t.removeCommonPrefixAndSuffix(i);const a=s.getStringReplacement(t),l=a.replaceRange.start-o,d=a.replaceRange.join(Ke.emptyAt(o)),c=i.getValueOfOffsetRange(d);return r.map(h=>{const u=h+l,g=u+a.replaceRange.length,p=new Ke(u,g),f=p.join(Ke.emptyAt(h));if(i.getValueOfOffsetRange(f)!==c)return;const _=new si(p,a.newText);return s.getTextReplacement(_)}).filter(Tn)}var XF=class extends M{constructor(n,e,t){super(),t&&this._register({dispose:()=>t()}),this._register(je(n).setDecorations(ye(e.map(s=>({range:s,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));const i=new ZA(KA.startNow(1,0,1e3,GA));this._register(ge(s=>{const o=i.getValue(s);n.getContainerDomNode().style.setProperty("--animation-opacity",o.toString()),i.isFinished(s)&&this.dispose()}))}};function XI(n,e,t=void 0){const i=e.targetRange;je(n).scrollTop.read(t);const s=n.getVisibleRanges();return s.length<1?!1:new x(s[0].startLineNumber,s[0].startColumn,s[s.length-1].endLineNumber,s[s.length-1].endColumn).containsRange(i)}function gC(n){if(n?.entitlementsData?.access_type_sku&&n?.entitlementsData?.copilot_plan)return{type:n.entitlementsData.access_type_sku,plan:n.entitlementsData.copilot_plan}}var YF=class{constructor(n){this.handler=e=>this._cb?.(e),this._cb=n}dispose(){this._cb=void 0}};function JF(n,e){const t=new YF(n);return e.add(t),t.handler}var QF=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},pC=function(n,e){return function(t,i){e(t,i,n)}},fa,O_=class{constructor(n){this.name=n}select(n,e,t){if(t.length===0)return 0;const i=t[0].score[0];for(let s=0;s<t.length;s++){const{score:o,completion:r}=t[s];if(o[0]!==i)break;if(r.preselect)return s}return 0}},fC=class extends O_{constructor(){super("first")}memorize(n,e,t){}toJSON(){}fromJSON(){}},eH=class extends O_{constructor(){super("recentlyUsed"),this._cache=new fl(300,.66),this._seq=0}memorize(n,e,t){const i=`${n.getLanguageId()}/${t.textLabel}`;this._cache.set(i,{touch:this._seq++,type:t.completion.kind,insertText:t.completion.insertText})}select(n,e,t){if(t.length===0)return 0;const i=n.getLineContent(e.lineNumber).substr(e.column-10,e.column-1);if(/\s$/.test(i))return super.select(n,e,t);const s=t[0].score[0];let o=-1,r=-1,a=-1;for(let l=0;l<t.length&&t[l].score[0]===s;l++){const d=`${n.getLanguageId()}/${t[l].textLabel}`,c=this._cache.peek(d);if(c&&c.touch>a&&c.type===t[l].completion.kind&&c.insertText===t[l].completion.insertText&&(a=c.touch,r=l),t[l].completion.preselect&&o===-1)return o=l}return r!==-1?r:o!==-1?o:0}toJSON(){return this._cache.toJSON()}fromJSON(n){this._cache.clear();const e=0;for(const[t,i]of n)i.touch=e,i.type=typeof i.type=="number"?i.type:nh.fromString(i.type),this._cache.set(t,i);this._seq=this._cache.size}},tH=class extends O_{constructor(){super("recentlyUsedByPrefix"),this._trie=aT.forStrings(),this._seq=0}memorize(n,e,t){const{word:i}=n.getWordUntilPosition(e),s=`${n.getLanguageId()}/${i}`;this._trie.set(s,{type:t.completion.kind,insertText:t.completion.insertText,touch:this._seq++})}select(n,e,t){const{word:i}=n.getWordUntilPosition(e);if(!i)return super.select(n,e,t);const s=`${n.getLanguageId()}/${i}`;let o=this._trie.get(s);if(o||(o=this._trie.findSubstr(s)),o)for(let r=0;r<t.length;r++){const{kind:a,insertText:l}=t[r].completion;if(a===o.type&&l===o.insertText)return r}return super.select(n,e,t)}toJSON(){const n=[];return this._trie.forEach((e,t)=>n.push([t,e])),n.sort((e,t)=>-(e[1].touch-t[1].touch)).forEach((e,t)=>e[1].touch=t),n.slice(0,200)}fromJSON(n){if(this._trie.clear(),n.length>0){this._seq=n[0][1].touch+1;for(const[e,t]of n)t.type=typeof t.type=="number"?t.type:nh.fromString(t.type),this._trie.set(e,t)}}},Yp=class{static{fa=this}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",tH],["recentlyUsed",eH],["first",fC]])}static{this._storagePrefix="suggest/memories"}constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new O,this._persistSoon=new at(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===ym.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(this._strategy?.name!==i){this._saveState();const s=fa._strategyCtors.get(i)||fC;this._strategy=new s;try{const o=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,r=this._storageService.get(`${fa._storagePrefix}/${i}`,o);r&&this._strategy.fromJSON(JSON.parse(r))}catch{}}return this._strategy}_saveState(){if(this._strategy){const e=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,t=JSON.stringify(this._strategy);this._storageService.store(`${fa._storagePrefix}/${this._strategy.name}`,t,e,1)}}};Yp=fa=QF([pC(0,Ni),pC(1,Ee)],Yp);var Mh=fn("ISuggestMemories");zn(Mh,Yp,1);var iH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},nH=function(n,e){return function(t,i){e(t,i,n)}},Jp,Nc=class{static{Jp=this}static{this.AtEnd=new ae("atEndOfWord",!1,{type:"boolean",description:m(1568,"A context key that is true when at the end of a word. Note that this is only defined when tab-completions are enabled")})}constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=Jp.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(139)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(139)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),s=this._editor.getSelection(),o=i.getWordAtPosition(s.getStartPosition());if(!o){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(o.endColumn===s.getStartPosition().column&&s.getStartPosition().lineNumber===s.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}};Nc=Jp=iH([nH(1,Ce)],Nc);var sH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},oH=function(n,e){return function(t,i){e(t,i,n)}},ma,Ir=class{static{ma=this}static{this.OtherSuggestions=new ae("hasOtherSuggestions",!1)}constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=ma.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(ma._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let s=i;for(let o=t.items.length;o>0&&(s=(s+t.items.length+(e?1:-1))%t.items.length,!(s===i||!t.items[s].completion.additionalTextEdits));o--);return s}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=ma._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};Ir=ma=sH([oH(1,Ce)],Ir);var rH=class{constructor(n,e,t,i){this._disposables=new O,this._disposables.add(t.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(t.onDidCancel(s=>{this.reset()})),this._disposables.add(e.onDidShow(()=>this._onItem(e.getFocusedItem()))),this._disposables.add(e.onDidFocus(this._onItem,this)),this._disposables.add(e.onDidHide(this.reset,this)),this._disposables.add(n.onWillType(s=>{if(this._active&&!e.isFrozen()&&t.state!==0){const o=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(o)&&n.getOption(0)&&i(this._active.item)}}))}_onItem(n){if(!n||!Gt(n.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===n.item)return;const e=new ac;for(const t of n.item.completion.commitCharacters)t.length>0&&e.add(t.charCodeAt(0));this._active={acceptCharacters:e,item:n}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}},mC=class{constructor(n,e){this.leadingLineContent=n,this.characterCountDelta=e}},YI=class $o{constructor(e,t,i,s,o,r,a=BS.default,l=void 0){this.clipboardText=l,this._snippetCompareFn=$o._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=s,this._options=o,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,r==="top"?this._snippetCompareFn=$o._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=$o._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<e.characterCountDelta&&this._filteredItems?2:1,this._lineContext=e)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const e=new Set;for(const[t,i]of this.getItemsByProvider())i.length>0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let s="",o="";const r=this._refilterKind===1?this._items:this._filteredItems,a=[],l=!this._options.filterGraceful||r.length>2e3?$S:JE;for(let d=0;d<r.length;d++){const c=r[d];if(c.isInvalid)continue;const h=this._itemsByProvider.get(c.provider);h?h.push(c):this._itemsByProvider.set(c.provider,[c]);const u=c.position.column-c.editStart.column,g=u+i-(c.position.column-this._column);if(s.length!==g&&(s=g===0?"":t.slice(-g),o=s.toLowerCase()),c.word=s,g===0)c.score=Wa.Default;else{let p=0;for(;p<u;){const f=s.charCodeAt(p);if(f===32||f===9)p+=1;else break}if(p>=g)c.score=Wa.Default;else if(typeof c.completion.filterText=="string"){const f=l(s,o,p,c.completion.filterText,c.filterTextLow,0,this._fuzzyScoreOptions);if(!f)continue;cR(c.completion.filterText,c.textLabel)===0?c.score=f:(c.score=H0(s,o,p,c.textLabel,c.labelLow,0),c.score[0]=f[0])}else{const f=l(s,o,p,c.textLabel,c.labelLow,0,this._fuzzyScoreOptions);if(!f)continue;c.score=f}}c.idx=d,c.distance=this._wordDistance.distance(c.position,c.completion),a.push(c),e.push(c.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?eP(e.length-.85,e,(d,c)=>d-c):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]<t.score[0]?1:e.distance<t.distance?-1:e.distance>t.distance?1:e.idx<t.idx?-1:e.idx>t.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return 1;if(t.completion.kind===28)return-1}return $o._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return-1;if(t.completion.kind===28)return 1}return $o._compareCompletionItems(e,t)}},JI=class en{async provideSelectionRanges(e,t){const i=[];for(const s of t){const o=[];i.push(o);const r=new Map;await new Promise(a=>en._bracketsRightYield(a,0,e,s,r)),await new Promise(a=>en._bracketsLeftYield(a,0,e,s,r,o))}return i}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(e,t,i,s,o){const r=new Map,a=Date.now();for(;;){if(t>=en._maxRounds){e();break}if(!s){e();break}const l=i.bracketPairs.findNextBracket(s);if(!l){e();break}if(Date.now()-a>en._maxDuration){setTimeout(()=>en._bracketsRightYield(e,t+1,i,s,o));break}if(l.bracketInfo.isOpeningBracket){const d=l.bracketInfo.bracketText,c=r.has(d)?r.get(d):0;r.set(d,c+1)}else{const d=l.bracketInfo.getOpeningBrackets()[0].bracketText;let c=r.has(d)?r.get(d):0;if(c-=1,r.set(d,Math.max(0,c)),c<0){let h=o.get(d);h||(h=new Tw,o.set(d,h)),h.push(l.range)}}s=l.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,s,o,r){const a=new Map,l=Date.now();for(;;){if(t>=en._maxRounds&&o.size===0){e();break}if(!s){e();break}const d=i.bracketPairs.findPrevBracket(s);if(!d){e();break}if(Date.now()-l>en._maxDuration){setTimeout(()=>en._bracketsLeftYield(e,t+1,i,s,o,r));break}if(d.bracketInfo.isOpeningBracket){const c=d.bracketInfo.bracketText;let h=a.has(c)?a.get(c):0;if(h-=1,a.set(c,Math.max(0,h)),h<0){const u=o.get(c);if(u){const g=u.shift();u.size===0&&o.delete(c);const p=x.fromPositions(d.range.getEndPosition(),g.getStartPosition()),f=x.fromPositions(d.range.getStartPosition(),g.getEndPosition());r.push({range:p}),r.push({range:f}),en._addBracketLeading(i,f,r)}}}else{const c=d.bracketInfo.getOpeningBrackets()[0].bracketText,h=a.has(c)?a.get(c):0;a.set(c,h+1)}s=d.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const s=t.startLineNumber,o=e.getLineFirstNonWhitespaceColumn(s);o!==0&&o!==t.startColumn&&(i.push({range:x.fromPositions(new B(s,o),t.getEndPosition())}),i.push({range:x.fromPositions(new B(s,1),t.getEndPosition())}));const r=s-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:x.fromPositions(new B(r,a),t.getEndPosition())}),i.push({range:x.fromPositions(new B(r,1),t.getEndPosition())}))}}},QI=class es{static{this.None=new class extends es{distance(){return 0}}}static async create(e,t){if(!t.getOption(134).localityBonus||!t.hasModel())return es.None;const i=t.getModel(),s=t.getPosition();if(!e.canComputeWordRanges(i.uri))return es.None;const[o]=await new JI().provideSelectionRanges(i,[s]);if(o.length===0)return es.None;const r=await e.computeWordRanges(i.uri,o[0].range);if(!r)return es.None;const a=i.getWordUntilPosition(s);return delete r[a.word],new class extends es{distance(l,d){if(!s.equals(t.getPosition()))return 0;if(d.kind===17)return 2<<20;const c=typeof d.label=="string"?d.label:d.label.label,h=r[c];if(nR(h))return 2<<20;const u=og(h,x.fromPositions(l),x.compareRangesUsingStarts),g=u>=0?h[u]:h[Math.max(0,~u-1)];let p=o.length;for(const f of o){if(!x.containsRange(f.range,g))break;p-=1}return p}}}},aH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Kn=function(n,e){return function(t,i){e(t,i,n)}},Qp,Bs=class{static shouldAutoTrigger(n){if(!n.hasModel())return!1;const e=n.getModel(),t=n.getPosition();e.tokenization.tokenizeIfCheap(t.lineNumber);const i=e.getWordAtPosition(t);return!(!i||i.endColumn!==t.column&&i.startColumn+1!==t.column||!isNaN(Number(i.word)))}constructor(n,e,t){this.leadingLineContent=n.getLineContent(e.lineNumber).substr(0,e.column-1),this.leadingWord=n.getWordUntilPosition(e),this.lineNumber=e.lineNumber,this.column=e.column,this.triggerOptions=t}};function lH(n,e,t){if(!e.getContextKeyValue(Se.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(Se.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(71).suppressSuggestions}function dH(n,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(Se.suppressSuggestions.key);return i!==void 0?!i:!n.getOption(71).suppressSuggestions}var Mc=Qp=class{constructor(e,t,i,s,o,r,a,l,d){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=s,this._logService=o,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=l,this._envService=d,this._toDispose=new O,this._triggerCharacterListener=new O,this._triggerQuickSuggest=new vl,this._triggerState=void 0,this._completionDisposables=new O,this._onDidCancel=new ee,this._onDidTrigger=new ee,this._onDidSuggest=new ee,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._currentSelection=this._editor.getSelection()||new ie(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let c=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{c=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{c=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(h=>{c||this._onCursorChange(h)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!c&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Pt(this._triggerCharacterListener),Pt([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._waitForInlineCompletions?.dispose(),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(104)||!this._editor.hasModel()||!this._editor.getOption(137))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const s of i.triggerCharacters||[]){let o=e.get(s);o||(o=new Set,e.set(s,o)),o.add(i)}const t=i=>{if(!dH(this._editor,this._contextKeyService,this._configurationService)||Bs.shouldAutoTrigger(this._editor))return;if(!i){const r=this._editor.getPosition();i=this._editor.getModel().getLineContent(r.lineNumber).substr(0,r.column-1)}let s="";zR(i.charCodeAt(i.length-1))?hT(i.charCodeAt(i.length-2))&&(s=i.substr(i.length-2)):s=i.charAt(i.length-1);const o=e.get(s);if(o){const r=new Map;if(this._completionModel)for(const[a,l]of this._completionModel.getItemsByProvider())o.has(a)||r.set(a,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:s,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:o,providerItemsToReuse:r}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){this._triggerQuickSuggest.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerState!==void 0&&(this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){tr.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&_t.get(this._editor)?.isInSnippet()||(this.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!Bs.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=this._editor.getOption(102);if(tr.isAllOff(i))return;let s=!1;if(!tr.isAllOn(i)){e.tokenization.tokenizeIfCheap(t.lineNumber);const o=e.tokenization.getLineTokens(t.lineNumber),r=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(t.column-1-1,0))),a=tr.valueFor(i,r);if(a==="off"||a==="inline")return;a==="offWhenInlineCompletions"&&(s=this._languageFeaturesService.inlineCompletionsProvider.has(e)&&this._editor.getOption(71).enabled)}lH(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&(s?this._waitForInlineCompletionsAndTrigger(e,t):this.trigger({auto:!0}))},this._editor.getOption(103)))}_waitForInlineCompletionsAndTrigger(e,t){const i=e.getVersionId(),s=ZI(this._editor),o=s?.model.get();if(!s||!o){this.trigger({auto:!0});return}if(o.state.get()?.inlineSuggestion)return;const r=new O;this._waitForInlineCompletions=r;const a=l=>{if(r.dispose(),this._waitForInlineCompletions===r&&(this._waitForInlineCompletions=void 0),this._triggerState!==void 0||!l)return;const d=this._editor.getModel(),c=this._editor.getPosition();d===e&&d.getVersionId()===i&&c?.equals(t)&&this._editor.hasWidgetFocus()&&this.trigger({auto:!0})};ji(()=>{a(!0),o.stop("automatic")},750,r),oR(r,l=>{if(s.model.read(l)!==o){l.dispose(),a(!1);return}const d=o.status.read(l),c=o.state.read(l);!c&&d==="loading"||(l.dispose(),a(!c))})}_refilterCompletionItems(){Ie(this._editor.hasModel()),Ie(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new Bs(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new Bs(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let s={triggerKind:e.triggerKind??0};e.triggerCharacter&&(s={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new ot;const o=this._editor.getOption(128);let r=1;switch(o){case"top":r=0;break;case"bottom":r=2}const{itemKind:a,showDeprecated:l}=Qp.createSuggestFilter(this._editor),d=new R_(r,e.completionOptions?.kindFilter??a,e.completionOptions?.providerFilter,e.completionOptions?.providerItemsToReuse,l),c=QI.create(this._editorWorkerService,this._editor),h=T_(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),d,s,this._requestToken.token);Promise.all([h,c]).then(async([u,g])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){u.disposable.dispose();return}let p=e?.clipboardText;if(!p&&u.needsClipboard&&(p=await this._clipboardService.readText()),this._triggerState===void 0){u.disposable.dispose();return}const f=this._editor.getModel(),_=new Bs(f,this._editor.getPosition(),e),v={...BS.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new YI(u.items,this._context.column,{leadingLineContent:_.leadingLineContent,characterCountDelta:_.column-this._context.column},g,this._editor.getOption(134),this._editor.getOption(128),v,p),this._completionDisposables.add(u.disposable),this._onNewContext(_),this._reportDurationsTelemetry(u.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const C of u.items)C.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${C.provider._debugDisplayName}`,C.completion)}).catch(Le)}_reportDurationsTelemetry(e){Math.random()>1e-4||setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(128)==="none"&&t.add(28);const i=e.getOption(134);return i.showMethods||t.add(0),i.showFunctions||t.add(1),i.showConstructors||t.add(2),i.showFields||t.add(3),i.showVariables||t.add(4),i.showClasses||t.add(5),i.showStructs||t.add(6),i.showInterfaces||t.add(7),i.showModules||t.add(8),i.showProperties||t.add(9),i.showEvents||t.add(10),i.showOperators||t.add(11),i.showUnits||t.add(12),i.showValues||t.add(13),i.showConstants||t.add(14),i.showEnums||t.add(15),i.showEnumMembers||t.add(16),i.showKeywords||t.add(17),i.showWords||t.add(18),i.showColors||t.add(19),i.showFiles||t.add(20),i.showReferences||t.add(21),i.showColors||t.add(22),i.showFolders||t.add(23),i.showTypeParameters||t.add(24),i.showSnippets||t.add(28),i.showUsers||t.add(25),i.showIssues||t.add(26),{itemKind:t,showDeprecated:i.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(It(e.leadingLineContent)!==It(this._context.leadingLineContent)){this.cancel();return}if(e.column<this._context.column){e.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(e.leadingWord.word.length!==0&&e.leadingWord.startColumn>this._context.leadingWord.startColumn){if(Bs.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}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[s,o]of this._completionModel.getItemsByProvider())o.length>0&&o[0].container.incomplete?i.add(s):t.set(s,o);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const s=Bs.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(s&&this._context.leadingWord.endColumn<e.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=t,i=this._completionModel.items.length>0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};Mc=Qp=aH([Kn(1,Vn),Kn(2,oi),Kn(3,Rs),Kn(4,Ot),Kn(5,Ce),Kn(6,Ee),Kn(7,X),Kn(8,rR)],Mc);var cH=class eL{static{this._maxSelectionLength=51200}constructor(e,t){this._disposables=new O,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),s=i.length;let o=!1;for(let a=0;a<s;a++)if(!i[a].isEmpty()){o=!0;break}if(!o){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];const r=e.getModel();for(let a=0;a<s;a++){const l=i[a];if(r.getValueLengthInRange(l)>eL._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}},hH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},vu=function(n,e){return function(t,i){e(t,i,n)}},ef=class{constructor(e,t,i,s,o,r){this._menuId=t,this._menuService=o,this._contextKeyService=r,this._menuDisposables=new O,this.element=U(e,H(".suggest-status-bar"));const a=(l=>i?.showIconsNoKeybindings?l instanceof co?s.createInstance(Dm,l,void 0):void 0:l instanceof co?s.createInstance(UE,l,{useComma:!1}):void 0);this._leftActions=new _s(this.element,{actionViewItemProvider:a}),this._rightActions=new _s(this.element,{actionViewItemProvider:a}),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 e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],s=[];for(const[o,r]of e.getActions())o==="left"?i.push(...r):s.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(s)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};ef=hH([vu(3,ne),vu(4,Ts),vu(5,Ce)],ef);var uH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},_C=function(n,e){return function(t,i){e(t,i,n)}};function A_(n){return!!n&&!!(n.completion.documentation||n.completion.detail&&n.completion.detail!==n.completion.label)}var tf=class{constructor(e,t,i){this._editor=e,this._themeService=t,this._markdownRendererService=i,this._onDidClose=new ee,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new ee,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new O,this._renderDisposeable=new O,this._size=new Pe(330,0),this.domNode=H(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=H(".body"),this._scrollbar=new um(this._body,{alwaysConsumeMouseWheel:!0}),U(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=U(this._body,H(".header")),this._close=U(this._header,H("span"+ce.asCSSSelector(V.close))),this._close.title=m(1563,"Close"),this._close.ariaLabel=m(1564,"Close"),this._close.role="button",this._close.tabIndex=-1,this._type=U(this._header,H("p.type")),this._docs=U(this._body,H("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(59),i=t.getMassagedFontFamily(),s=e.get(135)||t.fontSize,o=e.get(136)||t.lineHeight,r=t.fontWeight,a=`${s}px`,l=`${o}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${o/s}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){const e=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,t=Aa(this._themeService.getColorTheme().type)?2:1;return{lineHeight:e,borderWidth:t,borderHeight:t*2,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=m(1565,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){this._renderDisposeable.clear();let{detail:i,documentation:s}=e.completion;if(t){let o="";o+=`score: ${e.score[0]}
|
|
42
|
+
`,o+=`prefix: ${e.word??"(no prefix)"}
|
|
43
|
+
`,o+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
|
|
44
|
+
`,o+=`distance: ${e.distance} (localityBonus-setting)
|
|
45
|
+
`,o+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
|
|
46
|
+
`,o+=`commit_chars: ${e.completion.commitCharacters?.join("")}
|
|
47
|
+
`,s=new St().appendCodeblock("empty",o),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!A_(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const o=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=o,this._type.title=o,Li(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gim.test(o))}else ni(this._type),this._type.title="",ii(this._type),this.domNode.classList.add("no-type");if(ni(this._docs),typeof s=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=s;else if(s){this._docs.classList.add("markdown-docs"),ni(this._docs);const o=this._markdownRendererService.render(s,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(o.element),this._renderDisposeable.add(o)}this.domNode.classList.toggle("detail-and-doc",!!i&&!!s),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=o=>{o.preventDefault(),o.stopPropagation()},this._close.onclick=o=>{o.preventDefault(),o.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new Pe(e,t);Pe.equals(i,this._size)||(this._size=i,bE(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}focus(){this.domNode.focus()}};tf=uH([_C(1,Dt),_C(2,Es)],tf);var gH=class{constructor(n,e){this.widget=n,this._editor=e,this.allowEditorOverflow=!0,this._disposables=new O,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new h_,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(n.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let t,i,s=0,o=0;this._disposables.add(this._resizable.onDidWillResize(()=>{t=this._topLeft,i=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(r=>{if(t&&i){this.widget.layout(r.dimension.width,r.dimension.height);let a=!1;r.west&&(o=i.width-r.dimension.width,a=!0),r.north&&(s=i.height-r.dimension.height,a=!0),a&&this._applyTopLeft({top:t.top+s,left:t.left+o})}r.done&&(t=void 0,i=void 0,s=0,o=0,this._userSize=r.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??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 this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(n=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),n&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(n,e){const t=n.getBoundingClientRect();this._anchorBox=t,this._preferAlignAtTop=e,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,e)}_placeAtAnchor(n,e,t){const i=ml(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),o=new Pe(220,2*s.lineHeight),r=n.top,a=(function(){const D=i.width-(n.left+n.width+s.borderWidth+s.horizontalPadding),b=-s.borderWidth+n.left+n.width,I=new Pe(D,i.height-n.top-s.borderHeight-s.verticalPadding),N=I.with(void 0,n.top+n.height-s.borderHeight-s.verticalPadding);return{top:r,left:b,fit:D-e.width,maxSizeTop:I,maxSizeBottom:N,minSize:o.with(Math.min(D,o.width))}})(),l=(function(){const D=n.left-s.borderWidth-s.horizontalPadding,b=Math.max(s.horizontalPadding,n.left-e.width-s.borderWidth),I=new Pe(D,i.height-n.top-s.borderHeight-s.verticalPadding),N=I.with(void 0,n.top+n.height-s.borderHeight-s.verticalPadding);return{top:r,left:b,fit:D-e.width,maxSizeTop:I,maxSizeBottom:N,minSize:o.with(Math.min(D,o.width))}})(),d=(function(){const D=n.left,b=-s.borderWidth+n.top+n.height,I=new Pe(n.width-s.borderHeight,i.height-n.top-n.height-s.verticalPadding);return{top:b,left:D,fit:I.height-e.height,maxSizeBottom:I,maxSizeTop:I,minSize:o.with(I.width)}})(),c=(function(){const D=n.left,b=new Pe(n.width-s.borderHeight,n.top-s.verticalPadding);return{top:Math.max(s.verticalPadding,n.top-e.height),left:D,fit:b.height-e.height,maxSizeTop:b,maxSizeBottom:b,minSize:o.with(b.width)}})(),h=[a,l,t?d:c],u=h.find(D=>D.fit>=0)??h.sort((D,b)=>b.fit-D.fit)[0],g=n.top+n.height-s.borderHeight;let p,f=e.height;const _=Math.max(u.maxSizeTop.height,u.maxSizeBottom.height);f>_&&(f=_);let v;t?f<=u.maxSizeTop.height?(p=!0,v=u.maxSizeTop):(p=!1,v=u.maxSizeBottom):f<=u.maxSizeBottom.height?(p=!1,v=u.maxSizeBottom):(p=!0,v=u.maxSizeTop);let{top:C,left:w}=u;u===c?C=n.top-f+s.borderWidth:!p&&f>n.height&&(C=g-f);const y=this._editor.getDomNode();if(y){const D=y.getBoundingClientRect();C-=D.top,w-=D.left}this._applyTopLeft({left:w,top:C}),u===c?this._resizable.enableSashes(!0,!1,!1,!0):this._resizable.enableSashes(!p,u===a,p,u!==a),this._resizable.minSize=u.minSize,this._resizable.maxSize=v,this._resizable.layout(f,Math.min(v.width,e.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(n){this._topLeft=n,this._editor.layoutOverlayWidget(this)}},vC=fn("fileService"),Bi;(function(n){n[n.FILE=0]="FILE",n[n.FOLDER=1]="FOLDER",n[n.ROOT_FOLDER=2]="ROOT_FOLDER"})(Bi||(Bi={}));var pH=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function _a(n,e,t,i,s){if(ce.isThemeIcon(s))return[`codicon-${s.id}`,"predefined-file-icon"];if(ke.isUri(s))return[];const o=i===Bi.ROOT_FOLDER?["rootfolder-icon"]:i===Bi.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===Ct.data)r=ic.parseMetaData(t).get(ic.META_DATA_LABEL);else{const a=t.path.match(pH);a?(r=rd(a[2].toLowerCase()),a[1]&&o.push(`${rd(a[1].toLowerCase())}-name-dir-icon`)):r=rd(t.authority.toLowerCase())}if(i===Bi.ROOT_FOLDER)o.push(`${r}-root-name-folder-icon`);else if(i===Bi.FOLDER)o.push(`${r}-name-folder-icon`);else{if(r){if(o.push(`${r}-name-file-icon`),o.push("name-file-icon"),r.length<=255){const l=r.split(".");for(let d=1;d<l.length;d++)o.push(`${l.slice(d).join(".")}-ext-file-icon`)}o.push("ext-file-icon")}const a=fH(n,e,t);a&&o.push(`${rd(a)}-lang-file-icon`)}}return o}function fH(n,e,t){if(!t)return null;let i=null;if(t.scheme===Ct.data){const s=ic.parseMetaData(t).get(ic.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const s=n.getModel(t);s&&(i=s.getLanguageId())}return i&&i!=="plaintext"?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function rd(n){return n.replace(/[\s]/g,"/")}var mH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},bu=function(n,e){return function(t,i){e(t,i,n)}},_H=Ye("suggest-more-info",V.chevronRight,m(1566,"Icon for more information in the suggest widget.")),vH=new class va{static{this._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*\))/}static{this._regexStrict=new RegExp(`^${va._regexRelaxed.source}$`,"i")}extract(e,t){if(e.textLabel.match(va._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(va._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,s=va._regexRelaxed.exec(i);if(s&&(s.index===0||s.index+s[0].length===i.length))return t[0]=s[0],!0}return!1}},nf=class{constructor(e,t,i,s){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=s,this._onDidToggleDetails=new ee,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new O,i=e;i.classList.add("show-file-icons");const s=U(e,H(".icon")),o=U(s,H("span.colorspan")),r=U(e,H(".contents")),a=U(r,H(".main")),l=U(a,H(".icon-label.codicon")),d=U(a,H("span.left")),c=U(a,H("span.right")),h=new GS(d,{supportHighlights:!0,supportIcons:!0});t.add(h);const u=U(d,H("span.signature-label")),g=U(d,H("span.qualifier-label")),p=U(c,H("span.details-label")),f=U(c,H("span.readMore"+ce.asCSSSelector(_H)));return f.title=m(1567,"Read More"),{root:i,left:d,right:c,icon:s,colorspan:o,iconLabel:h,iconContainer:l,parametersLabel:u,qualifierLabel:g,detailsLabel:p,readMore:f,disposables:t,configureFont:()=>{const v=this._editor.getOptions(),C=v.get(59),w=C.getMassagedFontFamily(),y=C.fontFeatureSettings,D=C.fontVariationSettings,b=v.get(135)||C.fontSize,I=v.get(136)||C.lineHeight,N=C.fontWeight,T=C.letterSpacing,E=`${b}px`,F=`${I}px`,q=`${T}px`;i.style.fontSize=E,i.style.fontWeight=N,i.style.letterSpacing=q,a.style.fontFamily=w,a.style.fontFeatureSettings=y,a.style.fontVariationSettings=D,a.style.lineHeight=F,s.style.height=F,s.style.width=F,f.style.height=F,f.style.width=F}}}renderElement(e,t,i){i.configureFont();const{completion:s}=e;i.colorspan.style.backgroundColor="";const o={labelEscapeNewLines:!0,matches:ch(e.score)},r=[];if(s.kind===19&&vH.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(s.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=_a(this._modelService,this._languageService,ke.from({scheme:"fake",path:e.textLabel}),Bi.FILE),l=_a(this._modelService,this._languageService,ke.from({scheme:"fake",path:s.detail}),Bi.FILE);o.extraClasses=a.length>l.length?a:l}else s.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",o.extraClasses=[_a(this._modelService,this._languageService,ke.from({scheme:"fake",path:e.textLabel}),Bi.FOLDER),_a(this._modelService,this._languageService,ke.from({scheme:"fake",path:s.detail}),Bi.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...ce.asClassNameArray(nh.toIcon(s.kind))));s.tags&&s.tags.indexOf(1)>=0&&(o.extraClasses=(o.extraClasses||[]).concat(["deprecated"]),o.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,o),typeof s.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=Cu(s.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=Cu(s.label.detail||""),i.detailsLabel.textContent=Cu(s.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?Li(i.detailsLabel):ii(i.detailsLabel),A_(e)?(i.right.classList.add("can-expand-details"),Li(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),ii(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};nf=mH([bu(1,Yt),bu(2,Bn),bu(3,Dt)],nf);function Cu(n){return n.replace(/\r\n|\r|\n/g,"")}var bH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ad=function(n,e){return function(t,i){e(t,i,n)}},Ko,Oc=W("editorSuggestWidget.background",vm,m(1545,"Background color of the suggest widget."));W("editorSuggestWidget.border",xw,m(1546,"Border color of the suggest widget."));var sf=W("editorSuggestWidget.foreground",yl,m(1547,"Foreground color of the suggest widget.")),bC=W("editorSuggestWidget.selectedForeground",{dark:hg,light:hg,hcDark:Oc,hcLight:Oc},m(1548,"Foreground color of the selected entry in the suggest widget."));W("editorSuggestWidget.selectedIconForeground",{dark:ov,light:ov,hcDark:Oc,hcLight:Oc},m(1549,"Icon foreground color of the selected entry in the suggest widget."));var CH=W("editorSuggestWidget.selectedBackground",{dark:tg,light:tg,hcDark:sf,hcLight:sf},m(1550,"Background color of the selected entry in the suggest widget.")),SH=W("editorSuggestWidget.focusOutline",so,m(1551,"Outline color of the focused (keyboard-navigated) entry in the suggest widget."));W("editorSuggestWidget.highlightForeground",hw,m(1552,"Color of the match highlights in the suggest widget."));W("editorSuggestWidget.focusHighlightForeground",{dark:yv,light:yv,hcDark:bC,hcLight:bC},m(1553,"Color of the match highlights in the suggest widget when an item is focused."));W("editorSuggestWidgetStatus.foreground",st(sf,.5),m(1554,"Foreground color of the suggest widget status."));var wH=class{constructor(n,e){this._service=n,this._key=`suggestWidget.size/${e.getEditorType()}/${e instanceof un}`}restore(){const n=this._service.get(this._key,0)??"";try{const e=JSON.parse(n);if(Pe.is(e))return Pe.lift(e)}catch{}}store(n){this._service.store(this._key,JSON.stringify(n),0,1)}reset(){this._service.remove(this._key,0)}},of=class{static{Ko=this}static{this.LOADING_MESSAGE=m(1555,"Loading...")}static{this.NO_SUGGESTIONS_MESSAGE=m(1556,"No suggestions.")}constructor(e,t,i,s,o){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._loadingTimeout=new We,this._pendingLayout=new We,this._pendingShowDetails=new We,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new vl,this._disposables=new O,this._onDidSelect=new Mv,this._onDidFocus=new Mv,this._onDidHide=new ee,this._onDidShow=new ee,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new ee,this.element=new h_,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new yH(this,e),this._persistedSize=new wH(t,e);class r{constructor(f,_,v=!1,C=!1){this.persistedSize=f,this.currentSize=_,this.persistHeight=v,this.persistWidth=C}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(p=>{if(this._resize(p.dimension.width,p.dimension.height),a&&(a.persistHeight=a.persistHeight||!!p.north||!!p.south,a.persistWidth=a.persistWidth||!!p.east||!!p.west),!!p.done){if(a){const{itemHeight:f,defaultSize:_}=this.getLayoutInfo(),v=Math.round(f/2);let{width:C,height:w}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-w)<=v)&&(w=a.persistedSize?.height??_.height),(!a.persistWidth||Math.abs(a.currentSize.width-C)<=v)&&(C=a.persistedSize?.width??_.width),this._persistedSize.store(new Pe(C,w))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=U(this.element.domNode,H(".message")),this._listElement=U(this.element.domNode,H(".tree"));const l=this._disposables.add(o.createInstance(tf,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new gH(l,this.editor);const d=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);d();const c=()=>this.element.domNode.classList.toggle("fit-width-to-details",this.editor.getOption(134).fitWidthToDetails);c();const h=o.createInstance(nf,this.editor);this._disposables.add(h),this._disposables.add(h.onDidToggleDetails(()=>this.toggleDetails())),this._list=new Om("SuggestWidget",this._listElement,{getHeight:p=>this.getLayoutInfo().itemHeight,getTemplateId:p=>"suggestion"},[h],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>_m?"listitem":"option",getWidgetAriaLabel:()=>m(1557,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:p=>{let f=p.textLabel;const _=nh.toLabel(p.completion.kind);if(typeof p.completion.label!="string"){const{detail:y,description:D}=p.completion.label;y&&D?f=m(1558,"{0} {1}, {2}, {3}",f,y,D,_):y?f=m(1559,"{0} {1}, {2}",f,y,_):D&&(f=m(1560,"{0}, {1}, {2}",f,D,_))}else f=m(1561,"{0}, {1}",f,_);if(!p.isResolved||!this._isDetailsVisible())return f;const{documentation:v,detail:C}=p.completion,w=zm("{0}{1}",C||"",v?typeof v=="string"?v:v.value:"");return m(1562,"{0}, docs: {1}",f,w)}}}),this._list.style(kS({listInactiveFocusBackground:CH,listInactiveFocusOutline:SH})),this._status=o.createInstance(ef,this.element.domNode,kn,void 0);const u=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);u(),this._disposables.add(this._list.onMouseDown(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onTap(p=>this._onListMouseDownOrTap(p))),this._disposables.add(this._list.onDidChangeSelection(p=>this._onListSelection(p))),this._disposables.add(this._list.onDidChangeFocus(p=>this._onListFocus(p))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(p=>{p.hasChanged(134)&&(u(),d(),c()),this._completionModel&&(p.hasChanged(59)||p.hasChanged(135)||p.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=J.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=J.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=J.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=J.HasFocusedSuggestion.bindTo(i),this._ctxSuggestWidgetDetailsFocused=J.DetailsFocused.bindTo(i);const g=us(this._details.widget.domNode);this._disposables.add(g),this._disposables.add(g.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(g.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(hn(this._details.widget.domNode,"keydown",p=>{this._onDetailsKeydown.fire(p)})),this._disposables.add(this.editor.onMouseDown(p=>this._onEditorMouseDown(p)))}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose(),this._onDidSelect.dispose(),this._onDidFocus.dispose(),this._onDidHide.dispose(),this._onDidShow.dispose(),this._onDetailsKeydown.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onListFocus(e){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=mt(async s=>{const o=ji(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=s.onCancellationRequested(()=>o.dispose());try{return await t.resolve(s)}finally{o.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(i)}))}).catch(Le)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:ii(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=Ko.LOADING_MESSAGE,ii(this._listElement,this._status.element),Li(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Ss(Ko.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Ko.NO_SUGGESTIONS_MESSAGE,ii(this._listElement,this._status.element),Li(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Ss(Ko.NO_SUGGESTIONS_MESSAGE);break;case 3:ii(this._messageElement),Li(this._listElement,this._status.element),this._show();break;case 4:ii(this._messageElement),Li(this._listElement,this._status.element),this._show();break;case 5:ii(this._messageElement),Li(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus()}}_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(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout.value=ji(()=>this._setState(1),t)))}showSuggestions(e,t,i,s,o){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout.clear(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const r=this._completionModel.items.length,a=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),a){this._setState(s?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0,t===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(o?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=Vv(Nt(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(e=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(A_(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this._showDetails(!1,e))}_showDetails(e,t){this._pendingShowDetails.value=Vv(Nt(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let i=!1;e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),t&&(this._details.widget.focus(),i=!0)),i||this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout.clear(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(e){if(!this.editor.hasModel()||!this.editor.getDomNode())return;const t=ml(this.element.domNode.ownerDocument.body),i=this.getLayoutInfo();e||(e=i.defaultSize);let s=e.height,o=e.width;if(this._status.element.style.height=`${i.itemHeight}px`,this._state===2||this._state===1)s=i.itemHeight+i.borderHeight,o=i.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new Pe(o,s),this._contentWidget.setPreference(2);else{const r=t.width-i.borderHeight-2*i.horizontalPadding;o>r&&(o=r);let a=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:o;if(this.editor.getOption(134).fitWidthToDetails&&this._completionModel&&!this._persistedSize.restore()){const v=Math.min(r,this.editor.getLayoutInfo().width),C=Math.min(v,this._measureContentWidth(i));o=Math.max(o,C),a=Math.max(a,C)}const l=i.statusBarHeight+this._list.contentHeight+i.borderHeight,d=i.itemHeight+i.statusBarHeight,c=Mt(this.editor.getDomNode()),h=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),u=c.top+h.top+h.height,g=Math.min(t.height-u-i.verticalPadding,l),p=c.top+h.top-i.verticalPadding,f=Math.min(p,l);let _=Math.min(Math.max(f,g)+i.borderHeight,l);s===this._cappedHeight?.capped&&(s=this._cappedHeight.wanted),s<d&&(s=d),s>_&&(s=_),s>g&&f>g||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),_=f):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),_=g),this.element.preferredSize=new Pe(a,i.defaultSize.height),this.element.maxSize=new Pe(r,_),this.element.minSize=new Pe(220,d),this._cappedHeight=s===l?{wanted:this._cappedHeight?.wanted??e.height,capped:s}:void 0}this._resize(o,s)}_resize(e,t){const{width:i,height:s}=this.element.maxSize;e=Math.min(i,e),t=Math.min(s,t);const{statusBarHeight:o}=this.getLayoutInfo();this._list.layout(t-o,e),this._listElement.style.height=`${t-o}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}_measureContentWidth(e){const t=this._completionModel;if(!t)return 0;if(this._fitContentWidth?.model===t)return this._fitContentWidth.width;this._measureContext===void 0&&(this._measureContext=H("canvas").getContext("2d"));let i;if(this._measureContext){const r=this.editor.getOptions(),a=r.get(59),l=r.get(135)||a.fontSize;this._measureContext.font=`${a.fontWeight} ${l}px ${a.getMassagedFontFamily()}`,i=0;for(const d of t.items){const{completion:c}=d;let h=d.textLabel;typeof c.label=="string"?h+=c.detail??"":h+=(c.label.detail??"")+(c.label.description??""),i=Math.max(i,this._measureContext.measureText(h).width)}}else i=t.stats.pLabelLen*e.typicalHalfwidthCharacterWidth;const s=2*e.itemHeight+2*e.horizontalPadding+20,o=i+s;return this._fitContentWidth={model:t,width:o},o}getLayoutInfo(){const e=this.editor.getOption(59),t=eg(this.editor.getOption(136)||e.lineHeight,8,1e3),i=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:t,s=this._details.widget.getLayoutInfo().borderWidth;return{itemHeight:t,statusBarHeight:i,borderWidth:s,borderHeight:2*s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new Pe(430,i+12*t)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};of=Ko=bH([ad(1,Ni),ad(2,Ce),ad(3,Dt),ad(4,ne)],of);var yH=class{constructor(n,e){this._widget=n,this._editor=e,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?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:n,width:e}=this._widget.element.size,{borderWidth:t,horizontalPadding:i}=this._widget.getLayoutInfo();return new Pe(e+2*t+i,n+2*t)}afterRender(n){this._widget._afterRender(n)}setPreference(n){this._preferenceLocked||(this._preference=n)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(n){this._position=n}},xH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Fo=function(n,e){return function(t,i){e(t,i,n)}},rf,IH=class{constructor(n,e){if(this._model=n,this._position=e,this._decorationOptions=oe.register({description:"suggest-line-suffix",stickiness:1}),n.getLineMaxColumn(e.lineNumber)!==e.column){const t=n.getOffsetAt(e),i=n.getPositionAt(t+1);n.changeDecorations(s=>{this._marker&&s.removeDecoration(this._marker),this._marker=s.addDecoration(x.fromPositions(e,i),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(n=>{n.removeDecoration(this._marker),this._marker=void 0})}delta(n){if(this._model.isDisposed()||this._position.lineNumber!==n.lineNumber)return 0;if(this._marker){const e=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(e.getStartPosition())-this._model.getOffsetAt(n)}else return this._model.getLineMaxColumn(n.lineNumber)-n.column}},Ui=class{static{rf=this}static{this.ID="editor.contrib.suggestController"}static get(e){return e.getContribution(rf.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}constructor(e,t,i,s,o,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=s,this._instantiationService=o,this._logService=r,this._telemetryService=a,this._lineSuffix=new We,this._toDispose=new O,this._selectors=new LH(h=>h.priority),this._onWillInsertSuggestItem=new ee,this._wantsForceRenderingAbove=!1,this.editor=e,this.model=o.createInstance(Mc,this.editor),this._selectors.register({priority:0,select:(h,u,g)=>this._memoryService.select(h,u,g)});const l=J.InsertMode.bindTo(s);l.set(e.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(134).insertMode))),this.widget=this._toDispose.add(new $h(Nt(e.getDomNode()),()=>{const h=this._instantiationService.createInstance(of,this.editor);this._toDispose.add(h),this._toDispose.add(h.onDidSelect(_=>this._insertSuggestion(_,0),this));const u=new rH(this.editor,h,this.model,_=>this._insertSuggestion(_,2));this._toDispose.add(u);const g=J.MakesTextEdit.bindTo(this._contextKeyService),p=J.HasInsertAndReplaceRange.bindTo(this._contextKeyService),f=J.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(Te(()=>{g.reset(),p.reset(),f.reset()})),this._toDispose.add(h.onDidFocus(({item:_})=>{const v=this.editor.getPosition(),C=_.editStart.column,w=v.column;let y=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!_.completion.additionalTextEdits&&!(_.completion.insertTextRules&4)&&w-C===_.completion.insertText.length&&(y=this.editor.getModel().getValueInRange({startLineNumber:v.lineNumber,startColumn:C,endLineNumber:v.lineNumber,endColumn:w})!==_.completion.insertText),g.set(y),p.set(!B.equals(_.editInsertEnd,_.editReplaceEnd)),f.set(!!_.provider.resolveCompletionItem||!!_.completion.documentation||_.completion.detail!==_.completion.label)})),this._wantsForceRenderingAbove&&h.forceRenderingAbove(),h})),this._overtypingCapturer=this._toDispose.add(new $h(Nt(e.getDomNode()),()=>this._toDispose.add(new cH(this.editor,this.model)))),this._alternatives=this._toDispose.add(new $h(Nt(e.getDomNode()),()=>this._toDispose.add(new Ir(this.editor,this._contextKeyService)))),this._toDispose.add(o.createInstance(Nc,e)),this._toDispose.add(this.model.onDidTrigger(h=>{this.widget.value.showTriggered(h.auto,h.shy?250:50),this._lineSuffix.value=new IH(this.editor.getModel(),h.position)})),this._toDispose.add(this.model.onDidSuggest(h=>{if(h.triggerOptions.shy)return;let u=-1;for(const p of this._selectors.itemsOrderedByPriorityDesc)if(u=p.select(this.editor.getModel(),this.editor.getPosition(),h.completionModel.items),u!==-1)break;if(u===-1&&(u=0),this.model.state===0)return;let g=!1;if(h.triggerOptions.auto){const p=this.editor.getOption(134);p.selectionMode==="never"||p.selectionMode==="always"?g=p.selectionMode==="never":p.selectionMode==="whenTriggerCharacter"?g=h.triggerOptions.triggerKind!==1:p.selectionMode==="whenQuickSuggestion"&&(g=h.triggerOptions.triggerKind===1&&!h.triggerOptions.refilter)}this.widget.value.showSuggestions(h.completionModel,u,h.isFrozen,h.triggerOptions.auto,g)})),this._toDispose.add(this.model.onDidCancel(h=>{h.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const d=J.AcceptSuggestionsOnEnter.bindTo(s),c=()=>{const h=this.editor.getOption(1);d.set(h==="on"||h==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>c())),c()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=_t.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const s=this.editor.getModel(),o=s.getAlternativeVersionId(),{item:r}=e,a=[],l=new ot;t&1||this.editor.pushUndoStop();const d=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(s,this.editor.getPosition(),r);const c=r.isResolved;let h=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const p=ur.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(f=>{let _=x.lift(f.range);if(_.startLineNumber===r.position.lineNumber&&_.startColumn>r.position.column){const v=this.editor.getPosition().column-r.position.column,C=v,w=x.spansMultipleLines(_)?0:v;_=new x(_.startLineNumber,_.startColumn+C,_.endLineNumber,_.endColumn+w)}return Xe.replaceMove(_,f.text)})),p.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!c){const p=new pi;let f;const _=s.onDidChangeContent(y=>{if(y.isFlush){l.cancel(),_.dispose();return}for(const D of y.changes){const b=x.getEndPosition(D.range);(!f||B.isBefore(b,f))&&(f=b)}}),v=t;t|=2;let C=!1;const w=this.editor.onWillType(()=>{w.dispose(),C=!0,v&2||this.editor.pushUndoStop()});a.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(f&&r.completion.additionalTextEdits.some(D=>B.isBefore(f,x.getStartPosition(D.range))))return!1;C&&this.editor.pushUndoStop();const y=ur.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(D=>Xe.replaceMove(x.lift(D.range),D.text))),y.restoreRelativeVerticalPositionOfCursor(this.editor),(C||!(v&2))&&this.editor.pushUndoStop(),!0}).then(y=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",p.elapsed(),y),u=y===!0?1:y===!1?0:-2}).finally(()=>{_.dispose(),w.dispose()}))}let{insertText:g}=r.completion;if(r.completion.insertTextRules&4||(g=ho.escape(g)),this.model.cancel(),i.insert(g,{overwriteBefore:d.overwriteBefore,overwriteAfter:d.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:oo.suggest({providerId:qS.fromExtensionId(r.extensionId?.value)})}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===tL.id)this.model.trigger({auto:!0,retrigger:!0});else{const p=new pi;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(f=>{r.completion.extensionId?it(f):Le(f)}).finally(()=>{h=p.elapsed()}))}t&4&&this._alternatives.value.set(e,p=>{for(l.cancel();s.canUndo();){o!==s.getAlternativeVersionId()&&s.undo(),this._insertSuggestion(p,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,s,c,h,u,e.index,e.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,s,o,r,a){if(Math.random()>1e-4)return;const l=new Map;for(let h=0;h<Math.min(30,a.length);h++){const u=a[h].textLabel;l.has(u)?l.get(u).push(h):l.set(u,[h])}const d=l.get(e.textLabel),c=d&&d.length>1?d[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:e.extensionId?.value??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:QS(Ti(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:v0(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:s,additionalEditsAsync:o,index:r,firstIndex:c})}getOverwriteInfo(e,t){Ie(this.editor.hasModel());let i=this.editor.getOption(134).insertMode==="replace";t&&(i=!i);const s=e.position.column-e.editStart.column,o=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:s+r,overwriteAfter:o+a}}_alertCompletionItem(e){if(Gt(e.completion.additionalTextEdits)){const t=m(1534,"Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);gi(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},s=o=>{if(o.completion.insertTextRules&4||o.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=o.editStart.column,l=r.column;return l-a!==o.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:l})!==o.completion.insertText};Ge.once(this.model.onDidTrigger)(o=>{const r=[];Ge.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Pt(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(Pt(r),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),d=a.items[l];if(!s(d)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:d,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let s=0;e&&(s|=4),t&&(s|=8),this._insertSuggestion(i,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.isInitialized?this.widget.value.forceRenderingAbove():this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){this.widget.isInitialized?this.widget.value.stopForceRenderingAbove():this._wantsForceRenderingAbove=!1}registerSelector(e){return this._selectors.register(e)}};Ui=rf=xH([Fo(1,Mh),Fo(2,ht),Fo(3,Ce),Fo(4,ne),Fo(5,Ot),Fo(6,Rs)],Ui);var LH=class{constructor(n){this.prioritySelector=n,this._items=new Array}register(n){if(this._items.indexOf(n)!==-1)throw new Error("Value is already registered");return this._items.push(n),this._items.sort((e,t)=>this.prioritySelector(t)-this.prioritySelector(e)),{dispose:()=>{const e=this._items.indexOf(n);e>=0&&this._items.splice(e,1)}}}get itemsOrderedByPriorityDesc(){return this._items}},tL=class iL extends A{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:iL.id,label:L(1543,"Trigger Suggest"),precondition:k.and(S.writable,S.hasCompletionItemProvider,J.Visible.toNegated()),kbOpts:{kbExpr:S.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const s=Ui.get(t);if(!s)return;let o;i&&typeof i=="object"&&i.auto===!0&&(o=!0),s.triggerSuggest(void 0,o,void 0)}};de(Ui.ID,Ui,2);P(tL);var ri=190,Ht=Ft.bindToContribution(Ui.get);Z(new Ht({id:"acceptSelectedSuggestion",precondition:k.and(J.Visible,J.HasFocusedSuggestion),handler(n){n.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:k.and(J.Visible,S.textInputFocus),weight:ri},{primary:3,kbExpr:k.and(J.Visible,S.textInputFocus,J.AcceptSuggestionsOnEnter,J.MakesTextEdit),weight:ri}],menuOpts:[{menuId:kn,title:m(1535,"Insert"),group:"left",order:1,when:k.and(J.HasFocusedSuggestion,J.HasInsertAndReplaceRange.toNegated())},{menuId:kn,title:m(1536,"Insert"),group:"left",order:1,when:k.and(J.HasFocusedSuggestion,J.HasInsertAndReplaceRange,J.InsertMode.isEqualTo("insert"))},{menuId:kn,title:m(1537,"Replace"),group:"left",order:1,when:k.and(J.HasFocusedSuggestion,J.HasInsertAndReplaceRange,J.InsertMode.isEqualTo("replace"))}]}));Z(new Ht({id:"acceptAlternativeSelectedSuggestion",precondition:k.and(J.Visible,S.textInputFocus,J.HasFocusedSuggestion),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:1027,secondary:[1026]},handler(n){n.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:kn,group:"left",order:2,when:k.and(J.HasFocusedSuggestion,J.HasInsertAndReplaceRange,J.InsertMode.isEqualTo("insert")),title:m(1538,"Replace")},{menuId:kn,group:"left",order:2,when:k.and(J.HasFocusedSuggestion,J.HasInsertAndReplaceRange,J.InsertMode.isEqualTo("replace")),title:m(1539,"Insert")}]}));Me.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");Z(new Ht({id:"hideSuggestWidget",precondition:J.Visible,handler:n=>n.cancelSuggestWidget(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:9,secondary:[1033]}}));Z(new Ht({id:"selectNextSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectNextSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:kn,group:"left",order:0,when:J.HasFocusedSuggestion.toNegated(),title:m(1540,"Select")}}));Z(new Ht({id:"selectNextPageSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectNextPageSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:12,secondary:[2060]}}));Z(new Ht({id:"selectLastSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectLastSuggestion()}));Z(new Ht({id:"selectPrevSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));Z(new Ht({id:"selectPrevPageSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectPrevPageSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:11,secondary:[2059]}}));Z(new Ht({id:"selectFirstSuggestion",precondition:k.and(J.Visible,k.or(J.MultipleSuggestions,J.HasFocusedSuggestion.negate())),handler:n=>n.selectFirstSuggestion()}));Z(new Ht({id:"focusSuggestion",precondition:k.and(J.Visible,J.HasFocusedSuggestion.negate()),handler:n=>n.focusSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));Z(new Ht({id:"focusAndAcceptSuggestion",precondition:k.and(J.Visible,J.HasFocusedSuggestion.negate()),handler:n=>{n.focusSuggestion(),n.acceptSelectedSuggestion(!0,!1)}}));Z(new Ht({id:"toggleSuggestionDetails",precondition:k.and(J.Visible,J.HasFocusedSuggestion),handler:n=>n.toggleSuggestionDetails(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:kn,group:"right",order:1,when:k.and(J.DetailsVisible,J.CanResolve),title:m(1541,"Show Less")},{menuId:kn,group:"right",order:1,when:k.and(J.DetailsVisible.toNegated(),J.CanResolve),title:m(1542,"Show More")}]}));Z(new Ht({id:"toggleExplainMode",precondition:J.Visible,handler:n=>n.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));Z(new Ht({id:"toggleSuggestionFocus",precondition:J.Visible,handler:n=>n.toggleSuggestionFocus(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:2570,mac:{primary:778}}}));Z(new Ht({id:"insertBestCompletion",precondition:k.and(S.textInputFocus,k.equals("config.editor.tabCompletion","on"),Nc.AtEnd,J.Visible.toNegated(),Ir.OtherSuggestions.toNegated(),_t.InSnippetMode.toNegated()),handler:(n,e)=>{n.triggerSuggestAndAcceptBest(fm(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:ri,primary:2}}));Z(new Ht({id:"insertNextSuggestion",precondition:k.and(S.textInputFocus,k.equals("config.editor.tabCompletion","on"),Ir.OtherSuggestions,J.Visible.toNegated(),_t.InSnippetMode.toNegated()),handler:n=>n.acceptNextSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:2}}));Z(new Ht({id:"insertPrevSuggestion",precondition:k.and(S.textInputFocus,k.equals("config.editor.tabCompletion","on"),Ir.OtherSuggestions,J.Visible.toNegated(),_t.InSnippetMode.toNegated()),handler:n=>n.acceptPrevSuggestion(),kbOpts:{weight:ri,kbExpr:S.textInputFocus,primary:1026}}));Z(new class extends Ft{constructor(){super({id:"suggestWidgetCopy",precondition:J.DetailsFocused,kbOpts:{weight:200,kbExpr:J.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(n,e){Nt(e.getDomNode()).document.execCommand("copy")}});P(class extends A{constructor(){super({id:"editor.action.resetSuggestSize",label:L(1544,"Reset Suggest Widget Size"),precondition:void 0})}run(n,e){Ui.get(e)?.resetWidgetSize()}});var DH=class extends M{get selectedItem(){return this._currentSuggestItemInfo}constructor(n,e,t){super(),this.editor=n,this.suggestControllerPreselector=e,this.onWillAccept=t,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new ee),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(n.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(n.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const i=Ui.get(this.editor);if(i){this._register(i.registerSelector({priority:100,select:(r,a,l)=>{const d=this.editor.getModel();if(!d)return-1;const c=this.suggestControllerPreselector(),h=c?ms(c,d):void 0;if(!h)return-1;const u=B.lift(a),g=l.map((f,_)=>{const v=Su.fromSuggestion(i,d,u,f,this.isShiftKeyPressed),C=ms(v.getSingleTextEdit(),d);return{index:_,valid:MI(h,C),prefixLength:C.text.length,suggestItem:f}}).filter(f=>f&&f.valid&&f.prefixLength>0),p=sE(g,ao(f=>f.prefixLength,ro));return p?p.index:-1}}));let s=!1;const o=()=>{s||(s=!0,this._register(i.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(i.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(i.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(Ge.once(i.model.onDidTrigger)(r=>{o()})),this._register(i.onWillInsertSuggestItem(r=>{const a=this.editor.getPosition(),l=this.editor.getModel();if(!a||!l)return;const d=Su.fromSuggestion(i,l,a,r.item,this.isShiftKeyPressed);this.onWillAccept(d)}))}this.update(this._isActive)}update(n){const e=this.getSuggestItemInfo();(this._isActive!==n||!EH(this._currentSuggestItemInfo,e))&&(this._isActive=n,this._currentSuggestItemInfo=e,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const n=Ui.get(this.editor);if(!n||!this.isSuggestWidgetVisible)return;const e=n.widget.value.getFocusedItem(),t=this.editor.getPosition(),i=this.editor.getModel();if(!(!e||!t||!i))return Su.fromSuggestion(n,i,t,e.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Ui.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Ui.get(this.editor)?.forceRenderingAbove()}},Su=class nL{static fromSuggestion(e,t,i,s,o){let{insertText:r}=s.completion,a=!1;if(s.completion.insertTextRules&4){const d=new ho().parse(r);d.children.length<100&&Rc.adjustWhitespace(t,i,!0,d),r=d.toString(),a=!0}const l=e.getOverwriteInfo(s,o);return new nL(x.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),r,s.completion.kind,a,s.container.incomplete??!1)}constructor(e,t,i,s,o){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=s,this.listIncomplete=o}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new q0(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new Be(this.range,this.insertText)}};function EH(n,e){return n===e?!0:!n||!e?!1:n.equals(e)}var RH=class extends M{constructor(n,e,t){super(),this._editorObs=n,this._handleSuggestAccepted=e,this._suggestControllerPreselector=t,this._suggestWidgetAdaptor=this._register(new DH(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),i=>this._editorObs.forceUpdate(s=>{this._handleSuggestAccepted(i)}))),this.selectedItem=Bt(this,i=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(s=>i(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}},TH=class{constructor(n,e){this.lineNumber=n,this.columnRange=e}},CC=class{constructor(n,e){if(this.startColumn=n,this.endColumnExclusive=e,n>e)throw new pt(`startColumn ${n} cannot be after endColumnExclusive ${e}`)}toRange(n){return new x(n,this.startColumn,n,this.endColumnExclusive)}equals(n){return this.startColumn===n.startColumn&&this.endColumnExclusive===n.endColumnExclusive}toZeroBasedOffsetRange(){return new Ke(this.startColumn-1,this.endColumnExclusive-1)}},SC=class ba{static fromLineTokens(e){const t=[];for(let i=0;i<e.getCount();i++)t.push(new wC(e.getTokenText(i),e.getMetadata(i)));return ba.create(t)}static create(e){return new ba(e)}constructor(e){this._tokenInfo=e}toLineTokens(e){return Nr.createFromTextAndMetadata(this.map((t,i)=>({text:i.text,metadata:i.metadata})),e)}map(e){const t=[];let i=0;for(const s of this._tokenInfo){const o=new Ke(i,i+s.text.length);t.push(e(o,s)),i+=s.text.length}return t}slice(e){const t=[];let i=0;for(const s of this._tokenInfo){const o=i,r=o+s.text.length;if(r>e.start){if(o>=e.endExclusive)break;const a=Math.max(0,e.start-o),l=Math.max(0,r-e.endExclusive);t.push(new wC(s.text.slice(a,s.text.length-l),s.metadata))}i+=s.text.length}return ba.create(t)}append(e){const t=this._tokenInfo.concat(e._tokenInfo);return ba.create(t)}},wC=class{constructor(n,e){this.text=n,this.metadata=e}},PH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},kH=function(n,e){return function(t,i){e(t,i,n)}},NH=class sL{static from(e){if(e)return new sL(e.icon)}constructor(e=V.warning){this.icon=e}},oL="ghost-text",sl=class extends M{constructor(e,t,i,s){super(),this._editor=e,this._data=t,this._languageService=s,this._isDisposed=Fe(this,!1),this._warningState=R(o=>{const r=this._data.read(o),a=r?.warning;if(!r||!a)return;const l=r.ghostText;return{lineNumber:l.lineNumber,position:new B(l.lineNumber,l.parts[0].column),icon:a.icon}}),this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._nonWhitespaceCount=R(this,o=>{const r=this._data.read(o);if(r)return r.ghostText.parts.map(a=>a.lines.map(l=>l.line).join("")).join("").replace(/\s/g,"").length}),this._extraClassNames=R(this,o=>{const r=this._extraClasses.slice();this._warningState.read(o)&&r.push("warning");const a=this._nonWhitespaceCount.read(o);return this._highlightShortText&&a&&a<3?r.push("short-text"):this._useSyntaxHighlighting.read(o)&&r.push("syntax-highlighted"),r.map(l=>` ${l}`).join("")}),this._state=R(this,o=>{if(this._isDisposed.read(o))return;const r=this._data.read(o);if(!r)return;const a=this._editorObs.model.read(o);if(!a)return;const l=r.ghostText,d=l instanceof Ap?l.columnRange:void 0,c=this._useSyntaxHighlighting.read(o),h=this._extraClassNames.read(o),{inlineTexts:u,additionalLines:g,hiddenRange:p,additionalLinesOriginalSuffix:f}=MH(l,a,oL+h),_=a.getLineContent(l.lineNumber),v=new Mn(u.map(E=>si.insert(E.column-1,E.text))),C=c?a.tokenization.tokenizeLinesAt(l.lineNumber,[v.apply(_),...g.map(E=>E.content)]):void 0,w=v.getNewRanges(),y=u.map((E,F)=>({...E,tokens:C?.[0]?.getTokensInRange(w[F])})),D=g.map((E,F)=>{let q=C?.[F+1]??Nr.createEmpty(E.content,this._languageService.languageIdCodec);if(F===g.length-1&&f){const re=SC.fromLineTokens(a.tokenization.getLineTokens(f.lineNumber)).slice(f.columnRange.toZeroBasedOffsetRange());q=SC.fromLineTokens(q).append(re).toLineTokens(q.languageIdCodec)}return new FH(q,E.decorations)}),b=this._editor.getSelection()?.getStartPosition().column,I=y.filter(E=>E.text!==""),N=I.length!==0,T=new N_((N?I[0].column:1)-b,N?0:g.findIndex(E=>E.content!=="")+1,N?1:0,g.length+(N?1:0),0,Yd(I.map(E=>E.text.length))+Yd(D.map(E=>E.content.getTextLength())),I.length+(g.length>0?1:0),I.length>1&&D.length===0?I.every(E=>E.text===I[0].text):void 0);return{replacedRange:d,inlineTexts:y,additionalLines:D,hiddenRange:p,lineNumber:l.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(o),targetTextModel:a,syntaxHighlightingEnabled:c,telemetryViewData:T,handleInlineCompletionShown:r.handleInlineCompletionShown}}),this._decorations=R(this,o=>{const r=this._state.read(o);if(!r)return[];const a=[],l=this._extraClassNames.read(o);r.replacedRange&&a.push({range:r.replacedRange.toRange(r.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+l,description:"GhostTextReplacement"}}),r.hiddenRange&&a.push({range:r.hiddenRange.toRange(r.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const d of r.inlineTexts){let c="";this._highlightShortText&&d.text.length<5&&(c+=" short-text"),a.push({range:x.fromPositions(new B(r.lineNumber,d.column)),options:{description:"ghost-text-decoration",after:{content:d.text,tokens:d.tokens,inlineClassName:(d.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+l+c+d.lineDecorations.map(h=>" "+h.className).join(" "),cursorStops:Js.Left,attachedData:new wu(this)},showIfCollapsed:!0}})}return a}),this.isHovered=R(this,o=>this._isDisposed.read(o)?!1:this._isInlineTextHovered.read(o)||this._additionalLinesWidget.isHovered.read(o)),this._extraClasses=i.extraClasses??[],this._isClickable=i.isClickable??!1,this._shouldKeepCursorStable=i.shouldKeepCursorStable??!1,this._minReservedLineCount=i.minReservedLineCount??ye(0),this._useSyntaxHighlighting=i.useSyntaxHighlighting??ye(!0),this._highlightShortText=i.highlightShortSuggestions??!1,this._editorObs=je(this._editor),this._additionalLinesWidget=this._register(new AH(this._editor,nn({owner:this,equalsFn:dE(km())},o=>{const r=this._state.read(o);return r?new OH(r.lineNumber,r.additionalLines,r.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(o=>o.target.type===6&&o.target.detail.injectedText?.options.attachedData instanceof wu&&o.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(Te(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(o=>this._onDidClick.fire(o))),this._register(this._editor.onMouseUp(o=>{if(o.target.type!==6)return;const r=o.target.detail.injectedText?.options.attachedData;r instanceof wu&&r.owner===this&&this._onDidClick.fire(o.event)}))),this._register(ge(o=>{const r=this._state.read(o);r?.handleInlineCompletionShown(r.telemetryViewData)})),this._register(xl((o,r)=>{}))}static getWarningWidgetContext(e){const t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}};sl=PH([kH(3,Bn)],sl);var wu=class{constructor(n){this.owner=n}};function MH(n,e,t){const i=[],s=[];function o(c,h){if(s.length>0){const u=s[s.length-1];h&&u.decorations.push(new mr(u.content.length+1,u.content.length+1+c[0].line.length,h,0)),u.content+=c[0].line,c=c.slice(1)}for(const u of c)s.push({content:u.line,decorations:h?[new mr(1,u.line.length+1,h,0),...u.lineDecorations]:[...u.lineDecorations]})}const r=e.getLineContent(n.lineNumber);let a,l=0;for(const c of n.parts){let h=c.lines;a===void 0?(i.push({column:c.column,text:h[0].line,preview:c.preview,lineDecorations:h[0].lineDecorations}),h=h.slice(1)):o([{line:r.substring(l,c.column-1),lineDecorations:[]}],void 0),h.length>0&&(o(h,t),a===void 0&&c.column<=r.length&&(a=c.column)),l=c.column-1}let d;return a!==void 0&&(d=new TH(n.lineNumber,new CC(l+1,r.length+1))),{inlineTexts:i,additionalLines:s,hiddenRange:a!==void 0?new CC(a,r.length+1):void 0,additionalLinesOriginalSuffix:d}}var OH=class{constructor(n,e,t){this.lineNumber=n,this.additionalLines=e,this.minReservedLineCount=t}equals(n){return this.lineNumber!==n.lineNumber||this.minReservedLineCount!==n.minReservedLineCount?!1:$i(this.additionalLines,n.additionalLines,km())}},AH=class extends M{get viewZoneId(){return this._viewZoneInfo?.viewZoneId}constructor(n,e,t,i){super(),this._editor=n,this._lines=e,this._shouldKeepCursorStable=t,this._isClickable=i,this._viewZoneHeight=Fe("viewZoneHeight",void 0),this.editorOptionsChanged=sc("editorOptionChanged",Ge.filter(this._editor.onDidChangeConfiguration,s=>s.hasChanged(40)||s.hasChanged(133)||s.hasChanged(113)||s.hasChanged(108)||s.hasChanged(60)||s.hasChanged(59)||s.hasChanged(75)||s.hasChanged(176))),this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new We),this.isHovered=je(this._editor).isTargetHovered(s=>yC(s.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof Um&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(s=>this.hasBeenAccepted=s.source==="inlineCompletionAccept")),this._register(ge(s=>{const o=this._lines.read(s);this.editorOptionsChanged.read(s),o?(this.hasBeenAccepted=!1,this.updateLines(o.lineNumber,o.additionalLines,o.minReservedLineCount)):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(n=>{this.removeActiveViewZone(n)})}updateLines(n,e,t){const i=this._editor.getModel();if(!i)return;const{tabSize:s}=i.getOptions();je(this._editor).transaction(o=>{this._editor.changeViewZones(r=>{const a=new O;this.removeActiveViewZone(r);const l=Math.max(e.length,t);if(l>0){const d=document.createElement("div");HH(d,s,e,this._editor.getOptions(),this._isClickable),this._isClickable&&(a.add(Q(d,"mousedown",c=>{c.preventDefault()})),a.add(Q(d,"click",c=>{yC(c.target)&&this._onDidClick.fire(new Cm(Nt(c),c))}))),this.addViewZone(r,n,l,d)}this._viewZoneListener.value=a})})}addViewZone(n,e,t,i){const s=n.addZone({afterLineNumber:e,heightInLines:t,domNode:i,afterColumnAffinity:1,onComputedHeight:o=>{this._viewZoneHeight.set(o,void 0)}});this.keepCursorStable(e,t),this._viewZoneInfo={viewZoneId:s,heightInLines:t,lineNumber:e}}removeActiveViewZone(n){this._viewZoneInfo&&(n.removeZone(this._viewZoneInfo.viewZoneId),this.hasBeenAccepted||this.keepCursorStable(this._viewZoneInfo.lineNumber,-this._viewZoneInfo.heightInLines),this._viewZoneInfo=void 0,this._viewZoneHeight.set(void 0,void 0))}keepCursorStable(n,e){if(!this._shouldKeepCursorStable)return;const t=this._editor.getSelection()?.getStartPosition()?.lineNumber;t!==void 0&&n<t&&this._editor.setScrollTop(this._editor.getScrollTop()+e*this._editor.getOption(75))}};function yC(n){return hi(n)&&n.classList.contains(oL)}var FH=class{constructor(n,e){this.content=n,this.decorations=e}equals(n){return this.content.equals(n.content)?mr.equalsArr(this.decorations,n.decorations):!1}};function HH(n,e,t,i,s){const o=i.get(40),r=i.get(133),a="none",l=i.get(108),d=i.get(60),c=i.get(59),h=i.get(75),u=i.get(176)==="twoCells";let g="suggest-preview-text";s&&(g+=" clickable");const p=new Sw(1e4);p.appendString(`<div class="${g}">`);for(let _=0,v=t.length;_<v;_++){const C=t[_],w=C.content;p.appendString('<div class="view-line'),p.appendString('" style="top:'),p.appendString(String(_*h)),p.appendString('px;width:1000000px;">');const y=w.getLineContent(),D=bw(y),b=_T(y);Ow(new kw(c.isMonospace&&!o,c.canUseHalfwidthRightwardsArrow,y,!1,D,b,0,w,C.decorations.slice(),e,0,c.spaceWidth,c.middotWidth,c.wsmiddotWidth,r,a,l,d!==gT.OFF,null,null,0,!1,u),p),p.appendString("</div>")}p.appendString("</div>"),fw(n,c);const f=p.build();n.innerHTML=xC?xC.createHTML(f):f}var xC=Dw("editorGhostText",{createHTML:n=>n}),F_=class rL{constructor(e,t){this.width=e,this.height=t}toString(){return`(${this.width},${this.height})`}transpose(){return new rL(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}},ut=class xt{static fromPoints(e,t){return new xt(e.x,e.y,t.x,t.y)}static fromPointSize(e,t){return new xt(e.x,e.y,e.x+t.x,e.y+t.y)}static fromLeftTopRightBottom(e,t,i,s){return new xt(e,t,i,s)}static fromLeftTopWidthHeight(e,t,i,s){return new xt(e,t,e+i,t+s)}static fromRanges(e,t){return new xt(e.start,t.start,e.endExclusive,t.endExclusive)}static hull(e){let t=Number.MAX_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;for(const r of e)t=Math.min(t,r.left),i=Math.min(i,r.top),s=Math.max(s,r.right),o=Math.max(o,r.bottom);return new xt(t,i,s,o)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(e,t,i,s){if(this.left=e,this.top=t,this.right=i,this.bottom=s,e>i)throw new pt("Invalid arguments: Horizontally offset by "+(e-i));if(t>s)throw new pt("Invalid arguments: Vertically offset by "+(t-s))}withMargin(e,t,i,s){let o,r,a,l;return t===void 0&&i===void 0&&s===void 0?o=r=a=l=e:i===void 0&&s===void 0?(o=r=t,a=l=e):(o=s,r=t,a=e,l=i),new xt(this.left-o,this.top-a,this.right+r,this.bottom+l)}intersectVertical(e){const t=Math.max(this.top,e.start),i=Math.min(this.bottom,e.endExclusive);return new xt(this.left,t,this.right,Math.max(t,i))}intersectHorizontal(e){const t=Math.max(this.left,e.start),i=Math.min(this.right,e.endExclusive);return new xt(t,this.top,Math.max(t,i),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(e){const t=Math.max(this.left,e.left),i=Math.min(this.right,e.right),s=Math.max(this.top,e.top),o=Math.min(this.bottom,e.bottom);if(!(t>i||s>o))return new xt(t,s,i,o)}containsRect(e){return this.left<=e.left&&this.top<=e.top&&this.right>=e.right&&this.bottom>=e.bottom}containsPoint(e){return this.left<=e.x&&this.top<=e.y&&this.right>=e.x&&this.bottom>=e.y}moveToBeContainedIn(e){const t=this.width,i=this.height;let s=this.left,o=this.top;return s<e.left?s=e.left:s+t>e.right&&(s=e.right-t),o<e.top?o=e.top:o+i>e.bottom&&(o=e.bottom-i),new xt(s,o,s+t,o+i)}withWidth(e){return new xt(this.left,this.top,this.left+e,this.bottom)}withHeight(e){return new xt(this.left,this.top,this.right,this.top+e)}withTop(e){return new xt(this.left,e,this.right,this.bottom)}withLeft(e){return new xt(e,this.top,this.right,this.bottom)}translateX(e){return new xt(this.left+e,this.top,this.right+e,this.bottom)}translateY(e){return new xt(this.left,this.top+e,this.right,this.bottom+e)}getLeftBottom(){return new zi(this.left,this.bottom)}getRightBottom(){return new zi(this.right,this.bottom)}getRightTop(){return new zi(this.right,this.top)}toStyles(){return{position:"absolute",left:`${this.left}px`,top:`${this.top}px`,width:`${this.width}px`,height:`${this.height}px`}}withHorizontalRange(e){return new xt(e.start,this.top,e.endExclusive,this.bottom)}getSize(){return new F_(this.width,this.height)}},yu=class aL{constructor(e,t,i,s=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=s}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&$i(this.startLineNumbers,e.startLineNumbers)&&$i(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new aL([],[],0)}},IC=Dw("stickyScrollViewLayer",{createHTML:n=>n}),af="data-sticky-line-index",lL="data-sticky-is-line",WH="data-sticky-is-line-number",dL="data-sticky-is-folding-icon",VH=class extends M{get height(){return this._height}constructor(n){super(),this._foldingIconStore=this._register(new O),this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._height=-1,this._onDidChangeStickyScrollHeight=this._register(new ee),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._editor=n,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",n instanceof un),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);const e=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(t=>{t.hasChanged(131)&&e()})),this._register(this._editor.onDidScrollChange(t=>{t.scrollLeftChanged&&e(),t.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{e(),this._updateWidgetWidth()})),e(),this._register(this._editor.onDidLayoutChange(t=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(n){return this._renderedStickyLines.find(e=>e.lineNumber===n)}getCurrentLines(){return this._lineNumbers}setState(n,e,t){const i=!this._state&&!n,s=this._state&&this._state.equals(n);if(t===void 0&&(i||s))return;const o=this._findRenderingData(n),r=this._lineNumbers;this._lineNumbers=o.lineNumbers,this._lastLineRelativePosition=o.lastLineRelativePosition;const a=this._findIndexToRebuildFrom(r,this._lineNumbers,t);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,e,a),this._state=n}_findRenderingData(n){if(!n)return{lineNumbers:[],lastLineRelativePosition:0};const e=[...n.startLineNumbers];n.showEndForLine!==null&&(e[n.showEndForLine]=n.endLineNumbers[n.showEndForLine]);let t=0;for(let i=0;i<e.length;i++){const s=new B(e[i],1),o=this._editor._getViewModel();o&&s.lineNumber<=o.getLineCount()&&(t+=this._editor.getLineHeightForPosition(new B(e[i],1)))}return t===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:e,lastLineRelativePosition:n.lastLineRelativePosition}}_findIndexToRebuildFrom(n,e,t){if(e.length===0)return 0;if(t!==void 0)return t;const i=e.findIndex(s=>!n.includes(s));return i===-1?0:i}_updateWidgetWidth(){const n=this._editor.getLayoutInfo(),e=n.contentLeft;this._lineNumbersDomNode.style.width=`${e}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-n.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${n.width-n.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(n){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${n?.5:0}s`)}_setFoldingIconsVisibility(n){for(const e of this._renderedStickyLines){const t=e.foldingIcon;t&&t.setVisible(n?!0:t.isCollapsed)}}async _renderRootNode(n,e,t,i){const s=this._editor._getViewModel();if(!s){this._clearWidget();return}if(n.length===0){this._clearWidget();return}const o=[],r=n[n.length-1];let a=0;for(let d=0;d<this._renderedStickyLines.length;d++)if(d<i){const c=this._renderedStickyLines[d];o.push(this._updatePosition(c,a,c.lineNumber===r)),a+=c.height}else{const c=this._renderedStickyLines[d];c.lineNumberDomNode.remove(),c.lineDomNode.remove()}const l=this._editor.getLayoutInfo();for(let d=i;d<n.length;d++){const c=n[d];if(c>s.getLineCount())continue;const h=this._renderChildNode(s,d,c,a,r===c,t,l);a+=h.height,this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),o.push(h)}t&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(d=>d.scrollWidth))+l.verticalScrollbarWidth,this._renderedStickyLines=o,this._setHeight(a+e),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let n=0;n<this._renderedStickyLines.length;n++){const e=this._renderedStickyLines[n];e.lineNumberDomNode.remove(),e.lineDomNode.remove()}this._setHeight(0)}_setHeight(n){this._height!==n&&(this._height=n,this._height===0?this._rootDomNode.style.display="none":(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${this._height}px`,this._linesDomNodeScrollable.style.height=`${this._height}px`,this._rootDomNode.style.height=`${this._height}px`),this._onDidChangeStickyScrollHeight.fire({height:this._height}))}_setFoldingHoverListeners(){this._foldingIconStore.clear(),this._editor.getOption(126)==="mouseover"&&(this._foldingIconStore.clear(),this._foldingIconStore.add(Q(this._lineNumbersDomNode,we.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(Q(this._lineNumbersDomNode,we.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(n,e,t,i,s,o,r){const a=new BH(this._editor,n,r,o,this._isOnGlyphMargin,e,t);return this._updatePosition(a,i,s)}_updatePosition(n,e,t){const i=n.lineDomNode,s=n.lineNumberDomNode;if(t){i.style.zIndex="0",s.style.zIndex="0";const r=`${e+this._lastLineRelativePosition+(n.foldingIcon?.isCollapsed?1:0)}px`;i.style.top=r,s.style.top=r}else i.style.zIndex="1",s.style.zIndex="1",i.style.top=`${e}px`,s.style.top=`${e}px`;return n}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(n){0<=n&&n<this._renderedStickyLines.length&&this._renderedStickyLines[n].lineDomNode.focus()}getEditorPositionFromNode(n){if(!n||n.children.length>0)return null;const e=this._getRenderedStickyLineFromChildDomNode(n);if(!e)return null;const t=iE(e.characterMapping,n,0);return new B(e.lineNumber,t)}getLineNumberFromChildDomNode(n){return this._getRenderedStickyLineFromChildDomNode(n)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(n){const e=this.getLineIndexFromChildDomNode(n);return e===null||e<0||e>=this._renderedStickyLines.length?null:this._renderedStickyLines[e]}getLineIndexFromChildDomNode(n){const e=this._getAttributeValue(n,af);return e?parseInt(e,10):null}isInStickyLine(n){return this._getAttributeValue(n,lL)!==void 0}isInFoldingIconDomNode(n){return this._getAttributeValue(n,dL)!==void 0}_getAttributeValue(n,e){for(;n&&n!==this._rootDomNode;){const t=n.getAttribute(e);if(t!==null)return t;n=n.parentElement}}},BH=class{constructor(n,e,t,i,s,o,r){this.index=o,this.lineNumber=r;const a=e.coordinatesConverter.convertModelPositionToViewPosition(new B(r,1)).lineNumber,l=e.getViewLineRenderingData(a),d=n.getOption(76),c=n.getOption(117).verticalScrollbarSize;let h;try{h=mr.filter(l.inlineDecorations,a,l.minColumn,l.maxColumn)}catch{h=[]}const u=n.getLineHeightForPosition(new B(r,1)),g=e.getTextDirection(r),p=n.getOption(59),f=new kw(!0,!0,l.content,l.continuesWithWrappedLine,l.isBasicASCII,l.containsRTL,0,l.tokens,h,l.tabSize,l.startVisibleColumn,p.spaceWidth,1,1,500,"none",!0,!0,null,g,c,!1,n.getOption(176)==="twoCells"),_=new Sw(2e3),v=Ow(f,_);this.characterMapping=v.characterMapping;let C;IC?C=IC.createHTML(_.build()):C=_.build();const w=document.createElement("span");w.setAttribute(af,String(o)),w.setAttribute(lL,""),w.setAttribute("role","listitem"),w.tabIndex=0,w.className="sticky-line-content",w.classList.add(`stickyLine${r}`),w.style.lineHeight=`${u}px`,w.innerHTML=C;const y=document.createElement("span");y.setAttribute(af,String(o)),y.setAttribute(WH,""),y.className="sticky-line-number",y.style.lineHeight=`${u}px`;const D=t.contentLeft;y.style.width=`${D}px`;const b=document.createElement("span");d.renderType===1||d.renderType===3&&r%10===0?b.innerText=r.toString():d.renderType===2&&(b.innerText=Math.abs(r-n.getPosition().lineNumber).toString()),b.className="sticky-line-number-inner",b.style.width=`${t.lineNumbersWidth}px`,b.style.paddingLeft=`${t.lineNumbersLeft}px`,y.appendChild(b),this.foldingIcon=this._renderFoldingIconForLine(n,i,r,u,s),this.foldingIcon&&(y.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${t.lineNumbersWidth+t.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${u}px`),n.applyFontInfo(w),n.applyFontInfo(y),y.style.lineHeight=`${u}px`,w.style.lineHeight=`${u}px`,y.style.height=`${u}px`,w.style.height=`${u}px`,this.scrollWidth=w.scrollWidth,this.lineDomNode=w,this.lineNumberDomNode=y,this.height=u}_renderFoldingIconForLine(n,e,t,i,s){const o=n.getOption(126);if(!e||o==="never")return;const r=e.regions,a=r.findRange(t),l=r.getStartLineNumber(a);if(t!==l)return;const d=r.isCollapsed(a),c=new UH(d,l,r.getEndLineNumber(a),i);return c.setVisible(s?!0:d||o==="always"),c.domNode.setAttribute(dL,""),c}},UH=class{constructor(n,e,t,i){this.isCollapsed=n,this.foldingStartLine=e,this.foldingEndLine=t,this.dimension=i,this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${i}px`,this.domNode.style.lineHeight=`${i}px`,this.domNode.className=ce.asClassName(n?yc:wc)}setVisible(n){this.domNode.style.cursor=n?"pointer":"default",this.domNode.style.opacity=n?"1":"0"}},Ta=class{constructor(n,e){this.startLineNumber=n,this.endLineNumber=e}},Ac=class{constructor(n,e,t){this.range=n,this.children=e,this.parent=t}},cL=class{constructor(n,e,t,i){this.uri=n,this.version=e,this.element=t,this.outlineProviderId=i}},Oh=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ol=function(n,e){return function(t,i){e(t,i,n)}},Pa;(function(n){n.OUTLINE_MODEL="outlineModel",n.FOLDING_PROVIDER_MODEL="foldingProviderModel",n.INDENTATION_MODEL="indentationModel"})(Pa||(Pa={}));var ls;(function(n){n[n.VALID=0]="VALID",n[n.INVALID=1]="INVALID",n[n.CANCELED=2]="CANCELED"})(ls||(ls={}));var lf=class extends M{constructor(e,t,i,s){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new bs(300)),this._updateOperation=this._register(new O),this._editor.getOption(131).defaultModel){case Pa.OUTLINE_MODEL:this._modelProviders.push(new df(this._editor,s));case Pa.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new hf(this._editor,t,s));case Pa.INDENTATION_MODEL:this._modelProviders.push(new cf(this._editor,i))}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:s}=t.computeStickyModel(e);this._modelPromise=s;const o=await i;if(this._modelPromise!==s)return null;switch(o){case ls.CANCELED:return this._updateOperation.clear(),null;case ls.VALID:return t.stickyModel}}return null}).catch(t=>(Le(t),null))}};lf=Oh([ol(2,ne),ol(3,X)],lf);var hL=class extends M{constructor(n){super(),this._editor=n,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,ls.INVALID}computeStickyModel(n){if(n.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const e=mt(t=>this.createModelFromProvider(t));return{statusPromise:e.then(t=>this.isModelValid(t)?n.isCancellationRequested?ls.CANCELED:(this._stickyModel=this.createStickyModel(n,t),ls.VALID):this._invalid()).then(void 0,t=>(Le(t),ls.CANCELED)),modelPromise:e}}isModelValid(n){return!0}isProviderValid(){return!0}},df=class extends hL{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return rI.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){const{stickyOutlineElement:i,providerID:s}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),o=this._editor.getModel();return new cL(o.uri,o.getVersionId(),i,s)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(gs.first(e.children.values())instanceof oI){const r=gs.find(e.children.values(),a=>a.id===t);if(r)i=r.children;else{let a="",l=-1,d;for(const[c,h]of e.children.entries()){const u=this._findSumOfRangesOfGroup(h);u>l&&(d=h,l=u,a=h.id)}t=a,i=d.children}}else i=e.children;const s=[],o=Array.from(i.values()).sort((r,a)=>{const l=new Ta(r.symbol.range.startLineNumber,r.symbol.range.endLineNumber),d=new Ta(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber);return this._comparator(l,d)});for(const r of o)s.push(this._stickyModelFromOutlineElement(r,r.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Ac(void 0,s,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const o of e.children.values())if(o.symbol.selectionRange.startLineNumber!==o.symbol.range.endLineNumber)if(o.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(o,o.symbol.selectionRange.startLineNumber));else for(const r of o.children.values())i.push(this._stickyModelFromOutlineElement(r,o.symbol.selectionRange.startLineNumber));i.sort((o,r)=>this._comparator(o.range,r.range));const s=new Ta(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new Ac(s,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof Sp?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};df=Oh([ol(1,X)],df);var uL=class extends hL{constructor(n){super(n),this._foldingLimitReporter=this._register(new iI(n))}createStickyModel(n,e){const t=this._fromFoldingRegions(e),i=this._editor.getModel();return new cL(i.uri,i.getVersionId(),t,void 0)}isModelValid(n){return n!==null}_fromFoldingRegions(n){const e=n.length,t=[],i=new Ac(void 0,[],void 0);for(let s=0;s<e;s++){const o=n.getParentIndex(s);let r;o!==-1?r=t[o]:r=i;const a=new Ac(new Ta(n.getStartLineNumber(s),n.getEndLineNumber(s)+1),[],r);r.children.push(a),t.push(a)}return i}},cf=class extends uL{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new D_(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};cf=Oh([ol(1,ct)],cf);var hf=class extends uL{constructor(e,t,i){super(e),this._languageFeaturesService=i,this.provider=this._register(new We),this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){const i=ys.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());i.length!==0&&(this.provider.value=new E_(e.getModel(),i,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};hf=Oh([ol(2,X)],hf);var zH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},LC=function(n,e){return function(t,i){e(t,i,n)}},jH=class{constructor(n,e,t,i){this.startLineNumber=n,this.endLineNumber=e,this.top=t,this.height=i}},uf=class extends M{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new ee),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new O),this._updateSoon=this._register(new at(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(131)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(131).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),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._sessionStore.add(Te(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel()&&(this._stickyModelProvider=new lf(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new ot,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];const t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,s,o,r){const a=this._editor.getModel();if(!a||t.children.length===0)return;let l=r;const d=[];for(let u=0;u<t.children.length;u++){const g=t.children[u];g.range&&d.push(g.range.startLineNumber)}const c=this.updateIndex(og(d,e.startLineNumber,(u,g)=>u-g)),h=this.updateIndex(og(d,e.endLineNumber,(u,g)=>u-g));for(let u=c;u<=h;u++){const g=t.children[u];if(!g||!g.range)continue;const{startLineNumber:p,endLineNumber:f}=g.range;if(f>p+1&&e.startLineNumber<=f+1&&p-1<=e.endLineNumber&&p!==l&&a.isValidRange(new x(p,1,f,1))){l=p;const _=this._editor.getLineHeightForPosition(new B(p,1));i.push(new jH(p,f-1,o,_)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,g,i,s+1,o+_,p)}}}filterHiddenRanges(e){const t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(i=>!t.some(s=>i.startLineNumber>=s.startLineNumber&&i.endLineNumber<=s.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};uf=zH([LC(1,X),LC(2,ct)],uf);var qH=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Ho=function(n,e){return function(t,i){e(t,i,n)}},gf,Pi=class extends M{static{gf=this}static{this.ID="store.contrib.stickyScrollController"}constructor(e,t,i,s,o,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=s,this._contextKeyService=a,this._sessionStore=new O,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._mouseTarget=null,this._onDidChangeStickyScrollHeight=this._register(new ee),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._stickyScrollWidget=new VH(this._editor),this._stickyLineCandidateProvider=new uf(this._editor,i,o),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=yu.Empty;const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(c=>{c.changes.forEach(h=>{const u=h.lineNumber;this._widgetState.startLineNumbers.includes(u)&&this._renderStickyScroll(u)})})),this._register(this._editor.onDidChangeFont(c=>{c.changes.forEach(h=>{const u=h.lineNumber;this._widgetState.startLineNumbers.includes(u)&&this._renderStickyScroll(u)})})),this._register(this._editor.onDidChangeConfiguration(c=>{this._readConfigurationChange(c)})),this._register(Q(l,we.CONTEXT_MENU,async c=>{this._onContextMenu(Nt(l),c)})),this._stickyScrollFocusedContextKey=S.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=S.stickyScrollVisible.bindTo(this._contextKeyService);const d=this._register(us(l));this._register(d.onDidBlur(c=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(d.onDidFocus(c=>{this.focus()})),this._registerMouseListeners(),this._register(Q(l,we.MOUSE_DOWN,c=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(c=>{this._onDidChangeStickyScrollHeight.fire(c)})),this._onDidResize(),this._readConfiguration()}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(gf.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}isFocused(){return this._focused}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new O,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(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(x.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new O),t=this._register(new wh(this._editor,{extractLineNumberFromMouseEvent:o=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(o.target.element);return r?r.lineNumber:0}})),i=o=>{if(!this._editor.hasModel()||o.target.type!==12||o.target.detail!==this._stickyScrollWidget.getId())return null;const r=o.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new x(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},s=this._stickyScrollWidget.getDomNode();this._register(hn(s,we.CLICK,o=>{if(o.ctrlKey||o.altKey||o.metaKey||!o.leftButton)return;if(o.shiftKey){const a=this._stickyScrollWidget.getLineIndexFromChildDomNode(o.target);if(a===null)return;const l=new B(this._endLineNumbers[a],1);this._revealLineInCenterIfOutsideViewport(l);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(o.target)){const a=this._stickyScrollWidget.getLineNumberFromChildDomNode(o.target);this._toggleFoldingRegionForLine(a);return}if(!this._stickyScrollWidget.isInStickyLine(o.target))return;let r=this._stickyScrollWidget.getEditorPositionFromNode(o.target);if(!r){const a=this._stickyScrollWidget.getLineNumberFromChildDomNode(o.target);if(a===null)return;r=new B(a,1)}this._revealPosition(r)})),this._register(Q(_d,we.MOUSE_MOVE,o=>{this._mouseTarget=o.target,this._onMouseMoveOrKeyDown(o)})),this._register(Q(_d,we.KEY_DOWN,o=>{this._onMouseMoveOrKeyDown(o)})),this._register(Q(_d,we.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([o,r])=>{const a=i(o);if(!a||!o.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:d}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(d.style.textDecoration==="underline")return;const c=new ot;e.add(Te(()=>c.dispose(!0)));let h;Pl(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new B(l.startLineNumber,l.startColumn+1),!1,c.token).then((u=>{if(!c.token.isCancellationRequested)if(u.length!==0){this._candidateDefinitionsLength=u.length;const g=d;h!==g?(e.clear(),h=g,h.style.textDecoration="underline",e.add(Te(()=>{h.style.textDecoration="none"}))):h||(h=g,h.style.textDecoration="underline",e.add(Te(()=>{h.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async o=>{if(o.target.type!==12||o.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(o.target.element);r&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(Vx,o,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new Cm(e,t);this._contextMenuService.showContextMenu({menuId:K.StickyScrollContext,getAnchor:()=>i,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!hi(this._mouseTarget))return;const t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t?.foldingIcon;if(!i)return;x_(this._foldingModel,1,[e]),i.isCollapsed=!i.isCollapsed;const s=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(s),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(131);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(t=>{t.scrollTopChanged&&(this._showEndForLine=void 0,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=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(76).renderType===2?this._cursorPositionListener||(this._cursorPositionListener=this._editor.onDidChangeCursorPosition(t=>{this._positionLineNumber!==t.position.lineNumber&&(this._positionLineNumber=t.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0))}),this._sessionStore.add(this._cursorPositionListener)):this._cursorPositionListener&&(this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),this._cursorPositionListener=void 0)}_readConfigurationChange(e){(e.hasChanged(131)||e.hasChanged(81)||e.hasChanged(75)||e.hasChanged(126)||e.hasChanged(76))&&this._readConfiguration(),(e.hasChanged(76)||e.hasChanged(52)||e.hasChanged(126)||e.hasChanged(59)||e.hasChanged(176))&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const s of e.ranges)if(i>=s.fromLineNumber&&i<=s.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const e=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(e*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),s=this._stickyLineCandidateProvider.getVersionId();if(s===void 0||s===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const o=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(o)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await ys.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=yu.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop();let i=0;const s=[],o=[],r=this._editor.getVisibleRanges();if(r.length!==0){const a=new Ta(r[0].startLineNumber,r[r.length-1].endLineNumber),l=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(a);for(const d of l){const c=d.startLineNumber,h=d.endLineNumber,u=d.top,g=u+d.height,p=this._editor.getTopForLineNumber(c)-t,f=this._editor.getBottomForLineNumber(h)-t;if(u>p&&u<=f&&(s.push(c),o.push(h+1),g>f&&(i=f-g)),s.length===e)break}}return this._endLineNumbers=o,new yu(s,o,i,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};Pi=gf=qH([Ho(1,Sl),Ho(2,X),Ho(3,ne),Ho(4,ct),Ho(5,ki),Ho(6,Ce)],Pi);var ka=W("inlineEdit.originalBackground",st(eo,.2),m(1286,"Background color for the original text in inline edits."),!0),gL=W("inlineEdit.modifiedBackground",st(Yo,.3),m(1287,"Background color for the modified text in inline edits."),!0);W("inlineEdit.originalChangedLineBackground",st(eo,.8),m(1288,"Background color for the changed lines in the original text of inline edits."),!0);var $H=W("inlineEdit.originalChangedTextBackground",st(eo,.8),m(1289,"Overlay color for the changed text in the original text of inline edits."),!0),KH=W("inlineEdit.modifiedChangedLineBackground",{light:st(Wl,.7),dark:st(Wl,.7),hcDark:Wl,hcLight:Wl},m(1290,"Background color for the changed lines in the modified text of inline edits."),!0),GH=W("inlineEdit.modifiedChangedTextBackground",st(Yo,.7),m(1291,"Overlay color for the changed text in the modified text of inline edits."),!0),rl=W("inlineEdit.gutterIndicator.primaryForeground",US,m(1292,"Foreground color for the primary inline edit gutter indicator.")),ds=W("inlineEdit.gutterIndicator.primaryBorder",ow,m(1293,"Border color for the primary inline edit gutter indicator.")),Ol=W("inlineEdit.gutterIndicator.primaryBackground",{light:st(ds,.5),dark:st(ds,.4),hcDark:st(ds,.4),hcLight:st(ds,.5)},m(1294,"Background color for the primary inline edit gutter indicator.")),ZH=W("inlineEdit.gutterIndicator.secondaryForeground",yd,m(1295,"Foreground color for the secondary inline edit gutter indicator.")),XH=W("inlineEdit.gutterIndicator.secondaryBorder",Mm,m(1296,"Border color for the secondary inline edit gutter indicator.")),H_=W("inlineEdit.gutterIndicator.secondaryBackground",dg,m(1297,"Background color for the secondary inline edit gutter indicator.")),YH=W("inlineEdit.gutterIndicator.successfulForeground",US,m(1298,"Foreground color for the successful inline edit gutter indicator.")),pL=W("inlineEdit.gutterIndicator.successfulBorder",ow,m(1299,"Border color for the successful inline edit gutter indicator.")),W_=W("inlineEdit.gutterIndicator.successfulBackground",pL,m(1300,"Background color for the successful inline edit gutter indicator.")),JH=W("inlineEdit.gutterIndicator.background",{hcDark:st("tab.inactiveBackground",.5),hcLight:st("tab.inactiveBackground",.5),dark:st("tab.inactiveBackground",.5),light:"#5f5f5f18"},m(1301,"Background color for the inline edit gutter indicator.")),Ca=W("inlineEdit.originalBorder",{light:eo,dark:eo,hcDark:eo,hcLight:eo},m(1302,"Border color for the original text in inline edits.")),Sa=W("inlineEdit.modifiedBorder",{light:Dn(Yo,.6),dark:Yo,hcDark:Yo,hcLight:Yo},m(1303,"Border color for the modified text in inline edits.")),QH=W("inlineEdit.tabWillAcceptModifiedBorder",{light:Dn(Sa,0),dark:Dn(Sa,0),hcDark:Dn(Sa,0),hcLight:Dn(Sa,0)},m(1304,"Modified border color for the inline edits widget when tab will accept it.")),eW=W("inlineEdit.tabWillAcceptOriginalBorder",{light:Dn(Ca,0),dark:Dn(Ca,0),hcDark:Dn(Ca,0),hcLight:Dn(Ca,0)},m(1305,"Original border color for the inline edits widget over the original text when tab will accept it."));function al(n){return n.map(e=>e===Qe.Accept?QH:Sa)}function Ah(n){return n.map(e=>e===Qe.Accept?eW:Ca)}function Tt(n,e){let t;typeof n=="string"?t=lr(n,e):t=n.map((s,o)=>lr(s,e).read(o));const i=lr(nc,e);return t.map((s,o)=>s.makeOpaque(i.read(o)))}function Is(n){let e;switch(n){case gt.TextEditor:e=nc;break;case gt.DiffEditor:e=nc;break;case gt.Notebook:e="notebook.cellEditorBackground";break;default:bm(n,"Not supported editor type yet")}return De(e)}function lr(n,e){return _R({owner:{observeColor:n},equalsFn:(t,i)=>t.equals(i),debugName:()=>`observeColor(${n})`},e.onDidColorThemeChange,()=>{const t=e.getColorTheme().getColor(n);if(!t)throw new pt(`Missing color: ${n}`);return t})}function Rn(n,e,t){const i=n.model.read(t);if(!i)return 0;let s=0;for(let r=e.startLineNumber;r<e.endLineNumberExclusive;r++){const a=n.getWidthOfLine(r,t);s=Math.max(s,a)}const o=e.mapToLineArray(r=>i.getLineContent(r));return s<5&&o.some(r=>r.length>0)&&i.uri.scheme!=="file"&&console.log("unexpected width"),s}function tW(n,e,t){sc(n,n.editor.onDidChangeLineHeight).read(t);const i=n.model.read(t);if(!i)throw new pt("Model is required");const s=[];for(let o=e.startLineNumber;o<e.endLineNumberExclusive;o++){let r=n.getWidthOfLine(o,t);r===-1&&(r=i.getLineMaxColumn(o)*n.editor.getOption(59).typicalHalfwidthCharacterWidth);const a=n.editor.getLineHeightForPosition(new B(o,1));s.push(new F_(r,a))}return s}function iW(n,e,t){return n.layoutInfo.read(t),n.value.read(t),n.model.read(t)?(n.scrollTop.read(t),n.editor.getOffsetForColumn(e.lineNumber,e.column)):0}function V_(n,e,t,i,s=void 0){const o=i.getModel();if(!o)return{prefixTrim:0,prefixLeftOffset:0};const r=n.map(h=>h.isSingleLine()?h.startColumn-1:0),a=e.mapToLineArray(h=>Fv(o.getLineContent(h))),l=t.filter(h=>h!=="").map(h=>Fv(h)),d=Math.min(...r,...a,...l);let c;if(o.getLineIndentColumn(e.startLineNumber)>=d+1)je(i).scrollTop.read(s),c=i.getOffsetForColumn(e.startLineNumber,d+1);else if(t.length>0)c=B_(t[0].slice(0,d),i,o);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:d,prefixLeftOffset:c}}function B_(n,e,t){const i=e.getOption(59).typicalHalfwidthCharacterWidth,s=t.getOptions().tabSize*i,o=n.split(" ").length-1;return(n.length-o)*i+o*s}function U_(n){const e=n.layoutInfoContentLeft,t=R({name:"editor.validOverlay.width"},s=>{const o=n.layoutInfoMinimap.read(s).minimapLeft!==0,r=Math.max(0,n.layoutInfoWidth.read(s)-e.read(s));if(o){const a=n.layoutInfoMinimap.read(s).minimapWidth+n.layoutInfoVerticalScrollbarWidth.read(s);return Math.max(0,r-a)}return r}),i=R({name:"editor.validOverlay.height"},s=>n.layoutInfoHeight.read(s)+n.contentHeight.read(s));return R({name:"editor.validOverlay"},s=>ut.fromLeftTopWidthHeight(e.read(s),0,t.read(s),i.read(s)))}function nW(n,e){const t=[];for(const i of n){const s=e.mapRange(i.modifiedRange);t.push(new OS(i.originalRange,s))}return t}function zd(...n){return n.filter(e=>typeof e=="string").join(" ")}function sW(n,e){return new x(e.lineNumber,e.column+n.start,e.lineNumber,e.column+n.endExclusive)}function oW(n,e){let t=0;e:for(let i=0,s=n.length;i<s;i++)switch(n.charCodeAt(i)){case 9:t+=e;break;case 32:t++;break;default:break e}return t-t%e}function rW(n,e,t){let i=e-e%t,s=0;for(;s<n.length&&i!==0;s++)switch(n.charCodeAt(s)){case 9:i-=t;break;case 32:i--;break;default:throw new pt("Unexpected character found while calculating indent length")}return s}function aW(n,e,t){const i=Fn(n),s=[],o=fE(e.mapToLineArray(r=>oW(i[r-1],t)),ro);return e.forEach(r=>{const a=rW(i[r-1],o,t);s.push(new Be(sW(new Ke(0,a),new B(r,1)),""))}),new Ln(s)}var pf=class{constructor(){this._data=""}moveTo(n){return this._data+=`M ${n.x} ${n.y} `,this}lineTo(n){return this._data+=`L ${n.x} ${n.y} `,this}build(){return this._data}};function gn(n){const e=ks(void 0,(t,i)=>n.read(t)||i);return nn({debugName:()=>`${n.debugName}.mapOutFalsy`},t=>{if(e.read(t),!!n.read(t))return e})}function Wt(n,e=ph.ofCaller()){return{left:R({name:"editor.validOverlay.left"},t=>n(t)?.left,e),top:R({name:"editor.validOverlay.top"},t=>n(t)?.top,e),width:R({name:"editor.validOverlay.width"},t=>{const i=n(t);if(i)return i.width},e),height:R({name:"editor.validOverlay.height"},t=>{const i=n(t);if(i)return i.height},e)}}function lW(n,e){const t=n.getContainerDomNode(),i=Fe("domRect",t.getBoundingClientRect());return e.add(n.onDidLayoutChange(s=>{i.set(t.getBoundingClientRect(),void 0)})),i}var dW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},xu=function(n,e){return function(t,i){e(t,i,n)}},ff=class{constructor(e,t,i,s,o,r){this._editorObs=e,this._data=t,this._close=i,this._contextKeyService=s,this._keybindingService=o,this._commandService=r,this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(a=>a.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){const e=Fe("active",void 0),t=f=>({title:f.title,icon:f.icon,keybinding:typeof f.commandId=="string"?this._getKeybinding(f.commandArgs?void 0:f.commandId):R(this,_=>typeof f.commandId=="string"?void 0:this._getKeybinding(f.commandArgs?void 0:f.commandId.read(_)).read(_)),isActive:e.map(_=>_===f.id),onHoverChange:_=>e.set(_?f.id:void 0,void 0),onAction:()=>{const _=typeof f.commandId=="string"?f.commandId:f.commandId.get();return this._close(!0,_),this._commandService.executeCommand(_,...f.commandArgs??[])}}),i=this._data.extensionCommands.map(f=>f.map((_,v)=>Gn(t({id:_.command.id+"_"+v,title:_.command.title,icon:_.icon??V.symbolEvent,commandId:_.command.id,commandArgs:_.command.arguments})))),s=[];for(const f of i)f.length>0&&(s.push(Iu()),s.push(...f));if(this._data.extensionCommandsOnly)return DC(s.slice(1));const o=cW(this._data.displayName),r=Gn(t({id:"gotoAndAccept",title:m(1276,"Go To / Accept"),icon:V.check,commandId:Sr})),a=Gn(t({id:"reject",title:m(1277,"Reject"),icon:V.close,commandId:Zy})),l=this._data.alternativeAction?Gn(t({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:bh})):void 0,d=[],c=this._inlineEditsShowCollapsed.map(f=>Gn(t(f?{id:"showExpanded",title:m(1278,"Show Expanded"),icon:V.expandAll,commandId:Tg}:{id:"showCollapsed",title:m(1279,"Show Collapsed"),icon:V.collapseAll,commandId:Tg}))),h=Gn(t({id:"snooze",title:m(1280,"Snooze"),icon:V.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),u=Gn(t({id:"settings",title:m(1281,"Settings"),icon:V.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),g=this._data.action?[this._data.action]:[],p=g.length>0?hW(g.map(f=>({id:f.id,label:f.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(f.id,...f.arguments??[]),class:void 0,tooltip:f.tooltip??f.title})),{hoverDelegate:lT}):void 0;return DC([o,r,l,a,c,d.length?Iu():void 0,...d,h,u,...s,p?Iu():void 0,p])}_getKeybinding(e){return e?Bt(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e)):ye(void 0)}};ff=dW([xu(3,Ce),xu(4,He),xu(5,ht)],ff);function DC(n){return $.div({class:"content",style:{margin:4,minWidth:180}},n)}function cW(n){return $.div({class:"header",style:{color:De(mm),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[n])}function Gn(n){return R({name:"inlineEdits.option"},e=>$.div({class:["monaco-menu-option",n.isActive?.map(t=>t&&"active")],onmouseenter:()=>n.onHoverChange?.(!0),onmouseleave:()=>n.onHoverChange?.(!1),onclick:n.onAction,onkeydown:t=>{t.key==="Enter"&&n.onAction?.()},tabIndex:0,style:{borderRadius:3}},[$.elem("span",{style:{fontSize:16,display:"flex"}},[ce.isThemeIcon(n.icon)?an(n.icon):n.icon.map(t=>an(t))]),$.elem("span",{},[n.title]),$.div({style:{marginLeft:"auto"},ref:t=>{const i=e.store.add(new bl(t,_l,{disableTitle:!0,...dw,keybindingLabelShadow:void 0,keybindingLabelForeground:De(mm),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));e.store.add(ge(s=>{i.set(n.keybinding.read(s))}))}})]))}function hW(n,e){return R({name:"inlineEdits.actionBar"},t=>$.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[$.div({ref:i=>{t.store.add(new _s(i,e)).push(n,{icon:!1,label:!0})}})]))}function Iu(){return $.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:De(XE),padding:"2px 0"}},$.div({style:{borderBottom:`1px solid ${De(Mm)}`}}))}var uW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Yr=function(n,e){return function(t,i){e(t,i,n)}},fL=class{constructor(n,e,t,i,s){this.gutterMenuData=n,this.originalRange=e,this.model=t,this.altAction=i,this.customization=s}},mL=class _L{static fromInlineSuggestion(e){const t=e.action?.kind==="edit"?e.action.alternativeAction:void 0,i=e.source.inlineSuggestions.commands??[];return new _L(e.gutterMenuLinkAction,e.source.provider.displayName??m(1282,"Inline Suggestion"),i.length>0?[i]:[],t,e.source.provider.modelInfo,e.source.provider.setModelId?.bind(e.source.provider))}constructor(e,t,i,s,o,r,a=!1){this.action=e,this.displayName=t,this.extensionCommands=i,this.alternativeAction=s,this.modelInfo=o,this.setModelId=r,this.extensionCommandsOnly=a}},vL=class bL{static fromInlineCompletionModel(e){return new bL(()=>e.accept(),()=>e.jump())}constructor(e,t){this.accept=e,this.jump=t}},EC=16,gW=2,Fc=class extends M{constructor(e,t,i,s,o,r,a,l,d,c,h){super(),this._editorObs=e,this._data=t,this._tabAction=i,this._verticalOffset=s,this._isHoveringOverInlineEdit=o,this._focusIsInMenu=r,this._hoverService=a,this._instantiationService=l,this._accessibilityService=d,this._themeService=c,this._userInteractionService=h,this._onDidCloseWithCommand=this._register(new ee),this._modifierPressed=R(this,g=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),g).shiftKey),this._gutterIndicatorStyles=R(this,g=>{let p=this._tabAction.read(g);const f=this._data.read(g)?.altAction,_=this._modifierPressed.read(g);switch(f&&_&&(p=Qe.Inactive),p){case Qe.Inactive:return{background:Tt(H_,this._themeService).read(g).toString(),foreground:Tt(ZH,this._themeService).read(g).toString(),border:Tt(XH,this._themeService).read(g).toString()};case Qe.Jump:return{background:Tt(Ol,this._themeService).read(g).toString(),foreground:Tt(rl,this._themeService).read(g).toString(),border:Tt(ds,this._themeService).read(g).toString()};case Qe.Accept:return{background:Tt(W_,this._themeService).read(g).toString(),foreground:Tt(YH,this._themeService).read(g).toString(),border:Tt(pL,this._themeService).read(g).toString()};default:bm()}}),this._state=R(this,g=>{const p=this._originalRangeObs.read(g);if(p)return{range:p,lineOffsetRange:this._editorObs.observeLineOffsetRange(p,g.store)}}),this._lineNumberToRender=R(this,g=>{if(this._verticalOffset.read(g)!==0)return"";const p=this._data.read(g)?.originalRange.startLineNumber,f=this._editorObs.getOption(76).read(g);if(p===void 0||f.renderType===0)return"";if(f.renderType===3){const _=this._editorObs.cursorPosition.read(g);return p%10===0||_&&_.lineNumber===p?p.toString():""}if(f.renderType===2){const _=this._editorObs.cursorPosition.read(g);if(!_)return"";const v=Math.abs(p-_.lineNumber);return v===0?p.toString():v.toString()}return f.renderType===4?f.renderFn?f.renderFn(p):"":p.toString()}),this._availableWidthForIcon=R(this,g=>{const p=this._editorObs.editor.getModel(),f=this._editorObs.editor,_=this._editorObs.layoutInfo.read(g),v=_.decorationsLeft+_.decorationsWidth-_.glyphMarginLeft;if(!p||v<=0)return()=>0;if(_.lineNumbersLeft===0)return()=>v;const C=this._editorObs.getOption(76).read(g);if(C.renderType===2||C.renderType===0)return()=>v;const w=f.getOption(59).typicalHalfwidthCharacterWidth,y=_.lineNumbersLeft+_.lineNumbersWidth,D=(p.getLineCount()+1).toString().length,b=[];for(let I=1;I<=D;I++){const N=10**(I-1),T=f.getTopForLineNumber(N),E=I*w,F=Math.min(v,Math.max(0,y-E-_.glyphMarginLeft));b.push({firstLineNumberWithDigitCount:N,topOfLineNumber:T,usableWidthLeftOfLineNumber:F})}return I=>{for(let N=b.length-1;N>=0;N--)if(I>=b[N].topOfLineNumber)return b[N].usableWidthLeftOfLineNumber;throw new pt("Could not find avilable width for icon")}}),this._layout=R(this,g=>{const p=this._state.read(g);if(!p)return;const f=this._editorObs.layoutInfo.read(g),_=this._editorObs.observeLineHeightForLine(p.range.map(Re=>Re.startLineNumber)).read(g),v=1,C=2,w=f.decorationsLeft+f.decorationsWidth-f.glyphMarginLeft-2,y=f.height-4,D=ut.fromLeftTopWidthHeight(v,C,w,y),b=D.withTop(this._stickyScrollHeight.read(g)),I=D.withTop(b.top+C),N=p.lineOffsetRange.read(g),T=ut.fromRanges(Ke.fromTo(I.left,I.right),N),E=_,F=this._verticalOffset.read(g),q=T.withHeight(E).translateY(F),re=b.containsRect(q),be=this._data.read(g)?.customization?.icon,pe=be?ye(be):this._tabAction.map(Re=>Re===Qe.Accept?V.keyboardTab:V.arrowRight),Y=be?ye(be):R(this,Re=>this._isHoveredOverIconDebounced.read(Re)||this._isHoveredOverInlineEditDebounced.read(Re)?V.check:this._tabAction.read(Re)===Qe.Accept?V.keyboardTab:(this._editorObs.cursorLineNumber.read(Re)??0)<=p.range.read(Re).startLineNumber?V.keyboardTabAbove:V.keyboardTabBelow),ue=22,xe=Re=>{const Et=this._availableWidthForIcon.read(void 0)(Re.bottom+this._editorObs.editor.getScrollTop())-v;return Math.max(Math.min(Et,ue),EC)};if(re){const Re=q;let Et;f.lineNumbersWidth===0?Et=Math.max(0,Math.min(Math.max(f.lineNumbersLeft-D.left,0),Re.width-ue)):Et=Math.max(f.lineNumbersLeft+f.lineNumbersWidth-D.left,0);const qn=Re.withWidth(Et),qt=18,Xi=Math.min(Re.width-Et,ue);return{gutterEditArea:T,icon:Y,iconDirection:"right",iconRect:Re.withWidth(Math.max(Xi,qt)).translateX(Et),iconVisible:Xi>=qt,pillRect:Re,lineNumberRect:qn}}const Oe=D.intersect(T);if(Oe&&Oe.height>=E){const Re=q.moveToBeContainedIn(I).moveToBeContainedIn(Oe),Et=Re.withWidth(xe(Re));return{gutterEditArea:T,icon:Y,iconDirection:"right",iconRect:Et,pillRect:Et,iconVisible:!0}}const _e=q.moveToBeContainedIn(D),Ue=_e.withWidth(xe(_e)),rt=Ue;return{gutterEditArea:T,icon:pe,iconDirection:Ue.top<q.top?"top":"bottom",iconRect:rt,pillRect:Ue,iconVisible:!0}}),this._iconRef=$.ref(),this.isVisible=this._layout.map(g=>!!g),this._hoverVisible=Fe(this,!1),this.isHoverVisible=this._hoverVisible,this._isHoveredOverIcon=Fe(this,!1),this._isHoveredOverIconDebounced=Nv(this._isHoveredOverIcon,100),this.isHoveredOverIcon=this._isHoveredOverIconDebounced,this._indicator=$.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},gn(this._layout).map(g=>g?[$.div({style:{position:"absolute",background:De(JH),borderRadius:"3px",...Wt(p=>g.read(p).gutterEditArea)}}),$.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{const p=this._layout.get()?.icon.get()===V.check,f=this._data.get();if(!f)throw new pt("Gutter indicator data not available");this._editorObs.editor.focus(),p?f.model.accept():f.model.jump()},onmouseenter:()=>{this._isHoveredOverIcon.set(!0,void 0),this._showHover()},onmouseleave:()=>this._isHoveredOverIcon.set(!1,void 0),style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map(p=>p.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(p=>p.foreground),border:this._gutterIndicatorStyles.map(p=>`1px solid ${p.border}`),boxSizing:"border-box",borderRadius:"3px",display:"flex",justifyContent:g.map(p=>p.iconDirection==="bottom"?"flex-start":"flex-end"),transition:this._modifierPressed.map(p=>p?"":"background-color 0.2s ease-in-out, width 0.2s ease-in-out"),...Wt(p=>g.read(p).pillRect)}},[$.div({className:"line-number",style:{lineHeight:g.map(p=>p.lineNumberRect?p.lineNumberRect.height:0),display:g.map(p=>p.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:g.map(p=>p.lineNumberRect?p.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map(p=>p.foreground)}},this._lineNumberToRender),$.div({style:{transform:g.map(p=>`rotate(${pW(p.iconDirection)}deg)`),transition:"rotate 0.2s ease-in-out, opacity 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",opacity:g.map(p=>p.iconVisible?"1":"0"),marginRight:g.map(p=>p.pillRect.width-p.iconRect.width-(p.lineNumberRect?.width??0)),width:g.map(p=>p.iconRect.width),position:"relative",right:g.map(p=>p.iconDirection==="top"?"1px":"0"),color:this._data.map(p=>p?.customization?.icon?.color?De(p.customization.icon.color.id):void 0)}},[g.map((p,f)=>fW(an(p.icon.read(f)),{fontSize:mW(Math.min(p.iconRect.width-gW,EC))}))])])]:[])),this._originalRangeObs=gn(this._data.map(g=>g?.originalRange)),this._stickyScrollController=Pi.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?Bt(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):ye(0),this._isHoveredOverInlineEditDebounced=Nv(this._isHoveringOverInlineEdit,100);const u=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:u.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:ye(0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._register(or(this._isHoveredOverInlineEditDebounced,g=>{g&&this.triggerAnimation()})),this._register(ge(g=>{u.readEffect(g),u.element&&this._editorObs.editor.applyFontInfo(u.element)}))}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map(e=>e.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;const e=this._data.get();if(!e)throw new pt("Gutter indicator data not available");const t=new O,i=t.add(this._instantiationService.createInstance(ff,this._editorObs,e.gutterMenuData,(r,a)=>{r&&this._editorObs.editor.focus(),a&&this._onDidCloseWithCommand.fire(a),o?.dispose()}).toDisposableLiveElement()),s=this._userInteractionService.createFocusTracker(i.element,t);t.add(ge(r=>{this._focusIsInMenu.set(s.read(r),void 0)})),t.add(Te(()=>this._focusIsInMenu.set(!1,void 0)));const o=this._hoverService.showInstantHover({target:this._iconRef.element,content:i.element});o?(this._hoverVisible.set(!0,void 0),t.add(this._editorObs.editor.onDidScrollChange(()=>o.dispose())),t.add(o.onDispose(()=>{this._hoverVisible.set(!1,void 0),t.dispose()}))):t.dispose()}};Fc=uW([Yr(6,fi),Yr(7,ne),Yr(8,So),Yr(9,Dt),Yr(10,Qc)],Fc);function pW(n){switch(n){case"top":return 90;case"bottom":return-90;case"right":return 0}}function fW(n,e){for(const t in e)n.style[t]=e[t];return n}function mW(n){return`${n}px`}var _W=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},RC=function(n,e){return function(t,i){e(t,i,n)}},Qt;(function(n){n.FirstTime="firstTime",n.SecondTime="secondTime",n.Active="active"})(Qt||(Qt={}));var mf=class extends M{constructor(e,t,i,s,o){super(),this._model=e,this._indicator=t,this._collapsedView=i,this._storageService=s,this._configurationService=o,this._disposables=this._register(new We),this._setupDone=Fe({name:"setupDone"},!1),this._activeCompletionId=R(r=>{const a=this._model.read(r);if(!a||!this._setupDone.read(r))return;const l=this._indicator.read(r);if(!(!l||!l.isVisible.read(r)))return a.inlineEdit.inlineCompletion.identity.id}),this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()===Qt.Active)return;const e=new O;let t=!1,i=!1,s=0,o=0;return e.add(oE(this._activeCompletionId,async(r,a,l,d)=>{if(r===void 0)return;let c=this.getNewUserType();switch(c){case Qt.FirstTime:(s++>=5||t)&&(c=Qt.SecondTime,this.setNewUserType(c));break;case Qt.SecondTime:o++>=3&&i&&(c=Qt.Active,this.setNewUserType(c))}switch(c){case Qt.FirstTime:for(let h=0;h<3&&!d.isCancellationRequested;h++)await this._indicator.get()?.triggerAnimation(),await sh(500);break;case Qt.SecondTime:this._indicator.get()?.triggerAnimation()}})),e.add(ge(r=>{this._collapsedView.isVisible.read(r)&&this.getNewUserType()!==Qt.Active&&this._collapsedView.triggerAnimation()})),e.add(ge(r=>{const a=this._indicator.read(r);a&&r.store.add(or(a.isHoveredOverIcon,async l=>{l&&(t=!0)}))})),e.add(ge(r=>{const a=this._model.read(r);a&&r.store.add(a.onDidAccept(()=>{i=!0}))})),e}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,Qt.FirstTime)}setNewUserType(e){switch(e){case Qt.FirstTime:throw new pt("UserKind should not be set to first time");case Qt.SecondTime:break;case Qt.Active:this._disposables.clear()}this._storageService.store("inlineEditsGutterIndicatorUserKind",e,-1,0)}_initializeDebugSetting(){const e="editor.inlineSuggest.edits.resetNewUserExperience";return this._configurationService.getValue(e)&&this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._configurationService.onDidChangeConfiguration(t=>{t.affectsConfiguration(e)&&this._configurationService.getValue(e)&&(this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience())})}};mf=_W([RC(3,Ni),RC(4,Ee)],mf);var vW=class CL{static{this.empty=new CL([])}constructor(e){this.replacements=e,jE(TS(e,(t,i)=>t.lineRange.endLineNumberExclusive<=i.lineRange.startLineNumber))}toString(){return this.replacements.map(e=>e.toString()).join(",")}getNewLineRanges(){const e=[];let t=0;for(const i of this.replacements)e.push(ft.ofLength(i.lineRange.startLineNumber+t,i.newLines.length)),t+=i.newLines.length-i.lineRange.length;return e}},Lu=class SL{static fromSingleTextEdit(e,t){const i=Fn(e.text);let s=e.range.startLineNumber;const o=t.getValueOfRange(x.fromPositions(new B(e.range.startLineNumber,1),e.range.getStartPosition()));i[0]=o+i[0];let r=e.range.endLineNumber+1;const a=t.getTransformer().getLineLength(e.range.endLineNumber)+1,l=t.getValueOfRange(x.fromPositions(e.range.getEndPosition(),new B(e.range.endLineNumber,a)));i[i.length-1]=i[i.length-1]+l;const d=e.range.startColumn===t.getTransformer().getLineLength(e.range.startLineNumber)+1,c=e.range.endColumn===1;return d&&i[0].length===o.length&&(s++,i.shift()),i.length>0&&s<r&&c&&i[i.length-1].length===l.length&&(r--,i.pop()),new SL(new ft(s,r),i)}constructor(e,t){this.lineRange=e,this.newLines=t}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}toLineEdit(){return new vW([this])}},bW=class{get lineEdit(){return this.action?.kind==="jumpTo"?new Lu(ft.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind==="edit"?Lu.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new Lu(new ft(1,1),[])}get originalLineRange(){return this.lineEdit.lineRange}get modifiedLineRange(){return this.lineEdit.toLineEdit().getNewLineRanges()[0]}get displayRange(){return this.originalText.lineRange.intersect(this.originalLineRange.join(ft.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}constructor(n,e,t,i,s,o,r){this.originalText=n,this.action=e,this.edit=t,this.cursorPosition=i,this.multiCursorPositions=s,this.commands=o,this.inlineCompletion=r}},CW=class{constructor(n,e,t){this._model=n,this.inlineEdit=e,this.tabAction=t,this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=R(this,i=>XI(this._model.editor,this.inlineEdit.inlineCompletion,i)),this.onDidAccept=this._model.onDidAccept}accept(n){this._model.accept(void 0,n)}handleInlineEditShownNextFrame(n,e){const t=this.inlineEdit.inlineCompletion,i=Date.now();t.addRef(),pE(()=>{this._model.handleInlineSuggestionShown(t,n,e,i),t.removeRef()})}},SW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},wW=function(n,e){return function(t,i){e(t,i,n)}},_f=class extends M{constructor(e,t,i){super(),this._editor=e,this._edit=t,this._accessibilityService=i,this.onDidClick=Ge.None,this._iconRef=$.ref(),this.isHovered=ye(!1),this._editorObs=je(this._editor);const s=this._edit.map(l=>l?.edit?.replacements[0]??null).map(l=>l?ms(l,this._editor.getModel()).range.getStartPosition():null),o=this._editorObs.observePosition(s,this._store),r=R(l=>{const d=o.read(l);if(!d)return null;const c=this._editorObs.layoutInfoContentLeft.read(l),h=this._editorObs.scrollLeft.read(l);return new zi(c+d.x-h,d.y)}),a=$.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(r)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:a,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:ye(0)})),this.isVisible=this._edit.map((l,d)=>!!l&&r.read(d)!==null)}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:.2,transform:"translateY(1px)"},{offset:.36,transform:"translateY(-1px)"},{offset:.52,transform:"translateY(1px)"},{offset:.68,transform:"translateY(-1px)"},{offset:.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2e3}).finished}getCollapsedIndicator(e){const t=this._editorObs.layoutInfoContentLeft,i=e.map((o,r)=>o?o.deltaX(-t.read(r)):null),s=this.createIconPath(i);return $.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...Wt(o=>U_(this._editorObs).read(o)),overflow:"hidden",pointerEvents:"none"}},[$.svgElem("path",{class:"collapsedViewPath",d:s,fill:De(ds)})])}createIconPath(e){return e.map(o=>{if(!o)return new pf().build();const r=o.deltaX(-3).deltaY(-1),a=r.deltaX(6),l=r.deltaY(1),d=a.deltaY(1),c=l.deltaX(6/2).deltaY(3);return new pf().moveTo(r).lineTo(a).lineTo(d).lineTo(c).lineTo(l).lineTo(r).build()})}};_f=SW([wW(2,So)],_f);var yW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},TC=function(n,e){return function(t,i){e(t,i,n)}},PC=14,xW=0,Jr=4,kC=4,vf=class extends M{constructor(e,t,i,s,o,r){super(),this._editor=e,this._languageService=r,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._isHovered=Fe(this,!1),this.isHovered=this._isHovered,this._viewRef=$.ref(),this._editorObs=je(this._editor);const a=i.map((h,u)=>{let g;switch(h){case Qe.Inactive:g=H_;break;case Qe.Jump:g=Ol;break;case Qe.Accept:g=W_}return{border:Tt(g,o).read(u).toString(),background:Is(s.read(u))}}),l=t.map(h=>h?this.getState(h):void 0),d=l.map(h=>h?this.getRendering(h,a):void 0);this.minEditorScrollHeight=R(this,h=>{const u=l.read(h);return u?u.rect.read(h).bottom+this._editor.getScrollTop():0});const c=$.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[d]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:c.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:ks(this,(h,u)=>{const g=l.read(h);if(!g)return u??0;const p=g.rect.map(f=>f.right).read(h)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(h)+Jr-this._editorObs.layoutInfoContentLeft.read(h);return Math.max(u??0,p)}).recomputeInitiallyAndOnChange(this._store)})),this._register(ge(h=>{if(!d.read(h)){this._isHovered.set(!1,void 0);return}this._isHovered.set(c.isHovered.read(h),void 0)}))}fitsInsideViewport(e,t,i){const s=this._editorObs.layoutInfoWidth.read(i),o=this._editorObs.layoutInfoContentLeft.read(i),r=this._editor.getLayoutInfo().verticalScrollbarWidth,a=this._editorObs.layoutInfoMinimap.read(i).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(i).minimapWidth:0;return Rn(this._editorObs,e,void 0)+B_(t,this._editor,this._editor.getModel())+18<s-o-r-a}getState(e){const t=R(this,r=>{const a=e.range.startLineNumber,l=e.range.endLineNumber,d=e.range.startColumn,c=e.range.endColumn,h=this._editor.getModel()?.getLineCount()??0;return{lineWidth:Rn(this._editorObs,new ft(a,a+1),r),lineWidthBelow:a+1<=h?Rn(this._editorObs,new ft(a+1,a+2),r):void 0,lineWidthAbove:a-1>=1?Rn(this._editorObs,new ft(a-1,a),r):void 0,startContentLeftOffset:this._editor.getOffsetForColumn(a,d),endContentLeftOffset:this._editor.getOffsetForColumn(l,c)}}),i=e.range.startLineNumber,s=e.range.endLineNumber,o=this.fitsInsideViewport(new ft(i,s+1),e.content,void 0);return{rect:R(this,r=>{const a=this._editorObs.getOption(59).read(r).typicalHalfwidthCharacterWidth,{lineWidth:l,lineWidthBelow:d,lineWidthAbove:c,startContentLeftOffset:h,endContentLeftOffset:u}=t.read(r),g=this._editorObs.layoutInfoContentLeft.read(r),p=this._editorObs.observeLineHeightForLine(i).recomputeInitiallyAndOnChange(r.store).read(r),f=this._editorObs.scrollTop.read(r),_=this._editorObs.scrollLeft.read(r);let v;i===s&&u+5*a>=l&&o?v="end":d!==void 0&&d+PC-kC-Jr<h?v="below":c!==void 0&&c+PC-kC-Jr<h?v="above":v="end";let C,w,y=0,D=0;switch(v){case"end":C=this._editorObs.editor.getTopForLineNumber(i),w=l,y=18;break;case"below":C=this._editorObs.editor.getTopForLineNumber(i+1),w=h,y=8,D=2;break;case"above":C=this._editorObs.editor.getTopForLineNumber(i-1),w=h,y=8,D=2}return ut.fromLeftTopWidthHeight(g+w-_,C-f,a*e.content.length,p).withMargin(xW,Jr).translateX(y).translateY(D)}),label:e.content,kind:e.style}}getRendering(e,t){const i=document.createElement("div"),s=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0];let o;s&&e.kind===Y0.Code?o=lh.fromLineTokens(s).toLineTokens(e.label,this._languageService.languageIdCodec):o=Nr.createEmpty(e.label,this._languageService.languageIdCodec);const r=Zc(new Jc([o]),ah.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],i,!0);i.style.width=`${r.minWidthInPx}px`;const a=e.rect.map(l=>l.withMargin(0,Jr));return $.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...Wt(l=>a.read(l)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(l=>`1px solid ${l.border}`),borderRadius:"3px",backgroundColor:t.map(l=>l.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:l=>{l.preventDefault()},onclick:l=>{this._onDidClick.fire(Wr.create(l))}},[i])}};vf=yW([TC(4,Dt),TC(5,Bn)],vf);var IW=0,LW=0,Du=1,DW=1,EW=3,Eu=3,RW=class extends M{constructor(n,e,t,i){super(),this._editor=n,this._edit=e,this._uiState=t,this._tabAction=i,this.onDidClick=Ge.None,this._display=R(this,r=>this._uiState.read(r)?"block":"none"),this._editorMaxContentWidthInRange=R(this,r=>{const a=this._originalDisplayRange.read(r);return a?(this._editorObs.versionId.read(r),ks(this,(l,d)=>{const c=Rn(this._editorObs,a,l);return Math.max(c,d??0)})):ye(0)}).map((r,a)=>r.read(a)),this._maxPrefixTrim=R(this,r=>{const a=this._uiState.read(r);return a?V_(a.deletions,a.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}}),this._editorLayoutInfo=R(this,r=>{const a=this._edit.read(r);if(!a||!this._uiState.read(r))return null;const l=this._editorObs.layoutInfo.read(r),d=this._editorObs.scrollLeft.read(r),c=this._editorObs.getOption(59).map(_=>_.typicalHalfwidthCharacterWidth).read(r),h=l.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(r),c)-d,u=a.originalLineRange,g=this._originalVerticalStartPosition.read(r)??this._editor.getTopForLineNumber(u.startLineNumber)-this._editorObs.scrollTop.read(r),p=this._originalVerticalEndPosition.read(r)??this._editor.getTopForLineNumber(u.endLineNumberExclusive)-this._editorObs.scrollTop.read(r),f=l.contentLeft+this._maxPrefixTrim.read(r).prefixLeftOffset-d;return h<=f?null:{codeRect:ut.fromLeftTopRightBottom(f,g,h,p).withMargin(LW,IW),contentLeft:l.contentLeft}}).recomputeInitiallyAndOnChange(this._store),this._originalOverlay=$.div({style:{pointerEvents:"none"}},R(this,r=>{const a=gn(this._editorLayoutInfo).read(r);if(!a)return;const l=a.map(g=>ut.fromLeftTopRightBottom(g.contentLeft-Eu-Du,g.codeRect.top,g.contentLeft,g.codeRect.bottom)),d=R(this,g=>{const p=a.read(g).codeRect,f=l.read(g);return p.intersectHorizontal(new Ke(f.left,Number.MAX_SAFE_INTEGER))}),c=this._uiState.map(g=>g?.editorType===gt.DiffEditor?EW:DW).read(r),h=d.map(g=>g.withMargin(c,c)),u=Is(this._uiState.map(g=>g?.editorType??gt.TextEditor).read(r));return[$.div({class:"originalSeparatorDeletion",style:{...h.read(r).toStyles(),borderRadius:`${Eu}px`,border:`${Du+c}px solid ${u}`,boxSizing:"border-box"}}),$.div({class:"originalOverlayDeletion",style:{...d.read(r).toStyles(),borderRadius:`${Eu}px`,border:Ah(this._tabAction).map(g=>`${Du}px solid ${De(g)}`),boxSizing:"border-box",backgroundColor:De(ka)}}),$.div({class:"originalOverlayHiderDeletion",style:{...l.read(r).toStyles(),backgroundColor:u}})]})).keepUpdated(this._store),this._nonOverflowView=$.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store),this.isHovered=ye(!1),this._editorObs=je(this._editor);const s=R(this,r=>{const a=this._edit.read(r);return a?new B(a.originalLineRange.startLineNumber,1):null}),o=R(this,r=>{const a=this._edit.read(r);return a?new B(a.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(r=>r?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(s,this._store).map(r=>r?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(o,this._store).map(r=>r?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:R(this,r=>{const a=this._editorLayoutInfo.read(r);return a===null?0:a.codeRect.width})}))}},TW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},NC=function(n,e){return function(t,i){e(t,i,n)}},Wo=1,PW=1,kW=3,Ru=3,bf=class extends M{constructor(e,t,i,s,o){super(),this._editor=e,this._input=t,this._tabAction=i,this._languageService=o,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._state=R(this,r=>{const a=this._input.read(r);if(!a)return;const l=this._editor.getModel(),d=l.getEOL();if(a.startColumn===1&&a.lineNumber>1&&l.getLineLength(a.lineNumber)!==0&&a.text.endsWith(d)&&!a.text.startsWith(d)){const c=l.getLineLength(a.lineNumber-1)+1;return{lineNumber:a.lineNumber-1,column:c,text:d+a.text.slice(0,-d.length)}}return{lineNumber:a.lineNumber,column:a.startColumn,text:a.text}}),this._trimVertically=R(this,r=>{const a=this._state.read(r);if(!a)return{topOffset:0,contentHeight:0,linesTop:0,linesBottom:0};const l=a.text,d=this._editor.getLineHeightForPosition(new B(a.lineNumber,1)),c=this._editor.getModel().getEOL(),h=l.split(c).length;let u=0,g=0;if(l.trim()!==""){let p=0;for(;p<l.length&&l.startsWith(c,p);p+=c.length)u+=1;for(let f=l.length;f>p&&l.endsWith(c,f);f-=c.length)g+=1}return{topOffset:u*d,contentHeight:(h-u-g)*d,linesTop:u,linesBottom:g}}),this._maxPrefixTrim=R(this,r=>{const a=this._state.read(r);if(!a)return{prefixLeftOffset:0,prefixTrim:0};const l=this._editor.getModel(),d=l.getEOL(),c=this._trimVertically.read(r),h=a.text.split(d),u=h.slice(c.linesTop,h.length-c.linesBottom);c.linesTop===0&&(u[0]=l.getLineContent(a.lineNumber)+u[0]);const g=new ft(a.lineNumber,a.lineNumber+(c.linesTop>0?0:1));return V_([],g,u,this._editor)}),this._ghostText=R(r=>{const a=this._state.read(r),l=this._maxPrefixTrim.read(r);if(!a)return;const d=this._editor.getModel().getEOL(),c=a.text.split(d).map((h,u)=>new mw(new x(u+1,u===0?1:l.prefixTrim+1,u+1,h.length+1),"modified-background",0));return new nl(a.lineNumber,[new Tc(a.column,a.text,!1,c)])}),this._display=R(this,r=>this._state.read(r)?"block":"none"),this._editorMaxContentWidthInRange=R(this,r=>{const a=this._state.read(r);if(!a)return 0;this._editorObs.versionId.read(r);const l=this._editor.getModel(),d=l.getEOL(),c=a.text.startsWith(d)?"":l.getValueInRange(new x(a.lineNumber,1,a.lineNumber,a.column)),h=l.getValueInRange(new x(a.lineNumber,a.column,a.lineNumber,l.getLineLength(a.lineNumber)+1)),u=(c+a.text+h).split(d),g=ah.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),p=u.map(f=>{const _=l.tokenization.tokenizeLinesAt(a.lineNumber,[f])?.[0];let v;return _?v=lh.fromLineTokens(_).toLineTokens(f,this._languageService.languageIdCodec):v=Nr.createEmpty(f,this._languageService.languageIdCodec),Zc(new Jc([v]),g,[],H("div"),!0).minWidthInPx});return Math.max(...p)}),this.startLineOffset=this._trimVertically.map(r=>r.topOffset),this.originalLines=this._state.map(r=>r?new ft(r.lineNumber,Math.min(r.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0),this._overlayLayout=R(this,r=>{this._ghostText.read(r);const a=this._state.read(r);if(!a)return null;this._editorObs.observePosition(Fe(this,new B(a.lineNumber,a.column)),r.store).read(r);const l=this._editorObs.layoutInfo.read(r),d=this._editorObs.scrollLeft.read(r),c=this._editorObs.layoutInfoVerticalScrollbarWidth.read(r),h=l.contentLeft+this._editorMaxContentWidthInRange.read(r)-d,u=this._maxPrefixTrim.read(r).prefixLeftOffset??0,g=l.contentLeft+u-d;if(h<=g)return null;const{topOffset:p,contentHeight:f}=this._trimVertically.read(r),_=this._editorObs.scrollTop.read(r),v=this._editor.getTopForLineNumber(a.lineNumber)-_+p,C=v+f,w=new ut(g,v,h,C);return{overlay:w,startsAtContentLeft:u===0,contentLeft:l.contentLeft,minContentWidthRequired:u+w.width+c}}).recomputeInitiallyAndOnChange(this._store),this._modifiedOverlay=$.div({style:{pointerEvents:"none"}},R(this,r=>{const a=gn(this._overlayLayout).read(r);if(!a)return;const l=a.map(g=>ut.fromLeftTopRightBottom(g.contentLeft-Ru-Wo,g.overlay.top,g.contentLeft,g.overlay.bottom)).read(r),d=this._input.map(g=>g?.editorType===gt.DiffEditor?kW:PW).read(r),c=a.map(g=>g.overlay.withMargin(0,Wo,Wo,g.startsAtContentLeft?0:Wo).intersectHorizontal(new Ke(l.left,Number.MAX_SAFE_INTEGER))),h=c.map(g=>g.withMargin(d,d)),u=Is(this._input.read(void 0)?.editorType??gt.TextEditor);return[$.div({class:"originalUnderlayInsertion",style:{...h.read(r).toStyles(),borderRadius:Ru,border:`${Wo+d}px solid ${u}`,boxSizing:"border-box"}}),$.div({class:"originalOverlayInsertion",style:{...c.read(r).toStyles(),borderRadius:Ru,border:al(this._tabAction).map(g=>`${Wo}px solid ${De(g)}`),boxSizing:"border-box",backgroundColor:De(gL)}}),$.div({class:"originalOverlayHiderInsertion",style:{...l.toStyles(),backgroundColor:u}})]})).keepUpdated(this._store),this._view=$.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store),this._editorObs=je(this._editor),this._ghostTextView=this._register(s.createInstance(sl,this._editor,R(r=>{const a=this._ghostText.read(r);if(a)return{ghostText:a,handleInlineCompletionShown:l=>{},warning:void 0}}),{extraClasses:["inline-edit"],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(r=>{this._onDidClick.fire(new Wr(r))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:R(this,r=>{const a=this._overlayLayout.read(r);return a===null?0:a.minContentWidthRequired})}))}};bf=TW([NC(3,ne),NC(4,Bn)],bf);var NW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},MC=function(n,e){return function(t,i){e(t,i,n)}},Cf=class extends M{constructor(e,t,i,s,o,r){super(),this._editor=e,this._edit=t,this._editorType=i,this._tabAction=s,this._languageService=o,this._themeService=r,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._maxPrefixTrim=this._edit.map((a,l)=>a?V_(a.replacements.flatMap(d=>[d.originalRange,d.modifiedRange]),a.originalRange,a.modifiedLines,this._editor.editor,l):void 0),this._modifiedLineElements=R(this,a=>{const l=[];let d=0;const c=this._maxPrefixTrim.read(a),h=this._edit.read(a);if(!h||!c)return;const u=c.prefixTrim,g=MW(h.replacements.map(_=>_.modifiedRange)).map(_=>new x(_.startLineNumber,_.startColumn-u,_.endLineNumber,_.endColumn-u)),p=this._editor.model.get(),f=h.modifiedRange.startLineNumber;for(let _=0;_<h.modifiedRange.length;_++){const v=document.createElement("div"),C=f+_,w=h.modifiedLines[_].slice(u),y=p.tokenization.tokenizeLinesAt(C,[w])?.[0];let D;y?D=lh.fromLineTokens(y).toLineTokens(w,this._languageService.languageIdCodec):D=Nr.createEmpty(w,this._languageService.languageIdCodec);const b=[];for(const N of g.filter(T=>T.startLineNumber===C)){const T=Math.min(N.endColumn,w.length+1);b.push(new mw(new x(1,N.startColumn,1,T),"inlineCompletions-modified-bubble",0))}const I=Zc(new Jc([D]),ah.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),b,v,!0);this._editor.getOption(59).read(a),d=Math.max(d,I.minWidthInPx),l.push(v)}return{lines:l,requiredWidth:d}}),this._layout=R(this,a=>{const l=this._modifiedLineElements.read(a),d=this._maxPrefixTrim.read(a),c=this._edit.read(a);if(!l||!d||!c)return;const{prefixLeftOffset:h}=d,{requiredWidth:u}=l,g=this._editor.observeLineHeightsForLineRange(c.originalRange).read(a),p=(()=>{const pe=g.slice(0,c.modifiedRange.length);for(;pe.length<c.modifiedRange.length;)pe.push(g[g.length-1]);return pe})(),f=this._editor.layoutInfoContentLeft.read(a),_=this._editor.layoutInfoVerticalScrollbarWidth.read(a),v=this._editor.scrollLeft.read(a),C=this._editor.scrollTop.read(a),w=f-v,y=this._editor.editor.getModel(),D=c.originalRange.mapToLineArray(pe=>this._editor.editor.getOffsetForColumn(pe,y.getLineMaxColumn(pe))-h),b=Math.max(...D,u),I=c.originalRange.startLineNumber,N=c.originalRange.endLineNumberExclusive-1,T=this._editor.editor.getTopForLineNumber(I)-C,E=this._editor.editor.getBottomForLineNumber(N)-C,F=ut.fromLeftTopWidthHeight(w+h,T,b,E-T),q=ut.fromLeftTopWidthHeight(F.left,F.bottom,F.width,p.reduce((pe,Y)=>pe+Y,0)),re=ut.hull([F,q]),be=re.intersectVertical(new Ke(F.bottom,Number.MAX_SAFE_INTEGER));return{originalLinesOverlay:F,modifiedLinesOverlay:q,background:re,lowerBackground:be,lowerText:new ut(be.left,be.top,be.right,be.bottom),modifiedLineHeights:p,minContentWidthRequired:h+b+_}}),this._viewZoneInfo=R(a=>{if(!this._editor.getOption(71).map(c=>c.edits.allowCodeShifting==="always").read(a))return;const l=this._layout.read(a),d=this._edit.read(a);if(!(!l||!d))return{height:l.lowerBackground.height,lineNumber:d.originalRange.endLineNumberExclusive}}),this.minEditorScrollHeight=R(this,a=>{const l=gn(this._layout).read(a);return!l||this._viewZoneInfo.read(a)!==void 0?0:l.read(a).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=$.div({class:"line-replacement"},[R(this,a=>{const l=gn(this._layout).read(a),d=this._modifiedLineElements.read(a);if(!l||!d)return[];const c=l.read(a),h=this._editor.layoutInfoContentLeft.read(a),u=this._editorType.read(a)===gt.DiffEditor?3:1;d.lines.forEach((_,v)=>{_.style.width=`${c.lowerText.width}px`,_.style.height=`${c.modifiedLineHeights[v]}px`,_.style.position="relative"});const g=al(this._tabAction).read(a),p=Ah(this._tabAction).read(a),f=Is(this._editorType.read(a));return[$.div({style:{position:"absolute",...Wt(_=>U_(this._editor).read(_)),overflow:"hidden",pointerEvents:"none"}},[$.div({class:"borderAroundLineReplacement",style:{position:"absolute",...Wt(_=>l.read(_).background.translateX(-h).withMargin(u)),borderRadius:"3px",border:`${u+1}px solid ${f}`,boxSizing:"border-box",pointerEvents:"none"}}),$.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...Wt(_=>l.read(_).background.translateX(-h)),borderRadius:"3px",border:Tt(p,this._themeService).map(_=>`1px solid ${_.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:De(ka)}}),$.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...Wt(_=>l.read(_).lowerBackground.translateX(-h)),borderRadius:"0 0 3px 3px",background:f,boxShadow:`${De(gE)} 0 6px 6px -6px`,border:`1px solid ${De(g)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:_=>{_.preventDefault()},onclick:_=>this._onDidClick.fire(Wr.create(_))},[$.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:De(KH)}})]),$.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...Wt(_=>l.read(_).lowerText.translateX(-h)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:"0 0 3px 3px",overflow:"hidden"}},[...d.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(a=>this._isMouseOverWidget(a),this._store),this._previousViewZoneInfo=void 0,this._register(Te(()=>this._editor.editor.changeViewZones(a=>this.removePreviousViewZone(a)))),this._register(WR(this._viewZoneInfo,({lastValue:a,newValue:l})=>{a===l||a?.height===l?.height&&a?.lineNumber===l?.lineNumber||this._editor.editor.changeViewZones(d=>{this.removePreviousViewZone(d),l&&this.addViewZone(l,d)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:R(this,a=>this._layout.read(a)?.minContentWidthRequired??0),position:ye({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){const t=this._layout.get();return!t||!(e.event instanceof B0)?!1:t.lowerBackground.containsPoint(new zi(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);const t=this._editor.cursorLineNumber.get();t!==null&&t>=this._previousViewZoneInfo.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height),this._previousViewZoneInfo=void 0}addViewZone(e,t){const i=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:H("div")});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:i};const s=this._editor.cursorLineNumber.get();s!==null&&s>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};Cf=NW([MC(4,Bn),MC(5,Dt)],Cf);function MW(n){const e=[];for(;n.length;){let t=n.shift();t.startLineNumber!==t.endLineNumber&&(n.push(new x(t.startLineNumber+1,1,t.endLineNumber,t.endColumn)),t=new x(t.startLineNumber,t.startColumn,t.startLineNumber,Number.MAX_SAFE_INTEGER)),e.push(t)}return e}function OW(n,e){const t={};for(const[r,a]of Object.entries(e))Array.isArray(a)?t[r]={min:0,rules:a}:t[r]={min:a.min??0,rules:a.rules??[{max:a.max,priority:a.priority,share:a.share}]};const i={};let s=0;for(const[r,a]of Object.entries(t))i[r]=a.min,s+=a.min;if(s>n)return null;let o=n-s;for(;o>0;){const r=[];for(const[u,g]of Object.entries(t))for(let p=0;p<g.rules.length;p++){const f=g.rules[p];i[u]<(f.max??1/0)&&r.push({partKey:u,ruleIndex:p,rule:f,priority:f.priority??0,share:f.share??1})}if(r.length===0)break;const a=Math.max(...r.map(u=>u.priority)),l=r.filter(u=>u.priority===a),d=l.reduce((u,g)=>u+g.share,0);let c=0;const h=[];for(const u of l){const g=u.rule,p=i[u.partKey],f=(g.max??1/0)-p,_=o*u.share/d,v=Math.min(_,f);h.push({partKey:u.partKey,ruleIndex:u.ruleIndex,amount:v}),c+=v}if(c===0)break;for(const u of h)i[u.partKey]+=u.amount;if(o-=c,o<1e-4)break}return i}var AW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Tu=function(n,e){return function(t,i){e(t,i,n)}},Sf=class extends M{constructor(e,t,i,s,o,r){super(),this._editor=e,this._data=i,this._themeService=s,this._keybindingService=o,this._contextKeyService=r,this._styles=R(this,l=>({background:Tt(Ol,this._themeService).read(l).toString(),foreground:Tt(rl,this._themeService).read(l).toString(),border:Tt(ds,this._themeService).read(l).toString()})),this._pos=R(this,l=>this._editor.observePosition(R(d=>this._data.read(d)?.jumpToPosition||null),l.store)).flatten(),this._layout=R(this,l=>{const d=this._data.read(l);if(!d)return;const c=d.jumpToPosition,h=this._editor.observeLineHeightForLine(ye(c.lineNumber)).read(l),u=this._editor.scrollLeft.read(l),g=this._pos.read(l);if(!g)return;const p=this._editor.layoutInfo.read(l);return{widgetRect:ut.fromLeftTopWidthHeight(g.x+p.contentLeft+2-u,g.y,100,h)}}),this._blink=FW([{value:!0,durationMs:600},{value:!1,durationMs:600}]),this._widget=$.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map(l=>l?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...Wt(l=>this._layout.read(l)?.widgetRect)}},R(l=>this._data.read(l)===void 0?[]:$.div({style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",backgroundColor:this._styles.map(d=>d.background),"--vscodeIconForeground":this._styles.map(d=>d.foreground),border:this._styles.map(d=>`1px solid ${d.border}`),borderRadius:"3px",boxSizing:"border-box",fontSize:"11px",color:this._styles.map(d=>d.foreground)}},[this._style==="cursor"?$.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map(d=>d?"0":"1")}}):[R(()=>$.elem("div",{},HW(this._keybinding))),$.elem("div",{style:{lineHeight:this._layout.map(d=>d?.widgetRect.height),marginTop:"-2px"}},["to jump"])]]))),this._style=t.style,this._keybinding=this._getKeybinding(Sr);const a=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:a.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:ye(0)})),this._register(this._editor.setDecorations(R(l=>{const d=this._data.read(l);return d?[{range:x.fromPositions(d.jumpToPosition,d.jumpToPosition),options:{description:"inline-edit-jump-to-decoration",inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style==="label"?" ":" "}}}]:[]})))}_getKeybinding(e,t=ph.ofCaller()){return e?Bt(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):ye(void 0)}};Sf=AW([Tu(3,Dt),Tu(4,He),Tu(5,Ce)],Sf);function FW(n,e=ph.ofCaller()){let t=0;return Bt(void 0,i=>{t=0;const s=new at(()=>{t=(t+1)%n.length,i(null),s.schedule(n[t].durationMs)},0);return s.schedule(0),s},()=>n[t].value,e)}function HW(n){return R(e=>$.div({style:{},ref:t=>{const i=e.store.add(new bl(t,_l,{disableTitle:!0,...dw,keybindingLabelShadow:void 0,keybindingLabelForeground:De(rl),keybindingLabelBackground:"transparent",keybindingLabelBorder:De(rl),keybindingLabelBottomBorder:void 0}));e.store.add(ge(s=>{i.set(n.read(s))}))}}))}var WW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},VW=function(n,e){return function(t,i){e(t,i,n)}};function BW(n,e,t){const i=Math.max(1,Math.min(t,n)),s=Math.max(1,i-e),o=Math.min(t+1,i+e+1);return new ft(s,o)}var wf=class extends M{constructor(e,t,i,s,o){super(),this._previewTextModel=e,this._properties=t,this._parentEditor=i,this._tabAction=s,this._instantiationService=o,this._previewRef=$.ref(),this.element=$.div({class:"preview",style:{},ref:this._previewRef}),this._state=R(this,r=>{const a=this._properties.read(r);if(!a)return;let l,d;a.nextCursorPosition!==null?(l="original",d=a.nextCursorPosition.lineNumber):a.diff[0].innerChanges?.every(p=>p.modifiedRange.isEmpty())?(l="original",d=a.diff[0].original.startLineNumber):(l="modified",d=a.diff[0].modified.startLineNumber);const c=l==="modified"?kh.snapshot(this._previewTextModel):a.target,h=this._parentEditorObs.getOption(71).read(r).edits.longDistanceHintContextLineCount,u=l==="modified"?this._previewTextModel:a.target.dangerouslyGetUnderlyingModel(),g=BW(d,h,u.getLineCount());return{mode:l,targetLineNumber:d,visibleLineRange:g,textModel:c,diff:a.diff}}),this.updatePreviewEditorEffect=R(this,r=>{this._previewEditorObs.model.read(r);const a=this._state.read(r)?.visibleLineRange;if(!a)return;const l=[];a.startLineNumber>1&&l.push(new x(1,1,a.startLineNumber-1,1)),a.endLineNumberExclusive<this._previewTextModel.getLineCount()+1&&l.push(new x(a.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(l,void 0,!0)}),this.horizontalContentRangeInPreviewEditorToShow=R(this,r=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,r)),this.contentHeight=R(this,r=>{const a=this._state.read(r);return a?this._previewEditorObs.observeLineHeightsForLineRange(a.visibleLineRange).map(l=>l.reduce((d,c)=>d+c,0)):ye(null)}).flatten(),this._editorDecorations=R(this,r=>{const a=this._state.read(r);if(!a)return;const l={diff:a.diff},d=[],c=[],h=oe.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),u=oe.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),g=oe.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0});for(const p of l.diff)if(p.modified.isEmpty||p.original.isEmpty)p.original.isEmpty||d.push({range:p.original.toInclusiveRange(),options:h}),p.modified.isEmpty||c.push({range:p.modified.toInclusiveRange(),options:u});else for(const f of p.innerChanges||[])p.original.contains(f.originalRange.startLineNumber)&&!f.originalRange.isEmpty()&&d.push({range:f.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:zd("inlineCompletions-char-delete",f.originalRange.isEmpty()&&"empty"),zIndex:1}}),p.modified.contains(f.modifiedRange.startLineNumber)&&c.push({range:f.modifiedRange,options:g});return{originalDecorations:d,modifiedDecorations:c}}),this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=je(this._parentEditor),this._register(ge(r=>{const a=this._state.read(r)?.textModel||null;a&&this.previewEditor.setModel(a.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=je(this.previewEditor),this._register(this._previewEditorObs.setDecorations(R(r=>{const a=this._state.read(r),l=this._editorDecorations.read(r);return(a?.mode==="original"?l?.originalDecorations:l?.modifiedDecorations)??[]}))),this._register(ge(r=>{if(!this._properties.read(r))return;const a=this._parentEditorObs.cursorPosition.read(r);a&&this.previewEditor.setPosition(this._previewTextModel.validatePosition(a),"longDistanceHintPreview")})),this._register(ge(r=>{const a=this._state.read(r);if(!a)return;const l=(a.visibleLineRange.endLineNumberExclusive-1).toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:l+1})})),this._register(this._instantiationService.createInstance(Fc,this._previewEditorObs,R(r=>{const a=this._state.read(r);if(!a)return;const l=this._properties.read(r);if(l)return new fL(l.inlineSuggestInfo,ft.ofLength(a.targetLineNumber,1),l.model,void 0)}),this._tabAction,ye(0),ye(!1),Fe(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(un,this._previewRef.element,{glyphMargin:!1,lineNumbers:"on",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Se.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(e,t){const i=this._state.read(t);if(!i)return;const s=i.diff,o=this._properties.read(t)?.nextCursorPosition,r=i.visibleLineRange,a=this._previewEditorObs.layoutInfo.read(t),l=Rn(this._previewEditorObs,r,t);let d;if(o)d=x.fromPositions(o);else if(s[0].innerChanges)d=i.mode==="modified"?s[0].innerChanges[0].modifiedRange:s[0].innerChanges[0].originalRange;else return;const c=UW(e.getModel(),d,5),h=this._previewEditorObs.getLeftOfPosition(c.getStartPosition(),t),u=this._previewEditorObs.getLeftOfPosition(c.getEndPosition(),t),g=eg(h,0,l),p=eg(u,g,l),f=e.getModel().getLineFirstNonWhitespaceColumn(c.startLineNumber);return{indentationEnd:this._previewEditorObs.getLeftOfPosition(new B(c.startLineNumber,f),t),preferredRangeToReveal:new Ke(g,p),maxEditorWidth:l+a.contentLeft,contentWidth:l,nonContentWidth:a.contentLeft}}layout(e,t){this.previewEditor.layout(e),this._previewEditorObs.editor.setScrollLeft(t)}};wf=WW([VW(4,ne)],wf);function UW(n,e,t){const i=e.getStartPosition(),s=e.getEndPosition(),o=n.getLineContent(i.lineNumber);function r(c){const h=o.charAt(c-1);return/[a-zA-Z0-9_]/.test(h)}function a(c){const h=o.charAt(c-1);return h===" "||h===" "}let l=i.column;for(;l>1&&r(l)&&!a(l-1)&&i.column-l<t;)l--;let d=s.column-1;for(;d<=o.length&&r(d)&&!a(d+1)&&d-s.column<t;)d++;return new x(i.lineNumber,l,s.lineNumber,d+1)}function zW(n,e){const t=n.start,i=n.endExclusive;let s=Number.MAX_VALUE,o=0;for(const r of e){const a=o+r.width;Math.max(t,o)<Math.min(i,a)&&(s=Math.min(s,r.height)),o=a}return i>o||s===Number.MAX_VALUE?0:s}var OC=class{constructor(n,e,t){this._lineRangeInfo=n,this.availableSpaceSizes=n.sizes.map((i,s)=>{const o=t(n.lineRange.startLineNumber+s);return new F_(Math.max(0,e-i.width-o),i.height)}),this.availableSpaceHeightPrefixSums=$W(this.availableSpaceSizes,i=>i.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map(i=>i.transpose())}getWidgetVerticalOutline(n,e,t){const i=n-this._lineRangeInfo.lineRange.startLineNumber,s=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[i],o=Ke.ofStartAndLength(s,e),{previewEditorMargin:r,widgetPadding:a,widgetBorder:l,lowerBarHeight:d}=t;return o.withMargin(r+a+l).withMargin(0,d)}tryFindWidgetOutline(n,e,t,i){if(!(this._lineRangeInfo.lineRange.length<3))return qW(this._lineRangeInfo.lineRange.addMargin(-1,-1),n,s=>{const o=this.getWidgetVerticalOutline(s,e,i),r=zW(o.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);if(!(r<i.minWidgetWidth))return{horizontalWidgetRange:Ke.ofStartAndLength(t-r,r),verticalWidgetRange:o}})}};function jW(n,e,t,i,s){const o=[];let r=n.startLineNumber,a=t,l=[];for(let d=0;d<e.length;d++){const c=n.startLineNumber+d,h=a+l.reduce((g,p)=>g+p.height,0),u=i.editor.getTopForLineNumber(c);d>0&&u!==h&&(o.push({lineRange:ft.ofLength(r,c-r),top:a,sizes:l}),r=c,a=u,l=[]),l.push(e[d])}return o.push({lineRange:ft.ofLength(r,n.endLineNumberExclusive-r),top:a,sizes:l}),R({owner:"splitIntoContinuousLineRanges"},d=>i.observeTopForLineNumber(n.endLineNumberExclusive-1).read(d)).read(s),o}function qW(n,e,t){for(let i=0;;i++){const s=e+i;if(s<=n.endLineNumberExclusive){const r=t(s);if(r!==void 0)return r}const o=e-i;if(o>=n.startLineNumber){const r=t(o);if(r!==void 0)return r}if(o<n.startLineNumber&&s>n.endLineNumberExclusive)return}}function $W(n,e){const t=[0];let i=0;for(const s of n)i+=e(s),t.push(i);return t}var KW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Qr=function(n,e){return function(t,i){e(t,i,n)}},GW=6,Pu={EMPTY_SPACE:425,OVERLAY:375},ZW={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:250},yf=class extends M{constructor(e,t,i,s,o,r,a,l,d){super(),this._editor=e,this._viewState=t,this._previewTextModel=i,this._tabAction=s,this._instantiationService=o,this._themeService=r,this._keybindingService=a,this._modelService=l,this._languageService=d,this.onDidClick=Ge.None,this._viewWithElement=void 0,this._hintTextPosition=R(this,c=>{const h=this._viewState.read(c);return h?new B(h.hint.lineNumber,Number.MAX_SAFE_INTEGER):null}),this._lineSizesAroundHintPosition=R(this,c=>{const h=this._viewState.read(c),u=this._hintTextPosition.read(c);if(!h||!u)return[];const g=this._editorObs.model.read(c);if(!g)return[];const p=ft.ofLength(u.lineNumber,1).addMargin(5,5).intersect(ft.ofLength(1,g.getLineCount()));if(!p)return[];const f=tW(this._editorObs,p,c),_=this._editorObs.observeTopForLineNumber(p.startLineNumber).read(c);return jW(p,f,_,this._editorObs,c)}),this._isVisibleDelayed=OT(R(this,c=>this._viewState.read(c)?.hint.isVisible),(c,h)=>c===!0&&h===!1?200:0),this._previewEditorLayoutInfo=R(this,c=>{const h=this._viewState.read(c);if(!h||!this._isVisibleDelayed.read(c))return;const u=this._lineSizesAroundHintPosition.read(c);if(u.length===0)return;const g=this._editorObs.scrollTop.read(c),p=this._editorObs.scrollLeft.read(c),f=this._editorObs.layoutInfo.read(c),_=this._previewEditor.contentHeight.read(c),v=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(c);if(!_||!v)return;const C=f.contentWidth-f.verticalScrollbarWidth,w=f.contentLeft+C;if(!this._editorObs.cursorLineNumber.read(c))return;const y=ZW,D=_+2;let b,I;const N=qt=>qt===h.hint.lineNumber?40:20;for(const qt of u){const Xi=new OC(qt,C,N);if(I=Xi,b=Xi.tryFindWidgetOutline(h.hint.lineNumber,D,w,y),b)break}let T="empty-space";if(!b){T="overlay";const qt=Math.min(f.width-f.contentLeft,Pu.OVERLAY),Xi=I??new OC(u[0],C,N);b={horizontalWidgetRange:Ke.ofStartAndLength(w-qt,qt),verticalWidgetRange:Xi.getWidgetVerticalOutline(h.hint.lineNumber+2,D,y).delta(10)}}if(!b)return;const E=ut.fromRanges(b.horizontalWidgetRange,b.verticalWidgetRange).translateX(-p).translateY(-g),{previewEditorMargin:F,widgetPadding:q,widgetBorder:re,lowerBarHeight:be}=y,pe=T==="overlay"?Pu.OVERLAY:Pu.EMPTY_SPACE,Y=v.maxEditorWidth+F+q,ue=Math.min(pe,Math.max(Y,y.minWidgetWidth)),xe=OW(E.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:ue,priority:1}]},spaceAfter:{min:10}});if(!xe)return null;const Oe=XW([xe.spaceBefore,xe.content,xe.spaceAfter],E.left);E.withHorizontalRange(Oe[0]);const _e=E.withHorizontalRange(Oe[1]);E.withHorizontalRange(Oe[2]);const Ue=_e.withMargin(-q-re-F).withMargin(0,0,-be,0),rt=Ue.width-v.nonContentWidth,Re=rt*.8,Et=v.preferredRangeToReveal.intersect(Ke.ofStartAndLength(v.preferredRangeToReveal.start,Re))??v.preferredRangeToReveal,qn=YW(v.indentationEnd,rt,Et);return{codeEditorSize:Ue.getSize(),codeScrollLeft:p,contentLeft:f.contentLeft,widgetRect:_e,previewEditorMargin:F,widgetPadding:q,widgetBorder:re,lowerBarHeight:be,desiredPreviewEditorScrollLeft:qn.newScrollPosition}}),this._view=$.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:R(this,c=>this._previewEditorLayoutInfo.read(c)?"block":"none")}},[R(this,c=>[this._widgetContent])]),this._widgetContent=R(this,c=>$.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:De(vm),padding:this._previewEditorLayoutInfo.map(h=>h?.widgetPadding),boxSizing:"border-box",borderRadius:GW,border:R(h=>`${this._previewEditorLayoutInfo.read(h)?.widgetBorder}px solid ${this._styles.read(h).border}`),display:"flex",flexDirection:"column",opacity:R(h=>this._viewState.read(h)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...Wt(h=>this._previewEditorLayoutInfo.read(h)?.widgetRect)},onmousedown:h=>{h.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[$.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map(h=>h?.previewEditorMargin),background:this._styles.map(h=>h.background),pointerEvents:"none"}},[R(this,h=>this._previewEditor.element)]),$.div({class:"bar",style:{color:De(mm),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map(h=>h?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[R(this,h=>{const u=[],g=this._viewState.read(h);if(!g)return u;const p=this._editorObs.model.read(h),f=g.target.uri,_=!p||!g.target.targets(p);if(_){const D=Ti(f),b=_a(this._modelService,this._languageService,f,Bi.FILE);u.push($.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[$.elem("span",{class:b,style:{flexShrink:"0",marginRight:"4px"}}),D]))}else{const D=this._originalOutlineSource.read(h),b=this._originalTargetLineNumber.read(h),I=D?.getAt(b,h).slice(0,1)??[],N=[];if(I.length>0)for(let T=0;T<I.length;T++){const E=I[T],F=Yw.toIcon(E.kind);N.push($.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[an(F)," ",E.name,...T===I.length-1?[]:[an(V.chevronRight)]]))}u.push($.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},N))}const v=this._originalTargetLineNumber.read(h),C=_?V.arrowRight:g.hint.lineNumber<v?V.arrowDown:V.arrowUp,w=this._keybindingService.lookupKeybinding(l_);let y=_?"Go to file":"Go to suggestion";return w&&w.getLabel()==="Tab"&&(y=_?"Tab to open":"Tab to jump"),u.push($.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[y," ",an(C)])),u})])])),this._originalTargetLineNumber=R(this,c=>{const h=this._viewState.read(c);return h?h.edit.action?.kind==="jumpTo"?h.edit.action.position.lineNumber:h.diff[0]?.original.startLineNumber??-1:-1}),this._originalOutlineSource=Km(this,c=>{const h=this._editorObs.model.read(c),u=$w._breadcrumbsSourceFactory.read(c);return!h||!u?void 0:u(h,this._instantiationService)}),this._styles=R(c=>{const h=this._tabAction.read(c),u=lr(xw,this._themeService).read(c),g=Bt(this._themeService.onDidColorThemeChange,()=>{const f=this._themeService.getColorTheme();return f.type==="hcDark"||f.type==="hcLight"}).read(c);let p;if(g)p=u;else{let f;switch(h){case Qe.Inactive:f=H_;break;case Qe.Jump:f=Ol;break;case Qe.Accept:f=W_}p=Tt(f,this._themeService).read(c)}return{border:p.toString(),background:Is(this._viewState.map(f=>f?.editorType??gt.TextEditor).read(c))}}),this._editorObs=je(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(wf,this._previewTextModel,R(c=>{const h=this._viewState.read(c);if(h)return{diff:h.diff,model:h.model,inlineSuggestInfo:h.inlineSuggestInfo,nextCursorPosition:h.nextCursorPosition,target:h.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:ye(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(ge(c=>{const h=this._previewEditorLayoutInfo.read(c);h&&this._previewEditor.layout(h.codeEditorSize.toDimension(),h.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};yf=KW([Qr(4,ne),Qr(5,Dt),Qr(6,He),Qr(7,Yt),Qr(8,Bn)],yf);function XW(n,e=0){const t=[];let i=e;for(const s of n)t.push(new Ke(i,i+s)),i+=s;return t}function YW(n,e,t){const i=new Ke(n,n+e);return i.containsRange(t)?{newScrollPosition:n}:t.length>e?{newScrollPosition:t.start}:t.endExclusive>i.endExclusive?{newScrollPosition:t.endExclusive-e}:t.start<i.start?{newScrollPosition:t.start}:{newScrollPosition:n}}var JW=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ku=function(n,e){return function(t,i){e(t,i,n)}},ld=0,dd=0,Us=1,QW=1,eV=3,bn=3,Nu=20,tV=12,Hc=class extends M{static fitsInsideViewport(e,t,i,s){const o=je(e),r=o.layoutInfoWidth.read(s),a=o.layoutInfoContentLeft.read(s),l=e.getLayoutInfo().verticalScrollbarWidth,d=o.layoutInfoMinimap.read(s).minimapLeft!==0?o.layoutInfoMinimap.read(s).minimapWidth:0,c=Rn(o,i.displayRange,void 0),h=i.lineEdit.newLines.reduce((g,p)=>Math.max(g,B_(p,e,t)),0),u=Nu;return c+h+u+14<r-a-l-d}constructor(e,t,i,s,o,r,a,l){super(),this._editor=e,this._edit=t,this._previewTextModel=i,this._uiState=s,this._tabAction=o,this._instantiationService=r,this._themeService=a,this._userInteractionService=l,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._editorObs=je(this._editor),this._display=R(this,h=>this._uiState.read(h)?"block":"none"),this.previewRef=$.ref();const d=this._uiState.map(h=>h?.editorType===gt.DiffEditor?eV:QW);this._editorContainer=$.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:h=>{h.preventDefault()},onclick:h=>{this._onDidClick.fire(Wr.create(h))}},[$.div({class:"preview",style:{pointerEvents:"none"},ref:this.previewRef})]).keepUpdated(this._store),this.isHovered=this._userInteractionService.createHoverTracker(this._editorContainer.element,this._store),this.previewEditor=this._register(this._instantiationService.createInstance(un,this.previewRef.element,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},editContext:!1,rulers:[],padding:{top:0,bottom:0},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Se.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=je(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=R(this,h=>{this._editorContainer.readEffect(h),this._previewEditorObs.model.read(h),this._display.read(h),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(h));const u=this._uiState.read(h),g=this._edit.read(h);if(!u||!g)return;const p=g.originalLineRange,f=[];p.startLineNumber>1&&f.push(new x(1,1,p.startLineNumber-1,1)),p.startLineNumber+u.newTextLineCount<this._previewTextModel.getLineCount()+1&&f.push(new x(p.startLineNumber+u.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(f,void 0,!0);const _=[...this._activeViewZones];this._activeViewZones=[];const v=p.endLineNumberExclusive-p.startLineNumber-u.newTextLineCount;this.previewEditor.changeViewZones(C=>{_.forEach(w=>C.removeZone(w)),v>0&&this._activeViewZones.push(C.addZone({afterLineNumber:p.startLineNumber+u.newTextLineCount-1,heightInLines:v,showInHiddenAreas:!0,domNode:H("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=R(this,h=>{const u=this._edit.read(h);return u?(this._updatePreviewEditor.read(h),Rn(this._previewEditorObs,u.modifiedLineRange,h)):0}),this._cursorPosIfTouchesEdit=R(this,h=>{const u=this._editorObs.cursorPosition.read(h),g=this._edit.read(h);if(!(!g||!u))return g.modifiedLineRange.contains(u.lineNumber)?u:void 0}),this._originalStartPosition=R(this,h=>{const u=this._edit.read(h);return u?new B(u.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=R(this,h=>{const u=this._edit.read(h);return u?new B(u.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(h=>h?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(h=>h?.y),this._originalDisplayRange=this._edit.map(h=>h?.displayRange),this._editorMaxContentWidthInRange=R(this,h=>{const u=this._originalDisplayRange.read(h);return u?(this._editorObs.versionId.read(h),ks(this,(g,p)=>{const f=Rn(this._editorObs,u,g);return Math.max(f,p??0)})):ye(0)}).map((h,u)=>h.read(u));const c=lW(this._editor,this._store);this._previewEditorLayoutInfo=R(this,h=>{const u=this._edit.read(h);if(!u||!this._uiState.read(h))return null;const g=u.originalLineRange,p=this._editorObs.scrollLeft.read(h),f=this._editorMaxContentWidthInRange.read(h),_=this._editorObs.layoutInfo.read(h),v=this._previewEditorWidth.read(h),C=_.contentWidth-_.verticalScrollbarWidth,w=c.read(h),y=_.contentLeft+_.contentWidth+w.left,D=Nt(this._editor.getContainerDomNode()).innerWidth-y,b=Nt(this._editor.getContainerDomNode()).innerWidth-w.right,I=Math.min(_.contentWidth*.3,v,100),N=0,T=N+D,E=this._cursorPosIfTouchesEdit.read(h),F=Math.max(C+p-N-Math.max(0,I-T),Math.min(E?iW(this._editorObs,E,h)+50:0,C+p)),q=Math.min(f+Nu,F),re=f+Nu+v+70,be=F-q;let pe,Y;q>p?(pe=0,Y=_.contentLeft+q-p):(pe=p-q,Y=_.contentLeft);const ue=this._originalVerticalStartPosition.read(h)??this._editor.getTopForLineNumber(g.startLineNumber)-this._editorObs.scrollTop.read(h),xe=this._originalVerticalEndPosition.read(h)??this._editor.getBottomForLineNumber(g.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(h),Oe=_.contentLeft-p;let _e=ut.fromLeftTopRightBottom(Oe,ue,Y,xe);const Ue=_e.height===0;Ue||(_e=_e.withMargin(dd,ld));const rt=this._previewEditorObs.observeLineHeightsForLineRange(u.modifiedLineRange).read(h).reduce((JD,QD)=>JD+QD,0),Re=xe-ue,Et=Math.max(Re,rt),qn=be===0,qt=0,Xi=Math.min(v+tV,b+_.width-_.contentLeft-qt);let Ur=ut.fromLeftTopWidthHeight(_e.right+qt,ue,Xi,Et);return Ue?Ur=Ur.withMargin(dd,ld).translateY(dd):Ur=Ur.withMargin(dd,ld).translateX(1),{codeRect:_e,editRect:Ur,codeScrollLeft:p,contentLeft:_.contentLeft,isInsertion:Ue,maxContentWidth:re,shouldShowShadow:qn,desiredPreviewEditorScrollLeft:pe,previewEditorWidth:Xi}}),this._stickyScrollController=Pi.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?Bt(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):ye(0),this._shouldOverflow=R(this,h=>!1),this._originalBackgroundColor=Bt(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(ka)??ve.transparent),this._editorBackgroundColor=this._uiState.map(h=>Is(h?.editorType??gt.TextEditor)),this._backgroundSvg=$.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[$.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:R(this,h=>{const u=this._previewEditorLayoutInfo.read(h);if(u&&!this._originalBackgroundColor.read(h).isTransparent())return new pf().moveTo(u.codeRect.getRightTop()).lineTo(u.codeRect.getRightTop().deltaX(1e3)).lineTo(u.codeRect.getRightBottom().deltaX(1e3)).lineTo(u.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=$.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(h=>h?.isInsertion?"none":"block")}},R(this,h=>{const u=gn(this._previewEditorLayoutInfo).read(h);if(!u)return;const g=this._editorBackgroundColor.read(h),p=d.read(h),f=Ah(this._tabAction).map(T=>`${Us}px solid ${De(T)}`),_=`${Us+p}px solid ${g}`,v=u.read(h).codeScrollLeft!==0,C=u.map(T=>T.codeRect.bottom<T.editRect.bottom),w=bn*2+2,y=u.map(T=>ut.fromLeftTopRightBottom(T.contentLeft-bn-Us,T.codeRect.top,T.contentLeft,T.codeRect.bottom+w)).read(h),D=new Ke(y.left,Number.MAX_SAFE_INTEGER),b=u.map(T=>T.codeRect.intersectHorizontal(D)),I=b.map(T=>T.withMargin(p,0,p,p).intersectHorizontal(D)),N=b.map(T=>ut.fromLeftTopWidthHeight(T.right-w+Us,T.bottom-Us,w,w).intersectHorizontal(D));return[$.div({class:"originalSeparatorSideBySide",style:{...I.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${bn}px 0 0 ${bn}px`,borderTop:_,borderBottom:_,borderLeft:v?"none":_}}),$.div({class:"originalOverlaySideBySide",style:{...b.read(h).toStyles(),boxSizing:"border-box",borderRadius:`${bn}px 0 0 ${bn}px`,borderTop:f,borderBottom:f,borderLeft:v?"none":f,backgroundColor:De(ka)}}),$.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:C.map(T=>T?"block":"none"),...N.read(h).toStyles()}},[$.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:Tt(ka,this._themeService).map(T=>T.toString())}}),$.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:f,borderRight:f,borderRadius:"0 100% 0 0",backgroundColor:g}})]),$.div({class:"originalOverlaySideBySideHider",style:{...y.toStyles(),backgroundColor:g}})]})).keepUpdated(this._store),this._modifiedOverlay=$.div({style:{pointerEvents:"none"}},R(this,h=>{const u=gn(this._previewEditorLayoutInfo).read(h);if(!u)return;const g=u.map(b=>b.codeRect.bottom<b.editRect.bottom),p=this._editorBackgroundColor.read(h),f=d.read(h),_=g.map(b=>`0 ${bn}px ${bn}px ${b?bn:0}px`),v=Tt(al(this._tabAction),this._themeService).map(b=>`1px solid ${b.toString()}`),C=`${Us+f}px solid ${p}`,w=u.map(b=>b.editRect.withMargin(0,Us)),y=w.map(b=>b.withMargin(f,f,f,0)),D=R(this,b=>{const I=w.read(b),N=u.read(b);return!N.isInsertion||N.contentLeft>=I.left?ut.fromLeftTopWidthHeight(I.left,I.top,0,0):new ut(N.contentLeft,I.top,I.left,I.top+2)});return[$.div({class:"modifiedInsertionSideBySide",style:{...D.read(h).toStyles(),backgroundColor:al(this._tabAction).map(b=>De(b))}}),$.div({class:"modifiedSeparatorSideBySide",style:{...y.read(h).toStyles(),borderRadius:_,borderTop:C,borderBottom:C,borderRight:C,boxSizing:"border-box"}}),$.div({class:"modifiedOverlaySideBySide",style:{...w.read(h).toStyles(),borderRadius:_,border:v,boxSizing:"border-box",backgroundColor:De(gL)}})]})).keepUpdated(this._store),this._nonOverflowView=$.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,R(this,h=>this._shouldOverflow.read(h)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:ye(null),allowEditorOverflow:!1,minContentWidthInPx:R(this,h=>{const u=this._previewEditorLayoutInfo.read(h)?.maxContentWidth;return u===void 0?0:u})})),this.previewEditor.setModel(this._previewTextModel),this._register(ge(h=>{const u=this._previewEditorLayoutInfo.read(h);if(!u)return;const g=u.editRect.withMargin(-0,-0);this.previewEditor.layout({height:g.height,width:u.previewEditorWidth+15}),this._editorContainer.element.style.top=`${g.top}px`,this._editorContainer.element.style.left=`${g.left}px`,this._editorContainer.element.style.width=`${u.previewEditorWidth+ld}px`})),this._register(ge(h=>{const u=this._previewEditorLayoutInfo.read(h);u&&this._previewEditorObs.editor.setScrollLeft(u.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}};Hc=JW([ku(5,ne),ku(6,Dt),ku(7,Qc)],Hc);var iV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ea=function(n,e){return function(t,i){e(t,i,n)}},nV=class{constructor(n,e,t){this.edit=n,this.editorType=e,this.alternativeAction=t}equals(n){return this.edit.equals(n.edit)&&this.alternativeAction===n.alternativeAction}},di=1,AC="word-replacement-view-overlay",FC="word-replacement-view-widget",HC="word-replacement-view-replacement",Mu="word-replacement-view-rename",ir=class extends M{static{this.MAX_LENGTH=100}constructor(e,t,i,s,o,r,a,l){super(),this._editor=e,this._viewData=t,this._tabAction=i,this._languageService=s,this._themeService=o,this._keybindingService=r,this._hoverService=a,this._userInteractionService=l,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this._start=this._editor.observePosition(ye(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(ye(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=Fe(this,null),this._secondaryElement=Fe(this,null),this.isHovered=R(this,u=>{const g=this._primaryElement.read(u);return g?this._userInteractionService.createHoverTracker(g.element,u.store).read(u):!1}),this._renderTextEffect=R(this,u=>{const g=this._editor.model.read(void 0);if(!g)return;const p=g.getLineContent(this._viewData.edit.range.startLineNumber),f=si.replace(new Ke(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),_=f.replace(p),v=g.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[_])?.[0];let C;v?C=lh.fromLineTokens(v).slice(f.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):C=Nr.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);const w=Zc(new Jc([C]),ah.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${w.minWidthInPx}px`});const d=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),c=qR(this._viewData.alternativeAction?.count??new Promise(u=>u(void 0))).map(u=>u.value),h=R(this,u=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),u).shiftKey);this._layout=R(this,u=>{this._renderTextEffect.read(u);const g=this._start.read(u),p=this._end.read(u);if(!g||!p||g.x>p.x||g.y>p.y)return;const f=d.read(u);if(f<=0)return;const _=this._editor.scrollLeft.read(u),v=this._editor.getOption(59).read(u).typicalHalfwidthCharacterWidth,C=3*v,w=new zi(C,4);let y;if(this._viewData.alternativeAction){const T=this._viewData.alternativeAction.label,E=c.read(u),F=h.read(u),q=E!==void 0?E===1?m(1283,"{0} 1 occurrence",T):m(1284,"{0} {1} occurrences",T,E):T,re=m(1285,"{0} show occurrences","[shift]");y={label:E!==void 0&&F?q:T,tooltip:q?`${q}
|
|
48
|
+
${re}`:void 0,icon:void 0,count:E,keybinding:this._keybindingService.lookupKeybinding(bh),active:h}}const D=ut.fromPoints(g,p).withHeight(f).translateX(-_),b=ut.fromPointSize(D.getLeftBottom().add(w),new zi(this._viewData.edit.text.length*v,D.height)),I=b.withWidth(b.width+(y?y.label.length*v+8+4+12:0)),N=I.withLeft(D.left);return{alternativeAction:y,originalLine:D,codeLine:b,modifiedLine:I,lowerBackground:N,lineHeight:f}}),this.minEditorScrollHeight=R(this,u=>{const g=gn(this._layout).read(u);return g?g.read(u).modifiedLine.bottom+di+this._editor.editor.getScrollTop():0}),this._root=$.div({class:"word-replacement"},[R(this,u=>{const g=gn(this._layout).read(u);if(!g)return[];const p=Ah(this._tabAction).map(E=>De(E)).read(u),f=al(this._tabAction).map(E=>De(E)).read(u);this._line.style.lineHeight=`${g.read(u).modifiedLine.height+2}px`;const _=ye(!1),v=g.map(E=>E.alternativeAction),C=R(E=>(v.read(E)?.active.read(E)??!1)||_.read(E)),w=Bt(this._themeService.onDidColorThemeChange,()=>{const E=this._themeService.getColorTheme();return E.type==="hcDark"||E.type==="hcLight"}).read(u)?lr(cn,this._themeService).read(u):null,y={borderColor:w?w.toString():f,backgroundColor:De(GH),color:"",opacity:"1"},D={borderColor:w?w.toString():De(ds),backgroundColor:De(Ol),color:De(rl),opacity:"1"},b={borderColor:w?w.toString():lr(yd,this._themeService).map(E=>E.transparent(.2).toString()).read(u),backgroundColor:Is(this._viewData.editorType),color:"",opacity:"0.7"},I=Is(this._viewData.editorType),N=R(this,E=>(C.read(E),y)),T=R(this,E=>C.read(E)?D:b);return[$.div({id:AC,style:{position:"absolute",...Wt(E=>U_(this._editor).read(E)),overflow:"hidden",pointerEvents:"none"}},[$.div({style:{position:"absolute",...Wt(E=>g.read(E).lowerBackground.withMargin(di,2,di,0)),background:I,cursor:"pointer",pointerEvents:"auto"},onmousedown:E=>this._mouseDown(E)}),$.div({id:FC,style:{position:"absolute",...Wt(E=>g.read(E).modifiedLine.withMargin(di,2)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:"3px",background:I,display:"flex",justifyContent:"left",outline:`2px solid ${I}`},onmousedown:E=>this._mouseDown(E)},[$.div({id:HC,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:Wt(E=>g.read(E).codeLine.withMargin(di,2)).width,borderRadius:"3px",border:N.map(E=>`${di}px solid ${E.borderColor}`),boxSizing:"border-box",padding:`${di}px`,opacity:N.map(E=>E.opacity),background:N.map(E=>E.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:E=>{this._primaryElement.set(E,void 0)}},[this._line]),R(this,E=>{const F=v.read(E);if(!F)return;const q=document.createElement("div");return E.store.add(new bl(q,_l,{...HS,disableTitle:!0})).set(F.keybinding),$.div({id:Mu,style:{position:"relative",borderRadius:"3px",borderTop:`${di}px solid`,borderRight:`${di}px solid`,borderBottom:`${di}px solid`,borderLeft:`${di}px solid`,borderColor:T.map(re=>re.borderColor),opacity:T.map(re=>re.opacity),color:T.map(re=>re.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:T.map(re=>re.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:re=>{this._secondaryElement.set(re,void 0)},ref:re=>{F.tooltip&&E.store.add(this._hoverService.setupDelayedHoverAtMouse(re,{content:F.tooltip,appearance:{compact:!0}}))}},[q,H("div.inline-edit-alternative-action-label-separator"),F.icon?an(F.icon):void 0,F.label])})]),$.div({style:{position:"absolute",...Wt(E=>g.read(E).originalLine.withMargin(di)),boxSizing:"border-box",borderRadius:"3px",border:`${di}px solid ${p}`,background:De($H),pointerEvents:"none"}},[]),$.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:g.map(E=>E.modifiedLine.left-16),top:g.map(E=>E.modifiedLine.top+Math.round((E.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:E=>this._mouseDown(E)},[$.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:De(yd)}),$.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:De(yd)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:ye(0),position:ye({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_mouseDown(e){const t=sV(e.target,new Set([FC,HC,Mu,AC]));t&&(e.preventDefault(),this._onDidClick.fire(Wr.create(e,t===Mu)))}};ir=iV([ea(3,Bn),ea(4,Dt),ea(5,He),ea(6,fi),ea(7,Qc)],ir);function sV(n,e){let t=n;for(;t;){if(e.has(t.id))return t.id;t=t.parentElement}return null}var oV=class extends M{constructor(n,e,t){super(),this._originalEditor=n,this._state=e,this._modifiedTextModel=t,this._onDidClick=this._register(new ee),this.onDidClick=this._onDidClick.event,this.isHovered=je(this._originalEditor).isTargetHovered(s=>s.target.type===6&&s.target.detail.injectedText?.options.attachedData instanceof Ou&&s.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=lV(this._modifiedTextModel),this._decorations=R(this,s=>{const o=this._state.read(s);if(!o)return;const r=o.modifiedText,a=o.mode==="insertionInline",l=o.diff.length===1&&o.diff[0].innerChanges?.length===1,d=[],c=[],h=oe.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),u=oe.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),g=oe.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),p=oe.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),f=oe.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),_=oe.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),v=oe.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),C=o.mode!=="sideBySide"&&o.mode!=="deletion"&&o.mode!=="insertionInline"&&o.mode!=="lineReplacement",w=o.mode==="lineReplacement";for(const y of o.diff)if(C&&(y.original.isEmpty||d.push({range:y.original.toInclusiveRange(),options:u}),y.modified.isEmpty||c.push({range:y.modified.toInclusiveRange(),options:h})),y.modified.isEmpty||y.original.isEmpty)y.original.isEmpty||d.push({range:y.original.toInclusiveRange(),options:g}),y.modified.isEmpty||c.push({range:y.modified.toInclusiveRange(),options:p});else{const D=a&&rV(y);for(const b of y.innerChanges||[]){if(y.original.contains(b.originalRange.startLineNumber)&&!(w&&b.originalRange.isEmpty())){const I=this._originalEditor.getModel()?.getValueInRange(b.originalRange,1);d.push({range:b.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:zd("inlineCompletions-char-delete",b.originalRange.isSingleLine()&&o.mode==="insertionInline"&&"single-line-inline",b.originalRange.isEmpty()&&"empty",(b.originalRange.isEmpty()&&l||o.mode==="deletion"&&I===`
|
|
49
|
+
`)&&!D&&"diff-range-empty"),inlineClassName:D?zd("strike-through","inlineCompletions"):null,zIndex:1}})}if(y.modified.contains(b.modifiedRange.startLineNumber)&&c.push({range:b.modifiedRange,options:b.modifiedRange.isEmpty()&&!D&&l?_:f}),D){const I=r.getValueOfRange(b.modifiedRange),N=I.length>3?[{text:I.slice(0,1),extraClasses:["start"],offsetRange:new Ke(b.modifiedRange.startColumn-1,b.modifiedRange.startColumn)},{text:I.slice(1,-1),extraClasses:[],offsetRange:new Ke(b.modifiedRange.startColumn,b.modifiedRange.endColumn-2)},{text:I.slice(-1),extraClasses:["end"],offsetRange:new Ke(b.modifiedRange.endColumn-2,b.modifiedRange.endColumn-1)}]:[{text:I,extraClasses:["start","end"],offsetRange:new Ke(b.modifiedRange.startColumn-1,b.modifiedRange.endColumn)}];this._tokenizationFinished.read(s);const T=this._modifiedTextModel.tokenization.getLineTokens(b.modifiedRange.startLineNumber);for(const{text:E,extraClasses:F,offsetRange:q}of N)d.push({range:x.fromPositions(b.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:T.getTokensInRange(q),content:E,inlineClassName:zd("inlineCompletions-char-insert",b.modifiedRange.isSingleLine()&&o.mode==="insertionInline"&&"single-line-inline",...F),cursorStops:Js.None,attachedData:new Ou(this)},zIndex:2,showIfCollapsed:!0}})}}}if(o.editorType===gt.DiffEditor)for(const y of o.diff)y.original.isEmpty||d.push({range:y.original.toExclusiveRange(),options:v});return{originalDecorations:d,modifiedDecorations:c}}),this._register(je(this._originalEditor).setDecorations(this._decorations.map(s=>s?.originalDecorations??[])));const i=this._state.map(s=>s?.modifiedCodeEditor);this._register(xl((s,o)=>{const r=i.read(s);r&&o.add(je(r).setDecorations(this._decorations.map(a=>a?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(s=>{if(s.target.type!==6)return;const o=s.target.detail.injectedText?.options.attachedData;o instanceof Ou&&o.owner===this&&this._onDidClick.fire(new Wr(s.event))}))}},Ou=class{constructor(n){this.owner=n}};function rV(n){return n.innerChanges?n.innerChanges.every(e=>lv(e.modifiedRange)&&lv(e.originalRange)):!1}var aV=0;function lV(n){return Bt(n.onDidChangeTokens,()=>aV++)}var dV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},cV=function(n,e){return function(t,i){e(t,i,n)}},xf=class extends M{constructor(e,t,i,s,o,r){super(),this._editor=e,this._model=t,this._simpleModel=i,this._inlineSuggestInfo=s,this._showCollapsed=o,this._instantiationService=r,this._tabAction=R(c=>this._model.read(c)?.tabAction.read(c)??Qe.Inactive),this.displayRange=R(this,c=>{const h=this._uiState.read(c);if(h&&h.target.uri.toString()===this._editorObs.model.read(c)?.uri.toString()){if(h.state?.kind==="custom"){const u=h.state.displayLocation?.range;if(!u)throw new pt("custom view should have a range");return new ft(u.startLineNumber,u.endLineNumber)}return h.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(c):h.edit.displayRange}}),this._currentInlineEditCache=void 0,this._uiState=R(this,c=>{const h=this._model.read(c),u=this._editorObs.model.read(c);if(!h||!u||!this._constructorDone.read(c))return;const g=h.inlineEdit;let p,f,_;g.edit?(f=OS.fromEdit(g.edit),_=new Cd(g.edit.apply(g.originalText)),p=jv(f,g.originalText,_)):(f=[],p=[],_=g.originalText);let v=this._determineRenderState(h,c,p,_);if(!v){Le(new Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}const C=this._getLongDistanceHintState(h,c);if(C&&C.isVisible&&v.viewData.setLongDistanceViewData(C.lineNumber,g.lineEdit.lineRange.startLineNumber),v.viewData.isForAnotherDocument=!g.originalText.targets(u),v.kind===le.SideBySide){const D=aW(_.getValue(),g.modifiedLineRange,u.getOptions().tabSize);_=new Cd(D.applyToString(_.getValue())),f=nW(f,D),p=jv(f,g.originalText,_)}this._previewTextModel.setLanguage(u.getLanguageId());const w=this._previewTextModel.getValue();if(w!==_.getValue()){this._previewTextModel.setEOL(u.getEndOfLineSequence());const D=Mn.replace(new Ke(0,w.length),_.getValue()).removeCommonSuffixPrefix(w),b=Ph(this._previewTextModel).getTextEdit(D);this._previewTextModel.edit(b)}this._showCollapsed.read(c)&&(v={kind:le.Collapsed,viewData:v.viewData}),h.handleInlineEditShownNextFrame(v.kind,v.viewData);const y=g.action?.kind==="jumpTo"?g.action.position:null;return{state:v,diff:p,edit:g,newText:_.getValue(),newTextLineCount:g.modifiedLineRange.length,editorType:h.editorType,longDistanceHint:C,nextCursorPosition:y,target:g.inlineCompletion.originalTextRef}}),this.inlineEditsIsHovered=R(this,c=>this._sideBySide.isHovered.read(c)||this._wordReplacementViews.read(c).some(h=>h.isHovered.read(c))||this._deletion.isHovered.read(c)||this._inlineDiffView.isHovered.read(c)||this._lineReplacementView.isHovered.read(c)||this._insertion.isHovered.read(c)||this._customView.isHovered.read(c)||this._longDistanceHint.map((h,u)=>h?.isHovered.read(u)??!1).read(c)),this.gutterIndicatorOffset=R(this,c=>this._uiState.read(c)?.state?.kind==="insertionMultiLine"?this._insertion.startLineOffset.read(c):0),this._editorObs=je(this._editor),this._constructorDone=Fe(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(rc,"",this._editor.getModel().getLanguageId(),{...rc.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(Hc,this._editor,this._model.map(c=>c?.inlineEdit),this._previewTextModel,this._uiState.map(c=>c&&c.state?.kind===le.SideBySide?{newTextLineCount:c.newTextLineCount,editorType:c.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(RW,this._editor,this._model.map(c=>c?.inlineEdit),this._uiState.map(c=>c&&c.state?.kind===le.Deletion?{originalRange:c.state.originalRange,deletions:c.state.deletions,editorType:c.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(bf,this._editor,this._uiState.map(c=>c&&c.state?.kind===le.InsertionMultiLine?{lineNumber:c.state.lineNumber,startColumn:c.state.column,text:c.state.text,editorType:c.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(_f,this._editor,this._model.map((c,h)=>this._uiState.read(h)?.state?.kind===le.Collapsed?c?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(vf,this._editor,this._model.map((c,h)=>this._uiState.read(h)?.state?.kind===le.Custom?c?.displayLocation:void 0),this._tabAction,this._uiState.map(c=>c?.editorType??gt.TextEditor))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,c=>c.edits.showLongDistanceHint),this._longDistanceHint=R(this,c=>{if(this._showLongDistanceHint.read(c))return c.store.add(this._instantiationService.createInstance(yf,this._editor,this._uiState.map((h,u)=>h?.longDistanceHint?{hint:h.longDistanceHint,newTextLineCount:h.newTextLineCount,edit:h.edit,diff:h.diff,editorType:h.editorType,model:this._simpleModel.read(u),inlineSuggestInfo:this._inlineSuggestInfo.read(u),nextCursorPosition:h.nextCursorPosition,target:h.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=R(this,c=>{const h=this._uiState.read(c);if(!(!h||!h.state)&&!(h.state.kind==="wordReplacements"||h.state.kind==="insertionMultiLine"||h.state.kind==="collapsed"||h.state.kind==="custom"||h.state.kind==="jumpTo"))return{modifiedText:new Cd(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:h.editorType}}),this._inlineDiffView=this._register(new oV(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(Sf,this._editorObs,{style:"label"},R(c=>{const h=this._uiState.read(c);if(h?.state?.kind===le.JumpTo)return{jumpToPosition:h.state.position}})));const a=nn({equalsFn:dv.arrayC(dv.thisC())},c=>{const h=this._uiState.read(c);return h?.state?.kind===le.WordReplacements?h.state.replacements.map(u=>new nV(u,h.editorType,h.state?.alternativeAction)):[]});this._wordReplacementViews=Wm(this,a,(c,h)=>h.add(this._instantiationService.createInstance(ir,this._editorObs,c,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(Cf,this._editorObs,this._uiState.map(c=>c?.state?.kind===le.LineReplacement?{originalRange:c.state.originalRange,modifiedRange:c.state.modifiedRange,modifiedLines:c.state.modifiedLines,replacements:c.state.replacements}:void 0),this._uiState.map(c=>c?.editorType??gt.TextEditor),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(c=>c.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(c=>c.edits.renderSideBySide),this._register(ge(c=>{const h=this._model.read(c);h&&c.store.add(Ge.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(c).map(u=>u.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(u=>{this._viewHasBeenShownLongerThan(350)&&(u.event.preventDefault(),h.accept(u.alternativeAction))}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);const l=R(this,c=>Math.max(...this._wordReplacementViews.read(c).map(h=>h.minEditorScrollHeight.read(c)),this._lineReplacementView.minEditorScrollHeight.read(c),this._customView.minEditorScrollHeight.read(c))).recomputeInitiallyAndOnChange(this._store);let d;this._register(ge(c=>{const h=l.read(c),u=this._editorObs.model.read(c);u&&this._editor.changeViewZones(g=>{const p=this._editor.getScrollHeight(),f=h-p+1;f!==0&&d!==void 0&&(g.removeZone(d),d=void 0),!(f<=0)&&(d=g.addZone({afterLineNumber:u.getLineCount(),heightInPx:f,domNode:H("div.minScrollHeightViewZone")}))})})),this._constructorDone.set(!0,void 0)}_getLongDistanceHintState(e,t){if(e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t)||e.inlineEdit.action===void 0)return;const i=this._editorObs.model.read(t);return!i||!e.inlineEdit.originalText.targets(i)?{isVisible:!0,lineNumber:e.inlineEdit.cursorPosition.lineNumber}:(this._currentInlineEditCache?.inlineSuggestionIdentity!==e.inlineEdit.inlineCompletion.identity&&(this._currentInlineEditCache={inlineSuggestionIdentity:e.inlineEdit.inlineCompletion.identity,firstCursorLineNumber:e.inlineEdit.cursorPosition.lineNumber}),{lineNumber:this._currentInlineEditCache.firstCursorLineNumber,isVisible:!e.inViewPort.read(t)})}_getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}_determineView(e,t,i,s){const o=e.inlineEdit,r=this._previousView?.id===this._getCacheId(e)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),a=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view===le.SideBySide||this._previousView?.view===le.LineReplacement);if(r&&!a)return this._previousView.view;const l=e.inlineEdit.inlineCompletion.action;if(l?.kind==="edit"&&l.alternativeAction)return le.WordReplacements;const d=e.inlineEdit.inlineCompletion.originalTextRef.uri,c=this._editorObs.model.read(t)?.uri;if(c&&d.toString()!==c.toString()||e.displayLocation&&!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t))return le.Custom;const h=o.originalLineRange.length,u=o.modifiedLineRange.length,g=i.flatMap(f=>f.innerChanges??[]),p=g.length===1;if(e.editorType!==gt.DiffEditor){if(p&&this._useCodeShifting.read(t)!=="never"&&yL(i))return uV(i,o.cursorPosition)?le.InsertionInline:le.LineReplacement;if(VC(g,o,s))return le.Deletion;if(WC(i)&&this._useCodeShifting.read(t)==="always")return le.InsertionMultiLine;if(g.every(f=>rn.ofRange(f.originalRange).columnCount<ir.MAX_LENGTH&&rn.ofRange(f.modifiedRange).columnCount<ir.MAX_LENGTH)&&p&&h===1&&u===1){const f=g.map(v=>s.getValueOfRange(v.modifiedRange)),_=g.map(v=>e.inlineEdit.originalText.getValueOfRange(v.originalRange));if(!f.some(v=>v.includes(" "))&&!_.some(v=>v.includes(" "))&&(!g.some(v=>v.originalRange.isEmpty())||!BC(g.map(v=>new Be(v.originalRange,"")),o.originalText).some(v=>v.range.isEmpty()&&rn.ofRange(v.range).columnCount<ir.MAX_LENGTH)))return le.WordReplacements}}if(h>0&&u>0)return h===1&&u===1&&e.editorType!==gt.DiffEditor?le.LineReplacement:this._renderSideBySide.read(t)!=="never"&&Hc.fitsInsideViewport(this._editor,this._previewTextModel,o,t)?le.SideBySide:le.LineReplacement;if(e.editorType===gt.DiffEditor){if(VC(g,o,s))return le.Deletion;if(WC(i)&&this._useCodeShifting.read(t)==="always")return le.InsertionMultiLine}return le.SideBySide}_determineRenderState(e,t,i,s){if(e.inlineEdit.action?.kind==="jumpTo")return{kind:le.JumpTo,position:e.inlineEdit.action.position,viewData:wL()};const o=e.inlineEdit;let r=this._determineView(e,t,i,s);if(this._willRenderAboveCursor(t,o,r))switch(r){case le.LineReplacement:case le.WordReplacements:r=le.SideBySide}this._previousView={id:this._getCacheId(e),view:r,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};const a=i.flatMap(u=>u.innerChanges??[]),l=this._editor.getModel(),d=a.map(u=>({originalRange:u.originalRange,modifiedRange:u.modifiedRange,original:o.originalText.getValueOfRange(u.originalRange),modified:s.getValueOfRange(u.modifiedRange)})),c=hV(o,d,l);switch(r){case le.InsertionInline:return{kind:le.InsertionInline,viewData:c};case le.SideBySide:return{kind:le.SideBySide,viewData:c};case le.Collapsed:return{kind:le.Collapsed,viewData:c};case le.Custom:return{kind:le.Custom,displayLocation:e.displayLocation,viewData:c}}if(r===le.Deletion)return{kind:le.Deletion,originalRange:o.originalLineRange,deletions:a.map(u=>u.originalRange),viewData:c};if(r===le.InsertionMultiLine){const u=a[0];return{kind:le.InsertionMultiLine,lineNumber:u.originalRange.startLineNumber,column:u.originalRange.startColumn,text:s.getValueOfRange(u.modifiedRange),viewData:c}}const h=d.map(u=>new Be(u.originalRange,u.modified));if(h.length!==0){if(r===le.WordReplacements){let u=gV(h,o.originalText);return u.some(g=>g.range.isEmpty())&&(u=BC(h,o.originalText)),{kind:le.WordReplacements,replacements:u,alternativeAction:e.inlineEdit.action?.alternativeAction,viewData:c}}if(r===le.LineReplacement)return{kind:le.LineReplacement,originalRange:o.originalLineRange,modifiedRange:o.modifiedLineRange,modifiedLines:o.modifiedLineRange.mapToLineArray(u=>s.getLineAt(u)),replacements:a.map(u=>({originalRange:u.originalRange,modifiedRange:u.modifiedRange})),viewData:c}}}_willRenderAboveCursor(e,t,i){if(this._useCodeShifting.read(e)==="always")return!1;for(const s of t.multiCursorPositions)if(i===le.WordReplacements&&s.lineNumber===t.originalLineRange.startLineNumber+1||i===le.LineReplacement&&s.lineNumber>=t.originalLineRange.endLineNumberExclusive&&s.lineNumber<t.modifiedLineRange.endLineNumberExclusive+t.modifiedLineRange.length)return!0;return!1}_viewHasBeenShownLongerThan(e){const t=this._previousView?.timestamp;if(!t)throw new pt("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};xf=dV([cV(5,ne)],xf);var wL=()=>new N_(-1,-1,-1,-1,-1,-1,-1,!0);function hV(n,e,t){if(!n.edit)return wL();const i=n.cursorPosition,s=e.length===0?!1:e[0].modified.startsWith(t.getEOL());return new N_(n.edit.replacements.length===0?0:n.edit.replacements[0].range.getStartPosition().column-i.column,n.lineEdit.lineRange.startLineNumber-i.lineNumber+(s&&n.lineEdit.lineRange.startLineNumber>=i.lineNumber?1:0),n.lineEdit.lineRange.length,n.lineEdit.newLines.length,e.reduce((o,r)=>o+r.original.length,0),e.reduce((o,r)=>o+r.modified.length,0),e.length,e.every(o=>o.original===e[0].original&&o.modified===e[0].modified))}function yL(n){return n.every(t=>t.innerChanges.every(i=>e(i)));function e(t){return!(!t.originalRange.isEmpty()||t.modifiedRange.startLineNumber!==t.modifiedRange.endLineNumber)}}function uV(n,e){if(!e||!yL(n))return!1;const t=e;return n.every(s=>s.innerChanges.every(o=>i(o)));function i(s){const o=s.originalRange.getStartPosition();return!!(t.isBeforeOrEqual(o)||o.lineNumber<t.lineNumber)}}function WC(n){const e=n.flatMap(i=>i.innerChanges??[]);if(e.length!==1)return!1;const t=e[0];return!(!t.originalRange.isEmpty()||t.modifiedRange.startLineNumber===t.modifiedRange.endLineNumber)}function VC(n,e,t){return n.map(i=>({original:e.originalText.getValueOfRange(i.originalRange),modified:t.getValueOfRange(i.modifiedRange)})).every(({original:i,modified:s})=>s.trim()===""&&i.length>0&&(i.length>s.length||i.trim()!==""))}function gV(n,e){return xL(n,e,t=>/^[a-zA-Z]$/.test(t))}function BC(n,e){return xL(n,e,t=>!/^\s$/.test(t))}function xL(n,e,t){const i=[];n.sort((o,r)=>x.compareRangesUsingStarts(o.range,r.range));for(const o of n){let r=o.range.startColumn-1,a=o.range.endColumn-2,l="",d="";const c=e.getLineAt(o.range.startLineNumber),h=e.getLineAt(o.range.endLineNumber);if(s(c[r]))for(;s(c[r-1]);)l=c[r-1]+l,r--;if(s(h[a])||a<r)for(;s(h[a+1]);)d+=h[a+1],a++;let u=new Be(new x(o.range.startLineNumber,r+1,o.range.endLineNumber,a+2),l+o.text+d);i.length>0&&x.areIntersectingOrTouching(i[i.length-1].range,u.range)&&(u=Be.joinReplacements([i.pop(),u],e)),i.push(u)}function s(o){return o===void 0?!1:t(o)}return i}var pV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},fV=function(n,e){return function(t,i){e(t,i,n)}},If=class extends M{constructor(e,t,i,s){super(),this._editor=e,this._model=t,this._showCollapsed=i,this._inlineEdit=R(this,o=>{const r=this._model.read(o);if(!r||!this._editor.getModel())return;const a=r.inlineEditState.read(o);if(!a)return;const l=a.inlineSuggestion.action;let d;if(l?.kind==="edit"){const c=l.stringEdit,h=a.inlineSuggestion.originalTextRef.getTransformer(),u=c.replacements.map(g=>{const p=x.fromPositions(h.getPosition(g.replaceRange.start),h.getPosition(g.replaceRange.endExclusive));return new Be(p,g.newText)});d=new Ln(u)}else d=void 0;return new bW(a.inlineSuggestion.originalTextRef,l,d,r.primaryPosition.read(void 0),r.allPositions.read(void 0),a.inlineSuggestion.source.inlineSuggestions.commands??[],a.inlineSuggestion)}),this._inlineEditModel=R(this,o=>{const r=this._model.read(o);if(!r)return;const a=this._inlineEdit.read(o);if(!a)return;const l=R(this,d=>{if(this._editorObs.isFocused.read(d)){if(r.tabShouldJumpToInlineEdit.read(d))return Qe.Jump;if(r.tabShouldAcceptInlineEdit.read(d))return Qe.Accept}return Qe.Inactive});return new CW(r,a,l)}),this._editorObs=je(this._editor),this.view=this._register(s.createInstance(xf,this._editor,this._inlineEditModel,this._model.map(o=>o?vL.fromInlineCompletionModel(o):void 0),this._inlineEdit.map(o=>o?mL.fromInlineSuggestion(o.inlineCompletion):void 0),this._showCollapsed))}};If=pV([fV(3,ne)],If);var mV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},_V=function(n,e){return function(t,i){e(t,i,n)}},Lf=class extends M{static{this.hot=Sm(this)}constructor(e,t,i,s){super(),this._editor=e,this._model=t,this._focusIsInMenu=i,this._instantiationService=s,this._ghostTexts=R(this,o=>this._model.read(o)?.ghostTexts.read(o)??[]),this._inlineEdit=R(this,o=>this._model.read(o)?.inlineEditState.read(o)?.inlineSuggestion),this._everHadInlineEdit=ks(this,(o,r)=>r||!!this._inlineEdit.read(o)||!!this._model.read(o)?.inlineCompletionState.read(o)?.inlineSuggestion?.showInlineEditMenu),this._indicatorIsHoverVisible=Fe(this,void 0),this._showInlineEditCollapsed=R(this,o=>(this._model.read(o)?.showCollapsed.read(o)??!1)&&!this._indicatorIsHoverVisible.read(o)?.read(o)),this._inlineEditWidget=Km(o=>{if(this._everHadInlineEdit.read(o))return this._instantiationService.createInstance(If,this._editor,this._model,this._showInlineEditCollapsed)}),this._gutterIndicatorState=R(o=>{const r=this._model.read(o);if(!r)return;const a=r.state.read(o);if(a?.kind==="ghostText"&&a.inlineSuggestion?.showInlineEditMenu)return{displayRange:ft.ofLength(a.primaryGhostText.lineNumber,1),tabAction:R(this,l=>this._editorObs.isFocused.read(l)?Qe.Accept:Qe.Inactive),gutterIndicatorOffset:ye(vV(a.inlineSuggestion,this._editor)),inlineSuggestion:a.inlineSuggestion,model:r};if(a?.kind==="inlineEdit"){const l=this._inlineEditWidget.read(o)?.view;if(!l)return;const d=l.displayRange.read(o);return d?{displayRange:d,tabAction:R(c=>{if(this._editorObs.isFocused.read(c)){if(r.tabShouldJumpToInlineEdit.read(c))return Qe.Jump;if(r.tabShouldAcceptInlineEdit.read(c))return Qe.Accept}return Qe.Inactive}),gutterIndicatorOffset:l.gutterIndicatorOffset,inlineSuggestion:a.inlineSuggestion,model:r}:void 0}else return}),this._stablizedGhostTexts=qA(this._ghostTexts,this._store),this._editorObs=je(this._editor),this._ghostTextWidgets=Wm(this,this._stablizedGhostTexts,(o,r)=>r.add(this._createGhostText(o))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(o=>o.fontFamily),this._register(IT(R(o=>`
|
|
50
|
+
.monaco-editor .ghost-text-decoration,
|
|
51
|
+
.monaco-editor .ghost-text-decoration-preview,
|
|
52
|
+
.monaco-editor .ghost-text {
|
|
53
|
+
font-family: ${this._fontFamily.read(o)};
|
|
54
|
+
}`))),this._register(new Pg(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(Fc,this._editorObs,R(o=>{const r=this._gutterIndicatorState.read(o);if(r)return new fL(mL.fromInlineSuggestion(r.inlineSuggestion),r.displayRange,vL.fromInlineCompletionModel(r.model),r.inlineSuggestion.action?.kind==="edit"?r.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((o,r)=>o?.tabAction?.read(r)??Qe.Inactive),this._gutterIndicatorState.map((o,r)=>o?.gutterIndicatorOffset?.read(r)??0),this._inlineEditWidget.map((o,r)=>o?.view.inlineEditsIsHovered.read(r)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),R(o=>{const r=this._inlineEditWidget.read(o);if(r)return o.store.add(this._instantiationService.createInstance(mf,r._inlineEditModel,ye(this._indicator),r.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}_createGhostText(e){return this._instantiationService.createInstance(sl,this._editor,R(t=>{const i=this._model.read(t),s=i?.inlineCompletionState.read(t)?.inlineSuggestion;return!i||!s?{ghostText:e.read(t),handleInlineCompletionShown:()=>{},warning:void 0}:{ghostText:e.read(t),handleInlineCompletionShown:o=>i.handleInlineSuggestionShown(s,le.GhostText,o,Date.now()),warning:NH.from(i?.warning.read(t))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map(t=>t.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};Lf=mV([_V(3,ne)],Lf);function vV(n,e){const t=n.getSingleTextEdit(),i=e.getModel();if(!i)return 0;const s=i.getEOL();if(t.range.isEmpty()&&t.text.startsWith(s)){const o=e.getLineHeightForPosition(t.range.getStartPosition());return bV(t.text,s)*o}return 0}function bV(n,e){if(!e.length)return 0;let t=0,i=0;for(;n.startsWith(e,i);)t++,i+=e.length;return t}var CV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Zn=function(n,e){return function(t,i){e(t,i,n)}},tn;GF(n=>At.get(n));var At=class extends M{static{tn=this}static{this._instances=new Set}static{this.hot=Sm(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(e){const t=vx(e);return t?tn.get(t):null}static get(e){return NO(e.getContribution(tn.ID))}constructor(e,t,i,s,o,r,a,l,d){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=s,this._commandService=o,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=l,this._keybindingService=d,this._focusIsInMenu=Fe(this,!1),this._focusIsInEditorOrMenu=R(this,p=>{const f=this._editorObs.isFocused.read(p),_=this._focusIsInMenu.read(p);return f||_}),this._cursorIsInIndentation=R(this,p=>{const f=this._editorObs.cursorPosition.read(p);if(f===null)return!1;const _=this._editorObs.model.read(p);if(!_)return!1;this._editorObs.versionId.read(p);const v=_.getLineIndentColumn(f.lineNumber);return f.column<=v}),this.model=Km(this,p=>{if(this._editorObs.isReadonly.read(p))return;const f=this._editorObs.model.read(p);if(f)return this._instantiationService.createInstance(Xp,f,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabledInConfig,()=>this._isEditorDictationInProgress(),this.editor)}),this._playAccessibilitySignal=ns(this),this._view=R(p=>p.store.add(this._instantiationService.createInstance(Lf.hot.read(p),this.editor,this.model,this._focusIsInMenu))),this._editorObs=je(this.editor),this._positions=R(this,p=>this._editorObs.selections.read(p)?.map(f=>f.getEndPosition())??[new B(1,1)]),this._suggestWidgetAdapter=this._register(new RH(this._editorObs,p=>this.model.get()?.handleSuggestAccepted(p),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=Bt(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._register(this._contextKeyService.onDidChangeContext(p=>{p.affectsSome(new Set(["editorDictation.inProgress"]))&&this._isEditorDictationInProgress()&&this.model.get()?.stop()})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model.recomputeInitiallyAndOnChange(this._store),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map(p=>!0),this._view.recomputeInitiallyAndOnChange(this._store),tn._instances.add(this),this._register(Te(()=>tn._instances.delete(this))),this._register(ge(p=>{const f=this.model.read(p);if(!f)return;const _=f.state.read(p);if(!_||!this._focusIsInEditorOrMenu.read(void 0))return;const v=_.kind==="inlineEdit"?_.nextEditUri:void 0;for(const C of tn._instances)C!==this&&(v&&vs(v,C.editor.getModel()?.uri)?C.model.read(void 0)?.trigger():C.reject())})),this._register(ge(p=>{const f=this.model.read(p),_=this.editor.getModel()?.uri;!f||!_||p.store.add(f.onDidAccept(()=>{for(const v of tn._instances){if(v===this)continue;const C=v.model.read(void 0)?.state.read(void 0);C?.kind==="inlineEdit"&&vs(C.nextEditUri,_)&&v.model.read(void 0)?.stop("automatic")}}))})),this._register(or(this._editorObs.onDidType,(p,f)=>{this._enabledInConfig.get()&&!this._isEditorDictationInProgress()&&this.model.get()?.trigger()})),this._register(or(this._editorObs.onDidPaste,(p,f)=>{this._enabledInConfig.get()&&!this._isEditorDictationInProgress()&&this.model.get()?.trigger()}));const c=new Set([Sd.Tab.id,Sd.DeleteLeft.id,Sd.DeleteRight.id,Sr,"acceptSelectedSuggestion",LI.ID,xI.ID,Ne.NextMatchFindAction,k_.ID,uI.ID,gI.ID,fI.ID,...lR.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(p=>{if(c.has(p.commandId)&&e.hasTextFocus()&&this._enabledInConfig.get()&&!this._isEditorDictationInProgress()){let f=!1;p.commandId==="editor.action.inlineSuggest.commit"&&(f=!0),this._editorObs.forceUpdate(_=>{this.model.get()?.trigger(_,{noDelay:f})})}})),this._register(or(this._editorObs.selections,(p,f,_)=>{if(_.some(v=>v.reason===3||v.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;const v=this.model.get();if(!v)return;v.state.get()?.kind==="ghostText"&&this.model.get()?.stop()}})),this._register(ge(p=>{const f=this._focusIsInEditorOrMenu.read(p),_=this.model.read(void 0);if(f){const v=_?.state.read(void 0);(!v||v.kind!=="inlineEdit"||!v.nextEditUri)&&Vi(C=>{for(const w of tn._instances)w!==this&&w.model.read(void 0)?.stop("automatic",C)});return}this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(71).keepOnBlur||wr.dropDownVisible||_&&(_.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&_.inlineEditAvailable.read(void 0)||Vi(v=>{_.stop("automatic",v)}))})),this._register(ge(p=>{const f=this.model.read(p)?.inlineCompletionState.read(p);f?.suggestItem?f.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(Te(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));const h=ks(this,(p,f)=>{const _=this.model.read(p)?.state.read(p);return this._suggestWidgetAdapter.selectedItem.get()?f:_?.inlineSuggestion?.semanticId});this._register(mE(R(p=>(this._playAccessibilitySignal.read(p),h.read(p),{})),async(p,f,_,v)=>{let C=this.model.get(),w=C?.state.get();if(!w||!C||(await sh(50,Uv(v)),await $0(this._suggestWidgetAdapter.selectedItem,oa,()=>!1,Uv(v)),C=this.model.get(),w=C?.state.get(),!w||!C))return;const y=w.kind==="ghostText"?C.textModel.getLineContent(w.primaryGhostText.lineNumber):"";if(this._accessibilitySignalService.playSignal(w.kind==="ghostText"?Ba.inlineSuggestion:Ba.nextEditSuggestion),this.editor.getOption(12))if(w.kind==="ghostText")this._provideScreenReaderUpdate(w.primaryGhostText.renderForScreenReader(y));else{const D=w.inlineSuggestion.targetRange.startLineNumber,b=C.tabShouldAcceptInlineEdit.get(),I=C.tabShouldJumpToInlineEdit.get();let N;if(b){const T=this._keybindingService.lookupKeybinding(Sr)?.getAriaLabel();N=T?m(1262,"Next edit suggestion available on line {0}, press {1} to accept",D,T):m(1263,"Next edit suggestion available on line {0}, accept it to apply",D)}else if(I){const T=this._keybindingService.lookupKeybinding(l_)?.getAriaLabel();N=T?m(1264,"Next edit suggestion available on line {0}, press {1} to jump",D,T):m(1265,"Next edit suggestion available on line {0}",D)}else N=m(1266,"Next edit suggestion available on line {0}",D);this._provideScreenReaderUpdate(N)}})),this._register(this._configurationService.onDidChangeConfiguration(p=>{p.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")});const u=new $A(this._contextKeyService);this._register(u.bind(Se.cursorInIndentation,this._cursorIsInIndentation)),this._register(u.bind(Se.hasSelection,p=>!this._editorObs.cursorSelection.read(p)?.isEmpty())),this._register(u.bind(Se.cursorAtInlineEdit,this.model.map((p,f)=>p?.inlineEditState?.read(f)?.cursorAtInlineEdit.read(f)))),this._register(u.bind(Se.tabShouldAcceptInlineEdit,this.model.map((p,f)=>!!p?.tabShouldAcceptInlineEdit.read(f)))),this._register(u.bind(Se.tabShouldJumpToInlineEdit,this.model.map((p,f)=>!!p?.tabShouldJumpToInlineEdit.read(f)))),this._register(u.bind(Se.inlineEditVisible,p=>this.model.read(p)?.inlineEditState.read(p)!==void 0)),this._register(u.bind(Se.inlineSuggestionHasIndentation,p=>this.model.read(p)?.getIndentationInfo(p)?.startsWithIndentation)),this._register(u.bind(Se.inlineSuggestionHasIndentationLessThanTabSize,p=>this.model.read(p)?.getIndentationInfo(p)?.startsWithIndentationLessThanTabSize)),this._register(u.bind(Se.suppressSuggestions,p=>{const f=this.model.read(p)?.inlineCompletionState.read(p);return f?.primaryGhostText&&f?.inlineSuggestion?f.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(u.bind(Se.inlineSuggestionAlternativeActionVisible,p=>{const f=this.model.read(p)?.inlineEditState.read(p)?.inlineSuggestion.action;return f&&f.kind==="edit"&&f.alternativeAction!==void 0})),this._register(u.bind(Se.inlineSuggestionVisible,p=>{const f=this.model.read(p)?.inlineCompletionState.read(p);return!!f?.inlineSuggestion&&f?.primaryGhostText!==void 0&&!f?.primaryGhostText.isEmpty()}));const g=R(this,p=>{const f=this.model.read(p)?.inlineCompletionState.read(p)?.primaryGhostText;if(!(!f||f.isEmpty()))return new B(f.lineNumber,f.parts[0].column)});this._register(u.bind(Se.cursorBeforeGhostText,p=>{const f=g.read(p);if(!f)return!1;const _=this._editorObs.cursorPosition.read(p);return _?f.equals(_):!1})),this._register(this._instantiationService.createInstance(Np,this.editor))}_isEditorDictationInProgress(){return this._contextKeyService.getContext(this.editor.getDomNode())?.getValue("editorDictation.inProgress")===!0}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let s;!t&&i&&this.editor.getOption(170)&&(s=m(1267,"Inspect this in the accessible view ({0})",i.getAriaLabel())),gi(s?e+", "+s:e)}shouldShowHoverAt(e){const t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(i=>e.containsPosition(new B(t.lineNumber,i.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){Vi(e=>{const t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(const i of tn._instances)i!==this&&!i._focusIsInEditorOrMenu.get()&&i.model.get()?.stop("automatic",e)})}jump(){const e=this.model.get();e&&e.jump()}};At=tn=CV([Zn(1,ne),Zn(2,Ce),Zn(3,Ee),Zn(4,ht),Zn(5,ki),Zn(6,X),Zn(7,Tm),Zn(8,He)],At);var SV=class IL extends A{static{this.ID=Gy}constructor(){super({id:IL.ID,label:L(1239,"Show Next Inline Suggestion"),precondition:k.and(S.writable,Se.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){At.get(t)?.model.get()?.next()}},wV=class LL extends A{static{this.ID=Ky}constructor(){super({id:LL.ID,label:L(1240,"Show Previous Inline Suggestion"),precondition:k.and(S.writable,Se.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){At.get(t)?.model.get()?.previous()}},yV="vscode://schemas/inlineCompletionProviderIdArgs";function xV(n){const e=[];return n.providerId&&(e.push(n.providerId.toStringWithoutVersion()),e.push(n.providerId.extensionId+":*")),e}var UC=jO(UO({showNoResultNotification:td(Ab()),providerId:td($O(yV,AO())),explicit:td(Ab()),changeHintData:td(WO())}),VO()),IV=class extends A{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:L(1241,"Trigger Inline Suggestion"),precondition:S.writable,metadata:{description:m(1228,"Triggers an inline suggestion in the editor."),args:[{name:"args",description:m(1229,"Options for triggering inline suggestions."),isOptional:!0,schema:UC.getJSONSchema()}]}})}async run(n,e,t){const i=n.get(Rt),s=n.get(X),o=At.get(e),r=UC.validateOrThrow(t),a=r?.providerId?s.inlineCompletionsProvider.all(e.getModel()).find(l=>xV(l).some(d=>d===r.providerId)):void 0;await wR(async l=>{await o?.model.get()?.trigger(l,{provider:a,explicit:r?.explicit??!0,changeHint:r?.changeHintData?{data:r.changeHintData}:void 0}),o?.playAccessibilitySignal(l)}),r?.showNoResultNotification&&(o?.model.get()?.state.get()||i.notify({severity:Yc.Info,message:m(1230,"No inline suggestion is available.")}))}},LV=class extends A{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:L(1242,"Accept Next Word Of Inline Suggestion"),precondition:k.and(S.writable,Se.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:k.and(S.writable,Se.inlineSuggestionVisible,Se.cursorBeforeGhostText,Cl.negate())},menuOpts:[{menuId:K.InlineSuggestionToolbar,title:m(1231,"Accept Word"),group:"primary",order:2}]})}async run(n,e){await At.get(e)?.model.get()?.acceptNextWord()}},DV=class extends A{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:L(1243,"Accept Next Line Of Inline Suggestion"),precondition:k.and(S.writable,Se.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:K.InlineSuggestionToolbar,title:m(1232,"Accept Line"),group:"secondary",order:2}]})}async run(n,e){await At.get(e)?.model.get()?.acceptNextLine()}},EV=class extends A{constructor(){super({id:Sr,label:L(1244,"Accept Inline Suggestion"),precondition:k.or(Se.inlineSuggestionVisible,Se.inlineEditVisible),menuOpts:[{menuId:K.InlineSuggestionToolbar,title:m(1233,"Accept"),group:"primary",order:2},{menuId:K.InlineEditsActions,title:m(1234,"Accept"),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:k.or(k.and(Se.inlineSuggestionVisible,S.tabMovesFocus.toNegated(),J.Visible.toNegated(),S.hoverFocused.toNegated(),Se.hasSelection.toNegated(),Se.inlineSuggestionHasIndentationLessThanTabSize),k.and(Se.inlineEditVisible,S.tabMovesFocus.toNegated(),J.Visible.toNegated(),S.hoverFocused.toNegated(),Se.tabShouldAcceptInlineEdit))}]})}async run(n,e){const t=At.getInFocusedEditorOrParent(n);t&&(t.model.get()?.accept(t.editor),t.editor.focus())}};ai.registerKeybindingRule({id:Sr,weight:202,primary:2,when:k.and(Se.inInlineEditsPreviewEditor)});var RV=class extends A{constructor(){super({id:bh,label:L(1245,"Accept Inline Suggestion Alternative Action"),precondition:k.and(Se.inlineSuggestionAlternativeActionVisible,Se.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(n,e){const t=At.getInFocusedEditorOrParent(n);t&&(t.model.get()?.accept(t.editor,!0),t.editor.focus())}};ai.registerKeybindingRule({id:bh,weight:203,primary:1026,when:k.and(Se.inInlineEditsPreviewEditor)});var TV=class extends A{constructor(){super({id:l_,label:L(1246,"Jump to next inline edit"),precondition:Se.inlineEditVisible,menuOpts:[{menuId:K.InlineEditsActions,title:m(1235,"Jump"),group:"primary",order:1,when:Se.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:k.and(Se.inlineEditVisible,S.tabMovesFocus.toNegated(),J.Visible.toNegated(),S.hoverFocused.toNegated(),Se.tabShouldJumpToInlineEdit)}})}async run(n,e){const t=At.get(e);t&&t.jump()}},DL=class EL extends A{static{this.ID=Zy}constructor(){super({id:EL.ID,label:L(1247,"Hide Inline Suggestion"),precondition:k.or(Se.inlineSuggestionVisible,Se.inlineEditVisible),kbOpts:{kbExpr:S.editorTextFocus,weight:190,primary:9},menuOpts:[{menuId:K.InlineEditsActions,title:m(1236,"Reject"),group:"primary",order:3}]})}async run(e,t){const i=At.getInFocusedEditorOrParent(e);Vi(s=>{i?.model.get()?.stop("explicitCancel",s)}),i?.editor.focus()}},PV=class RL extends A{static{this.ID=Tg}constructor(){super({id:RL.ID,label:L(1248,"Toggle Inline Suggestions Show Collapsed"),precondition:k.true()})}async run(e,t){const i=e.get(Ee),s=i.getValue("editor.inlineSuggest.edits.showCollapsed");i.updateValue("editor.inlineSuggest.edits.showCollapsed",!s)}};ai.registerKeybindingRule({id:DL.ID,weight:-1,primary:9,secondary:[1033],when:k.and(Se.inInlineEditsPreviewEditor)});var kV=class TL extends lt{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:TL.ID,title:m(1237,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:K.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:k.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e){const t=e.get(Ee),i=t.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";t.updateValue("editor.inlineSuggest.showToolbar",i)}},NV=class extends A{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:m(1238,"Developer: Extract Inline Suggest State"),alias:"Developer: Inline Suggest Extract Repro",precondition:k.or(Se.inlineEditVisible,Se.inlineSuggestionVisible)})}async run(n,e){const t=n.get(oi),i=At.get(e)?.model.get();if(!i)return;const s=i.extractReproSample(),o=Fn(JSON.stringify({inlineCompletion:s.inlineCompletion},null,4)).map(a=>"// "+a).join(`
|
|
55
|
+
`),r=`${s.documentValue}
|
|
56
|
+
|
|
57
|
+
// <json>
|
|
58
|
+
${o}
|
|
59
|
+
// </json>
|
|
60
|
+
`;return await t.writeText(r),{reproCase:r}}},MV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},cd=function(n,e){return function(t,i){e(t,i,n)}},OV=class{constructor(n,e,t){this.owner=n,this.range=e,this.controller=t}isValidForHoverAnchor(n){return n.type===1&&this.range.startColumn<=n.range.startColumn&&this.range.endColumn>=n.range.endColumn}},Df=class{constructor(e,t,i,s,o){this._editor=e,this.accessibilityService=t,this._instantiationService=i,this._telemetryService=s,this._markdownRendererService=o,this.hoverOrdinal=4,this.hideCopyButton=!0}suggestHoverAnchor(e){const t=At.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const s=i.detail;if(t.shouldShowHoverAtViewZone(s.viewZoneId))return new la(1e3,this,x.fromPositions(this._editor.getModel().validatePosition(s.positionBefore||s.position)),e.event.posx,e.event.posy,!1)}if(i.type===7&&t.shouldShowHoverAt(i.range))return new la(1e3,this,i.range,e.event.posx,e.event.posy,!1);if(i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range))return new la(1e3,this,i.range,e.event.posx,e.event.posy,!1);if(i.type===9&&i.element){const s=sl.getWarningWidgetContext(i.element);if(s&&t.shouldShowHoverAt(s.range))return new la(1e3,this,s.range,e.event.posx,e.event.posy,!1)}return null}computeSync(e,t){if(this._editor.getOption(71).showToolbar!=="onHover")return[];const i=At.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new OV(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new O,s=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&i.add(this.renderScreenReaderText(e,s));const o=s.controller.model.get(),r=document.createElement("div");return e.fragment.appendChild(r),i.add(xl((a,l)=>{const d=l.add(this._instantiationService.createInstance(wr.hot.read(a),this._editor,!1,ye(null),o.selectedInlineCompletionIndex,o.inlineCompletionsCount,o.activeCommands,o.warning,()=>{e.onContentsChanged()}));r.replaceChildren(d.getDomNode())})),o.triggerExplicitly(),new po([{hoverPart:s,hoverElement:r,dispose(){i.dispose()}}])}getAccessibleContent(e){return m(1268,"There are inline completions here")}renderScreenReaderText(e,t){const i=new O,s=H,o=s("div.hover-row.markdown-hover"),r=U(o,s("div.hover-contents",{"aria-live":"assertive"})),a=l=>{const d=m(1269,"Suggestion:"),c=i.add(this._markdownRendererService.render(new St().appendText(d).appendCodeblock("text",l),{context:this._editor,asyncRenderCallback:()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}}));r.replaceChildren(c.element)};return i.add(ge(l=>{const d=t.controller.model.read(l)?.primaryGhostText.read(l);if(d){const c=this._editor.getModel().getLineContent(d.lineNumber);a(d.renderForScreenReader(c))}else tc(r)})),e.fragment.appendChild(o),i}};Df=MV([cd(1,So),cd(2,ne),cd(3,Rs),cd(4,Es)],Df);var AV=class{};de(At.ID,MO(At.hot),3);P(IV);P(SV);P(wV);P(LV);P(DV);P(EV);P(RV);P(PV);P(DL);P(TV);me(kV);P(NV);me(uR);me(jT);xo.register(Df);Lh.register(new AV);var FV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Au=function(n,e){return function(t,i){e(t,i,n)}},wa,ll=class{static{wa=this}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}constructor(e,t,i,s){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=s,this.toUnhook=new O,this.toUnhookForKeyboard=new O,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const o=new wh(e);this.toUnhook.add(o),this.toUnhook.add(o.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(o.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{Le(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(o.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(wa.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),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(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){this.toUnhookForKeyboard.clear();const t=e?this.editor.getModel()?.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new Rw(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=mt(r=>this.findDefinition(e,r));let s;try{s=await this.previousPromise}catch(r){Le(r);return}if(!s||!s.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const o=s[0].originSelectionRange?x.lift(s[0].originSelectionRange):new x(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(s.length>1){let r=o;for(const{originSelectionRange:a}of s)a&&(r=x.plusRange(r,a));this.addDecoration(r,new St().appendText(m(1135,"Click to show {0} definitions.",s.length)))}else{const r=s[0];return r.uri?this.textModelResolverService.createModelReference(r.uri).then(a=>{if(!a.object||!a.object.textEditorModel){a.dispose();return}const{object:{textEditorModel:l}}=a,{startLineNumber:d}=r.range;if(d<1||d>l.getLineCount()){a.dispose();return}const c=this.getPreviewValue(l,d,r),h=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(o,c?new St().appendCodeblock(h||"",c):void 0),a.dispose()}):void 0}}getPreviewValue(e,t,i){let s=i.range;return s.endLineNumber-s.startLineNumber>=wa.MAX_SOURCE_PREVIEW_LINES&&(s=this.getPreviewRangeBasedOnIndentation(e,t)),s=e.validateRange(s),this.stripIndentationFromPreviewRange(e,t,s)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let o=t+1;o<i.endLineNumber;o++){const r=e.getLineFirstNonWhitespaceColumn(o);s=Math.min(s,r)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),s=Math.min(e.getLineCount(),t+wa.MAX_SOURCE_PREVIEW_LINES);let o=t+1;for(;o<s&&i!==e.getLineFirstNonWhitespaceColumn(o);o++);return new x(t,1,o+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(e.target.detail.injectedText?.options instanceof Pm)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Pl(this.languageFeaturesService.definitionProvider,i,e,!1,t):Promise.resolve(null)}async gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const s=!t&&this.editor.getOption(101)&&!this.isInPeekEditor(i);return new Nl({openToSide:t,openInPeek:s,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(Ce);return Ut.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};ll=wa=FV([Au(1,li),Au(2,Bn),Au(3,X)],ll);de(ll.ID,ll,2);var HV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},zC=function(n,e){return function(t,i){e(t,i,n)}},Wc=class extends M{static{this.ID="editor.contrib.markerSelectionStatus"}constructor(e,t,i){super(),this._editor=e,this._markerService=i,this._ctxHasDiagnostics=S.selectionHasDiagnostics.bindTo(t),this._store.add(this._editor.onDidChangeCursorSelection(()=>this._update())),this._store.add(this._editor.onDidChangeModel(()=>this._update())),this._store.add(this._markerService.onMarkerChanged(s=>{const o=this._editor.getModel();o&&s.some(r=>vs(r,o.uri))&&this._update()})),this._update()}dispose(){this._ctxHasDiagnostics.reset(),super.dispose()}_update(){const e=this._editor.getModel(),t=this._editor.getSelection();if(!e||!t){this._ctxHasDiagnostics.reset();return}const i=this._markerService.read({resource:e.uri,severities:wt.Error|wt.Warning|wt.Info}).some(s=>x.areIntersecting({startLineNumber:s.startLineNumber,startColumn:s.startColumn,endLineNumber:s.endLineNumber,endColumn:s.endColumn},t));this._ctxHasDiagnostics.set(i)}};Wc=HV([zC(1,Ce),zC(2,fh)],Wc);de(Wc.ID,Wc,1);var WV=class extends A{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:L(1159,"Developer: Debug Editor GPU Renderer"),precondition:k.true()})}async run(n,e){const t=n.get(ne),i=await n.get(Ri).pick([{label:m(1156,"Log Texture Atlas Stats"),id:"logTextureAtlasStats"},{label:m(1157,"Save Texture Atlas"),id:"saveTextureAtlas"},{label:m(1158,"Draw Glyph"),id:"drawGlyph"}],{canPickMany:!1});if(i)switch(i.id){case"logTextureAtlasStats":t.invokeFunction(s=>{const o=s.get(Ot),r=qr.atlas;if(!qr.atlas){o.error("No texture atlas found");return}const a=r.getStats();o.info(["Texture atlas stats",...a].join(`
|
|
61
|
+
|
|
62
|
+
`))});break;case"saveTextureAtlas":t.invokeFunction(async s=>{const o=s.get(Cs),r=s.get(vC),a=o.getWorkspace().folders;if(a.length>0){const l=qr.atlas,d=[];for(const[c,h]of l.pages.entries())d.push(r.writeFile(ke.joinPath(a[0].uri,`textureAtlasPage${c}_actual.png`),vd.wrap(new Uint8Array(await(await h.source.convertToBlob()).arrayBuffer()))),r.writeFile(ke.joinPath(a[0].uri,`textureAtlasPage${c}_usage.png`),vd.wrap(new Uint8Array(await(await h.getUsagePreview()).arrayBuffer()))));await Promise.all(d)}});break;case"drawGlyph":t.invokeFunction(async s=>{const o=s.get(Ee),r=s.get(vC),a=s.get(Ri),l=s.get(Cs).getWorkspace().folders;if(l.length===0)return;const d=qr.atlas,c=o.getValue("editor.fontFamily"),h=o.getValue("editor.fontSize"),u=new IE(h,c,Jd().devicePixelRatio,qr.decorationStyleCache);let g=await a.input({prompt:"Enter a character to draw (prefix with 0x for code point))"});if(!g)return;const p=g.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;p!==void 0&&(g=String.fromCodePoint(parseInt(p,16)));const f=0,_=d.getGlyph(u,g,f,0,0);if(!_)return;const v=d.pages[_.pageIndex].source.getContext("2d")?.getImageData(_.x,_.y,_.w,_.h);if(!v)return;const C=new OffscreenCanvas(v.width,v.height);gP(C.getContext("2d")).putImageData(v,0,0);const w=await C.convertToBlob({type:"image/png"}),y=ke.joinPath(l[0].uri,`glyph_${g}_${f}_${h}px_${c.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await r.writeFile(y,vd.wrap(new Uint8Array(await w.arrayBuffer())))})}}};P(WV);var Hi;(function(n){n.NoAutoFocus="noAutoFocus",n.FocusIfVisible="focusIfVisible",n.AutoFocusImmediately="autoFocusImmediately"})(Hi||(Hi={}));var VV=class extends A{constructor(){super({id:j1,label:L(1165,"Show or Focus Hover"),metadata:{description:L(1166,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Hi.NoAutoFocus,Hi.FocusIfVisible,Hi.AutoFocusImmediately],enumDescriptions:[m(1162,"The hover will not automatically take focus."),m(1163,"The hover will take focus only if it is already visible."),m(1164,"The hover will automatically take focus when it appears.")],default:Hi.FocusIfVisible}}}}]},precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:tt(2089,2087),weight:100}})}run(n,e,t){if(!e.hasModel())return;const i=Lt.get(e);if(!i)return;const s=t?.focus;let o=Hi.FocusIfVisible;Object.values(Hi).includes(s)?o=s:typeof s=="boolean"&&s&&(o=Hi.AutoFocusImmediately);const r=l=>{const d=e.getPosition(),c=new x(d.lineNumber,d.column,d.lineNumber,d.column);i.showContentHover(c,1,2,l)},a=e.getOption(2)===2;i.isHoverVisible?o!==Hi.NoAutoFocus?i.focus():r(a):r(a||o===Hi.AutoFocusImmediately)}},BV=class extends A{constructor(){super({id:q1,label:L(1167,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:L(1168,"Show the definition preview hover in the editor.")}})}run(n,e){const t=Lt.get(e);if(!t)return;const i=e.getPosition();if(!i)return;const s=new x(i.lineNumber,i.column,i.lineNumber,i.column),o=ll.get(e);o&&o.startFindDefinitionFromCursor(i).then(()=>{t.showContentHover(s,1,2,!0)})}},UV=class extends A{constructor(){super({id:$1,label:L(1169,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(n,e){Lt.get(e)?.hideContentHover()}},zV=class extends A{constructor(){super({id:K1,label:L(1170,"Scroll Up Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:16,weight:100},metadata:{description:L(1171,"Scroll up the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.scrollUp()}},jV=class extends A{constructor(){super({id:G1,label:L(1172,"Scroll Down Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:18,weight:100},metadata:{description:L(1173,"Scroll down the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.scrollDown()}},qV=class extends A{constructor(){super({id:Z1,label:L(1174,"Scroll Left Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:15,weight:100},metadata:{description:L(1175,"Scroll left the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.scrollLeft()}},$V=class extends A{constructor(){super({id:X1,label:L(1176,"Scroll Right Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:17,weight:100},metadata:{description:L(1177,"Scroll right the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.scrollRight()}},KV=class extends A{constructor(){super({id:Y1,label:L(1178,"Page Up Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:L(1179,"Page up the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.pageUp()}},GV=class extends A{constructor(){super({id:J1,label:L(1180,"Page Down Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:L(1181,"Page down the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.pageDown()}},ZV=class extends A{constructor(){super({id:Q1,label:L(1182,"Go To Top Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:L(1183,"Go to the top of the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.goToTop()}},XV=class extends A{constructor(){super({id:ek,label:L(1184,"Go To Bottom Hover"),precondition:S.hoverFocused,kbOpts:{kbExpr:S.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:L(1185,"Go to the bottom of the editor hover.")}})}run(n,e){const t=Lt.get(e);t&&t.goToBottom()}},YV=class extends A{constructor(){super({id:r_,label:tk,alias:"Increase Hover Verbosity Level",precondition:S.hoverVisible})}run(n,e,t){const i=Lt.get(e);if(!i)return;const s=t?.index!==void 0?t.index:i.focusedHoverPartIndex();i.updateHoverVerbosityLevel(ui.Increase,s,t?.focus)}},JV=class extends A{constructor(){super({id:a_,label:ik,alias:"Decrease Hover Verbosity Level",precondition:S.hoverVisible})}run(n,e,t){const i=Lt.get(e);if(!i)return;const s=t?.index!==void 0?t.index:i.focusedHoverPartIndex();Lt.get(e)?.updateHoverVerbosityLevel(ui.Decrease,s,t?.focus)}},QV=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ta=function(n,e){return function(t,i){e(t,i,n)}},_i=H,e3=class{constructor(n,e,t){this.owner=n,this.range=e,this.marker=t}isValidForHoverAnchor(n){return n.type===1&&this.range.startColumn<=n.range.startColumn&&this.range.endColumn>=n.range.endColumn}},jC={type:1,filter:{include:Ae.QuickFix},triggerAction:Xt.QuickFixHover},Ef=class{constructor(e,t,i,s,o,r){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=s,this._menuService=o,this._contextKeyService=r,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),s=e.range;if(!i.isValidRange(e.range))return[];const o=s.startLineNumber,r=i.getLineMaxColumn(o),a=[];for(const l of t){const d=l.range.startLineNumber===o?l.range.startColumn:1,c=l.range.endLineNumber===o?l.range.endColumn:r,h=this._markerDecorationsService.getMarker(i.uri,l);if(!h)continue;const u=new x(e.range.startLineNumber,d,e.range.startLineNumber,c);a.push(new e3(this,u,h))}return a}renderHoverParts(e,t){if(!t.length)return new po([]);const i=[];t.forEach(r=>{const a=this._renderMarkerHover(r);e.fragment.appendChild(a.hoverElement),i.push(a)});const s=t.length===1?t[0]:t.sort((r,a)=>wt.compare(r.marker.severity,a.marker.severity))[0],o=this._renderMarkerStatusbar(e,s);return new po(i,o)}getAccessibleContent(e){const{marker:t}=e,i=Gt(t.relatedInformation)?t.relatedInformation.map(s=>`${Ti(s.resource)}(${s.startLineNumber}, ${s.startColumn}): ${s.message}`).join(`
|
|
63
|
+
`):void 0;return[t.message,i].filter(s=>!!s).join(`
|
|
64
|
+
`)}_renderMarkerHover(e){const t=new O,i=_i("div.hover-row"),s=U(i,_i("div.marker.hover-contents")),{source:o,message:r,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(s);const d=U(s,_i("span"));if(d.style.whiteSpace="pre-wrap",d.innerText=r,o||a)if(a&&typeof a!="string"){const c=_i("span");if(o){const p=U(c,_i("span"));p.innerText=o}const h=U(c,_i("a.code-link"));h.setAttribute("href",a.target.toString(!0)),t.add(Q(h,"click",p=>{this._openerService.open(a.target),p.preventDefault(),p.stopPropagation()}));const u=U(h,_i("span"));u.innerText=a.value;const g=U(s,c);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const c=U(s,_i("span"));c.style.opacity="0.6",c.style.paddingLeft="6px",c.innerText=o&&a?`${o}(${a})`:o||`(${a})`}if(Gt(l))for(const{message:c,resource:h,startLineNumber:u,startColumn:g}of l){const p=U(s,_i("div"));p.style.marginTop="8px";const f=U(p,_i("a"));f.innerText=`${Ti(h)}(${u}, ${g}): `,f.style.cursor="pointer",t.add(Q(f,"click",v=>{if(v.stopPropagation(),v.preventDefault(),this._openerService){const C={selection:{startLineNumber:u,startColumn:g}};this._openerService.open(h,{fromUserGesture:!0,editorOptions:C}).catch(Le)}}));const _=U(p,_i("span"));_.innerText=c,this._editor.applyFontInfo(_)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}_renderMarkerStatusbar(e,t){const i=new O;if(t.marker.severity===wt.Error||t.marker.severity===wt.Warning||t.marker.severity===wt.Info){const r=_o.get(this._editor);r&&e.statusBar.addAction({label:m(1195,"View Problem"),commandId:k_.ID,run:()=>{e.hide(),r.showAtMarker(t.marker),this._editor.focus()}})}const s=[];for(const[,r]of this._menuService.getMenuActions(K.MarkerHoverStatusBar,this._contextKeyService))for(const a of r)a instanceof co&&a.enabled&&s.push(a);const o=()=>{for(const r of s)e.statusBar.addAction({label:r.label,commandId:r.id,iconClass:r.class,run:()=>{e.hide(),this._editor.setSelection(x.lift(t.range)),r.run()}})};if(this._editor.getOption(104))o();else{const r=e.statusBar.append(_i("div"));this.recentMarkerCodeActionsInfo&&(Pv.makeKey(this.recentMarkerCodeActionsInfo.marker)===Pv.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||s.length===0&&(r.textContent=m(1196,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const a=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?M.None:ji(()=>r.textContent=m(1197,"Checking for quick fixes..."),200,i);r.textContent||(r.textContent=" ");const l=this.getCodeActions(t.marker);i.add(Te(()=>l.cancel())),l.then(d=>{if(a.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:d.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){d.dispose(),s.length===0?r.textContent=m(1198,"No quick fixes available"):r.style.display="none",o();return}r.style.display="none";let c=!1;i.add(Te(()=>{c||d.dispose()})),e.statusBar.addAction({label:m(1199,"Quick Fix..."),commandId:Ly,run:u=>{c=!0;const g=go.get(this._editor),p=Mt(u);g?.showCodeActions(jC,d,{x:p.left,y:p.top,width:p.width,height:p.height})}});const h=d.validActions.find(u=>u.action.isAI);h?e.statusBar.addAction({label:h.action.title,commandId:h.action.command?.id??"",iconClass:ce.asClassName(V.sparkle),run:()=>{go.get(this._editor)?.applyCodeAction(h,!1,!1,as.FromProblemsHover)}}):o(),e.onContentsChanged()},Le)}return i}getCodeActions(e){return mt(t=>Qo(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new x(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),jC,En.None,t))}};Ef=QV([ta(1,vE),ta(2,Co),ta(3,X),ta(4,Ts),ta(5,Ce)],Ef);var t3=class{constructor(n){this._editor=n}computeSync(n){const e=o=>({value:o}),t=this._editor.getLineDecorations(n.lineNumber),i=[],s=n.laneOrLine==="lineNo";if(!t)return i;for(const o of t){const r=o.options.glyphMargin?.position??ig.Center;if(!s&&r!==n.laneOrLine)continue;const a=s?o.options.lineNumberHoverMessage:o.options.glyphMarginHoverMessage;!a||Ha(a)||i.push(...Aw(a).map(e))}return i}},i3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},n3=function(n,e){return function(t,i){e(t,i,n)}},Rf,qC=H,Tf=class extends M{static{Rf=this}static{this.ID="editor.contrib.modesGlyphHoverWidget"}constructor(e,t){super(),this._markdownRendererService=t,this.allowEditorOverflow=!0,this._renderDisposeables=this._register(new O),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new Nw(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new Yy(this._editor,new t3(this._editor))),this._register(this._hoverOperation.onResult(i=>this._withResult(i))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(59)&&this._updateFont()})),this._register(hn(this._hover.containerDomNode,"mouseleave",i=>{this._onMouseLeave(i)})),this._editor.addOverlayWidget(this)}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Rf.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(e=>this._editor.applyFontInfo(e))}_onModelDecorationsChanged(){this._isVisible&&this._hoverComputerOptions&&(this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===e&&this._hoverComputerOptions.laneOrLine===t||(this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:e,laneOrLine:t},this._hoverOperation.start(0,this._hoverComputerOptions))}hide(){this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e.value,this._messages.length>0?this._renderMessages(e.options.lineNumber,e.options.laneOrLine,this._messages):this.hide()}_renderMessages(e,t,i){this._renderDisposeables.clear();const s=document.createDocumentFragment();for(const o of i){const r=qC("div.hover-row.markdown-hover"),a=U(r,qC("div.hover-contents")),l=this._renderDisposeables.add(this._markdownRendererService.render(o.value,{context:this._editor}));a.appendChild(l.element),s.appendChild(r)}this._updateContents(s),this._showAt(e,t)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e,t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),s=this._editor.getTopForLineNumber(e),o=this._editor.getScrollTop(),r=this._editor.getOption(75),a=this._hover.containerDomNode.clientHeight,l=s-o-(a-r)/2,d=i.glyphMarginLeft+i.glyphMarginWidth+(t==="lineNo"?i.lineNumbersWidth:0),c=i.height-a,h=Math.max(0,Math.min(Math.round(l),c));if(this._editor.getOption(51)){const u=this._editor.getDomNode();if(u){const g=Mt(u);this._hover.containerDomNode.style.position="fixed",this._hover.containerDomNode.style.left=`${g.left+d}px`,this._hover.containerDomNode.style.top=`${g.top+h}px`}}else this._hover.containerDomNode.style.position="absolute",this._hover.containerDomNode.style.left=`${d}px`,this._hover.containerDomNode.style.top=`${h}px`;this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!Ch(t,e.x,e.y))&&this.hide()}};Tf=Rf=i3([n3(1,Es)],Tf);var s3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},o3=function(n,e){return function(t,i){e(t,i,n)}},Vc=class extends M{static{this.ID="editor.contrib.marginHover"}constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new O,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new at(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled!=="off"?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideGlyphHover()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(e){const t=this._glyphWidget?.getDomNode();return t?Ch(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover())}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnGlyphHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(!this.shouldKeepOpenOnEditorMouseMoveOrLeave){if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}}_reactToEditorMouseMove(e){if(e){if(!Xy(this._hoverSettings.enabled,this._editor.getOption(86),e)){this.hideGlyphHover();return}this._tryShowHoverWidget(e)||this.hideGlyphHover()}}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){if(this._editor.hasModel()){if(this._hoverSettings.enabled==="onKeyboardModifier"&&c_(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}tw(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(Tf,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};Vc=s3([o3(1,ne)],Vc);var r3=class{},a3=class{},l3=class{};de(Lt.ID,Lt,2);de(Vc.ID,Vc,2);P(VV);P(BV);P(UV);P(zV);P(jV);P(qV);P($V);P(KV);P(GV);P(ZV);P(XV);P(YV);P(JV);xo.register(Ja);xo.register(Ef);Me.registerCommand(Rg,n=>{n.get(Ee).updateValue("editor.hover.showLongLineWarning",!1)});pl((n,e)=>{const t=n.getColor(Mm);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))});Lh.register(new r3);Lh.register(new a3);Lh.register(new l3);function PL(n,e,t,i){if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return[];const s=e.getLanguageConfiguration(n.getLanguageId()).indentRulesSupport;if(!s)return[];const o=new jR(n,s,e);for(i=Math.min(i,n.getLineCount());t<=i&&o.shouldIgnore(t);)t++;if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=n.getOptions(),d=(f,_)=>(_=_||1,_r.shiftIndent(f,f.length+_,r,a,l)),c=(f,_)=>(_=_||1,_r.unshiftIndent(f,f.length+_,r,a,l)),h=[],u=n.getLineContent(t);let g=It(u),p=g;o.shouldIncrease(t)?(p=d(p),g=d(g)):o.shouldIndentNextLine(t)&&(p=d(p)),t++;for(let f=t;f<=i;f++){if(d3(n,f))continue;const _=n.getLineContent(f),v=It(_),C=p;o.shouldDecrease(f,C)&&(p=c(p),g=c(g)),v!==p&&h.push(Xe.replaceMove(new ie(f,1,f,v.length+1),CT(p,a,l))),!o.shouldIgnore(f)&&(o.shouldIncrease(f,C)?(g=d(g),p=g):o.shouldIndentNextLine(f,C)?p=d(p):p=g)}return h}function d3(n,e){return n.tokenization.isCheapToTokenize(e)?n.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var c3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},h3=function(n,e){return function(t,i){e(t,i,n)}},u3=class kL extends A{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:kL.ID,label:L(1204,"Convert Indentation to Spaces"),precondition:S.writable,metadata:{description:L(1205,"Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const s=i.getOptions(),o=t.getSelection();if(!o)return;const r=new w3(o,s.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}},g3=class NL extends A{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:NL.ID,label:L(1206,"Convert Indentation to Tabs"),precondition:S.writable,metadata:{description:L(1207,"Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const s=i.getOptions(),o=t.getSelection();if(!o)return;const r=new y3(o,s.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}},z_=class extends A{constructor(n,e,t){super(t),this.insertSpaces=n,this.displaySizeOnly=e}run(n,e){const t=n.get(Ri),i=n.get(Yt),s=e.getModel();if(!s)return;const o=i.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),r=s.getOptions(),a=[1,2,3,4,5,6,7,8].map(d=>({id:d.toString(),label:d.toString(),description:d===o.tabSize&&d===r.tabSize?m(1200,"Configured Tab Size"):d===o.tabSize?m(1201,"Default Tab Size"):d===r.tabSize?m(1202,"Current Tab Size"):void 0})),l=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{t.pick(a,{placeHolder:m(1203,"Select Tab Size for Current File"),activeItem:a[l]}).then(d=>{if(d&&s&&!s.isDisposed()){const c=parseInt(d.label,10);this.displaySizeOnly?s.updateOptions({tabSize:c}):s.updateOptions({tabSize:c,indentSize:c,insertSpaces:this.insertSpaces})}})},50)}},p3=class ML extends z_{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:ML.ID,label:L(1208,"Indent Using Tabs"),precondition:void 0,metadata:{description:L(1209,"Use indentation with tabs.")}})}},f3=class OL extends z_{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:OL.ID,label:L(1210,"Indent Using Spaces"),precondition:void 0,metadata:{description:L(1211,"Use indentation with spaces.")}})}},m3=class AL extends z_{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:AL.ID,label:L(1212,"Change Tab Display Size"),precondition:void 0,metadata:{description:L(1213,"Change the space size equivalent of the tab.")}})}},_3=class FL extends A{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:FL.ID,label:L(1214,"Detect Indentation from Content"),precondition:void 0,metadata:{description:L(1215,"Detect the indentation from content.")}})}run(e,t){const i=e.get(Yt),s=t.getModel();if(!s)return;const o=i.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget);s.detectIndentation(o.insertSpaces,o.tabSize)}},v3=class extends A{constructor(){super({id:"editor.action.reindentlines",label:L(1216,"Reindent Lines"),precondition:S.writable,metadata:{description:L(1217,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(n,e){const t=n.get(ct),i=e.getModel();if(!i)return;const s=PL(i,t,1,i.getLineCount());s.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,s),e.pushUndoStop())}},b3=class extends A{constructor(){super({id:"editor.action.reindentselectedlines",label:L(1218,"Reindent Selected Lines"),precondition:S.writable,metadata:{description:L(1219,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(n,e){const t=n.get(ct),i=e.getModel();if(!i)return;const s=e.getSelections();if(s===null)return;const o=[];for(const r of s){let a=r.startLineNumber,l=r.endLineNumber;if(a!==l&&r.endColumn===1&&l--,a===1){if(a===l)continue}else a--;const d=PL(i,t,a,l);o.push(...d)}o.length>0&&(e.pushUndoStop(),e.executeEdits(this.id,o),e.pushUndoStop())}},C3=class{constructor(n,e){this._initialSelection=e,this._edits=[],this._selectionId=null;for(const t of n)t.range&&typeof t.text=="string"&&this._edits.push(t)}getEditOperations(n,e){for(const i of this._edits)e.addEditOperation(x.lift(i.range),i.text);let t=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(t=!0,this._selectionId=e.trackSelection(this._initialSelection,!1))),t||(this._selectionId=e.trackSelection(this._initialSelection))}computeCursorState(n,e){return e.getTrackedSelection(this._selectionId)}},Bc=class{static{this.ID="editor.contrib.autoIndentOnPaste"}constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new O,this.callOnModel=new O,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(!this.editor.getOption(17)||this.editor.getOption(16)<4)&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||!this.editor.getOption(18)&&S3(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(16),{tabSize:o,indentSize:r,insertSpaces:a}=i.getOptions(),l=[],d={shiftIndent:g=>_r.shiftIndent(g,g.length+1,o,r,a),unshiftIndent:g=>_r.unshiftIndent(g,g.length+1,o,r,a)};let c=e.startLineNumber,h=i.getLineContent(c);if(!/\S/.test(h.substring(0,e.startColumn-1))){const g=Ia(s,i,i.getLanguageId(),c,d,this._languageConfigurationService);if(g!==null){const p=It(h),f=$t(g,o);if(f!==$t(p,o)){const _=Ra(f,o,a);l.push({range:new x(c,1,c,p.length+1),text:_}),h=_+h.substring(p.length)}else{const _=Hw(i,c,this._languageConfigurationService);if(_===0||_===8)return}}}const u=c;for(;c<e.endLineNumber;){if(!/\S/.test(i.getLineContent(c+1))){c++;continue}break}if(c!==e.endLineNumber){const g=Ia(s,{tokenization:{getLineTokens:p=>i.tokenization.getLineTokens(p),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(p,f)=>i.getLanguageIdAtPosition(p,f)},getLineContent:p=>p===u?h:i.getLineContent(p)},i.getLanguageId(),c+1,d,this._languageConfigurationService);if(g!==null){const p=$t(g,o),f=$t(It(i.getLineContent(c+1)),o);if(p!==f){const _=p-f;for(let v=c+1;v<=e.endLineNumber;v++){const C=i.getLineContent(v),w=It(C),y=$t(w,o)+_,D=Ra(y,o,a);D!==w&&l.push({range:new x(v,1,v,w.length+1),text:D})}}}}if(l.length>0){this.editor.pushUndoStop();const g=new C3(l,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=o=>o.trim().length===0;let s=!0;if(t.startLineNumber===t.endLineNumber)s=i(e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1));else for(let o=t.startLineNumber;o<=t.endLineNumber;o++){const r=e.getLineContent(o);if(o===t.startLineNumber?s=i(r.substring(t.startColumn-1)):o===t.endLineNumber?s=i(r.substring(0,t.endColumn-1)):s=e.getLineFirstNonWhitespaceColumn(o)===0,!s)break}return s}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};Bc=c3([h3(1,ct)],Bc);function S3(n,e){const t=i=>kT(n,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function HL(n,e,t,i){if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let s="";for(let r=0;r<t;r++)s+=" ";const o=new RegExp(s,"gi");for(let r=1,a=n.getLineCount();r<=a;r++){let l=n.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=n.getLineMaxColumn(r)),l===1)continue;const d=new x(r,1,r,l),c=n.getValueInRange(d),h=i?c.replace(/\t/gi,s):c.replace(o," ");e.addEditOperation(d,h)}}var w3=class{constructor(n,e){this.selection=n,this.tabSize=e,this.selectionId=null}getEditOperations(n,e){this.selectionId=e.trackSelection(this.selection),HL(n,e,this.tabSize,!0)}computeCursorState(n,e){return e.getTrackedSelection(this.selectionId)}},y3=class{constructor(n,e){this.selection=n,this.tabSize=e,this.selectionId=null}getEditOperations(n,e){this.selectionId=e.trackSelection(this.selection),HL(n,e,this.tabSize,!1)}computeCursorState(n,e){return e.getTrackedSelection(this.selectionId)}};de(Bc.ID,Bc,2);P(u3);P(g3);P(p3);P(f3);P(m3);P(_3);P(v3);P(b3);de(el.ID,el,1);xo.register(Cc);var x3=class{constructor(n,e,t){this._editRange=n,this._originalSelection=e,this._text=t}getEditOperations(n,e){e.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(n,e){const t=e.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ie(t.endLineNumber,Math.min(this._originalSelection.positionColumn,t.endColumn),t.endLineNumber,Math.min(this._originalSelection.positionColumn,t.endColumn)):new ie(t.endLineNumber,t.endColumn-this._text.length,t.endLineNumber,t.endColumn)}},I3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},L3=function(n,e){return function(t,i){e(t,i,n)}},jd,Lr=class{static{jd=this}static{this.ID="editor.contrib.inPlaceReplaceController"}static get(e){return e.getContribution(jd.ID)}static{this.DECORATION=oe.register({description:"in-place-replace",className:"valueSetReplacement"})}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){this.currentRequest?.cancel();const i=this.editor.getSelection(),s=this.editor.getModel();if(!s||!i)return;let o=i;if(o.startLineNumber!==o.endLineNumber)return;const r=new Rw(this.editor,5),a=s.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=mt(l=>this.editorWorkerService.navigateValueSet(a,o,t)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!r.validate(this.editor))return;const d=x.lift(l.range);let c=l.range;const h=l.value.length-(o.endColumn-o.startColumn);c={startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.startColumn+l.value.length},h>1&&(o=new ie(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+h-1));const u=new x3(d,o,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,u),this.editor.pushUndoStop(),this.decorations.set([{range:c,options:jd.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=sh(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Le)}).catch(Le)):Promise.resolve(void 0)}};Lr=jd=I3([L3(1,Vn)],Lr);var D3=class extends A{constructor(){super({id:"editor.action.inPlaceReplace.up",label:L(1306,"Replace with Previous Value"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:3159,weight:100}})}run(n,e){const t=Lr.get(e);return t?t.run(this.id,!1):Promise.resolve(void 0)}},E3=class extends A{constructor(){super({id:"editor.action.inPlaceReplace.down",label:L(1307,"Replace with Next Value"),precondition:S.writable,kbOpts:{kbExpr:S.editorTextFocus,primary:3161,weight:100}})}run(n,e){const t=Lr.get(e);return t?t.run(this.id,!0):Promise.resolve(void 0)}};de(Lr.ID,Lr,4);P(D3);P(E3);var R3=class{constructor(n){this._selection=n,this._selectionId=null}getEditOperations(n,e){const t=T3(n);t&&e.addEditOperation(t.range,t.text),this._selectionId=e.trackSelection(this._selection)}computeCursorState(n,e){return e.getTrackedSelection(this._selectionId)}};function T3(n){const e=n.getLineCount();return Xe.insert(new B(e,n.getLineMaxColumn(e)),n.getEOL())}var P3=class WL extends A{static{this.ID="editor.action.insertFinalNewLine"}constructor(){super({id:WL.ID,label:L(1308,"Insert Final New Line"),precondition:S.writable})}run(e,t,i){const s=t.getSelection();if(s===null)return;const o=new R3(s);t.pushUndoStop(),t.executeCommands(this.id,[o]),t.pushUndoStop()}};P(P3);var k3=class extends A{constructor(){super({id:"expandLineSelection",label:L(1309,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:S.textInputFocus,primary:2090}})}run(n,e,t){if(t=t||{},!e.hasModel())return;const i=e._getViewModel();i.model.pushStackElement(),i.setCursorStates(t.source,3,Em.expandLineSelection(i,i.getCursorStates())),i.revealAllCursors(t.source,!0)}};P(k3);var N3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},hd=function(n,e){return function(t,i){e(t,i,n)}},qd,VL=new ae("LinkedEditingInputVisible",!1),M3="linked-editing-decoration",Dr=class extends M{static{qd=this}static{this.ID="editor.contrib.linkedEditing"}static{this.DECORATION=oe.register({description:"linked-editing",stickiness:0,className:M3})}static get(e){return e.getContribution(qd.ID)}constructor(e,t,i,s,o){super(),this.languageConfigurationService=s,this._syncRangesToken=0,this._localToDispose=this._register(new O),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=VL.bindTo(t),this._debounceInformation=o.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 O),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(r=>{(r.hasChanged(78)||r.hasChanged(106))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(Ge.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const s=new bs(this._debounceInformation.get(t)),o=()=>{this._rangeUpdateTriggerPromise=s.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new bs(0),a=l=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(l))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{o()})),this._localToDispose.add(this._editor.onDidChangeModelContent(l=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const d=this._currentDecorations.getRange(0);if(d&&l.changes.every(c=>d.intersectRanges(c.range))){a(this._syncRangesToken);return}}o()})),this._localToDispose.add({dispose:()=>{s.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const s=t.getValueInRange(i);if(this._currentWordPattern){const r=s.match(this._currentWordPattern);if((r?r[0].length:0)!==s.length)return this.clearRanges()}const o=[];for(let r=1,a=this._currentDecorations.length;r<a;r++){const l=this._currentDecorations.getRange(r);if(l)if(l.startLineNumber!==l.endLineNumber)o.push({range:l,text:s});else{let d=t.getValueInRange(l),c=s,h=l.startColumn,u=l.endColumn;const g=Or(d,c);h+=g,d=d.substr(g),c=c.substr(g);const p=Vm(d,c);u-=p,d=d.substr(0,d.length-p),c=c.substr(0,c.length-p),(h!==u||c.length!==0)&&o.push({range:new x(l.startLineNumber,h,l.endLineNumber,u),text:c})}}if(o.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const r=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",o),this._editor._getViewModel().setPrevEditOperationType(r)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}const t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}const i=this._editor.getModel(),s=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===s){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=s;const o=this._currentRequestCts=new ot;try{const r=new pi(!1),a=await BL(this._providers,i,t,o.token);if(this._debounceInformation.update(i,r.elapsed()),o!==this._currentRequestCts||(this._currentRequestCts=null,s!==i.getVersionId()))return;let l=[];a?.ranges&&(l=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let d=!1;for(let h=0,u=l.length;h<u;h++)if(x.containsPosition(l[h],t)){if(d=!0,h!==0){const g=l[h];l.splice(h,1),l.unshift(g)}break}if(!d){this.clearRanges();return}const c=l.map(h=>({range:h,options:qd.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(c),this._syncRangesToken++}catch(r){Un(r)||Le(r),(this._currentRequestCts===o||!this._currentRequestCts)&&this.clearRanges()}}};Dr=qd=N3([hd(1,Ce),hd(2,X),hd(3,ct),hd(4,ki)],Dr);var O3=class extends A{constructor(){super({id:"editor.action.linkedEditing",label:L(1342,"Start Linked Editing"),precondition:k.and(S.writable,S.hasRenameProvider),kbOpts:{kbExpr:S.editorTextFocus,primary:3132,weight:100}})}runCommand(n,e){const t=n.get(Ze),[i,s]=Array.isArray(e)&&e||[void 0,void 0];return ke.isUri(i)&&B.isIPosition(s)?t.openCodeEditor({resource:i},t.getActiveCodeEditor()).then(o=>{o&&(o.setPosition(s),o.invokeWithinContext(r=>(this.reportTelemetry(r,o),this.run(r,o))))},Le):super.runCommand(n,e)}run(n,e){const t=Dr.get(e);return t?Promise.resolve(t.updateRanges(!0)):Promise.resolve()}},A3=Ft.bindToContribution(Dr.get);Z(new A3({id:"cancelLinkedEditingInput",precondition:VL,handler:n=>n.clearRanges(),kbOpts:{kbExpr:S.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function BL(n,e,t,i){const s=n.ordered(e);return Hm(s.map(o=>async()=>{try{return await o.provideLinkedEditingRanges(e,t,i)}catch(r){it(r);return}}),o=>!!o&&Gt(o?.ranges))}W("editor.linkedEditingBackground",{dark:ve.fromHex("#f00").transparent(.3),light:ve.fromHex("#f00").transparent(.3),hcDark:ve.fromHex("#f00").transparent(.3),hcLight:ve.white},m(1341,"Background color when the editor auto renames on type."));jt("_executeLinkedEditingProvider",(n,e,t)=>{const{linkedEditingRangeProvider:i}=n.get(X);return BL(i,e,t,he.None)});de(Dr.ID,Dr,1);P(O3);var F3=class{constructor(n,e){this._link=n,this._provider=e}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(n){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,n)).then(e=>(this._link=e||this._link,this._link.url?this.resolve(n):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}},$C=class Pf{static{this.Empty=new Pf([])}constructor(e){this._disposables=new O;let t=[];for(const[i,s]of e){const o=i.links.map(r=>new F3(r,s));t=Pf._union(t,o),qm(i)&&(this._disposables??=new O,this._disposables.add(i))}this.links=t}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(e,t){const i=[];let s,o,r,a;for(s=0,r=0,o=e.length,a=t.length;s<o&&r<a;){const l=e[s],d=t[r];if(x.areIntersectingOrTouching(l.range,d.range)){s++;continue}x.compareRangesUsingStarts(l.range,d.range)<0?(i.push(l),s++):(i.push(d),r++)}for(;s<o;s++)i.push(e[s]);for(;r<a;r++)i.push(t[r]);return i}};async function UL(n,e,t){const i=[],s=n.ordered(e).reverse().map(async(r,a)=>{try{const l=await r.provideLinks(e,t);l&&(i[a]=[l,r])}catch(l){it(l)}});await Promise.all(s);let o=new $C(Ps(i));return t.isCancellationRequested&&(o.dispose(),o=$C.Empty),o}Me.registerCommand("_executeLinkProvider",async(n,...e)=>{let[t,i]=e;Ie(t instanceof ke),typeof i!="number"&&(i=0);const{linkProvider:s}=n.get(X),o=n.get(Yt).getModel(t);if(!o)return[];const r=await UL(s,o,he.None);if(!r)return[];for(let l=0;l<Math.min(i,r.links.length);l++)await r.links[l].resolve(he.None);const a=r.links.slice(0);return r.dispose(),a});var H3=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ud=function(n,e){return function(t,i){e(t,i,n)}},kf,dl=class extends M{static{kf=this}static{this.ID="editor.linkDetector"}static get(e){return e.getContribution(kf.ID)}constructor(e,t,i,s,o){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=s,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=o.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new at(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new wh(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,l])=>{this._onEditorMouseMove(a,l)})),this._register(r.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(r.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=mt(t=>UL(this.providers,e,t));try{const t=new pi(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Le(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(86)==="altKey",i=[],s=Object.keys(this.currentOccurrences);for(const r of s){const a=this.currentOccurrences[r];i.push(a.decorationId)}const o=[];if(e)for(const r of e)o.push(GC.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,o);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let l=0,d=a.length;l<d;l++){const c=new GC(e[l],a[l]);this.currentOccurrences[c.decorationId]=c}})}_onEditorMouseMove(e,t){const i=this.editor.getOption(86)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();const s=this.getLinkOccurrence(e.target.position);s&&this.editor.changeDecorations(o=>{s.activate(o,i),this.activeLinkDecorationId=s.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:s}=e;s.resolve(he.None).then(o=>{if(typeof o=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===Ct.file&&o.startsWith(`${Ct.file}:`)){const a=ke.parse(o);if(a.scheme===Ct.file){const l=s0(a);let d=null;l.startsWith("/./")||l.startsWith("\\.\\")?d=`.${l.substr(1)}`:(l.startsWith("//./")||l.startsWith("\\\\.\\"))&&(d=`.${l.substr(2)}`),d&&(o=iT(r,d))}}}return this.openerService.open(o,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},o=>{const r=o instanceof Error?o.message:o;r==="invalid"?this.notificationService.warn(m(1343,"Failed to open this link because it is not well-formed: {0}",s.url.toString())):r==="missing"?this.notificationService.warn(m(1344,"Failed to open this link because its target is missing.")):Le(o)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const s=this.currentOccurrences[i.id];if(s)return s}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink"))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}};dl=kf=H3([ud(1,Co),ud(2,Rt),ud(3,X),ud(4,ki)],dl);var KC={general:oe.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:oe.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})},GC=class $d{static decoration(e,t){return{range:e.range,options:$d._getOptions(e,t,!1)}}static _getOptions(e,t,i){const s={...i?KC.active:KC.general};return s.hoverMessage=W3(e,t),s}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,$d._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,$d._getOptions(this.link,t,!1))}};function W3(n,e){const t=n.url&&/^command:/i.test(n.url.toString()),i=n.tooltip?n.tooltip:t?m(1345,"Execute command"):m(1346,"Follow link"),s=e?On?m(1347,"cmd + click"):m(1348,"ctrl + click"):On?m(1349,"option + click"):m(1350,"alt + click");if(n.url){let o="";if(/^command:/i.test(n.url.toString())){const r=n.url.toString().match(/^command:([^?#]+)/);if(r){const a=r[1];o=m(1351,"Execute command {0}",a)}}return new St("",!0).appendLink(n.url.toString(!0).replace(/ /g,"%20"),i,o).appendMarkdown(` (${s})`)}else return new St().appendText(`${i} (${s})`)}var V3=class extends A{constructor(){super({id:"editor.action.openLink",label:L(1352,"Open Link"),precondition:void 0})}run(n,e){const t=dl.get(e);if(!t||!e.hasModel())return;const i=e.getSelections();for(const s of i){const o=t.getLinkOccurrence(s.getEndPosition());o&&t.openLinkOccurrence(o,!1)}}};de(dl.ID,dl,1);P(V3);var ZC=class extends M{static{this.ID="editor.contrib.longLinesHelper"}constructor(n){super(),this._editor=n,this._register(this._editor.onMouseDown(e=>{const t=this._editor.getOption(133);t>=0&&e.target.type===6&&e.target.position.column>=t&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}};de(ZC.ID,ZC,2);var XC=class extends M{static{this.ID="editor.contrib.middleScroll"}constructor(n){super(),this._editor=n;const e=je(this._editor),t=e.getOption(172);this._register(ge(i=>{if(!t.read(i))return;const s=e.domNode.read(i);if(!s)return;const o=i.store.add(rT("scrollingSession",void 0));i.store.add(this._editor.onMouseDown(a=>{if(o.read(void 0)){o.set(void 0,void 0);return}if(!a.event.middleButton)return;a.event.stopPropagation(),a.event.preventDefault();const l=new O,d=new zi(a.event.posx,a.event.posy),c=B3(Nt(s),d,l).map(g=>g.subtract(d).withThreshold(5)),h=s.getBoundingClientRect(),u=new zi(d.x-h.left,d.y-h.top);o.set({mouseDeltaAfterThreshold:c,initialMousePosInEditor:u,didScroll:!1,dispose:()=>l.dispose()},void 0),l.add(this._editor.onMouseUp(g=>{const p=o.read(void 0);p&&p.didScroll&&o.set(void 0,void 0)})),l.add(this._editor.onKeyDown(g=>{o.set(void 0,void 0)}))})),i.store.add(ge(a=>{const l=o.read(a);if(!l)return;let d=Date.now();a.store.add(ge(h=>{Op.instance.invalidateOnNextAnimationFrame(h);const u=Date.now(),g=u-d;d=u;const p=l.mouseDeltaAfterThreshold.read(void 0),f=g/32,_=p.scale(f),v=new zi(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(U3(v.add(_))),_.isZero()||(l.didScroll=!0)}));const c=R(h=>{const u=l.mouseDeltaAfterThreshold.read(h);let g="";return g+=u.y<0?"n":u.y>0?"s":"",g+=u.x<0?"w":u.x>0?"e":"",g});a.store.add(ge(h=>{s.setAttribute("data-scroll-direction",c.read(h))}))}));const r=i.store.add($.div({class:["scroll-editor-on-middle-click-dot",o.map(a=>a?"":"hidden")],style:{left:o.map(a=>a?a.initialMousePosInEditor.x:0),top:o.map(a=>a?a.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());i.store.add(uE(s,r.element)),i.store.add(ge(a=>{const l=o.read(a);s.classList.toggle("scroll-editor-on-middle-click-editor",!!l)}))}))}};function B3(n,e,t){const i=Fe("pos",e);return t.add(Q(n,"mousemove",s=>{i.set(new zi(s.pageX,s.pageY),void 0)})),i}function U3(n){return{scrollLeft:n.x,scrollTop:n.y}}de(XC.ID,XC,2);var z3=W("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},m(1637,"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);W("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},m(1638,"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);W("editor.wordHighlightTextBackground",z3,m(1639,"Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);var j3=W("editor.wordHighlightBorder",{light:null,dark:null,hcDark:so,hcLight:so},m(1640,"Border color of a symbol during read-access, like reading a variable."));W("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:so,hcLight:so},m(1641,"Border color of a symbol during write-access, like writing to a variable."));W("editor.wordHighlightTextBorder",j3,m(1642,"Border color of a textual occurrence for a symbol."));var q3=W("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",m(1643,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),$3=W("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",m(1644,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),K3=W("editorOverviewRuler.wordHighlightTextForeground",ww,m(1645,"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),G3=oe.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:nt($3),position:ln.Center},minimap:{color:nt(Gc),position:1}}),Z3=oe.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:nt(K3),position:ln.Center},minimap:{color:nt(Gc),position:1}}),X3=oe.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:nt(ww),position:ln.Center},minimap:{color:nt(Gc),position:1}}),Y3=oe.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),J3=oe.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:nt(q3),position:ln.Center},minimap:{color:nt(Gc),position:1}});function Q3(n){return n===Qd.Write?G3:n===Qd.Text?Z3:J3}function eB(n){return n?Y3:X3}pl((n,e)=>{const t=n.getColor(RE);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var tB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},iB=function(n,e){return function(t,i){e(t,i,n)}},Nf;function Ms(n,e){const t=e.filter(i=>!n.find(s=>s.equals(i)));if(t.length>=1){const i=t.map(o=>`line ${o.viewState.position.lineNumber} column ${o.viewState.position.column}`).join(", "),s=t.length===1?m(1354,"Cursor added: {0}",i):m(1355,"Cursors added: {0}",i);Ss(s)}}var nB=class extends A{constructor(){super({id:"editor.action.insertCursorAbove",label:L(1364,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1356,"&&Add Cursor Above"),order:2}})}run(n,e,t){if(!e.hasModel())return;let i=!0;t&&t.logicalLine===!1&&(i=!1);const s=e._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(t.source,3,Em.addCursorUp(s,o,i)),s.revealTopMostCursor(t.source),Ms(o,s.getCursorStates())}},sB=class extends A{constructor(){super({id:"editor.action.insertCursorBelow",label:L(1365,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1357,"A&&dd Cursor Below"),order:3}})}run(n,e,t){if(!e.hasModel())return;let i=!0;t&&t.logicalLine===!1&&(i=!1);const s=e._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const o=s.getCursorStates();s.setCursorStates(t.source,3,Em.addCursorDown(s,o,i)),s.revealBottomMostCursor(t.source),Ms(o,s.getCursorStates())}},oB=class extends A{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:L(1366,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1358,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(n,e,t){if(!n.isEmpty()){for(let i=n.startLineNumber;i<n.endLineNumber;i++){const s=e.getLineMaxColumn(i);t.push(new ie(i,s,i,s))}n.endColumn>1&&t.push(new ie(n.endLineNumber,n.endColumn,n.endLineNumber,n.endColumn))}}run(n,e){if(!e.hasModel())return;const t=e.getModel(),i=e.getSelections(),s=e._getViewModel(),o=s.getCursorStates(),r=[];i.forEach(a=>this.getCursorsForSelection(a,t,r)),r.length>0&&e.setSelections(r),Ms(o,s.getCursorStates())}},rB=class extends A{constructor(){super({id:"editor.action.addCursorsToBottom",label:L(1367,"Add Cursors to Bottom"),precondition:void 0})}run(n,e){if(!e.hasModel())return;const t=e.getSelections(),i=e.getModel().getLineCount(),s=[];for(let a=t[0].startLineNumber;a<=i;a++)s.push(new ie(a,t[0].startColumn,a,t[0].endColumn));const o=e._getViewModel(),r=o.getCursorStates();s.length>0&&e.setSelections(s),Ms(r,o.getCursorStates())}},aB=class extends A{constructor(){super({id:"editor.action.addCursorsToTop",label:L(1368,"Add Cursors to Top"),precondition:void 0})}run(n,e){if(!e.hasModel())return;const t=e.getSelections(),i=[];for(let r=t[0].startLineNumber;r>=1;r--)i.push(new ie(r,t[0].startColumn,r,t[0].endColumn));const s=e._getViewModel(),o=s.getCursorStates();i.length>0&&e.setSelections(i),Ms(o,s.getCursorStates())}},gd=class{constructor(n,e,t){this.selections=n,this.revealRange=e,this.revealScrollType=t}},zL=class Mf{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new Mf(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let s=!1,o,r;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(s=!0,o=!0,r=!0):(o=i.wholeWord,r=i.matchCase);const l=e.getSelection();let d,c=null;if(l.isEmpty()){const h=e.getConfiguredWordAtPosition(l.getStartPosition());if(!h)return null;d=h.word,c=new ie(l.startLineNumber,h.startColumn,l.startLineNumber,h.endColumn)}else d=e.getModel().getValueInRange(l).replace(/\r\n/g,`
|
|
65
|
+
`);return new Mf(e,t,s,d,o,r,c)}constructor(e,t,i,s,o,r,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=s,this.wholeWord=o,this.matchCase=r,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new gd(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new gd(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const s=this.currentMatch;return this.currentMatch=null,s}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return i?new ie(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new gd(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new gd(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const s=this.currentMatch;return this.currentMatch=null,s}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return i?new ie(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}},Uc=class jL extends M{static{this.ID="editor.contrib.multiCursorController"}static get(e){return e.getContribution(jL.ID)}constructor(e){super(),this._sessionDispose=this._register(new O),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=zL.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(s=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(s=>{(s.matchCase||s.wholeWord)&&this._endSession()}))}}_endSession(){this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController&&this._session.findController.getState().change({wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0},!1),this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new ie(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const i=e.getState().matchCase;if(!qL(this._editor.getModel(),t,i)){const s=this._editor.getModel(),o=[];for(let r=0,a=t.length;r<a;r++)o[r]=this._expandEmptyToWord(s,t[r]);this._editor.setSelections(o);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex){const s=this._editor.getModel();i.searchScope?t=s.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(148):null,!1,1073741824):t=s.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const s=this._editor.getSelection();for(let o=0,r=t.length;o<r;o++){const a=t[o];if(a.range.intersectRanges(s)){t[o]=t[0],t[0]=a;break}}this._setSelections(t.map(o=>new ie(o.range.startLineNumber,o.range.startColumn,o.range.endLineNumber,o.range.endColumn)))}}},Br=class extends A{run(n,e){const t=Uc.get(e);if(!t)return;const i=e._getViewModel();if(i){const s=i.getCursorStates(),o=zt.get(e);if(o)this._run(t,o);else{const r=n.get(ne).createInstance(zt,e);this._run(t,r),r.dispose()}Ms(s,i.getCursorStates())}}},lB=class extends Br{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:L(1369,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:2082,weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1359,"Add &&Next Occurrence"),order:5}})}_run(n,e){n.addSelectionToNextFindMatch(e)}},dB=class extends Br{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:L(1370,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1360,"Add P&&revious Occurrence"),order:6}})}_run(n,e){n.addSelectionToPreviousFindMatch(e)}},cB=class extends Br{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:L(1371,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:tt(2089,2082),weight:100}})}_run(n,e){n.moveSelectionToNextFindMatch(e)}},hB=class extends Br{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:L(1372,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(n,e){n.moveSelectionToPreviousFindMatch(e)}},uB=class extends Br{constructor(){super({id:"editor.action.selectHighlights",label:L(1373,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:S.focus,primary:3114,weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"3_multi",title:m(1361,"Select All &&Occurrences"),order:7}})}_run(n,e){n.selectAll(e)}},gB=class extends Br{constructor(){super({id:"editor.action.changeAll",label:L(1374,"Change All Occurrences"),precondition:k.and(S.writable,S.editorTextFocus),kbOpts:{kbExpr:S.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(n,e){n.selectAll(e)}},pB=class{constructor(n,e,t,i,s){this._model=n,this._searchText=e,this._matchCase=t,this._wordSeparators=i,this._cachedFindMatches=null,this._modelVersionId=this._model.getVersionId(),s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(n=>n.range),this._cachedFindMatches.sort(x.compareRangesUsingStarts)),this._cachedFindMatches}},zc=class extends M{static{Nf=this}static{this.ID="editor.contrib.selectionHighlighter"}constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new at(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(s=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(s=>{this._isEnabled&&(s.selection.isEmpty()?s.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(s=>{this._setState(null)})),this._register(e.onDidChangeModelContent(s=>{this._isEnabled&&this.updateSoon.schedule()}));const i=zt.get(e);i&&this._register(i.getState().onFindReplaceStateChange(s=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(Nf._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,i,s,o){if(!t||!o.hasModel())return null;if(!i){const h=o.getSelection();if(h.startLineNumber!==h.endLineNumber)return null}const r=Uc.get(o);if(!r)return null;const a=zt.get(o);if(!a)return null;let l=r.getSession(a);if(!l){const h=o.getSelections();if(h.length>1){const u=a.getState().matchCase;if(!qL(o.getModel(),h,u))return null}l=zL.create(o,a)}if(!l||l.currentMatch||/^[ \t]+$/.test(l.searchText)||s>0&&l.searchText.length>s)return null;const d=a.getState(),c=d.matchCase;if(d.isRevealed){let h=d.searchString;c||(h=h.toLowerCase());let u=l.searchText;if(c||(u=u.toLowerCase()),h===u&&l.matchCase===d.matchCase&&l.wholeWord===d.wholeWord&&!d.isRegex)return null}return new pB(o.getModel(),l.searchText,l.matchCase,l.wholeWord?o.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),s=this.editor.getSelections();s.sort(x.compareRangesUsingStarts);const o=[];for(let d=0,c=0,h=i.length,u=s.length;d<h;){const g=i[d];if(c>=u)o.push(g),d++;else{const p=x.compareRangesUsingStarts(g,s[c]);p<0?((s[c].isEmpty()||!x.areIntersecting(g,s[c]))&&o.push(g),d++):(p>0||d++,c++)}}const r=this.editor.getOption(90)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,l=o.map(d=>({range:d,options:eB(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}};zc=Nf=tB([iB(1,X)],zc);function qL(n,e,t){const i=YC(n,e[0],!t);for(let s=1,o=e.length;s<o;s++){const r=e[s];if(r.isEmpty()||i!==YC(n,r,!t))return!1}return!0}function YC(n,e,t){const i=n.getValueInRange(e);return t?i.toLowerCase():i}var fB=class extends A{constructor(){super({id:"editor.action.focusNextCursor",label:L(1375,"Focus Next Cursor"),metadata:{description:m(1362,"Focuses the next cursor"),args:[]},precondition:void 0})}run(n,e,t){if(!e.hasModel())return;const i=e._getViewModel();if(i.cursorConfig.readOnly)return;i.model.pushStackElement();const s=Array.from(i.getCursorStates()),o=s.shift();o&&(s.push(o),i.setCursorStates(t.source,3,s),i.revealPrimaryCursor(t.source,!0),Ms(s,i.getCursorStates()))}},mB=class extends A{constructor(){super({id:"editor.action.focusPreviousCursor",label:L(1376,"Focus Previous Cursor"),metadata:{description:m(1363,"Focuses the previous cursor"),args:[]},precondition:void 0})}run(n,e,t){if(!e.hasModel())return;const i=e._getViewModel();if(i.cursorConfig.readOnly)return;i.model.pushStackElement();const s=Array.from(i.getCursorStates()),o=s.pop();o&&(s.unshift(o),i.setCursorStates(t.source,3,s),i.revealPrimaryCursor(t.source,!0),Ms(s,i.getCursorStates()))}};de(Uc.ID,Uc,4);de(zc.ID,zc,1);P(nB);P(sB);P(oB);P(lB);P(dB);P(cB);P(hB);P(uB);P(gB);P(rB);P(aB);P(fB);P(mB);var vo={Visible:new ae("parameterHintsVisible",!1),MultipleSignatures:new ae("parameterHintsMultipleSignatures",!1)};async function $L(n,e,t,i,s){const o=n.ordered(e);for(const r of o)try{const a=await r.provideSignatureHelp(e,t,s,i);if(a)return a}catch(a){it(a)}}Me.registerCommand("_executeSignatureHelpProvider",async(n,...e)=>{const[t,i,s]=e;Ie(ke.isUri(t)),Ie(B.isIPosition(i)),Ie(typeof s=="string"||!s);const o=n.get(X),r=await n.get(li).createModelReference(t);try{const a=await $L(o.signatureHelpProvider,r.object.textEditorModel,B.lift(i),{triggerKind:ps.Invoke,isRetrigger:!1,triggerCharacter:s},he.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var is;(function(n){n.Default={type:0};class e{constructor(s,o){this.request=s,this.previouslyActiveHints=o,this.type=2}}n.Pending=e;class t{constructor(s){this.hints=s,this.type=1}}n.Active=t})(is||(is={}));var _B=class KL extends M{static{this.DEFAULT_DELAY=120}constructor(e,t,i=KL.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new ee),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=is.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new We),this.triggerChars=new ac,this.retriggerChars=new ac,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=this._register(new bs(i)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(s=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(s=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(s=>this.onCursorChange(s))),this._register(this.editor.onDidChangeModelContent(s=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(s=>this.onDidType(s))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=is.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const s=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(s),t).catch(Le)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,s=this.editor.getOption(98).cycle;if((e<2||i)&&!s){this.cancel();return}this.updateActiveSignature(i&&s?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,s=this.editor.getOption(98).cycle;if((e<2||i)&&!s){this.cancel();return}this.updateActiveSignature(i&&s?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new is.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const s=this._pendingTriggers.reduce(vB);this._pendingTriggers=[];const o={triggerKind:s.triggerKind,triggerCharacter:s.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new is.Pending(mt(l=>$L(this.providers,r,a,o,l)),i);try{const l=await this.state.request;return e!==this.triggerId?(l?.dispose(),!1):!l||!l.value.signatures||l.value.signatures.length===0?(l?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new is.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=is.Default),Le(l),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const s=i.charCodeAt(0);this.triggerChars.add(s),this.retriggerChars.add(s)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:ps.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:ps.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:ps.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};function vB(n,e){switch(e.triggerKind){case ps.Invoke:return e;case ps.ContentChange:return n;case ps.TriggerCharacter:default:return e}}var bB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},JC=function(n,e){return function(t,i){e(t,i,n)}},Of,Jt=H,CB=Ye("parameter-hints-next",V.chevronDown,m(1378,"Icon for show next parameter hint.")),SB=Ye("parameter-hints-previous",V.chevronUp,m(1379,"Icon for show previous parameter hint.")),Af=class extends M{static{Of=this}static{this.ID="editor.widget.parameterHintsWidget"}constructor(e,t,i,s){super(),this.editor=e,this.model=t,this.markdownRendererService=s,this.renderDisposeables=this._register(new O),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.keyVisible=vo.Visible.bindTo(i),this.keyMultipleSignatures=vo.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=Jt(".editor-widget.parameter-hints-widget"),t=U(e,Jt(".phwrapper"));t.tabIndex=-1;const i=U(t,Jt(".controls")),s=U(i,Jt(".button"+ce.asCSSSelector(SB))),o=U(i,Jt(".overloads")),r=U(i,Jt(".button"+ce.asCSSSelector(CB)));this._register(Q(s,"click",u=>{bt.stop(u),this.previous()})),this._register(Q(r,"click",u=>{bt.stop(u),this.next()}));const a=Jt(".body"),l=new um(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const d=U(a,Jt(".signature")),c=U(a,Jt(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:d,overloads:o,docs:c,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(u=>{this.visible&&this.editor.layoutContentWidget(this)}));const h=()=>{if(!this.domNodes)return;const u=this.editor.getOption(59),g=this.domNodes.element;g.style.fontSize=`${u.fontSize}px`,g.style.lineHeight=`${u.lineHeight/u.fontSize}`,g.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",u.fontFamily),g.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Rm.fontFamily)};h(),this._register(Ge.chain(this.editor.onDidChangeConfiguration.bind(this.editor),u=>u.filter(g=>g.hasChanged(59)))(h)),this._register(this.editor.onDidLayoutChange(u=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const s=U(this.domNodes.signature,Jt(".code")),o=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(o)this.renderParameters(s,i,r);else{const d=U(s,Jt("span"));d.textContent=i.label}const a=i.parameters[r];if(a?.documentation){const d=Jt("span.documentation");if(typeof a.documentation=="string")d.textContent=a.documentation;else{const c=this.renderMarkdownDocs(a.documentation);d.appendChild(c.element)}U(this.domNodes.docs,Jt("p",{},d))}if(i.documentation!==void 0)if(typeof i.documentation=="string")U(this.domNodes.docs,Jt("p",{},i.documentation));else{const d=this.renderMarkdownDocs(i.documentation);U(this.domNodes.docs,d.element)}const l=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",l),this.domNodes.docs.classList.toggle("empty",!l),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let d="";const c=i.parameters[r];Array.isArray(c.label)?d=i.label.substring(c.label[0],c.label[1]):d=c.label,c.documentation&&(d+=typeof c.documentation=="string"?`, ${c.documentation}`:`, ${c.documentation.value}`),i.documentation&&(d+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==d&&(gi(m(1380,"{0}, hint",d)),this.announcedLabel=d)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=this.renderDisposeables.add(this.markdownRendererService.render(e,{context:this.editor,asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Go(t.documentation).length>0||t&&typeof t.documentation=="object"&&Go(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Go(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Go(e.documentation.value).length>0)}renderParameters(e,t,i){const[s,o]=this.getParameterLabelOffsets(t,i),r=document.createElement("span");r.textContent=t.label.substring(0,s);const a=document.createElement("span");a.textContent=t.label.substring(s,o),a.className="parameter active";const l=document.createElement("span");l.textContent=t.label.substring(o),U(e,r,a,l)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const s=new RegExp(`(\\W|^)${Va(i.label)}(?=\\W|$)`,"g");s.test(e.label);const o=s.lastIndex-i.label.length;return o>=0?[o,s.lastIndex]:[0,0]}else return[0,0]}else 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 Of.ID}updateMaxHeight(){if(!this.domNodes)return;const e=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=e;const t=this.domNodes.element.getElementsByClassName("phwrapper");t.length&&(t[0].style.maxHeight=e)}};Af=Of=bB([JC(2,Ce),JC(3,Es)],Af);W("editorHoverWidget.highlightForeground",hw,m(1381,"Foreground color of the active item in the parameter hint."));var wB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},QC=function(n,e){return function(t,i){e(t,i,n)}},Ff,Er=class extends M{static{Ff=this}static{this.ID="editor.controller.parameterHints"}static get(e){return e.getContribution(Ff.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new _B(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(s=>{s?(this.widget.value.show(),this.widget.value.render(s)):this.widget.rawValue?.hide()})),this.widget=new $m(()=>this._register(t.createInstance(Af,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(e){this.model.trigger(e,0)}};Er=Ff=wB([QC(1,ne),QC(2,X)],Er);var yB=class extends A{constructor(){super({id:"editor.action.triggerParameterHints",label:L(1377,"Trigger Parameter Hints"),precondition:S.hasSignatureHelpProvider,kbOpts:{kbExpr:S.editorTextFocus,primary:3082,weight:100}})}run(n,e){Er.get(e)?.trigger({triggerKind:ps.Invoke})}};de(Er.ID,Er,2);P(yB);var j_=175,q_=Ft.bindToContribution(Er.get);Z(new q_({id:"closeParameterHints",precondition:vo.Visible,handler:n=>n.cancel(),kbOpts:{weight:j_,kbExpr:S.focus,primary:9,secondary:[1033]}}));Z(new q_({id:"showPrevParameterHint",precondition:k.and(vo.Visible,vo.MultipleSignatures),handler:n=>n.previous(),kbOpts:{weight:j_,kbExpr:S.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));Z(new q_({id:"showNextParameterHint",precondition:k.and(vo.Visible,vo.MultipleSignatures),handler:n=>n.next(),kbOpts:{weight:j_,kbExpr:S.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var eS=class extends M{static{this.ID="editor.contrib.placeholderText"}constructor(n){super(),this._editor=n,this._editorObs=je(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=nn({owner:this,equalsFn:n0},e=>{const t=this._placeholderText.read(e);if(t&&this._editorObs.valueIsEmpty.read(e))return{placeholder:t}}),this._shouldViewBeAlive=xB(this,e=>this._state.read(e)?.placeholder!==void 0),this._view=R(e=>{if(!this._shouldViewBeAlive.read(e))return;const t=Fa("div.editorPlaceholder");e.store.add(ge(i=>{const s=this._state.read(i),o=s?.placeholder!==void 0;t.root.style.display=o?"block":"none",t.root.innerText=s?.placeholder??""})),e.store.add(ge(i=>{const s=this._editorObs.layoutInfo.read(i);t.root.style.left=`${s.contentLeft}px`,t.root.style.width=s.contentWidth-s.verticalScrollbarWidth+"px",t.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),e.store.add(ge(i=>{t.root.style.fontFamily=this._editorObs.getOption(58).read(i),t.root.style.fontSize=this._editorObs.getOption(61).read(i)+"px",t.root.style.lineHeight=this._editorObs.getOption(75).read(i)+"px"})),e.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:ye(0),position:ye(null),domNode:t.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};function xB(n,e){return ks(n,(t,i)=>i===!0?!0:e(t))}var IB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},LB=function(n,e){return function(t,i){e(t,i,n)}},DB=class{constructor(n){this.instantiationService=n}init(...n){}};function EB(n){return n()}var tS=class extends DB{constructor(e,t){super(t),this.init(e)}};tS=IB([LB(1,ne)],tS);de(eS.ID,EB(()=>eS),0);W("editor.placeholder.foreground",y0,m(1400,"Foreground color of the placeholder text in the editor."));var RB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},iS=function(n,e){return function(t,i){e(t,i,n)}},jc=class extends M{static{this.ID="editor.sectionHeaderDetector"}constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(s=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(s=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(s=>{const o=this.editor.getModel()?.getLanguageId();o&&s.affects(o)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(s=>{this.options&&!s.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(s=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(s=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new at(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,s=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!s?.markers))return{foldingRules:s,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(i=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(i)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(o=>{if(!o.shouldBeInComments)return!0;const r=t.validateRange(o.range),a=t.tokenization.getLineTokens(r.startLineNumber),l=a.findTokenIndexAtOffset(r.startColumn-1),d=a.getStandardTokenType(l),c=t.getLanguageIdAtPosition(r.startLineNumber,r.startColumn);return a.getLanguageId(l)===c&&d===1}));const i=Object.values(this.currentOccurrences).map(o=>o.decorationId),s=e.map(o=>TB(o));this.editor.changeDecorations(o=>{const r=o.deltaDecorations(i,s);this.currentOccurrences={};for(let a=0,l=r.length;a<l;a++){const d={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[d.decorationId]=d}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}};jc=RB([iS(1,ct),iS(2,Vn)],jc);function TB(n){return{range:n.range,options:oe.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:n.hasSeparatorLine?2:1,sectionHeaderText:n.text}})}}de(jc.ID,jc,1);function PB(n){for(let e=0,t=n.length;e<t;e+=4){const i=n[e+0],s=n[e+1],o=n[e+2],r=n[e+3];n[e+0]=r,n[e+1]=o,n[e+2]=s,n[e+3]=i}}function kB(n){const e=new Uint8Array(n.buffer,n.byteOffset,n.length*4);return aE()||PB(e),vd.wrap(e)}function GL(n){const e=new Uint32Array(NB(n));let t=0;if(e[t++]=n.id,n.type==="full")e[t++]=1,e[t++]=n.data.length,e.set(n.data,t),t+=n.data.length;else{e[t++]=2,e[t++]=n.deltas.length;for(const i of n.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return kB(e)}function NB(n){let e=0;if(e+=2,n.type==="full")e+=1+n.data.length;else{e+=1,e+=3*n.deltas.length;for(const t of n.deltas)t.data&&(e+=t.data.length)}return e}function Fh(n){return n&&!!n.data}function ZL(n){return n&&Array.isArray(n.edits)}var MB=class{constructor(n,e,t){this.provider=n,this.tokens=e,this.error=t}};function XL(n,e){return n.has(e)}function OB(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:[]}async function YL(n,e,t,i,s){const o=OB(n,e),r=await Promise.all(o.map(async a=>{let l,d=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,s)}catch(c){d=c,l=null}return(!l||!Fh(l)&&!ZL(l))&&(l=null),new MB(a,l,d)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function AB(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:null}var FB=class{constructor(n,e){this.provider=n,this.tokens=e}};function HB(n,e){return n.has(e)}function JL(n,e){const t=n.orderedGroups(e);return t.length>0?t[0]:[]}async function $_(n,e,t,i){const s=JL(n,e),o=await Promise.all(s.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){it(l),a=null}return(!a||!Fh(a))&&(a=null),new FB(r,a)}));for(const r of o)if(r.tokens)return r;return o.length>0?o[0]:null}Me.registerCommand("_provideDocumentSemanticTokensLegend",async(n,...e)=>{const[t]=e;Ie(t instanceof ke);const i=n.get(Yt).getModel(t);if(!i)return;const{documentSemanticTokensProvider:s}=n.get(X),o=AB(s,i);return o?o[0].getLegend():n.get(ht).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)});Me.registerCommand("_provideDocumentSemanticTokens",async(n,...e)=>{const[t]=e;Ie(t instanceof ke);const i=n.get(Yt).getModel(t);if(!i)return;const{documentSemanticTokensProvider:s}=n.get(X);if(!XL(s,i))return n.get(ht).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const o=await YL(s,i,null,null,he.None);if(!o)return;const{provider:r,tokens:a}=o;if(!a||!Fh(a))return;const l=GL({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l});Me.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(n,...e)=>{const[t,i]=e;Ie(t instanceof ke);const s=n.get(Yt).getModel(t);if(!s)return;const{documentRangeSemanticTokensProvider:o}=n.get(X),r=JL(o,s);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!x.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await $_(o,s,x.lift(i),he.None);if(a)return a.provider.getLegend()});Me.registerCommand("_provideDocumentRangeSemanticTokens",async(n,...e)=>{const[t,i]=e;Ie(t instanceof ke),Ie(x.isIRange(i));const s=n.get(Yt).getModel(t);if(!s)return;const{documentRangeSemanticTokensProvider:o}=n.get(X),r=await $_(o,s,x.lift(i),he.None);if(!(!r||!r.tokens))return GL({id:0,type:"full",data:r.tokens.data})});var WB="editor.semanticHighlighting";function Kd(n,e,t){const i=t.getValue(WB,{overrideIdentifier:n.getLanguageId(),resource:n.uri})?.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var QL=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},sn=function(n,e){return function(t,i){e(t,i,n)}},ts,Hf=class extends M{constructor(e,t,i,s,o,r){super(),this._watchers=new Nn,this._providerChangeListeners=this._register(new O);const a=r.documentSemanticTokensProvider,l=u=>{this._watchers.get(u.uri)?.dispose(),this._watchers.set(u.uri,new Wf(u,e,i,o,r))},d=(u,g)=>{g.dispose(),this._watchers.delete(u.uri)},c=()=>{for(const u of t.getModels()){const g=this._watchers.get(u.uri);Kd(u,i,s)?g||l(u):g&&d(u,g)}},h=()=>{this._providerChangeListeners.clear();for(const u of a.allNoModel())typeof u.onDidChange=="function"&&this._providerChangeListeners.add(u.onDidChange(()=>{for(const g of this._watchers.values())g.handleProviderDidChange(u)}))};t.getModels().forEach(u=>{Kd(u,i,s)&&l(u)}),this._register(t.onModelAdded(u=>{Kd(u,i,s)&&l(u)})),this._register(t.onModelRemoved(u=>{const g=this._watchers.get(u.uri);g&&d(u,g)})),this._register(s.onDidChangeConfiguration(u=>{u.affectsConfiguration("editor.semanticHighlighting")&&c()})),this._register(i.onDidColorThemeChange(c)),h(),this._register(a.onDidChange(()=>{h();for(const u of this._watchers.values())u.handleRegistryChange()}))}dispose(){Pt(this._watchers.values()),this._watchers.clear(),super.dispose()}};Hf=QL([sn(0,Fm),sn(1,Yt),sn(2,Dt),sn(3,Ee),sn(4,ki),sn(5,X)],Hf);var Wf=class extends M{static{ts=this}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}constructor(e,t,i,s,o){super(),this._semanticTokensStylingService=t,this._relevantProviders=new Set,this._isDisposed=!1,this._model=e,this._provider=o.documentSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentSemanticTokens",{min:ts.REQUEST_MIN_DELAY,max:ts.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new at(()=>this._fetchDocumentSemanticTokensNow(),ts.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._providersChangedDuringRequest=!1,this._updateRelevantProviders(),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._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(0)})),this._register(i.onDidColorThemeChange(r=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}handleRegistryChange(){this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))}handleProviderDidChange(e){if(this._relevantProviders.has(e)){if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}}_updateRelevantProviders(){this._relevantProviders=new Set(this._provider.all(this._model))}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!XL(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new ot,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,s=YL(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const o=[],r=this._model.onDidChangeContent(l=>{o.push(l)}),a=new pi(!1);s.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,o);else{const{provider:d,tokens:c}=l,h=this._semanticTokensStylingService.getStyling(d);this._setDocumentSemanticTokens(d,c||null,h,o)}},l=>{l&&(Un(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||Le(l),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(o.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,s,o){o=Math.min(o,i.length-s,e.length-t);for(let r=0;r<o;r++)i[s+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,s){const o=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){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(ZL(t)){const a=t.resultId,l=d=>{e.releaseDocumentSemanticTokens(a),this._model.tokenization.setSemanticTokens(null,!0),d&&this._fetchDocumentSemanticTokens.schedule(0)};if(!o){l(!1);return}if(t.edits.length===0)t={resultId:t.resultId,data:o.data};else{let d=0;for(const f of t.edits)d+=(f.data?f.data.length:0)-f.deleteCount;const c=o.data,h=c.length+d;if(h<0){i.warnInvalidEditDeleteCount(o.resultId,a,c.length,d),l(!0);return}const u=new Uint32Array(h);let g=c.length,p=u.length;for(let f=t.edits.length-1;f>=0;f--){const _=t.edits[f];if(_.start>c.length){i.warnInvalidEditStart(o.resultId,a,f,_.start,c.length),l(!0);return}const v=g-(_.start+_.deleteCount);v>0&&(ts._copy(c,g-v,u,p-v,v),p-=v),_.data&&(ts._copy(_.data,0,u,p-_.data.length,_.data.length),p-=_.data.length),g=_.start}g>0&&ts._copy(c,0,u,0,g),t={resultId:t.resultId,data:u}}}if(Fh(t)){this._currentDocumentResponse=new VB(e,t.resultId,t.data);const a=Pw(t,i,this._model.getLanguageId());if(s.length>0)for(const l of s)for(const d of a)for(const c of l.changes)d.applyEdit(c.range,c.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}};Wf=ts=QL([sn(1,Fm),sn(2,Dt),sn(3,ki),sn(4,X)],Wf);var VB=class{constructor(n,e,t){this.provider=n,this.resultId=e,this.data=t}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};Mr(Hf);var BB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ia=function(n,e){return function(t,i){e(t,i,n)}},qc=class extends M{static{this.ID="editor.contrib.viewportSemanticTokens"}constructor(e,t,i,s,o,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=s,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=o.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new at(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[],this._rangeProvidersChangeListeners=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},l=()=>{if(this._cleanupProviderListeners(),this._editor.hasModel()){const d=this._editor.getModel();for(const c of this._provider.all(d)){const h=c.onDidChange?.(()=>{this._cancelAll(),a()});h&&this._rangeProvidersChangeListeners.push(h)}}};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{l(),this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelLanguage(()=>{l(),this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(d=>{this._cancelAll(),a()})),l(),this._register(this._provider.onDidChange(()=>{l(),this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(d=>{d.affectsConfiguration("editor.semanticHighlighting")&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){Pt(this._rangeProvidersChangeListeners),this._rangeProvidersChangeListeners=[]}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!Kd(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!HB(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),s=mt(r=>Promise.resolve($_(this._provider,e,t,r))),o=new pi(!1);return s.then(r=>{if(this._debounceInformation.update(e,o.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=r,d=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,Pw(l,d,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(s),()=>this._removeOutstandingRequest(s)),s}};qc=BB([ia(1,Fm),ia(2,Dt),ia(3,Ee),ia(4,ki),ia(5,X)],qc);de(qc.ID,qc,1);var UB=class{constructor(n=!0){this.selectSubwords=n}provideSelectionRanges(n,e){const t=[];for(const i of e){const s=[];t.push(s),this.selectSubwords&&this._addInWordRanges(s,n,i),this._addWordRanges(s,n,i),this._addWhitespaceLine(s,n,i),s.push({range:n.getFullModelRange()})}return t}_addInWordRanges(n,e,t){const i=e.getWordAtPosition(t);if(!i)return;const{word:s,startColumn:o}=i,r=t.column-o;let a=r,l=r,d=0;for(;a>=0;a--){const c=s.charCodeAt(a);if(a!==r&&(c===95||c===45))break;if(Av(c)&&Dv(d))break;d=c}for(a+=1;l<s.length;l++){const c=s.charCodeAt(l);if(Dv(c)&&Av(d))break;if(c===95||c===45)break;d=c}a<l&&n.push({range:new x(t.lineNumber,o+a,t.lineNumber,o+l)})}_addWordRanges(n,e,t){const i=e.getWordAtPosition(t);i&&n.push({range:new x(t.lineNumber,i.startColumn,t.lineNumber,i.endColumn)})}_addWhitespaceLine(n,e,t){e.getLineLength(t.lineNumber)>0&&e.getLineFirstNonWhitespaceColumn(t.lineNumber)===0&&e.getLineLastNonWhitespaceColumn(t.lineNumber)===0&&n.push({range:new x(t.lineNumber,1,t.lineNumber,e.getLineMaxColumn(t.lineNumber))})}},zB=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},jB=function(n,e){return function(t,i){e(t,i,n)}},Vf,qB=class eD{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new eD(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}},cl=class{static{Vf=this}static{this.ID="editor.contrib.smartSelectController"}static get(e){return e.getContribution(Vf.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){this._selectionListener?.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await iD(this._languageFeaturesService.selectionRangeProvider,i,t.map(o=>o.getPosition()),this._editor.getOption(129),he.None).then(o=>{if(!(!Gt(o)||o.length!==t.length)&&!(!this._editor.hasModel()||!$i(this._editor.getSelections(),t,(r,a)=>r.equalsSelection(a)))){for(let r=0;r<o.length;r++)o[r]=o[r].filter(a=>a.containsPosition(t[r].getStartPosition())&&a.containsPosition(t[r].getEndPosition())),o[r].unshift(t[r]);this._state=o.map(r=>new qB(0,r)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(o=>o.mov(e));const s=this._state.map(o=>ie.fromPositions(o.ranges[o.index].getStartPosition(),o.ranges[o.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(s)}finally{this._ignoreSelection=!1}}};cl=Vf=zB([jB(1,X)],cl);var tD=class extends A{constructor(n,e){super(e),this._forward=n}async run(n,e){const t=cl.get(e);t&&await t.run(this._forward)}},$B=class extends tD{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:L(1469,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"1_basic",title:m(1467,"&&Expand Selection"),order:2}})}};Me.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");var KB=class extends tD{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:L(1470,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:K.MenubarSelectionMenu,group:"1_basic",title:m(1468,"&&Shrink Selection"),order:3}})}};de(cl.ID,cl,4);P($B);P(KB);async function iD(n,e,t,i,s){const o=n.all(e).concat(new UB(i.selectSubwords));o.length===1&&o.unshift(new JI);const r=[],a=[];for(const l of o)r.push(Promise.resolve(l.provideSelectionRanges(e,t,s)).then(d=>{if(Gt(d)&&d.length===t.length)for(let c=0;c<t.length;c++){a[c]||(a[c]=[]);for(const h of d[c])x.isIRange(h.range)&&x.containsPosition(h.range,t[c])&&a[c].push(x.lift(h.range))}},it));return await Promise.all(r),a.map(l=>{if(l.length===0)return[];l.sort((u,g)=>B.isBefore(u.getStartPosition(),g.getStartPosition())?1:B.isBefore(g.getStartPosition(),u.getStartPosition())||B.isBefore(u.getEndPosition(),g.getEndPosition())?-1:B.isBefore(g.getEndPosition(),u.getEndPosition())?1:0);const d=[];let c;for(const u of l)(!c||x.containsRange(u,c)&&!x.equalsRange(u,c))&&(d.push(u),c=u);if(!i.selectLeadingAndTrailingWhitespace)return d;const h=[d[0]];for(let u=1;u<d.length;u++){const g=d[u-1],p=d[u];if(p.startLineNumber!==g.startLineNumber||p.endLineNumber!==g.endLineNumber){const f=new x(g.startLineNumber,e.getLineFirstNonWhitespaceColumn(g.startLineNumber),g.endLineNumber,e.getLineLastNonWhitespaceColumn(g.endLineNumber));f.containsRange(g)&&!f.equalsRange(g)&&p.containsRange(f)&&!p.equalsRange(f)&&h.push(f);const _=new x(g.startLineNumber,1,g.endLineNumber,e.getLineMaxColumn(g.endLineNumber));_.containsRange(g)&&!_.equalsRange(f)&&p.containsRange(_)&&!p.equalsRange(_)&&h.push(_)}h.push(p)}return h})}Me.registerCommand("_executeSelectionRangeProvider",async function(n,...e){const[t,i]=e;Ie(ke.isUri(t)),Ie(L0(i,r=>B.isIPosition(r)));const s=n.get(X).selectionRangeProvider,o=await n.get(li).createModelReference(t);try{return iD(s,o.object.textEditorModel,i.map(B.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},he.None)}finally{o.dispose()}});var Bf=Object.freeze({View:L(1718,"View"),Help:L(1719,"Help"),Test:L(1720,"Test"),File:L(1721,"File"),Preferences:L(1722,"Preferences"),Developer:L(1723,"Developer")}),GB=class extends mi{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...L(1518,"Toggle Editor Sticky Scroll"),mnemonicTitle:m(1514,"&&Toggle Editor Sticky Scroll")},metadata:{description:L(1519,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:Bf.View,toggled:{condition:k.equals("config.editor.stickyScroll.enabled",!0),title:m(1515,"Sticky Scroll"),mnemonicTitle:m(1516,"&&Sticky Scroll")},menu:[{id:K.CommandPalette},{id:K.MenubarAppearanceMenu,group:"4_editor",order:3},{id:K.StickyScrollContext}]})}async runEditorCommand(n,e){const t=n.get(Ee),i=!t.getValue("editor.stickyScroll.enabled"),s=Pi.get(e)?.isFocused();t.updateValue("editor.stickyScroll.enabled",i),s&&e.focus()}},Hh=100,ZB=class extends mi{constructor(){super({id:"editor.action.focusStickyScroll",title:{...L(1520,"Focus Editor Sticky Scroll"),mnemonicTitle:m(1517,"&&Focus Editor Sticky Scroll")},precondition:k.and(k.has("config.editor.stickyScroll.enabled"),S.stickyScrollVisible),menu:[{id:K.CommandPalette}]})}runEditorCommand(n,e){Pi.get(e)?.focus()}},XB=class extends mi{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:L(1521,"Select the next editor sticky scroll line"),precondition:S.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Hh,primary:18}})}runEditorCommand(n,e){Pi.get(e)?.focusNext()}},YB=class extends mi{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:L(1522,"Select the previous sticky scroll line"),precondition:S.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Hh,primary:16}})}runEditorCommand(n,e){Pi.get(e)?.focusPrevious()}},JB=class extends mi{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:L(1523,"Go to the focused sticky scroll line"),precondition:S.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Hh,primary:3}})}runEditorCommand(n,e){Pi.get(e)?.goToFocused()}},QB=class extends mi{constructor(){super({id:"editor.action.selectEditor",title:L(1524,"Select Editor"),precondition:S.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:Hh,primary:9}})}runEditorCommand(n,e){Pi.get(e)?.selectEditor()}};de(Pi.ID,Pi,1);me(GB);me(ZB);me(YB);me(XB);me(JB);me(QB);var nD=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ya=function(n,e){return function(t,i){e(t,i,n)}},e2=class{constructor(n,e,t,i,s,o,r){this.range=n,this.insertText=e,this.filterText=t,this.additionalTextEdits=i,this.command=s,this.gutterMenuLinkAction=o,this.completion=r,this.doNotLog=!0}},Uf=class extends UT{constructor(e,t,i,s,o,r){super(o.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=s,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){const e=[],{items:t}=this.completionModel,i=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),s=gs.slice(t,i),o=gs.slice(t,0,i);let r=5;for(const a of gs.concat(s,o)){if(a.score===Wa.Default)continue;const l=new x(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),d=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new e2(l,d,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a.completion.action,a)),r-->=0&&a.resolve(he.None)}return e}};Uf=nD([ya(5,Mh)],Uf);var zf=class extends M{constructor(e,t,i,s){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=s,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,s){if(i.selectedSuggestionInfo)return;let o;for(const g of this._editorService.listCodeEditors())if(g.getModel()===e){o=g;break}if(!o)return;const r=o.getOption(102);if(tr.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(tr.valueFor(r,l)!=="inline")return;let d=e.getWordAtPosition(t),c;if(d?.word||(c=this._getTriggerCharacterInfo(e,t)),!d?.word&&!c||(d||(d=e.getWordUntilPosition(t)),d.endColumn!==t.column))return;let h;const u=e.getValueInRange(new x(t.lineNumber,1,t.lineNumber,t.column));if(!c&&this._lastResult?.canBeReused(e,t.lineNumber,d)){const g=new mC(u,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=g,this._lastResult.acquire(),h=this._lastResult}else{const g=await T_(this._languageFeatureService.completionProvider,e,t,new R_(void 0,Mc.createSuggestFilter(o).itemKind,c?.providers),c&&{triggerKind:1,triggerCharacter:c.ch},s);let p;g.needsClipboard&&(p=await this._clipboardService.readText());const f=new YI(g.items,t.column,new mC(u,0),QI.None,o.getOption(134),o.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},p);h=new Uf(e,t.lineNumber,d,f,g,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(he.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){const i=e.getValueInRange(x.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),s=new Set;for(const o of this._languageFeatureService.completionProvider.all(e))o.triggerCharacters?.includes(i)&&s.add(o);if(s.size!==0)return{providers:s,ch:i}}};zf=nD([ya(0,X),ya(1,oi),ya(2,Mh),ya(3,Ze)],zf);Mr(zf);var t2=class extends A{constructor(){super({id:"editor.action.forceRetokenize",label:L(1606,"Developer: Force Retokenize"),precondition:void 0})}run(n,e){if(!e.hasModel())return;const t=e.getModel();t.tokenization.resetTokenization();const i=new pi;t.tokenization.forceTokenization(t.getLineCount()),i.stop(),console.log(`tokenization took ${i.elapsed()}`)}};P(t2);var i2=class sD extends lt{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:sD.ID,title:L(1604,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:L(1605,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const e=!Lv.getTabFocusMode();Lv.setTabFocusMode(e),e?gi(m(1602,"Pressing Tab will now move focus to the next focusable element")):gi(m(1603,"Pressing Tab will now insert the tab character"))}};me(i2);var oD=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},jf=function(n,e){return function(t,i){e(t,i,n)}},n2=26,qf=class extends M{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance($f))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,n2)}};qf=oD([jf(1,ne)],qf);var $f=class extends M{constructor(e,t){super(),this.instantiationService=e,this.markdownRendererService=t,this.element=H("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=H("span");return t.innerText=e,t}return this.markdownRendererService.render(e).element}clear(){ni(this.element)}show(e){ni(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=U(this.element,H("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(H(`div${ce.asCSSSelector(e.icon)}`));const s=U(this.element,H("div.message-container"));if(s.setAttribute("aria-hidden","true"),s.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=U(this.element,H("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(hc,this.messageActionsContainer,{...r,tabIndex:-1},{}));const o=U(this.element,H("div.action-container"));this.actionBar=this._register(new _s(o)),this.actionBar.push(this._register(new hr("banner.close",m(1607,"Close Banner"),ce.asClassName(sw),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};$f=oD([jf(0,ne),jf(1,Es)],$f);var K_=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Na=function(n,e){return function(t,i){e(t,i,n)}},s2=Ye("extensions-warning-message",V.warning,m(1608,"Icon shown with a warning message in the extensions editor.")),hl=class extends M{static{this.ID="editor.contrib.unicodeHighlighter"}constructor(e,t,i,s){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=o=>{if(o&&o.hasMore){if(this._bannerClosed)return;const r=Math.max(o.ambiguousCharacterCount,o.nonBasicAsciiCharacterCount,o.invisibleCharacterCount);let a;if(o.nonBasicAsciiCharacterCount>=r)a={message:m(1609,"This document contains many non-basic ASCII unicode characters"),command:new Z_};else if(o.ambiguousCharacterCount>=r)a={message:m(1610,"This document contains many ambiguous unicode characters"),command:new Al};else if(o.invisibleCharacterCount>=r)a={message:m(1611,"This document contains many invisible unicode characters"),command:new G_};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:s2,actions:[{label:a.command.shortLabel,href:`command:${a.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(s.createInstance(qf,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(i.onDidChangeTrust(o=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(o=>{o.hasChanged(142)&&(this._options=e.getOption(142),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 e=o2(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?ZS.NumberFormat().value.resolvedOptions().locale:i==="_vscode"?tE:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Kf(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new r2(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};hl=K_([Na(1,Vn),Na(2,VT),Na(3,ne)],hl);function o2(n,e){return{nonBasicASCII:e.nonBasicASCII==="inUntrustedWorkspace"?!n:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments==="inUntrustedWorkspace"?!n:e.includeComments,includeStrings:e.includeStrings==="inUntrustedWorkspace"?!n:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}var Kf=class extends M{constructor(e,t,i,s){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=s,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new at(()=>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()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const s of t.ranges)i.push({range:s,options:lD.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();return zS(t,e)?{reason:aD(t.getValueInRange(e.range),this._options),inComment:MS(t,e),inString:rw(t,e)}:null}};Kf=K_([Na(3,Vn)],Kf);var r2=class extends M{constructor(n,e,t){super(),this._editor=n,this._options=e,this._updateState=t,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new at(()=>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()){this._decorations.clear();return}const n=this._editor.getVisibleRanges(),e=[],t={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const i of n){const s=Xw.computeUnicodeHighlights(this._model,this._options,i);for(const o of s.ranges)t.ranges.push(o);t.ambiguousCharacterCount+=t.ambiguousCharacterCount,t.invisibleCharacterCount+=t.invisibleCharacterCount,t.nonBasicAsciiCharacterCount+=t.nonBasicAsciiCharacterCount,t.hasMore=t.hasMore||s.hasMore}if(!t.hasMore)for(const i of t.ranges)e.push({range:i,options:lD.instance.getDecorationFromOptions(this._options)});this._updateState(t),this._decorations.set(e)}getDecorationInfo(n){if(!this._decorations.has(n))return null;const e=this._editor.getModel(),t=e.getValueInRange(n.range);return zS(e,n)?{reason:aD(t,this._options),inComment:MS(e,n),inString:rw(e,n)}:null}},rD=m(1612,"Configure Unicode Highlight Options"),Gf=class{constructor(e,t){this._editor=e,this._markdownRendererService=t,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),s=this._editor.getContribution(hl.ID);if(!s)return[];const o=[],r=new Set;let a=300;for(const l of t){const d=s.getDecorationInfo(l);if(!d)continue;const c=i.getValueInRange(l.range).codePointAt(0),h=Fu(c);let u;switch(d.reason.kind){case 0:bw(d.reason.confusableWith)?u=m(1613,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",h,Fu(d.reason.confusableWith.codePointAt(0))):u=m(1614,"The character {0} could be confused with the character {1}, which is more common in source code.",h,Fu(d.reason.confusableWith.codePointAt(0)));break;case 1:u=m(1615,"The character {0} is invisible.",h);break;case 2:u=m(1616,"The character {0} is not a basic ASCII character.",h)}if(r.has(u))continue;r.add(u);const g={codePoint:c,reason:d.reason,inComment:d.inComment,inString:d.inString},p=m(1617,"Adjust settings"),f=NS(gD.ID,g),_=new St("",!0).appendMarkdown(u).appendText(" ").appendLink(f,p,rD);o.push(new Di(this,l.range,[_],!1,a++))}return o}renderHoverParts(e,t){return eN(e,t,this._editor,this._markdownRendererService)}getAccessibleContent(e){return e.contents.map(t=>t.value).join(`
|
|
66
|
+
`)}};Gf=K_([Na(1,Es)],Gf);function Zf(n){return`U+${n.toString(16).padStart(4,"0")}`}function Fu(n){let e=`\`${Zf(n)}\``;return Vw.isInvisibleCharacter(n)||(e+=` "${`${a2(n)}`}"`),e}function a2(n){return n===96?"`` ` ``":"`"+String.fromCodePoint(n)+"`"}function aD(n,e){return Xw.computeUnicodeHighlightReason(n,e)}var lD=class dD{constructor(){this.map=new Map}static{this.instance=new dD}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let s=this.map.get(i);return s||(s=oe.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,s)),s}},l2=class extends A{constructor(){super({id:Al.ID,label:L(1626,"Disable highlighting of characters in comments"),precondition:void 0}),this.shortLabel=m(1618,"Disable Highlight In Comments")}async run(n,e){const t=n.get(Ee);t&&this.runAction(t)}async runAction(n){await n.updateValue(An.includeComments,!1,2)}},d2=class extends A{constructor(){super({id:Al.ID,label:L(1627,"Disable highlighting of characters in strings"),precondition:void 0}),this.shortLabel=m(1619,"Disable Highlight In Strings")}async run(n,e){const t=n.get(Ee);t&&this.runAction(t)}async runAction(n){await n.updateValue(An.includeStrings,!1,2)}},Al=class cD extends lt{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}constructor(){super({id:cD.ID,title:L(1628,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1}),this.shortLabel=m(1620,"Disable Ambiguous Highlight")}async run(e,t){const i=e.get(Ee);i&&this.runAction(i)}async runAction(e){await e.updateValue(An.ambiguousCharacters,!1,2)}},G_=class hD extends lt{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}constructor(){super({id:hD.ID,title:L(1629,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1}),this.shortLabel=m(1621,"Disable Invisible Highlight")}async run(e,t){const i=e.get(Ee);i&&this.runAction(i)}async runAction(e){await e.updateValue(An.invisibleCharacters,!1,2)}},Z_=class uD extends lt{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}constructor(){super({id:uD.ID,title:L(1630,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1}),this.shortLabel=m(1622,"Disable Non ASCII Highlight")}async run(e,t){const i=e.get(Ee);i&&this.runAction(i)}async runAction(e){await e.updateValue(An.nonBasicASCII,!1,2)}},gD=class pD extends lt{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:pD.ID,title:L(1631,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(e,t){const{codePoint:i,reason:s,inString:o,inComment:r}=t,a=String.fromCodePoint(i),l=e.get(Ri),d=e.get(Ee);function c(p){return Vw.isInvisibleCharacter(p)?m(1623,"Exclude {0} (invisible character) from being highlighted",Zf(p)):m(1624,"Exclude {0} from being highlighted",`${Zf(p)} "${a}"`)}const h=[];if(s.kind===0)for(const p of s.notAmbiguousInLocales)h.push({label:m(1625,'Allow unicode characters that are more common in the language "{0}".',p),run:async()=>{h2(d,[p])}});if(h.push({label:c(i),run:()=>c2(d,[i])}),r){const p=new l2;h.push({label:p.label,run:async()=>p.runAction(d)})}else if(o){const p=new d2;h.push({label:p.label,run:async()=>p.runAction(d)})}function u(p){return typeof p.desc.title=="string"?p.desc.title:p.desc.title.value}if(s.kind===0){const p=new Al;h.push({label:u(p),run:async()=>p.runAction(d)})}else if(s.kind===1){const p=new G_;h.push({label:u(p),run:async()=>p.runAction(d)})}else if(s.kind===2){const p=new Z_;h.push({label:u(p),run:async()=>p.runAction(d)})}else u2(s);const g=await l.pick(h,{title:rD});g&&await g.run()}};async function c2(n,e){const t=n.getValue(An.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const s of e)i[String.fromCodePoint(s)]=!0;await n.updateValue(An.allowedCharacters,i,2)}async function h2(n,e){const t=n.inspect(An.allowedLocales).user?.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const s of e)i[s]=!0;await n.updateValue(An.allowedLocales,i,2)}function u2(n){throw new Error(`Unexpected value: ${n}`)}me(Al);me(G_);me(Z_);me(gD);de(hl.ID,hl,1);xo.register(Gf);var g2=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},nS=function(n,e){return function(t,i){e(t,i,n)}},fD="ignoreUnusualLineTerminators";function p2(n,e,t){n.setModelProperty(e.uri,fD,t)}function f2(n,e){return n.getModelProperty(e.uri,fD)}var $c=class extends M{static{this.ID="editor.contrib.unusualLineTerminatorsDetector"}constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(s=>{s.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||f2(this._codeEditorService,e)===!0||this._editor.getOption(104))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let t;try{this._isPresentingDialog=!0,t=await this._dialogService.confirm({title:m(1632,"Unusual Line Terminators"),message:m(1633,"Detected unusual line terminators"),detail:m(1634,"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`.",Ti(e.uri)),primaryButton:m(1635,"&&Remove Unusual Line Terminators"),cancelButton:m(1636,"Ignore")})}finally{this._isPresentingDialog=!1}if(!t.confirmed){p2(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};$c=g2([nS(1,gm),nS(2,Ze)],$c);de($c.ID,$c,1);var m2=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},_2=function(n,e){return function(t,i){e(t,i,n)}},sS=class{constructor(){this.selector={language:"*"}}provideDocumentHighlights(n,e,t){if(n.isDisposed())return;const i=[],s=n.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});return s?n.findMatches(s.word,!0,!1,!0,Bv,!1).map(o=>({range:o.range,kind:Qd.Text})):Promise.resolve(i)}provideMultiDocumentHighlights(n,e,t,i){if(n.isDisposed())return;const s=new Nn,o=n.getWordAtPosition({lineNumber:e.lineNumber,column:e.column});if(!o)return Promise.resolve(s);for(const r of[n,...t]){if(r.isDisposed())continue;const a=r.findMatches(o.word,!0,!1,!0,Bv,!1).map(l=>({range:l.range,kind:Qd.Text}));a&&s.set(r.uri,a)}return s}},Xf=class extends M{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new sS)),this._register(e.multiDocumentHighlightProvider.register("*",new sS))}};Xf=m2([_2(0,X)],Xf);var mD=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},on=function(n,e){return function(t,i){e(t,i,n)}},Ve,Yf,X_=new ae("hasWordHighlights",!1);function _D(n,e,t,i){const s=n.ordered(e);return Hm(s.map(o=>()=>Promise.resolve(o.provideDocumentHighlights(e,t,i)).then(void 0,it)),o=>o!=null).then(o=>{if(o){const r=new Nn;return r.set(e.uri,o),r}return new Nn})}function v2(n,e,t,i,s){const o=n.ordered(e);return Hm(o.map(r=>()=>{const a=s.filter(l=>VE(l)).filter(l=>VR(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(e,t,a,i)).then(void 0,it)}),r=>r!=null)}var vD=class{constructor(n,e,t){this._model=n,this._selection=e,this._wordSeparators=t,this._wordRange=this._getCurrentWordRange(n,e),this._result=null}get result(){return this._result||(this._result=mt(n=>this._compute(this._model,this._selection,this._wordSeparators,n))),this._result}_getCurrentWordRange(n,e){const t=n.getWordAtPosition(e.getPosition());return t?new x(e.startLineNumber,t.startColumn,e.startLineNumber,t.endColumn):null}cancel(){this.result.cancel()}},b2=class extends vD{constructor(n,e,t,i){super(n,e,t),this._providers=i}_compute(n,e,t,i){return _D(this._providers,n,e.getPosition(),i).then(s=>s||new Nn)}},C2=class extends vD{constructor(n,e,t,i,s){super(n,e,t),this._providers=i,this._otherModels=s}_compute(n,e,t,i){return v2(this._providers,n,e.getPosition(),i,this._otherModels).then(s=>s||new Nn)}};function S2(n,e,t,i){return new b2(e,t,i,n)}function w2(n,e,t,i,s){return new C2(e,t,i,n,s)}jt("_executeDocumentHighlights",async(n,e,t)=>(await _D(n.get(X).documentHighlightProvider,e,t,he.None))?.get(e.uri));var Jf=class{static{Ve=this}static{this.storedDecorationIDs=new Nn}static{this.query=null}constructor(e,t,i,s,o,r,a,l){this.toUnhook=new O,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Nn,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,this.runDelayer=this.toUnhook.add(new bs(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=r,this.textModelService=o,this.configurationService=a,this.logService=l,this._hasWordHighlights=X_.bindTo(s),this._ignorePositionChangeEvent=!1,this.occurrencesHighlightEnablement=this.editor.getOption(90),this.occurrencesHighlightDelay=this.configurationService.getValue("editor.occurrencesHighlightDelay"),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(d=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(d)}).catch(Le)})),this.toUnhook.add(e.onDidFocusEditorText(d=>{this.occurrencesHighlightEnablement!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}).catch(Le))})),this.toUnhook.add(e.onDidChangeModelContent(d=>{U0(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(d=>{!d.newModelUrl&&d.oldModelUrl?this._stopSingular():Ve.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(d=>{const c=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==c)switch(this.occurrencesHighlightEnablement=c,c){case"off":this._stopAll();break;case"singleFile":this._stopAll(Ve.query?.modelInfo?.modelURI);break;case"multiFile":Ve.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",c)}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(d=>{if(d.affectsConfiguration("editor.occurrencesHighlightDelay")){const c=a.getValue("editor.occurrencesHighlightDelay");this.occurrencesHighlightDelay!==c&&(this.occurrencesHighlightDelay=c)}})),this.toUnhook.add(e.onDidBlurEditorWidget(()=>{const d=this.codeEditorService.getFocusedCodeEditor();d?d.getModel()?.uri.scheme===Ct.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Ct.vscodeNotebookCell&&this._stopAll():this._stopAll()})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,Ve.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(e){this.occurrencesHighlightEnablement!=="off"&&(this.runDelayer.cancel(),this.runDelayer.trigger(()=>{this._run(!1,e)}).catch(Le))}stop(){this.occurrencesHighlightEnablement!=="off"&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(x.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),t=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,i=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(i.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(i);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(i.startLineNumber);gi(`${o}, ${t+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),t=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,i=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(i.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(i);const s=this._getWord();if(s){const o=this.editor.getModel().getLineContent(i.startLineNumber);gi(`${o}, ${t+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=Ve.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),Ve.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const s of t){if(!s.hasModel()||vs(s.getModel().uri,e))continue;const o=Ve.storedDecorationIDs.get(s.getModel().uri);if(!o)continue;s.removeDecorations(o),i.push(s.getModel().uri);const r=Ls.get(s);r?.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(const s of i)Ve.storedDecorationIDs.delete(s)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Ct.vscodeNotebookCell&&Ve.query?.modelInfo?.modelURI.scheme!==Ct.vscodeNotebookCell?(Ve.query=null,this._run()):Ve.query?.modelInfo&&(Ve.query.modelInfo=null)),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){if(this.occurrencesHighlightEnablement==="off"){this._stopAll();return}if(e.source!=="api"&&e.reason!==3){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Ct.vscodeNotebookCell){const s=[],o=this.codeEditorService.listCodeEditors();for(const r of o){const a=r.getModel();a&&a!==e&&a.uri.scheme===Ct.vscodeNotebookCell&&s.push(a)}return s}const t=[],i=this.codeEditorService.listCodeEditors();for(const s of i){if(!Kw(s))continue;const o=s.getModel();o&&e===o.modified&&t.push(o.modified)}if(t.length)return t;if(this.occurrencesHighlightEnablement==="singleFile")return[];for(const s of i){const o=s.getModel();o&&o!==e&&t.push(o)}return t}async _run(e,t){if(this.editor.hasTextFocus()){const i=this.editor.getSelection();if(!i||i.startLineNumber!==i.endLineNumber){Ve.query=null,this._stopAll();return}const s=i.startColumn,o=i.endColumn,r=this._getWord();if(!r||r.startColumn>s||r.endColumn<o){Ve.query=null,this._stopAll();return}Ve.query={modelInfo:{modelURI:this.model.uri,selection:i}}}else if(!Ve.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),vs(this.editor.getModel().uri,Ve.query.modelInfo?.modelURI)){if(!e){const r=this.decorations.getRanges();for(const a of r)if(a.containsPosition(this.editor.getPosition()))return}this._stopAll(e?this.model.uri:void 0);const i=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel());if(!Ve.query||!Ve.query.modelInfo)return;const o=await this.textModelService.createModelReference(Ve.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(o.object.textEditorModel,Ve.query.modelInfo.selection,s),this.workerRequest?.result.then(r=>{i===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Le)}catch(r){this.logService.error("Unexpected error during occurrence request. Log: ",r)}finally{o.dispose()}}else if(this.model.uri.scheme===Ct.vscodeNotebookCell){const i=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!Ve.query||!Ve.query.modelInfo)return;const s=await this.textModelService.createModelReference(Ve.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(s.object.textEditorModel,Ve.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(o=>{i===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=o||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Le)}catch(o){this.logService.error("Unexpected error during occurrence request. Log: ",o)}finally{s.dispose()}}}computeWithModel(e,t,i){return i.length?w2(this.multiDocumentProviders,e,t,this.editor.getOption(148),i):S2(this.providers,e,t,this.editor.getOption(148))}_beginRenderDecorations(e){const t=new Date().getTime(),i=this.lastCursorPositionChangeTime+e;t>=i?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},i-t)}renderDecorations(){this.renderDecorationsTimer=void 0;const e=this.codeEditorService.listCodeEditors();for(const t of e){const i=Ls.get(t);if(!i)continue;const s=[],o=t.getModel()?.uri;if(o&&this.workerRequestValue.has(o)){const r=Ve.storedDecorationIDs.get(o),a=this.workerRequestValue.get(o);if(a)for(const d of a)d.range&&s.push({range:d.range,options:Q3(d.kind)});let l=[];t.changeDecorations(d=>{l=d.deltaDecorations(r??[],s)}),Ve.storedDecorationIDs=Ve.storedDecorationIDs.set(o,l),s.length>0&&(i.wordHighlighter?.decorations.set(s),i.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}};Jf=Ve=mD([on(4,li),on(5,Ze),on(6,Ee),on(7,Ot)],Jf);var Ls=class extends M{static{Yf=this}static{this.ID="editor.contrib.wordHighlighter"}static get(e){return e.getContribution(Yf.ID)}constructor(e,t,i,s,o,r,a){super(),this._wordHighlighter=null;const l=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&e.getModel().uri.scheme!==Ct.accessibleView&&(this._wordHighlighter=new Jf(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,o,s,r,a))};this._register(e.onDidChangeModel(d=>{this._wordHighlighter&&(!d.newModelUrl&&d.oldModelUrl?.scheme!==Ct.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),this._wordHighlighter=null),l()})),l()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore(250)}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}};Ls=Yf=mD([on(1,Ce),on(2,X),on(3,Ze),on(4,li),on(5,Ee),on(6,Ot)],Ls);var bD=class extends A{constructor(n,e){super(e),this._isNext=n}run(n,e){const t=Ls.get(e);t&&(this._isNext?t.moveNext():t.moveBack())}},y2=class extends bD{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:L(1646,"Go to Next Symbol Highlight"),precondition:X_,kbOpts:{kbExpr:S.editorTextFocus,primary:65,weight:100}})}},x2=class extends bD{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:L(1647,"Go to Previous Symbol Highlight"),precondition:X_,kbOpts:{kbExpr:S.editorTextFocus,primary:1089,weight:100}})}},I2=class extends A{constructor(){super({id:"editor.action.wordHighlight.trigger",label:L(1648,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:S.editorTextFocus,primary:0,weight:100}})}run(n,e){const t=Ls.get(e);t&&t.restoreViewState(!0)}};de(Ls.ID,Ls,0);P(y2);P(x2);P(I2);Mr(Xf);var Wh=class extends Ft{constructor(n){super(n),this._inSelectionMode=n.inSelectionMode,this._wordNavigationType=n.wordNavigationType}runEditorCommand(n,e,t){if(!e.hasModel())return;const i=bo(e.getOption(148),e.getOption(147)),s=e.getModel(),o=e.getSelections(),r=o.length>1,a=o.map(l=>{const d=new B(l.positionLineNumber,l.positionColumn),c=this._move(i,s,d,this._wordNavigationType,r);return this._moveTo(l,c,this._inSelectionMode)});if(s.pushStackElement(),e._getViewModel().setCursorStates("moveWordCommand",3,a.map(l=>ER.fromModelSelection(l))),a.length===1){const l=new B(a[0].positionLineNumber,a[0].positionColumn);e.revealPosition(l,0)}}_moveTo(n,e,t){return t?new ie(n.selectionStartLineNumber,n.selectionStartColumn,e.lineNumber,e.column):new ie(e.lineNumber,e.column,e.lineNumber,e.column)}},Os=class extends Wh{_move(n,e,t,i,s){return Dl.moveWordLeft(n,e,t,i,s)}},As=class extends Wh{_move(n,e,t,i,s){return Dl.moveWordRight(n,e,t,i)}},L2=class extends Os{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}},D2=class extends Os{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}},E2=class extends Os{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:k.and(S.textInputFocus,k.and(Cl,oh)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},R2=class extends Os{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}},T2=class extends Os{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}},P2=class extends Os{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:k.and(S.textInputFocus,k.and(Cl,oh)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},k2=class extends Os{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(n,e,t,i,s){return super._move(bo(hh.wordSeparators.defaultValue,n.intlSegmenterLocales),e,t,i,s)}},N2=class extends Os{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(n,e,t,i,s){return super._move(bo(hh.wordSeparators.defaultValue,n.intlSegmenterLocales),e,t,i,s)}},M2=class extends As{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}},O2=class extends As{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:k.and(S.textInputFocus,k.and(Cl,oh)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},A2=class extends As{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}},F2=class extends As{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}},H2=class extends As{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:k.and(S.textInputFocus,k.and(Cl,oh)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},W2=class extends As{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}},V2=class extends As{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(n,e,t,i,s){return super._move(bo(hh.wordSeparators.defaultValue,n.intlSegmenterLocales),e,t,i,s)}},B2=class extends As{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(n,e,t,i,s){return super._move(bo(hh.wordSeparators.defaultValue,n.intlSegmenterLocales),e,t,i,s)}},Vh=class extends Ft{constructor(n){super({canTriggerInlineEdits:!0,...n}),this._whitespaceHeuristics=n.whitespaceHeuristics,this._wordNavigationType=n.wordNavigationType}runEditorCommand(n,e,t){const i=n?.get(ct);if(!e.hasModel()||!i)return;const s=bo(e.getOption(148),e.getOption(147)),o=e.getModel(),r=e.getSelections(),a=e.getOption(10),l=e.getOption(15),d=i.getLanguageConfiguration(o.getLanguageId()).getAutoClosingPairs(),c=e._getViewModel(),h=r.map(u=>{const g=this._delete({wordSeparators:s,model:o,selection:u,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:e.getOption(13),autoClosingBrackets:a,autoClosingQuotes:l,autoClosingPairs:d,autoClosedCharacters:c.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Ll(g,"")});e.pushUndoStop(),e.executeCommands(this.id,h),e.pushUndoStop()}},Y_=class extends Vh{_delete(n,e){const t=Dl.deleteWordLeft(n,e);return t||new x(1,1,1,1)}},J_=class extends Vh{_delete(n,e){const t=Dl.deleteWordRight(n,e);if(t)return t;const i=n.model.getLineCount(),s=n.model.getLineMaxColumn(i);return new x(i,s,i,s)}},U2=class extends Y_{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:S.writable})}},z2=class extends Y_{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:S.writable})}},j2=class extends Y_{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},q2=class extends J_{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:S.writable})}},$2=class extends J_{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:S.writable})}},K2=class extends J_{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},G2=class extends A{constructor(){super({id:"deleteInsideWord",precondition:S.writable,label:L(1650,"Delete Word"),metadata:{description:L(1651,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:m(1649,"Delete only the word and leave surrounding whitespace")}}}}]}})}run(n,e,t){if(!e.hasModel())return;const i=!!(t&&typeof t=="object"&&t.onlyWord),s=bo(e.getOption(148),e.getOption(147)),o=e.getModel(),r=e.getSelections().map(a=>{const l=Dl.deleteInsideWord(s,o,a,i);return new Ll(l,"")});e.pushUndoStop(),e.executeCommands(this.id,r),e.pushUndoStop()}};Z(new L2);Z(new D2);Z(new E2);Z(new R2);Z(new T2);Z(new P2);Z(new M2);Z(new O2);Z(new A2);Z(new F2);Z(new H2);Z(new W2);Z(new k2);Z(new N2);Z(new V2);Z(new B2);Z(new U2);Z(new z2);Z(new j2);Z(new q2);Z(new $2);Z(new K2);P(G2);var Z2=class extends Vh{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(n,e){const t=uh.deleteWordPartLeft(n);return t||new x(1,1,1,1)}},X2=class extends Vh{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:S.writable,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(n,e){const t=uh.deleteWordPartRight(n);if(t)return t;const i=n.model.getLineCount(),s=n.model.getLineMaxColumn(i);return new x(i,s,i,s)}},CD=class extends Wh{_move(n,e,t,i,s){return uh.moveWordPartLeft(n,e,t,s)}},Y2=class extends CD{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};Me.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");var J2=class extends CD{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};Me.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");var SD=class extends Wh{_move(n,e,t,i,s){return uh.moveWordPartRight(n,e,t)}},Q2=class extends SD{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},e5=class extends SD{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:S.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};Z(new Z2);Z(new X2);Z(new Y2);Z(new J2);Z(new Q2);Z(new e5);var oS=class extends M{static{this.ID="editor.contrib.readOnlyMessageController"}constructor(n){super(),this.editor=n,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const n=Zt.get(this.editor);if(n&&this.editor.hasModel()){let e=this.editor.getOptions().get(105);e||(this.editor.isSimpleWidget?e=new St(m(1447,"Cannot edit in read-only input")):e=new St(m(1448,"Cannot edit in read-only editor"))),n.showMessage(e,this.editor.getPosition())}}};de(oS.ID,oS,2);var t5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},rS=function(n,e){return function(t,i){e(t,i,n)}},Qf=class extends M{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Fe(this,void 0);const s=sc("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),o=sc("_textModel.onDidChangeContent",Ge.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(xl(async(r,a)=>{s.read(r),o.read(r);const l=a.add(new J0),d=await this._outlineModelService.getOrCreate(this._textModel,l.token);a.isDisposed||this._currentModel.set(d,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const s=i.asListOfDocumentSymbols().filter(o=>e.contains(o.range.startLineNumber)&&!e.contains(o.range.endLineNumber));return s.sort(Cv(ao(o=>o.range.endLineNumber-o.range.startLineNumber,ro))),s.map(o=>({name:o.name,kind:o.kind,startLineNumber:o.range.startLineNumber}))}getAt(e,t){const i=this._currentModel.read(t);if(!i)return[];const s=i.asListOfDocumentSymbols().filter(o=>new ft(o.range.startLineNumber,o.range.endLineNumber).contains(e));return s.length===0?[]:(s.sort(Cv(ao(o=>o.range.endLineNumber-o.range.startLineNumber,ro))),s.map(o=>({name:o.name,kind:o.kind,startLineNumber:o.range.startLineNumber})))}};Qf=t5([rS(1,X),rS(2,Ml)],Qf);$w.setBreadcrumbsSourceFactory((n,e)=>e.createInstance(Qf,n));var wD=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},dr=function(n,e){return function(t,i){e(t,i,n)}},Kc=class extends M{static{this.ID="editor.contrib.floatingToolbar"}constructor(e,t,i,s){super();const o=this._register(je(e)),r=R(l=>o.model.read(l)?.uri),a=this._register(t.createInstance(em,K.EditorContent,e.contextKeyService,r));this._register(ge(l=>{a.hasActions.read(l)&&l.store.add(o.createOverlayWidget({allowEditorOverflow:!1,domNode:a.element,minContentWidthInPx:ye(0),position:ye({preference:1})}))}))}};Kc=wD([dr(1,ne),dr(2,He),dr(3,Ts)],Kc);var em=class extends M{constructor(e,t,i,s,o,r){super();const a=this._register(r.createMenu(e,t)),l=Bt(this,a.onDidChange,()=>a.getActions()),d=R(c=>{const h=l.read(c),{primary:u}=YS(h,()=>!0);return u.filter(g=>g.id!==Ua.ID)});this.hasActions=R(c=>d.read(c).length>0),this.element=Fa("div.floating-menu-overlay-widget").root,this._register(Te(()=>this.element.remove())),this._register(ge(c=>{const h=d.read(c),u=h.length>0,g=u?h[0].id:void 0,p=h.length===1;if(this.element.classList.toggle("single-button",p),this.element.style.height=p?"28px":"26px",!u)return;const f=s.createInstance(c0,this.element,e,{actionViewItemProvider:(_,v)=>{if(_ instanceof co)return s.createInstance(class extends Dm{render(C){super.render(C),_.id===g&&this.element?.classList.add("primary")}updateLabel(){const C=o.lookupKeybinding(_.id),w=C?C.getLabel():void 0;this.options.label&&this.label&&(this.label.textContent=w?`${this._commandAction.label} (${w})`:this._commandAction.label)}},_,{...v,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:"editor.overlayToolbar",toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});c.store.add(f),c.store.add(ge(_=>{const v=i.read(_);f.context=v}))}))}};em=wD([dr(3,ne),dr(4,He),dr(5,Ts)],em);de(Kc.ID,Kc,1);var aS=class extends M{static{this.ID="editor.contrib.iPadShowKeyboard"}constructor(n){super(),this.editor=n,this.widget=null,Ju&&(this._register(n.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const n=!this.editor.getOption(104);!this.widget&&n?this.widget=new i5(this.editor):this.widget&&!n&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}},i5=class yD extends M{static{this.ID="editor.contrib.ShowKeyboardWidget"}constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(Q(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(Q(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return yD.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};de(aS.ID,aS,3);var n5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},lS=function(n,e){return function(t,i){e(t,i,n)}},tm,ul=class extends M{static{tm=this}static{this.ID="editor.contrib.inspectTokens"}static get(e){return e.getContribution(tm.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(s=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(s=>this.stop())),this._register(Xc.onDidChange(s=>this.stop())),this._register(this._editor.onKeyUp(s=>s.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new a5(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}};ul=tm=n5([lS(1,cw),lS(2,Bn)],ul);var s5=class extends A{constructor(){super({id:"editor.action.inspectTokens",label:e0.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(n,e){ul.get(e)?.launch()}};function o5(n){let e="";for(let t=0,i=n.length;t<i;t++){const s=n.charCodeAt(t);switch(s){case 9:e+="→";break;case 32:e+="·";break;default:e+=String.fromCharCode(s)}}return e}function r5(n,e){const t=Xc.get(e);if(t)return t;const i=n.encodeLanguageId(e);return{getInitialState:()=>WT,tokenize:(s,o,r)=>yR(e,r),tokenizeEncoded:(s,o,r)=>RR(i,r)}}var a5=class xD extends M{static{this._ID="editor.contrib.inspectTokensWidget"}constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=r5(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return xD._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let l=t.tokens1.length-1;l>=0;l--){const d=t.tokens1[l];if(e.column-1>=d.offset){i=l;break}}let s=0;for(let l=t.tokens2.length>>>1;l>=0;l--)if(e.column-1>=t.tokens2[l<<1]){s=l;break}const o=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const l=t.tokens1[i].offset,d=i+1<t.tokens1.length?t.tokens1[i+1].offset:o.length;r=o.substring(l,d)}tc(this._domNode,H("h2.tm-token",void 0,o5(r),H("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),U(this._domNode,H("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(s<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(s<<1)+1]):null;U(this._domNode,H("table.tm-metadata-table",void 0,H("tbody",void 0,H("tr",void 0,H("td.tm-metadata-key",void 0,"language"),H("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),H("tr",void 0,H("td.tm-metadata-key",void 0,"token type"),H("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),H("tr",void 0,H("td.tm-metadata-key",void 0,"font style"),H("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),H("tr",void 0,H("td.tm-metadata-key",void 0,"foreground"),H("td.tm-metadata-value",void 0,`${a?ve.Format.CSS.formatHex(a.foreground):"-?-"}`)),H("tr",void 0,H("td.tm-metadata-key",void 0,"background"),H("td.tm-metadata-value",void 0,`${a?ve.Format.CSS.formatHex(a.background):"-?-"}`))))),U(this._domNode,H("hr.tokens-inspect-separator")),i<t.tokens1.length&&U(this._domNode,H("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=Xc.getColorMap(),i=jr.getLanguageId(e),s=jr.getTokenType(e),o=jr.getFontStyle(e),r=jr.getForeground(e),a=jr.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:s,fontStyle:o,foreground:t[r],background:t[a]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return e&1&&(t+="italic "),e&2&&(t+="bold "),e&4&&(t+="underline "),e&8&&(t+="strikethrough "),t.length===0&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),s=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:s.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};de(ul.ID,ul,4);P(s5);var l5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Hu=function(n,e){return function(t,i){e(t,i,n)}},xa,im=class{static{xa=this}static{this.PREFIX="?"}constructor(e,t,i){this.quickInputService=e,this.keybindingService=t,this.contextKeyService=i,this.registry=pn.as(kr.Quickaccess)}provide(e){const t=new O;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const s=this.registry.getQuickAccessProvider(i.substr(xa.PREFIX.length),this.contextKeyService);s?.prefix&&s.prefix!==xa.PREFIX&&this.quickInputService.quickAccess.show(s.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==xa.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders(this.contextKeyService).sort((e,t)=>e.prefix.localeCompare(t.prefix)).flatMap(e=>this.createPicks(e))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,s=i||"…";return{prefix:i,label:s,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:m(1844,"{0}, {1}",s,t.description),description:t.description}})}};im=xa=l5([Hu(0,Ri),Hu(1,He),Hu(2,Ce)],im);pn.as(kr.Quickaccess).registerQuickAccessProvider({ctor:im,prefix:"",helpEntries:[{description:AT.helpQuickAccessActionLabel}]});var ID=class{constructor(n){this.options=n,this.rangeHighlightDecorationId=void 0}provide(n,e,t){const i=new O;n.canAcceptInBackground=!!this.options?.canAcceptInBackground,n.matchOnLabel=n.matchOnDescription=n.matchOnDetail=n.sortByLabel=!1;const s=i.add(new We);return s.value=this.doProvide(n,e,t),i.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(n,e)})),i}doProvide(n,e,t){const i=new O,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const o={editor:s},r=uw(s);if(r){let a=s.saveViewState()??void 0;i.add(r.onDidChangeCursorPosition(()=>{a=s.saveViewState()??void 0})),o.restoreViewState=()=>{a&&s===this.activeTextEditorControl&&s.restoreViewState(a)},i.add(jw(e.onCancellationRequested)(()=>o.restoreViewState?.()))}i.add(Te(()=>this.clearDecorations(s))),i.add(this.provideWithTextEditor(o,n,e,t))}else i.add(this.provideWithoutTextEditor(n,e));return i}canProvideWithTextEditor(n){return!0}gotoLocation({editor:n},e){n.setSelection(e.range,"code.jump"),n.revealRangeInCenter(e.range,0),e.preserveFocus||n.focus();const t=this.getModel(n);if(t){const i=t.getLineContent(e.range.startLineNumber);Ss(m(1401,"Line {0}, column {1}: {2}",e.range.startLineNumber,e.range.startColumn,i))}}getModel(n){return Kw(n)?n.getModel()?.modified:n.getModel()}addDecorations(n,e){n.changeDecorations(t=>{const i=[];this.rangeHighlightDecorationId&&(i.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),i.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:e,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:e,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:nt(XS),position:ln.Full}}}],[o,r]=t.deltaDecorations(i,s);this.rangeHighlightDecorationId={rangeHighlightId:o,overviewRulerDecorationId:r}})}clearDecorations(n){const e=this.rangeHighlightDecorationId;e&&(n.changeDecorations(t=>{t.deltaDecorations([e.overviewRulerDecorationId,e.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}},d5=class Gd extends ID{static{this.GO_TO_LINE_PREFIX=":"}static{this.GO_TO_OFFSET_PREFIX="::"}static{this.ZERO_BASED_OFFSET_STORAGE_KEY="gotoLine.useZeroBasedOffset"}constructor(){super({canAcceptInBackground:!0})}get useZeroBasedOffset(){return this.storageService.getBoolean(Gd.ZERO_BASED_OFFSET_STORAGE_KEY,-1,!1)}set useZeroBasedOffset(e){this.storageService.store(Gd.ZERO_BASED_OFFSET_STORAGE_KEY,e,-1,0)}provideWithoutTextEditor(e){const t=m(1402,"Open a text editor first to go to a line or an offset.");return e.items=[{label:t}],e.ariaLabel=t,M.None}provideWithTextEditor(e,t,i){const s=e.editor,o=new O;t.ariaLabel=m(1403,"Go to line. Type a line number, optionally followed by colon and column number."),o.add(t.onDidAccept(d=>{const[c]=t.selectedItems;if(c){if(!c.lineNumber)return;this.gotoLocation(e,{range:this.toRange(c.lineNumber,c.column),keyMods:t.keyMods,preserveFocus:d.inBackground}),d.inBackground||t.hide()}}));const r={iconClass:ce.asClassName(V.indexZero),tooltip:m(1404,"Toggle Zero-Based Offset"),location:kE.Input,toggle:{checked:this.useZeroBasedOffset}},a=()=>{const d=t.value.trim().substring(Gd.GO_TO_LINE_PREFIX.length),{inOffsetMode:c,lineNumber:h,column:u,label:g}=this.parsePosition(s,d);if(t.buttons=c?[r]:[],t.items=[{lineNumber:h,column:u,label:g,ariaLabel:h?m(1405,"Go to line {0}, column {1}. Press Enter to navigate.",h,u||1):g}],!h){this.clearDecorations(s);return}const p=this.toRange(h,u);s.revealRangeInCenter(p,0),this.addDecorations(s,p)};o.add(t.onDidTriggerButton(d=>{d===r&&(this.useZeroBasedOffset=d.toggle?.checked??!this.useZeroBasedOffset,a())})),a(),o.add(t.onDidChangeValue(()=>a()));const l=uw(s);return l&&l.getOptions().get(76).renderType===2&&(l.updateOptions({lineNumbers:"on"}),o.add(Te(()=>l.updateOptions({lineNumbers:"relative"})))),o}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=this.getModel(e);if(!i)return{label:m(1406,"Open a text editor first to go to a line or an offset.")};if(t.startsWith(":")){let s=parseInt(t.substring(1),10);const o=i.getValueLength();if(isNaN(s))return{inOffsetMode:!0,label:this.useZeroBasedOffset?m(1407,"Type a character position to go to (from 0 to {0}).",o-1):m(1408,"Type a character position to go to (from 1 to {0}).",o)};{const r=s<0;this.useZeroBasedOffset||(s-=Math.sign(s)),r&&(s+=o);const a=i.getPositionAt(s),l=bd.visibleColumnFromColumn(i.getLineContent(a.lineNumber),a.column,i.getOptions().tabSize)+1;return{...a,inOffsetMode:!0,label:m(1409,"Press 'Enter' to go to line {0} at column {1}.",a.lineNumber,l)}}}else{const s=t.split(/,|:|#/),o=i.getLineCount();let r=parseInt(s[0]?.trim(),10);if(s.length<1||isNaN(r))return{label:m(1410,"Type a line number to go to (from 1 to {0}).",o)};r=r>=0?r:o+1+r,r=Math.min(Math.max(1,r),o);const a=i.getOptions().tabSize,l=i.getLineContent(r),d=bd.visibleColumnFromColumn(l,i.getLineMaxColumn(r),a)+1;let c=parseInt(s[1]?.trim(),10);if(s.length<2||isNaN(c))return{lineNumber:r,column:1,label:s.length<2?m(1411,"Press 'Enter' to go to line {0} or enter colon : to add a column number.",r):m(1412,"Press 'Enter' to go to line {0} or enter a column number (from 1 to {1}).",r,d)};c=c>=0?c:d+c,c=Math.min(Math.max(1,c),d);const h=bd.columnFromVisibleColumn(l,c-1,a);return{lineNumber:r,column:h,label:m(1413,"Press 'Enter' to go to line {0} at column {1}.",r,c)}}}},c5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},dS=function(n,e){return function(t,i){e(t,i,n)}},Ds=class extends d5{constructor(e,t){super(),this.editorService=e,this.storageService=t,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Ds=c5([dS(0,Ze),dS(1,Ni)],Ds);var LD=class DD extends A{static{this.ID="editor.action.gotoLine"}constructor(){super({id:DD.ID,label:th.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:S.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Ri).quickAccess.show(Ds.GO_TO_LINE_PREFIX)}};P(LD);pn.as(kr.Quickaccess).registerQuickAccessProvider({ctor:Ds,prefix:Ds.GO_TO_LINE_PREFIX,helpEntries:[{description:th.gotoLineActionLabel,commandId:LD.ID}]});var ED=class RD extends A{static{this.ID="editor.action.gotoOffset"}constructor(){super({id:RD.ID,label:th.gotoOffsetActionLabel,alias:"Go to Offset...",precondition:void 0})}run(e){e.get(Ri).quickAccess.show(Ds.GO_TO_OFFSET_PREFIX)}};P(ED);pn.as(kr.Quickaccess).registerQuickAccessProvider({ctor:Ds,prefix:Ds.GO_TO_OFFSET_PREFIX,helpEntries:[{description:th.gotoOffsetActionLabel,commandId:ED.ID}]});var TD=[void 0,[]];function Wu(n,e,t=0,i=0){const s=e;return s.values&&s.values.length>1?h5(n,s.values,t,i):PD(n,e,t,i)}function h5(n,e,t,i){let s=0;const o=[];for(const r of e){const[a,l]=PD(n,r,t,i);if(typeof a!="number")return TD;s+=a,o.push(...l)}return[s,u5(o)]}function PD(n,e,t,i){const s=$S(e.normalized,e.normalizedLowercase,t,n,n.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return s?[s[0],ch(s)]:TD}new Tr("allowNonContiguousMatches");new Tr("description");new Tr("label");new Tr("values");new Tr("expectContiguousMatch");new Tr("value");function u5(n){const e=n.sort((s,o)=>s.start-o.start),t=[];let i;for(const s of e)!i||!g5(i,s)?(i=s,t.push(s)):(i.start=Math.min(i.start,s.start),i.end=Math.max(i.end,s.end));return t}function g5(n,e){return!(n.end<e.start||e.end<n.start)}function cS(n){return n.startsWith('"')&&n.endsWith('"')}var kD=" ";function nm(n){typeof n!="string"&&(n="");const e=n.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:s}=hS(n),o=t.indexOf(ng)>=0,r=cS(n);let a;const l=n.split(kD);if(l.length>1)for(const d of l){const c=cS(d),{pathNormalized:h,normalized:u,normalizedLowercase:g}=hS(d);u&&(a||(a=[]),a.push({original:d,originalLowercase:d.toLowerCase(),pathNormalized:h,normalized:u,normalizedLowercase:g,expectContiguousMatch:c}))}return{original:n,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:s,values:a,containsPathSeparator:o,expectContiguousMatch:r}}function hS(n){let e;_m?e=n.replace(/\//g,ng):e=n.replace(/\\/g,ng);const t=e.replace(/[\*\u2026\s"]/g,"").replace(/(?<=.)#$/,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function uS(n){return Array.isArray(n)?nm(n.map(e=>e.original).join(kD)):nm(n.original)}var p5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},gS=function(n,e){return function(t,i){e(t,i,n)}},Zd,no=class extends ID{static{Zd=this}static{this.PREFIX="@"}static{this.SCOPE_PREFIX=":"}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,m(1414,"To go to a symbol, first open a text editor with symbol information.")),M.None}provideWithTextEditor(e,t,i,s){const o=e.editor,r=this.getModel(o);return r?this._languageFeaturesService.documentSymbolProvider.has(r)?this.doProvideWithEditorSymbols(e,r,t,i,s):this.doProvideWithoutEditorSymbols(e,r,t,i):M.None}doProvideWithoutEditorSymbols(e,t,i,s){const o=new O;return this.provideLabelPick(i,m(1415,"The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,o)||s.isCancellationRequested||o.add(this.doProvideWithEditorSymbols(e,t,i,s)))(),o}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new cm,s=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(s.dispose(),i.complete(!0))}));return t.add(Te(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,s,o){const r=e.editor,a=new O;a.add(i.onDidAccept(h=>{const[u]=i.selectedItems;if(u&&u.range){if(i.keyMods.shift&&u.attach){u.attach(i.keyMods,h);return}this.gotoLocation(e,{range:u.range.selection,keyMods:i.keyMods,preserveFocus:h.inBackground}),o?.handleAccept?.(u,h.inBackground),h.inBackground||i.hide()}})),a.add(i.onDidTriggerItemButton(({item:h})=>{h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const l=this.getDocumentSymbols(t,s),d=a.add(new We),c=async h=>{d?.value?.cancel(),i.busy=!1,d.value=new ot,i.busy=!0;try{const u=nm(i.value.substr(Zd.PREFIX.length).trim()),g=await this.doGetSymbolPicks(l,u,void 0,d.value.token,t);if(s.isCancellationRequested)return;if(g.length>0){if(i.items=g,h&&u.original.length===0){const p=w0(g,f=>!!(f.type!=="separator"&&f.range&&x.containsPosition(f.range.decoration,h)));p&&(i.activeItems=[p])}}else u.original.length>0?this.provideLabelPick(i,m(1416,"No matching editor symbols")):this.provideLabelPick(i,m(1417,"No editor symbols"))}finally{s.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>c(void 0))),c(r.getSelection()?.getPosition()),a.add(i.onDidChangeActive(()=>{const[h]=i.activeItems;h&&h.range&&(r.revealRangeInCenter(h.range.selection,0),this.addDecorations(r,h.range.decoration))})),a}async doGetSymbolPicks(e,t,i,s,o){const r=await e;if(s.isCancellationRequested)return[];const a=t.original.indexOf(Zd.SCOPE_PREFIX)===0,l=a?1:0;let d,c;t.values&&t.values.length>1?(d=uS(t.values[0]),c=uS(t.values.slice(1))):d=t;let h;const u=this.options?.openSideBySideDirection?.();u&&(h=[{iconClass:u==="right"?ce.asClassName(V.splitHorizontal):ce.asClassName(V.splitVertical),tooltip:u==="right"?m(1418,"Open to the Side"):m(1419,"Open to the Bottom")}]);const g=[];for(let _=0;_<r.length;_++){const v=r[_],C=fR(v.name),w=`$(${Yw.toIcon(v.kind).id}) ${C}`,y=w.length-C.length;let D=v.containerName;i?.extraContainerLabel&&(D?D=`${i.extraContainerLabel} • ${D}`:D=i.extraContainerLabel);let b,I,N,T;if(t.original.length>l){let F=!1;if(d!==t&&([b,I]=Wu(w,{...t,values:void 0},l,y),typeof b=="number"&&(F=!0)),typeof b!="number"&&([b,I]=Wu(w,d,l,y),typeof b!="number"))continue;if(!F&&c){if(D&&c.original.length>0&&([N,T]=Wu(D,c)),typeof N!="number")continue;typeof b=="number"&&(b+=N)}}const E=v.tags&&v.tags.indexOf(1)>=0;g.push({index:_,kind:v.kind,score:b,label:w,ariaLabel:AE(v.name,v.kind),description:D,highlights:E?void 0:{label:I,description:T},range:{selection:x.collapseToStart(v.selectionRange),decoration:v.range},uri:o.uri,symbolName:C,strikethrough:E,buttons:h})}const p=g.sort((_,v)=>a?this.compareByKindAndScore(_,v):this.compareByScore(_,v));let f=[];if(a){let w=function(){v&&typeof _=="number"&&C>0&&(v.label=zm(Bu[_]||Vu,C))},_,v,C=0;for(const y of p)_!==y.kind?(w(),_=y.kind,C=1,v={type:"separator"},f.push(v)):C++,f.push(y);w()}else p.length>0&&(f=[{label:m(1420,"symbols ({0})",g.length),type:"separator"},...p]);return f}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){const i=Bu[e.kind]||Vu,s=Bu[t.kind]||Vu,o=i.localeCompare(s);return o===0?this.compareByScore(e,t):o}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}};no=Zd=p5([gS(0,X),gS(1,Ml)],no);var Vu=m(1421,"properties ({0})"),Bu={5:m(1422,"methods ({0})"),11:m(1423,"functions ({0})"),8:m(1424,"constructors ({0})"),12:m(1425,"variables ({0})"),4:m(1426,"classes ({0})"),22:m(1427,"structs ({0})"),23:m(1428,"events ({0})"),24:m(1429,"operators ({0})"),10:m(1430,"interfaces ({0})"),2:m(1431,"namespaces ({0})"),3:m(1432,"packages ({0})"),25:m(1433,"type parameters ({0})"),1:m(1434,"modules ({0})"),6:m(1435,"properties ({0})"),9:m(1436,"enumerations ({0})"),21:m(1437,"enumeration members ({0})"),14:m(1438,"strings ({0})"),0:m(1439,"files ({0})"),17:m(1440,"arrays ({0})"),15:m(1441,"numbers ({0})"),16:m(1442,"booleans ({0})"),18:m(1443,"objects ({0})"),19:m(1444,"keys ({0})"),7:m(1445,"fields ({0})"),13:m(1446,"constants ({0})")},f5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Uu=function(n,e){return function(t,i){e(t,i,n)}},sm=class extends no{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=Ge.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};sm=f5([Uu(0,Ze),Uu(1,X),Uu(2,Ml)],sm);var ND=class MD extends A{static{this.ID="editor.action.quickOutline"}constructor(){super({id:MD.ID,label:lg.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:S.hasDocumentSymbolProvider,kbOpts:{kbExpr:S.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Ri).quickAccess.show(no.PREFIX,{itemActivation:GT.NONE})}};P(ND);pn.as(kr.Quickaccess).registerQuickAccessProvider({ctor:sm,prefix:no.PREFIX,helpEntries:[{description:lg.quickOutlineActionLabel,prefix:no.PREFIX,commandId:ND.ID},{description:lg.quickOutlineByCategoryActionLabel,prefix:no.PREFIX_BY_CATEGORY}]});function m5(n){const e=new Map;for(const t of n)e.set(t,(e.get(t)??0)+1);return e}var _5=class Xd{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),s=new Map,o=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const d=this.computeSimilarityScore(l,i,s);d>0&&o.push({key:r,score:d})}}return o}static termFrequencies(e){return m5(Xd.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield t(i);const s=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(s.length>1)for(const o of s)o.length>2&&/\p{Letter}{3,}/gu.test(o)&&(yield t(o))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const s of t.textChunks){const o=Xd.termFrequencies(s);for(const r of o.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);i.push({text:s,tf:o})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const s of i.tf.keys()){const o=this.chunkOccurrences.get(s);if(typeof o=="number"){const r=o-1;r<=0?this.chunkOccurrences.delete(s):this.chunkOccurrences.set(s,r)}}}}computeSimilarityScore(e,t,i){let s=0;for(const[o,r]of Object.entries(t)){const a=e.tf.get(o);if(!a)continue;let l=i.get(o);typeof l!="number"&&(l=this.computeIdf(o),i.set(o,l));const d=a*l;s+=d*r}return s}computeEmbedding(e){const t=Xd.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,s]of e){const o=this.computeIdf(i);o>0&&(t[i]=s*o)}return t}};function v5(n){const e=n.slice(0);e.sort((i,s)=>s.score-i.score);const t=e[0]?.score??0;if(t>0)for(const i of e)i.score/=t;return e}var cs;(function(n){n[n.NO_ACTION=0]="NO_ACTION",n[n.CLOSE_PICKER=1]="CLOSE_PICKER",n[n.REFRESH_PICKER=2]="REFRESH_PICKER",n[n.REMOVE_ITEM=3]="REMOVE_ITEM"})(cs||(cs={}));function zu(n){return Array.isArray(n.items)}function pS(n){const e=n;return!!e.picks&&e.additionalPicks instanceof Promise}var b5=class extends M{constructor(n,e){super(),this.prefix=n,this.options=e}provide(n,e,t){const i=new O;n.canAcceptInBackground=!!this.options?.canAcceptInBackground,n.matchOnLabel=n.matchOnDescription=n.matchOnDetail=n.sortByLabel=!1;let s;const o=i.add(new We),r=async()=>{s?.dispose(!0),n.busy=!1;const l=o.value=new O;s=l.add(new ot(e));const d=s.token;let c=n.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(c=c.trim());const h=this._getPicks(c,l,d,t),u=(p,f)=>{let _,v;if(zu(p)?(_=p.items,v=p.active):_=p,_.length===0){if(f)return!1;(c.length>0||n.hideInput)&&this.options?.noResultsPick&&(HE(this.options.noResultsPick)?_=[this.options.noResultsPick(c)]:_=[this.options.noResultsPick])}return n.items=_,v&&(n.activeItems=[v]),!0},g=async p=>{let f=!1,_=!1;await Promise.all([(async()=>{typeof p.mergeDelay=="number"&&(await sh(p.mergeDelay),d.isCancellationRequested)||_||(f=u(p.picks,!0))})(),(async()=>{n.busy=!0;try{const v=await p.additionalPicks;if(d.isCancellationRequested)return;let C,w;zu(p.picks)?(C=p.picks.items,w=p.picks.active):C=p.picks;let y,D;if(zu(v)?(y=v.items,D=v.active):y=v,y.length>0||!f){let b;if(!w&&!D){const I=n.activeItems[0];I&&C.indexOf(I)!==-1&&(b=I)}u({items:[...C,...y],active:w||D||b})}}finally{d.isCancellationRequested||(n.busy=!1),_=!0}})()])};if(h!==null)if(pS(h))await g(h);else if(!(h instanceof Promise))u(h);else{n.busy=!0;try{const p=await h;if(d.isCancellationRequested)return;pS(p)?await g(p):u(p)}finally{d.isCancellationRequested||(n.busy=!1)}}};i.add(n.onDidChangeValue(()=>r())),r(),i.add(n.onDidAccept(l=>{if(t?.handleAccept){l.inBackground||n.hide(),t.handleAccept?.(n.activeItems[0],l.inBackground);return}const[d]=n.selectedItems;if(typeof d?.accept=="function"){if(C0(n.keyMods)&&d.attach){d.attach(n.keyMods,l);return}l.inBackground||n.hide(),d.accept(n.keyMods,l)}}));const a=async(l,d)=>{if(typeof d.trigger!="function")return;const c=d.buttons?.indexOf(l)??-1;if(c>=0){const h=d.trigger(c,n.keyMods),u=typeof h=="number"?h:await h;if(e.isCancellationRequested)return;switch(u){case cs.NO_ACTION:break;case cs.CLOSE_PICKER:n.hide();break;case cs.REFRESH_PICKER:r();break;case cs.REMOVE_ITEM:{const g=n.items.indexOf(d);if(g!==-1){const p=n.items.slice(),f=p.splice(g,1),_=n.activeItems.filter(C=>C!==f[0]),v=n.keepScrollPosition;n.keepScrollPosition=!0,n.items=p,_&&(n.activeItems=_),n.keepScrollPosition=v}break}}}};return i.add(n.onDidTriggerItemButton(({button:l,item:d})=>a(l,d))),i.add(n.onDidTriggerSeparatorButton(({button:l,separator:d})=>a(l,d))),i}},OD=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ss=function(n,e){return function(t,i){e(t,i,n)}},Ys,$e,om=class extends b5{static{Ys=this}static{this.PREFIX=">"}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=t0($E,CE)}constructor(e,t,i,s,o,r){super(Ys.PREFIX,e),this.keybindingService=i,this.commandService=s,this.telemetryService=o,this.dialogService=r,this.commandsHistory=this._register(t.createInstance(rm)),this.options=e}async _getPicks(e,t,i,s){const o=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=jw(()=>{const g=new _5;g.updateDocuments(o.map(f=>({key:f.commandId,textChunks:[this.getTfIdfChunk(f)]})));const p=g.calculateScores(e,i);return v5(p).filter(f=>f.score>Ys.TFIDF_THRESHOLD).slice(0,Ys.TFIDF_MAX_RESULTS)}),a=[];for(const g of o){const p=Ys.WORD_FILTER(e,g.label)??void 0;let f;if(g.commandAlias&&(f=Ys.WORD_FILTER(e,g.commandAlias)??void 0),p||f)g.highlights={label:p,detail:this.options.showAlias?f:void 0},a.push(g);else if(e===g.commandId)a.push(g);else if(e.length>=3){const _=r();if(i.isCancellationRequested)return[];const v=_.find(C=>C.key===g.commandId);v&&(g.tfIdfScore=v.score,a.push(g))}}const l=new Map;for(const g of a){const p=l.get(g.label);p?(g.description=g.commandId,p.description=p.commandId):l.set(g.label,g)}a.sort((g,p)=>{if(g.tfIdfScore&&p.tfIdfScore)return g.tfIdfScore===p.tfIdfScore?g.label.localeCompare(p.label):p.tfIdfScore-g.tfIdfScore;if(g.tfIdfScore)return 1;if(p.tfIdfScore)return-1;const f=this.commandsHistory.peek(g.commandId),_=this.commandsHistory.peek(p.commandId);if(f&&_)return f>_?-1:1;if(f)return-1;if(_)return 1;if(this.options.suggestedCommandIds){const w=this.options.suggestedCommandIds.has(g.commandId),y=this.options.suggestedCommandIds.has(p.commandId);if(w&&y)return 0;if(w)return-1;if(y)return 1}const v=g.commandCategory===Bf.Developer.value,C=p.commandCategory===Bf.Developer.value;return v&&!C?1:!v&&C?-1:g.label.localeCompare(p.label)});const d=[];let c=!1,h=!0,u=!!this.options.suggestedCommandIds;for(let g=0;g<a.length;g++){const p=a[g],f=!!this.commandsHistory.peek(p.commandId);g===0&&f&&(d.push({type:"separator",label:m(1836,"recently used")}),c=!0),h&&p.tfIdfScore!==void 0&&(d.push({type:"separator",label:m(1837,"similar commands")}),h=!1),u&&p.tfIdfScore===void 0&&!f&&this.options.suggestedCommandIds?.has(p.commandId)&&(d.push({type:"separator",label:m(1838,"commonly used")}),c=!0,u=!1),c&&p.tfIdfScore===void 0&&!f&&!this.options.suggestedCommandIds?.has(p.commandId)&&(d.push({type:"separator",label:m(1839,"other commands")}),c=!1),d.push(this.toCommandPick(p,s,f))}return this.hasAdditionalCommandPicks(e,i)?{picks:d,additionalPicks:(async()=>{const g=await this.getAdditionalCommandPicks(o,a,e,i);if(i.isCancellationRequested)return[];const p=g.map(f=>this.toCommandPick(f,s));return h&&p[0]?.type!=="separator"&&p.unshift({type:"separator",label:m(1840,"similar commands")}),p})()}:d}toCommandPick(e,t,i=!1){if(e.type==="separator")return e;const s=e.tooltip??e.commandDescription?.value,o=this.keybindingService.lookupKeybinding(e.commandId),r=o?m(1841,"{0}, {1}",e.label,o.getAriaLabel()):e.label,a=e.buttons||[],l=i?[...a,{iconClass:ce.asClassName(V.close),tooltip:m(1842,"Remove from Recently Used")}]:e.buttons;return{...e,id:e.commandId,tooltip:s,ariaLabel:r,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:o,buttons:l,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(d){Un(d)||this.dialogService.error(m(1843,"Command '{0}' resulted in an error",e.label),cc(d))}},trigger:i?(d,c)=>d===a.length?(this.commandsHistory.remove(e.commandId),cs.REMOVE_ITEM):e.trigger?e.trigger(d,c):cs.NO_ACTION:e.trigger}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let s=e;return t&&t!==e&&(s+=` - ${t}`),i&&i.value!==e&&(s+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),s}};om=Ys=OD([ss(1,ne),ss(2,He),ss(3,ht),ss(4,Rs),ss(5,gm)],om);var rm=class extends M{static{$e=this}static{this.DEFAULT_COMMANDS_HISTORY_LENGTH=50}static{this.PREF_KEY_CACHE="commandPalette.mru.cache"}static{this.PREF_KEY_COUNTER="commandPalette.mru.counter"}static{this.counter=1}static{this.hasChanges=!1}constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===ym.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=$e.getConfiguredCommandHistoryLength(this.configurationService),$e.cache&&$e.cache.limit!==this.configuredCommandsHistoryLength&&($e.cache.limit=this.configuredCommandsHistoryLength,$e.hasChanges=!0))}load(){const e=this.storageService.get($e.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(s){this.logService.error(`[CommandsHistory] invalid data: ${s}`)}const i=$e.cache=new fl(this.configuredCommandsHistoryLength,1);if(t){let s;t.usesLRU?s=t.entries:s=t.entries.sort((o,r)=>o.value-r.value),s.forEach(o=>i.set(o.key,o.value))}$e.counter=this.storageService.getNumber($e.PREF_KEY_COUNTER,0,$e.counter)}push(e){$e.cache&&($e.cache.set(e,$e.counter++),$e.hasChanges=!0)}peek(e){return $e.cache?.peek(e)}remove(e){$e.cache&&($e.cache.delete(e),$e.hasChanges=!0)}saveState(){if(!$e.cache||!$e.hasChanges)return;const e={usesLRU:!0,entries:[]};$e.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store($e.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store($e.PREF_KEY_COUNTER,$e.counter,0,0),$e.hasChanges=!1}static getConfiguredCommandHistoryLength(e){const t=e.getValue().workbench?.commandPalette?.history;return typeof t=="number"?t:$e.DEFAULT_COMMANDS_HISTORY_LENGTH}};rm=$e=OD([ss(0,Ni),ss(1,Ee),ss(2,Ot)],rm);var C5=class extends om{constructor(n,e,t,i,s,o){super(n,e,t,i,s,o)}getCodeEditorCommandPicks(){const n=this.activeTextEditorControl;if(!n)return[];const e=[];for(const t of n.getSupportedActions()){let i;t.metadata?.description&&(xR(t.metadata.description)?i=t.metadata.description:i={original:t.metadata.description,value:t.metadata.description}),e.push({commandId:t.id,commandAlias:t.alias,commandDescription:i,label:NE(t.label)||t.id})}return e}},S5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Vo=function(n,e){return function(t,i){e(t,i,n)}},gl=class extends C5{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,s,o,r){super({showAlias:!1},e,i,s,o,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};gl=S5([Vo(0,ne),Vo(1,Ze),Vo(2,He),Vo(3,ht),Vo(4,Rs),Vo(5,gm)],gl);var AD=class FD extends A{static{this.ID="editor.action.quickCommand"}constructor(){super({id:FD.ID,label:_w.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:S.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Ri).quickAccess.show(gl.PREFIX)}};P(AD);pn.as(kr.Quickaccess).registerQuickAccessProvider({ctor:gl,prefix:gl.PREFIX,helpEntries:[{description:_w.quickCommandHelp,commandId:AD.ID}]});var w5=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},Bo=function(n,e){return function(t,i){e(t,i,n)}},am=class extends fo{constructor(e,t,i,s,o,r,a){super(!0,e,t,i,s,o,r,a)}};am=w5([Bo(1,Ce),Bo(2,Ze),Bo(3,Rt),Bo(4,ne),Bo(5,Ni),Bo(6,Ee)],am);de(fo.ID,am,4);var y5=class extends A{constructor(){super({id:"editor.action.toggleHighContrast",label:TT.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(n,e){const t=n.get(cw),i=t.getColorTheme();Aa(i.type)?(t.setTheme(this._originalThemeName||(_v(i.type)?"vs-dark":"vs")),this._originalThemeName=null):(t.setTheme(_v(i.type)?hP:r0),this._originalThemeName=i.themeName)}};P(y5);var HD=class{constructor(n,e,t,i,s){this._onDidChange=new ja,this._onDidExtraLibsChange=new ja,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(n),this.setDiagnosticsOptions(e),this.setWorkerOptions(t),this.setInlayHintsOptions(i),this.setModeConfiguration(s),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(n,e){let t;if(typeof e>"u"?t=`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t=e,this._extraLibs[t]&&this._extraLibs[t].content===n)return{dispose:()=>{}};let i=1;return this._removedExtraLibs[t]&&(i=this._removedExtraLibs[t]+1),this._extraLibs[t]&&(i=this._extraLibs[t].version+1),this._extraLibs[t]={content:n,version:i},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let s=this._extraLibs[t];s&&s.version===i&&(delete this._extraLibs[t],this._removedExtraLibs[t]=i,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(n){for(const e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),n&&n.length>0)for(const e of n){const t=e.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,i=e.content;let s=1;this._removedExtraLibs[t]&&(s=this._removedExtraLibs[t]+1),this._extraLibs[t]={content:i,version:s}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(n){this._compilerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(n){this._diagnosticsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(n){this._workerOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(n){this._inlayHintsOptions=n||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(n){}setEagerModelSync(n){this._eagerModelSync=n}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(void 0)}},WD={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},x5=new HD({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},WD),I5=new HD({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},WD);function VD(){return z(()=>import("./tsMode-BRJ2WiSx.js"),__vite__mapDeps([0,1,2,3,4]))}G.onLanguage("typescript",()=>VD().then(n=>n.setupTypeScript(x5)));G.onLanguage("javascript",()=>VD().then(n=>n.setupJavaScript(I5)));var L5=Object.defineProperty,D5=(n,e,t)=>e in n?L5(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,se=(n,e,t)=>D5(n,typeof e!="symbol"?e+"":e,t),pd,fS,fd,ju,md;function E5(n){return n.method!==void 0}var mS;(function(n){function e(t){return t}n.create=e})(mS||(mS={}));var Ii;(function(n){n.parseError=-32700,n.invalidRequest=-32600,n.methodNotFound=-32601,n.invalidParams=-32602,n.internalError=-32603;function e(o){return-32099<=o&&o<=-32e3}n.isServerError=e;function t(o){if(!e(o))throw new Error("Invalid range for a server error.");return o}n.serverError=t,n.unexpectedServerError=-32e3;function i(o){return!0}n.isApplicationError=i;function s(o){return o}n.applicationError=s,n.genericApplicationError=-320100})(Ii||(Ii={}));var BD=class{constructor(){se(this,"listeners",new Set),se(this,"event",n=>(this.listeners.add(n),{dispose:()=>{this.listeners.delete(n)}}))}fire(n){this.listeners.forEach(e=>e(n))}},R5=class{constructor(n){se(this,"_value"),se(this,"eventEmitter"),this._value=n,this.eventEmitter=new BD}get value(){return this._value}set value(n){this._value!==n&&(this._value=n,this.eventEmitter.fire(n))}get onChange(){return this.eventEmitter.event}};function T5(n,e){const t=setTimeout(e,n);return{dispose:()=>clearTimeout(t)}}function qu(n,e,t){return n instanceof Set?(n.add(e),{dispose:()=>n.delete(e)}):(n.set(e,t),{dispose:()=>n.delete(e)})}var P5=class{constructor(){se(this,"_state","none"),se(this,"promise"),se(this,"resolve",()=>{}),se(this,"reject",()=>{}),this.promise=new Promise((n,e)=>{this.resolve=n,this.reject=e})}get state(){return this._state}},g4=(pd=class{constructor(){se(this,"_unprocessedMessages",[]),se(this,"_messageListener"),se(this,"id",pd.id++),se(this,"_state",new R5({state:"open"})),se(this,"state",this._state)}setListener(n){if(this._messageListener=n,!!n)for(;this._unprocessedMessages.length>0&&this._messageListener!==void 0;){const e=this._unprocessedMessages.shift();this._messageListener(e)}}send(n){return this._sendImpl(n)}_dispatchReceivedMessage(n){this._unprocessedMessages.length===0&&this._messageListener?this._messageListener(n):this._unprocessedMessages.push(n)}_onConnectionClosed(){this._state.value={state:"closed",error:void 0}}log(n){return new k5(this,n??new N5)}},se(pd,"id",0),pd),k5=class{constructor(n,e){se(this,"baseStream"),se(this,"logger"),this.baseStream=n,this.logger=e}get state(){return this.baseStream.state}setListener(n){if(n===void 0){this.baseStream.setListener(void 0);return}this.baseStream.setListener(e=>{this.logger.log(this.baseStream,"incoming",e),n(e)})}send(n){return this.logger.log(this.baseStream,"outgoing",n),this.baseStream.send(n)}toString(){return`StreamLogger/${this.baseStream.toString()}`}},N5=class{log(n,e,t){console.log(`${e==="incoming"?"<-":"->"} [${n.toString()}] ${JSON.stringify(t)}`)}},M5=class UD{constructor(e){se(this,"connect"),this.connect=e}mapContext(e){return new UD(t=>this.connect(t?O5(t,e):void 0))}};function O5(n,e){return{handleNotification:(t,i)=>n.handleNotification(t,e(i)),handleRequest:(t,i,s)=>n.handleRequest(t,i,e(s))}}var A5=class zD{constructor(e,t,i){se(this,"_stream"),se(this,"_listener"),se(this,"_logger"),se(this,"_unprocessedResponses",new Map),se(this,"_lastUsedRequestId",0),this._stream=e,this._listener=t,this._logger=i,this._stream.setListener(s=>{E5(s)?s.id===void 0?this._processNotification(s):this._processRequest(s):this._processResponse(s)})}static createChannel(e,t){let i=!1;return new M5(s=>{if(i)throw new Error(`A channel to the stream ${e} was already constructed!`);return i=!0,new zD(e,s,t)})}get state(){return this._stream.state}async _processNotification(e){if(e.id!==void 0)throw new Error;if(!this._listener){this._logger&&this._logger.debug({text:"Notification ignored",message:e});return}try{await this._listener.handleNotification({method:e.method,params:e.params||null})}catch(t){this._logger&&this._logger.warn({text:`Exception was thrown while handling notification: ${t}`,exception:t,message:e})}}async _processRequest(e){if(e.id===void 0)throw new Error;let t;if(this._listener)try{t=await this._listener.handleRequest({method:e.method,params:e.params||null},e.id)}catch(s){this._logger&&this._logger.warn({text:`Exception was thrown while handling request: ${s}`,message:e,exception:s}),t={error:{code:Ii.internalError,message:"An unexpected exception was thrown.",data:void 0}}}else this._logger&&this._logger.debug({text:"Received request even though not listening for requests",message:e}),t={error:{code:Ii.methodNotFound,message:"This endpoint does not listen for requests or notifications.",data:void 0}};let i;"result"in t?i={jsonrpc:"2.0",id:e.id,result:t.result}:i={jsonrpc:"2.0",id:e.id,error:t.error},await this._stream.send(i)}_processResponse(e){const t=""+e.id,i=this._unprocessedResponses.get(t);if(!i){this._logger&&this._logger.debug({text:"Got an unexpected response message",message:e});return}this._unprocessedResponses.delete(t),i(e)}_newRequestId(){return this._lastUsedRequestId++}sendRequest(e,t,i){const s={jsonrpc:"2.0",id:this._newRequestId(),method:e.method,params:e.params||void 0};return i&&i(s.id),new Promise((o,r)=>{const a=""+s.id;this._unprocessedResponses.set(a,l=>{"result"in l?o({result:l.result}):(l.error||r(new Error("Response had neither 'result' nor 'error' field set.")),o({error:l.error}))}),this._stream.send(s).then(void 0,l=>{this._unprocessedResponses.delete(a),r(l)})})}sendNotification(e,t){const i={jsonrpc:"2.0",id:void 0,method:e.method,params:e.params||void 0};return this._stream.send(i)}toString(){return"StreamChannel/"+this._stream.toString()}},cr;(function(n){function e(){return{deserializeFromJson:s=>({hasErrors:!1,value:s}),serializeToJson:s=>s}}n.sAny=e;function t(){return{deserializeFromJson:s=>({hasErrors:!1,value:{}}),serializeToJson:s=>({})}}n.sEmptyObject=t;function i(){return{deserializeFromJson:s=>({hasErrors:!1,value:void 0}),serializeToJson:s=>null}}n.sVoidFromNull=i})(cr||(cr={}));var jD=Symbol("OptionalMethodNotFound"),qD=class{contextualize(n){return new F5(this,n)}},F5=class extends qD{constructor(n,e){super(),se(this,"underylingTypedChannel"),se(this,"converters"),this.underylingTypedChannel=n,this.converters=e}async request(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.request(n,e,i)}async notify(n,e,t){const i=await this.converters.getSendContext(t);return this.underylingTypedChannel.notify(n,e,i)}registerNotificationHandler(n,e){return this.underylingTypedChannel.registerNotificationHandler(n,async(t,i)=>await e(t,await this.converters.getNewContext(i)))}registerRequestHandler(n,e){return this.underylingTypedChannel.registerRequestHandler(n,async(t,i,s)=>await e(t,i,await this.converters.getNewContext(s)))}},_S=class $D extends qD{constructor(e,t={}){super(),se(this,"channelCtor"),se(this,"_requestSender"),se(this,"_handler",new Map),se(this,"_unknownNotificationHandler",new Set),se(this,"_timeout"),se(this,"sendExceptionDetails",!1),se(this,"_logger"),se(this,"listeningDeferred",new P5),se(this,"onListening",this.listeningDeferred.promise),se(this,"_requestDidErrorEventEmitter",new BD),se(this,"onRequestDidError",this._requestDidErrorEventEmitter.event),this.channelCtor=e,this._logger=t.logger,this.sendExceptionDetails=!!t.sendExceptionDetails,this._timeout=T5(1e3,()=>{this._requestSender||console.warn(`"${this.startListen.name}" has not been called within 1 second after construction of this channel. Did you forget to call it?`,this)})}static fromTransport(e,t={}){return new $D(A5.createChannel(e,t.logger),t)}startListen(){if(this._requestSender)throw new Error(`"${this.startListen.name}" can be called only once, but it already has been called.`);this._timeout&&(this._timeout.dispose(),this._timeout=void 0),this._requestSender=this.channelCtor.connect({handleRequest:(e,t,i)=>this.handleRequest(e,t,i),handleNotification:(e,t)=>this.handleNotification(e,t)}),this.listeningDeferred.resolve()}checkChannel(e){if(!e)throw new Error(`"${this.startListen.name}" must be called before any messages can be sent or received.`);return!0}async handleRequest(e,t,i){const s=this._handler.get(e.method);if(!s)return this._logger&&this._logger.debug({text:`No request handler for "${e.method}".`,data:{requestObject:e}}),{error:{code:Ii.methodNotFound,message:`No request handler for "${e.method}".`,data:{method:e.method}}};if(s.kind!="request"){const r=`"${e.method}" is registered as notification, but was sent as request.`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e}}),{error:{code:Ii.invalidRequest,message:r,data:{method:e.method}}}}const o=s.requestType.paramsSerializer.deserializeFromJson(e.params);if(o.hasErrors){const r=`Got invalid params: ${o.errorMessage}`;return this._logger&&this._logger.debug({text:r,data:{requestObject:e,errorMessage:o.errorMessage}}),{error:{code:Ii.invalidParams,message:r,data:{errors:o.errorMessage}}}}else{const r=o.value;let a;try{const l=await s.handler(r,t,i);if("error"in l||"errorMessage"in l){const d=l.error?s.requestType.errorSerializer.serializeToJson(l.error):void 0;a={error:{code:l.errorCode||Ii.genericApplicationError,message:l.errorMessage||"An error was returned",data:d}}}else a={result:s.requestType.resultSerializer.serializeToJson(l.ok)}}catch(l){l instanceof bS?a={error:{code:l.code,message:l.message}}:(this._logger&&this._logger.warn({text:`An exception was thrown while handling a request: ${l}.`,exception:l,data:{requestObject:e}}),a={error:{code:Ii.unexpectedServerError,message:this.sendExceptionDetails?`An exception was thrown while handling a request: ${l}.`:"Server has thrown an unexpected exception"}})}return a}}async handleNotification(e,t){const i=this._handler.get(e.method);if(!i){for(const r of this._unknownNotificationHandler)r(e);this._unknownNotificationHandler.size===0&&this._logger&&this._logger.debug({text:`Unhandled notification "${e.method}"`,data:{requestObject:e}});return}if(i.kind!="notification"){this._logger&&this._logger.debug({text:`"${e.method}" is registered as request, but was sent as notification.`,data:{requestObject:e}});return}const s=i.notificationType.paramsSerializer.deserializeFromJson(e.params);if(s.hasErrors){this._logger&&this._logger.debug({text:`Got invalid params: ${s}`,data:{requestObject:e,errorMessage:s.errorMessage}});return}const o=s.value;for(const r of i.handlers)try{r(o,t)}catch(a){this._logger&&this._logger.warn({text:`An exception was thrown while handling a notification: ${a}.`,exception:a,data:{requestObject:e}})}}registerUnknownNotificationHandler(e){return qu(this._unknownNotificationHandler,e)}registerRequestHandler(e,t){if(this._handler.get(e.method))throw new Error(`Handler with method "${e.method}" already registered.`);return qu(this._handler,e.method,{kind:"request",requestType:e,handler:t})}registerNotificationHandler(e,t){let i=this._handler.get(e.method);if(!i)i={kind:"notification",notificationType:e,handlers:new Set},this._handler.set(e.method,i);else{if(i.kind!=="notification")throw new Error(`Method "${e.method}" was already registered as request handler.`);if(i.notificationType!==e)throw new Error(`Method "${e.method}" was registered for a different type.`)}return qu(i.handlers,t)}getRegisteredTypes(){const e=[];for(const t of this._handler.values())t.kind==="notification"?e.push(t.notificationType):t.kind==="request"&&e.push(t.requestType);return e}async request(e,t,i){if(!this.checkChannel(this._requestSender))throw new Error("Impossible");const s=e.paramsSerializer.serializeToJson(t);vS(s);const o=await this._requestSender.sendRequest({method:e.method,params:s},i);if("error"in o){if(e.isOptional&&o.error.code===Ii.methodNotFound)return jD;let r;if(o.error.data!==void 0){const l=e.errorSerializer.deserializeFromJson(o.error.data);if(l.hasErrors)throw new Error(l.errorMessage);r=l.value}else r=void 0;const a=new bS(o.error.message,r,o.error.code);throw this._requestDidErrorEventEmitter.fire({error:a}),a}else{const r=e.resultSerializer.deserializeFromJson(o.result);if(r.hasErrors)throw new Error("Could not deserialize response: "+r.errorMessage+`
|
|
67
|
+
|
|
68
|
+
${JSON.stringify(o,null,2)}`);return r.value}}async notify(e,t,i){if(!this.checkChannel(this._requestSender))throw new Error;const s=e.paramsSerializer.serializeToJson(t);vS(s),this._requestSender.sendNotification({method:e.method,params:s},i)}};function vS(n){if(n!==null&&Array.isArray(n)&&typeof n!="object")throw new Error("Invalid value! Only null, array and object is allowed.")}var bS=class KD extends Error{constructor(e,t,i=Ii.genericApplicationError){super(e),se(this,"data"),se(this,"code"),this.data=t,this.code=i,Object.setPrototypeOf(this,KD.prototype)}},H5=class lm{constructor(e,t,i,s,o=!1){se(this,"method"),se(this,"paramsSerializer"),se(this,"resultSerializer"),se(this,"errorSerializer"),se(this,"isOptional"),se(this,"kind","request"),this.method=e,this.paramsSerializer=t,this.resultSerializer=i,this.errorSerializer=s,this.isOptional=o}withMethod(e){return new lm(e,this.paramsSerializer,this.resultSerializer,this.errorSerializer)}optional(){return new lm(this.method,this.paramsSerializer,this.resultSerializer,this.errorSerializer,!0)}},W5=class GD{constructor(e,t){se(this,"method"),se(this,"paramsSerializer"),se(this,"kind","notification"),this.method=e,this.paramsSerializer=t}withMethod(e){return new GD(e,this.paramsSerializer)}};function te(n){return new H5((n||{}).method,cr.sAny(),cr.sAny(),cr.sAny())}function qe(n){return new W5((n||{}).method,cr.sAny())}var CS=(fS=Symbol(),fd=class{constructor(n){se(this,"error"),se(this,fS),this.error=n}},se(fd,"factory",n=>new fd(n)),fd);function V5(n){const e=SS(n.server),t=SS(n.client);return new B5(n.tags||[],e,t)}function SS(n){const e={};for(const[t,i]of Object.entries(n)){const s=i.method?i.method:t;e[t]=i.withMethod(s)}return e}var B5=class ZD{constructor(e=[],t,i){se(this,"tags"),se(this,"server"),se(this,"client"),this.tags=e,this.server=t,this.client=i}_onlyDesignTime(){return new Error("This property is not meant to be accessed at runtime")}get TContractObject(){throw this._onlyDesignTime()}get TClientInterface(){throw this._onlyDesignTime()}get TServerInterface(){throw this._onlyDesignTime()}get TClientHandler(){throw this._onlyDesignTime()}get TServerHandler(){throw this._onlyDesignTime()}get TTags(){throw this._onlyDesignTime()}getInterface(e,t,i,s){const o=this.buildCounterpart(e,i),r=this.registerHandlers(e,t,s,o);return{counterpart:o,dispose:()=>r.dispose()}}buildCounterpart(e,t){const i={};for(const[s,o]of Object.entries(t)){let r;o.kind==="request"?o.isOptional?r=async(a,l)=>{a===void 0&&(a={});try{return await e.request(o,a,l)}catch(d){if(d&&d.code===Ii.methodNotFound)return jD;throw d}}:r=(a,l)=>(a===void 0&&(a={}),e.request(o,a,l)):r=(a,l)=>(a===void 0&&(a={}),e.notify(o,a,l)),i[s]=r}return i}registerHandlers(e,t,i,s){const o=[];for(const[r,a]of Object.entries(t))if(a.kind==="request"){let l=i[r];if(!l)continue;const d=this.createRequestHandler(s,l);o.push(e.registerRequestHandler(a,d))}else{const l=i[r];l&&o.push(e.registerNotificationHandler(a,(d,c)=>{l(d,{context:c,counterpart:s})}))}return{dispose:()=>o.forEach(r=>r.dispose())}}createRequestHandler(e,t){return async(i,s,o)=>{const r=await t(i,{context:o,counterpart:e,newErr:CS.factory,requestId:s});return r instanceof CS?r.error:{ok:r}}}static getServerFromStream(e,t,i,s){const o=_S.fromTransport(t,i),{server:r}=e.getServer(o,s);return o.startListen(),{channel:o,server:r}}static registerServerToStream(e,t,i,s){const o=_S.fromTransport(t,i),{client:r}=e.registerServer(o,s);return o.startListen(),{channel:o,client:r}}getServer(e,t){const{counterpart:i,dispose:s}=this.getInterface(e,this.client,this.server,t);return{server:i,dispose:s}}registerServer(e,t){const{counterpart:i,dispose:s}=this.getInterface(e,this.server,this.client,t);return{client:i,dispose:s}}withContext(){return new ZD(this.tags,this.server,this.client)}},$u=(function(n){return n.Comment="comment",n.Imports="imports",n.Region="region",n})({}),Je=(function(n){return n[n.File=1]="File",n[n.Module=2]="Module",n[n.Namespace=3]="Namespace",n[n.Package=4]="Package",n[n.Class=5]="Class",n[n.Method=6]="Method",n[n.Property=7]="Property",n[n.Field=8]="Field",n[n.Constructor=9]="Constructor",n[n.Enum=10]="Enum",n[n.Interface=11]="Interface",n[n.Function=12]="Function",n[n.Variable=13]="Variable",n[n.Constant=14]="Constant",n[n.String=15]="String",n[n.Number=16]="Number",n[n.Boolean=17]="Boolean",n[n.Array=18]="Array",n[n.Object=19]="Object",n[n.Key=20]="Key",n[n.Null=21]="Null",n[n.EnumMember=22]="EnumMember",n[n.Struct=23]="Struct",n[n.Event=24]="Event",n[n.Operator=25]="Operator",n[n.TypeParameter=26]="TypeParameter",n})({}),U5=(function(n){return n[n.Deprecated=1]="Deprecated",n})({}),wS=(function(n){return n[n.Type=1]="Type",n[n.Parameter=2]="Parameter",n})({}),et=(function(n){return n[n.Text=1]="Text",n[n.Method=2]="Method",n[n.Function=3]="Function",n[n.Constructor=4]="Constructor",n[n.Field=5]="Field",n[n.Variable=6]="Variable",n[n.Class=7]="Class",n[n.Interface=8]="Interface",n[n.Module=9]="Module",n[n.Property=10]="Property",n[n.Unit=11]="Unit",n[n.Value=12]="Value",n[n.Enum=13]="Enum",n[n.Keyword=14]="Keyword",n[n.Snippet=15]="Snippet",n[n.Color=16]="Color",n[n.File=17]="File",n[n.Reference=18]="Reference",n[n.Folder=19]="Folder",n[n.EnumMember=20]="EnumMember",n[n.Constant=21]="Constant",n[n.Struct=22]="Struct",n[n.Event=23]="Event",n[n.Operator=24]="Operator",n[n.TypeParameter=25]="TypeParameter",n})({}),z5=(function(n){return n[n.Deprecated=1]="Deprecated",n})({}),j5=(function(n){return n[n.PlainText=1]="PlainText",n[n.Snippet=2]="Snippet",n})({}),Ku=(function(n){return n[n.Text=1]="Text",n[n.Read=2]="Read",n[n.Write=3]="Write",n})({}),Cn=(function(n){return n.Empty="",n.QuickFix="quickfix",n.Refactor="refactor",n.RefactorExtract="refactor.extract",n.RefactorInline="refactor.inline",n.RefactorRewrite="refactor.rewrite",n.Source="source",n.SourceOrganizeImports="source.organizeImports",n.SourceFixAll="source.fixAll",n})({}),hs=(function(n){return n[n.Error=1]="Error",n[n.Warning=2]="Warning",n[n.Information=3]="Information",n[n.Hint=4]="Hint",n})({}),yS=(function(n){return n[n.Unnecessary=1]="Unnecessary",n[n.Deprecated=2]="Deprecated",n})({}),Gu=(function(n){return n[n.Invoked=1]="Invoked",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.TriggerForIncompleteCompletions=3]="TriggerForIncompleteCompletions",n})({}),Zu=(function(n){return n[n.Invoked=1]="Invoked",n[n.TriggerCharacter=2]="TriggerCharacter",n[n.ContentChange=3]="ContentChange",n})({}),xS=(function(n){return n[n.Invoked=1]="Invoked",n[n.Automatic=2]="Automatic",n})({}),fe=class{constructor(n){this.method=n}},q5={textDocumentImplementation:new fe("textDocument/implementation"),textDocumentTypeDefinition:new fe("textDocument/typeDefinition"),textDocumentDocumentColor:new fe("textDocument/documentColor"),textDocumentColorPresentation:new fe("textDocument/colorPresentation"),textDocumentFoldingRange:new fe("textDocument/foldingRange"),textDocumentDeclaration:new fe("textDocument/declaration"),textDocumentSelectionRange:new fe("textDocument/selectionRange"),textDocumentPrepareCallHierarchy:new fe("textDocument/prepareCallHierarchy"),textDocumentSemanticTokensFull:new fe("textDocument/semanticTokens/full"),textDocumentSemanticTokensFullDelta:new fe("textDocument/semanticTokens/full/delta"),textDocumentLinkedEditingRange:new fe("textDocument/linkedEditingRange"),workspaceWillCreateFiles:new fe("workspace/willCreateFiles"),workspaceWillRenameFiles:new fe("workspace/willRenameFiles"),workspaceWillDeleteFiles:new fe("workspace/willDeleteFiles"),textDocumentMoniker:new fe("textDocument/moniker"),textDocumentPrepareTypeHierarchy:new fe("textDocument/prepareTypeHierarchy"),textDocumentInlineValue:new fe("textDocument/inlineValue"),textDocumentInlayHint:new fe("textDocument/inlayHint"),textDocumentDiagnostic:new fe("textDocument/diagnostic"),textDocumentInlineCompletion:new fe("textDocument/inlineCompletion"),textDocumentWillSaveWaitUntil:new fe("textDocument/willSaveWaitUntil"),textDocumentCompletion:new fe("textDocument/completion"),textDocumentHover:new fe("textDocument/hover"),textDocumentSignatureHelp:new fe("textDocument/signatureHelp"),textDocumentDefinition:new fe("textDocument/definition"),textDocumentReferences:new fe("textDocument/references"),textDocumentDocumentHighlight:new fe("textDocument/documentHighlight"),textDocumentDocumentSymbol:new fe("textDocument/documentSymbol"),textDocumentCodeAction:new fe("textDocument/codeAction"),workspaceSymbol:new fe("workspace/symbol"),textDocumentCodeLens:new fe("textDocument/codeLens"),textDocumentDocumentLink:new fe("textDocument/documentLink"),textDocumentFormatting:new fe("textDocument/formatting"),textDocumentRangeFormatting:new fe("textDocument/rangeFormatting"),textDocumentRangesFormatting:new fe("textDocument/rangesFormatting"),textDocumentOnTypeFormatting:new fe("textDocument/onTypeFormatting"),textDocumentRename:new fe("textDocument/rename"),workspaceExecuteCommand:new fe("workspace/executeCommand"),workspaceDidCreateFiles:new fe("workspace/didCreateFiles"),workspaceDidRenameFiles:new fe("workspace/didRenameFiles"),workspaceDidDeleteFiles:new fe("workspace/didDeleteFiles"),workspaceDidChangeConfiguration:new fe("workspace/didChangeConfiguration"),textDocumentDidOpen:new fe("textDocument/didOpen"),textDocumentDidChange:new fe("textDocument/didChange"),textDocumentDidClose:new fe("textDocument/didClose"),textDocumentDidSave:new fe("textDocument/didSave"),textDocumentWillSave:new fe("textDocument/willSave"),workspaceDidChangeWatchedFiles:new fe("workspace/didChangeWatchedFiles")},p4=V5({server:{textDocumentImplementation:te({method:"textDocument/implementation"}),textDocumentTypeDefinition:te({method:"textDocument/typeDefinition"}),textDocumentDocumentColor:te({method:"textDocument/documentColor"}),textDocumentColorPresentation:te({method:"textDocument/colorPresentation"}),textDocumentFoldingRange:te({method:"textDocument/foldingRange"}),textDocumentDeclaration:te({method:"textDocument/declaration"}),textDocumentSelectionRange:te({method:"textDocument/selectionRange"}),textDocumentPrepareCallHierarchy:te({method:"textDocument/prepareCallHierarchy"}),callHierarchyIncomingCalls:te({method:"callHierarchy/incomingCalls"}),callHierarchyOutgoingCalls:te({method:"callHierarchy/outgoingCalls"}),textDocumentSemanticTokensFull:te({method:"textDocument/semanticTokens/full"}),textDocumentSemanticTokensFullDelta:te({method:"textDocument/semanticTokens/full/delta"}),textDocumentSemanticTokensRange:te({method:"textDocument/semanticTokens/range"}),textDocumentLinkedEditingRange:te({method:"textDocument/linkedEditingRange"}),workspaceWillCreateFiles:te({method:"workspace/willCreateFiles"}),workspaceWillRenameFiles:te({method:"workspace/willRenameFiles"}),workspaceWillDeleteFiles:te({method:"workspace/willDeleteFiles"}),textDocumentMoniker:te({method:"textDocument/moniker"}),textDocumentPrepareTypeHierarchy:te({method:"textDocument/prepareTypeHierarchy"}),typeHierarchySupertypes:te({method:"typeHierarchy/supertypes"}),typeHierarchySubtypes:te({method:"typeHierarchy/subtypes"}),textDocumentInlineValue:te({method:"textDocument/inlineValue"}),textDocumentInlayHint:te({method:"textDocument/inlayHint"}),inlayHintResolve:te({method:"inlayHint/resolve"}),textDocumentDiagnostic:te({method:"textDocument/diagnostic"}),workspaceDiagnostic:te({method:"workspace/diagnostic"}),textDocumentInlineCompletion:te({method:"textDocument/inlineCompletion"}),initialize:te({method:"initialize"}),shutdown:te({method:"shutdown"}),textDocumentWillSaveWaitUntil:te({method:"textDocument/willSaveWaitUntil"}),textDocumentCompletion:te({method:"textDocument/completion"}),completionItemResolve:te({method:"completionItem/resolve"}),textDocumentHover:te({method:"textDocument/hover"}),textDocumentSignatureHelp:te({method:"textDocument/signatureHelp"}),textDocumentDefinition:te({method:"textDocument/definition"}),textDocumentReferences:te({method:"textDocument/references"}),textDocumentDocumentHighlight:te({method:"textDocument/documentHighlight"}),textDocumentDocumentSymbol:te({method:"textDocument/documentSymbol"}),textDocumentCodeAction:te({method:"textDocument/codeAction"}),codeActionResolve:te({method:"codeAction/resolve"}),workspaceSymbol:te({method:"workspace/symbol"}),workspaceSymbolResolve:te({method:"workspaceSymbol/resolve"}),textDocumentCodeLens:te({method:"textDocument/codeLens"}),codeLensResolve:te({method:"codeLens/resolve"}),textDocumentDocumentLink:te({method:"textDocument/documentLink"}),documentLinkResolve:te({method:"documentLink/resolve"}),textDocumentFormatting:te({method:"textDocument/formatting"}),textDocumentRangeFormatting:te({method:"textDocument/rangeFormatting"}),textDocumentRangesFormatting:te({method:"textDocument/rangesFormatting"}),textDocumentOnTypeFormatting:te({method:"textDocument/onTypeFormatting"}),textDocumentRename:te({method:"textDocument/rename"}),textDocumentPrepareRename:te({method:"textDocument/prepareRename"}),workspaceExecuteCommand:te({method:"workspace/executeCommand"}),workspaceDidChangeWorkspaceFolders:qe({method:"workspace/didChangeWorkspaceFolders"}),windowWorkDoneProgressCancel:qe({method:"window/workDoneProgress/cancel"}),workspaceDidCreateFiles:qe({method:"workspace/didCreateFiles"}),workspaceDidRenameFiles:qe({method:"workspace/didRenameFiles"}),workspaceDidDeleteFiles:qe({method:"workspace/didDeleteFiles"}),notebookDocumentDidOpen:qe({method:"notebookDocument/didOpen"}),notebookDocumentDidChange:qe({method:"notebookDocument/didChange"}),notebookDocumentDidSave:qe({method:"notebookDocument/didSave"}),notebookDocumentDidClose:qe({method:"notebookDocument/didClose"}),initialized:qe({method:"initialized"}),exit:qe({method:"exit"}),workspaceDidChangeConfiguration:qe({method:"workspace/didChangeConfiguration"}),textDocumentDidOpen:qe({method:"textDocument/didOpen"}),textDocumentDidChange:qe({method:"textDocument/didChange"}),textDocumentDidClose:qe({method:"textDocument/didClose"}),textDocumentDidSave:qe({method:"textDocument/didSave"}),textDocumentWillSave:qe({method:"textDocument/willSave"}),workspaceDidChangeWatchedFiles:qe({method:"workspace/didChangeWatchedFiles"}),setTrace:qe({method:"$/setTrace"}),cancelRequest:qe({method:"$/cancelRequest"}),progress:qe({method:"$/progress"})},client:{workspaceWorkspaceFolders:te({method:"workspace/workspaceFolders"}).optional(),workspaceConfiguration:te({method:"workspace/configuration"}).optional(),workspaceFoldingRangeRefresh:te({method:"workspace/foldingRange/refresh"}).optional(),windowWorkDoneProgressCreate:te({method:"window/workDoneProgress/create"}).optional(),workspaceSemanticTokensRefresh:te({method:"workspace/semanticTokens/refresh"}).optional(),windowShowDocument:te({method:"window/showDocument"}).optional(),workspaceInlineValueRefresh:te({method:"workspace/inlineValue/refresh"}).optional(),workspaceInlayHintRefresh:te({method:"workspace/inlayHint/refresh"}).optional(),workspaceDiagnosticRefresh:te({method:"workspace/diagnostic/refresh"}).optional(),clientRegisterCapability:te({method:"client/registerCapability"}).optional(),clientUnregisterCapability:te({method:"client/unregisterCapability"}).optional(),windowShowMessageRequest:te({method:"window/showMessageRequest"}).optional(),workspaceCodeLensRefresh:te({method:"workspace/codeLens/refresh"}).optional(),workspaceApplyEdit:te({method:"workspace/applyEdit"}).optional(),windowShowMessage:qe({method:"window/showMessage"}),windowLogMessage:qe({method:"window/logMessage"}),telemetryEvent:qe({method:"telemetry/event"}),textDocumentPublishDiagnostics:qe({method:"textDocument/publishDiagnostics"}),logTrace:qe({method:"$/logTrace"}),cancelRequest:qe({method:"$/cancelRequest"}),progress:qe({method:"$/progress"})}}),f4=(ju=class{constructor(){se(this,"_store",new $5)}dispose(){this._store.dispose()}_register(n){if(n===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(n)}},se(ju,"None",Object.freeze({dispose(){}})),ju),$5=(md=class{constructor(){se(this,"_toDispose",new Set),se(this,"_isDisposed",!1)}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}clear(){if(this._toDispose.size!==0)try{for(const n of this._toDispose)n.dispose()}finally{this._toDispose.clear()}}add(n){if(!n)return n;if(n===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?md.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(n),n}},se(md,"DISABLE_DISPOSED_WARNING",!1),md),m4=new Map([[Cn.Empty,""],[Cn.QuickFix,"quickfix"],[Cn.Refactor,"refactor"],[Cn.RefactorExtract,"refactor.extract"],[Cn.RefactorInline,"refactor.inline"],[Cn.RefactorRewrite,"refactor.rewrite"],[Cn.Source,"source"],[Cn.SourceOrganizeImports,"source.organizeImports"],[Cn.SourceFixAll,"source.fixAll"]]),_4=new Map([[G.CodeActionTriggerType.Invoke,xS.Invoked],[G.CodeActionTriggerType.Auto,xS.Automatic]]),v4=new Map([[et.Text,G.CompletionItemKind.Text],[et.Method,G.CompletionItemKind.Method],[et.Function,G.CompletionItemKind.Function],[et.Constructor,G.CompletionItemKind.Constructor],[et.Field,G.CompletionItemKind.Field],[et.Variable,G.CompletionItemKind.Variable],[et.Class,G.CompletionItemKind.Class],[et.Interface,G.CompletionItemKind.Interface],[et.Module,G.CompletionItemKind.Module],[et.Property,G.CompletionItemKind.Property],[et.Unit,G.CompletionItemKind.Unit],[et.Value,G.CompletionItemKind.Value],[et.Enum,G.CompletionItemKind.Enum],[et.Keyword,G.CompletionItemKind.Keyword],[et.Snippet,G.CompletionItemKind.Snippet],[et.Color,G.CompletionItemKind.Color],[et.File,G.CompletionItemKind.File],[et.Reference,G.CompletionItemKind.Reference],[et.Folder,G.CompletionItemKind.Folder],[et.EnumMember,G.CompletionItemKind.EnumMember],[et.Constant,G.CompletionItemKind.Constant],[et.Struct,G.CompletionItemKind.Struct],[et.Event,G.CompletionItemKind.Event],[et.Operator,G.CompletionItemKind.Operator],[et.TypeParameter,G.CompletionItemKind.TypeParameter]]),b4=new Map([[z5.Deprecated,G.CompletionItemTag.Deprecated]]),C4=new Map([[G.CompletionTriggerKind.Invoke,Gu.Invoked],[G.CompletionTriggerKind.TriggerCharacter,Gu.TriggerCharacter],[G.CompletionTriggerKind.TriggerForIncompleteCompletions,Gu.TriggerForIncompleteCompletions]]),S4=new Map([[j5.Snippet,G.CompletionItemInsertTextRule.InsertAsSnippet]]),w4=new Map([[Je.File,G.SymbolKind.File],[Je.Module,G.SymbolKind.Module],[Je.Namespace,G.SymbolKind.Namespace],[Je.Package,G.SymbolKind.Package],[Je.Class,G.SymbolKind.Class],[Je.Method,G.SymbolKind.Method],[Je.Property,G.SymbolKind.Property],[Je.Field,G.SymbolKind.Field],[Je.Constructor,G.SymbolKind.Constructor],[Je.Enum,G.SymbolKind.Enum],[Je.Interface,G.SymbolKind.Interface],[Je.Function,G.SymbolKind.Function],[Je.Variable,G.SymbolKind.Variable],[Je.Constant,G.SymbolKind.Constant],[Je.String,G.SymbolKind.String],[Je.Number,G.SymbolKind.Number],[Je.Boolean,G.SymbolKind.Boolean],[Je.Array,G.SymbolKind.Array],[Je.Object,G.SymbolKind.Object],[Je.Key,G.SymbolKind.Key],[Je.Null,G.SymbolKind.Null],[Je.EnumMember,G.SymbolKind.EnumMember],[Je.Struct,G.SymbolKind.Struct],[Je.Event,G.SymbolKind.Event],[Je.Operator,G.SymbolKind.Operator],[Je.TypeParameter,G.SymbolKind.TypeParameter]]),y4=new Map([[U5.Deprecated,G.SymbolTag.Deprecated]]),x4=new Map([[Ku.Text,G.DocumentHighlightKind.Text],[Ku.Read,G.DocumentHighlightKind.Read],[Ku.Write,G.DocumentHighlightKind.Write]]),I4=new Map([[$u.Comment,G.FoldingRangeKind.Comment],[$u.Imports,G.FoldingRangeKind.Imports],[$u.Region,G.FoldingRangeKind.Region]]),L4=new Map([[os.Error,hs.Error],[os.Warning,hs.Warning],[os.Info,hs.Information],[os.Hint,hs.Hint]]),D4=new Map([[hs.Error,os.Error],[hs.Warning,os.Warning],[hs.Information,os.Info],[hs.Hint,os.Hint]]),E4=new Map([[yS.Unnecessary,Ev.Unnecessary],[yS.Deprecated,Ev.Deprecated]]),R4=new Map([[G.SignatureHelpTriggerKind.Invoke,Zu.Invoked],[G.SignatureHelpTriggerKind.TriggerCharacter,Zu.TriggerCharacter],[G.SignatureHelpTriggerKind.ContentChange,Zu.ContentChange]]),T4=new Map([[wS.Type,G.InlayHintKind.Type],[wS.Parameter,G.InlayHintKind.Parameter]]),P4=new Map([...Object.values(q5)].map(n=>[n.method,n])),na=null;typeof WebSocket<"u"?na=WebSocket:typeof MozWebSocket<"u"?na=MozWebSocket:typeof global<"u"?na=global.WebSocket||global.MozWebSocket:typeof window<"u"?na=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(na=self.WebSocket||self.MozWebSocket);var XD={},Xu={},K5=class YD{static getOrCreate(e){return Xu[e]||(Xu[e]=new YD(e)),Xu[e]}constructor(e){this._languageId=e,this._loadingTriggered=!1,this._lazyLoadPromise=new Promise((t,i)=>{this._lazyLoadPromiseResolve=t,this._lazyLoadPromiseReject=i})}load(){return this._loadingTriggered||(this._loadingTriggered=!0,XD[this._languageId].loader().then(e=>this._lazyLoadPromiseResolve(e),e=>this._lazyLoadPromiseReject(e))),this._lazyLoadPromise}};function j(n){const e=n.id;XD[e]=n,G.register(n);const t=K5.getOrCreate(e);G.registerTokensProviderFactory(e,{create:async()=>(await t.load()).language}),G.onLanguageEncountered(e,async()=>{const i=await t.load();G.setLanguageConfiguration(e,i.conf)})}j({id:"abap",extensions:[".abap"],aliases:["abap","ABAP"],loader:()=>z(()=>import("./abap-CNHfI6UP.js"),[])});j({id:"apex",extensions:[".cls"],aliases:["Apex","apex"],mimetypes:["text/x-apex-source","text/x-apex"],loader:()=>z(()=>import("./apex-DTJWTIPK.js"),[])});j({id:"azcli",extensions:[".azcli"],aliases:["Azure CLI","azcli"],loader:()=>z(()=>import("./azcli-Degrf7_O.js"),[])});j({id:"bat",extensions:[".bat",".cmd"],aliases:["Batch","bat"],loader:()=>z(()=>import("./bat-og3u3-iX.js"),[])});j({id:"bicep",extensions:[".bicep"],aliases:["Bicep"],loader:()=>z(()=>import("./bicep-DWKWUTZk.js"),[])});j({id:"cameligo",extensions:[".mligo"],aliases:["Cameligo"],loader:()=>z(()=>import("./cameligo-wkA_VlQe.js"),[])});j({id:"clojure",extensions:[".clj",".cljs",".cljc",".edn"],aliases:["clojure","Clojure"],loader:()=>z(()=>import("./clojure-DOzhadKJ.js"),[])});j({id:"coffeescript",extensions:[".coffee"],aliases:["CoffeeScript","coffeescript","coffee"],mimetypes:["text/x-coffeescript","text/coffeescript"],loader:()=>z(()=>import("./coffee-CS5CzV5M.js"),[])});j({id:"c",extensions:[".c",".h"],aliases:["C","c"],loader:()=>z(()=>import("./cpp-BMgiE7AJ.js"),[])});j({id:"cpp",extensions:[".cpp",".cc",".cxx",".hpp",".hh",".hxx"],aliases:["C++","Cpp","cpp"],loader:()=>z(()=>import("./cpp-BMgiE7AJ.js"),[])});j({id:"csharp",extensions:[".cs",".csx",".cake"],aliases:["C#","csharp"],loader:()=>z(()=>import("./csharp-Bsvbb6s9.js"),[])});j({id:"csp",extensions:[".csp"],aliases:["CSP","csp"],loader:()=>z(()=>import("./csp-BrZ2q231.js"),[])});j({id:"css",extensions:[".css"],aliases:["CSS","css"],mimetypes:["text/css"],loader:()=>z(()=>import("./css-Uqgocp1T.js"),[])});j({id:"cypher",extensions:[".cypher",".cyp"],aliases:["Cypher","OpenCypher"],loader:()=>z(()=>import("./cypher-BtFHfHba.js"),[])});j({id:"dart",extensions:[".dart"],aliases:["Dart","dart"],mimetypes:["text/x-dart-source","text/x-dart"],loader:()=>z(()=>import("./dart-C5lyYd0g.js"),[])});j({id:"dockerfile",extensions:[".dockerfile"],filenames:["Dockerfile"],aliases:["Dockerfile"],loader:()=>z(()=>import("./dockerfile-BvQ8yybz.js"),[])});j({id:"ecl",extensions:[".ecl"],aliases:["ECL","Ecl","ecl"],loader:()=>z(()=>import("./ecl-DkR5NtXz.js"),[])});j({id:"elixir",extensions:[".ex",".exs"],aliases:["Elixir","elixir","ex"],loader:()=>z(()=>import("./elixir-DwgH4lv4.js"),[])});j({id:"flow9",extensions:[".flow"],aliases:["Flow9","Flow","flow9","flow"],loader:()=>z(()=>import("./flow9-DdhMBw5Q.js"),[])});j({id:"fsharp",extensions:[".fs",".fsi",".ml",".mli",".fsx",".fsscript"],aliases:["F#","FSharp","fsharp"],loader:()=>z(()=>import("./fsharp-D3Xp09Vk.js"),[])});j({id:"freemarker2",extensions:[".ftl",".ftlh",".ftlx"],aliases:["FreeMarker2","Apache FreeMarker2"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagAutoInterpolationDollar),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-angle.interpolation-dollar",aliases:["FreeMarker2 (Angle/Dollar)","Apache FreeMarker2 (Angle/Dollar)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagAngleInterpolationDollar),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-bracket.interpolation-dollar",aliases:["FreeMarker2 (Bracket/Dollar)","Apache FreeMarker2 (Bracket/Dollar)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagBracketInterpolationDollar),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-angle.interpolation-bracket",aliases:["FreeMarker2 (Angle/Bracket)","Apache FreeMarker2 (Angle/Bracket)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagAngleInterpolationBracket),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-bracket.interpolation-bracket",aliases:["FreeMarker2 (Bracket/Bracket)","Apache FreeMarker2 (Bracket/Bracket)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagBracketInterpolationBracket),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-auto.interpolation-dollar",aliases:["FreeMarker2 (Auto/Dollar)","Apache FreeMarker2 (Auto/Dollar)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagAutoInterpolationDollar),__vite__mapDeps([5,1,2,3]))});j({id:"freemarker2.tag-auto.interpolation-bracket",aliases:["FreeMarker2 (Auto/Bracket)","Apache FreeMarker2 (Auto/Bracket)"],loader:()=>z(()=>import("./freemarker2-g_nJsTeC.js").then(n=>n.TagAutoInterpolationBracket),__vite__mapDeps([5,1,2,3]))});j({id:"go",extensions:[".go"],aliases:["Go"],loader:()=>z(()=>import("./go-DiDKwy3n.js"),[])});j({id:"graphql",extensions:[".graphql",".gql"],aliases:["GraphQL","graphql","gql"],mimetypes:["application/graphql"],loader:()=>z(()=>import("./graphql-BgFph-jF.js"),[])});j({id:"handlebars",extensions:[".handlebars",".hbs"],aliases:["Handlebars","handlebars","hbs"],mimetypes:["text/x-handlebars-template"],loader:()=>z(()=>import("./handlebars-RA6uoaMW.js"),__vite__mapDeps([6,1,2,3]))});j({id:"hcl",extensions:[".tf",".tfvars",".hcl"],aliases:["Terraform","tf","HCL","hcl"],loader:()=>z(()=>import("./hcl-D4fzt9AB.js"),[])});j({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:()=>z(()=>import("./html-DchTZAEc.js"),__vite__mapDeps([7,1,2,3]))});j({id:"ini",extensions:[".ini",".properties",".gitconfig"],filenames:["config",".gitattributes",".gitconfig",".editorconfig"],aliases:["Ini","ini"],loader:()=>z(()=>import("./ini-CjG9jGLJ.js"),[])});j({id:"java",extensions:[".java",".jav"],aliases:["Java","java"],mimetypes:["text/x-java-source","text/x-java"],loader:()=>z(()=>import("./java-DitR3Nwd.js"),[])});j({id:"javascript",extensions:[".js",".es6",".jsx",".mjs",".cjs"],firstLine:"^#!.*\\bnode",filenames:["jakefile"],aliases:["JavaScript","javascript","js"],mimetypes:["text/javascript"],loader:()=>z(()=>import("./javascript-l9pEcFVL.js"),__vite__mapDeps([8,9,1,2,3]))});j({id:"julia",extensions:[".jl"],aliases:["julia","Julia"],loader:()=>z(()=>import("./julia-_g8mQYsr.js"),[])});j({id:"kotlin",extensions:[".kt",".kts"],aliases:["Kotlin","kotlin"],mimetypes:["text/x-kotlin-source","text/x-kotlin"],loader:()=>z(()=>import("./kotlin-3o4lP58u.js"),[])});j({id:"less",extensions:[".less"],aliases:["Less","less"],mimetypes:["text/x-less","text/less"],loader:()=>z(()=>import("./less-CdRSAxY_.js"),[])});j({id:"lexon",extensions:[".lex"],aliases:["Lexon"],loader:()=>z(()=>import("./lexon-B1v3Gspe.js"),[])});j({id:"lua",extensions:[".lua"],aliases:["Lua","lua"],loader:()=>z(()=>import("./lua-D3D-_pEE.js"),[])});j({id:"liquid",extensions:[".liquid",".html.liquid"],aliases:["Liquid","liquid"],mimetypes:["application/liquid"],loader:()=>z(()=>import("./liquid-3wMbC9OJ.js"),__vite__mapDeps([10,1,2,3]))});j({id:"m3",extensions:[".m3",".i3",".mg",".ig"],aliases:["Modula-3","Modula3","modula3","m3"],loader:()=>z(()=>import("./m3-fsgnMtjU.js"),[])});j({id:"markdown",extensions:[".md",".markdown",".mdown",".mkdn",".mkd",".mdwn",".mdtxt",".mdtext"],aliases:["Markdown","markdown"],loader:()=>z(()=>import("./markdown-DTtmtPZi.js"),[])});j({id:"mdx",extensions:[".mdx"],aliases:["MDX","mdx"],loader:()=>z(()=>import("./mdx-B7jfJVLI.js"),__vite__mapDeps([11,1,2,3]))});j({id:"mips",extensions:[".s"],aliases:["MIPS","MIPS-V"],mimetypes:["text/x-mips","text/mips","text/plaintext"],loader:()=>z(()=>import("./mips-BA6kSOEZ.js"),[])});j({id:"msdax",extensions:[".dax",".msdax"],aliases:["DAX","MSDAX"],loader:()=>z(()=>import("./msdax-B96QDI_e.js"),[])});j({id:"mysql",extensions:[],aliases:["MySQL","mysql"],loader:()=>z(()=>import("./mysql-ZJG-Zmb7.js"),[])});j({id:"objective-c",extensions:[".m"],aliases:["Objective-C"],loader:()=>z(()=>import("./objective-c-D1BqZdFg.js"),[])});j({id:"pascal",extensions:[".pas",".p",".pp"],aliases:["Pascal","pas"],mimetypes:["text/x-pascal-source","text/x-pascal"],loader:()=>z(()=>import("./pascal-CXwopv-V.js"),[])});j({id:"pascaligo",extensions:[".ligo"],aliases:["Pascaligo","ligo"],loader:()=>z(()=>import("./pascaligo-DbxCO0kO.js"),[])});j({id:"perl",extensions:[".pl",".pm"],aliases:["Perl","pl"],loader:()=>z(()=>import("./perl-DL95F-1i.js"),[])});j({id:"pgsql",extensions:[],aliases:["PostgreSQL","postgres","pg","postgre"],loader:()=>z(()=>import("./pgsql-D6V7y-We.js"),[])});j({id:"php",extensions:[".php",".php4",".php5",".phtml",".ctp"],aliases:["PHP","php"],mimetypes:["application/x-php"],loader:()=>z(()=>import("./php-Cl4Rc77T.js"),[])});j({id:"pla",extensions:[".pla"],loader:()=>z(()=>import("./pla-C2-KEJLZ.js"),[])});j({id:"postiats",extensions:[".dats",".sats",".hats"],aliases:["ATS","ATS/Postiats"],loader:()=>z(()=>import("./postiats-CnwS6VBM.js"),[])});j({id:"powerquery",extensions:[".pq",".pqm"],aliases:["PQ","M","Power Query","Power Query M"],loader:()=>z(()=>import("./powerquery-IxSHxxBc.js"),[])});j({id:"powershell",extensions:[".ps1",".psm1",".psd1"],aliases:["PowerShell","powershell","ps","ps1"],loader:()=>z(()=>import("./powershell-DAkyXnxj.js"),[])});j({id:"proto",extensions:[".proto"],aliases:["protobuf","Protocol Buffers"],loader:()=>z(()=>import("./protobuf-FnPVBP5H.js"),[])});j({id:"pug",extensions:[".jade",".pug"],aliases:["Pug","Jade","jade"],loader:()=>z(()=>import("./pug-C_d8B8nZ.js"),[])});j({id:"python",extensions:[".py",".rpy",".pyw",".cpy",".gyp",".gypi"],aliases:["Python","py"],firstLine:"^#!/.*\\bpython[0-9.-]*\\b",loader:()=>z(()=>import("./python-DK9sRx0Y.js"),__vite__mapDeps([12,1,2,3]))});j({id:"qsharp",extensions:[".qs"],aliases:["Q#","qsharp"],loader:()=>z(()=>import("./qsharp-DHzbHTnS.js"),[])});j({id:"r",extensions:[".r",".rhistory",".rmd",".rprofile",".rt"],aliases:["R","r"],loader:()=>z(()=>import("./r-BreUQjgc.js"),[])});j({id:"razor",extensions:[".cshtml"],aliases:["Razor","razor"],mimetypes:["text/x-cshtml"],loader:()=>z(()=>import("./razor-CI-yLdex.js"),__vite__mapDeps([13,1,2,3]))});j({id:"redis",extensions:[".redis"],aliases:["redis"],loader:()=>z(()=>import("./redis-BdhjrevD.js"),[])});j({id:"redshift",extensions:[],aliases:["Redshift","redshift"],loader:()=>z(()=>import("./redshift-CwVMUyQc.js"),[])});j({id:"restructuredtext",extensions:[".rst"],aliases:["reStructuredText","restructuredtext"],loader:()=>z(()=>import("./restructuredtext-D6U9PIiF.js"),[])});j({id:"ruby",extensions:[".rb",".rbx",".rjs",".gemspec",".pp"],filenames:["rakefile","Gemfile"],aliases:["Ruby","rb"],loader:()=>z(()=>import("./ruby-D0QS81Wd.js"),[])});j({id:"rust",extensions:[".rs",".rlib"],aliases:["Rust","rust"],loader:()=>z(()=>import("./rust-Bsq9cLDY.js"),[])});j({id:"sb",extensions:[".sb"],aliases:["Small Basic","sb"],loader:()=>z(()=>import("./sb-DAQADLLd.js"),[])});j({id:"scala",extensions:[".scala",".sc",".sbt"],aliases:["Scala","scala","SBT","Sbt","sbt","Dotty","dotty"],mimetypes:["text/x-scala-source","text/x-scala","text/x-sbt","text/x-dotty"],loader:()=>z(()=>import("./scala-oEMLo0pl.js"),[])});j({id:"scheme",extensions:[".scm",".ss",".sch",".rkt"],aliases:["scheme","Scheme"],loader:()=>z(()=>import("./scheme-DDI6muad.js"),[])});j({id:"scss",extensions:[".scss"],aliases:["Sass","sass","scss"],mimetypes:["text/x-scss","text/scss"],loader:()=>z(()=>import("./scss-BU9Ttlwm.js"),[])});j({id:"shell",extensions:[".sh",".bash"],aliases:["Shell","sh"],loader:()=>z(()=>import("./shell-BI6rOefn.js"),[])});j({id:"sol",extensions:[".sol"],aliases:["sol","solidity","Solidity"],loader:()=>z(()=>import("./solidity-B17zzzu-.js"),[])});j({id:"aes",extensions:[".aes"],aliases:["aes","sophia","Sophia"],loader:()=>z(()=>import("./sophia-DQi6mooo.js"),[])});j({id:"sparql",extensions:[".rq"],aliases:["sparql","SPARQL"],loader:()=>z(()=>import("./sparql-DGFBDMPi.js"),[])});j({id:"sql",extensions:[".sql"],aliases:["SQL"],loader:()=>z(()=>import("./sql-DGzRlxQo.js"),[])});j({id:"st",extensions:[".st",".iecst",".iecplc",".lc3lib",".TcPOU",".TcDUT",".TcGVL",".TcIO"],aliases:["StructuredText","scl","stl"],loader:()=>z(()=>import("./st-Ceq2dhS_.js"),[])});j({id:"swift",aliases:["Swift","swift"],extensions:[".swift"],mimetypes:["text/swift"],loader:()=>z(()=>import("./swift-8-FeeRSy.js"),[])});j({id:"systemverilog",extensions:[".sv",".svh"],aliases:["SV","sv","SystemVerilog","systemverilog"],loader:()=>z(()=>import("./systemverilog-mmioB6wo.js"),[])});j({id:"verilog",extensions:[".v",".vh"],aliases:["V","v","Verilog","verilog"],loader:()=>z(()=>import("./systemverilog-mmioB6wo.js"),[])});j({id:"tcl",extensions:[".tcl"],aliases:["tcl","Tcl","tcltk","TclTk","tcl/tk","Tcl/Tk"],loader:()=>z(()=>import("./tcl-BTUJQo2X.js"),[])});j({id:"twig",extensions:[".twig"],aliases:["Twig","twig"],mimetypes:["text/x-twig"],loader:()=>z(()=>import("./twig-C6ea54bM.js"),[])});j({id:"typescript",extensions:[".ts",".tsx",".cts",".mts"],aliases:["TypeScript","ts","typescript"],mimetypes:["text/typescript"],loader:()=>z(()=>import("./typescript-U3aTTn2d.js"),__vite__mapDeps([9,1,2,3]))});j({id:"typespec",extensions:[".tsp"],aliases:["TypeSpec"],loader:()=>z(()=>import("./typespec-B4z8l2XF.js"),[])});j({id:"vb",extensions:[".vb"],aliases:["Visual Basic","vb"],loader:()=>z(()=>import("./vb-BbQNgbjG.js"),[])});j({id:"wgsl",extensions:[".wgsl"],aliases:["WebGPU Shading Language","WGSL","wgsl"],loader:()=>z(()=>import("./wgsl-SWAFFAY4.js"),[])});j({id:"xml",extensions:[".xml",".xsd",".dtd",".ascx",".csproj",".config",".props",".targets",".wxi",".wxl",".wxs",".xaml",".svg",".svgz",".opf",".xslt",".xsl"],firstLine:"(\\<\\?xml.*)|(\\<svg)|(\\<\\!doctype\\s+svg)",aliases:["XML","xml"],mimetypes:["text/xml","application/xml","application/xaml+xml","application/xml-dtd"],loader:()=>z(()=>import("./xml-DM-qLhlQ.js"),__vite__mapDeps([14,1,2,3]))});j({id:"yaml",extensions:[".yaml",".yml"],aliases:["YAML","yaml","YML","yml"],mimetypes:["application/x-yaml","text/x-yaml"],loader:()=>z(()=>import("./yaml-BB3LUpV7.js"),__vite__mapDeps([15,1,2,3]))});var Q_=class{constructor(n,e,t){this._onDidChange=new ja,this._languageId=n,this.setOptions(e),this.setModeConfiguration(t)}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(n){this._options=n||Object.create(null),this._onDidChange.fire(this)}setDiagnosticsOptions(n){this.setOptions(n)}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(this)}},ev={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}},tv={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},G5=new Q_("css",ev,tv),Z5=new Q_("scss",ev,tv),X5=new Q_("less",ev,tv);function iv(){return z(()=>import("./cssMode-BoXwzMyE.js"),__vite__mapDeps([16,4,1,2,3,17]))}G.onLanguage("less",()=>{iv().then(n=>n.setupMode(X5))});G.onLanguage("scss",()=>{iv().then(n=>n.setupMode(Z5))});G.onLanguage("css",()=>{iv().then(n=>n.setupMode(G5))});var Y5=class{constructor(n,e,t){this._onDidChange=new ja,this._languageId=n,this.setOptions(e),this.setModeConfiguration(t)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get options(){return this._options}get modeConfiguration(){return this._modeConfiguration}setOptions(n){this._options=n||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(this)}},Bh={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 Uh(n){return{completionItems:!0,hovers:!0,documentSymbols:!0,links:!0,documentHighlights:!0,rename:!0,colors:!0,foldingRanges:!0,selectionRanges:!0,diagnostics:n===Ma,documentFormattingEdits:n===Ma,documentRangeFormattingEdits:n===Ma}}var Ma="html",IS="handlebars",LS="razor",J5=nv(Ma,Bh,Uh(Ma)),k4=J5.defaults,Q5=nv(IS,Bh,Uh(IS)),N4=Q5.defaults,eU=nv(LS,Bh,Uh(LS)),M4=eU.defaults;function tU(){return z(()=>import("./htmlMode-BcLYF6v1.js"),__vite__mapDeps([18,4,1,2,3,17]))}function nv(n,e=Bh,t=Uh(n)){const i=new Y5(n,e,t);let s;const o=G.onLanguage(n,async()=>{s=(await tU()).setupMode(i)});return{defaults:i,dispose(){o.dispose(),s?.dispose(),s=void 0}}}var iU=class{constructor(n,e,t){this._onDidChange=new ja,this._languageId=n,this.setDiagnosticsOptions(e),this.setModeConfiguration(t)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(n){this._diagnosticsOptions=n||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(n){this._modeConfiguration=n||Object.create(null),this._onDidChange.fire(this)}},nU=new iU("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});function sU(){return z(()=>import("./jsonMode-D4edoDNQ.js"),__vite__mapDeps([19,4,1,2,3,17]))}G.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]});G.onLanguage("json",()=>{sU().then(n=>n.setupMode(nU))});var DS="__monacoFindWidgetTabIndexPatchApplied",sa="__monacoFindWidgetOriginalTabIndex";function ES(n,e){const t=n?._domNode;if(!t)return;const i=t.querySelectorAll('input, textarea, [tabindex], [role="button"], [role="checkbox"]');for(const s of i)if(s instanceof HTMLElement)if(e){if(!(sa in s.dataset))continue;const o=s.dataset[sa];o===""?s.removeAttribute("tabindex"):s.tabIndex=Number(o),delete s.dataset[sa]}else sa in s.dataset||(s.dataset[sa]=s.getAttribute("tabindex")??""),s.tabIndex=-1}if(!qs[DS]){const n=qs.prototype._reveal,e=qs.prototype._hide;qs.prototype._reveal=function(...t){n.apply(this,t),ES(this,!0)},qs.prototype._hide=function(...t){e.apply(this,t),ES(this,!1)},qs[DS]=!0}function oU(n){return new Worker("/assets/editor.worker-ByY_fgkM.js",{name:n?.name})}function rU(n){return new Worker("/assets/json.worker-BKCy_srb.js",{name:n?.name})}self.MonacoEnvironment={getWorker:(n,e)=>e==="json"?new rU:new oU};var aU="db-studio-dark",lU="db-studio-light",RS=!1,O4=()=>{if(RS)return;RS=!0;const n={"editor.background":"#00000000","editorGutter.background":"#00000000","editor.lineHighlightBackground":"#00000000","editorOverviewRuler.background":"#00000000"};kv.defineTheme(aU,{base:"vs-dark",inherit:!0,rules:[],colors:n}),kv.defineTheme(lU,{base:"vs",inherit:!0,rules:[],colors:n})};export{x5 as i,lU as n,O4 as r,aU as t};
|