@vizejs/vite-plugin-musea 0.345.0 → 0.350.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/a11y/index.d.mts +1 -1
  2. package/dist/a11y/index.mjs +1 -1
  3. package/dist/{a11y-62l8G1tr.mjs → a11y-Cht-W4kd.mjs} +1 -1
  4. package/dist/{a11y-62l8G1tr.mjs.map → a11y-Cht-W4kd.mjs.map} +1 -1
  5. package/dist/autogen/index.d.mts.map +1 -1
  6. package/dist/autogen/index.mjs +1 -1
  7. package/dist/{autogen-B7_TO0n5.mjs → autogen-B-N0cJbZ.mjs} +1 -1
  8. package/dist/{autogen-B7_TO0n5.mjs.map → autogen-B-N0cJbZ.mjs.map} +1 -1
  9. package/dist/cli/index.d.mts.map +1 -1
  10. package/dist/cli/index.mjs +1 -1
  11. package/dist/cli/index.mjs.map +1 -1
  12. package/dist/gallery/assets/MonacoEditor--hIp2XW8.js +2 -0
  13. package/dist/gallery/assets/MonacoEditor-Db3Q217Z.css +1 -0
  14. package/dist/gallery/assets/codicon-Brq4_Ui5.ttf +0 -0
  15. package/dist/gallery/assets/{css.worker-Wv5dxAWO.js → css.worker-BjrR-8m8.js} +36 -32
  16. package/dist/gallery/assets/cssMode-ZHNilfqs.js +1 -0
  17. package/dist/gallery/assets/editor-8AbsNvUX.css +1 -0
  18. package/dist/gallery/assets/editor.api-D1ZVmYNy.js +847 -0
  19. package/dist/gallery/assets/editor.worker-s_hwqnK9.js +30 -0
  20. package/dist/gallery/assets/{freemarker2-BZ6nC3A3.js → freemarker2-DTuUuWg9.js} +1 -1
  21. package/dist/gallery/assets/handlebars-LhSSvR3a.js +1 -0
  22. package/dist/gallery/assets/html-CSSv3RQ6.js +1 -0
  23. package/dist/gallery/assets/{html.worker-CQP8QQsS.js → html.worker-BFmRaMni.js} +28 -24
  24. package/dist/gallery/assets/htmlMode-0CF_bjtn.js +1 -0
  25. package/dist/gallery/assets/{index-De8nZlO8.js → index-aDilKAxX.js} +26 -25
  26. package/dist/gallery/assets/{javascript-BnHRMqEr.js → javascript-DVhxh8Pu.js} +1 -1
  27. package/dist/gallery/assets/json.worker-CD0GJfW6.js +62 -0
  28. package/dist/gallery/assets/{jsonMode-jcQUywhl.js → jsonMode-QJbmCz1q.js} +1 -1
  29. package/dist/gallery/assets/liquid-B52Ojsd5.js +1 -0
  30. package/dist/gallery/assets/lspLanguageFeatures-C5GMmpHQ.js +4 -0
  31. package/dist/gallery/assets/mdx-DNKO_bCY.js +1 -0
  32. package/dist/gallery/assets/python-5n83nryU.js +1 -0
  33. package/dist/gallery/assets/razor-Cv2UCBnr.js +1 -0
  34. package/dist/gallery/assets/register-DCDIi0Et.js +2 -0
  35. package/dist/gallery/assets/toggleHighContrast-CFGa3V3O.css +1 -0
  36. package/dist/gallery/assets/toggleHighContrast-DTCsvl0z.js +51 -0
  37. package/dist/gallery/assets/{ts.worker-METxwbDZ.js → ts.worker-BFy34-VB.js} +190 -171
  38. package/dist/gallery/assets/{tsMode-Kibx_hev.js → tsMode-D3AmenYN.js} +1 -1
  39. package/dist/gallery/assets/typescript-DPV4YtP_.js +1 -0
  40. package/dist/gallery/assets/vs-Ce8dYDBN.js +6 -0
  41. package/dist/gallery/assets/workers-BY7_4E6g.js +1 -0
  42. package/dist/gallery/assets/xml-CYxaE2hx.js +1 -0
  43. package/dist/gallery/assets/yaml-BilRBwjA.js +1 -0
  44. package/dist/gallery/index.html +1 -1
  45. package/dist/{gallery-onvFYjip.mjs → gallery-3Sqabvai.mjs} +2 -2
  46. package/dist/{gallery-onvFYjip.mjs.map → gallery-3Sqabvai.mjs.map} +1 -1
  47. package/dist/{index-leLThbJH.d.mts → index-75q-ZCzF.d.mts} +2 -2
  48. package/dist/index-75q-ZCzF.d.mts.map +1 -0
  49. package/dist/index.d.mts +2 -2
  50. package/dist/index.d.mts.map +1 -1
  51. package/dist/index.mjs +5 -5
  52. package/dist/index.mjs.map +1 -1
  53. package/dist/{template-CFSGRuGu.mjs → template-ByMVejqE.mjs} +1 -1
  54. package/dist/{template-CFSGRuGu.mjs.map → template-ByMVejqE.mjs.map} +1 -1
  55. package/dist/{vrt-C5O4NHsc.d.mts → vrt-D454uyH6.d.mts} +1 -1
  56. package/dist/vrt-D454uyH6.d.mts.map +1 -0
  57. package/dist/{vrt-Cv1PK1EF.mjs → vrt-DgVSWKGl.mjs} +1 -1
  58. package/dist/{vrt-Cv1PK1EF.mjs.map → vrt-DgVSWKGl.mjs.map} +1 -1
  59. package/dist/vrt.d.mts +2 -2
  60. package/dist/vrt.mjs +1 -1
  61. package/package.json +10 -10
  62. package/dist/gallery/assets/MonacoEditor-DsbIpkQL.js +0 -2
  63. package/dist/gallery/assets/MonacoEditor-iu5ZxbsG.css +0 -1
  64. package/dist/gallery/assets/codicon-ngg6Pgfi.ttf +0 -0
  65. package/dist/gallery/assets/cssMode-BEYj0tak.js +0 -1
  66. package/dist/gallery/assets/editor-BnkT-hT5.css +0 -1
  67. package/dist/gallery/assets/editor.api2-Bz2kYzUN.js +0 -872
  68. package/dist/gallery/assets/editor.main-BVHs2SSr.js +0 -6
  69. package/dist/gallery/assets/editor.worker-Bd9IXS8d.js +0 -26
  70. package/dist/gallery/assets/handlebars-DEfvHxqu.js +0 -1
  71. package/dist/gallery/assets/html-BQHhPRs4.js +0 -1
  72. package/dist/gallery/assets/htmlMode-BJg8FTpN.js +0 -1
  73. package/dist/gallery/assets/json.worker-DzV-CpCQ.js +0 -58
  74. package/dist/gallery/assets/liquid-DBFdARj0.js +0 -1
  75. package/dist/gallery/assets/lspLanguageFeatures-BAQ0wWN5.js +0 -4
  76. package/dist/gallery/assets/mdx-B4klyOk6.js +0 -1
  77. package/dist/gallery/assets/monaco.contribution-DurMprOc.js +0 -2
  78. package/dist/gallery/assets/python-DVtrR2b4.js +0 -1
  79. package/dist/gallery/assets/razor-DvGAQ27Z.js +0 -1
  80. package/dist/gallery/assets/typescript-qDteoCEw.js +0 -1
  81. package/dist/gallery/assets/workers-Cruk8RxZ.js +0 -1
  82. package/dist/gallery/assets/xml-CTVXfCOD.js +0 -1
  83. package/dist/gallery/assets/yaml-BuZYNjL4.js +0 -1
  84. package/dist/index-leLThbJH.d.mts.map +0 -1
  85. package/dist/vrt-C5O4NHsc.d.mts.map +0 -1
  86. /package/dist/gallery/assets/{abap-DVwoIrM0.js → abap-08VXUWAP.js} +0 -0
  87. /package/dist/gallery/assets/{apex-DnfrpC_v.js → apex-BWPQTe0t.js} +0 -0
  88. /package/dist/gallery/assets/{azcli-CE6n6ErR.js → azcli-Bc_sGQ0U.js} +0 -0
  89. /package/dist/gallery/assets/{bat-ainFW1qj.js → bat-i0X4ZdIN.js} +0 -0
  90. /package/dist/gallery/assets/{bicep-Lzdk7NqX.js → bicep-B5-_aFwp.js} +0 -0
  91. /package/dist/gallery/assets/{cameligo-BjyZ5cgY.js → cameligo-DMUM7wLl.js} +0 -0
  92. /package/dist/gallery/assets/{clojure-B-6owjux.js → clojure-Cm7r79vr.js} +0 -0
  93. /package/dist/gallery/assets/{coffee-npIvPqmH.js → coffee-Ba7i2nA0.js} +0 -0
  94. /package/dist/gallery/assets/{cpp--A8GPZYM.js → cpp-C7h46wYY.js} +0 -0
  95. /package/dist/gallery/assets/{csharp-Daa9qY-p.js → csharp-BKxtCVv1.js} +0 -0
  96. /package/dist/gallery/assets/{csp-N0NfYrCc.js → csp-bTuwJoIa.js} +0 -0
  97. /package/dist/gallery/assets/{css-CUssoHYv.js → css-DIMkf-bt.js} +0 -0
  98. /package/dist/gallery/assets/{cypher-CmQpMFeE.js → cypher-CVaqCwHa.js} +0 -0
  99. /package/dist/gallery/assets/{dart-DOjZJNmR.js → dart-onAF5SnQ.js} +0 -0
  100. /package/dist/gallery/assets/{dockerfile-CxIfCbxU.js → dockerfile-DZFCIeNp.js} +0 -0
  101. /package/dist/gallery/assets/{ecl-AnA3JP56.js → ecl-D05T4iGw.js} +0 -0
  102. /package/dist/gallery/assets/{elixir-D-N3eh22.js → elixir-6RTg0lbw.js} +0 -0
  103. /package/dist/gallery/assets/{flow9-BR6FT9qg.js → flow9-C5_-GSwl.js} +0 -0
  104. /package/dist/gallery/assets/{fsharp-DR0IQ95q.js → fsharp-C8Ef5oNN.js} +0 -0
  105. /package/dist/gallery/assets/{go-B27OpVON.js → go-C-y9NEjX.js} +0 -0
  106. /package/dist/gallery/assets/{graphql-Cw7HtomI.js → graphql-fmXr3nnJ.js} +0 -0
  107. /package/dist/gallery/assets/{hcl-CDDd0gYG.js → hcl-CpzslTdj.js} +0 -0
  108. /package/dist/gallery/assets/{ini-ChiSjCUM.js → ini-sBoK_t0W.js} +0 -0
  109. /package/dist/gallery/assets/{java-CKVuuvX6.js → java-BEtHBSE6.js} +0 -0
  110. /package/dist/gallery/assets/{julia-BcKGx43g.js → julia-Bri6UV-V.js} +0 -0
  111. /package/dist/gallery/assets/{kotlin-DemwFMfK.js → kotlin-BOotOW0E.js} +0 -0
  112. /package/dist/gallery/assets/{less-BFpYPxgE.js → less-B9JPFI3C.js} +0 -0
  113. /package/dist/gallery/assets/{lexon-DDPF3See.js → lexon-CfSJPG6W.js} +0 -0
  114. /package/dist/gallery/assets/{lua-CmzM4S9z.js → lua-CsQS60Ue.js} +0 -0
  115. /package/dist/gallery/assets/{m3-C75GLUav.js → m3-D-oSqn_W.js} +0 -0
  116. /package/dist/gallery/assets/{markdown-B6XL0Y9j.js → markdown-Cimd5fb3.js} +0 -0
  117. /package/dist/gallery/assets/{mips-BG4Fy7Bl.js → mips-CIPQ_RoX.js} +0 -0
  118. /package/dist/gallery/assets/{msdax-H0aqYz0U.js → msdax-DauUninz.js} +0 -0
  119. /package/dist/gallery/assets/{mysql-CDbOhBhf.js → mysql-SOo6toE5.js} +0 -0
  120. /package/dist/gallery/assets/{objective-c-DKE6-VEf.js → objective-c-FvmIjYaQ.js} +0 -0
  121. /package/dist/gallery/assets/{pascal-DBuqflGM.js → pascal-DrH0SRf2.js} +0 -0
  122. /package/dist/gallery/assets/{pascaligo-BVtulzHb.js → pascaligo-D-ptJ9y-.js} +0 -0
  123. /package/dist/gallery/assets/{perl-xkTv78ng.js → perl-oz_6vUea.js} +0 -0
  124. /package/dist/gallery/assets/{pgsql-Cxti3J5E.js → pgsql-DTj74zXo.js} +0 -0
  125. /package/dist/gallery/assets/{php-Bh5BD3dg.js → php-nr791fC2.js} +0 -0
  126. /package/dist/gallery/assets/{pla-DSsYzlXV.js → pla-CopQ2nXW.js} +0 -0
  127. /package/dist/gallery/assets/{postiats-De0qivlp.js → postiats-43DmfD33.js} +0 -0
  128. /package/dist/gallery/assets/{powerquery-KGKq89F-.js → powerquery-D3hlyOfw.js} +0 -0
  129. /package/dist/gallery/assets/{powershell-Djwhihrv.js → powershell-DmHpPYUd.js} +0 -0
  130. /package/dist/gallery/assets/{protobuf-Jbp01qUU.js → protobuf-C531GsRP.js} +0 -0
  131. /package/dist/gallery/assets/{pug-BntfJCN7.js → pug-Z5eAx3Zn.js} +0 -0
  132. /package/dist/gallery/assets/{qsharp-CHH1r_aq.js → qsharp-DkqhCAOL.js} +0 -0
  133. /package/dist/gallery/assets/{r-BbeUcBN9.js → r-BwWrilGY.js} +0 -0
  134. /package/dist/gallery/assets/{redis-DR9m_VtD.js → redis-ClamHrr6.js} +0 -0
  135. /package/dist/gallery/assets/{redshift-D97Qa-FW.js → redshift-DT7zqm-g.js} +0 -0
  136. /package/dist/gallery/assets/{restructuredtext-DQ1MtboI.js → restructuredtext-BYgofb2h.js} +0 -0
  137. /package/dist/gallery/assets/{ruby-ByLGeogt.js → ruby-DezsRK8O.js} +0 -0
  138. /package/dist/gallery/assets/{rust-CIqtS9ON.js → rust-DdL9SqIa.js} +0 -0
  139. /package/dist/gallery/assets/{sb-ByVTEZ1d.js → sb-CcwsVR0C.js} +0 -0
  140. /package/dist/gallery/assets/{scala-DvkPypTh.js → scala-DHpiXF5c.js} +0 -0
  141. /package/dist/gallery/assets/{scheme-CQy1Ya2H.js → scheme-BeGwcela.js} +0 -0
  142. /package/dist/gallery/assets/{scss-DLIO8qmP.js → scss-gp-XZpBa.js} +0 -0
  143. /package/dist/gallery/assets/{shell-BZaILY8J.js → shell-CC2rA5mh.js} +0 -0
  144. /package/dist/gallery/assets/{solidity-D80FpOWz.js → solidity-BEEn4gHE.js} +0 -0
  145. /package/dist/gallery/assets/{sophia-DXh1T4eB.js → sophia-CRfGWb83.js} +0 -0
  146. /package/dist/gallery/assets/{sparql-DHSgmKlJ.js → sparql-D_Lu-MrJ.js} +0 -0
  147. /package/dist/gallery/assets/{sql-9GboOSCN.js → sql-NEE52Syq.js} +0 -0
  148. /package/dist/gallery/assets/{st--m1Z2h3c.js → st-DbInun42.js} +0 -0
  149. /package/dist/gallery/assets/{swift-DMo7Bf1r.js → swift-Bxkupp3x.js} +0 -0
  150. /package/dist/gallery/assets/{systemverilog-D6kP5wsA.js → systemverilog-Bz4Y3fRF.js} +0 -0
  151. /package/dist/gallery/assets/{tcl-HAhMyY2Y.js → tcl-DISqw1ZD.js} +0 -0
  152. /package/dist/gallery/assets/{twig-RNzllx71.js → twig-De2hgUGE.js} +0 -0
  153. /package/dist/gallery/assets/{typespec-DeyXqKVJ.js → typespec-B8J7ngcE.js} +0 -0
  154. /package/dist/gallery/assets/{vb-BfpeX2r9.js → vb-DV3o63ZY.js} +0 -0
  155. /package/dist/gallery/assets/{wgsl-B52428dy.js → wgsl-DpFanUEy.js} +0 -0
@@ -0,0 +1,51 @@
1
+ import{$ as e,$a as t,$c as n,$d as r,$i as i,$l as a,$n as o,$o as s,$r as c,$s as l,$t as u,$u as d,A as f,Aa as p,Ac as m,Ad as h,Ai as g,Al as _,An as v,Ao as y,Ar as b,As as ee,At as te,Au as ne,B as re,Ba as ie,Bc as ae,Bd as oe,Bi as se,Bl as ce,Bn as le,Bo as ue,Br as de,Bs as fe,Bt as pe,Bu as me,C as he,Ca as ge,Cc as _e,Cd as ve,Ci as ye,Cl as be,Cn as xe,Co as Se,Cr as Ce,Cs as we,Ct as Te,Cu as Ee,D as De,Da as Oe,Dc as ke,Dd as Ae,Di as je,Dl as Me,Dn as Ne,Do as Pe,Dr as Fe,Ds as Ie,Dt as Le,Du as Re,E as ze,Ea as Be,Ec as x,Ed as S,Ei as Ve,El as He,En as Ue,Eo as We,Er as Ge,Es as Ke,Et as qe,Eu as Je,F as Ye,Fa as Xe,Fc as C,Fd as Ze,Fi as Qe,Fl as $e,Fn as et,Fo as tt,Fr as nt,Fs as rt,Ft as it,Fu as at,G as ot,Ga as st,Gc as w,Gd as ct,Gi as lt,Gl as ut,Gn as dt,Go as ft,Gr as pt,Gs as mt,Gt as ht,Gu as gt,H as _t,Ha as vt,Hc as yt,Hd as bt,Hi as xt,Hl as St,Hn as Ct,Ho as wt,Hr as Tt,Hs as T,Ht as Et,Hu as Dt,I as Ot,Ia as E,Ic as D,Id as kt,Ii as At,Il as jt,In as Mt,Io as Nt,Ir as Pt,Is as Ft,It,Iu as Lt,J as Rt,Jc as zt,Jd as Bt,Ji as Vt,Jl as Ht,Jn as Ut,Jo as Wt,Jr as Gt,Js as O,Jt as Kt,Ju as qt,K as Jt,Ka as Yt,Kc as Xt,Kd as Zt,Ki as Qt,Kl as k,Kn as $t,Ko as en,Kr as tn,Ks as nn,Kt as rn,Ku as an,L as on,La as sn,Lc as cn,Ld as ln,Li as un,Ll as dn,Ln as fn,Lo as pn,Lr as mn,Ls as hn,Lt as gn,Lu as _n,M as vn,Ma as yn,Mc as A,Md as bn,Mi as xn,Ml as Sn,Mn as Cn,Mo as wn,Mr as Tn,Ms as En,Mt as Dn,Mu as On,N as kn,Na as An,Nc as jn,Nd as Mn,Ni as Nn,Nl as Pn,Nn as Fn,No as In,Nr as Ln,Ns as Rn,Nt as zn,Nu as Bn,O as Vn,Oa as Hn,Oc as Un,Od as Wn,Oi as Gn,Ol as Kn,On as qn,Oo as Jn,Or as Yn,Os as Xn,Ot as Zn,Ou as Qn,P as $n,Pa as er,Pc as tr,Pd as nr,Pi as rr,Pl as ir,Pn as ar,Po as or,Pr as sr,Ps as cr,Pt as lr,Pu as ur,Q as dr,Qa as fr,Qc as pr,Qd as mr,Qi as hr,Ql as gr,Qn as _r,Qo as vr,Qr as yr,Qs as br,Qt as xr,Qu as Sr,R as Cr,Ra as wr,Rc as Tr,Rd as Er,Ri as Dr,Rl as Or,Rn as kr,Ro as Ar,Rr as jr,Rs as Mr,Rt as Nr,Ru as Pr,S as Fr,Sa as Ir,Sc as Lr,Sd as Rr,Si as zr,Sl as Br,Sn as Vr,So as Hr,Sr as Ur,Ss as Wr,St as Gr,Su as Kr,T as qr,Ta as Jr,Tc as Yr,Td as j,Ti as Xr,Tl as Zr,Tn as Qr,To as $r,Tr as ei,Ts as ti,Tt as ni,Tu as ri,U as ii,Ua as ai,Uc as M,Ud as oi,Ui as si,Ul as ci,Un as li,Uo as ui,Ur as di,Us as N,Ut as fi,Uu as pi,V as mi,Va as hi,Vc as gi,Vd as _i,Vi as vi,Vl as yi,Vn as bi,Vo as xi,Vr as Si,Vs as P,Vt as Ci,Vu as wi,W as Ti,Wa as Ei,Wc as Di,Wd as Oi,Wi as ki,Wl as Ai,Wn as ji,Wo as Mi,Wr as Ni,Ws as Pi,Wt as Fi,Wu as Ii,X as Li,Xa as Ri,Xc as zi,Xd as Bi,Xi as Vi,Xl as Hi,Xn as Ui,Xo as Wi,Xr as Gi,Xs as F,Xt as Ki,Xu as qi,Y as Ji,Ya as Yi,Yc as I,Yd as Xi,Yi as Zi,Yl as L,Yn as Qi,Yo as $i,Yr as ea,Ys as R,Yt as ta,Yu as na,Z as ra,Za as ia,Zc as aa,Zd as oa,Zi as sa,Zl as ca,Zn as la,Zo as z,Zr as ua,Zs as da,Zt as fa,Zu as pa,_a as ma,_c as ha,_d as B,_f as V,_i as ga,_l as _a,_n as va,_o as ya,_r as ba,_s as xa,_t as Sa,_u as Ca,aa as wa,ac as Ta,ad as Ea,af as Da,ai as Oa,al as H,an as ka,ao as Aa,ar as ja,as as Ma,at as Na,au as Pa,b as Fa,ba as Ia,bc as La,bd as U,bi as Ra,bl as za,bn as Ba,bo as Va,br as Ha,bs as Ua,bt as Wa,bu as Ga,ca as Ka,cc as qa,cd as Ja,cf as Ya,ci as Xa,cl as Za,cn as Qa,co as $a,cr as eo,cs as to,ct as no,cu as ro,da as io,dc as ao,dd as oo,df as so,di as co,dl as lo,dn as uo,do as fo,dr as po,ds as mo,dt as ho,du as go,ea as _o,ec as vo,ed as yo,ef as bo,ei as xo,el as So,en as Co,eo as wo,er as To,es as Eo,et as Do,eu as Oo,fa as ko,fc as Ao,fd as jo,ff as Mo,fi as No,fl as Po,fn as Fo,fo as Io,fr as Lo,fs as Ro,ft as zo,fu as Bo,g as Vo,ga as Ho,gc as Uo,gd as Wo,gf as Go,gi as Ko,gl as qo,gn as Jo,go as Yo,gr as Xo,gs as Zo,gt as Qo,gu as $o,h as es,ha as ts,hc as ns,hd as rs,hf as is,hi as as,hl as os,hn as ss,ho as cs,hr as ls,hs as us,ht as ds,hu as fs,ia as ps,ic as ms,id as hs,if as gs,ii as _s,il as vs,in as ys,io as W,ir as bs,is as xs,it as Ss,iu as Cs,j as ws,ja as Ts,jc as G,jd as Es,ji as Ds,jl as Os,jn as ks,jo as As,jr as js,js as Ms,jt as Ns,ju as Ps,k as Fs,ka as Is,kc as Ls,kd as Rs,ki as zs,kl as Bs,kn as Vs,ko as Hs,kr as Us,ks as Ws,kt as Gs,ku as Ks,la as qs,lc as Js,ld as Ys,lf as Xs,li as Zs,ll as Qs,ln as $s,lo as ec,lr as tc,ls as nc,lt as rc,lu as ic,ma as ac,mc as oc,md as sc,mf as cc,mi as lc,ml as uc,mn as dc,mo as fc,mr as pc,ms as mc,mt as hc,mu as gc,na as _c,nc as vc,nd as yc,nf as bc,ni as xc,nl as K,nn as Sc,no as q,nr as Cc,ns as wc,nt as Tc,nu as Ec,oa as Dc,oc as Oc,od as kc,of as Ac,oi as jc,ol as Mc,on as Nc,oo as Pc,or as Fc,os as Ic,ot as Lc,ou as Rc,pa as zc,pc as Bc,pd as Vc,pf as Hc,pi as Uc,pl as Wc,pn as Gc,po as Kc,pr as qc,ps as Jc,pt as Yc,pu as Xc,q as Zc,qa as Qc,qc as $c,qd as el,qi as tl,ql as nl,qn as rl,qo as il,qr as al,qs as ol,qt as sl,qu as cl,ra as ll,rc as ul,rd as dl,rf as fl,ri as pl,rl as ml,rn as hl,ro as gl,rr as _l,rs as vl,rt as yl,ru as bl,sa as xl,sc as Sl,sd as Cl,sf as wl,si as Tl,sl as El,sn as Dl,so as Ol,sr as kl,ss as Al,st as jl,su as Ml,ta as Nl,tc as Pl,td as Fl,tf as Il,ti as Ll,tl as Rl,tn as zl,to as Bl,tr as Vl,ts as Hl,tt as Ul,tu as Wl,ua as Gl,uc as Kl,ud as ql,uf as Jl,ui as Yl,ul as Xl,un as Zl,uo as Ql,ur as $l,us as eu,ut as tu,uu as nu,v as ru,va as iu,vc as au,vd as ou,vf as J,vi as su,vl as cu,vn as lu,vo as uu,vr as Y,vs as du,vt as fu,vu as pu,w as mu,wa as hu,wc as gu,wd as _u,wi as vu,wl as X,wn as yu,wo as bu,wr as xu,ws as Su,wt as Cu,wu,x as Tu,xa as Eu,xc as Z,xd as Du,xi as Ou,xl as ku,xn as Au,xo as ju,xr as Mu,xs as Nu,xt as Pu,xu as Fu,y as Iu,ya as Lu,yc as Ru,yd as zu,yi as Bu,yl as Vu,yn as Hu,yo as Uu,yr as Wu,ys as Gu,yt as Ku,yu as qu,z as Ju,za as Yu,zc as Xu,zd as Zu,zi as Qu,zl as $u,zn as ed,zo as td,zr as nd,zs as rd,zt as id,zu as ad}from"./editor.api-D1ZVmYNy.js";var od=class extends Ru{constructor(){super({id:`diffEditor.toggleCollapseUnchangedRegions`,title:J(101,`Toggle Collapse Unchanged Regions`),icon:D.map,toggled:m.has(`config.diffEditor.hideUnchangedRegions.enabled`),precondition:m.has(`isInDiffEditor`),menu:{when:m.has(`isInDiffEditor`),id:Z.EditorTitle,order:22,group:`navigation`}})}run(e,...t){let n=e.get(xa),r=!n.getValue(`diffEditor.hideUnchangedRegions.enabled`);n.updateValue(`diffEditor.hideUnchangedRegions.enabled`,r)}},sd=class extends Ru{constructor(){super({id:`diffEditor.toggleShowMovedCodeBlocks`,title:J(102,`Toggle Show Moved Code Blocks`),precondition:m.has(`isInDiffEditor`)})}run(e,...t){let n=e.get(xa),r=!n.getValue(`diffEditor.experimental.showMoves`);n.updateValue(`diffEditor.experimental.showMoves`,r)}},cd=class extends Ru{constructor(){super({id:`diffEditor.toggleUseInlineViewWhenSpaceIsLimited`,title:J(103,`Toggle Use Inline View When Space Is Limited`),precondition:m.has(`isInDiffEditor`)})}run(e,...t){let n=e.get(xa),r=!n.getValue(`diffEditor.useInlineViewWhenSpaceIsLimited`);n.updateValue(`diffEditor.useInlineViewWhenSpaceIsLimited`,r)}},ld=J(104,`Diff Editor`),ud=class extends Pi{constructor(){super({id:`diffEditor.switchSide`,title:J(105,`Switch Side`),icon:D.arrowSwap,precondition:m.has(`isInDiffEditor`),f1:!0,category:ld})}runEditorCommand(e,t,n){let r=yd(e);if(r instanceof Kt){if(n&&n.dryRun)return{destinationSelection:r.mapToOtherSide().destinationSelection};r.switchSide()}}},dd=class extends Pi{constructor(){super({id:`diffEditor.exitCompareMove`,title:J(106,`Exit Compare Move`),icon:D.close,precondition:z.comparingMovedCode,f1:!1,category:ld,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...n){let r=yd(e);r instanceof Kt&&r.exitCompareMove()}},fd=class extends Pi{constructor(){super({id:`diffEditor.collapseAllUnchangedRegions`,title:J(107,`Collapse All Unchanged Regions`),icon:D.fold,precondition:m.has(`isInDiffEditor`),f1:!0,category:ld})}runEditorCommand(e,t,...n){let r=yd(e);r instanceof Kt&&r.collapseAllUnchangedRegions()}},pd=class extends Pi{constructor(){super({id:`diffEditor.showAllUnchangedRegions`,title:J(108,`Show All Unchanged Regions`),icon:D.unfold,precondition:m.has(`isInDiffEditor`),f1:!0,category:ld})}runEditorCommand(e,t,...n){let r=yd(e);r instanceof Kt&&r.showAllUnchangedRegions()}},md=class extends Ru{constructor(){super({id:`diffEditor.revert`,title:J(109,`Revert`),f1:!0,category:ld,precondition:m.has(`isInDiffEditor`)})}run(e,t){return t?this.runViaToolbarContext(e,t):this.runViaCursorOrSelection(e)}runViaCursorOrSelection(e){let t=yd(e);t instanceof Kt&&t.revertFocusedRangeMappings()}runViaToolbarContext(e,t){let n=vd(e,t.originalUri,t.modifiedUri);n instanceof Kt&&n.revertRangeMappings(t.mapping.innerChanges??[])}},hd=J(110,`Accessible Diff Viewer`),gd=class e extends Ru{static{this.id=`editor.action.accessibleDiffViewer.next`}constructor(){super({id:e.id,title:J(111,`Go to Next Difference`),category:hd,precondition:m.has(`isInDiffEditor`),keybinding:{primary:65,weight:100},f1:!0})}run(e){yd(e)?.accessibleDiffViewerNext()}},_d=class e extends Ru{static{this.id=`editor.action.accessibleDiffViewer.prev`}constructor(){super({id:e.id,title:J(112,`Go to Previous Difference`),category:hd,precondition:m.has(`isInDiffEditor`),keybinding:{primary:1089,weight:100},f1:!0})}run(e){yd(e)?.accessibleDiffViewerPrev()}};function vd(e,t,n){return e.get(Di).listDiffEditors().find(e=>{let r=e.getModifiedEditor(),i=e.getOriginalEditor();return r&&r.getModel()?.uri.toString()===n.toString()&&i&&i.getModel()?.uri.toString()===t.toString()})||null}function yd(e){let t=e.get(Di).listDiffEditors(),n=Za();if(n){for(let e of t)if(e.getContainerDomNode().contains(n))return e}return null}x(od),x(sd),x(cd),_e.appendMenuItem(Z.EditorTitle,{command:{id:new cd().desc.id,title:V(135,`Use Inline View When Space Is Limited`),toggled:m.has(`config.diffEditor.useInlineViewWhenSpaceIsLimited`),precondition:m.has(`isInDiffEditor`)},order:11,group:`1_diff`,when:m.and(z.diffEditorRenderSideBySideInlineBreakpointReached,m.has(`isInDiffEditor`))}),_e.appendMenuItem(Z.EditorTitle,{command:{id:new sd().desc.id,title:V(136,`Show Moved Code Blocks`),icon:D.move,toggled:Ls.create(`config.diffEditor.experimental.showMoves`,!0),precondition:m.has(`isInDiffEditor`)},order:10,group:`1_diff`,when:m.has(`isInDiffEditor`)}),x(md);for(let e of[{icon:D.arrowRight,key:z.diffEditorInlineMode.toNegated()},{icon:D.discard,key:z.diffEditorInlineMode}])_e.appendMenuItem(Z.DiffEditorHunkToolbar,{command:{id:new md().desc.id,title:V(137,`Revert Block`),icon:e.icon},when:m.and(z.diffEditorModifiedWritable,e.key),order:5,group:`primary`}),_e.appendMenuItem(Z.DiffEditorSelectionToolbar,{command:{id:new md().desc.id,title:V(138,`Revert Selection`),icon:e.icon},when:m.and(z.diffEditorModifiedWritable,e.key),order:5,group:`primary`});x(ud),x(dd),x(fd),x(pd),_e.appendMenuItem(Z.EditorTitle,{command:{id:gd.id,title:V(139,`Open Accessible Diff Viewer`),precondition:m.has(`isInDiffEditor`)},order:10,group:`2_diff`,when:m.and(z.accessibleDiffViewerVisible.negate(),m.has(`isInDiffEditor`))}),jn.registerCommandAlias(`editor.action.diffReview.next`,gd.id),x(gd),jn.registerCommandAlias(`editor.action.diffReview.prev`,_d.id),x(_d);var bd=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xd=function(e,t){return function(n,r){t(n,r,e)}},Sd,Cd=new A(`selectionAnchorSet`,!1),wd=class{static{Sd=this}static{this.ID=`editor.contrib.selectionAnchorController`}static get(e){return e.getContribution(Sd.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=Cd.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){let e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(P.fromPositions(e,e),{description:`selection-anchor`,stickiness:1,hoverMessage:new li().appendText(V(834,`Selection Anchor`)),className:`selection-anchor`})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),$c(V(835,`Anchor set at {0}:{1}`,e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){let e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){let e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){let t=this.editor.getPosition();this.editor.setSelection(P.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){let e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}};wd=Sd=bd([xd(1,G)],wd);var Td=class extends N{constructor(){super({id:`editor.action.setSelectionAnchor`,label:J(836,`Set Selection Anchor`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2080),weight:100}})}async run(e,t){wd.get(t)?.setSelectionAnchor()}},Ed=class extends N{constructor(){super({id:`editor.action.goToSelectionAnchor`,label:J(837,`Go to Selection Anchor`),precondition:Cd})}async run(e,t){wd.get(t)?.goToSelectionAnchor()}},Dd=class extends N{constructor(){super({id:`editor.action.selectFromAnchorToCursor`,label:J(838,`Select from Anchor to Cursor`),precondition:Cd,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2089),weight:100}})}async run(e,t){wd.get(t)?.selectFromAnchorToCursor()}},Od=class extends N{constructor(){super({id:`editor.action.cancelSelectionAnchor`,label:J(839,`Cancel Selection Anchor`),precondition:Cd,kbOpts:{kbExpr:z.editorTextFocus,primary:9,weight:100}})}async run(e,t){wd.get(t)?.cancelSelectionAnchor()}};F(wd.ID,wd,4),O(Td),O(Ed),O(Dd),O(Od);var kd=E(`editorOverviewRuler.bracketMatchForeground`,`#A0A0A0`,V(840,`Overview ruler marker color for matching brackets.`)),Ad=class extends N{constructor(){super({id:`editor.action.jumpToBracket`,label:J(842,`Go to Bracket`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:3165,weight:100}})}run(e,t){Pd.get(t)?.jumpToBracket()}},jd=class extends N{constructor(){super({id:`editor.action.selectToBracket`,label:J(843,`Select to Bracket`),precondition:void 0,metadata:{description:J(844,`Select the text inside and including the brackets or curly braces`),args:[{name:`args`,schema:{type:`object`,properties:{selectBrackets:{type:`boolean`,default:!0}}}}]}})}run(e,t,n){let r=!0;n&&n.selectBrackets===!1&&(r=!1),Pd.get(t)?.selectToBracket(r)}},Md=class extends N{constructor(){super({id:`editor.action.removeBrackets`,label:J(845,`Remove Brackets`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(e,t){Pd.get(t)?.removeBrackets(this.id)}},Nd=class{constructor(e,t,n){this.position=e,this.brackets=t,this.options=n}},Pd=class e extends j{static{this.ID=`editor.contrib.bracketMatchingController`}static get(t){return t.getContribution(e.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new Cl(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(e=>{this._matchBrackets!==`never`&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(e=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(e=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(e=>{e.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;let e=this._editor.getModel(),t=this._editor.getSelections().map(t=>{let n=t.getStartPosition(),r=e.bracketPairs.matchBracket(n),i=null;if(r)r[0].containsPosition(n)&&!r[1].containsPosition(n)?i=r[1].getStartPosition():r[1].containsPosition(n)&&(i=r[0].getStartPosition());else{let t=e.bracketPairs.findEnclosingBrackets(n);if(t)i=t[1].getStartPosition();else{let t=e.bracketPairs.findNextBracket(n);t&&t.range&&(i=t.range.getStartPosition())}}return i?new P(i.lineNumber,i.column,i.lineNumber,i.column):new P(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;let t=this._editor.getModel(),n=[];this._editor.getSelections().forEach(r=>{let i=r.getStartPosition(),a=t.bracketPairs.matchBracket(i);if(!a&&(a=t.bracketPairs.findEnclosingBrackets(i),!a)){let e=t.bracketPairs.findNextBracket(i);e&&e.range&&(a=t.bracketPairs.matchBracket(e.range.getStartPosition()))}let o=null,s=null;if(a){a.sort(T.compareRangesUsingStarts);let[t,n]=a;if(o=e?t.getStartPosition():t.getEndPosition(),s=e?n.getEndPosition():n.getStartPosition(),n.containsPosition(i)){let e=o;o=s,s=e}}o&&s&&n.push(new P(o.lineNumber,o.column,s.lineNumber,s.column))}),n.length>0&&(this._editor.setSelections(n),this._editor.revealRange(n[0]))}removeBrackets(e){if(!this._editor.hasModel())return;let t=this._editor.getModel();this._editor.getSelections().forEach(n=>{let r=n.getPosition(),i=t.bracketPairs.matchBracket(r);i||=t.bracketPairs.findEnclosingBrackets(r),i&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:i[0],text:``},{range:i[1],text:``}]),this._editor.pushUndoStop())})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Y.register({description:`bracket-match-overview`,stickiness:1,className:`bracket-match`,inlineClassName:`bracket-match-inline`,overviewRuler:{color:pl(kd),position:Su.Center}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Y.register({description:`bracket-match-no-overview`,stickiness:1,className:`bracket-match`,inlineClassName:`bracket-match-inline`})}_updateBrackets(){if(this._matchBrackets===`never`)return;this._recomputeBrackets();let e=[],t=0;for(let n of this._lastBracketsData){let r=n.brackets;r&&(e[t++]={range:r[0],options:n.options},e[t++]={range:r[1],options:n.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}let t=this._editor.getSelections();if(t.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}let n=this._editor.getModel(),r=n.getVersionId(),i=[];this._lastVersionId===r&&(i=this._lastBracketsData);let a=[],o=0;for(let e=0,n=t.length;e<n;e++){let n=t[e];n.isEmpty()&&(a[o++]=n.getStartPosition())}a.length>1&&a.sort(M.compare);let s=[],c=0,l=0,u=i.length;for(let t=0,r=a.length;t<r;t++){let r=a[t];for(;l<u&&i[l].position.isBefore(r);)l++;if(l<u&&i[l].position.equals(r))s[c++]=i[l];else{let t=n.bracketPairs.matchBracket(r,20),i=e._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!t&&this._matchBrackets===`always`&&(t=n.bracketPairs.findEnclosingBrackets(r,20),i=e._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),s[c++]=new Nd(r,t,i)}}this._lastBracketsData=s,this._lastVersionId=r}};F(Pd.ID,Pd,1),O(jd),O(Ad),O(Md),_e.appendMenuItem(Z.MenubarGoMenu,{group:`5_infile_nav`,command:{id:`editor.action.jumpToBracket`,title:V(841,`Go to &&Bracket`)},order:2}),xc((e,t)=>{let n=e.getColor(yr);n&&t.addRule(`.monaco-editor .bracket-match-inline { color: ${n} !important; }`)});var Fd=class{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;let n=this._selection.startLineNumber,r=this._selection.startColumn,i=this._selection.endColumn;if(!(this._isMovingLeft&&r===1)&&!(!this._isMovingLeft&&i===e.getLineMaxColumn(n)))if(this._isMovingLeft){let a=new T(n,r-1,n,r),o=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new T(n,i,n,i),o)}else{let a=new T(n,i,n,i+1),o=e.getValueInRange(a);t.addEditOperation(a,null),t.addEditOperation(new T(n,r,n,r),o)}}computeCursorState(e,t){return this._isMovingLeft?new P(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new P(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}},Id=class extends N{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;let n=[],r=t.getSelections();for(let e of r)n.push(new Fd(e,this.left));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}},Ld=class extends Id{constructor(){super(!0,{id:`editor.action.moveCarretLeftAction`,label:J(846,`Move Selected Text Left`),precondition:z.writable})}},Rd=class extends Id{constructor(){super(!1,{id:`editor.action.moveCarretRightAction`,label:J(847,`Move Selected Text Right`),precondition:z.writable})}};O(Ld),O(Rd),O(class extends N{constructor(){super({id:`editor.action.transposeLetters`,label:J(848,`Transpose Letters`),precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;let n=t.getModel(),r=[],i=t.getSelections();for(let e of i){if(!e.isEmpty())continue;let t=e.startLineNumber,i=e.startColumn,a=n.getLineMaxColumn(t);if(t===1&&(i===1||i===2&&a===2))continue;let o=i===a?e.getPosition():cr.rightPosition(n,e.getPosition().lineNumber,e.getPosition().column),s=cr.leftPosition(n,o),c=cr.leftPosition(n,s),l=n.getValueInRange(T.fromPositions(c,s)),u=n.getValueInRange(T.fromPositions(s,o)),d=T.fromPositions(c,o);r.push(new rt(d,u+l))}r.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,r),t.pushUndoStop())}});var zd=class e{static{this.sep=`.`}static{this.None=new e(`@@none@@`)}static{this.Empty=new e(``)}constructor(e){this.value=e}equals(e){return this.value===e.value}contains(t){return this.equals(t)||this.value===``||t.value.startsWith(this.value+e.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...t){return new e((this.value?[this.value,...t]:t).join(e.sep))}},Bd=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Vd=function(e,t){return function(n,r){t(n,r,e)}},Hd=Y.register({description:`inline-progress-widget`,stickiness:1,showIfCollapsed:!0,after:{content:`\xA0`,inlineClassName:`inline-editor-progress-decoration`,inlineClassNameAffectsLetterSpacing:!0}}),Ud=class e extends j{static{this.baseId=`editor.widget.inlineProgressWidget`}constructor(e,t,n,r,i){super(),this.typeId=e,this.editor=t,this.range=n,this.delegate=i,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(r),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=I(`.inline-progress-widget`),this.domNode.role=`button`,this.domNode.title=e;let t=I(`span.icon`);this.domNode.append(t),t.classList.add(...C.asClassNameArray(D.loading),`codicon-modifier-spin`);let n=()=>{let e=this.editor.getOption(75);this.domNode.style.height=`${e}px`,this.domNode.style.width=`${Math.ceil(.8*e)}px`};n(),this._register(this.editor.onDidChangeConfiguration(e=>{(e.hasChanged(61)||e.hasChanged(75))&&n()})),this._register(K(this.domNode,pr.CLICK,e=>{this.delegate.cancel()}))}getId(){return e.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)}},Wd=class extends j{constructor(e,t,n){super(),this.id=e,this._editor=t,this._instantiationService=n,this._showDelay=500,this._showPromise=this._register(new Ae),this._currentWidget=this._register(new Ae),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,n,r,i){let a=this._operationIdPool++;this._currentOperation=a,this.clear(),this._showPromise.value=oo(()=>{let n=T.fromPositions(e);this._currentDecorations.set([{range:n,options:Hd}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(Ud,this.id,this._editor,n,t,r))},i??this._showDelay);try{return await n}finally{this._currentOperation===a&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};Wd=Bd([Vd(2,w)],Wd);var Gd=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Kd=function(e,t){return function(n,r){t(n,r,e)}},qd,Jd=class{static{qd=this}static{this.ID=`editor.contrib.messageController`}static{this.MESSAGE_VISIBLE=new A(`messageVisible`,!1,V(1333,`Whether the editor is currently showing an inline message`))}static get(e){return e.getContribution(qd.ID)}constructor(e,t,n){this._openerService=n,this._messageWidget=new Ae,this._messageListeners=new S,this._mouseOverMessage=!1,this._editor=e,this._visible=qd.MESSAGE_VISIBLE.bindTo(t)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){if($c($t(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),$t(e)){let n=this._messageListeners.add(kr(e,{actionHandler:(e,t)=>{this.closeMessage(),It(this._openerService,e,t.isTrusted)}}));this._messageWidget.value=new Yd(this._editor,t,n.element)}else this._messageWidget.value=new Yd(this._editor,t,e);this._messageListeners.add(Du.debounce(this._editor.onDidBlurEditorText,(e,t)=>t,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&ku(Za(),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(K(this._messageWidget.value.getDomNode(),pr.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(K(this._messageWidget.value.getDomNode(),pr.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let n;this._messageListeners.add(this._editor.onMouseMove(e=>{e.target.position&&(n?n.containsPosition(e.target.position)||this.closeMessage():n=new T(t.lineNumber-3,1,e.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(Yd.fadeOut(this._messageWidget.value))}};Jd=qd=Gd([Kd(1,G),Kd(2,gn)],Jd),R(new(mt.bindToContribution(Jd.get))({id:`leaveEditorMessage`,precondition:Jd.MESSAGE_VISIBLE,handler:e=>e.closeMessage(),kbOpts:{weight:130,primary:9}}));var Yd=class{static fadeOut(e){let t=()=>{e.dispose(),clearTimeout(n),e.getDomNode().removeEventListener(`animationend`,t)},n=setTimeout(t,110);return e.getDomNode().addEventListener(`animationend`,t),e.getDomNode().classList.add(`fadeOut`),{dispose:t}}constructor(e,{lineNumber:t,column:n},r){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:n},this._domNode=document.createElement(`div`),this._domNode.classList.add(`monaco-editor-overlaymessage`),this._domNode.style.marginLeft=`-6px`;let i=document.createElement(`div`);i.classList.add(`anchor`,`top`),this._domNode.appendChild(i);let a=document.createElement(`div`);typeof r==`string`?(a.classList.add(`message`),a.textContent=r):(r.classList.add(`message`),a.appendChild(r)),this._domNode.appendChild(a);let o=document.createElement(`div`);o.classList.add(`anchor`,`below`),this._domNode.appendChild(o),this._editor.addContentWidget(this),this._domNode.classList.add(`fadeIn`)}dispose(){this._editor.removeContentWidget(this)}getId(){return`messageoverlay`}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle(`below`,e===2)}};F(Jd.ID,Jd,4);var Xd=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Zd=function(e,t){return function(n,r){t(n,r,e)}},Qd=class{constructor(e){this.copyMimeTypes=[],this.kind=e,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(e,t,n,r,i){let a=await this.getEdit(n,i);if(a)return{edits:[{insertText:a.insertText,title:a.title,kind:a.kind,handledMimeType:a.handledMimeType,yieldTo:a.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,n,r){let i=await this.getEdit(n,r);if(i)return{edits:[{insertText:i.insertText,title:i.title,kind:i.kind,handledMimeType:i.handledMimeType,yieldTo:i.yieldTo}],dispose(){}}}},$d=class e extends Qd{static{this.id=`text`}constructor(){super(zd.Empty.append(`text`,`plain`)),this.id=e.id,this.dropMimeTypes=[mc.text],this.pasteMimeTypes=[mc.text]}async getEdit(e,t){let n=e.get(mc.text);if(!n||e.has(mc.uriList))return;let r=await n.asString();return{handledMimeType:mc.text,title:V(965,`Insert Plain Text`),insertText:r,kind:this.kind}}},ef=class extends Qd{constructor(){super(zd.Empty.append(`uri`,`path`,`absolute`)),this.dropMimeTypes=[mc.uriList],this.pasteMimeTypes=[mc.uriList]}async getEdit(e,t){let n=await rf(e);if(!n.length||t.isCancellationRequested)return;let r=0,i=n.map(({uri:e,originalText:t})=>e.scheme===Ks.file?e.fsPath:(r++,t)).join(` `),a;return a=r>0?n.length>1?V(966,`Insert Uris`):V(967,`Insert Uri`):n.length>1?V(968,`Insert Paths`):V(969,`Insert Path`),{handledMimeType:mc.uriList,insertText:i,title:a,kind:this.kind}}},tf=class extends Qd{constructor(e){super(zd.Empty.append(`uri`,`path`,`relative`)),this._workspaceContextService=e,this.dropMimeTypes=[mc.uriList],this.pasteMimeTypes=[mc.uriList]}async getEdit(e,t){let n=await rf(e);if(!n.length||t.isCancellationRequested)return;let r=gc(n.map(({uri:e})=>{let t=this._workspaceContextService.getWorkspaceFolder(e);return t?oc(t.uri,e):void 0}));if(r.length)return{handledMimeType:mc.uriList,insertText:r.join(` `),title:n.length>1?V(970,`Insert Relative Paths`):V(971,`Insert Relative Path`),kind:this.kind}}};tf=Xd([Zd(0,Zn)],tf);var nf=class{constructor(){this.kind=new zd(`html`),this.providedPasteEditKinds=[this.kind],this.copyMimeTypes=[],this.pasteMimeTypes=[`text/html`],this._yieldTo=[{mimeType:mc.text}]}async provideDocumentPasteEdits(e,t,n,r,i){if(r.triggerKind!==As.PasteAs&&!r.only?.contains(this.kind))return;let a=await n.get(`text/html`)?.asString();if(!(!a||i.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:V(972,`Insert HTML`),kind:this.kind}]}}};async function rf(e){let t=e.get(mc.uriList);if(!t)return[];let n=await t.asString(),r=[];for(let e of Yl.parse(n))try{r.push({uri:On.parse(e),originalText:e})}catch{}return r}var af={scheme:`*`,hasAccessToAllModels:!0},of=class extends j{constructor(e,t){super(),this._register(e.documentDropEditProvider.register(af,new $d)),this._register(e.documentDropEditProvider.register(af,new ef)),this._register(e.documentDropEditProvider.register(af,new tf(t)))}};of=Xd([Zd(0,q),Zd(1,Zn)],of);var sf=class extends j{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register(af,new $d)),this._register(e.documentPasteEditProvider.register(af,new ef)),this._register(e.documentPasteEditProvider.register(af,new tf(t))),this._register(e.documentPasteEditProvider.register(af,new nf))}};sf=Xd([Zd(0,q),Zd(1,Zn)],sf);var cf=class e{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};let t=this.pos,n=0,r=this.value.charCodeAt(t),i;if(i=e._table[r],typeof i==`number`)return this.pos+=1,{type:i,pos:t,len:1};if(e.isDigitCharacter(r)){i=8;do n+=1,r=this.value.charCodeAt(t+n);while(e.isDigitCharacter(r));return this.pos+=n,{type:i,pos:t,len:n}}if(e.isVariableCharacter(r)){i=9;do r=this.value.charCodeAt(t+ ++n);while(e.isVariableCharacter(r)||e.isDigitCharacter(r));return this.pos+=n,{type:i,pos:t,len:n}}i=10;do n+=1,r=this.value.charCodeAt(t+n);while(!isNaN(r)&&e._table[r]===void 0&&!e.isDigitCharacter(r)&&!e.isVariableCharacter(r));return this.pos+=n,{type:i,pos:t,len:n}}},lf=class{constructor(){this._children=[]}appendChild(e){return e instanceof uf&&this._children[this._children.length-1]instanceof uf?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){let{parent:n}=e,r=n.children.indexOf(e),i=n.children.slice(0);i.splice(r,1,...t),n._children=i,(function e(t,n){for(let r of t)r.parent=n,e(r.children,r)})(t,n)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof vf)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),``)}len(){return 0}},uf=class e extends lf{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new e(this.value)}},df=class extends lf{},ff=class e extends df{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:+(e.index>t.index)}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof pf?this._children[0]:void 0}clone(){let t=new e(this.index);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map(e=>e.clone()),t}},pf=class e extends lf{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof uf&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){let t=new e;return this.options.forEach(t.appendChild,t),t}},mf=class e extends lf{constructor(){super(...arguments),this.regexp=RegExp(``)}resolve(e){let t=this,n=!1,r=e.replace(this.regexp,function(){return n=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!n&&this._children.some(e=>e instanceof hf&&!!e.elseValue)&&(r=this._replace([])),r}_replace(e){let t=``;for(let n of this._children)if(n instanceof hf){let r=e[n.index]||``;r=n.resolve(r),t+=r}else t+=n.toString();return t}toString(){return``}clone(){let t=new e;return t.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?`i`:``)+(this.regexp.global?`g`:``)),t._children=this.children.map(e=>e.clone()),t}},hf=class e extends lf{constructor(e,t,n,r){super(),this.index=e,this.shorthandName=t,this.ifValue=n,this.elseValue=r}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,`-`);let t=e.trim().replace(/^_+|_+$/g,``),n=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 n?n.map(e=>e.toLowerCase()).join(`-`):t.split(/[\s_-]+/).filter(e=>e.length>0).map(e=>e.toLowerCase()).join(`-`)}_toPascalCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map(e=>e.charAt(0).toUpperCase()+e.substr(1)).join(``):e}_toCamelCase(e){let t=e.match(/[\p{L}0-9]+/gu);return t?t.map((e,t)=>t===0?e.charAt(0).toLowerCase()+e.substr(1):e.charAt(0).toUpperCase()+e.substr(1)).join(``):e}_toSnakeCase(e){return e.replace(/(\p{Ll})(\p{Lu})/gu,`$1_$2`).replace(/[\s\-]+/g,`_`).toLowerCase()}clone(){return new e(this.index,this.shorthandName,this.ifValue,this.elseValue)}},gf=class e extends df{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||``)),t===void 0?!1:(this._children=[new uf(t)],!0)}clone(){let t=new e(this.name);return this.transform&&(t.transform=this.transform.clone()),t._children=this.children.map(e=>e.clone()),t}};function _f(e,t){let n=[...e];for(;n.length>0;){let e=n.shift();if(!t(e))break;n.unshift(...e.children)}}var vf=class e extends lf{get placeholderInfo(){if(!this._placeholders){let e=[],t;this.walk(function(n){return n instanceof ff&&(e.push(n),t=!t||t.index<n.index?n:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){let{all:e}=this.placeholderInfo;return e}offset(e){let t=0,n=!1;return this.walk(r=>r===e?(n=!0,!1):(t+=r.len(),!0)),n?t:-1}fullLen(e){let t=0;return _f([e],e=>(t+=e.len(),!0)),t}enclosingPlaceholders(e){let t=[],{parent:n}=e;for(;n;)n instanceof ff&&t.push(n),n=n.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof gf&&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(){let t=new e;return t._children=this.children.map(e=>e.clone()),t}walk(e){_f(this.children,e)}},yf=class{constructor(){this._scanner=new cf,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,`\\$&`)}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,n){let r=new vf;return this.parseFragment(e,r),this.ensureFinalTabstop(r,n??!1,t??!1),r}parseFragment(e,t){let n=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););let r=new Map,i=[];t.walk(e=>(e instanceof ff&&(e.isFinalTabstop?r.set(0,void 0):!r.has(e.index)&&e.children.length>0?r.set(e.index,e.children):i.push(e)),!0));let a=(e,n)=>{let i=r.get(e.index);if(!i)return;let o=new ff(e.index);o.transform=e.transform;for(let e of i){let t=e.clone();o.appendChild(t),t instanceof ff&&r.has(t.index)&&!n.has(t.index)&&(n.add(t.index),a(t,n),n.delete(t.index))}t.replace(e,[o])},o=new Set;for(let e of i)a(e,o);return t.children.slice(n)}ensureFinalTabstop(e,t,n){(t||n&&e.placeholders.length>0)&&(e.placeholders.find(e=>e.index===0)||e.appendChild(new ff(0)))}_accept(e,t){if(e===void 0||this._token.type===e){let e=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),e}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){let t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){let e=this._scanner.next();if(e.type!==0&&e.type!==4&&e.type!==5)return!1}this._token=this._scanner.next()}let n=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,`$1`);return this._token=this._scanner.next(),n}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new uf(t)),!0):!1}_parseTabstopOrVariableName(e){let t,n=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new ff(Number(t)):new gf(t)),!0):this._backTo(n)}_parseComplexPlaceholder(e){let t,n=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(n);let r=new ff(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(r),!0;if(!this._parse(r))return e.appendChild(new uf("${"+t+`:`)),r.children.forEach(e.appendChild,e),!0}else if(r.index>0&&this._accept(7)){let t=new pf;for(;;){if(this._parseChoiceElement(t)){if(this._accept(2))continue;if(this._accept(7)&&(r.appendChild(t),this._accept(4)))return e.appendChild(r),!0}return this._backTo(n),!1}}else if(this._accept(6))return this._parseTransform(r)?(e.appendChild(r),!0):(this._backTo(n),!1);else if(this._accept(4))return e.appendChild(r),!0;else return this._backTo(n)}_parseChoiceElement(e){let t=this._token,n=[];for(;!(this._token.type===2||this._token.type===7);){let e;if(e=(e=this._accept(5,!0))?this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||e:this._accept(void 0,!0),!e)return this._backTo(t),!1;n.push(e)}return n.length===0?(this._backTo(t),!1):(e.appendChild(new uf(n.join(``))),!0)}_parseComplexVariable(e){let t,n=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(n);let r=new gf(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(r),!0;if(!this._parse(r))return e.appendChild(new uf("${"+t+`:`)),r.children.forEach(e.appendChild,e),!0}else if(this._accept(6))return this._parseTransform(r)?(e.appendChild(r),!0):(this._backTo(n),!1);else if(this._accept(4))return e.appendChild(r),!0;else return this._backTo(n)}_parseTransform(e){let t=new mf,n=``,r=``;for(;!this._accept(6);){let e;if(e=this._accept(5,!0)){e=this._accept(6,!0)||e,n+=e;continue}if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let e;if(e=this._accept(5,!0)){e=this._accept(5,!0)||this._accept(6,!0)||e,t.appendChild(new uf(e));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){r+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(n,r)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){let t=this._token;if(!this._accept(0))return!1;let n=!1;this._accept(3)&&(n=!0);let r=this._accept(8,!0);if(!r)return this._backTo(t),!1;if(!n||this._accept(4))return e.appendChild(new hf(Number(r))),!0;if(!this._accept(1))return this._backTo(t),!1;if(this._accept(6)){let n=this._accept(9,!0);return!n||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new hf(Number(r),n)),!0)}else if(this._accept(11)){let t=this._until(4);if(t)return e.appendChild(new hf(Number(r),void 0,t,void 0)),!0}else if(this._accept(12)){let t=this._until(4);if(t)return e.appendChild(new hf(Number(r),void 0,void 0,t)),!0}else if(this._accept(13)){let t=this._until(1);if(t){let n=this._until(4);if(n)return e.appendChild(new hf(Number(r),void 0,t,n)),!0}}else{let t=this._until(4);if(t)return e.appendChild(new hf(Number(r),void 0,void 0,t)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type===14?!1:(e.appendChild(new uf(this._scanner.tokenText(this._token))),this._accept(void 0),!0)}};function bf(e,t,n){return(typeof n.insertText==`string`?n.insertText===``:n.insertText.snippet===``)?{edits:n.additionalEdit?.edits??[]}:{edits:[...t.map(t=>new fi(e,{range:t,text:typeof n.insertText==`string`?yf.escape(n.insertText)+`$0`:n.insertText.snippet,insertAsSnippet:!0})),...n.additionalEdit?.edits??[]]}}function xf(e){function t(e,t){return`mimeType`in e?e.mimeType===t.handledMimeType:!!t.kind&&e.kind.contains(t.kind)}let n=new Map;for(let r of e)for(let i of r.yieldTo??[])for(let a of e)if(a!==r&&t(i,a)){let e=n.get(r);e||(e=[],n.set(r,e)),e.push(a)}if(!n.size)return Array.from(e);let r=new Set,i=[];function a(e){if(!e.length)return[];let t=e[0];if(i.includes(t))return console.warn(`Yield to cycle detected`,t),e;if(r.has(t))return a(e.slice(1));let o=[],s=n.get(t);return s&&(i.push(t),o=a(s),i.pop()),r.add(t),[...o,t,...a(e.slice(1))]}return a(Array.from(e))}function Sf(e,t){return t&&(e.stack||e.stacktrace)?V(33,`{0}: {1}`,wf(e),Cf(e.stack)||Cf(e.stacktrace)):wf(e)}function Cf(e){return Array.isArray(e)?e.join(`
2
+ `):e}function wf(e){return e.code===`ERR_UNC_HOST_NOT_ALLOWED`?`${e.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof e.code==`string`&&typeof e.errno==`number`&&typeof e.syscall==`string`?V(34,`A system error occurred ({0})`,e.message):e.message||V(35,`An unknown error occurred. Please consult the log for more details.`)}function Tf(e=null,t=!1){if(!e)return V(36,`An unknown error occurred. Please consult the log for more details.`);if(Array.isArray(e)){let n=gc(e),r=Tf(n[0],t);return n.length>1?V(37,`{0} ({1} errors in total)`,r,n.length):r}if(bc(e))return e;if(e.detail){let n=e.detail;if(n.error)return Sf(n.error,t);if(n.exception)return Sf(n.exception,t)}return e.stack?Sf(e,t):e.message?e.message:V(38,`An unknown error occurred. Please consult the log for more details.`)}var Ef=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Df=function(e,t){return function(n,r){t(n,r,e)}},Of,kf=`acceptSelectedCodeAction`,Af=`previewSelectedCodeAction`,jf=class{get templateId(){return`header`}renderTemplate(e){e.classList.add(`group-header`);let t=document.createElement(`span`);return e.append(t),{container:e,text:t}}renderElement(e,t,n){n.text.textContent=e.group?.title??e.label??``}disposeTemplate(e){}},Mf=class{get templateId(){return`separator`}renderTemplate(e){e.classList.add(`separator`);let t=document.createElement(`span`);return e.append(t),{container:e,text:t}}renderElement(e,t,n){n.text.textContent=e.label??``}disposeTemplate(e){}},Nf=class{get templateId(){return`action`}constructor(e,t,n,r,i,a,o,s,c){this._supportsPreview=e,this._onRemoveItem=t,this._onShowSubmenu=n,this._hasAnySubmenuActions=r,this._groupTitleByIndex=i,this._linkHandler=a,this._hideDefaultKeybindingTooltip=o,this._keybindingService=s,this._openerService=c}renderTemplate(e){e.classList.add(this.templateId);let t=document.createElement(`div`);t.className=`icon`,e.append(t);let n=document.createElement(`span`);n.className=`title`,e.append(n);let r=document.createElement(`span`);r.className=`action-item-badge`,e.append(r);let i=document.createElement(`span`);i.className=`description`,e.append(i);let a=document.createElement(`span`);a.className=`group-title`,e.append(a);let o=document.createElement(`span`);o.className=`detail`,e.append(o);let s=new Cu(e,Zu),c=document.createElement(`div`);c.className=`action-list-item-toolbar`,e.append(c);let l=document.createElement(`div`);return l.className=`action-list-submenu-indicator`,e.append(l),{container:e,icon:t,text:n,detail:o,badge:r,description:i,groupTitle:a,keybinding:s,toolbar:c,submenuIndicator:l,elementDisposables:new S}}renderElement(e,t,n){if(n.elementDisposables.clear(),e.group?.icon?(n.icon.className=C.asClassName(e.group.icon),e.group.icon.color&&(n.icon.style.color=An(e.group.icon.color.id))):(n.icon.className=C.asClassName(D.lightBulb),n.icon.style.color=`var(--vscode-editorLightBulb-foreground)`),!e.item||!e.label)return;if(Kn(!e.hideIcon,n.icon),e.isSectionToggle){let t=e.group?.icon===D.chevronDown;n.container.setAttribute(`aria-expanded`,String(t))}else n.container.removeAttribute(`aria-expanded`);if(n.previousClassName&&n.container.classList.remove(n.previousClassName),n.container.classList.toggle(`action-list-custom`,!!e.className),e.className&&n.container.classList.add(e.className),n.previousClassName=e.className,n.text.textContent=zf(e.label),e.badge?(n.badge.textContent=e.badge,n.badge.style.display=``):(n.badge.textContent=``,n.badge.style.display=`none`),e.keybinding)n.description.textContent=e.keybinding.getLabel(),n.description.style.display=`inline`,n.description.style.letterSpacing=`0.5px`;else if(e.description){if(Mc(n.description),typeof e.description==`string`)n.description.textContent=zf(e.description);else{let t=kr(e.description,{actionHandler:t=>{let n=On.parse(t);this._linkHandler?this._linkHandler(n,e):this._openerService.open(n,{allowCommands:!0})}});n.elementDisposables.add(t),n.description.appendChild(t.element)}n.description.style.display=`inline`}else n.description.textContent=``,n.description.style.display=`none`;let r=this._groupTitleByIndex.get(t);r?(n.groupTitle.textContent=r,n.groupTitle.style.display=``):(n.groupTitle.textContent=``,n.groupTitle.style.display=`none`),e.detail?(n.detail.textContent=zf(e.detail),n.detail.style.display=``):(n.detail.textContent=``,n.detail.style.display=`none`);let i=this._keybindingService.lookupKeybinding(kf)?.getLabel(),a=this._keybindingService.lookupKeybinding(Af)?.getLabel();n.container.classList.toggle(`option-disabled`,!!e.disabled),e.hover===void 0?e.tooltip?n.container.title=e.tooltip:e.disabled?n.container.title=e.label:this._hideDefaultKeybindingTooltip?n.container.title=``:i&&a?this._supportsPreview&&e.canPreview?n.container.title=V(1705,`{0} to Apply, {1} to Preview`,i,a):n.container.title=V(1706,`{0} to Apply`,i):n.container.title=``:n.container.title=``,Mc(n.toolbar);let o=[...e.toolbarActions??[]];if(e.onRemove&&o.push(ae({id:`actionList.remove`,label:V(1707,`Remove`),class:C.asClassName(D.close),run:async()=>{await e.onRemove(),this._onRemoveItem?.(e)}})),n.container.classList.toggle(`has-toolbar`,o.length>0),o.length>0){let e=new Fn(n.toolbar);n.elementDisposables.add(e),e.push(o,{icon:!0,label:!1})}e.submenuActions?.length&&!e.hover?.content?(n.submenuIndicator.className=`action-list-submenu-indicator has-submenu `+C.asClassName(D.chevronRight),n.submenuIndicator.style.display=``,n.submenuIndicator.style.visibility=``,n.elementDisposables.add(K(n.submenuIndicator,pr.CLICK,t=>{t.stopPropagation(),this._onShowSubmenu?.(e)}))):this._hasAnySubmenuActions?(n.submenuIndicator.className=`action-list-submenu-indicator`,n.submenuIndicator.style.display=``,n.submenuIndicator.style.visibility=`hidden`):(n.submenuIndicator.className=`action-list-submenu-indicator`,n.submenuIndicator.style.display=`none`)}disposeTemplate(e){e.keybinding.dispose(),e.elementDisposables.dispose()}};Nf=Ef([Df(7,jr),Df(8,gn)],Nf);var Pf=class extends UIEvent{constructor(){super(`acceptSelectedAction`)}},Ff=class extends UIEvent{constructor(){super(`previewSelectedAction`)}};function If(e){if(e.kind===`action`)return e.label}var Lf=Of=class extends j{constructor(e,t,n,r,i,a,o,s,c){if(super(),this._supportsPreview=t,this._delegate=r,this._options=a,this._keybindingService=o,this._openerService=s,this._instantiationService=c,this._headerLineHeight=24,this._separatorLineHeight=8,this.cts=this._register(new ou),this._submenuDisposables=this._register(new S),this._collapsedSections=new Set,this._filterText=``,this._suppressHover=!1,this._hasLaidOut=!1,this._filterCts=this._register(new Ae),this._groupTitleByIndex=new Map,this._onDidRequestLayout=this._register(new U),this.onDidRequestLayout=this._onDidRequestLayout.event,this.domNode=document.createElement(`div`),this.domNode.classList.add(`actionList`),this._options?.inlineDescription&&this.domNode.classList.add(`inline-description`),this._options?.className){let e=this._options.className.split(/\s+/).filter(e=>e.length>0);e.length>0&&this.domNode.classList.add(...e)}if(this._actionLineHeight=24,this._submenuContainer=document.createElement(`div`),this._submenuContainer.className=`action-list-submenu-panel action-widget`,this._submenuContainer.style.display=`none`,this._submenuContainer.tabIndex=-1,this.domNode.append(this._submenuContainer),this._register(K(this._submenuContainer,`mouseenter`,()=>{this._cancelSubmenuHide()})),this._register(K(this._submenuContainer,`mouseleave`,()=>{this._scheduleSubmenuHide()})),this._register(bn(()=>{this._cancelSubmenuHide(),this._cancelSubmenuShow()})),this._options?.collapsedByDefault)for(let e of this._options.collapsedByDefault)this._collapsedSections.add(e);let l={getHeight:e=>this._getItemHeight(e),getTemplateId:e=>e.kind},u=(this._options?.reserveSubmenuSpace??!0)&&n.some(e=>!!e.submenuActions?.length&&!e.hover?.content);if(this._list=this._register(new et(e,this.domNode,l,[new Nf(this._supportsPreview,e=>this._removeItem(e),e=>this._showSubmenuForItem(e),u,this._groupTitleByIndex,this._options?.linkHandler,this._options?.hideDefaultKeybindingTooltip??!1,this._keybindingService,this._openerService),new jf,new Mf],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:If},accessibilityProvider:{getAriaLabel:e=>{if(e.kind===`action`){let t=e.label?zf(e?.label):``;if(e.detail&&(t=t+`, `+zf(e.detail)),e.ariaDescription)t=t+`, `+zf(e.ariaDescription);else if(e.description){let n=typeof e.description==`string`?e.description:e.description.value;t=t+`, `+zf(n)}if(e.hover?.content&&!e.ariaDescription&&!e.description){let n=e.hover.content,r=typeof n==`string`?n:$t(n)?n.value:Br(n)?n.textContent??void 0:void 0;r&&(!e.detail||zf(e.detail)!==zf(r))&&(t=t+`, `+zf(r))}return e.group?.title&&(t=t+`, `+e.group.title),e.disabled&&(t=V(1708,`{0}, Disabled Reason: {1}`,t,e.disabled)),e.submenuActions?.length&&(t=V(1709,`{0}, use right arrow to access options`,t)),t}return null},getWidgetAriaLabel:()=>V(1710,`Action Widget`),getRole:e=>{switch(e.kind){case`action`:return`option`;case`separator`:return`separator`;default:return`separator`}},getWidgetRole:()=>`listbox`,...i}})),this._list.style(Zl),this._register(this._list.onMouseClick(e=>this.onListClick(e))),this._register(this._list.onMouseOver(e=>this.onListHover(e))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(e=>this.onListSelection(e))),this._allMenuItems=[...n],this._options?.showFilter||this._options?.secondaryHeading){this._filterContainer=document.createElement(`div`),this._filterContainer.className=`action-list-filter`;let e=H(this._filterContainer,I(`.action-list-filter-row`));if(this._options?.showFilter){this._filterInput=document.createElement(`input`),this._filterInput.type=`text`,this._filterInput.className=`action-list-filter-input`,this._filterInput.placeholder=this._options?.filterPlaceholder??V(1711,`Search...`),this._filterInput.setAttribute(`aria-label`,V(1712,`Filter items`)),e.appendChild(this._filterInput);let t=this._options?.filterActions??[];if(t.length>0){let n=H(e,I(`.action-list-filter-actions`));this._register(new Fn(n)).push(t,{icon:!0,label:!1})}this._register(K(this._filterInput,`input`,()=>{this._filterText=this._filterInput.value,this._applyOrUpdateFilter()}))}if(this._options?.secondaryHeading){let t=H(e,I(`.action-list-filter-label`));t.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){let e=H(this._headerContainer,I(`span.action-list-header-icon`));e.classList.add(...C.asClassNameArray(this._options.headerIcon)),e.setAttribute(`aria-hidden`,`true`)}let e=H(this._headerContainer,I(`span.action-list-header-text`));e.textContent=this._options.headerText}this._applyFilter(),this._list.length&&this._focusCheckedOrFirst(),this._register(K(this.domNode,`keydown`,e=>{if(e.key===`ArrowRight`){let t=this._list.getFocus();if(t.length>0){let n=this._list.element(t[0]);if(n?.submenuActions?.length){aa.stop(e,!0);let r=this._getRowElement(t[0]);r&&(this._showSubmenuForElement(n,r),this._currentSubmenuWidget?.focus())}}}})),this._filterInput&&this._register(K(this.domNode,`keydown`,e=>{this._filterInput&&!za(this._filterInput)&&e.key.length===1&&e.key!==` `&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(this._filterInput.focus(),this._filterInput.value=e.key,this._filterText=e.key,this._applyOrUpdateFilter(),e.preventDefault(),e.stopPropagation())}))}_toggleSection(e){this._collapsedSections.has(e)?this._collapsedSections.delete(e):this._collapsedSections.add(e),this._options?.onDidToggleSection?.(e,this._collapsedSections.has(e)),this._applyFilter()}_applyOrUpdateFilter(){if(!this._delegate.onFilter){this._applyFilter();return}let e=this._filterText;this._filterCts.value?.cancel();let t=new ou;this._filterCts.value=t,this._delegate.onFilter(e,t.token).then(e=>{t.token.isCancellationRequested||(this._allMenuItems=[...e],this._applyFilter(!0))}).catch(()=>{})}_applyFilter(e=!1,t=!0){let n=e?``:this._filterText.toLowerCase(),r=!e&&n.length>0,i=[],a=this._list.getFocus(),o;if(a.length>0&&(o=this._list.element(a[0])),r){let e,t=[],r=!1,a=()=>{e&&r&&i.push(e),i.push(...t),e=void 0,t=[],r=!1},o=e=>{let t=(e.label??``).toLowerCase(),r=typeof e.description==`string`?e.description:e.description?.value??``;return t.includes(n)||r.toLowerCase().includes(n)};for(let n of this._allMenuItems)if(n.kind!==`header`){if(n.kind===`separator`){a(),e=n.label?n:void 0;continue}if(n.showAlways){t.push(n);continue}n.isSectionToggle||o(n)&&(r=!0,t.push(n))}a()}else for(let e of this._allMenuItems){if(e.kind===`header`){i.push(e);continue}if(e.kind===`separator`){if(e.section&&this._collapsedSections.has(e.section))continue;i.push(e);continue}if(e.isSectionToggle&&e.section){let t=this._collapsedSections.has(e.section);i.push({...e,group:{...e.group,icon:t?D.chevronRight:D.chevronDown}});continue}e.section&&this._collapsedSections.has(e.section)||i.push(e)}let s=[],c=!1;for(let e=0;e<i.length;e++)s[e]=c,i[e].kind===`action`&&(c=!0);let l=[],u=!1;for(let e=i.length-1;e>=0;e--){if(i[e].kind===`action`){u=!0;continue}i[e].kind===`separator`&&(l[e]=u,u=!1)}for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind!==`separator`)continue;let n=l[e],r=!t.label&&!s[e];(!n||r)&&i.splice(e,1)}this._options?.showGroupTitleOnFirstItem&&this._recomputeGroupTitles(i);let d=this._filterInput&&za(this._filterInput);if(this._list.splice(0,this._list.length,i),t&&this._onDidRequestLayout.fire(),d)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._hasLaidOut&&o){let e=o.item?.id;if(e){for(let t=0;t<this._list.length;t++)if(this._list.element(t).item?.id===e){this._list.setFocus([t]),this._list.reveal(t),this._list.domFocus();break}}}}get filterContainer(){return this._filterContainer}get footerContainer(){return this._footerContainer}get headerContainer(){return this._headerContainer}get filterInput(){return this._filterInput}focusCondition(e){return!e.disabled&&e.kind===`action`}focus(){if(this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst()}clearFocus(){this._list.setFocus([])}getFocusedElement(){let e=this._list.getFocus();if(e.length>0)return this._list.element(e[0])}_focusCheckedOrFirst(){this._suppressHover=!0;try{for(let e=0;e<this._list.length;e++){let t=this._list.element(e);if(t.kind===`action`&&t.item?.checked){this._list.setFocus([e]),this._list.reveal(e);return}}this._list.focusFirst(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}finally{this._suppressHover=!1}}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){switch(e.kind){case`header`:return this._headerLineHeight;case`separator`:return e.label?this._actionLineHeight:this._separatorLineHeight;default:return e.detail?this._options?.detailItemHeight??48:this._actionLineHeight}}computeFullHeight(){let e=0;for(let t of this._allMenuItems)e+=this._getItemHeight(t);return e}computeListHeight(){let e=this._list.length,t=0;for(let n=0;n<e;n++){let e=this._list.element(n);t+=this._getItemHeight(e)}return t}layout(e,t){this._hasLaidOut=!0,this._list.layout(e,t),this.domNode.style.height=`${e}px`,this._filterContainer&&this._filterContainer.parentElement&&this._filterContainer.parentElement.insertBefore(this._filterContainer,this.domNode)}computeMaxWidth(e){let t=this._list.length,n=Math.max(e,this._options?.minWidth??0),r=this._options?.maxWidth??1/0,i=Math.max(r,n),a=e=>Math.min(Math.max(e,n),i),o=n,s=this._allMenuItems.length;if(s>=50)return a(380);if(s>t){let e=[];for(let n=0;n<t;n++)e.push(this._list.element(n));let n=[...this._allMenuItems];this._list.splice(0,t,n);let r=0;for(let e of n)r+=this._getItemHeight(e);this._list.layout(r);let i=[];for(let e=0;e<n.length;e++){let t=this._getRowElement(e);if(t){t.style.width=`auto`;let r=t.getBoundingClientRect().width;t.style.width=``,i.push(r+this._computeToolbarWidth(n[e]))}}return o=a(Math.max(...i)),this._list.splice(0,n.length,e),o}let c=[];for(let e=0;e<t;e++){let t=this._getRowElement(e);if(t){t.style.width=`auto`;let n=t.getBoundingClientRect().width;t.style.width=``,c.push(n+this._computeToolbarWidth(this._list.element(e)))}}return a(Math.max(...c))}focusPrevious(){if(this._filterInput&&za(this._filterInput)){this._list.domFocus();let e=this._list.getFocus();if(e.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);let t=this._list.getFocus();t.length>0&&t[0]>=e[0]?this._filterInput.focus():t.length>0&&this._list.reveal(t[0])}else{this._list.focusLast(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}return}let e=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);let 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._filterInput&&za(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}else{this._list.focusFirst(void 0,this.focusCondition);let e=this._list.getFocus();e.length>0&&this._list.reveal(e[0])}return}let e=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);let 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])}}collapseFocusedSection(){let e=this._getFocusedSection();e&&!this._collapsedSections.has(e)&&this._toggleSection(e)}expandFocusedSection(){let e=this._getFocusedSection();e&&this._collapsedSections.has(e)&&this._toggleSection(e)}toggleFocusedSection(){let e=this._list.getFocus();if(e.length===0)return!1;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section?(this._toggleSection(t.section),!0):!1}_getFocusedSection(){let e=this._list.getFocus();if(e.length===0)return;let t=this._list.element(e[0]);return t.isSectionToggle&&t.section,t.section}acceptSelected(e){let t=this._list.getFocus();if(t.length===0)return;let n=t[0],r=this._list.element(n);if(!this.focusCondition(r))return;let i=e?new Ff:new Pf;this._list.setSelection([n],i)}onListSelection(e){if(!e.elements.length)return;let t=e.elements[0];if(t.isSectionToggle&&t.section){this._list.setSelection([]);let e=t.section;queueMicrotask(()=>{this._toggleSection(e)});return}if(be(e.browserEvent)){let t=e.browserEvent.target;if(Br(t)&&(t.closest(`.action-list-item-toolbar`)||t.closest(`.action-list-submenu-indicator`))){this._list.setSelection([]);return}}if(t.item&&this.focusCondition(t)){let n=e.browserEvent instanceof Ff;this._delegate.onSelect(t.item,n&&this._supportsPreview)}else this._list.setSelection([])}onFocus(){let e=this._list.getFocus();if(e.length===0)return;let t=e[0],n=this._list.element(t);this._delegate.onFocus?.(n.item),this._suppressHover||this._showHoverForElement(n,t)}_removeItem(e){let t=this._allMenuItems.indexOf(e);t>=0&&(this._allMenuItems.splice(t,1),this._applyFilter())}_recomputeGroupTitles(e){this._groupTitleByIndex.clear();let t=new Set;for(let n=0;n<e.length;n++){let r=e[n];r.kind===`action`&&r.group?.title&&!t.has(r.group.title)&&(t.add(r.group.title),this._groupTitleByIndex.set(n,r.group.title))}}_computeToolbarWidth(e){let t=e.toolbarActions?.length??0;return e.onRemove&&t++,t===0?0:t*22+6}_getRowElement(e){return this.domNode.ownerDocument.getElementById(this._list.getElementID(e))}_showHoverForElement(e,t){if(this._currentSubmenuElement===e)return;let n=!!e.hover?.content,r=!!e.submenuActions?.length;if(n||r){let n=this._getRowElement(t);n&&this._showSubmenuForElement(e,n);return}this._hideSubmenu()}_showSubmenuForItem(e){let t=this._list.indexOf(e);if(t>=0){let n=this._getRowElement(t);n&&this._showSubmenuForElement(e,n)}}_showSubmenuForElement(e,t){if(this._currentSubmenuElement===e)return;this._submenuDisposables.clear(),this._currentSubmenuElement=e,this._clearSubmenuContainer();let n,r=e.hover?.content;if(r){if(Br(r))n=r,e.hover?.disposable&&this._register(e.hover.disposable);else{let t=typeof r==`string`?new li(r):r,i=this._options?.linkHandler,a=kr(t,{actionHandler:t=>{let n=On.parse(t);i?i(n,e):this._openerService.open(n,{allowCommands:!0})}});this._submenuDisposables.add(a),n=a.element}n.classList.add(`action-list-submenu-hover-header`),e.submenuActions?.length&&n.classList.add(`has-submenu`),this._submenuContainer.appendChild(n)}let i=!!e.submenuActions?.length;this._submenuContainer.style.display=``,this._submenuContainer.style.position=`absolute`,this._submenuContainer.removeAttribute(`role`);let a=t.getBoundingClientRect(),o=this.domNode.getBoundingClientRect(),s=_a(this.domNode),c=0,l=n?n.offsetWidth:0;if(i){let t=[],n=e.submenuActions.filter(e=>e instanceof Xu).filter(e=>e.actions.length>0);for(let e=0;e<n.length;e++){let r=n[e];r.label&&t.push({kind:`header`,group:{title:r.label},label:r.label});for(let e=0;e<r.actions.length;e++){let n=r.actions[e],i=n,a=i.icon??C.fromId(n.checked?D.check.id:D.blank.id),o=i.hoverContent;t.push({item:n,kind:`action`,label:n.label,description:n.tooltip||void 0,group:{title:``,icon:a},hideIcon:!1,hover:o?{content:o}:{},onRemove:i.onRemove})}e<n.length-1&&t.push({kind:`separator`,label:``})}for(let n of e.submenuActions)if(!(n instanceof Xu)){let e=n;t.push({item:n,kind:`action`,label:n.label,description:n.tooltip||void 0,group:{title:``},hideIcon:!1,hover:{},onRemove:e.onRemove})}let r=this._submenuDisposables.add(this._instantiationService.createInstance(Of,`submenu`,!1,t,{onHide:()=>{},onSelect:e=>{e.run();let t=this._currentSubmenuElement?.item;this._hideSubmenu(),t&&this._delegate.onSelect(t),this.hide()}},void 0,void 0));this._submenuContainer.appendChild(r.domNode),this._currentSubmenuWidget=r,r.clearFocus(),c=r.computeListHeight(),r.layout(c);let i=r.computeMaxWidth(0);l=Math.max(l,i),r.layout(c,l),r.domNode.style.width=`${l}px`,this._submenuDisposables.add(K(r.domNode,`keydown`,e=>{if(e.key===`ArrowLeft`||e.key===`Escape`)aa.stop(e,!0),this._hideSubmenu(),this._list.domFocus();else if(e.key===`Enter`){aa.stop(e,!0);let t=r.getFocusedElement();if(t?.item){t.item.run();let e=this._currentSubmenuElement?.item;this._hideSubmenu(),e&&this._delegate.onSelect(e),this.hide()}}else e.key===`ArrowDown`?(aa.stop(e,!0),r.focusNext()):e.key===`ArrowUp`&&(aa.stop(e,!0),r.focusPrevious())}))}let u=s.innerWidth-a.right,d=o.left,f=l+10;u>=f||u>=d?this._submenuContainer.style.left=`${o.right-o.left+4}px`:this._submenuContainer.style.left=`${-f-4}px`;let p=n?n.offsetHeight:0,m=c+p,h=s.innerHeight,g=a.height,_=a.top-o.top+(g-m)/2,v=o.top+_+m;v>h&&(_-=v-h+8),o.top+_<0&&(_=-o.top),this._submenuContainer.style.top=`${_}px`}_hideSubmenu(){this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._submenuDisposables.clear(),this._currentSubmenuWidget=void 0,this._currentSubmenuElement=void 0,this._clearSubmenuContainer(),this._submenuContainer.style.display=`none`}_clearSubmenuContainer(){this._submenuContainer.contains(Za())&&this._list.domFocus(),Mc(this._submenuContainer)}_scheduleSubmenuHide(){this._cancelSubmenuHide(),this._submenuHideTimeout=setTimeout(()=>{this._hideSubmenu()},300)}_cancelSubmenuHide(){this._submenuHideTimeout!==void 0&&(clearTimeout(this._submenuHideTimeout),this._submenuHideTimeout=void 0)}_scheduleSubmenuShow(e,t){this._cancelSubmenuShow(),this._submenuShowTimeout=setTimeout(()=>{this._submenuShowTimeout=void 0;let n=typeof t==`number`?this._getRowElement(t):null;n&&this._showSubmenuForElement(e,n)},500)}_cancelSubmenuShow(){this._submenuShowTimeout!==void 0&&(clearTimeout(this._submenuShowTimeout),this._submenuShowTimeout=void 0)}async onListHover(e){let t=e.element;if(t&&t.item&&this.focusCondition(t)){if(Br(e.browserEvent.target)&&e.browserEvent.target.closest(`.action-list-item-toolbar`)!==null){t.submenuActions?.length||this._cancelSubmenuShow(),this._list.setFocus([]);return}let n=!!(t.submenuActions?.length||t.hover?.content);if(n&&(this._suppressHover=!0),this._list.setFocus(typeof e.index==`number`?[e.index]:[]),n&&(this._suppressHover=!1),n){this._currentSubmenuElement===t?(this._cancelSubmenuHide(),this._cancelSubmenuShow()):(this._hideSubmenu(),this._scheduleSubmenuShow(t,e.index));return}if(this._currentSubmenuElement===t?this._cancelSubmenuHide():(this._cancelSubmenuShow(),this._hideSubmenu()),this._delegate.onHover&&!t.disabled&&t.kind===`action`&&this._currentSubmenuElement!==t){let n=await this._delegate.onHover(t.item,this.cts.token),r=n?n.canPreview:void 0;r!==t.canPreview&&(t.canPreview=r,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._hideSubmenu(),this._scheduleSubmenuShow(t,e.index)))}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};Lf=Of=Ef([Df(6,jr),Df(7,gn),Df(8,w)],Lf);var Rf=class extends j{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 anchorPosition(){if(this._showAbove!==void 0)return+!!this._showAbove}constructor(e,t,n,r,i,a,o,s,c,l){super(),this._contextViewService=s,this._layoutService=c,this._lastMinWidth=0,this._hasLaidOut=!1,this._anchor=o,this._widget=this._register(l.createInstance(Lf,e,t,n,r,i,a)),this._register(this._widget.onDidRequestLayout(()=>{this._hasLaidOut&&(this.layout(this._lastMinWidth),this._contextViewService.layout())}))}focus(){this._widget.focus()}hide(e){this._widget.hide(e),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(){let e=this.domNode.parentElement?.closest(`.action-widget`);if(!e)return 0;let t=_a(e).getComputedStyle(e),n=e=>Number.parseFloat(e)||0;return n(t.paddingTop)+n(t.paddingBottom)+n(t.borderTopWidth)+n(t.borderBottomWidth)}computeHeight(){let e=this._widget.computeListHeight(),t=this._widget.filterContainer?36:0,n=this._widget.footerContainer?32:0,r=this._widget.headerContainer?this._widget.headerContainer.offsetHeight||36:0,i=t+n+r,a=_a(this.domNode),o;if(this.hasDynamicHeight()){let e=a.innerHeight,t=qe(this._anchor),n=t.top-a.pageYOffset,r=e-n-t.height-30,s=n;if(this._showAbove===void 0){let e=i+this._widget.computeFullHeight();this._showAbove=e>r&&s>r}o=Math.max(0,(this._showAbove?s:r)-this.computeActionWidgetVerticalChromeHeight())}else{let e=this._layoutService.getContainer(a).clientHeight,t=this.domNode.getBoundingClientRect().top;o=t>0?e-t-10:e*.7}let s=Math.floor(a.innerHeight*.6),c=this._widget.lineHeight,l=Math.min(Math.max(o,c*3+i),s);return Math.min(e+i,l)-i}layout(e){this._hasLaidOut=!0,this._lastMinWidth=e;let t=this.computeHeight();this._widget.layout(t);let n=this._widget.computeMaxWidth(e);return this._cachedMaxWidth=n,this._widget.layout(t,this._cachedMaxWidth),this._cachedMaxWidth}};Rf=Ef([Df(7,Vr),Df(8,Te),Df(9,w)],Rf);function zf(e){return e.replace(/\r\n|\r|\n/g,` `)}var Bf=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Vf=function(e,t){return function(n,r){t(n,r,e)}};E(`actionBar.toggledBackground`,At,V(1713,`Background color for toggled action items in action bar.`));var Hf={Visible:new A(`codeActionMenuVisible`,!1,V(1714,`Whether the action widget list is visible`)),FilterFocused:new A(`codeActionMenuFilterFocused`,!1,V(1715,`Whether the action widget filter input is focused`))},Uf=Xt(`actionWidgetService`),Wf=class extends j{get isVisible(){return Hf.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,n){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=n,this._list=this._register(new Ae)}show(e,t,n,r,i,a,o,s,c){let l=Hf.Visible.bindTo(this._contextKeyService),u=this._instantiationService.createInstance(Rf,e,t,n,r,s,c,i);this._contextViewService.showContextView({getAnchor:()=>i,render:e=>(l.set(!0),this._renderWidget(e,u,o??[])),onHide:e=>{l.reset(),this._onWidgetClosed(e)},get anchorPosition(){return u.anchorPosition}},a,!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){this._list.value?.hide(e),this._list.clear()}_renderWidget(e,t,n){let r=document.createElement(`div`);if(r.classList.add(`action-widget`),e.appendChild(r),this._list.value=t,this._list.value)this._list.value.headerContainer&&r.appendChild(this._list.value.headerContainer),this._list.value.filterContainer&&r.appendChild(this._list.value.filterContainer),r.appendChild(this._list.value.domNode),this._list.value.footerContainer&&r.appendChild(this._list.value.footerContainer);else throw Error(`List has no value`);let i=new S,a=this._list.value.headerContainer;a&&i.add(Rl(a,e=>e.preventDefault()));let o=document.createElement(`div`),s=e.appendChild(o);s.classList.add(`context-view-block`),i.add(Rl(s,e=>e.stopPropagation()));let c=document.createElement(`div`),l=e.appendChild(c);l.classList.add(`context-view-pointerBlock`),i.add(K(l,pr.POINTER_MOVE,()=>l.remove())),i.add(Rl(l,()=>l.remove()));let u=0;if(n.length){let e=this._createActionBar(`.action-widget-action-bar`,n);e&&(r.appendChild(e.getContainer().parentElement),i.add(e),u=e.getContainer().offsetWidth)}let d=this._list.value?.layout(u);r.style.width=`${d}px`,this._list.value?.focus();let f=Hf.FilterFocused.bindTo(this._contextKeyService);if(i.add({dispose:()=>f.reset()}),this._list.value?.filterInput){let e=this._list.value.filterInput;i.add(K(e,`focus`,()=>f.set(!0))),i.add(K(e,`blur`,()=>f.set(!1)))}let p=i.add(Os(e));return i.add(p.onDidBlur(()=>{let e=Za();e?.closest(`.action-widget-hover`)||e?.closest(`.action-list-submenu-panel`)||this.hide(!0)})),i}_createActionBar(e,t){if(!t.length)return;let n=new Fn(I(e));return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};Wf=Bf([Vf(0,Vr),Vf(1,G),Vf(2,w)],Wf),us(Uf,Wf,1);var Gf=1100;x(class extends Ru{constructor(){super({id:`hideCodeActionWidget`,title:J(1716,`Hide action widget`),precondition:Hf.Visible,keybinding:{weight:Gf,primary:9,secondary:[1033]}})}run(e){e.get(Uf).hide(!0)}}),x(class extends Ru{constructor(){super({id:`clearFilterCodeActionWidget`,title:J(1717,`Clear action widget filter`),precondition:m.and(Hf.Visible,Hf.FilterFocused),keybinding:{weight:1101,primary:9}})}run(e){let t=e.get(Uf);t instanceof Wf&&(t.clearFilter()||t.hide(!0))}}),x(class extends Ru{constructor(){super({id:`selectPrevCodeAction`,title:J(1718,`Select previous action`),precondition:Hf.Visible,keybinding:{weight:Gf,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.focusPrevious()}}),x(class extends Ru{constructor(){super({id:`selectNextCodeAction`,title:J(1719,`Select next action`),precondition:Hf.Visible,keybinding:{weight:Gf,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.focusNext()}}),x(class extends Ru{constructor(){super({id:`collapseSectionCodeAction`,title:J(1720,`Collapse section`),precondition:m.and(Hf.Visible,Hf.FilterFocused.negate()),keybinding:{weight:Gf,primary:15}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.collapseSection()}}),x(class extends Ru{constructor(){super({id:`expandSectionCodeAction`,title:J(1721,`Expand section`),precondition:m.and(Hf.Visible,Hf.FilterFocused.negate()),keybinding:{weight:Gf,primary:17}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.expandSection()}}),x(class extends Ru{constructor(){super({id:`toggleSectionCodeAction`,title:J(1722,`Toggle section`),precondition:m.and(Hf.Visible,Hf.FilterFocused.negate()),keybinding:{weight:Gf,primary:10}})}run(e){let t=e.get(Uf);t instanceof Wf&&(t.toggleSection()||t.acceptSelected())}}),x(class extends Ru{constructor(){super({id:kf,title:J(1723,`Accept selected action`),precondition:Hf.Visible,keybinding:{weight:Gf,primary:3,secondary:[2137]}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.acceptSelected()}}),x(class extends Ru{constructor(){super({id:Af,title:J(1724,`Preview selected action`),precondition:Hf.Visible,keybinding:{weight:Gf,primary:2051}})}run(e){let t=e.get(Uf);t instanceof Wf&&t.acceptSelected(!0)}});var Kf=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},qf=function(e,t){return function(n,r){t(n,r,e)}},Jf,Yf=class extends j{static{Jf=this}static{this.baseId=`editor.widget.postEditWidget`}constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this.typeId=e,this.editor=t,this.showCommand=r,this.range=i,this.edits=a,this.onSelectNewEdit=o,this.additionalActions=s,this._keybindingService=l,this._actionWidgetService=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=n.bindTo(c),this.visibleContext.set(!0),this._register(bn(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(bn((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(e=>{this.dispose()})),this._register(Du.runAndSubscribe(l.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=I(`.post-edit-widget`),this.button=this._register(new Le(this.domNode,{supportIcons:!0})),this.button.label=`$(insert)`,this._register(K(this.domNode,pr.CLICK,()=>this.showSelector()))}getId(){return Jf.baseId+`.`+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let e=Po(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show(`postEditWidget`,!1,this.edits.allEdits.map((e,t)=>({kind:`action`,item:e,label:e.title,disabled:!1,canPreview:!1,group:{title:``,icon:C.fromId(t===this.edits.activeEditIndex?D.check.id:D.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:e=>{this._actionWidgetService.hide(!1);let t=this.edits.allEdits.findIndex(t=>t===e);if(t!==this.edits.activeEditIndex)return this.onSelectNewEdit(t)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}};Yf=Jf=Kf([qf(8,G),qf(9,jr),qf(10,Uf)],Yf);var Xf=class extends j{constructor(e,t,n,r,i,a,o,s){super(),this._id=e,this._editor=t,this._visibleContext=n,this._showCommand=r,this._getAdditionalActions=i,this._instantiationService=a,this._bulkEditService=o,this._notificationService=s,this._currentWidget=this._register(new Ae),this._register(Du.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,n,r,i){if(!e.length||!this._editor.hasModel())return;let a=this._editor.getModel(),o=t.allEdits.at(t.activeEditIndex);if(!o)return;let s=async a=>{let o=this._editor.getModel();o&&(await o.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:a,allEdits:t.allEdits},n,r,i))},c=(r,i)=>{Mo(r)||(this._notificationService.error(i),n&&this.show(e[0],t,s))},l=new pe(this._editor,3,void 0,i),u;try{u=await sc(r(o,l.token),l.token)}catch(e){return c(e,V(976,`Error resolving edit '{0}':
3
+ {1}`,o.title,Tf(e)))}finally{l.dispose()}if(i.isCancellationRequested)return;let d=bf(a.uri,e,u),f=e[0],p=a.deltaDecorations([],[{range:f,options:{description:`paste-line-suffix`,stickiness:0}}]);this._editor.focus();let m,h;try{m=await this._bulkEditService.apply(d,{editor:this._editor,token:i}),h=a.getDecorationRange(p[0])}catch(e){return c(e,V(977,`Error applying edit '{0}':
4
+ {1}`,o.title,Tf(e)))}finally{a.deltaDecorations(p,[])}i.isCancellationRequested||n&&m.isApplied&&t.allEdits.length>1&&this.show(h??f,t,s)}show(e,t,n){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(Yf,this._id,this._editor,this._visibleContext,this._showCommand,e,t,n,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};Xf=Kf([qf(5,w),qf(6,Et),qf(7,di)],Xf);var Zf=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qf=function(e,t){return function(n,r){t(n,r,e)}},$f,ep=`editor.changePasteType`,tp=`editor.pasteAs.preferences`,np=new A(`pasteWidgetVisible`,!1,V(956,`Whether the paste widget is showing`)),rp=`application/vnd.code.copymetadata`,ip=class extends j{static{$f=this}static{this.ID=`editor.contrib.copyPasteActionController`}static get(e){return e.getContribution($f.ID)}constructor(e,t,n,r,i,a,o,s,c,l){super(),this._logService=n,this._bulkEditService=r,this._clipboardService=i,this._commandService=a,this._configService=o,this._languageFeaturesService=s,this._quickInputService=c,this._progressService=l,this._editor=e,this._register(e.onWillCopy(e=>this.handleCopy(e))),this._register(e.onWillCut(e=>this.handleCopy(e))),this._register(e.onWillPaste(e=>this.handlePaste(e))),this._pasteProgressManager=this._register(new Wd(`pasteIntoEditor`,e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Xf,`pasteIntoEditor`,e,np,{id:ep,label:V(957,`Show paste options...`)},()=>$f._configureDefaultAction?[$f._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;let t=this._editor.getModel(),n=this._editor._getViewModel(),r=this._editor.getSelections();if(!t||!n||!r?.length)return;let i={multicursorText:e.dataToCopy.multicursorText??null,pasteOnNewLine:e.dataToCopy.isFromEmptySelection,mode:null},a=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(e=>!!e.prepareDocumentPaste);if(!a.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:i});return}let o=new co,s=a.flatMap(e=>e.copyMimeTypes??[]),c=as();this.setCopyMetadata(e.clipboardData,{id:c,providerCopyMimeTypes:s,defaultPastePayload:i});let l=a.map(n=>({providerMimeTypes:n.copyMimeTypes,operation:ql(r=>n.prepareDocumentPaste(t,e.dataToCopy.sourceRanges,o,r).catch(e=>{console.error(e)}))}));$f._currentCopyOperation?.operations.forEach(e=>e.operation.cancel()),$f._currentCopyOperation={handle:c,operations:l}}async handlePaste(e){if(this._logService.trace(`CopyPasteController#handlePaste for id : `,e.metadata?.id),!this._editor.hasTextFocus())return;let t=e.toExternalVSDataTransfer();if(!t)return;t.delete(rp),Jd.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;let n=this._editor.getModel(),r=this._editor.getSelections();if(!r?.length||!n||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;let i=this.fetchCopyMetadata(e);this._logService.trace(`CopyPasteController#handlePaste with metadata : `,i?.id,` and text.length : `,e.clipboardData.getData(`text/plain`).length);let a=Array.from(e.clipboardData.files).map(e=>e.type),o=[...e.clipboardData.types,...a,...i?.providerCopyMimeTypes??[],mc.uriList],s=this._languageFeaturesService.documentPasteEditProvider.ordered(n).filter(e=>{let t=this._pasteAsActionContext?.preferred;return t&&!this.providerMatchesPreference(e,t)?!1:e.pasteMimeTypes?.some(e=>Uc(e,o))});if(!s.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(r,this._pasteAsActionContext.preferred),e.setHandled());return}e.setHandled(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,s,r,t,i):this.doPasteInline(s,r,t,i,e.browserEvent)}showPasteAsNoEditMessage(e,t){let n=`only`in t?t.only.value:`preferences`in t?t.preferences.length?t.preferences.map(e=>e.value).join(`, `):V(958,`empty`):t.providerId;Jd.get(this._editor)?.showMessage(V(959,`No paste edits for '{0}' found`,n),e[0].getStartPosition())}doPasteInline(e,t,n,r,i){this._logService.trace(`CopyPasteController#doPasteInline`);let a=this._editor;if(!a.hasModel())return;let o=new pe(a,3,void 0),s=ql(async a=>{let c=this._editor;if(!c.hasModel())return;let l=c.getModel(),u=new S,d=u.add(new ou(a));u.add(o.token.onCancellationRequested(()=>d.cancel()));let f=d.token;try{if(await this.mergeInDataFromCopy(e,n,r,f),f.isCancellationRequested)return;let a=e.filter(e=>this.isSupportedPasteProvider(e,n));if(!a.length||a.length===1&&a[0]instanceof $d)return this.applyDefaultPasteHandler(n,r,f,i);let o={triggerKind:As.Automatic},s=await this.getPasteEdits(a,n,l,t,o,f);if(u.add(s),f.isCancellationRequested)return;if(s.edits.length===1&&s.edits[0].provider instanceof $d)return this.applyDefaultPasteHandler(n,r,f,i);if(s.edits.length){let e=c.getOption(97).showPasteSelector===`afterPaste`;return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(l,s.edits),allEdits:s.edits},e,async(e,n)=>{if(!e.provider.resolveDocumentPasteEdit)return e;let r=e.provider.resolveDocumentPasteEdit(e,n),i=new Ea,a=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),V(960,`Resolving paste edit for '{0}'. Click to cancel`,e.title),Vc(Promise.race([i.p,r]),n),{cancel:()=>i.cancel()},0);return a&&(e.insertText=a.insertText,e.additionalEdit=a.additionalEdit),e},f)}await this.applyDefaultPasteHandler(n,r,f,i)}finally{u.dispose(),this._currentPasteOperation===s&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),V(961,`Running paste handlers. Click to cancel and do basic paste`),s,{cancel:async()=>{s.cancel(),!o.token.isCancellationRequested&&await this.applyDefaultPasteHandler(n,r,o.token,i)}}).finally(()=>{o.dispose()}),this._currentPasteOperation=s}showPasteAsPick(e,t,n,r,i){this._logService.trace(`CopyPasteController#showPasteAsPick`);let a=ql(async o=>{let s=this._editor;if(!s.hasModel())return;let c=s.getModel(),l=new S,u=l.add(new pe(s,3,void 0,o));try{if(await this.mergeInDataFromCopy(t,r,i,u.token),u.token.isCancellationRequested)return;let a=t.filter(t=>this.isSupportedPasteProvider(t,r,e));e&&(a=a.filter(t=>this.providerMatchesPreference(t,e)));let o={triggerKind:As.PasteAs,only:e&&`only`in e?e.only:void 0},s=l.add(await this.getPasteEdits(a,r,c,n,o,u.token));if(u.token.isCancellationRequested)return;if(e&&(s={edits:s.edits.filter(t=>`only`in e?e.only.contains(t.kind):`preferences`in e?e.preferences.some(e=>e.contains(t.kind)):e.providerId===t.provider.id),dispose:s.dispose}),!s.edits.length){e&&this.showPasteAsNoEditMessage(n,e);return}let d;if(e)d=s.edits.at(0);else{let e={id:`editor.pasteAs.default`,label:V(962,`Configure default paste action`),edit:void 0},t=await this._quickInputService.pick([...s.edits.map(e=>({label:e.title,description:e.kind?.value,edit:e})),...$f._configureDefaultAction?[gs({type:`separator`}),{label:$f._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:V(963,`Select Paste Action`)});if(t===e){$f._configureDefaultAction?.run();return}d=t?.edit}if(!d)return;let f=bf(c.uri,n,d);await this._bulkEditService.apply(f,{editor:this._editor})}finally{l.dispose(),this._currentPasteOperation===a&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:V(964,`Running paste handlers`)},()=>a)}setCopyMetadata(e,t){this._logService.trace(`CopyPasteController#setCopyMetadata new id : `,t.id),e.setData(rp,JSON.stringify(t))}fetchCopyMetadata(e){this._logService.trace(`CopyPasteController#fetchCopyMetadata`);let t=e.clipboardData.getData(rp);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,n,r){if(this._logService.trace(`CopyPasteController#mergeInDataFromCopy with metadata : `,n?.id),n?.id&&$f._currentCopyOperation?.handle===n.id){let n=$f._currentCopyOperation.operations.filter(t=>e.some(e=>e.pasteMimeTypes.some(e=>Uc(e,t.providerMimeTypes)))).map(e=>e.operation),i=await Promise.all(n);if(r.isCancellationRequested)return;for(let e of i.reverse())if(e)for(let[n,r]of e)t.replace(n,r)}if(!t.has(mc.uriList)){let e=await this._clipboardService.readResources();if(r.isCancellationRequested)return;e.length&&t.append(mc.uriList,No(Yl.create(e)))}}async getPasteEdits(e,t,n,r,i,a){let o=new S;return{edits:xf(gc(await Vc(Promise.all(e.map(async e=>{try{let s=await e.provideDocumentPasteEdits?.(n,r,t,i,a);return s&&o.add(s),s?.edits?.map(t=>({...t,provider:e}))}catch(e){Mo(e)||console.error(e);return}})),a)??[]).flat().filter(e=>!i.only||i.only.contains(e.kind))),dispose:()=>o.dispose()}}async applyDefaultPasteHandler(e,t,n,r){let i=await(e.get(mc.text)??e.get(`text`))?.asString()??``;if(n.isCancellationRequested)return;let a={clipboardEvent:r,text:i,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`,a)}isSupportedPasteProvider(e,t,n){return e.pasteMimeTypes?.some(e=>t.matches(e))?!n||this.providerMatchesPreference(e,n):!1}providerMatchesPreference(e,t){return`only`in t?e.providedPasteEditKinds.some(e=>t.only.contains(e)):`preferences`in t?e.providedPasteEditKinds.some(e=>t.preferences.some(t=>t.contains(e))):e.id===t.providerId}getInitialActiveEditIndex(e,t){let n=this._configService.getValue(tp,{resource:e.uri});for(let e of Array.isArray(n)?n:[]){let n=new zd(e),r=t.findIndex(e=>n.contains(e.kind));if(r>=0)return r}return 0}};ip=$f=Zf([Qf(1,w),Qf(2,Pl),Qf(3,Et),Qf(4,xe),Qf(5,tr),Qf(6,xa),Qf(7,q),Qf(8,Fi),Qf(9,kl)],ip);var ap=`9_cutcopypaste`,op=Oi||document.queryCommandSupported(`cut`),sp=Oi||document.queryCommandSupported(`copy`),cp=navigator.clipboard===void 0||is?document.queryCommandSupported(`paste`):!0;function lp(e){return e.register(),e}var up=op?lp(new nn({id:`editor.action.clipboardCutAction`,precondition:void 0,kbOpts:Oi?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:Z.MenubarEditMenu,group:`2_ccp`,title:V(849,`Cu&&t`),order:1},{menuId:Z.EditorContext,group:ap,title:V(850,`Cut`),when:z.writable,order:1},{menuId:Z.CommandPalette,group:``,title:V(851,`Cut`),order:1},{menuId:Z.SimpleEditorContext,group:ap,title:V(852,`Cut`),when:z.writable,order:1}]})):void 0,dp=sp?lp(new nn({id:`editor.action.clipboardCopyAction`,precondition:void 0,kbOpts:Oi?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:Z.MenubarEditMenu,group:`2_ccp`,title:V(853,`&&Copy`),order:2},{menuId:Z.EditorContext,group:ap,title:V(854,`Copy`),order:2},{menuId:Z.CommandPalette,group:``,title:V(855,`Copy`),order:1},{menuId:Z.SimpleEditorContext,group:ap,title:V(856,`Copy`),order:2}]})):void 0;_e.appendMenuItem(Z.MenubarEditMenu,{submenu:Z.MenubarCopy,title:J(861,`Copy As`),group:`2_ccp`,order:3}),_e.appendMenuItem(Z.EditorContext,{submenu:Z.EditorContextCopy,title:J(862,`Copy As`),group:ap,order:3}),_e.appendMenuItem(Z.EditorContext,{submenu:Z.EditorContextShare,title:J(863,`Share`),group:`11_share`,order:-1,when:m.and(m.notEquals(`resourceScheme`,`output`),z.editorTextFocus)}),_e.appendMenuItem(Z.ExplorerContext,{submenu:Z.ExplorerContextShare,title:J(864,`Share`),group:`11_share`,order:-1});var fp=cp?lp(new nn({id:`editor.action.clipboardPasteAction`,precondition:void 0,kbOpts:Oi?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:Z.MenubarEditMenu,group:`2_ccp`,title:V(857,`&&Paste`),order:4},{menuId:Z.EditorContext,group:ap,title:V(858,`Paste`),when:z.writable,order:4},{menuId:Z.CommandPalette,group:``,title:V(859,`Paste`),order:1},{menuId:Z.SimpleEditorContext,group:ap,title:V(860,`Paste`),when:z.writable,order:4}]})):void 0,pp=class extends N{constructor(){super({id:`editor.action.clipboardCopyWithSyntaxHighlightingAction`,label:J(865,`Copy with Syntax Highlighting`),precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:0,weight:100}})}run(e,t){let n=e.get(Pl),r=e.get(xe);n.trace(`ExecCommandCopyWithSyntaxHighlightingAction#run`),t.hasModel()&&(!t.getOption(45)&&t.getSelection().isEmpty()||(Oa.forceCopyWithSyntaxHighlighting=!0,t.focus(),n.trace(`ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)`),mp(t,r),n.trace(`ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)`),Oa.forceCopyWithSyntaxHighlighting=!1))}};function mp(e,t){if(Oa.electronBugWorkaroundCopyEventHasFired=!1,e.getContainerDomNode().ownerDocument.execCommand(`copy`),Oi&&Oa.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:n}=Tl(e._getViewModel(),void 0,is);t.writeText(n.text)}}function hp(e,t){e&&(e.addImplementation(1e4,`code-editor`,(e,n)=>{let r=e.get(Pl),i=e.get(xe);r.trace(`registerExecCommandImpl (addImplementation code-editor for : `,t,`)`);let a=e.get(Di).getFocusedCodeEditor();if(a&&a.hasTextFocus()&&a.hasModel()){let e=a.getOption(45),n=a.getSelection();return n&&n.isEmpty()&&!e||(a.getOption(170)&&t===`cut`?(gp(a),r.trace(`registerExecCommandImpl (before execCommand copy)`),mp(a,i),a.trigger(void 0,`cut`,void 0),r.trace(`registerExecCommandImpl (after execCommand copy)`)):(gp(a),r.trace(`registerExecCommandImpl (before execCommand `+t+`)`),t===`copy`?mp(a,i):a.getContainerDomNode().ownerDocument.execCommand(t),r.trace(`registerExecCommandImpl (after execCommand `+t+`)`))),!0}return!1}),e.addImplementation(0,`generic-dom`,(e,n)=>{let r=e.get(Pl);return r.trace(`registerExecCommandImpl (addImplementation generic-dom for : `,t,`)`),r.trace(`registerExecCommandImpl (before execCommand `+t+`)`),El().execCommand(t),r.trace(`registerExecCommandImpl (after execCommand `+t+`)`),!0}))}function gp(e){if(e.getOption(170)){let t=mn.get(e.getId());t&&t.handleWillCopy()}}hp(up,`cut`),hp(dp,`copy`),fp&&(fp.addImplementation(1e4,`code-editor`,(e,t)=>{let n=e.get(Pl);n.trace(`registerExecCommandImpl (addImplementation code-editor for : paste)`);let r=e.get(Di),i=e.get(xe),a=r.getFocusedCodeEditor();if(a&&a.hasModel()&&a.hasTextFocus()){if(a.getOption(170)){let e=mn.get(a.getId());e&&e.handleWillPaste()}n.trace(`registerExecCommandImpl (before triggerPaste)`);let e=i.triggerPaste(Qs().vscodeWindowId);return e?(n.trace(`registerExecCommandImpl (triggerPaste defined)`),e.then(async()=>(n.trace(`registerExecCommandImpl (after triggerPaste)`),ip.get(a)?.finishedPaste()??Promise.resolve()))):(n.trace(`registerExecCommandImpl (triggerPaste undefined)`),ct?(n.trace(`registerExecCommandImpl (Paste handling on web)`),(async()=>{let e=await i.readText();if(e!==``){let t=jc.INSTANCE.get(e),r=!1,i=null,o=null;t&&(r=a.getOption(45)&&!!t.isFromEmptySelection,i=t.multicursorText===void 0?null:t.multicursorText,o=t.mode),n.trace(`registerExecCommandImpl (clipboardText.length : `,e.length,` id : `,t?.id,`)`),a.trigger(`keyboard`,`paste`,{text:e,pasteOnNewLine:r,multicursorText:i,mode:o})}})()):!0)}return!1}),fp.addImplementation(0,`generic-dom`,(e,t)=>(e.get(Pl).trace(`registerExecCommandImpl (addImplementation generic-dom for : paste)`),e.get(xe).triggerPaste(Qs().vscodeWindowId)??!1))),sp&&O(pp);var _p=new class{constructor(){this.QuickFix=new zd(`quickfix`),this.Refactor=new zd(`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 zd(`notebook`),this.Source=new zd(`source`),this.SourceOrganizeImports=this.Source.append(`organizeImports`),this.SourceFixAll=this.Source.append(`fixAll`),this.SurroundWith=this.Refactor.append(`surround`)}},vp;(function(e){e.Refactor=`refactor`,e.RefactorPreview=`refactor preview`,e.Lightbulb=`lightbulb`,e.Default=`other (default)`,e.SourceAction=`source action`,e.QuickFix=`quick fix action`,e.FixAll=`fix all`,e.OrganizeImports=`organize imports`,e.AutoFix=`auto fix`,e.QuickFixHover=`quick fix hover window`,e.OnSave=`save participants`,e.ProblemsView=`problems view`})(vp||={});function yp(e,t){return!(e.include&&!e.include.intersects(t)||e.excludes&&e.excludes.some(n=>xp(t,n,e.include))||!e.includeSourceActions&&_p.Source.contains(t))}function bp(e,t){let n=t.kind?new zd(t.kind):void 0;return!(e.include&&(!n||!e.include.contains(n))||e.excludes&&n&&e.excludes.some(t=>xp(n,t,e.include))||!e.includeSourceActions&&n&&_p.Source.contains(n)||e.onlyIncludePreferredActions&&!t.isPreferred)}function xp(e,t,n){return!(!t.contains(e)||n&&t.contains(n))}var Sp=class e{static fromUser(t,n){return!t||typeof t!=`object`?new e(n.kind,n.apply,!1):new e(e.getKindFromUser(t,n.kind),e.getApplyFromUser(t,n.apply),e.getPreferredUser(t))}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 zd(e.kind):t}static getPreferredUser(e){return typeof e.preferred==`boolean`?e.preferred:!1}constructor(e,t,n){this.kind=e,this.apply=t,this.preferred=n}},Cp=class{constructor(e,t,n){this.action=e,this.provider=t,this.highlightRange=n}async resolve(e){if(this.provider?.resolveCodeAction&&!this.action.edit){let t;try{t=await this.provider.resolveCodeAction(this.action,e)}catch(e){cc(e)}t&&(this.action.edit=t.edit)}return this}},wp=`editor.action.codeAction`,Tp=`editor.action.quickFix`,Ep=`editor.action.autoFix`,Dp=`editor.action.refactor`,Op=`editor.action.sourceAction`,kp=`editor.action.organizeImports`,Ap=`editor.action.fixAll`,jp=1e3,Mp=class e extends j{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:t},{action:n}){return t.isAI&&!n.isAI?1:!t.isAI&&n.isAI?-1:Fu(t.diagnostics)?Fu(n.diagnostics)?e.codeActionsPreferredComparator(t,n):-1:Fu(n.diagnostics)?1:e.codeActionsPreferredComparator(t,n)}constructor(t,n,r){super(),this.documentation=n,this._register(r),this.allActions=[...t].sort(e.codeActionsComparator),this.validActions=this.allActions.filter(({action:e})=>!e.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&_p.QuickFix.contains(new zd(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}},Np={actions:[],documentation:void 0};async function Pp(e,t,n,r,i,a){let o=r.filter||{},s={...o,excludes:[...o.excludes||[],_p.Notebook]},c={only:o.include?.value,trigger:r.type},l=new Ci(t,a),u=Fp(e,t,r.type===2?s:o),d=new S,f=u.map(async e=>{let r=setTimeout(()=>i.report(e),1250);try{let r=await e.provideCodeActions(t,n,c,l.token);if(l.token.isCancellationRequested)return r?.dispose(),Np;r&&d.add(r);let i=(r?.actions||[]).filter(e=>e&&bp(o,e)),a=Lp(e,i,o.include);return{actions:i.map(t=>new Cp(t,e)),documentation:a}}catch(e){if(Mo(e))throw e;return cc(e),Np}finally{clearTimeout(r)}}),p=e.onDidChange(()=>{pu(e.all(t),u)||l.cancel()});try{let n=await Promise.all(f),i=n.map(e=>e.actions).flat(),a=new Mp(i,[...gc(n.map(e=>e.documentation)),...Ip(e,t,r,i)],d);return d.add(a),a}catch(e){throw d.dispose(),e}finally{p.dispose(),l.dispose()}}function Fp(e,t,n){return e.all(t).filter(e=>e.providedCodeActionKinds?e.providedCodeActionKinds.some(e=>yp(n,new zd(e))):!0)}function*Ip(e,t,n,r){if(t&&r.length)for(let i of e.all(t))i._getAdditionalMenuItems&&(yield*i._getAdditionalMenuItems?.({trigger:n.type,only:n.filter?.include?.value},r.map(e=>e.action)))}function Lp(e,t,n){if(!e.documentation)return;let r=e.documentation.map(e=>({kind:new zd(e.kind),command:e.command}));if(n){let e;for(let t of r)t.kind.contains(n)&&(e?e.kind.contains(t.kind)&&(e=t):e=t);if(e)return e?.command}for(let e of t)if(e.kind){for(let t of r)if(t.kind.contains(new zd(e.kind)))return t.command}}var Rp;(function(e){e.OnSave=`onSave`,e.FromProblemsView=`fromProblemsView`,e.FromCodeActions=`fromCodeActions`,e.FromAILightbulb=`fromAILightbulb`,e.FromProblemsHover=`fromProblemsHover`})(Rp||={});async function zp(e,t,n,r,i=B.None){let a=e.get(Et),o=e.get(tr),s=e.get(au),c=e.get(di),l=e.get(Lo);if(s.publicLog2(`codeAction.applyCodeAction`,{codeActionTitle:t.action.title,codeActionKind:t.action.kind,codeActionIsPreferred:!!t.action.isPreferred,reason:n}),l.playSignal(po.codeActionTriggered),await t.resolve(i),!i.isCancellationRequested&&!(t.action.edit?.edits.length&&!(await a.apply(t.action.edit,{editor:r?.editor,label:t.action.title,quotableLabel:t.action.title,code:`undoredo.codeAction`,respectAutoSaveConfig:n!==Rp.OnSave,showPreview:r?.preview,reason:Ln.codeAction({kind:t.action.kind,providerId:ue.fromExtensionId(t.provider?.extensionId)})})).isApplied)){if(t.action.command)try{await o.executeCommand(t.action.command.id,...t.action.command.arguments||[])}catch(e){let t=Bp(e);c.error(typeof t==`string`?t:V(866,`An unknown error occurred while applying the code action`))}setTimeout(()=>l.playSignal(po.codeActionApplied),jp)}}function Bp(e){if(typeof e==`string`)return e;if(e instanceof Error&&typeof e.message==`string`)return e.message}jn.registerCommand(`_executeCodeActionProvider`,async function(e,t,n,r,i){if(!(t instanceof On))throw so();let{codeActionProvider:a}=e.get(q),o=e.get(yt).getModel(t);if(!o)throw so();let s=P.isISelection(n)?P.liftSelection(n):T.isIRange(n)?o.validateRange(n):void 0;if(!s)throw so();let c=typeof r==`string`?new zd(r):void 0,l=await Pp(a,o,s,{type:1,triggerAction:vp.Default,filter:{includeSourceActions:!0,include:c}},eo.None,B.None),u=[],d=Math.min(l.validActions.length,typeof i==`number`?i:0);for(let e=0;e<d;e++)u.push(l.validActions[e].resolve(B.None));try{return await Promise.all(u),l.validActions.map(e=>e.action)}finally{setTimeout(()=>l.dispose(),100)}});var Vp=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Hp=function(e,t){return function(n,r){t(n,r,e)}},Up,Wp=class{static{Up=this}static{this.codeActionCommands=[Dp,wp,Op,kp,Ap]}constructor(e){this.keybindingService=e}getResolver(){let e=new yc(()=>this.keybindingService.getKeybindings().filter(e=>Up.codeActionCommands.indexOf(e.command)>=0).filter(e=>e.resolvedKeybinding).map(e=>{let t=e.commandArgs;return e.command===`editor.action.organizeImports`?t={kind:_p.SourceOrganizeImports.value}:e.command===`editor.action.fixAll`&&(t={kind:_p.SourceFixAll.value}),{resolvedKeybinding:e.resolvedKeybinding,...Sp.fromUser(t,{kind:zd.None,apply:`never`})}}));return t=>{if(t.kind)return this.bestKeybindingForCodeAction(t,e.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;let n=new zd(e.kind);return t.filter(e=>e.kind.contains(n)).filter(t=>t.preferred?e.isPreferred:!0).reduceRight((e,t)=>e?e.kind.contains(t.kind)?t:e:t,void 0)}};Wp=Up=Vp([Hp(0,jr)],Wp),E(`symbolIcon.arrayForeground`,Ts,V(1547,`The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.booleanForeground`,Ts,V(1548,`The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.classForeground`,{dark:`#EE9D28`,light:`#D67E00`,hcDark:`#EE9D28`,hcLight:`#D67E00`},V(1549,`The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.colorForeground`,Ts,V(1550,`The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.constantForeground`,Ts,V(1551,`The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.constructorForeground`,{dark:`#B180D7`,light:`#652D90`,hcDark:`#B180D7`,hcLight:`#652D90`},V(1552,`The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.enumeratorForeground`,{dark:`#EE9D28`,light:`#D67E00`,hcDark:`#EE9D28`,hcLight:`#D67E00`},V(1553,`The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.enumeratorMemberForeground`,{dark:`#75BEFF`,light:`#007ACC`,hcDark:`#75BEFF`,hcLight:`#007ACC`},V(1554,`The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.eventForeground`,{dark:`#EE9D28`,light:`#D67E00`,hcDark:`#EE9D28`,hcLight:`#D67E00`},V(1555,`The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.fieldForeground`,{dark:`#75BEFF`,light:`#007ACC`,hcDark:`#75BEFF`,hcLight:`#007ACC`},V(1556,`The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.fileForeground`,Ts,V(1557,`The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.folderForeground`,Ts,V(1558,`The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.functionForeground`,{dark:`#B180D7`,light:`#652D90`,hcDark:`#B180D7`,hcLight:`#652D90`},V(1559,`The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.interfaceForeground`,{dark:`#75BEFF`,light:`#007ACC`,hcDark:`#75BEFF`,hcLight:`#007ACC`},V(1560,`The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.keyForeground`,Ts,V(1561,`The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.keywordForeground`,Ts,V(1562,`The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.methodForeground`,{dark:`#B180D7`,light:`#652D90`,hcDark:`#B180D7`,hcLight:`#652D90`},V(1563,`The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.moduleForeground`,Ts,V(1564,`The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.namespaceForeground`,Ts,V(1565,`The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.nullForeground`,Ts,V(1566,`The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.numberForeground`,Ts,V(1567,`The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.objectForeground`,Ts,V(1568,`The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.operatorForeground`,Ts,V(1569,`The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.packageForeground`,Ts,V(1570,`The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.propertyForeground`,Ts,V(1571,`The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.referenceForeground`,Ts,V(1572,`The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.snippetForeground`,Ts,V(1573,`The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.stringForeground`,Ts,V(1574,`The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.structForeground`,Ts,V(1575,`The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.textForeground`,Ts,V(1576,`The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.typeParameterForeground`,Ts,V(1577,`The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.unitForeground`,Ts,V(1578,`The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`)),E(`symbolIcon.variableForeground`,{dark:`#75BEFF`,light:`#007ACC`,hcDark:`#75BEFF`,hcLight:`#007ACC`},V(1579,`The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget.`));var Gp=Object.freeze({kind:zd.Empty,title:V(902,`More Actions...`)}),Kp=Object.freeze([{kind:_p.QuickFix,title:V(903,`Quick Fix`)},{kind:_p.RefactorExtract,title:V(904,`Extract`),icon:D.wrench},{kind:_p.RefactorInline,title:V(905,`Inline`),icon:D.wrench},{kind:_p.RefactorRewrite,title:V(906,`Rewrite`),icon:D.wrench},{kind:_p.RefactorMove,title:V(907,`Move`),icon:D.wrench},{kind:_p.SurroundWith,title:V(908,`Surround With`),icon:D.surroundWith},{kind:_p.Source,title:V(909,`Source Action`),icon:D.symbolFile},Gp]);function qp(e,t,n){if(!t)return e.map(e=>({kind:`action`,item:e,group:Gp,disabled:!!e.action.disabled,label:e.action.disabled||e.action.title,canPreview:!!e.action.edit?.edits.length}));let r=Kp.map(e=>({group:e,actions:[]}));for(let t of e){let e=t.action.kind?new zd(t.action.kind):zd.None;for(let n of r)if(n.group.kind.contains(e)){n.actions.push(t);break}}let i=[];for(let e of r)if(e.actions.length){i.push({kind:`header`,group:e.group});for(let t of e.actions){let r=e.group;i.push({kind:`action`,item:t,group:t.action.isAI?{title:r.title,kind:r.kind,icon:D.sparkle}:r,label:t.action.title,disabled:!!t.action.disabled,keybinding:n(t.action)})}}return i}var Jp=new A(`supportedCodeAction`,``),Yp=class extends j{constructor(e,t,n,r=250){super(),this._editor=e,this._markerService=t,this._signalChange=n,this._delay=r,this._autoTriggerTimer=this._register(new Ja),this.ignoreLightbulbOff=!1,this._register(this._markerService.onMarkerChanged(e=>this._onMarkerChanges(e))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){let t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){let t=this._editor.getModel();t&&e.some(e=>ao(e,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:vp.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;let t=this._editor.getSelection();if(e.type===1)return t;let n=this._editor.getOption(73).enabled;if(!(n===Qc.Off&&!this.ignoreLightbulbOff)){if(n===Qc.Off||n===Qc.On)return t;if(n===Qc.OnCode){if(!t.isEmpty())return t;let e=this._editor.getModel(),{lineNumber:n,column:r}=t.getPosition(),i=e.getLineContent(n);if(i.length===0)return;if(r===1){if(/\s/.test(i[0]))return}else if(r===e.getLineMaxColumn(n)){if(/\s/.test(i[i.length-1]))return}else if(/\s/.test(i[r-2])&&/\s/.test(i[r-1]))return}return t}}},Xp;(function(e){e.Empty={type:0};class t{constructor(e,t,n){this.trigger=e,this.position=t,this._cancellablePromise=n,this.type=1,this.actions=n.catch(e=>{if(Mo(e))return Zp;throw e})}cancel(){this._cancellablePromise.cancel()}}e.Triggered=t})(Xp||={});var Zp=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1}),Qp=class extends j{constructor(e,t,n,r,i,a){super(),this._editor=e,this._registry=t,this._markerService=n,this._progressService=i,this._configurationService=a,this._codeActionOracle=this._register(new Ae),this._state=Xp.Empty,this._onDidChangeState=this._register(new U),this.onDidChangeState=this._onDidChangeState.event,this.codeActionsDisposable=this._register(new Ae),this._disposed=!1,this._ignoreLightbulbOff=!1,this._supportedCodeActions=Jp.bindTo(r),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(e=>{e.hasChanged(73)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Xp.Empty,!0))}_settingEnabledNearbyQuickfixes(){let e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue(`editor.codeActionWidget.includeNearbyQuickFixes`,{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Xp.Empty);let e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(104)){let t=this._registry.all(e).flatMap(e=>e.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(` `));let n=new Yp(this._editor,this._markerService,t=>{if(!t){this.setState(Xp.Empty);return}let n=t.selection.getStartPosition(),r=ql(async n=>{if(this._settingEnabledNearbyQuickfixes()&&t.trigger.type===1&&(t.trigger.triggerAction===vp.QuickFix||t.trigger.filter?.include?.contains(_p.QuickFix))){let r=await Pp(this._registry,e,t.selection,t.trigger,eo.None,n);this.codeActionsDisposable.value=r;let i=[...r.allActions];if(n.isCancellationRequested)return r.dispose(),Zp;let a=r.validActions?.some(e=>e.action.kind&&_p.QuickFix.contains(new zd(e.action.kind))&&!e.action.isAI),o=this._markerService.read({resource:e.uri});if(a){for(let e of r.validActions)e.action.command?.arguments?.some(e=>typeof e==`string`&&e.includes(`_typescript.applyFixAllCodeAction`))&&(e.action.diagnostics=[...o.filter(e=>e.relatedInformation)]);return{validActions:r.validActions,allActions:i,documentation:r.documentation,hasAutoFix:r.hasAutoFix,hasAIFix:r.hasAIFix,allAIFixes:r.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=r}}}else if(!a&&o.length>0){let a=t.selection.getPosition(),s=a,c=Number.MAX_VALUE,l=[...r.validActions];for(let u of o){let d=u.endColumn,f=u.endLineNumber,p=u.startLineNumber;if(f===a.lineNumber||p===a.lineNumber){s=new M(f,d);let u={type:t.trigger.type,triggerAction:t.trigger.triggerAction,filter:{include:t.trigger.filter?.include?t.trigger.filter?.include:_p.QuickFix},autoApply:t.trigger.autoApply,context:{notAvailableMessage:t.trigger.context?.notAvailableMessage||``,position:s}},p=new P(s.lineNumber,s.column,s.lineNumber,s.column),m=await Pp(this._registry,e,p,u,eo.None,n);if(n.isCancellationRequested)return m.dispose(),Zp;if(m.validActions.length!==0){for(let e of m.validActions)e.action.command?.arguments?.some(e=>typeof e==`string`&&e.includes(`_typescript.applyFixAllCodeAction`))&&(e.action.diagnostics=[...o.filter(e=>e.relatedInformation)]);r.allActions.length===0&&i.push(...m.allActions),Math.abs(a.column-d)<c?l.unshift(...m.validActions):l.push(...m.validActions)}c=Math.abs(a.column-d)}}let u=l.filter((e,t,n)=>n.findIndex(t=>t.action.title===e.action.title)===t);return u.sort((e,t)=>e.action.isPreferred&&!t.action.isPreferred?-1:!e.action.isPreferred&&t.action.isPreferred||e.action.isAI&&!t.action.isAI?1:!e.action.isAI&&t.action.isAI?-1:0),{validActions:u,allActions:i,documentation:r.documentation,hasAutoFix:r.hasAutoFix,hasAIFix:r.hasAIFix,allAIFixes:r.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=r}}}}if(t.trigger.type===1){let r=await Pp(this._registry,e,t.selection,t.trigger,eo.None,n);return this.codeActionsDisposable.value=r,r}let r=await Pp(this._registry,e,t.selection,t.trigger,eo.None,n);return this.codeActionsDisposable.value=r,r});t.trigger.type===1&&this._progressService?.showWhile(r,250);let i=new Xp.Triggered(t.trigger,n,r),a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&i.type===1&&i.trigger.type===2&&this._state.position!==i.position),a?setTimeout(()=>{this.setState(i)},500):this.setState(i)},void 0);n.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=n,this._codeActionOracle.value.trigger({type:2,triggerAction:vp.Default})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e),this.codeActionsDisposable.dispose()}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}},$p=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},em=function(e,t){return function(n,r){t(n,r,e)}},tm,nm=Vs(`gutter-lightbulb`,D.lightBulb,V(910,`Icon which spawns code actions menu from the gutter when there is no space in the editor.`)),rm=Vs(`gutter-lightbulb-auto-fix`,D.lightbulbAutofix,V(911,`Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.`)),im=Vs(`gutter-lightbulb-sparkle`,D.lightbulbSparkle,V(912,`Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.`)),am=Vs(`gutter-lightbulb-aifix-auto-fix`,D.lightbulbSparkleAutofix,V(913,`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.`)),om=Vs(`gutter-lightbulb-sparkle-filled`,D.sparkleFilled,V(914,`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.`)),sm;(function(e){e.Hidden={type:0};class t{constructor(e,t,n,r){this.actions=e,this.trigger=t,this.editorPosition=n,this.widgetPosition=r,this.type=1}}e.Showing=t})(sm||={});function cm(e,t,n,r,i=!1){if(e.validActions.length<=0)return;let a,o=!1;e.allAIFixes?(a=i?om:D.sparkleFilled,e.validActions.length===1&&(o=!0)):a=e.hasAutoFix?e.hasAIFix?i?am:D.lightbulbSparkleAutofix:i?rm:D.lightbulbAutofix:e.hasAIFix?i?im:D.lightbulbSparkle:i?nm:D.lightBulb;let s;return s=o?V(915,`Run: {0}`,e.validActions[0].action.title):e.hasAutoFix&&n?V(916,`Show Code Actions. Preferred Quick Fix Available ({0})`,n):!e.hasAutoFix&&r?V(917,`Show Code Actions ({0})`,r):V(918,`Show Code Actions`),{actions:e,trigger:t,icon:a,autoRun:o,title:s,isGutter:i}}var lm=class extends j{static{tm=this}static{this.GUTTER_DECORATION=Y.register({description:`codicon-gutter-lightbulb-decoration`,glyphMarginClassName:C.asClassName(D.lightBulb),glyphMargin:{position:Wr.Left},stickiness:1})}static{this.ID=`editor.contrib.lightbulbWidget`}static{this._posPref=[0]}static _computeLightBulbInfo(e,t,n,r){if(e.type===1)return cm(e.actions,e.trigger,n,r,t)}constructor(e,t){super(),this._editor=e,this._keybindingService=t,this.onlyWithEmptySelection=!1,this._onClick=this._register(new U),this.onClick=this._onClick.event,this._state=St(this,sm.Hidden),this._gutterState=St(this,sm.Hidden),this._combinedInfo=L(this,e=>{let t=this._gutterState.read(e);if(t.type===1)return tm._computeLightBulbInfo(t,!0,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e));let n=this._state.read(e);if(n.type===1)return tm._computeLightBulbInfo(n,!1,this._preferredKbLabel.read(e),this._quickFixKbLabel.read(e))}),this._iconClasses=[],this.lightbulbClasses=[`codicon-`+nm.id,`codicon-`+am.id,`codicon-`+rm.id,`codicon-`+im.id,`codicon-`+om.id],this._preferredKbLabel=St(this,void 0),this._quickFixKbLabel=St(this,void 0),this.gutterDecoration=tm.GUTTER_DECORATION,this._domNode=I(`div.lightBulbWidget`),this._domNode.role=`listbox`,this._register(zr.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(e=>{let t=this._editor.getModel(),n=this._state.get();(n.type!==1||!t||n.editorPosition.lineNumber>=t.getLineCount())&&this.hide();let r=this._gutterState.get();(r.type!==1||!t||r.editorPosition.lineNumber>=t.getLineCount())&&this.gutterHide()})),this._register(ml(this._domNode,e=>{let t=this._state.get();if(t.type!==1)return;this._editor.focus(),e.preventDefault();let{top:n,height:r}=Po(this._domNode),i=this._editor.getOption(75),a=Math.floor(i/3);t.widgetPosition.position!==null&&t.widgetPosition.position.lineNumber<t.editorPosition.lineNumber&&(a+=i),this._onClick.fire({x:e.posx,y:n+r+a,actions:t.actions,trigger:t.trigger})})),this._register(K(this._domNode,`mouseenter`,e=>{(e.buttons&1)==1&&this.hide()})),this._register(Du.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(k(e=>{let t=this._combinedInfo.read(e);this._updateLightBulbTitleAndIcon(t),this._updateGutterDecorationOptions(t)})),this._register(this._editor.onMouseDown(async e=>{if(!e.target.element||!this.lightbulbClasses.some(t=>e.target.element&&e.target.element.classList.contains(t)))return;let t=this._gutterState.get();if(t.type!==1)return;this._editor.focus();let{top:n,height:r}=Po(e.target.element),i=this._editor.getOption(75),a=Math.floor(i/3);t.widgetPosition.position!==null&&t.widgetPosition.position.lineNumber<t.editorPosition.lineNumber&&(a+=i),this._onClick.fire({x:e.event.posx,y:n+r+a,actions:t.actions,trigger:t.trigger})}))}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return`LightBulbWidget`}getDomNode(){return this._domNode}getPosition(){let e=this._state.get();return e.type===1?e.widgetPosition:null}update(e,t,n){if(e.validActions.length<=0||this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty()||!this._editor.hasTextFocus()||this._editor.getOptions().get(73).enabled===Qc.Off)return this.gutterHide(),this.hide();let r=this._editor.getModel();if(!r)return this.gutterHide(),this.hide();let{lineNumber:i,column:a}=r.validatePosition(n),o=r.getOptions().tabSize,s=this._editor.getOptions().get(59),c=ua(r.getLineContent(i),o),l=s.spaceWidth*c>22,u=e=>e>2&&this._editor.getTopForLineNumber(e)===this._editor.getTopForLineNumber(e-1),d=this._editor.getLineDecorations(i),f=!1;if(d)for(let e of d){let t=e.options.glyphMarginClassName;if(t&&!this.lightbulbClasses.some(e=>t.includes(e))){f=!0;break}}let p=i,m=1;if(!l){let o=e=>{let t=r.getLineContent(e);return/^\s*$|^\s+/.test(t)||t.length<=m};if(i>1&&!u(i-1)){let a=i===r.getLineCount(),s=i>1&&o(i-1),c=!a&&o(i+1),l=o(i),u=!c&&!s;if(!c&&!s&&!f)return this._gutterState.set(new sm.Showing(e,t,n,{position:{lineNumber:p,column:m},preference:tm._posPref}),void 0),this.renderGutterLightbub(),this.hide();s||a||s&&!l?--p:(c||u&&l)&&(p+=1)}else if(i===1&&(i===r.getLineCount()||!o(i+1)&&!o(i)))if(this._gutterState.set(new sm.Showing(e,t,n,{position:{lineNumber:p,column:m},preference:tm._posPref}),void 0),f)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(i<r.getLineCount()&&!u(i+1))p+=1;else if(a*s.spaceWidth<22)return this.hide();m=/^\S\s*$/.test(r.getLineContent(p))?2:1}this._state.set(new sm.Showing(e,t,n,{position:{lineNumber:p,column:m},preference:tm._posPref}),void 0),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());let h=e.validActions,g=e.validActions[0].action.kind;if(h.length!==1||!g){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this._state.get()!==sm.Hidden&&(this._state.set(sm.Hidden,void 0),this._editor.layoutContentWidget(this))}gutterHide(){this._gutterState.get()!==sm.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this._gutterState.set(sm.Hidden,void 0))}_updateLightBulbTitleAndIcon(e){this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!(!e||e.isGutter)&&(this._domNode.title=e.title,this._iconClasses=C.asClassNameArray(e.icon),this._domNode.classList.add(...this._iconClasses))}_updateGutterDecorationOptions(e){!e||!e.isGutter||(this.gutterDecoration=Y.register({description:`codicon-gutter-lightbulb-decoration`,glyphMarginClassName:C.asClassName(e.icon),glyphMargin:{position:Wr.Left},stickiness:1}))}renderGutterLightbub(){let 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 T(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(n=>{n.changeDecoration(e,new T(t,0,t,0)),n.changeDecorationOptions(e,this.gutterDecoration)})}};lm=tm=$p([em(1,jr)],lm);var um=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},dm=function(e,t){return function(n,r){t(n,r,e)}},fm,pm=`quickfix-edit-highlight`,mm=class extends j{static{fm=this}static{this.ID=`editor.contrib.codeActionController`}static get(e){return e.getContribution(fm.ID)}constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this._commandService=o,this._configurationService=s,this._actionWidgetService=c,this._instantiationService=l,this._progressService=u,this._keybindingService=d,this._activeCodeActions=this._register(new Ae),this._showDisabled=!1,this._disposed=!1,this._onlyLightBulbWithEmptySelection=!1,this._lightBulbInfoObs=St(this,void 0),this._preferredKbLabel=St(this,void 0),this._quickFixKbLabel=St(this,void 0),this._editor=e,this._model=this._register(new Qp(this._editor,i.codeActionProvider,t,n,a,s)),this._register(this._model.onDidChangeState(e=>this.update(e))),this._register(Du.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 yc(()=>{let e=this._editor.getContribution(lm.ID);return e&&(this._register(e.onClick(e=>this.showCodeActionsFromLightbulb(e.actions,e))),e.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection),e}),this._resolver=r.createInstance(Wp),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){let t=e.validActions[0],n=t.action.command;n&&n.id===`inlineChat.start`&&n.arguments&&n.arguments.length>=1&&n.arguments[0]&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this.applyCodeAction(t,!1,!1,Rp.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,n){return this.showCodeActionList(t,n,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,n,r){if(!this._editor.hasModel())return;Jd.get(this._editor)?.closeMessage();let i=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:n,autoApply:r,context:{notAvailableMessage:e,position:i}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,n,r){let i=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(zp,e,r,{preview:n,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:vp.QuickFix,filter:{}}),i.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=await e.actions}catch(e){Hc(e);return}if(!this._disposed&&this._editor.getSelection()?.startLineNumber===e.position.lineNumber)if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),this._lightBulbInfoObs.set(cm(t,e.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),e.trigger.type===1){if(e.trigger.filter?.include){let n=this.tryGetValidActionToApply(e.trigger,t);if(n){try{this.hideLightBulbWidget(),await this.applyCodeAction(n,!1,!1,Rp.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){let n=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(n&&n.action.disabled){Jd.get(this._editor)?.showMessage(n.action.disabled,e.trigger.context.position),t.dispose();return}}}let n=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!n&&!t.validActions.length)){Jd.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:n,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:e})=>e.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=Y.register({description:`quickfix-highlight`,className:pm})}async showCodeActionList(e,t,n){let r=this._editor.createDecorationsCollection(),i=this._editor.getDomNode();if(!i)return;let a=n.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!a.length)return;let o=M.isIPosition(t)?this.toCoords(t):t;this._actionWidgetService.show(`codeActionWidget`,!0,qp(a,this._shouldShowHeaders(),this._resolver.getResolver()),{onSelect:async(e,t)=>{this.applyCodeAction(e,!0,!!t,n.fromLightbulb?Rp.FromAILightbulb:Rp.FromCodeActions),this._actionWidgetService.hide(!1),r.clear()},onHide:e=>{this._editor?.focus(),r.clear()},onHover:async(e,t)=>{if(t.isCancellationRequested)return;let n=!1,r=e.action.kind;if(r){let e=new zd(r);n=[_p.RefactorExtract,_p.RefactorInline,_p.RefactorRewrite,_p.RefactorMove,_p.Source].some(t=>t.contains(e))}return{canPreview:n||!!e.action.edit?.edits.length}},onFocus:e=>{if(e&&e.action){let t=e.action.ranges,n=e.action.diagnostics;if(r.clear(),t&&t.length>0){let e=n&&n?.length>1?n.map(e=>({range:e,options:fm.DECORATION})):t.map(e=>({range:e,options:fm.DECORATION}));r.set(e)}else if(n&&n.length>0){let e=n.map(e=>({range:e,options:fm.DECORATION}));r.set(e);let t=n[0];if(t.startLineNumber&&t.startColumn){let e=this._editor.getModel()?.getWordAtPosition({lineNumber:t.startLineNumber,column:t.startColumn})?.word;zt(V(899,`Context: {0} at line {1} and column {2}.`,e,t.startLineNumber,t.startColumn))}}}else r.clear()}},o,i,this._getActionBarActions(e,t,n))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();let t=this._editor.getScrolledVisiblePosition(e),n=Po(this._editor.getDomNode());return{x:n.left+t.left,y:n.top+t.top+t.height}}_shouldShowHeaders(){let e=this._editor?.getModel();return this._configurationService.getValue(`editor.codeActionWidget.showHeaders`,{resource:e?.uri})}_getActionBarActions(e,t,n){if(n.fromLightbulb)return[];let r=e.documentation.map(e=>({id:e.id,label:e.title,tooltip:e.tooltip??``,class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(e.id,...e.arguments??[])}));return n.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&r.push(this._showDisabled?{id:`hideMoreActions`,label:V(900,`Hide Disabled`),enabled:!0,tooltip:``,class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,n))}:{id:`showMoreActions`,label:V(901,`Show Disabled`),enabled:!0,tooltip:``,class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,n))}),r}};mm=fm=um([dm(1,Wa),dm(2,G),dm(3,w),dm(4,q),dm(5,Fc),dm(6,tr),dm(7,xa),dm(8,Uf),dm(9,w),dm(10,Fc),dm(11,jr)],mm),xc((e,t)=>{((e,n)=>{n&&t.addRule(`.monaco-editor ${e} { background-color: ${n}; }`)})(`.quickfix-edit-highlight`,e.getColor(Nl));let n=e.getColor(_c);n&&t.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Xr(e.type)?`dotted`:`solid`} ${n}; box-sizing: border-box; }`)});function hm(e){return m.regex(Jp.keys()[0],RegExp(`(\\s|^)`+pi(e.value)+`\\b`))}var gm={type:`object`,defaultSnippets:[{body:{kind:``}}],properties:{kind:{type:`string`,description:V(867,`Kind of the code action to run.`)},apply:{type:`string`,description:V(868,`Controls when the returned actions are applied.`),default:`ifSingle`,enum:[`first`,`ifSingle`,`never`],enumDescriptions:[V(869,`Always apply the first returned code action.`),V(870,`Apply the first returned code action if it is the only one.`),V(871,`Do not apply the returned code actions.`)]},preferred:{type:`boolean`,default:!1,description:V(872,`Controls if only preferred code actions should be returned.`)}}};function _m(e,t,n,r,i=vp.Default){e.hasModel()&&mm.get(e)?.manualTriggerAtCurrentPosition(t,i,n,r)}var vm=class extends Pi{constructor(){super({id:Tp,title:J(889,`Quick Fix...`),precondition:m.and(z.writable,z.hasCodeActionsProvider),icon:D.lightBulb,f1:!0,keybinding:{when:z.textInputFocus,primary:2137,weight:100},menu:{id:Z.InlineChatEditorAffordance,group:`1_quickfix`,order:0,when:m.and(z.writable,z.hasCodeActionsProvider)}})}runEditorCommand(e,t){return _m(t,V(873,`No code actions available`),void 0,void 0,vp.QuickFix)}},ym=class extends mt{constructor(){super({id:wp,precondition:m.and(z.writable,z.hasCodeActionsProvider),metadata:{description:`Trigger a code action`,args:[{name:`args`,schema:gm}]}})}runEditorCommand(e,t,n){let r=Sp.fromUser(n,{kind:zd.Empty,apply:`ifSingle`});return _m(t,typeof n?.kind==`string`?r.preferred?V(874,`No preferred code actions for '{0}' available`,n.kind):V(875,`No code actions for '{0}' available`,n.kind):r.preferred?V(876,`No preferred code actions available`):V(877,`No code actions available`),{include:r.kind,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply)}},bm=class extends N{constructor(){super({id:Dp,label:J(890,`Refactor...`),precondition:m.and(z.writable,z.hasCodeActionsProvider),kbOpts:{kbExpr:z.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:`1_modification`,order:2,when:m.and(z.writable,hm(_p.Refactor))},metadata:{description:`Refactor...`,args:[{name:`args`,schema:gm}]}})}run(e,t,n){let r=Sp.fromUser(n,{kind:_p.Refactor,apply:`never`});return _m(t,typeof n?.kind==`string`?r.preferred?V(878,`No preferred refactorings for '{0}' available`,n.kind):V(879,`No refactorings for '{0}' available`,n.kind):r.preferred?V(880,`No preferred refactorings available`):V(881,`No refactorings available`),{include:_p.Refactor.contains(r.kind)?r.kind:zd.None,onlyIncludePreferredActions:r.preferred},r.apply,vp.Refactor)}},xm=class extends N{constructor(){super({id:Op,label:J(891,`Source Action...`),precondition:m.and(z.writable,z.hasCodeActionsProvider),contextMenuOpts:{group:`1_modification`,order:2.1,when:m.and(z.writable,hm(_p.Source))},metadata:{description:`Source Action...`,args:[{name:`args`,schema:gm}]}})}run(e,t,n){let r=Sp.fromUser(n,{kind:_p.Source,apply:`never`});return _m(t,typeof n?.kind==`string`?r.preferred?V(882,`No preferred source actions for '{0}' available`,n.kind):V(883,`No source actions for '{0}' available`,n.kind):r.preferred?V(884,`No preferred source actions available`):V(885,`No source actions available`),{include:_p.Source.contains(r.kind)?r.kind:zd.None,includeSourceActions:!0,onlyIncludePreferredActions:r.preferred},r.apply,vp.SourceAction)}},Sm=class extends N{constructor(){super({id:kp,label:J(892,`Organize Imports`),precondition:m.and(z.writable,hm(_p.SourceOrganizeImports)),kbOpts:{kbExpr:z.textInputFocus,primary:1581,weight:100},metadata:{description:J(893,`Organize imports in the current file. Also called 'Optimize Imports' by some tools`)}})}run(e,t){return _m(t,V(886,`No organize imports action available`),{include:_p.SourceOrganizeImports,includeSourceActions:!0},`ifSingle`,vp.OrganizeImports)}},Cm=class extends N{constructor(){super({id:Ap,label:J(894,`Fix All`),precondition:m.and(z.writable,hm(_p.SourceFixAll))})}run(e,t){return _m(t,V(887,`No fix all action available`),{include:_p.SourceFixAll,includeSourceActions:!0},`ifSingle`,vp.FixAll)}},wm=class extends N{constructor(){super({id:Ep,label:J(895,`Auto Fix...`),precondition:m.and(z.writable,hm(_p.QuickFix)),kbOpts:{kbExpr:z.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return _m(t,V(888,`No auto fixes available`),{include:_p.QuickFix,onlyIncludePreferredActions:!0},`ifSingle`,vp.AutoFix)}};F(mm.ID,mm,3),F(lm.ID,lm,4),x(vm),O(bm),O(xm),O(Sm),O(wm),O(Cm),R(new ym),Un.as(Ro.Configuration).registerConfiguration({...Gr,properties:{"editor.codeActionWidget.showHeaders":{type:`boolean`,scope:6,description:V(896,`Enable/disable showing group headers in the Code Action menu.`),default:!0}}}),Un.as(Ro.Configuration).registerConfiguration({...Gr,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:`boolean`,scope:6,description:V(897,`Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic.`),default:!0}}}),Un.as(Ro.Configuration).registerConfiguration({...Gr,properties:{"editor.codeActions.triggerOnFocusChange":{type:`boolean`,scope:6,markdownDescription:V(898,`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 Tm=class e{constructor(){this.lenses=[]}static{this.Empty=new e}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(e,t){Es(e)&&(this._store??=new S,this._store.add(e));for(let n of e.lenses)this.lenses.push({symbol:n,provider:t})}};async function Em(e,t,n){let r=e.ordered(t),i=new Map,a=new Tm,o=r.map(async(e,r)=>{i.set(e,r);try{let r=await Promise.resolve(e.provideCodeLenses(t,n));r&&a.add(r,e)}catch(e){cc(e)}});return await Promise.all(o),n.isCancellationRequested?(a.dispose(),Tm.Empty):(a.lenses=a.lenses.sort((e,t)=>e.symbol.range.startLineNumber<t.symbol.range.startLineNumber?-1:e.symbol.range.startLineNumber>t.symbol.range.startLineNumber?1:i.get(e.provider)<i.get(t.provider)?-1:i.get(e.provider)>i.get(t.provider)?1:e.symbol.range.startColumn<t.symbol.range.startColumn?-1:+(e.symbol.range.startColumn>t.symbol.range.startColumn)),a)}jn.registerCommand(`_executeCodeLensProvider`,function(e,...t){let[n,r]=t;Bi(On.isUri(n)),Bi(typeof r==`number`||!r);let{codeLensProvider:i}=e.get(q),a=e.get(yt).getModel(n);if(!a)throw so();let o=[],s=new S;return Em(i,a,B.None).then(e=>{s.add(e);let t=[];for(let n of e.lenses)r==null||n.symbol.command?o.push(n.symbol):r-- >0&&n.provider.resolveCodeLens&&t.push(Promise.resolve(n.provider.resolveCodeLens(a,n.symbol,B.None)).then(e=>o.push(e||n.symbol)));return Promise.all(t)}).then(()=>o).finally(()=>{setTimeout(()=>s.dispose(),100)})});var Dm=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Om=function(e,t){return function(n,r){t(n,r,e)}},km=Xt(`ICodeLensCache`),Am=class{constructor(e,t){this.lineCount=e,this.data=t}},jm=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw Error(`not supported`)}},this._cache=new Uo(20,.75),Me(Go,()=>e.remove(`codelens/cache`,1));let t=`codelens/cache2`,n=e.get(t,1,`{}`);this._deserialize(n);let r=Du.filter(e.onWillSaveState,e=>e.reason===dc.SHUTDOWN);Du.once(r)(n=>{e.store(t,this._serialize(),1,1)})}put(e,t){let n=t.lenses.map(e=>({range:e.symbol.range,command:e.symbol.command&&{id:``,title:e.symbol.command?.title}})),r=new Tm;r.add({lenses:n},this._fakeProvider);let i=new Am(e.getLineCount(),r);this._cache.set(e.uri.toString(),i)}get(e){let 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(){let e=Object.create(null);for(let[t,n]of this._cache){let r=new Set;for(let e of n.data.lenses)r.add(e.symbol.range.startLineNumber);e[t]={lineCount:n.lineCount,lines:[...r.values()]}}return JSON.stringify(e)}_deserialize(e){try{let t=JSON.parse(e);for(let e in t){let n=t[e],r=[];for(let e of n.lines)r.push({range:new T(e,1,e,11)});let i=new Tm;i.add({lenses:r},this._fakeProvider),this._cache.set(e,new Am(n.lineCount,i))}}catch{}}};jm=Dm([Om(0,Gc)],jm),us(km,jm,1);var Mm=class{constructor(e,t,n){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=n,this.suppressMouseDown=!0,this.domNode=document.createElement(`div`)}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute(`monaco-visible-view-zone`)}},Nm=class e{static{this._idPool=0}constructor(t,n){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=t,this._id=`codelens.widget-${e._idPool++}`,this.updatePosition(n),this._domNode=document.createElement(`span`),this._domNode.className=`codelens-decoration`}withCommands(t,n){this._commands.clear();let r=[],i=!1;for(let n=0;n<t.length;n++){let a=t[n];if(a&&(i=!0,a.command)){let i=le(a.command.title.trim());if(a.command.id){let t=`c${e._idPool++}`;r.push(I(`a`,{id:t,title:a.command.tooltip,role:`button`},...i)),this._commands.set(t,a.command)}else r.push(I(`span`,{title:a.command.tooltip},...i));n+1<t.length&&r.push(I(`span`,void 0,`\xA0|\xA0`))}}i?(Zr(this._domNode,...r),this._isEmpty&&n&&this._domNode.classList.add(`fadein`),this._isEmpty=!1):Zr(this._domNode,I(`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){let t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}},Pm=class{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){let t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let e=0,n=t.length;e<n;e++)this._addDecorationsCallbacks[e](t[e])}},Fm=Y.register({collapseOnReplaceEdit:!0,description:`codelens`}),Im=class{constructor(e,t,n,r,i,a){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let o,s=[];this._data.forEach((e,t)=>{e.symbol.command&&s.push(e.symbol),n.addDecoration({range:e.symbol.range,options:Fm},e=>this._decorationIds[t]=e),o=o?T.plusRange(o,e.symbol.range):T.lift(e.symbol.range)}),this._viewZone=new Mm(o.startLineNumber-1,i,a),this._viewZoneId=r.addZone(this._viewZone),s.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(s,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new Nm(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&=(this._editor.removeContentWidget(this._contentWidget),void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{let n=this._editor.getModel().getDecorationRange(e),r=this._data[t].symbol;return!!(n&&T.isEmpty(r.range)===n.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((e,n)=>{t.addDecoration({range:e.symbol.range,options:Fm},e=>this._decorationIds[n]=e)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){let n=e.getDecorationRange(this._decorationIds[t]);n&&(this._data[t].symbol.range=n)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){let n=e[t];if(n){let{symbol:e}=this._data[t];e.command=n.command||e.command}}}getCommand(e){return this._contentWidget?.getCommand(e)}getLineNumber(){let e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){let t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}},Lm=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Rm=function(e,t){return function(n,r){t(n,r,e)}},zm=class{static{this.ID=`css.editor.codeLens`}constructor(e,t,n,r,i,a){this._editor=e,this._languageFeaturesService=t,this._commandService=r,this._notificationService=i,this._codeLensCache=a,this._disposables=new S,this._localToDispose=new S,this._lenses=[],this._oldCodeLensModels=new S,this._provideCodeLensDebounce=n.for(t.codeLensProvider,`CodeLensProvide`,{min:250}),this._resolveCodeLensesDebounce=n.for(t.codeLensProvider,`CodeLensResolve`,{min:250,salt:`resolve`}),this._resolveCodeLensesScheduler=new Cl(()=>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(e=>{(e.hasChanged(59)||e.hasChanged(25)||e.hasChanged(24))&&this._updateLensStyle(),e.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(){let e=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61)),t=this._editor.getOption(25);return(!t||t<5)&&(t=this._editor.getOption(61)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){let{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),n=this._editor.getOption(24),r=this._editor.getOption(59),{style:i}=this._editor.getContainerDomNode();i.setProperty(`--vscode-editorCodeLens-lineHeight`,`${e}px`),i.setProperty(`--vscode-editorCodeLens-fontSize`,`${t}px`),i.setProperty(`--vscode-editorCodeLens-fontFeatureSettings`,r.fontFeatureSettings),n&&(i.setProperty(`--vscode-editorCodeLens-fontFamily`,n),i.setProperty(`--vscode-editorCodeLens-fontFamilyDefault`,Ri.fontFamily)),this._editor.changeViewZones(t=>{for(let n of this._lenses)n.updateHeight(e,t)})}_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();let e=this._editor.getModel();if(!e||!this._editor.getOption(23)||e.isTooLargeForTokenization())return;let t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&oo(()=>{t===this._codeLensCache.get(e)&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(let t of this._languageFeaturesService.codeLensProvider.all(e))if(typeof t.onDidChange==`function`){let e=t.onDidChange(()=>n.schedule());this._localToDispose.add(e)}let n=new Cl(()=>{let t=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=ql(t=>Em(this._languageFeaturesService.codeLensProvider,e,t)),this._getCodeLensModelPromise.then(r=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=r,this._codeLensCache.put(e,r),n.delay=this._provideCodeLensDebounce.update(e,Date.now()-t),this._renderCodeLensSymbols(r),this._resolveCodeLensesInViewportSoon()},Hc)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(n),this._localToDispose.add(bn(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(e=>{this._editor.changeViewZones(t=>{let n=[],r=-1;this._lenses.forEach(e=>{!e.isValid()||r===e.getLineNumber()?n.push(e):(e.update(t),r=e.getLineNumber())});let i=new Pm;n.forEach(e=>{e.dispose(i,t),this._lenses.splice(this._lenses.indexOf(e),1)}),i.commit(e)})}),n.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{n.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{n.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(e=>{e.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(bn(()=>{if(this._editor.getModel()){let e=ja.capture(this._editor);this._editor.changeDecorations(e=>{this._editor.changeViewZones(t=>{this._disposeAllLenses(e,t)})}),e.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(e=>{if(e.target.type!==9)return;let t=e.target.element;if(t?.tagName===`SPAN`&&(t=t.parentElement),t?.tagName===`A`)for(let e of this._lenses){let n=e.getCommand(t);if(n){this._commandService.executeCommand(n.id,...n.arguments||[]).catch(e=>this._notificationService.error(e));break}}})),n.schedule()}_disposeAllLenses(e,t){let n=new Pm;for(let e of this._lenses)e.dispose(n,t);e&&n.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;let t=this._editor.getModel().getLineCount(),n=[],r;for(let i of e.lenses){let e=i.symbol.range.startLineNumber;e<1||e>t||(r&&r[r.length-1].symbol.range.startLineNumber===e?r.push(i):(r=[i],n.push(r)))}if(!n.length&&!this._lenses.length)return;let i=ja.capture(this._editor),a=this._getLayoutInfo();this._editor.changeDecorations(e=>{this._editor.changeViewZones(t=>{let r=new Pm,i=0,o=0;for(;o<n.length&&i<this._lenses.length;){let e=n[o][0].symbol.range.startLineNumber,s=this._lenses[i].getLineNumber();s<e?(this._lenses[i].dispose(r,t),this._lenses.splice(i,1)):s===e?(this._lenses[i].updateCodeLensSymbols(n[o],r),o++,i++):(this._lenses.splice(i,0,new Im(n[o],this._editor,r,t,a.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),i++,o++)}for(;i<this._lenses.length;)this._lenses[i].dispose(r,t),this._lenses.splice(i,1);for(;o<n.length;)this._lenses.push(new Im(n[o],this._editor,r,t,a.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),o++;r.commit(e)})}),i.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;let e=this._editor.getModel();if(!e)return;let t=[],n=[];if(this._lenses.forEach(r=>{let i=r.computeIfNecessary(e);i&&(t.push(i),n.push(r))}),t.length===0){this._oldCodeLensModels.clear();return}let r=Date.now(),i=ql(r=>{let i=t.map((t,i)=>{let a=Array(t.length),o=t.map((t,n)=>!t.symbol.command&&typeof t.provider.resolveCodeLens==`function`?Promise.resolve(t.provider.resolveCodeLens(e,t.symbol,r)).then(e=>{a[n]=e},cc):(a[n]=t.symbol,Promise.resolve(void 0)));return Promise.all(o).then(()=>{!r.isCancellationRequested&&!n[i].isDisposed()&&n[i].updateCommands(a)})});return Promise.all(i)});this._resolveCodeLensesPromise=i,this._resolveCodeLensesPromise.then(()=>{let t=this._resolveCodeLensesDebounce.update(e,Date.now()-r);this._resolveCodeLensesScheduler.delay=t,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),i===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},e=>{Hc(e),i===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}};zm=Lm([Rm(1,q),Rm(2,Sa),Rm(3,tr),Rm(4,di),Rm(5,km)],zm),F(zm.ID,zm,1),O(class extends N{constructor(){super({id:`codelens.showLensesInCurrentLine`,precondition:z.hasCodeLensProvider,label:J(920,`Show CodeLens Commands for Current Line`)})}async run(e,t){if(!t.hasModel())return;let n=e.get(Fi),r=e.get(tr),i=e.get(di),a=t.getSelection().positionLineNumber,o=t.getContribution(zm.ID);if(!o)return;let s=await o.getModel();if(!s)return;let c=[];for(let e of s.lenses)e.symbol.command&&e.symbol.range.startLineNumber===a&&c.push({label:e.symbol.command.title,command:e.symbol.command});if(c.length===0)return;let l=await n.pick(c,{canPickMany:!1,placeHolder:V(919,`Select a command`)});if(!l)return;let u=l.command;if(s.isDisposed){let e=(await o.getModel())?.lenses.find(e=>e.symbol.range.startLineNumber===a&&e.symbol.command?.title===u.title);if(!e||!e.symbol.command)return;u=e.symbol.command}try{await r.executeCommand(u.id,...u.arguments||[])}catch(e){i.error(e)}}});var Bm=class{constructor(e,t,n,r){this.priority=e,this.range=t,this.initialMousePosX=n,this.initialMousePosY=r,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}},Vm=class{constructor(e,t,n,r,i,a){this.priority=e,this.owner=t,this.range=n,this.initialMousePosX=r,this.initialMousePosY=i,this.supportsMarkerHover=a,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}},Hm=class{constructor(e,t){this.renderedHoverParts=e,this.disposables=t}dispose(){for(let e of this.renderedHoverParts)e.dispose();this.disposables?.dispose()}},Um=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}},Wm=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Gm=function(e,t){return function(n,r){t(n,r,e)}},Km=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,n){let r=t.range,i=t.color,a=new W(new Pc(Math.round(255*i.red),Math.round(255*i.green),Math.round(255*i.blue),i.alpha)),o=W.Format.CSS.formatRGB(a),s=W.Format.CSS.formatHSL(a),c=W.Format.CSS.formatHexA(a,!0),l=[];return l.push({label:o,textEdit:{range:r,text:o}}),l.push({label:s,textEdit:{range:r,text:s}}),l.push({label:c,textEdit:{range:r,text:c}}),l}};Km=Wm([Gm(0,$i)],Km);var qm=class extends j{constructor(e,t){super(),this._register(e.colorProvider.register(`*`,new Km(t)))}};qm=Wm([Gm(0,q),Gm(1,$i)],qm);async function Jm(e,t,n,r=`auto`){return $m(new Xm,e,t,n,r)}function Ym(e,t,n,r){return Promise.resolve(n.provideColorPresentations(e,t,r))}var Xm=class{constructor(){}async compute(e,t,n,r){let i=await e.provideDocumentColors(t,n);if(Array.isArray(i))for(let t of i)r.push({colorInfo:t,provider:e});return Array.isArray(i)}},Zm=class{constructor(){}async compute(e,t,n,r){let i=await e.provideDocumentColors(t,n);if(Array.isArray(i))for(let e of i)r.push({range:e.range,color:[e.color.red,e.color.green,e.color.blue,e.color.alpha]});return Array.isArray(i)}},Qm=class{constructor(e){this.colorInfo=e}async compute(e,t,n,r){let i=await e.provideColorPresentations(t,this.colorInfo,B.None);return Array.isArray(i)&&r.push(...i),Array.isArray(i)}};async function $m(e,t,n,r,i){let a=!1,o,s=[],c=t.ordered(n);for(let t=c.length-1;t>=0;t--){let l=c[t];if(i!==`always`&&l instanceof Km)o=l;else try{await e.compute(l,n,r,s)&&(a=!0)}catch(e){cc(e)}}return a?s:o&&i!==`never`?(await e.compute(o,n,r,s),s):[]}function eh(e,t){let{colorProvider:n}=e.get(q),r=e.get(yt).getModel(t);if(!r)throw so();return{model:r,colorProviderRegistry:n,defaultColorDecoratorsEnablement:e.get(xa).getValue(`editor.defaultColorDecorators`,{resource:t})}}var th=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},nh=function(e,t){return function(n,r){t(n,r,e)}},rh,ih=Object.create({}),ah=class extends j{static{rh=this}static{this.ID=`editor.contrib.colorDetector`}static{this.RECOMPUTE_TIME=1e3}constructor(e,t,n,r){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=n,this._localToDispose=this._register(new S),this._decorationsIds=[],this._colorDatas=new Map,this._decoratorLimitReporter=this._register(new oh),this._colorDecorationClassRefs=this._register(new S),this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new zs(this._editor)),this._debounceInformation=r.for(n.colorProvider,`Document Colors`,{min:rh.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(n.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(e=>{let t=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167);let n=t!==this._isColorDecoratorsEnabled||e.hasChanged(27),r=e.hasChanged(167);(n||r)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167),this.updateColors()}isEnabled(){let e=this._editor.getModel();if(!e)return!1;let t=e.getLanguageId(),n=this._configurationService.getValue(t);if(n&&typeof n==`object`){let e=n.colorDecorators;if(e&&e.enable!==void 0&&!e.enable)return e.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)return;let e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new Ja,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=ql(async e=>{let t=this._editor.getModel();if(!t)return[];let n=new ve(!1),r=await Jm(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,n.elapsed()),r});try{let e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Hc(e)}}stop(){this._timeoutTimer&&=(this._timeoutTimer.cancel(),null),this._computePromise&&=(this._computePromise.cancel(),null),this._localToDispose.clear()}updateDecorations(e){let t=e.map(e=>({range:{startLineNumber:e.colorInfo.range.startLineNumber,startColumn:e.colorInfo.range.startColumn,endLineNumber:e.colorInfo.range.endLineNumber,endColumn:e.colorInfo.range.endColumn},options:Y.EMPTY}));this._editor.changeDecorations(n=>{this._decorationsIds=n.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((t,n)=>this._colorDatas.set(t,e[n]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();let t=[],n=this._editor.getOption(27);for(let r=0;r<e.length&&t.length<n;r++){let{red:n,green:i,blue:a,alpha:o}=e[r].colorInfo.color,s=new Pc(Math.round(n*255),Math.round(i*255),Math.round(a*255),o),c=`rgba(${s.r}, ${s.g}, ${s.b}, ${s.a})`,l=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:c}));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:`\xA0`,inlineClassName:`${l.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:ih}}})}let r=n<e.length?n:!1;this._decoratorLimitReporter.update(e.length,r),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){let t=this._editor.getModel();if(!t)return null;let n=t.getDecorationsInRange(T.fromPositions(e,e)).filter(e=>this._colorDatas.has(e.id));return n.length===0?null:this._colorDatas.get(n[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}};ah=rh=th([nh(1,xa),nh(2,q),nh(3,Sa)],ah);var oh=class extends j{constructor(){super(...arguments),this._onDidChange=this._register(new U),this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}},sh=`editor.action.showHover`,ch=`editor.action.showDefinitionPreviewHover`,lh=`editor.action.hideHover`,uh=`editor.action.scrollUpHover`,dh=`editor.action.scrollDownHover`,fh=`editor.action.scrollLeftHover`,ph=`editor.action.scrollRightHover`,mh=`editor.action.pageUpHover`,hh=`editor.action.pageDownHover`,gh=`editor.action.goToTopHover`,_h=`editor.action.goToBottomHover`,vh=`editor.action.increaseHoverVerbosityLevel`,yh=V(1145,`Increase Hover Verbosity Level`),bh=`editor.action.decreaseHoverVerbosityLevel`,xh=V(1146,`Decrease Hover Verbosity Level`),Sh=`editor.action.hideLongLineWarningHover`,Ch=`editor.action.inlineSuggest.commit`,wh=`editor.action.inlineSuggest.commitAlternativeAction`,Th=`editor.action.inlineSuggest.showPrevious`,Eh=`editor.action.inlineSuggest.showNext`,Dh=`editor.action.inlineSuggest.jump`,Oh=`editor.action.inlineSuggest.hide`,kh=`editor.action.inlineSuggest.toggleShowCollapsed`,Ah=`editor.action.inlineSuggest.renameSymbol`,jh=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Mh=function(e,t){return function(n,r){t(n,r,e)}},Nh,Ph=class extends j{constructor(e,t,n){super(),this.editor=e,this.model=t,this.instantiationService=n,this.alwaysShowToolbar=$u(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar===`always`),this.sessionPosition=void 0,this.position=L(this,e=>{let t=this.model.read(e)?.primaryGhostText.read(e);if(!this.alwaysShowToolbar.read(e)||!t||t.parts.length===0)return this.sessionPosition=void 0,null;let n=t.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==t.lineNumber&&(this.sessionPosition=void 0);let r=new M(t.lineNumber,Math.min(n,this.sessionPosition?.column??2**53-1));return this.sessionPosition=r,r}),this._register(Ht((t,n)=>{let r=this.model.read(t);if(!r||!this.alwaysShowToolbar.read(t))return;let i=L(t=>{let n=t.store.add(this.instantiationService.createInstance(Lh.hot.read(t),this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands,r.warning,()=>{}));return e.addContentWidget(n),t.store.add(bn(()=>e.removeContentWidget(n))),t.store.add(k(e=>{this.position.read(e)&&r.lastTriggerKind.read(e)!==pn.Explicit&&r.triggerExplicitly()})),n}),a=ir(this,(e,t)=>!!this.position.read(e)||!!t);n.add(k(e=>{a.read(e)&&i.read(e)}))}))}};Ph=jh([Mh(2,w)],Ph);var Fh=Vs(`inline-suggestion-hints-next`,D.chevronRight,V(1250,`Icon for show next parameter hint.`)),Ih=Vs(`inline-suggestion-hints-previous`,D.chevronLeft,V(1251,`Icon for show previous parameter hint.`)),Lh=class extends j{static{Nh=this}static{this.hot=qc(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(e,t,n){let r=new cn(e,t,n,!0,()=>this._commandService.executeCommand(e));return r.tooltip=this.keybindingService.appendKeybinding(t,e,this._contextKeyService),r}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f){super(),this.editor=e,this.withBorder=t,this._position=n,this._currentSuggestionIdx=r,this._suggestionCount=i,this._extraCommands=a,this._warning=o,this._relayout=s,this._commandService=c,this.keybindingService=u,this._contextKeyService=d,this._menuService=f,this.id=`InlineSuggestionHintsContentWidget${Nh.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=L(e=>{let t=this._warning.read(e);if(t)return typeof t.message==`string`?t.message:e.store.add(kr(t.message)).element}),this._warningMessageNode=X.div({class:`warningMessage`,style:{maxWidth:400,margin:4,marginBottom:4,display:L(e=>this._warning.read(e)?`block`:`none`)}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=cu(`div.inlineSuggestionsHints`,{className:this.withBorder?`monaco-hover monaco-hover-content`:``},[this._warningMessageNode.element,cu(`div@toolBar`)]),this.previousAction=this._register(this.createCommandAction(Th,V(1252,`Previous`),C.asClassName(Ih))),this.availableSuggestionCountAction=this._register(new cn(`inlineSuggestionHints.availableSuggestionCount`,``,void 0,!1)),this.nextAction=this._register(this.createCommandAction(Eh,V(1253,`Next`),C.asClassName(Fh))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(Z.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new Cl(()=>{this.availableSuggestionCountAction.label=``},100)),this.disableButtonsDebounced=this._register(new Cl(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(k(e=>{this._warningMessageContentNode.read(e),this._warningMessageNode.readEffect(e),this._relayout()})),this.toolBar=this._register(l.createInstance(Bh,this.nodes.toolBar,Z.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:e=>e.startsWith(`primary`)},actionViewItemProvider:(e,t)=>{if(e instanceof Lr)return l.createInstance(zh,e,void 0);if(e===this.availableSuggestionCountAction){let t=new Rh(void 0,e,{label:!0,icon:!1});return t.setClass(`availableSuggestionCount`),t}},telemetrySource:`InlineSuggestionToolbar`})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(e=>{Nh._dropDownVisible=e})),this._register(k(e=>{this._position.read(e),this.editor.layoutContentWidget(this)})),this._register(k(e=>{let t=this._suggestionCount.read(e),n=this._currentSuggestionIdx.read(e);t===void 0?this.clearAvailableSuggestionCountLabelDebounced.schedule():(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${n+1}/${t}`),t!==void 0&&t>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(k(e=>{let t=this._extraCommands.read(e).map(e=>({class:void 0,id:e.command.id,enabled:!0,tooltip:e.command.tooltip||``,label:e.command.title,run:()=>this._commandService.executeCommand(e.command.id,...e.command.arguments??[])}));for(let[e,n]of this.inlineCompletionsActionsMenus.getActions())for(let e of n)e instanceof Lr&&t.push(e);t.length>0&&t.unshift(new Tr),this.toolBar.setAdditionalSecondaryActions(t)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};Lh=Nh=jh([Mh(8,tr),Mh(9,w),Mh(10,jr),Mh(11,G),Mh(12,La)],Lh);var Rh=class extends ar{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}},zh=class extends Sc{updateLabel(){let e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!e)return super.updateLabel();if(this.label){let t=cu(`div.keybinding`).root;this._register(new Cu(t,Zu,{disableTitle:!0,...ni})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add(`inlineSuggestionStatusBarItemLabel`)}}updateTooltip(){}},Bh=class extends zl{constructor(e,t,n,r,i,a,o,s,c){super(e,{resetMenu:t,...n},r,i,a,o,s,c),this.menuId=t,this.options2=n,this.menuService=r,this.contextKeyService=i,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(){let{primary:e,secondary:t}=ka(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){pu(this.prependedPrimaryActions,e,(e,t)=>e===t)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){pu(this.additionalActions,e,(e,t)=>e===t)||(this.additionalActions=e,this.updateToolbar())}};Bh=jh([Mh(3,La),Mh(4,G),Mh(5,Au),Mh(6,jr),Mh(7,tr),Mh(8,au)],Bh);function Vh(e,t,n){let r=Po(e);return!(t<r.left+3||t>r.left+r.width-3||n<r.top+3||n>r.top+r.height-3)}function Hh(e,t,n){return e===`on`?!0:e===`off`?!1:Uh(t,n.event)}function Uh(e,t){return e===`altKey`?t.ctrlKey||t.metaKey:t.altKey}var Wh=class{constructor(e,t,n,r){this.value=e,this.isComplete=t,this.hasLoadingMessage=n,this.options=r}},Gh=class extends j{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new U),this.onResult=this._onResult.event,this._asyncComputationScheduler=this._register(new Kh(e=>this._triggerAsyncComputation(e),0)),this._syncComputationScheduler=this._register(new Kh(e=>this._triggerSyncComputation(e),0)),this._loadingMessageScheduler=this._register(new Kh(e=>this._triggerLoadingMessage(e),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&=(this._asyncIterable.cancel(),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(e,t){this._options=t,this._state=e,this._fireResult(t)}_triggerAsyncComputation(e){this._setState(2,e),this._syncComputationScheduler.schedule(e,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=Ys(t=>this._computer.computeAsync(e,t)),(async()=>{try{for await(let t of this._asyncIterable)t&&(this._result.push(t),this._fireResult(e));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,e)}catch(e){Hc(e)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(e){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(e))),this._setState(this._asyncIterableDone?0:3,e)}_triggerLoadingMessage(e){this._state===3&&this._setState(4,e)}_fireResult(e){if(this._state===1||this._state===2)return;let t=this._state===0,n=this._state===4;this._onResult.fire(new Wh(this._result.slice(0),t,n,e))}start(e,t){if(e===0)this._state===0&&(this._setState(1,t),this._asyncComputationScheduler.schedule(t,this._firstWaitTime),this._loadingMessageScheduler.schedule(t,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(t),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&=(this._asyncIterable.cancel(),null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}},Kh=class extends j{constructor(e,t){super(),this._scheduler=this._register(new Cl(()=>e(this._options),t))}schedule(e,t){this._options=e,this._scheduler.schedule(t)}cancel(){this._scheduler.cancel()}},qh=class{get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}constructor(){this._onDidWillResize=new U,this._onDidResize=new U,this._sashListener=new S,this._size=new zi(0,0),this._minSize=new zi(0,0),this._maxSize=new zi(2**53-1,2**53-1),this.domNode=document.createElement(`div`),this._eastSash=new va(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new va(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new va(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:Jo.North}),this._southSash=new va(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:Jo.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,n=0;this._sashListener.add(Du.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,n=0)})),this._sashListener.add(Du.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,n=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(r=>{e&&(n=r.currentX-r.startX,this.layout(e.height+t,e.width+n),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(r=>{e&&(n=-(r.currentX-r.startX),this.layout(e.height+t,e.width+n),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(r=>{e&&(t=-(r.currentY-r.startY),this.layout(e.height+t,e.width+n),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(r=>{e&&(t=r.currentY-r.startY,this.layout(e.height+t,e.width+n),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(Du.any(this._eastSash.onDidReset,this._westSash.onDidReset)(e=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(Du.any(this._northSash.onDidReset,this._southSash.onDidReset)(e=>{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(e,t,n,r){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=n?3:0,this._westSash.state=r?3:0}layout(e=this.size.height,t=this.size.width){let{height:n,width:r}=this._minSize,{height:i,width:a}=this._maxSize;e=Math.max(n,Math.min(i,e)),t=Math.max(r,Math.min(a,t));let o=new zi(t,e);zi.equals(o,this._size)||(this.domNode.style.height=e+`px`,this.domNode.style.width=t+`px`,this._size=o,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}},Jh=30,Yh=24,Xh=class extends j{constructor(e,t=new zi(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new qh),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position=`absolute`,this._resizableNode.minSize=zi.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(e=>{this._resize(new zi(e.dimension.width,e.dimension.height)),e.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?M.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){let t=this._editor.getDomNode(),n=this._editor.getScrolledVisiblePosition(e);if(!(!t||!n))return Po(t).top+n.top-Jh}_availableVerticalSpaceBelow(e){let t=this._editor.getDomNode(),n=this._editor.getScrolledVisiblePosition(e);if(!t||!n)return;let r=Po(t),i=Xl(t.ownerDocument.body),a=r.top+n.top+n.height;return i.height-a-Yh}_findPositionPreference(e,t){let n=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),r=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),i=Math.min(e,Math.min(Math.max(r,n),e)),a;return a=this._editor.getOption(69).above?i<=r?1:2:i<=n?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}},Zh=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qh=function(e,t){return function(n,r){t(n,r,e)}},$h,eg=30,tg=class extends Xh{static{$h=this}static{this.ID=`editor.contrib.resizableContentHoverWidget`}static{this._lastDimensions=new zi(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,n,r,i){let a=new zi(150,e.getOption(75)+8);super(e,a),this._configurationService=n,this._accessibilityService=r,this._keybindingService=i,this._hover=this._register(new Yc(!0)),this._onDidResize=this._register(new U),this.onDidResize=this._onDidResize.event,this._onDidScroll=this._register(new U),this.onDidScroll=this._onDidScroll.event,this._onContentsChanged=this._register(new U),this.onContentsChanged=this._onContentsChanged.event,this._minimumSize=a,this._hoverVisibleKey=z.hoverVisible.bindTo(t),this._hoverFocusedKey=z.hoverFocused.bindTo(t),H(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(e=>{e.hasChanged(59)&&this._updateFont()}));let o=this._register(Os(this._resizableNode.domNode));this._register(o.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(o.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(e=>{this._onDidScroll.fire(e)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return $h.ID}static _applyDimensions(e,t,n){let r=typeof t==`number`?`${t}px`:t,i=typeof n==`number`?`${n}px`:n;e.style.width=r,e.style.height=i}_setContentsDomNodeDimensions(e,t){let n=this._hover.contentsDomNode;return $h._applyDimensions(n,e,t)}_setContainerDomNodeDimensions(e,t){let n=this._hover.containerDomNode;return $h._applyDimensions(n,e,t)}_setScrollableElementDimensions(e,t){let n=this._hover.scrollbar.getDomNode();return $h._applyDimensions(n,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,n){let r=typeof t==`number`?`${t}px`:t,i=typeof n==`number`?`${n}px`:n;e.style.maxWidth=r,e.style.maxHeight=i}_setHoverWidgetMaxDimensions(e,t){$h._applyMaxDimensions(this._hover.contentsDomNode,e,t),$h._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),$h._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(){let e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new zi(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){$h._lastDimensions=new zi(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(){let e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){let e=this._findAvailableSpaceVertically();if(!e)return;let t=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(e=>{t+=e.clientHeight}),Math.min(e,t)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty(`--vscode-hover-whiteSpace`,`nowrap`),this._hover.containerDomNode.style.setProperty(`--vscode-hover-sourceWhiteSpace`,`nowrap`);let e=Array.from(this._hover.contentsDomNode.children).some(e=>e.scrollWidth>e.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;let e=this._isHoverTextOverflowing(),t=this._contentWidth===void 0?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?Xl(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;let n=Po(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=ng(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,n.left,n.top,n.width,n.height));let r=ng(e,t,n.left,n.top,n.width,n.height);return r>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,r),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle(`hidden`,!e)}_updateFont(){let{fontSize:e,lineHeight:t}=this._editor.getOption(59),n=this._hover.contentsDomNode;n.style.fontSize=`${e}px`,n.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName(`code`)).forEach(e=>this._editor.applyFontInfo(e))}_updateContent(e){let t=this._hover.contentsDomNode;t.style.paddingBottom=``,t.textContent=``,t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){let e=Math.max(this._editor.getLayoutInfo().height/4,250,$h._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,$h._lastDimensions.width);this._resizableNode.maxSize=new zi(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);let t=os(this._hover.containerDomNode),n=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,n)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();let r=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&ds(this._configurationService.getValue(`accessibility.verbosity.hover`)===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding(`editor.action.accessibleView`)?.getAriaLabel()??``);r&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+`, `+r)}hide(){if(!this._renderedHover)return;let e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new zi(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){let e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions(`auto`,`auto`),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new zi(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){let e=this._contentWidth===void 0?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new zi(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let e=this._hover.contentsDomNode,t=os(e),n=qo(e)+2;if(this._resizableNode.layout(t,n),this._setHoverWidgetDimensions(n,t),t=os(e),n=qo(e),this._contentWidth=n,this._updateMinimumWidth(),this._resizableNode.layout(t,n),this._renderedHover?.showAtPosition){let e=os(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(e,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-eg})}scrollRight(){let e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+eg})}pageUp(){let e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){let 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})}};tg=$h=Zh([Qh(1,G),Qh(2,xa),Qh(3,ai),Qh(4,jr)],tg);function ng(e,t,n,r,i,a){let o=n+i/2,s=r+a/2,c=Math.max(Math.abs(e-o)-i/2,0),l=Math.max(Math.abs(t-s)-a/2,0);return Math.sqrt(c*c+l*l)}var rg=class e{constructor(e,t){this._editor=e,this._participants=t}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];let n=e.getModel(),r=t.range.startLineNumber;if(r>n.getLineCount())return[];let i=n.getLineMaxColumn(r);return e.getLineDecorations(r).filter(e=>{if(e.options.isWholeLine)return!0;let n=e.range.startLineNumber===r?e.range.startColumn:1,a=e.range.endLineNumber===r?e.range.endColumn:i;if(e.options.showIfCollapsed){if(n>t.range.startColumn+1||t.range.endColumn-1>a)return!1}else if(n>t.range.startColumn||t.range.endColumn>a)return!1;return!0})}computeAsync(t,n){let r=t.anchor;if(!this._editor.hasModel()||!r)return hs.EMPTY;let i=e._getLineDecorations(this._editor,r);return hs.merge(this._participants.map(e=>e.computeAsync?e.computeAsync(r,i,t.source,n):hs.EMPTY))}computeSync(t){if(!this._editor.hasModel())return[];let n=t.anchor,r=e._getLineDecorations(this._editor,n),i=[];for(let e of this._participants)i=i.concat(e.computeSync(n,r,t.source));return gc(i)}},ig=class{constructor(e,t,n){this.hoverParts=e,this.isComplete=t,this.options=n}filter(e){let t=this.hoverParts.filter(t=>t.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new ag(this,t,this.isComplete,this.options)}},ag=class extends ig{constructor(e,t,n,r){super(t,n,r),this.original=e}filter(e){return this.original.filter(e)}},og=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sg=function(e,t){return function(n,r){t(n,r,e)}},cg=I,lg=class extends j{get hasContent(){return this._hasContent}constructor(e,t){super(),this._keybindingService=e,this._hoverService=t,this.actions=[],this._hasContent=!1,this.hoverElement=cg(`div.hover-row.status-bar`),this.hoverElement.tabIndex=0,this.actionsElement=H(this.hoverElement,cg(`div.actions`))}addAction(e){let t=this._keybindingService.lookupKeybinding(e.commandId),n=t?t.getLabel():null;this._hasContent=!0;let r=this._register(zo.render(this.actionsElement,e,n));return this._register(this._hoverService.setupManagedHover(bs(`element`),r.actionContainer,r.actionRenderedLabel)),this.actions.push(r),r}append(e){let t=H(this.actionsElement,e);return this._hasContent=!0,t}};lg=og([sg(0,jr),sg(1,fa)],lg);var ug=class e{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){let e=this._findScopeDecorationIds.map(e=>this._editor.getModel().getDecorationRange(e)).filter(e=>!!e);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){let t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){let t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(t){let n=this._editor.getModel().getDecorationsInRange(t);for(let t of n){let n=t.options;if(n===e._FIND_MATCH_DECORATION||n===e._FIND_MATCH_NO_OVERVIEW_DECORATION||n===e._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(t.id)}return 0}setCurrentFindMatch(t){let n=null,r=0;if(t)for(let e=0,i=this._decorations.length;e<i;e++){let i=this._editor.getModel().getDecorationRange(this._decorations[e]);if(t.equalsRange(i)){n=this._decorations[e],r=e+1;break}}return(this._highlightedDecorationId!==null||n!==null)&&this._editor.changeDecorations(t=>{if(this._highlightedDecorationId!==null&&(t.changeDecorationOptions(this._highlightedDecorationId,e._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),n!==null&&(this._highlightedDecorationId=n,t.changeDecorationOptions(this._highlightedDecorationId,e._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(t.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),n!==null){let r=this._editor.getModel().getDecorationRange(n);if(r.startLineNumber!==r.endLineNumber&&r.endColumn===1){let e=r.endLineNumber-1,t=this._editor.getModel().getLineMaxColumn(e);r=new T(r.startLineNumber,r.startColumn,e,t)}this._rangeHighlightDecorationId=t.addDecoration(r,e._RANGE_HIGHLIGHT_DECORATION)}}),r}set(t,n){this._editor.changeDecorations(r=>{let i=e._FIND_MATCH_DECORATION,a=[];if(t.length>1e3){i=e._FIND_MATCH_NO_OVERVIEW_DECORATION;let n=this._editor.getModel().getLineCount(),r=this._editor.getLayoutInfo().height/n,o=Math.max(2,Math.ceil(3/r)),s=t[0].range.startLineNumber,c=t[0].range.endLineNumber;for(let n=1,r=t.length;n<r;n++){let r=t[n].range;c+o>=r.startLineNumber?r.endLineNumber>c&&(c=r.endLineNumber):(a.push({range:new T(s,1,c,1),options:e._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),s=r.startLineNumber,c=r.endLineNumber)}a.push({range:new T(s,1,c,1),options:e._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let o=Array(t.length);for(let e=0,n=t.length;e<n;e++)o[e]={range:t[e].range,options:i};this._decorations=r.deltaDecorations(this._decorations,o),this._overviewRulerApproximateDecorations=r.deltaDecorations(this._overviewRulerApproximateDecorations,a),this._rangeHighlightDecorationId&&=(r.removeDecoration(this._rangeHighlightDecorationId),null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(e=>r.removeDecoration(e)),this._findScopeDecorationIds=[]),n?.length&&(this._findScopeDecorationIds=n.map(t=>r.addDecoration(t,e._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){let n=this._decorations[t],r=this._editor.getModel().getDecorationRange(n);if(!(!r||r.endLineNumber>e.lineNumber)&&(r.endLineNumber<e.lineNumber||!(r.endColumn>e.column)))return r}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,n=this._decorations.length;t<n;t++){let n=this._decorations[t],r=this._editor.getModel().getDecorationRange(n);if(!(!r||r.startLineNumber<e.lineNumber)&&(r.startLineNumber>e.lineNumber||!(r.startColumn<e.column)))return r}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=Y.register({description:`current-find-match`,stickiness:1,zIndex:13,className:`currentFindMatch`,inlineClassName:`currentFindMatchInline`,showIfCollapsed:!0,overviewRuler:{color:pl(ge),position:Su.Center},minimap:{color:pl(lt),position:1}})}static{this._FIND_MATCH_DECORATION=Y.register({description:`find-match`,stickiness:1,zIndex:10,className:`findMatch`,inlineClassName:`findMatchInline`,showIfCollapsed:!0,overviewRuler:{color:pl(ge),position:Su.Center},minimap:{color:pl(lt),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=Y.register({description:`find-match-no-overview`,stickiness:1,className:`findMatch`,showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=Y.register({description:`find-match-only-overview`,stickiness:1,overviewRuler:{color:pl(ge),position:Su.Center}})}static{this._RANGE_HIGHLIGHT_DECORATION=Y.register({description:`find-range-highlight`,stickiness:1,className:`rangeHighlight`,isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=Y.register({description:`find-scope`,className:`findScope`,isWholeLine:!0})}},dg=class{constructor(e,t,n){this._editorSelection=e,this._ranges=t,this._replaceStrings=n,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){let e=[];for(let t=0;t<this._ranges.length;t++)e.push({range:this._ranges[t],text:this._replaceStrings[t]});e.sort((e,t)=>T.compareRangesUsingStarts(e.range,t.range));let n=[],r=e[0];for(let t=1;t<e.length;t++)r.range.endLineNumber===e[t].range.startLineNumber&&r.range.endColumn===e[t].range.startColumn?(r.range=r.range.plusRange(e[t].range),r.text+=e[t].text):(n.push(r),r=e[t]);n.push(r);for(let e of n)t.addEditOperation(e.range,e.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}};function fg(e,t){if(e&&e[0]!==``){let n=pg(e,t,`-`),r=pg(e,t,`_`);return n&&!r?mg(e,t,`-`):!n&&r?mg(e,t,`_`):e[0].toUpperCase()===e[0]?t.toUpperCase():e[0].toLowerCase()===e[0]?t.toLowerCase():Dt(e[0][0])&&t.length>0?t[0].toUpperCase()+t.substr(1):e[0][0].toUpperCase()!==e[0][0]&&t.length>0?t[0].toLowerCase()+t.substr(1):t}else return t}function pg(e,t,n){return e[0].indexOf(n)!==-1&&t.indexOf(n)!==-1&&e[0].split(n).length===t.split(n).length}function mg(e,t,n){let r=t.split(n),i=e[0].split(n),a=``;return r.forEach((e,t)=>{a+=fg([i[t]],e)+n}),a.slice(0,-1)}var hg=class{constructor(e){this.staticValue=e,this.kind=0}},gg=class{constructor(e){this.pieces=e,this.kind=1}},_g=class e{static fromStaticValue(t){return new e([vg.staticValue(t)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new hg(``):e.length===1&&e[0].staticValue!==null?this._state=new hg(e[0].staticValue):this._state=new gg(e)}buildReplaceString(t,n){if(this._state.kind===0)return n?fg(t,this._state.staticValue):this._state.staticValue;let r=``;for(let n=0,i=this._state.pieces.length;n<i;n++){let i=this._state.pieces[n];if(i.staticValue!==null){r+=i.staticValue;continue}let a=e._substitute(i.matchIndex,t);if(i.caseOps!==null&&i.caseOps.length>0){let e=[],t=i.caseOps.length,n=0;for(let r=0,o=a.length;r<o;r++){if(n>=t){e.push(a.slice(r));break}switch(i.caseOps[n]){case`U`:e.push(a[r].toUpperCase());break;case`u`:e.push(a[r].toUpperCase()),n++;break;case`L`:e.push(a[r].toLowerCase());break;case`l`:e.push(a[r].toLowerCase()),n++;break;default:e.push(a[r])}}a=e.join(``)}r+=a}return r}static _substitute(e,t){if(t===null)return``;if(e===0)return t[0];let n=``;for(;e>0;){if(e<t.length)return(t[e]||``)+n;n=String(e%10)+n,e=Math.floor(e/10)}return`$`+n}},vg=class e{static staticValue(t){return new e(t,-1,null)}static caseOps(t,n){return new e(null,t,n)}constructor(e,t,n){this.staticValue=e,this.matchIndex=t,!n||n.length===0?this.caseOps=null:this.caseOps=n.slice(0)}},yg=class{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=``}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){e.length!==0&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,n){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=vg.staticValue(this._currentStaticPiece),this._currentStaticPiece=``),this._result[this._resultLen++]=vg.caseOps(e,n),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=vg.staticValue(this._currentStaticPiece),this._currentStaticPiece=``),new _g(this._result)}};function bg(e){if(!e||e.length===0)return new _g(null);let t=[],n=new yg(e);for(let r=0,i=e.length;r<i;r++){let a=e.charCodeAt(r);if(a===92){if(r++,r>=i)break;let a=e.charCodeAt(r);switch(a){case 92:n.emitUnchanged(r-1),n.emitStatic(`\\`,r+1);break;case 110:n.emitUnchanged(r-1),n.emitStatic(`
5
+ `,r+1);break;case 116:n.emitUnchanged(r-1),n.emitStatic(` `,r+1);break;case 117:case 85:case 108:case 76:n.emitUnchanged(r-1),n.emitStatic(``,r+1),t.push(String.fromCharCode(a));break}continue}if(a===36){if(r++,r>=i)break;let a=e.charCodeAt(r);if(a===36){n.emitUnchanged(r-1),n.emitStatic(`$`,r+1);continue}if(a===48||a===38){n.emitUnchanged(r-1),n.emitMatchIndex(0,r+1,t),t.length=0;continue}if(49<=a&&a<=57){let o=a-48;if(r+1<i){let i=e.charCodeAt(r+1);if(48<=i&&i<=57){r++,o=o*10+(i-48),n.emitUnchanged(r-2),n.emitMatchIndex(o,r+1,t),t.length=0;continue}}n.emitUnchanged(r-1),n.emitMatchIndex(o,r+1,t),t.length=0;continue}}}return n.finalize()}var xg=new A(`findWidgetVisible`,!1);xg.toNegated();var Sg=new A(`findInputFocussed`,!1),Cg=new A(`replaceInputFocussed`,!1),wg=new A(`findWidgetFocused`,!1),Tg={primary:545,mac:{primary:2593}},Eg={primary:565,mac:{primary:2613}},Dg={primary:560,mac:{primary:2608}},Og={primary:554,mac:{primary:2602}},kg={primary:558,mac:{primary:2606}},Ag={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`},jg=19999,Mg=240,Ng=class e{constructor(e,t){this._toDispose=new S,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new Ja,this._decorations=new ug(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new Cl(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(e=>{(e.reason===3||e.reason===5||e.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(e=>{this._ignoreModelContentChanged||(e.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(e=>this._onStateChanged(e))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,h(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)},Mg)):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 n=null;t===void 0?n=this._decorations.getFindScopes():t!==null&&(n=Array.isArray(t)?t:[t]),n!==null&&(n=n.map(e=>{if(e.startLineNumber!==e.endLineNumber){let t=e.endLineNumber;return e.endColumn===1&&--t,new T(e.startLineNumber,1,t,this._editor.getModel().getLineMaxColumn(t))}return e}));let r=this._findMatches(n,!1,jg);this._decorations.set(r,n);let i=this._editor.getSelection(),a=this._decorations.getCurrentMatchesPosition(i);if(a===0&&r.length>0){let e=Va(r.map(e=>e.range),e=>T.compareRangesUsingStarts(e,i)>=0);a=e>0?e-1+1:a}this._state.changeMatchInfo(a,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()){let e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){let t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){let t=this._state.isRegex&&(this._state.searchString.indexOf(`^`)>=0||this._state.searchString.indexOf(`$`)>=0),{lineNumber:n,column:r}=e,i=this._editor.getModel();return t||r===1?(n===1?n=i.getLineCount():n--,r=i.getLineMaxColumn(n)):r--,new M(n,r)}_moveToPrevMatch(t,n=!1){if(!this._state.canNavigateBack()){let e=this._decorations.matchAfterPosition(t);e&&this._setCurrentFindMatch(e);return}if(this._decorations.getCount()<19999){let e=this._decorations.matchBeforePosition(t);e&&e.isEmpty()&&e.getStartPosition().equals(t)&&(t=this._prevSearchPosition(t),e=this._decorations.matchBeforePosition(t)),e&&this._setCurrentFindMatch(e);return}if(this._cannotFind())return;let r=this._decorations.getFindScope(),i=e._getSearchRange(this._editor.getModel(),r);i.getEndPosition().isBefore(t)&&(t=i.getEndPosition()),t.isBefore(i.getStartPosition())&&(t=i.getEndPosition());let{lineNumber:a,column:o}=t,s=this._editor.getModel(),c=new M(a,o),l=s.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(l&&l.range.isEmpty()&&l.range.getStartPosition().equals(c)&&(c=this._prevSearchPosition(c),l=s.findPreviousMatch(this._state.searchString,c,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),l){if(!n&&!i.containsRange(l.range))return this._moveToPrevMatch(l.range.getStartPosition(),!0);this._setCurrentFindMatch(l.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){let t=this._state.isRegex&&(this._state.searchString.indexOf(`^`)>=0||this._state.searchString.indexOf(`$`)>=0),{lineNumber:n,column:r}=e,i=this._editor.getModel();return t||r===i.getLineMaxColumn(n)?(n===i.getLineCount()?n=1:n++,r=1):r++,new M(n,r)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){let t=this._decorations.matchBeforePosition(e);t&&this._setCurrentFindMatch(t);return}if(this._decorations.getCount()<19999){let t=this._decorations.matchAfterPosition(e);t&&t.isEmpty()&&t.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),t=this._decorations.matchAfterPosition(e)),t&&this._setCurrentFindMatch(t);return}let t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(t,n,r,i=!1){if(this._cannotFind())return null;let a=this._decorations.getFindScope(),o=e._getSearchRange(this._editor.getModel(),a);o.getEndPosition().isBefore(t)&&(t=o.getStartPosition()),t.isBefore(o.getStartPosition())&&(t=o.getStartPosition());let{lineNumber:s,column:c}=t,l=this._editor.getModel(),u=new M(s,c),d=l.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n);return r&&d&&d.range.isEmpty()&&d.range.getStartPosition().equals(u)&&(u=this._nextSearchPosition(u),d=l.findNextMatch(this._state.searchString,u,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n)),d?!i&&!o.containsRange(d.range)?this._getNextMatch(d.range.getEndPosition(),n,r,!0):d:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(e){let t=this._decorations.getDecorationRangeAt(e);t&&this._setCurrentFindMatch(t)}moveToMatch(e){this._moveToMatch(e)}_getReplacePattern(){return this._state.isRegex?bg(this._state.replaceString):_g.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let e=this._getReplacePattern(),t=this._editor.getSelection(),n=this._getNextMatch(t.getStartPosition(),!0,!1);if(n)if(t.equalsRange(n.range)){let r=e.buildReplaceString(n.matches,this._state.preserveCase),i=new rt(t,r);this._executeEditorCommand(`replace`,i),this._decorations.setStartPosition(new M(t.startLineNumber,t.startColumn+r.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(n.range)}_findMatches(t,n,r){let i=(t||[null]).map(t=>e._getSearchRange(this._editor.getModel(),t));return this._editor.getModel().findMatches(this._state.searchString,i,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n,r)}replaceAll(){if(!this._hasMatches())return;let e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=19999?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){let e=new Pe(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 e=`mu`;t.ignoreCase&&(e+=`i`),t.global&&(e+=`g`),t=new RegExp(t.source,e)}let n=this._editor.getModel(),r=n.getValue(1),i=n.getFullModelRange(),a=this._getReplacePattern(),o,s=this._state.preserveCase;o=a.hasReplacementPatterns||s?r.replace(t,function(){return a.buildReplaceString(arguments,s)}):r.replace(t,a.buildReplaceString(null,s));let c=new Ft(i,o,this._editor.getSelection());this._executeEditorCommand(`replaceAll`,c)}_regularReplaceAll(e){let t=this._getReplacePattern(),n=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),r=[];for(let e=0,i=n.length;e<i;e++)r[e]=t.buildReplaceString(n[e].matches,this._state.preserveCase);let i=new dg(this._editor.getSelection(),n.map(e=>e.range),r);this._executeEditorCommand(`replaceAll`,i)}selectAllMatches(){if(!this._hasMatches())return;let e=this._decorations.getFindScopes(),t=this._findMatches(e,!1,1073741824).map(e=>new P(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn)),n=this._editor.getSelection();for(let e=0,r=t.length;e<r;e++)if(t[e].equalsRange(n)){t=[n].concat(t.slice(0,e),t.slice(e+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}}},Pg=V(5,`input`),Fg=V(6,`Preserve Case`),Ig=class extends tu{constructor(e){super({icon:D.preserveCase,title:Fg+e.appendTitle,isChecked:e.isChecked,hoverLifecycleOptions:e.hoverLifecycleOptions,inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}},Lg=class extends Ra{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}constructor(e,t,n,r){super(),this._showOptionButtons=n,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new U),this._onKeyDown=this._register(new U),this._onMouseDown=this._register(new U),this._onInput=this._register(new U),this._onKeyUp=this._register(new U),this._onPreserveCaseKeyDown=this._register(new U),this.contextViewProvider=t,this.placeholder=r.placeholder||``,this.validation=r.validation,this.label=r.label||Pg;let i=r.appendPreserveCaseLabel||``,a=r.history||new Set([]),o=!!r.flexibleHeight,s=!!r.flexibleWidth,c=r.flexibleMaxHeight;this.domNode=document.createElement(`div`),this.domNode.classList.add(`monaco-findInput`),this.inputBox=this._register(new Lc(this.domNode,this.contextViewProvider,{ariaLabel:this.label||``,placeholder:this.placeholder||``,validationOptions:{validation:this.validation},history:a,showHistoryHint:r.showHistoryHint,flexibleHeight:o,flexibleWidth:s,flexibleMaxHeight:c,inputBoxStyles:r.inputBoxStyles})),this.preserveCase=this._register(new Ig({appendTitle:i,isChecked:!1,hoverLifecycleOptions:r.hoverLifecycleOptions,...r.toggleStyles})),this._register(this.preserveCase.onChange(e=>{this._onDidOptionChange.fire(e),!e&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(e=>{this._onPreserveCaseKeyDown.fire(e)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;let l=[this.preserveCase.domNode];this.onkeydown(this.domNode,e=>{if(e.equals(15)||e.equals(17)||e.equals(9)){let t=l.indexOf(this.domNode.ownerDocument.activeElement);if(t>=0){let n=-1;e.equals(17)?n=(t+1)%l.length:e.equals(15)&&(n=t===0?l.length-1:t-1),e.equals(9)?(l[t].blur(),this.inputBox.focus()):n>=0&&l[n].focus(),aa.stop(e,!0)}}});let u=document.createElement(`div`);u.className=`controls`,u.style.display=this._showOptionButtons?`block`:`none`,u.appendChild(this.preserveCase.domNode),this.domNode.appendChild(u),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,e=>this._onKeyDown.fire(e)),this.onkeyup(this.inputBox.inputElement,e=>this._onKeyUp.fire(e)),this.oninput(this.inputBox.inputElement,e=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,e=>this._onMouseDown.fire(e))}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(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+`px`}},Rg=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zg=function(e,t){return function(n,r){t(n,r,e)}},Bg=new A(`suggestWidgetVisible`,!1,V(1760,`Whether suggestion are visible`)),Vg=`historyNavigationWidgetFocus`,Hg=`historyNavigationForwardsEnabled`,Ug=`historyNavigationBackwardsEnabled`,Wg=void 0,Gg=[];function Kg(e,t){if(Gg.includes(t))throw Error(`Cannot register the same widget multiple times`);Gg.push(t);let n=new S,r=new A(Vg,!1).bindTo(e),i=new A(Hg,!0).bindTo(e),a=new A(Ug,!0).bindTo(e),o=()=>{r.set(!0),Wg=t},s=()=>{r.set(!1),Wg===t&&(Wg=void 0)};return za(t.element)&&o(),n.add(t.onDidFocus(()=>o())),n.add(t.onDidBlur(()=>s())),n.add(bn(()=>{Gg.splice(Gg.indexOf(t),1),s()})),{historyNavigationForwardsEnablement:i,historyNavigationBackwardsEnablement:a,dispose(){n.dispose()}}}var qg=class extends Na{constructor(e,t,n,r){super(e,t,n);let i=this._register(r.createScoped(this.inputBox.element));this._register(Kg(i,this.inputBox))}};qg=Rg([zg(3,G)],qg);var Jg=class extends Lg{constructor(e,t,n,r,i=!1){super(e,t,i,n);let a=this._register(r.createScoped(this.inputBox.element));this._register(Kg(a,this.inputBox))}};Jg=Rg([zg(3,G)],Jg),ke.registerCommandAndKeybindingRule({id:`history.showPrevious`,weight:200,when:m.and(m.has(Vg),m.equals(Ug,!0),m.not(`isComposing`),Bg.isEqualTo(!1)),primary:16,secondary:[528],handler:e=>{Wg?.showPreviousValue()}}),ke.registerCommandAndKeybindingRule({id:`history.showNext`,weight:200,when:m.and(m.has(Vg),m.equals(Hg,!0),m.not(`isComposing`),Bg.isEqualTo(!1)),primary:18,secondary:[530],handler:e=>{Wg?.showNextValue()}});function Yg(e){return e.lookupKeybinding(`history.showPrevious`)?.getElectronAccelerator()===`Up`&&e.lookupKeybinding(`history.showNext`)?.getElectronAccelerator()===`Down`}var Xg=Vs(`find-collapsed`,D.chevronRight,V(996,`Icon to indicate that the editor find widget is collapsed.`)),Zg=Vs(`find-expanded`,D.chevronDown,V(997,`Icon to indicate that the editor find widget is expanded.`)),Qg=Vs(`find-selection`,D.selection,V(998,`Icon for 'Find in Selection' in the editor find widget.`)),$g=Vs(`find-replace`,D.replace,V(999,`Icon for 'Replace' in the editor find widget.`)),e_=Vs(`find-replace-all`,D.replaceAll,V(1e3,`Icon for 'Replace All' in the editor find widget.`)),t_=Vs(`find-previous-match`,D.arrowUp,V(1001,`Icon for 'Find Previous' in the editor find widget.`)),n_=Vs(`find-next-match`,D.arrowDown,V(1002,`Icon for 'Find Next' in the editor find widget.`)),r_=V(1003,`Find / Replace`),i_=V(1004,`Find`),a_=V(1005,`Find`),o_=V(1006,`Previous Match`),s_=V(1007,`Next Match`),c_=V(1008,`Find in Selection`),l_=V(1009,`Close`),u_=V(1010,`Replace`),d_=V(1011,`Replace`),f_=V(1012,`Replace`),p_=V(1013,`Replace All`),m_=V(1014,`Toggle Replace`),h_=V(1015,`Only the first {0} results are highlighted, but all find operations work on the entire text.`,jg),g_=V(1016,`{0} of {1}`),__=V(1017,`No results`),v_=419,y_=221,b_=69,x_=33,S_=oi?256:2048,C_=class{constructor(e){this.afterLineNumber=e,this.heightInPx=x_,this.suppressMouseDown=!1,this.domNode=document.createElement(`div`),this.domNode.className=`dock-find-viewzone`}};function w_(e,t,n){let r=!!t.match(/\n/);if(n&&r&&n.selectionStart>0){e.stopPropagation();return}}function T_(e,t,n){let r=!!t.match(/\n/);if(n&&r&&n.selectionEnd<n.value.length){e.stopPropagation();return}}var E_=class e extends Ra{static{this.ID=`editor.contrib.findWidget`}constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._hoverService=o,this._findWidgetSearchHistory=s,this._replaceWidgetHistory=c,this._configurationService=l,this._accessibilityService=u,this._cachedHeight=null,this._lastFocusedInputWasReplace=!1,this._lastFocusedElement=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=n,this._contextViewProvider=r,this._keybindingService=i,this._contextKeyService=a,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new kc(500),this._register(bn(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(e=>this._onStateChanged(e))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(e=>{if(e.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),e.hasChanged(165)&&this._tryUpdateWidgetWidth(),e.hasChanged(2)&&this.updateAccessibilitySupport(),e.hasChanged(50)){let e=this._codeEditor.getOption(50).loop;this._state.change({loop:e},!1);let t=this._codeEditor.getOption(50).addExtraSpaceOnTop;t&&!this._viewZone&&(this._viewZone=new C_(0),this._showViewZone()),!t&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){let e=await this._controller.getGlobalBufferTerm();e&&e!==this._state.searchString&&(this._state.change({searchString:e},!1),this._findInput.select())}})),this._findInputFocused=Sg.bindTo(a),this._findFocusTracker=this._register(Os(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=Cg.bindTo(a),this._replaceFocusTracker=this._register(Os(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=wg.bindTo(a),this._widgetFocusTracker=this._register(Os(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register(K(this._domNode,`focusin`,e=>{Br(e.target)&&(this._lastFocusedElement=e.target)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new C_(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(e=>{if(e.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return e.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=qo(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){let e=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle(`no-results`,e),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,Hc)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=b_+`px`,this._state.matchesCount>=19999?this._matchesCount.title=h_: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 n=String(this._state.matchesPosition);n===`0`&&(n=`?`),e=gt(g_,n,t)}else e=__;this._matchesCount.appendChild(document.createTextNode(e)),$c(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),b_=Math.max(b_,this._matchesCount.clientWidth)}_getAriaLabel(e,t,n){let r;if(e===__)r=n===``?V(1018,`{0} found`,e):V(1019,`{0} found for '{1}'`,e,n);else if(t){let i=V(1020,`{0} found for '{1}', at {2}`,e,n,t.startLineNumber+`:`+t.startColumn),a=this._codeEditor.getModel();r=a&&t.startLineNumber<=a.getLineCount()&&t.startLineNumber>=1?`${a.getLineContent(t.startLineNumber)}, ${i}`:i}else r=V(1021,`{0} found for '{1}'`,e,n);return r}_updateToggleSelectionFindButton(){let e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,n=this._toggleSelectionFind.checked;this._isVisible&&(n||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);let 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);let n=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&n)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;let 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`:{let t=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=t;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){let n=this._codeEditor.getDomNode();if(n){let r=Po(n),i=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),a=r.left+(i?i.left:0),o=i?i.top:0;if(this._viewZone&&o<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);let n=uc(this._domNode).left;a>n&&(t=!1);let i=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());r.left+(i?i.left:0)>n&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(e=>{clearTimeout(e)}),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;let t=this._viewZone;this._viewZoneId!==void 0||!t||this._codeEditor.changeViewZones(n=>{t.heightInPx=this._getHeight(),this._viewZoneId=n.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 C_(0));let t=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){let r=this._getHeight();if(r===t.heightInPx)return;let i=r-t.heightInPx;t.heightInPx=r,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+i);return}else{let r=this._getHeight();if(r-=this._codeEditor.getOption(96).top,r<=0)return;t.heightInPx=r,this._viewZoneId=n.addZone(t),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r)}})}_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),void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;let 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`);let t=e.width,n=e.minimap.minimapWidth,r=!1,i=!1,a=!1;if(this._resized&&qo(this._domNode)>v_){this._domNode.style.maxWidth=`${t-28-n-15}px`,this._replaceInput.width=qo(this._findInput.domNode);return}if(447+n>=t&&(i=!0),447+n-b_>=t&&(a=!0),447+n-b_>=t+50&&(r=!0),this._domNode.classList.toggle(`collapsed-find-widget`,r),this._domNode.classList.toggle(`narrow-find-widget`,a),this._domNode.classList.toggle(`reduced-find-widget`,i),!a&&!r&&(this._domNode.style.maxWidth=`${t-28-n-15}px`),this._findInput.layout({collapsedFindWidget:r,narrowFindWidget:a,reducedFindWidget:i}),this._resized){let e=this._findInput.inputBox.element.clientWidth;e>0&&(this._replaceInput.width=e)}else this._isReplaceVisible&&(this._replaceInput.width=qo(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(){let 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){let e=this._codeEditor.getSelections();e.map(e=>{e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber-1)));let t=this._state.currentMatch;return e.startLineNumber!==e.endLineNumber&&!T.equalsRange(e,t)?e:null}).filter(e=>!!e),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(S_|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
6
+ `),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 w_(e,this._findInput.getValue(),this._findInput.domNode.querySelector(`textarea`));if(e.equals(18))return T_(e,this._findInput.getValue(),this._findInput.domNode.querySelector(`textarea`))}_onReplaceInputKeyDown(e){if(e.equals(S_|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
7
+ `),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 w_(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector(`textarea`));if(e.equals(18))return T_(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector(`textarea`))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding(``,e)}_buildDomNode(){let e=this._codeEditor.getOption(50).history,t=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new qg(null,this._contextViewProvider,{width:y_,label:i_,placeholder:a_,appendCaseSensitiveLabel:this._keybindingLabelFor(Ag.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Ag.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Ag.ToggleRegexCommand),validation:e=>{if(e.length===0||!this._findInput.getRegex())return null;try{return new RegExp(e,`gu`),null}catch(e){return{content:e.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>Yg(this._keybindingService),inputBoxStyles:Qa,toggleStyles:uo,history:e===`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(e=>{e.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(e)})),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(e=>{e.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),e.preventDefault())})),this._register(this._findInput.onRegexKeyDown(e=>{e.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),e.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(e=>{this._tryUpdateHeight()&&this._showViewZone()})),_i&&this._register(this._findInput.onMouseDown(e=>this._onFindInputMouseDown(e))),this._matchesCount=document.createElement(`div`),this._matchesCount.className=`matchesCount`,this._updateMatchesCount();let n={groupId:`find-widget`};this._prevBtn=this._register(new D_({label:o_+this._keybindingLabelFor(Ag.PreviousMatchFindAction),icon:t_,hoverLifecycleOptions:n,onTrigger:()=>{Xi(this._codeEditor.getAction(Ag.PreviousMatchFindAction)).run().then(void 0,Hc)}},this._hoverService)),this._nextBtn=this._register(new D_({label:s_+this._keybindingLabelFor(Ag.NextMatchFindAction),icon:n_,hoverLifecycleOptions:n,onTrigger:()=>{Xi(this._codeEditor.getAction(Ag.NextMatchFindAction)).run().then(void 0,Hc)}},this._hoverService));let r=document.createElement(`div`);r.className=`find-part`,r.appendChild(this._findInput.domNode);let i=document.createElement(`div`);i.className=`find-actions`,r.appendChild(i),i.appendChild(this._matchesCount),i.appendChild(this._prevBtn.domNode),i.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new tu({icon:Qg,title:c_+this._keybindingLabelFor(Ag.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:n,inputActiveOptionBackground:An(At),inputActiveOptionBorder:An(un),inputActiveOptionForeground:An(Dr)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let e=this._codeEditor.getSelections();e=e.map(e=>(e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e)).filter(e=>!!e),e.length&&this._state.change({searchScope:e},!0)}}else this._state.change({searchScope:null},!0)})),i.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new D_({label:l_+this._keybindingLabelFor(Ag.CloseFindWidgetCommand),icon:v,hoverLifecycleOptions:n,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:e=>{e.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),e.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new Jg(null,void 0,{label:u_,placeholder:d_,appendPreserveCaseLabel:this._keybindingLabelFor(Ag.TogglePreserveCaseCommand),history:t===`workspace`?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>Yg(this._keybindingService),inputBoxStyles:Qa,toggleStyles:uo,hoverLifecycleOptions:n},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(e=>this._onReplaceInputKeyDown(e))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(e=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(e=>{e.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(),e.preventDefault())})),this._replaceBtn=this._register(new D_({label:f_+this._keybindingLabelFor(Ag.ReplaceOneAction),icon:$g,hoverLifecycleOptions:n,onTrigger:()=>{this._controller.replace()},onKeyDown:e=>{e.equals(1026)&&(this._closeBtn.focus(),e.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new D_({label:p_+this._keybindingLabelFor(Ag.ReplaceAllAction),icon:e_,hoverLifecycleOptions:n,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));let a=document.createElement(`div`);a.className=`replace-part`,a.appendChild(this._replaceInput.domNode);let o=document.createElement(`div`);o.className=`replace-actions`,a.appendChild(o),o.appendChild(this._replaceBtn.domNode),o.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new D_({label:m_,className:`codicon toggle left`,onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=qo(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=r_,this._domNode.role=`dialog`,this._domNode.style.width=`${v_}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(r),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(a),this._resizeSash=this._register(new va(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let s=v_;this._register(this._resizeSash.onDidStart(()=>{s=qo(this._domNode)})),this._register(this._resizeSash.onDidChange(e=>{this._resized=!0;let t=s+e.startX-e.currentX;t<v_||t>(parseFloat(lo(this._domNode).maxWidth)||0)||(this._domNode.style.width=`${t}px`,this._isReplaceVisible&&(this._replaceInput.width=qo(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{let e=qo(this._domNode);if(e<v_)return;let t=v_;if(!this._resized||e===v_){let e=this._codeEditor.getLayoutInfo();t=e.width-28-e.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${t}px`,this._isReplaceVisible&&(this._replaceInput.width=qo(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let e=i_,t=u_;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue(`accessibility.verbosity.find`)&&this._accessibilityService.isScreenReaderOptimized()){let n=this._keybindingService.lookupKeybinding(`editor.action.accessibilityHelp`)?.getAriaLabel();if(n){let r=V(1022,`Press {0} for accessibility help`,n);e=V(1023,`{0}, {1}`,e,r),t=V(1024,`{0}, {1}`,t,r)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=oo(()=>{this._isVisible&&(this._findInput.inputBox.setAriaLabel(i_),this._replaceInput.inputBox.setAriaLabel(u_))},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)}},D_=class extends Ra{constructor(e,t){super(),this._opts=e;let n=`button`;this._opts.className&&(n=n+` `+this._opts.className),this._opts.icon&&(n=n+` `+C.asClassName(this._opts.icon)),this._domNode=document.createElement(`div`),this._domNode.tabIndex=0,this._domNode.className=n,this._domNode.setAttribute(`role`,`button`),this._domNode.setAttribute(`aria-label`,this._opts.label),this._register(t.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},e.hoverLifecycleOptions)),this.onclick(this._domNode,e=>{this._opts.onTrigger(),e.preventDefault()}),this.onkeydown(this._domNode,e=>{if(e.equals(10)||e.equals(3)){this._opts.onTrigger(),e.preventDefault();return}this._opts.onKeyDown?.(e)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle(`disabled`,!e),this._domNode.setAttribute(`aria-disabled`,String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute(`aria-expanded`,String(!!e)),e?(this._domNode.classList.remove(...C.asClassNameArray(Xg)),this._domNode.classList.add(...C.asClassNameArray(Zg))):(this._domNode.classList.remove(...C.asClassNameArray(Zg)),this._domNode.classList.add(...C.asClassNameArray(Xg)))}};xc((e,t)=>{let n=e.getColor(_c);n&&t.addRule(`.monaco-editor .findMatch { border: 1px ${Xr(e.type)?`dotted`:`solid`} ${n}; box-sizing: border-box; }`);let r=e.getColor(ps);r&&t.addRule(`.monaco-editor .findScope { border: 1px ${Xr(e.type)?`dashed`:`solid`} ${r}; }`);let i=e.getColor(Is);i&&t.addRule(`.monaco-editor .find-widget { border: 1px solid ${i}; }`);let a=e.getColor(_o);a&&t.addRule(`.monaco-editor .findMatchInline { color: ${a}; }`);let o=e.getColor(ll);o&&t.addRule(`.monaco-editor .currentFindMatchInline { color: ${o}; }`)});var O_=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},k_=function(e,t){return function(n,r){t(n,r,e)}},A_=class extends j{constructor(e,t,n,r){super(),this._container=e,this._getContent=t,this._clipboardService=n,this._hoverService=r,this._container.classList.add(`hover-row-with-copy`),this._button=this._register(new D_({label:V(1171,`Copy`),icon:D.copy,onTrigger:()=>this._copyContent(),className:`hover-copy-button`},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){let e=this._getContent();e&&(await this._clipboardService.writeText(e),zt(V(1172,`Copied to clipboard`)))}};A_=O_([k_(2,xe),k_(3,fa)],A_);var j_=class{constructor(e,t,n){this.provider=e,this.hover=t,this.ordinal=n}};async function M_(e,t,n,r,i){let a=await Promise.resolve(e.provideHover(n,r,i)).catch(cc);if(!(!a||!F_(a)))return new j_(e,a,t)}function N_(e,t,n,r,i=!1){let a=e.ordered(t,i).map((e,i)=>M_(e,i,t,n,r));return hs.fromPromisesResolveOrder(a).coalesce()}async function P_(e,t,n,r,i=!1){let a=[];for await(let o of N_(e,t,n,r,i))a.push(o.hover);return a}br(`_executeHoverProvider`,(e,t,n)=>P_(e.get(q).hoverProvider,t,n,B.None)),br(`_executeHoverProvider_recursive`,(e,t,n)=>P_(e.get(q).hoverProvider,t,n,B.None,!0));function F_(e){let t=e.range!==void 0,n=e.contents!==void 0&&e.contents&&e.contents.length>0;return t&&n}var I_=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},L_=function(e,t){return function(n,r){t(n,r,e)}},R_=I,z_=Vs(`hover-increase-verbosity`,D.addSmall,V(1173,`Icon for increaseing hover verbosity.`)),B_=Vs(`hover-decrease-verbosity`,D.removeSmall,V(1174,`Icon for decreasing hover verbosity.`)),V_=class{constructor(e,t,n,r,i,a=void 0){this.owner=e,this.range=t,this.contents=n,this.isBeforeContent=r,this.ordinal=i,this.source=a}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}},H_=class{constructor(e,t,n){this.hover=e,this.hoverProvider=t,this.hoverPosition=n}supportsVerbosityAction(e){switch(e){case In.Increase:return this.hover.canIncreaseVerbosity??!1;case In.Decrease:return this.hover.canDecreaseVerbosity??!1}}},U_=class{constructor(e,t,n,r,i,a,o){this._editor=e,this._markdownRendererService=t,this._configurationService=n,this._languageFeaturesService=r,this._keybindingService=i,this._hoverService=a,this._commandService=o,this.hoverOrdinal=3}createLoadingMessage(e){return new V_(this,e.range,[new li().appendText(V(1175,`Loading...`))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];let n=this._editor.getModel(),r=e.range.startLineNumber,i=n.getLineMaxColumn(r),a=[],o=1e3,s=n.getLineLength(r),c=n.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),l=this._editor.getOption(133),u=this._configurationService.getValue(`editor.maxTokenizationLineLength`,{overrideIdentifier:c}),d=this._editor.getOption(69).showLongLineWarning,f=!1;l>=0&&s>l&&e.range.startColumn>=l&&(f=!0,d&&a.push(new V_(this,e.range,[{value:V(1176,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`. [Don't Show Again](command:{0})",Sh),isTrusted:!0}],!1,o++))),!f&&typeof u==`number`&&s>=u&&d&&a.push(new V_(this,e.range,[{value:V(1177,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`. [Don't Show Again](command:{0})",Sh),isTrusted:!0}],!1,o++));let p=!1;for(let n of t){let t=n.range.startLineNumber===r?n.range.startColumn:1,s=n.range.endLineNumber===r?n.range.endColumn:i,c=n.options.hoverMessage;if(!c||dt(c))continue;n.options.beforeContentClassName&&(p=!0);let l=new T(e.range.startLineNumber,t,e.range.startLineNumber,s);a.push(new V_(this,l,nu(c),p,o++))}return a}computeAsync(e,t,n,r){if(!this._editor.hasModel()||e.type!==1)return hs.EMPTY;let i=this._editor.getModel(),a=this._languageFeaturesService.hoverProvider;return a.has(i)?this._getMarkdownHovers(a,i,e,r):hs.EMPTY}async*_getMarkdownHovers(e,t,n,r){let i=n.range.getStartPosition(),a=N_(e,t,i,r);for await(let e of a)if(!dt(e.hover.contents)){let t=e.hover.range?T.lift(e.hover.range):n.range,r=new H_(e.hover,e.provider,i);yield new V_(this,t,e.hover.contents,!1,e.ordinal,r)}}renderHoverParts(e,t){return this._renderedHoverParts=new G_(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))}};U_=I_([L_(1,it),L_(2,xa),L_(3,q),L_(4,jr),L_(5,fa),L_(6,tr)],U_);var W_=class{constructor(e,t,n,r){this.hoverPart=e,this.hoverElement=t,this.disposables=n,this.actionsContainer=r}dispose(){this.disposables.dispose()}},G_=class{constructor(e,t,n,r,i,a,o,s,c,l){this._hoverParticipant=n,this._editor=r,this._commandService=i,this._keybindingService=a,this._hoverService=o,this._configurationService=s,this._markdownRendererService=c,this._onFinishedRendering=l,this._ongoingHoverOperations=new Map,this._disposables=new S,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(bn(()=>{this.renderedHoverParts.forEach(e=>{e.dispose()}),this._ongoingHoverOperations.forEach(e=>{e.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,n){return e.sort(fs(e=>e.ordinal,Ee)),e.map(e=>{let r=this._renderHoverPart(e,n);return t.appendChild(r.hoverElement),r})}_renderHoverPart(e,t){let n=this._renderMarkdownHover(e,t),r=n.hoverElement,i=e.source,a=new S;if(a.add(n),!i)return new W_(e,r,a);let o=i.supportsVerbosityAction(In.Increase),s=i.supportsVerbosityAction(In.Decrease);if(!o&&!s)return new W_(e,r,a);let c=R_(`div.verbosity-actions`);r.prepend(c);let l=R_(`div.verbosity-actions-inner`);return c.append(l),a.add(this._renderHoverExpansionAction(l,In.Increase,o)),a.add(this._renderHoverExpansionAction(l,In.Decrease,s)),new W_(e,r,a,l)}_renderMarkdownHover(e,t){return q_(this._editor,e,this._markdownRendererService,t)}_renderHoverExpansionAction(e,t,n){let r=new S,i=t===In.Increase,a=H(e,R_(C.asCSSSelector(i?z_:B_)));a.tabIndex=0;let o=r.add(new xr(`mouse`,void 0,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(r.add(this._hoverService.setupManagedHover(o,a,J_(this._keybindingService,t))),!n)return a.classList.add(`disabled`),r;a.classList.add(`enabled`);let s=()=>this._commandService.executeCommand(t===In.Increase?vh:bh,{focus:!0});return r.add(new ho(a,s)),r.add(new hc(a,s,[3,10])),r}handleScroll(e){this.renderedHoverParts.forEach(t=>{let n=t.actionsContainer;if(!n)return;let r=t.hoverElement,i=e.scrollTop+e.height,a=r.offsetTop,o=r.clientHeight,s=a+o,c;c=s<=i||a>=i?o-22:i-a-22,n.style.top=`${c}px`})}async updateMarkdownHoverPartVerbosityLevel(e,t){let n=this._editor.getModel();if(!n)return;let r=this._getRenderedHoverPartAtIndex(t),i=r?.hoverPart.source;if(!r||!i?.supportsVerbosityAction(e))return;let a=await this._fetchHover(i,n,e);if(!a)return;let o=new H_(a,i.hoverProvider,i.hoverPosition),s=r.hoverPart,c=new V_(this._hoverParticipant,s.range,a.contents,s.isBeforeContent,s.ordinal,o),l=this._updateRenderedHoverPart(t,c);if(l)return{hoverPart:c,hoverElement:l.hoverElement}}getAccessibleContent(e){let t=this.renderedHoverParts.findIndex(t=>t.hoverPart===e);if(t===-1)return;let n=this._getRenderedHoverPartAtIndex(t);if(n)return n.hoverElement.innerText.replace(/[^\S\n\r]+/gu,` `)}async _fetchHover(e,t,n){let r=n===In.Increase?1:-1,i=e.hoverProvider,a=this._ongoingHoverOperations.get(i);a&&(a.tokenSource.cancel(),r+=a.verbosityDelta);let o=new ou;this._ongoingHoverOperations.set(i,{verbosityDelta:r,tokenSource:o});let s={verbosityRequest:{verbosityDelta:r,previousHover:e.hover}},c;try{c=await Promise.resolve(i.provideHover(t,e.hoverPosition,o.token,s))}catch(e){cc(e)}return o.dispose(),this._ongoingHoverOperations.delete(i),c}_updateRenderedHoverPart(e,t){if(e>=this.renderedHoverParts.length||e<0)return;let n=this._renderHoverPart(t,this._onFinishedRendering),r=this.renderedHoverParts[e],i=r.hoverElement,a=n.hoverElement,o=Array.from(a.children);i.replaceChildren(...o);let s=new W_(t,i,n.disposables,n.actionsContainer);return r.dispose(),this.renderedHoverParts[e]=s,s}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}};function K_(e,t,n,r){t.sort(fs(e=>e.ordinal,Ee));let i=[];for(let a of t){let t=q_(n,a,r,e.onContentsChanged);e.fragment.appendChild(t.hoverElement),i.push(t)}return new Hm(i)}function q_(e,t,n,r){let i=new S,a=R_(`div.hover-row`),o=R_(`div.hover-row-contents`);a.appendChild(o);let s=t.contents;for(let t of s){if(dt(t))continue;let a=R_(`div.markdown-hover`),s=H(a,R_(`div.hover-contents`)),c=i.add(n.render(t,{context:e,asyncRenderCallback:()=>{s.className=`hover-contents code-hover-contents`,r()}}));s.appendChild(c.element),o.appendChild(a)}return{hoverPart:t,hoverElement:a,dispose(){i.dispose()}}}function J_(e,t){switch(t){case In.Increase:return e.appendKeybinding(V(1178,`Increase Hover Verbosity`),vh);case In.Decrease:return e.appendKeybinding(V(1179,`Decrease Hover Verbosity`),bh)}}var Y_=I,X_=class extends j{constructor(e,t,n){super(),this.model=t,this.pixelRatio=n,this._onDidChange=this._register(new U),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new U),this.onColorFlushed=this._onColorFlushed.event,this._domNode=Y_(`.saturation-wrap`),H(e,this._domNode),this._canvas=document.createElement(`canvas`),this._canvas.className=`saturation-box`,H(this._domNode,this._canvas),this.selection=Y_(`.saturation-selection`),H(this._domNode,this.selection),this.layout(),this._register(K(this._domNode,pr.POINTER_DOWN,e=>this.onPointerDown(e))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new wr);let t=Po(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>this.onDidChangePosition(e.pageX-t.left,e.pageY-t.top),()=>null);let n=K(e.target.ownerDocument,pr.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),this.monitor&&=(this.monitor.stopMonitoring(!0),null)},!0)}onDidChangePosition(e,t){let n=Math.max(0,Math.min(1,e/this.width)),r=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(n,r),this._onDidChange.fire({s:n,v:r})}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();let e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){let e=this.model.color.hsva,t=new W(new Aa(e.h,1,1,1)),n=this._canvas.getContext(`2d`),r=n.createLinearGradient(0,0,this._canvas.width,0);r.addColorStop(0,`rgba(255, 255, 255, 1)`),r.addColorStop(.5,`rgba(255, 255, 255, 0.5)`),r.addColorStop(1,`rgba(255, 255, 255, 0)`);let i=n.createLinearGradient(0,0,0,this._canvas.height);i.addColorStop(0,`rgba(0, 0, 0, 0)`),i.addColorStop(1,`rgba(0, 0, 0, 1)`),n.rect(0,0,this._canvas.width,this._canvas.height),n.fillStyle=W.Format.CSS.format(t),n.fill(),n.fillStyle=r,n.fill(),n.fillStyle=i,n.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();let t=e.hsva;this.paintSelection(t.s,t.v)}},Z_=class extends j{constructor(e){super(),this._onClicked=this._register(new U),this.onClicked=this._onClicked.event,this._button=H(e,document.createElement(`button`)),this._button.classList.add(`insert-button`),this._button.textContent=`Insert`,this._register(K(this._button,pr.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}},Q_=I,$_=class extends j{constructor(e,t,n){super(),this.model=t,this._onDidChange=this._register(new U),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new U),this.onColorFlushed=this._onColorFlushed.event,n===`standalone`?(this.domNode=H(e,Q_(`.standalone-strip`)),this.overlay=H(this.domNode,Q_(`.standalone-overlay`))):(this.domNode=H(e,Q_(`.strip`)),this.overlay=H(this.domNode,Q_(`.overlay`))),this.slider=H(this.domNode,Q_(`.slider`)),this.slider.style.top=`0px`,this._register(K(this.domNode,pr.POINTER_DOWN,e=>this.onPointerDown(e))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;let e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){let t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._register(new wr),n=Po(this.domNode);this.domNode.classList.add(`grabbing`),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,e=>this.onDidChangeTop(e.pageY-n.top),()=>null);let r=K(e.target.ownerDocument,pr.POINTER_UP,()=>{this._onColorFlushed.fire(),r.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove(`grabbing`)},!0)}onDidChangeTop(e){let t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}},ev=class extends $_{constructor(e,t,n){super(e,t,n),this.domNode.classList.add(`opacity-strip`),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);let{r:t,g:n,b:r}=e.rgba,i=new W(new Pc(t,n,r,1)),a=new W(new Pc(t,n,r,0));this.overlay.style.background=`linear-gradient(to bottom, ${i} 0%, ${a} 100%)`}getValue(e){return e.hsva.a}},tv=class extends $_{constructor(e,t,n){super(e,t,n),this.domNode.classList.add(`hue-strip`)}getValue(e){return 1-e.hsva.h/360}},nv=I,rv=class extends j{constructor(e,t,n,r){super(),this.model=t,this.pixelRatio=n,this._insertButton=null,this._domNode=nv(`.colorpicker-body`),H(e,this._domNode),this._saturationBox=new X_(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 ev(this._domNode,this.model,r),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new tv(this._domNode,this.model,r),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),r===`standalone`&&(this._insertButton=this._register(new Z_(this._domNode)),this._domNode.classList.add(`standalone-colorpicker`))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){let n=this.model.color.hsva;this.model.color=new W(new Aa(n.h,e,t,n.a))}onDidOpacityChange(e){let t=this.model.color.hsva;this.model.color=new W(new Aa(t.h,t.s,t.v,e))}onDidHueChange(e){let t=this.model.color.hsva,n=(1-e)*360;this.model.color=new W(new Aa(n===360?0:n,t.s,t.v,t.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()}},iv=I,av=class extends j{constructor(e){super(),this._onClicked=this._register(new U),this.onClicked=this._onClicked.event,this._button=document.createElement(`div`),this._button.classList.add(`close-button`),H(e,this._button);let t=document.createElement(`div`);t.classList.add(`close-button-inner-div`),H(this._button,t),H(t,iv(`.button`+C.asCSSSelector(Vs(`color-picker-close`,D.close,V(921,`Icon to close the color picker`))))).classList.add(`close-icon`),this._register(K(this._button,pr.CLICK,()=>{this._onClicked.fire()}))}},ov=I,sv=class extends j{constructor(e,t,n,r){super(),this.model=t,this.type=r,this._closeButton=null,this._domNode=ov(`.colorpicker-header`),H(e,this._domNode),this._pickedColorNode=H(this._domNode,ov(`.picked-color`)),H(this._pickedColorNode,ov(`span.codicon.codicon-color-mode`)),this._pickedColorPresentation=H(this._pickedColorNode,document.createElement(`span`)),this._pickedColorPresentation.classList.add(`picked-color-presentation`);let i=V(922,`Click to toggle color options (rgb/hsl/hex)`);this._pickedColorNode.setAttribute(`title`,i),this._originalColorNode=H(this._domNode,ov(`.original-color`)),this._originalColorNode.style.backgroundColor=W.Format.CSS.format(this.model.originalColor)||``,this.backgroundColor=n.getColorTheme().getColor(Dc)||W.white,this._register(n.onDidColorThemeChange(e=>{this.backgroundColor=e.getColor(Dc)||W.white})),this._register(K(this._pickedColorNode,pr.CLICK,()=>this.model.selectNextColorPresentation())),this._register(K(this._originalColorNode,pr.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=W.Format.CSS.format(t.color)||``,this._pickedColorNode.classList.toggle(`light`,t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.type===`standalone`&&(this._domNode.classList.add(`standalone-colorpicker`),this._closeButton=this._register(new av(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=W.Format.CSS.format(e)||``,this._pickedColorNode.classList.toggle(`light`,e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:``}},cv=I,lv=class extends Ra{constructor(e,t,n,r,i){super(),this.model=t,this.pixelRatio=n,this._register(fr.getInstance(_a(e)).onDidChange(()=>this.layout())),this._domNode=cv(`.colorpicker-widget`),e.appendChild(this._domNode),this.header=this._register(new sv(this._domNode,this.model,r,i)),this.body=this._register(new rv(this._domNode,this.model,this.pixelRatio,i))}layout(){this.body.layout()}get domNode(){return this._domNode}},uv=class extends j{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,n){super(),this.presentationIndex=n,this._onColorFlushed=this._register(new U),this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=this._register(new U),this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=this._register(new U),this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let n=-1;for(let e=0;e<this.colorPresentations.length;e++)if(t.toLowerCase()===this.colorPresentations[e].label){n=e;break}if(n===-1){let e=t.split(`(`)[0].toLowerCase();for(let t=0;t<this.colorPresentations.length;t++)if(this.colorPresentations[t].label.toLowerCase().startsWith(e)){n=t;break}}n!==-1&&n!==this.presentationIndex&&(this.presentationIndex=n,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}};async function dv(e,t,n){let r=e.getValueInRange(t.range),{red:i,green:a,blue:o,alpha:s}=t.color,c=new W(new Pc(Math.round(i*255),Math.round(a*255),Math.round(o*255),s)),l=await Ym(e,t,n,B.None),u=new uv(c,[],0);return u.colorPresentations=l||[],u.guessColorPresentation(c,r),{range:T.lift(t.range),model:u,provider:n}}function fv(e,t,n){let r=[],i=n.presentation.textEdit??{range:t,text:n.presentation.label,forceMoveMarkers:!1};r.push(i),n.presentation.additionalTextEdits&&r.push(...n.presentation.additionalTextEdits);let a=T.lift(i.range),o=e.getModel()._setTrackedRange(null,a,3);return e.executeEdits(`colorpicker`,r),e.pushUndoStop(),e.getModel()._getTrackedRange(o)??a}async function pv(e,t,n,r,i){t.colorPresentations=await Ym(e,{range:r,color:{red:n.rgba.r/255,green:n.rgba.g/255,blue:n.rgba.b/255,alpha:n.rgba.a}},i.provider,B.None)||[]}var mv=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},hv=function(e,t){return function(n,r){t(n,r,e)}},gv=class e{constructor(e,t,n,r){this.owner=e,this.range=t,this.model=n,this.provider=r,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}static fromBaseColor(t,n){return new e(t,n.range,n.model,n.provider)}},_v=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t,n){return[]}computeAsync(e,t,n,r){return hs.fromPromise(this._computeAsync(e,t,n))}async _computeAsync(e,t,n){if(!this._editor.hasModel()||!this._isValidRequest(n))return[];let r=ah.get(this._editor);if(!r)return[];for(let e of t){if(!r.isColorDecoration(e))continue;let t=r.getColorData(e.range.getStartPosition());if(t)return[gv.fromBaseColor(this,await dv(this._editor.getModel(),t.colorInfo,t.provider))]}return[]}_isValidRequest(e){let t=this._editor.getOption(168);switch(e){case 0:return t===`hover`||t===`clickAndHover`;case 1:return t===`click`||t===`clickAndHover`;case 2:return!0}}renderHoverParts(e,t){let n=this._editor;if(t.length===0||!n.hasModel())return new Hm([]);let r=n.getOption(75)+8;e.setMinimumDimensions(new zi(302,r));let i=new S,a=t[0],o=n.getModel(),s=a.model;this._colorPicker=i.add(new lv(e.fragment,s,n.getOption(163),this._themeService,`hover`));let c=!1,l=new T(a.range.startLineNumber,a.range.startColumn,a.range.endLineNumber,a.range.endColumn);return i.add(s.onColorFlushed(async e=>{await pv(o,s,e,l,a),c=!0,l=fv(n,l,s)})),i.add(s.onDidChangeColor(e=>{pv(o,s,e,l,a)})),i.add(n.onDidChangeModelContent(t=>{c?c=!1:(e.hide(),n.focus())})),new Hm([{hoverPart:gv.fromBaseColor(this,a),hoverElement:this._colorPicker.domNode,dispose(){i.dispose()}}])}getAccessibleContent(e){return V(923,`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}};_v=mv([hv(1,Ll)],_v);function vv(e,t){return!!e[t]}var yv=class{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.mouseMiddleClickAction=t.mouseMiddleClickAction,this.hasTriggerModifier=vv(e.event,t.triggerModifier),this.isMiddleClick&&t.mouseMiddleClickAction===`ctrlLeftClick`&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=vv(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}},bv=class{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=vv(e,t.triggerModifier)}},xv=class{constructor(e,t,n,r,i){this.mouseMiddleClickAction=i,this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=n,this.triggerSideBySideModifier=r}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier&&this.mouseMiddleClickAction===e.mouseMiddleClickAction}};function Sv(e,t){return e===`altKey`?oi?new xv(57,`metaKey`,6,`altKey`,t):new xv(5,`ctrlKey`,6,`altKey`,t):oi?new xv(6,`altKey`,57,`metaKey`,t):new xv(6,`altKey`,5,`ctrlKey`,t)}var Cv=class extends j{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new U),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new U),this.onExecute=this._onExecute.event,this._onCancel=this._register(new U),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(e=>e.target.position?e.target.position.lineNumber:0),this._opts=Sv(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(e=>{if(e.hasChanged(86)||e.hasChanged(87)){let e=Sv(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(e))return;this._opts=e,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(e=>this._onEditorMouseMove(new yv(e,this._opts)))),this._register(this._editor.onMouseDown(e=>this._onEditorMouseDown(new yv(e,this._opts)))),this._register(this._editor.onMouseUp(e=>this._onEditorMouseUp(new yv(e,this._opts)))),this._register(this._editor.onKeyDown(e=>this._onEditorKeyDown(new bv(e,this._opts)))),this._register(this._editor.onKeyUp(e=>this._onEditorKeyUp(new bv(e,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(e=>this._onDidChangeCursorSelection(e))),this._register(this._editor.onDidChangeModel(e=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(e=>{(e.scrollTopChanged||e.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){let t=this._extractLineNumberFromMouseEvent(e);this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&(this._hasTriggerKeyOnMouseDown||e.isMiddleClick&&e.mouseMiddleClickAction===`openLink`)&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}},wv=class{constructor(e,t){this.range=e,this.direction=t}},Tv=class e{constructor(e,t,n){this.hint=e,this.anchor=t,this.provider=n,this._isResolved=!1}with(t){let n=new e(this.hint,t.anchor,this.provider);return n._isResolved=this._isResolved,n._currentResolve=this._currentResolve,n}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{let 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(e){cc(e),this._isResolved=!1}}},Ev=class e{static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(t,n,r,i){let a=[],o=t.ordered(n).reverse().map(t=>r.map(async r=>{try{let o=await t.provideInlayHints(n,r,i);(o?.hints.length||t.onDidChangeInlayHints)&&a.push([o??e._emptyInlayHintList,t])}catch(e){cc(e)}}));if(await Promise.all(o.flat()),i.isCancellationRequested||n.isDisposed())throw new Jl;return new e(r,a,n)}constructor(t,n,r){this._disposables=new S,this.ranges=t,this.provider=new Set;let i=[];for(let[t,a]of n){this._disposables.add(t),this.provider.add(a);for(let n of t.hints){let t=r.validatePosition(n.position),o=`before`,s=e._getRangeAtPosition(r,t),c;s.getStartPosition().isBefore(t)?(c=T.fromPositions(s.getStartPosition(),t),o=`after`):(c=T.fromPositions(t,s.getEndPosition()),o=`before`),i.push(new Tv(n,new wv(c,o),a))}}this.items=i.sort((e,t)=>M.compare(e.hint.position,t.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){let n=t.lineNumber,r=e.getWordAtPosition(t);if(r)return new T(n,r.startColumn,n,r.endColumn);e.tokenization.tokenizeIfCheap(n);let i=e.tokenization.getLineTokens(n),a=t.column-1,o=i.findTokenIndexAtOffset(a),s=i.getStartOffset(o),c=i.getEndOffset(o);return c-s===1&&(s===a&&o>1?(s=i.getStartOffset(o-1),c=i.getEndOffset(o-1)):c===a&&o<i.getCount()-1&&(s=i.getStartOffset(o+1),c=i.getEndOffset(o+1))),new T(n,s+1,n,c+1)}};function Dv(e){return ji(e.id,...e.arguments??[]).toString()}var Ov=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},kv=function(e,t){return function(n,r){t(n,r,e)}},Av=class extends ls{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(e,{...r.getRawOptions(),overflowWidgetsDomNode:r.getOverflowWidgetsDomNode()},n,i,a,o,s,c,l,u,d,f,p),this._parentEditor=r,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(r.onDidChangeConfiguration(e=>this._onParentConfigurationChanged(e)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Xn(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Av=Ov([kv(4,w),kv(5,Di),kv(6,tr),kv(7,G),kv(8,Ll),kv(9,di),kv(10,ai),kv(11,eu),kv(12,q),kv(13,Pt)],Av);function jv(e){let t=e.get(Di).getFocusedCodeEditor();return t instanceof Av?t.getParentEditor():t}var Mv=new W(new Pc(0,122,204)),Nv={showArrow:!0,showFrame:!0,className:``,frameColor:Mv,arrowColor:Mv,keepEditorSelection:!1},Pv=`vs.editor.contrib.zoneWidget`,Fv=class{constructor(e,t,n,r,i,a,o,s){this.id=``,this.domNode=e,this.afterLineNumber=t,this.afterColumn=n,this.heightInLines=r,this.showInHiddenAreas=o,this.ordinal=s,this._onDomNodeTop=i,this._onComputedHeight=a}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}},Iv=class{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}},Lv=class e{static{this._IdGenerator=new bi(`.arrow-decoration-`)}constructor(t){this._editor=t,this._ruleName=e._IdGenerator.nextId(),this._color=null,this._height=-1,this._decorations=this._editor.createDecorationsCollection()}dispose(){this.hide(),hi(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(){hi(this._ruleName),Yu(`.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:T.fromPositions(e),options:{description:`zone-widget-arrow`,className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}},Rv=class{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._isSashResizeHeight=!1,this._viewZone=null,this._disposables=new S,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=Ie(t),Xn(this.options,Nv,!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(e=>{let t=this._getWidth(e);this.domNode.style.width=t+`px`,this.domNode.style.left=this._getLeft(e)+`px`,this._onWidth(t)}))}dispose(){this._overlayWidget&&=(this.editor.removeOverlayWidget(this._overlayWidget),null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.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 Lv(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){let e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){let e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+`px`}_onViewZoneHeight(e){if(this.domNode.style.height=`${e}px`,this.container){let t=e-this._decoratingElementsHeight();this.container.style.height=`${t}px`;let n=this.editor.getLayoutInfo();this._doLayout(t,this._getWidth(n))}this._resizeSash?.layout()}get position(){let e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){let n=T.isIRange(e)?T.lift(e):T.fromPositions(e);this._isShowing=!0,this._showImpl(n,t),this._isShowing=!1,this._positionMarkerId.set([{range:n,options:Y.EMPTY}])}hide(){this._viewZone&&=(this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id)}),null),this._overlayWidget&&=(this.editor.removeOverlayWidget(this._overlayWidget),null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){let e=this.editor.getOption(75),t=0;if(this.options.showArrow){let n=Math.round(e/3);t+=2*n}if(this.options.showFrame){let n=this.options.frameWidth??Math.round(e/9);t+=2*n}return t}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(e,t){let n=e.getStartPosition(),r=this.editor.getLayoutInfo(),i=this._getWidth(r);this.domNode.style.width=`${i}px`,this.domNode.style.left=this._getLeft(r)+`px`;let a=document.createElement(`div`);a.style.overflow=`hidden`;let o=this.editor.getOption(75),s=this._getMaximumHeightInLines();s!==void 0&&(t=Math.min(t,s));let c=0,l=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(o/3),this._arrow.height=c,this._arrow.show(n)),this.options.showFrame&&(l=Math.round(o/9)),this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._overlayWidget&&=(this.editor.removeOverlayWidget(this._overlayWidget),null),this.domNode.style.top=`-1000px`,this._viewZone=new Fv(a,n.lineNumber,n.column,t,e=>this._onViewZoneTop(e),e=>this._onViewZoneHeight(e),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=e.addZone(this._viewZone),this._overlayWidget=new Iv(Pv+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){let e=this.options.frameWidth?this.options.frameWidth:l;this.container.style.borderTopWidth=e+`px`,this.container.style.borderBottomWidth=e+`px`}let u=t*o-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+`px`,this.container.style.height=u+`px`,this.container.style.overflow=`hidden`),this._doLayout(u,i),this.options.keepEditorSelection||this.editor.setSelection(e);let d=this.editor.getModel();if(d){let t=d.validateRange(new T(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(t,t.startLineNumber===d.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e,t){let n=this._getMaximumHeightInLines(),r=t&&n!==void 0?Math.min(n,e):e;this._viewZone&&this._viewZone.heightInLines!==r&&(this.editor.changeViewZones(e=>{this._viewZone&&(this._viewZone.heightInLines=r,e.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new va(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){let n=(t.currentY-e.startY)/this.editor.getOption(75),r=n<0?Math.ceil(n):Math.floor(n),i=e.heightInLines+r;i>e.minLines&&i<e.maxLines&&(this._isSashResizeHeight=!0,this._relayout(i))}}))}_updateSashEnablement(){if(this._resizeSash){let{minLines:e,maxLines:t}=this._getResizeBounds();this._resizeSash.state=e===t?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(){let e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}},zv=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Bv=function(e,t){return function(n,r){t(n,r,e)}},Vv=Xt(`IPeekViewService`);us(Vv,class{constructor(){this._widgets=new Map}addExclusiveWidget(e,t){let n=this._widgets.get(e);n&&(n.listener.dispose(),n.widget.dispose()),this._widgets.set(e,{widget:t,listener:t.onDidClose(()=>{let n=this._widgets.get(e);n&&n.widget===t&&(n.listener.dispose(),this._widgets.delete(e))})})}},1);var Hv;(function(e){e.inPeekEditor=new A(`inReferenceSearchEditor`,!0,V(1362,`Whether the current code editor is embedded inside peek`)),e.notInPeekEditor=e.inPeekEditor.toNegated()})(Hv||={});var Uv=class{static{this.ID=`editor.contrib.referenceController`}constructor(e,t){e instanceof Av&&Hv.inPeekEditor.bindTo(t)}dispose(){}};Uv=zv([Bv(1,G)],Uv),F(Uv.ID,Uv,0);var Wv={headerBackgroundColor:W.white,primaryHeadingColor:W.fromHex(`#333333`),secondaryHeadingColor:W.fromHex(`#6c6c6cb3`)},Gv=class extends Rv{constructor(e,t,n){super(e,t),this.instantiationService=n,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,Xn(this.options,Wv,!1);let r=lu(this.editor);r.openedPeekWidgets.set(r.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();let e=lu(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){let 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();let 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=I(`.head`),this._bodyElement=I(`.body`),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=I(`.peekview-title`),this.options.supportOnTitleClick&&(this._titleElement.classList.add(`clickable`),vs(this._titleElement,`click`,e=>this._onTitleClick(e))),H(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=I(`span.filename`),this._secondaryHeading=I(`span.dirname`),this._metaHeading=I(`span.meta`),H(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let n=I(`.peekview-actions`);H(this._headElement,n);let r=this._getActionBarOptions();this._actionbarWidget=new Fn(n,r),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new cn(`peekview.close`,V(1363,`Close`),C.asClassName(D.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:ys.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:Mc(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,Bs(this._metaHeading)):Vu(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}let n=Math.ceil(this.editor.getOption(75)*1.2),r=Math.round(e-(n+1));this._doLayoutHead(n,t),this._doLayoutBody(r,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`)}};Gv=zv([Bv(2,w)],Gv);var Kv=E(`peekViewTitle.background`,{dark:`#252526`,light:`#F3F3F3`,hcDark:W.black,hcLight:W.white},V(1364,`Background color of the peek view title area.`)),qv=E(`peekViewTitleLabel.foreground`,{dark:W.white,light:W.black,hcDark:W.white,hcLight:wa},V(1365,`Color of the peek view title.`)),Jv=E(`peekViewTitleDescription.foreground`,{dark:`#ccccccb3`,light:`#616161`,hcDark:`#FFFFFF99`,hcLight:`#292929`},V(1366,`Color of the peek view title info.`)),Yv=E(`peekView.border`,{dark:Gl,light:Gl,hcDark:Is,hcLight:Is},V(1367,`Color of the peek view borders and arrow.`)),Xv=E(`peekViewResult.background`,{dark:`#252526`,light:`#F3F3F3`,hcDark:W.black,hcLight:W.white},V(1368,`Background color of the peek view result list.`));E(`peekViewResult.lineForeground`,{dark:`#bbbbbb`,light:`#646465`,hcDark:W.white,hcLight:wa},V(1369,`Foreground color for line nodes in the peek view result list.`)),E(`peekViewResult.fileForeground`,{dark:W.white,light:`#1E1E1E`,hcDark:W.white,hcLight:wa},V(1370,`Foreground color for file nodes in the peek view result list.`)),E(`peekViewResult.selectionBackground`,{dark:`#3399ff33`,light:`#3399ff33`,hcDark:null,hcLight:null},V(1371,`Background color of the selected entry in the peek view result list.`)),E(`peekViewResult.selectionForeground`,{dark:W.white,light:`#6C6C6C`,hcDark:W.white,hcLight:wa},V(1372,`Foreground color of the selected entry in the peek view result list.`));var Zv=E(`peekViewEditor.background`,{dark:`#001F33`,light:`#F2F8FC`,hcDark:W.black,hcLight:W.white},V(1373,`Background color of the peek view editor.`));E(`peekViewEditorGutter.background`,Zv,V(1374,`Background color of the gutter in the peek view editor.`)),E(`peekViewEditorStickyScroll.background`,Zv,V(1375,`Background color of sticky scroll in the peek view editor.`)),E(`peekViewEditorStickyScrollGutter.background`,Zv,V(1376,`Background color of the gutter part of sticky scroll in the peek view editor.`)),E(`peekViewResult.matchHighlightBackground`,{dark:`#ea5c004d`,light:`#ea5c004d`,hcDark:null,hcLight:null},V(1377,`Match highlight color in the peek view result list.`)),E(`peekViewEditor.matchHighlightBackground`,{dark:`#ff8f0099`,light:`#f5d802de`,hcDark:null,hcLight:null},V(1378,`Match highlight color in the peek view editor.`)),E(`peekViewEditor.matchHighlightBorder`,{dark:null,light:null,hcDark:Hn,hcLight:Hn},V(1379,`Match highlight border in the peek view editor.`));var Qv=class{constructor(e,t,n,r){this.isProviderFirst=e,this.parent=t,this.link=n,this._rangeCallback=r,this.id=Ct.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){let e=this.parent.getPreview(this)?.preview(this.range);return e?V(1131,`{0} in {1} on line {2} at column {3}`,e.value,Oc(this.uri),this.range.startLineNumber,this.range.startColumn):V(1130,`in {0} on line {1} at column {2}`,Oc(this.uri),this.range.startLineNumber,this.range.startColumn)}},$v=class{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){let n=this._modelReference.object.textEditorModel;if(!n)return;let{startLineNumber:r,startColumn:i,endLineNumber:a,endColumn:o}=e,s=new T(r,n.getWordUntilPosition({lineNumber:r,column:i-t}).startColumn,r,i),c=new T(a,o,a,1073741824),l=n.getValueInRange(s).replace(/^\s+/,``),u=n.getValueInRange(e),d=n.getValueInRange(c).replace(/\s+$/,``);return{value:l+u+d,highlight:{start:l.length,end:l.length+u.length}}}},ey=class{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new ha}dispose(){h(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){let e=this.children.length;return e===1?V(1132,`1 symbol in {0}, full path {1}`,Oc(this.uri),this.uri.fsPath):V(1133,`{0} symbols in {1}, full path {2}`,e,Oc(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(let t of this.children)if(!this._previews.has(t.uri))try{let n=await e.createModelReference(t.uri);this._previews.set(t.uri,new $v(n))}catch(e){Hc(e)}return this}},ty=class e{constructor(t,n){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new U,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=t,this._title=n;let[r]=t;t.sort(e._compareReferences);let i;for(let n of t)if((!i||!Js.isEqual(i.uri,n.uri,!0))&&(i=new ey(this,n.uri),this.groups.push(i)),i.children.length===0||e._compareReferences(n,i.children[i.children.length-1])!==0){let e=new Qv(r===n,i,n,e=>this._onDidChangeReferenceRange.fire(e));this.references.push(e),i.children.push(e)}}dispose(){h(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new e(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?V(1134,`No results found`):this.references.length===1?V(1135,`Found 1 symbol in {0}`,this.references[0].uri.fsPath):this.groups.length===1?V(1136,`Found {0} symbols in {1}`,this.references.length,this.groups[0].uri.fsPath):V(1137,`Found {0} symbols in {1} files`,this.references.length,this.groups.length)}nextOrPreviousReference(e,t){let{parent:n}=e,r=n.children.indexOf(e),i=n.children.length,a=n.parent.groups.length;return a===1||t&&r+1<i||!t&&r>0?(r=t?(r+1)%i:(r+i-1)%i,n.children[r]):(r=n.parent.groups.indexOf(n),t?(r=(r+1)%a,n.parent.groups[r].children[0]):(r=(r+a-1)%a,n.parent.groups[r].children[n.parent.groups[r].children.length-1]))}nearestReference(e,t){let n=this.references.map((n,r)=>({idx:r,prefixLen:_n(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((e,t)=>e.prefixLen>t.prefixLen?-1:e.prefixLen<t.prefixLen?1:e.offsetDist<t.offsetDist?-1:+(e.offsetDist>t.offsetDist))[0];if(n)return this.references[n.idx]}referenceAt(e,t){for(let n of this.references)if(n.uri.toString()===e.toString()&&T.containsPosition(n.range,t))return n}firstReference(){for(let e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return Js.compare(e.uri,t.uri)||T.compareRangesUsingStarts(e.range,t.range)}},ny=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ry=function(e,t){return function(n,r){t(n,r,e)}},iy,ay=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof ty||e instanceof ey}getChildren(e){if(e instanceof ty)return e.groups;if(e instanceof ey)return e.resolve(this._resolverService).then(e=>e.children);throw Error(`bad tree`)}};ay=ny([ry(0,gi)],ay);var oy=class{getHeight(){return 23}getTemplateId(e){return e instanceof ey?uy.id:fy.id}},sy=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){if(e instanceof Qv){let t=e.parent.getPreview(e)?.preview(e.range);if(t)return t.value}return Oc(e.uri)}};sy=ny([ry(0,jr)],sy);var cy=class{getId(e){return e instanceof Qv?e.id:e.uri}},ly=class extends j{constructor(e,t){super(),this._labelService=t;let n=document.createElement(`div`);n.classList.add(`reference-file`),this.file=this._register(new _t(n,{supportHighlights:!0})),this.badge=this._register(new Ti(H(n,I(`.count`)),{},Dl)),e.appendChild(n)}set(e,t){let n=qa(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(n,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});let r=e.children.length;this.badge.setCount(r),r>1?this.badge.setTitleFormat(V(1124,`{0} references`,r)):this.badge.setTitleFormat(V(1125,`{0} reference`,r))}};ly=ny([ry(1,mi)],ly);var uy=class{static{iy=this}static{this.id=`FileReferencesRenderer`}constructor(e){this._instantiationService=e,this.templateId=iy.id}renderTemplate(e){return this._instantiationService.createInstance(ly,e)}renderElement(e,t,n){n.set(e.element,la(e.filterData))}disposeTemplate(e){e.dispose()}};uy=iy=ny([ry(0,w)],uy);var dy=class extends j{constructor(e){super(),this.label=this._register(new ii(e))}set(e,t){let n=e.parent.getPreview(e)?.preview(e.range);if(!n||!n.value)this.label.set(`${Oc(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{let{value:e,highlight:r}=n;t&&!Ut.isDefault(t)?(this.label.element.classList.toggle(`referenceMatch`,!1),this.label.set(e,la(t))):(this.label.element.classList.toggle(`referenceMatch`,!0),this.label.set(e,[r]))}}},fy=class e{constructor(){this.templateId=e.id}static{this.id=`OneReferenceRenderer`}renderTemplate(e){return new dy(e)}renderElement(e,t,n){n.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}},py=class{getWidgetAriaLabel(){return V(1126,`References`)}getAriaLabel(e){return e.ariaMessage}},my=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},hy=function(e,t){return function(n,r){t(n,r,e)}},gy=class e{static{this.DecorationOptions=Y.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 S,this._callOnModelChange=new S,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();let e=this._editor.getModel();if(e){for(let t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(t){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));let n=[],r=[];for(let i=0,a=t.children.length;i<a;i++){let a=t.children[i];this._decorationIgnoreSet.has(a.id)||a.uri.toString()===this._editor.getModel().uri.toString()&&(n.push({range:a.range,options:e.DecorationOptions}),r.push(i))}this._editor.changeDecorations(e=>{let i=e.deltaDecorations([],n);for(let e=0;e<i.length;e++)this._decorations.set(i[e],t.children[r[e]])})}_onDecorationChanged(){let e=[],t=this._editor.getModel();if(t){for(let[n,r]of this._decorations){let i=t.getDecorationRange(n);if(!i)continue;let a=!1;T.equalsRange(i,r.range)||((T.spansMultipleLines(i)||r.range.endColumn-r.range.startColumn!==i.endColumn-i.startColumn)&&(a=!0),a?(this._decorationIgnoreSet.add(r.id),e.push(n)):r.range=i)}for(let t=0,n=e.length;t<n;t++)this._decorations.delete(e[t]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}},_y=class{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,n;try{let r=JSON.parse(e);t=r.ratio,n=r.heightInLines}catch{}return{ratio:t||.7,heightInLines:n||18}}},vy=class extends Jt{},yy=class{constructor(e){this.labelService=e,this.disposables=new S}getDragURI(e){return e instanceof ey?e.uri.toString():e instanceof Qv?Nr(e.uri,e.range).toString():null}getDragLabel(e){if(e.length!==0)return e.map(e=>this.labelService.getUriBasenameLabel(e.uri)).join(`, `)}onDragStart(e,t){if(!t.dataTransfer)return;let n=e.elements.map(e=>this.getDragURI(e)).filter(Boolean);n.length&&(t.dataTransfer.setData(lc.RESOURCES,JSON.stringify(n)),t.dataTransfer.setData(lc.TEXT,n.join(`
8
+ `)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};yy=my([hy(0,mi)],yy);var by=class extends Gv{constructor(e,t,n,r,i,a,o,s,c){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},a),this._defaultTreeKeyboardSupport=t,this.layoutData=n,this._textModelResolverService=i,this._instantiationService=a,this._peekViewService=o,this._uriLabel=s,this._keybindingService=c,this._disposeOnNewModel=new S,this._callOnDispose=new S,this._onDidSelectReference=this._callOnDispose.add(new U),this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new zi(0,0),this._isClosing=!1,this._applyTheme(r.getColorTheme()),this._callOnDispose.add(r.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(),h(this._preview),h(this._previewNotAvailableMessage),h(this._tree),h(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){let t=e.getColor(Yv)||W.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(Kv)||W.transparent,primaryHeadingColor:e.getColor(qv),secondaryHeadingColor:e.getColor(Jv)})}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(t){this.setCssClass(`reference-zone-widget`),this._messageContainer=H(t,I(`div.messages`)),Vu(this._messageContainer),this._splitView=new Do(t,{orientation:1}),this._previewContainer=H(t,I(`div.preview.inline`));let n={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(Av,this._previewContainer,n,{},this.editor),Vu(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Wu,V(1127,`no preview available`),mo,Wu.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=H(t,I(`div.ref-tree.inline`));let r={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new py,keyboardNavigationLabelProvider:this._instantiationService.createInstance(sy),identityProvider:new cy,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:Xv},dnd:this._instantiationService.createInstance(yy)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(vs(this._treeContainer,`keydown`,e=>{e.equals(9)&&(this._keybindingService.dispatchEvent(e,e.target),e.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(vy,`ReferencesWidget`,this._treeContainer,new oy,[this._instantiationService.createInstance(uy),this._instantiationService.createInstance(fy)],this._instantiationService.createInstance(ay),r),this._splitView.addView({onDidChange:Du.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:e=>{this._preview.layout({height:this._dim.height,width:e})}},e.Distribute),this._splitView.addView({onDidChange:Du.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:e=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${e}px`,this._tree.layout(this._dim.height,e)}},e.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));let i=(e,t)=>{e instanceof Qv&&(t===`show`&&this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:t,source:`tree`}))};this._disposables.add(this._tree.onDidOpen(e=>{e.sideBySide?i(e.element,`side`):e.editorOptions.pinned?i(e.element,`goto`):i(e.element,`show`)})),Vu(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new zi(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=V(1128,`No results`),Bs(this._messageContainer),Promise.resolve(void 0)):(Vu(this._messageContainer),this._decorationsManager=new gy(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=>{let{event:t,target:n}=e;if(t.detail!==2)return;let r=this._getFocusedReference();r&&this._onDidSelectReference.fire({element:{uri:r.uri,range:n.range},kind:t.ctrlKey||t.metaKey||t.altKey?`side`:`open`,source:`editor`})})),this.container.classList.add(`results-loaded`),Bs(this._treeContainer),Bs(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(){let[e]=this._tree.getFocus();if(e instanceof Qv)return e;if(e instanceof ey&&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===Ks.inMemory?this.setTitle(V(1129,`References`)):this.setTitle(Sl(e.uri),this._uriLabel.getUriLabel(qa(e.uri)));let n=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));let r=await n;if(!this._model){r.dispose();return}h(this._previewModelReference);let i=r.object;if(i){let t=this._preview.getModel()===i.textEditorModel?0:1,n=T.lift(e.range).collapseToStart();this._previewModelReference=r,this._preview.setModel(i.textEditorModel),this._preview.setSelection(n),this._preview.revealRangeInCenter(n,t)}else this._preview.setModel(this._previewNotAvailableMessage),r.dispose()}};by=my([hy(3,Ll),hy(4,gi),hy(5,w),hy(6,Vv),hy(7,mi),hy(8,jr)],by);var xy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Sy=function(e,t){return function(n,r){t(n,r,e)}},Cy,wy=new A(`referenceSearchVisible`,!1,V(1121,`Whether reference peek is visible, like 'Peek References' or 'Peek Definition'`)),Ty=class{static{Cy=this}static{this.ID=`editor.contrib.referencesController`}static get(e){return e.getContribution(Cy.ID)}constructor(e,t,n,r,i,a,o,s){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=r,this._notificationService=i,this._instantiationService=a,this._storageService=o,this._configurationService=s,this._disposables=new S,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=wy.bindTo(n)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,n){let r;if(this._widget&&(r=this._widget.position),this.closeWidget(),r&&e.containsPosition(r))return;this._peekMode=n,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));let i=`peekViewLayout`,a=_y.fromJSON(this._storageService.get(i,0,`{}`));this._widget=this._instantiationService.createInstance(by,this._editor,this._defaultTreeKeyboardSupport,a),this._widget.setTitle(V(1122,`Loading...`)),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(i,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(e=>{let{element:t,kind:r}=e;if(t)switch(r){case`open`:(e.source!==`editor`||!this._configurationService.getValue(`editor.stablePeek`))&&this.openReference(t,!1,!1);break;case`side`:this.openReference(t,!0,!1);break;case`goto`:n?this._gotoReference(t,!0):this.openReference(t,!1,!0);break}}));let o=++this._requestIdPool;t.then(t=>{if(o!==this._requestIdPool||!this._widget){t.dispose();return}return this._model?.dispose(),this._model=t,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(``):this._widget.setMetaTitle(V(1123,`{0} ({1})`,this._model.title,this._model.references.length));let t=this._editor.getModel().uri,n=new M(e.startLineNumber,e.startColumn),r=this._model.nearestReference(t,n);if(r)return this._widget.setSelection(r).then(()=>{this._widget&&this._editor.getOption(99)===`editor`&&this._widget.focusOnPreviewEditor()})}})},e=>{this._notificationService.error(e)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;let t=this._widget.position;if(!t)return;let n=this._model.nearestReference(this._editor.getModel().uri,t);if(!n)return;let r=this._model.nextOrPreviousReference(n,e),i=this._editor.hasTextFocus(),a=this._widget.isPreviewEditorFocused();await this._widget.setSelection(r),await this._gotoReference(r,!1),i?this._editor.focus():this._widget&&a&&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;let n=T.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:n,selectionSource:`code.jump`,pinned:t}},this._editor).then(e=>{if(this._ignoreModelChangeEvent=!1,!e||!this._widget){this.closeWidget();return}if(this._editor===e)this._widget.show(n),this._widget.focusOnReferenceTree();else{let t=Cy.get(e),r=this._model.clone();this.closeWidget(),e.focus(),t?.toggleWidget(n,ql(e=>Promise.resolve(r)),this._peekMode??!1)}},e=>{this._ignoreModelChangeEvent=!1,Hc(e)})}openReference(e,t,n){t||this.closeWidget();let{uri:r,range:i}=e;this._editorService.openCodeEditor({resource:r,options:{selection:i,selectionSource:`code.jump`,pinned:n}},this._editor,t)}};Ty=Cy=xy([Sy(2,G),Sy(3,Di),Sy(4,di),Sy(5,w),Sy(6,Gc),Sy(7,xa)],Ty);function Ey(e,t){let n=jv(e);if(!n)return;let r=Ty.get(n);r&&t(r)}ke.registerCommandAndKeybindingRule({id:`togglePeekWidgetFocus`,weight:100,primary:ln(2089,60),when:m.or(wy,Hv.inPeekEditor),handler(e){Ey(e,e=>{e.changeFocusBetweenPreviewAndReferences()})}}),ke.registerCommandAndKeybindingRule({id:`goToNextReference`,weight:90,primary:62,secondary:[70],when:m.or(wy,Hv.inPeekEditor),handler(e){Ey(e,e=>{e.goToNextOrPreviousReference(!0)})}}),ke.registerCommandAndKeybindingRule({id:`goToPreviousReference`,weight:90,primary:1086,secondary:[1094],when:m.or(wy,Hv.inPeekEditor),handler(e){Ey(e,e=>{e.goToNextOrPreviousReference(!1)})}}),jn.registerCommandAlias(`goToNextReferenceFromEmbeddedEditor`,`goToNextReference`),jn.registerCommandAlias(`goToPreviousReferenceFromEmbeddedEditor`,`goToPreviousReference`),jn.registerCommandAlias(`closeReferenceSearchEditor`,`closeReferenceSearch`),jn.registerCommand(`closeReferenceSearch`,e=>Ey(e,e=>e.closeWidget())),ke.registerKeybindingRule({id:`closeReferenceSearch`,weight:-1,primary:9,secondary:[1033],when:m.and(Hv.inPeekEditor,m.not(`config.editor.stablePeek`))}),ke.registerKeybindingRule({id:`closeReferenceSearch`,weight:250,primary:9,secondary:[1033],when:m.and(wy,m.not(`config.editor.stablePeek`),m.or(z.editorTextFocus,Li.negate()))}),ke.registerCommandAndKeybindingRule({id:`revealReference`,weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:m.and(wy,Zc,Rt.negate(),Ji.negate()),handler(e){let t=e.get(ot).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Qv&&Ey(e,e=>e.revealReference(t[0]))}}),ke.registerCommandAndKeybindingRule({id:`openReferenceToSide`,weight:100,primary:2051,mac:{primary:259},when:m.and(wy,Zc,Rt.negate(),Ji.negate()),handler(e){let t=e.get(ot).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Qv&&Ey(e,e=>e.openReference(t[0],!0,!0))}}),jn.registerCommand(`openReference`,e=>{let t=e.get(ot).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Qv&&Ey(e,e=>e.openReference(t[0],!1,!0))});var Dy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Oy=function(e,t){return function(n,r){t(n,r,e)}},ky=new A(`hasSymbols`,!1,V(1138,`Whether there are symbol locations that can be navigated via keyboard-only.`)),Ay=Xt(`ISymbolNavigationService`),jy=class{constructor(e,t,n,r){this._editorService=t,this._notificationService=n,this._keybindingService=r,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=ky.bindTo(e)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(e){let 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();let n=new My(this._editorService),r=n.onDidChange(e=>{if(this._ignoreEditorChange)return;let n=this._editorService.getActiveCodeEditor();if(!n)return;let r=n.getModel(),i=n.getPosition();if(!r||!i)return;let a=!1,o=!1;for(let e of t.references)if(ao(e.uri,r.uri))a=!0,o||=T.containsPosition(e.range,i);else if(a)break;(!a||!o)&&this.reset()});this._currentState=Rs(n,r)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;let t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:T.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();let e=this._keybindingService.lookupKeybinding(`editor.gotoNextSymbolFromResult`),t=e?V(1139,`Symbol {0} of {1}, {2} for next`,this._currentIdx+1,this._currentModel.references.length,e.getLabel()):V(1140,`Symbol {0} of {1}`,this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};jy=Dy([Oy(0,G),Oy(1,Di),Oy(2,di),Oy(3,jr)],jy),us(Ay,jy,1),R(new class extends mt{constructor(){super({id:`editor.gotoNextSymbolFromResult`,precondition:ky,kbOpts:{weight:100,primary:70}})}runEditorCommand(e,t){return e.get(Ay).revealNext(t)}}),ke.registerCommandAndKeybindingRule({id:`editor.gotoNextSymbolFromResult.cancel`,weight:100,when:ky,primary:9,handler(e){e.get(Ay).reset()}});var My=class{constructor(e){this._listener=new Map,this._disposables=new S,this._onDidChange=new U,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(),h(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,Rs(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)}};My=Dy([Oy(0,Di)],My);function Ny(e,t){return t.uri.scheme===e.uri.scheme?!0:!Ps(t.uri,Ks.walkThroughSnippet,Ks.vscodeChatCodeBlock,Ks.vscodeChatCodeCompareBlock)}async function Py(e,t,n,r,i){let a=n.ordered(e,r).map(n=>Promise.resolve(i(n,e,t)).then(void 0,e=>{cc(e)}));return gc((await Promise.all(a)).flat()).filter(t=>Ny(e,t))}function Fy(e,t,n,r,i){return Py(t,n,e,r,(e,t,n)=>e.provideDefinition(t,n,i))}function Iy(e,t,n,r,i){return Py(t,n,e,r,(e,t,n)=>e.provideDeclaration(t,n,i))}function Ly(e,t,n,r,i){return Py(t,n,e,r,(e,t,n)=>e.provideImplementation(t,n,i))}function Ry(e,t,n,r,i){return Py(t,n,e,r,(e,t,n)=>e.provideTypeDefinition(t,n,i))}function zy(e,t,n,r,i,a){return Py(t,n,e,i,async(e,t,n)=>{let i=(await e.provideReferences(t,n,{includeDeclaration:!0},a))?.filter(e=>Ny(t,e));if(!r||!i||i.length!==2)return i;let o=(await e.provideReferences(t,n,{includeDeclaration:!1},a))?.filter(e=>Ny(t,e));return o&&o.length===1?o:i})}async function By(e){let t=new ty(await e(),``),n=t.references.map(e=>e.link);return t.dispose(),n}br(`_executeDefinitionProvider`,(e,t,n)=>{let r=Fy(e.get(q).definitionProvider,t,n,!1,B.None);return By(()=>r)}),br(`_executeDefinitionProvider_recursive`,(e,t,n)=>{let r=Fy(e.get(q).definitionProvider,t,n,!0,B.None);return By(()=>r)}),br(`_executeTypeDefinitionProvider`,(e,t,n)=>{let r=Ry(e.get(q).typeDefinitionProvider,t,n,!1,B.None);return By(()=>r)}),br(`_executeTypeDefinitionProvider_recursive`,(e,t,n)=>{let r=Ry(e.get(q).typeDefinitionProvider,t,n,!0,B.None);return By(()=>r)}),br(`_executeDeclarationProvider`,(e,t,n)=>{let r=Iy(e.get(q).declarationProvider,t,n,!1,B.None);return By(()=>r)}),br(`_executeDeclarationProvider_recursive`,(e,t,n)=>{let r=Iy(e.get(q).declarationProvider,t,n,!0,B.None);return By(()=>r)}),br(`_executeReferenceProvider`,(e,t,n)=>{let r=zy(e.get(q).referenceProvider,t,n,!1,!1,B.None);return By(()=>r)}),br(`_executeReferenceProvider_recursive`,(e,t,n)=>{let r=zy(e.get(q).referenceProvider,t,n,!1,!0,B.None);return By(()=>r)}),br(`_executeImplementationProvider`,(e,t,n)=>{let r=Ly(e.get(q).implementationProvider,t,n,!1,B.None);return By(()=>r)}),br(`_executeImplementationProvider_recursive`,(e,t,n)=>{let r=Ly(e.get(q).implementationProvider,t,n,!0,B.None);return By(()=>r)}),_e.appendMenuItem(Z.EditorContext,{submenu:Z.EditorContextPeek,title:V(1081,`Peek`),group:`navigation`,order:100});var Vy=class e{static is(t){return!t||typeof t!=`object`?!1:!!(t instanceof e||M.isIPosition(t.position)&&t.model)}constructor(e,t){this.model=e,this.position=t}},Hy=class e extends Pi{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return e._allSymbolNavigationCommands.values()}static _patchConfig(e){let t={...e,f1:!0};if(t.menu)for(let n of Mn.wrap(t.menu))(n.id===Z.EditorContext||n.id===Z.EditorContextPeek)&&(n.when=m.and(e.precondition,n.when));return t}constructor(t,n){super(e._patchConfig(n)),this.configuration=t,e._allSymbolNavigationCommands.set(n.id,this)}runEditorCommand(t,n,r,i){if(!n.hasModel())return Promise.resolve(void 0);let a=t.get(di),o=t.get(Di),s=t.get(Fc),c=t.get(Ay),l=t.get(q),u=t.get(w),d=n.getModel(),f=n.getPosition(),p=Vy.is(r)?r:new Vy(d,f),m=new pe(n,5),h=Vc(this._getLocationModel(l,p.model,p.position,m.token),m.token).then(async t=>{if(!t||m.token.isCancellationRequested)return;$c(t.ariaMessage);let a;if(t.referenceAt(d.uri,f)){let t=this._getAlternativeCommand(n);t!==void 0&&!e._activeAlternativeCommands.has(t)&&e._allSymbolNavigationCommands.has(t)&&(a=e._allSymbolNavigationCommands.get(t))}let s=t.references.length;if(s===0){if(!this.configuration.muteMessage){let e=d.getWordAtPosition(f);Jd.get(n)?.showMessage(this._getNoResultFoundMessage(e),f)}}else if(s===1&&a)e._activeAlternativeCommands.add(this.desc.id),u.invokeFunction(t=>a.runEditorCommand(t,n,r,i).finally(()=>{e._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(o,c,n,t,i)},e=>{a.error(e)}).finally(()=>{m.dispose()});return s.showWhile(h,250),h}async _onResult(e,t,n,r,i){let a=this._getGoToPreference(n);if(!(n instanceof Av)&&(this.configuration.openInPeek||a===`peek`&&r.references.length>1))this._openInPeek(n,r,i);else{let o=r.firstReference(),s=r.references.length>1&&a===`gotoAndPeek`,c=await this._openReference(n,e,o,this.configuration.openToSide,!s);s&&c?this._openInPeek(c,r,i):r.dispose(),a===`goto`&&t.put(o)}}async _openReference(e,t,n,r,i){let a;if(en(n)&&(a=n.targetSelectionRange),a||=n.range,!a)return;let o=await t.openCodeEditor({resource:n.uri,options:{selection:T.collapseToStart(a),selectionRevealType:3,selectionSource:`code.jump`}},e,r);if(o){if(i){let e=o.getModel(),t=o.createDecorationsCollection([{range:a,options:{description:`symbol-navigate-action-highlight`,className:`symbolHighlight`}}]);setTimeout(()=>{o.getModel()===e&&t.clear()},350)}return o}}_openInPeek(e,t,n){let r=Ty.get(e);r&&e.hasModel()?r.toggleWidget(n??e.getSelection(),ql(e=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}},Uy=class extends Hy{async _getLocationModel(e,t,n,r){return new ty(await Fy(e.definitionProvider,t,n,!1,r),V(1082,`Definitions`))}_getNoResultFoundMessage(e){return e&&e.word?V(1083,`No definition found for '{0}'`,e.word):V(1084,`No definition found`)}_getAlternativeCommand(e){return e.getOption(67).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(67).multipleDefinitions}};x(class e extends Uy{static{this.id=`editor.action.revealDefinition`}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.id,title:{...J(1108,`Go to Definition`),mnemonicTitle:V(1085,`Go to &&Definition`)},precondition:z.hasDefinitionProvider,keybinding:[{when:z.editorTextFocus,primary:70,weight:100},{when:m.and(z.editorTextFocus,ra),primary:2118,weight:100}],menu:[{id:Z.EditorContext,group:`navigation`,order:1.1},{id:Z.MenubarGoMenu,precondition:null,group:`4_symbol_nav`,order:2}]}),jn.registerCommandAlias(`editor.action.goToDeclaration`,e.id)}}),x(class e extends Uy{static{this.id=`editor.action.revealDefinitionAside`}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:e.id,title:J(1109,`Open Definition to the Side`),precondition:m.and(z.hasDefinitionProvider,z.isInEmbeddedEditor.toNegated()),keybinding:[{when:z.editorTextFocus,primary:ln(2089,70),weight:100},{when:m.and(z.editorTextFocus,ra),primary:ln(2089,2118),weight:100}]}),jn.registerCommandAlias(`editor.action.openDeclarationToTheSide`,e.id)}}),x(class e extends Uy{static{this.id=`editor.action.peekDefinition`}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.id,title:J(1110,`Peek Definition`),precondition:m.and(z.hasDefinitionProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),keybinding:{when:z.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:Z.EditorContextPeek,group:`peek`,order:2}}),jn.registerCommandAlias(`editor.action.previewDeclaration`,e.id)}});var Wy=class extends Hy{async _getLocationModel(e,t,n,r){return new ty(await Iy(e.declarationProvider,t,n,!1,r),V(1086,`Declarations`))}_getNoResultFoundMessage(e){return e&&e.word?V(1087,`No declaration found for '{0}'`,e.word):V(1088,`No declaration found`)}_getAlternativeCommand(e){return e.getOption(67).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(67).multipleDeclarations}};x(class e extends Wy{static{this.id=`editor.action.revealDeclaration`}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.id,title:{...J(1111,`Go to Declaration`),mnemonicTitle:V(1089,`Go to &&Declaration`)},precondition:m.and(z.hasDeclarationProvider,z.isInEmbeddedEditor.toNegated()),menu:[{id:Z.EditorContext,group:`navigation`,order:1.3},{id:Z.MenubarGoMenu,precondition:null,group:`4_symbol_nav`,order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?V(1090,`No declaration found for '{0}'`,e.word):V(1091,`No declaration found`)}}),x(class extends Wy{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:`editor.action.peekDeclaration`,title:J(1112,`Peek Declaration`),precondition:m.and(z.hasDeclarationProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),menu:{id:Z.EditorContextPeek,group:`peek`,order:3}})}});var Gy=class extends Hy{async _getLocationModel(e,t,n,r){return new ty(await Ry(e.typeDefinitionProvider,t,n,!1,r),V(1092,`Type Definitions`))}_getNoResultFoundMessage(e){return e&&e.word?V(1093,`No type definition found for '{0}'`,e.word):V(1094,`No type definition found`)}_getAlternativeCommand(e){return e.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(67).multipleTypeDefinitions}};x(class e extends Gy{static{this.ID=`editor.action.goToTypeDefinition`}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.ID,title:{...J(1113,`Go to Type Definition`),mnemonicTitle:V(1095,`Go to &&Type Definition`)},precondition:z.hasTypeDefinitionProvider,keybinding:{when:z.editorTextFocus,primary:0,weight:100},menu:[{id:Z.EditorContext,group:`navigation`,order:1.4},{id:Z.MenubarGoMenu,precondition:null,group:`4_symbol_nav`,order:3}]})}}),x(class e extends Gy{static{this.ID=`editor.action.peekTypeDefinition`}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.ID,title:J(1114,`Peek Type Definition`),precondition:m.and(z.hasTypeDefinitionProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),menu:{id:Z.EditorContextPeek,group:`peek`,order:4}})}});var Ky=class extends Hy{async _getLocationModel(e,t,n,r){return new ty(await Ly(e.implementationProvider,t,n,!1,r),V(1096,`Implementations`))}_getNoResultFoundMessage(e){return e&&e.word?V(1097,`No implementation found for '{0}'`,e.word):V(1098,`No implementation found`)}_getAlternativeCommand(e){return e.getOption(67).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(67).multipleImplementations}};x(class e extends Ky{static{this.ID=`editor.action.goToImplementation`}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:e.ID,title:{...J(1115,`Go to Implementations`),mnemonicTitle:V(1099,`Go to &&Implementations`)},precondition:z.hasImplementationProvider,keybinding:{when:z.editorTextFocus,primary:2118,weight:100},menu:[{id:Z.EditorContext,group:`navigation`,order:1.45},{id:Z.MenubarGoMenu,precondition:null,group:`4_symbol_nav`,order:4}]})}}),x(class e extends Ky{static{this.ID=`editor.action.peekImplementation`}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:e.ID,title:J(1116,`Peek Implementations`),precondition:m.and(z.hasImplementationProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),keybinding:{when:z.editorTextFocus,primary:3142,weight:100},menu:{id:Z.EditorContextPeek,group:`peek`,order:5}})}});var qy=class extends Hy{_getNoResultFoundMessage(e){return e?V(1100,`No references found for '{0}'`,e.word):V(1101,`No references found`)}_getAlternativeCommand(e){return e.getOption(67).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(67).multipleReferences}};x(class extends qy{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:`editor.action.goToReferences`,title:{...J(1117,`Go to References`),mnemonicTitle:V(1102,`Go to &&References`)},precondition:m.and(z.hasReferenceProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),keybinding:{when:z.editorTextFocus,primary:1094,weight:100},menu:[{id:Z.EditorContext,group:`navigation`,order:1.45},{id:Z.MenubarGoMenu,precondition:null,group:`4_symbol_nav`,order:5}]})}async _getLocationModel(e,t,n,r){return new ty(await zy(e.referenceProvider,t,n,!0,!1,r),V(1103,`References`))}}),x(class extends qy{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:`editor.action.referenceSearch.trigger`,title:J(1118,`Peek References`),precondition:m.and(z.hasReferenceProvider,Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated()),menu:{id:Z.EditorContextPeek,group:`peek`,order:6}})}async _getLocationModel(e,t,n,r){return new ty(await zy(e.referenceProvider,t,n,!1,!1,r),V(1104,`References`))}});var Jy=class extends Hy{constructor(e,t,n){super(e,{id:`editor.action.goToLocation`,title:J(1119,`Go to Any Symbol`),precondition:m.and(Hv.notInPeekEditor,z.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=n}async _getLocationModel(e,t,n,r){return new ty(this._references,V(1105,`Locations`))}_getNoResultFoundMessage(e){return e&&V(1106,`No results for '{0}'`,e.word)||``}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}};jn.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:On},{name:`position`,description:`The position at which to start`,constraint:M.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(e,t,n,r,i,a,o)=>{Bi(On.isUri(t)),Bi(M.isIPosition(n)),Bi(Array.isArray(r)),Bi(i===void 0||typeof i==`string`),Bi(o===void 0||typeof o==`boolean`);let s=e.get(Di),c=await s.openCodeEditor({resource:t},s.getFocusedCodeEditor());if(Tc(c))return c.setPosition(n),c.revealPositionInCenterIfOutsideViewport(n,0),c.invokeWithinContext(e=>{let t=new class extends Jy{_getNoResultFoundMessage(e){return a||super._getNoResultFoundMessage(e)}}({muteMessage:!a,openInPeek:!!o,openToSide:!1},r,i);e.get(w).invokeFunction(t.run.bind(t),c)})}}),jn.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:On},{name:`position`,description:`The position at which to start`,constraint:M.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(e,t,n,r,i)=>{e.get(tr).executeCommand(`editor.action.goToLocations`,t,n,r,i,void 0,!0)}}),jn.registerCommand({id:`editor.action.findReferences`,handler:(e,t,n)=>{Bi(On.isUri(t)),Bi(M.isIPosition(n));let r=e.get(q),i=e.get(Di);return i.openCodeEditor({resource:t},i.getFocusedCodeEditor()).then(e=>{if(!Tc(e)||!e.hasModel())return;let t=Ty.get(e);if(!t)return;let i=ql(t=>zy(r.referenceProvider,e.getModel(),M.lift(n),!1,!1,t).then(e=>new ty(e,V(1107,`References`)))),a=new T(n.lineNumber,n.column,n.lineNumber,n.column);return Promise.resolve(t.toggleWidget(a,i,!1))})}}),jn.registerCommandAlias(`editor.action.showReferences`,`editor.action.peekLocations`);async function Yy(e,t,n,r){let i=e.get(gi),a=e.get(Au),o=e.get(tr),s=e.get(w),c=e.get(di);if(await r.item.resolve(B.None),!r.part.location)return;let l=r.part.location,u=[],d=new Set(_e.getMenuItems(Z.EditorContext).map(e=>Yr(e)?e.command.id:as()));for(let e of Hy.all())d.has(e.desc.id)&&u.push(new cn(e.desc.id,Lr.label(e.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let n=await i.createModelReference(l.uri);try{let i=new Vy(n.object.textEditorModel,T.getStartPosition(l.range)),a=r.item.anchor.range;await s.invokeFunction(e.runEditorCommand.bind(e),t,i,a)}finally{n.dispose()}}));if(r.part.command){let{command:e}=r.part;u.push(new Tr),u.push(new cn(e.id,e.title,void 0,!0,async()=>{try{await o.executeCommand(e.id,...e.arguments??[])}catch(e){c.notify({severity:Ni.Error,source:r.item.provider.displayName,message:e})}}))}let f=t.getOption(144);a.showContextMenu({domForShadowRoot:f?t.getDomNode()??void 0:void 0,getAnchor:()=>{let e=Po(n);return{x:e.left,y:e.top+e.height+8}},getActions:()=>u,onHide:()=>{t.focus()},autoSelectFirstItem:!0})}async function Xy(e,t,n,r){let i=await e.get(gi).createModelReference(r.uri);await n.invokeWithinContext(async e=>{let a=t.hasSideBySideModifier,o=e.get(G),s=Hv.inPeekEditor.getValue(o);return new Uy({openToSide:a,openInPeek:!a&&n.getOption(101)&&!s,muteMessage:!0},{title:{value:``,original:``},id:``,precondition:void 0}).run(e,new Vy(i.object.textEditorModel,T.getStartPosition(r.range)),T.lift(r.range))}),i.dispose()}var Zy=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qy=function(e,t){return function(n,r){t(n,r,e)}},$y,eb=class e{constructor(){this._entries=new Uo(50)}get(t){let n=e._key(t);return this._entries.get(n)}set(t,n){let r=e._key(t);this._entries.set(r,n)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}},tb=Xt(`IInlayHintsCache`);us(tb,eb,1);var nb=class{constructor(e,t){this.item=e,this.index=t}get part(){let e=this.item.hint.label;return typeof e==`string`?{label:e}:e[this.index]}},rb=class{constructor(e,t){this.part=e,this.hasTriggerModifier=t}},ib=class{constructor(){this._store=new Ae,this._tokenSource=new ou}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new ou,this._store.value=new S,{store:this._store.value,token:this._tokenSource.token}}},ab=class{static{$y=this}static{this.ID=`editor.contrib.InlayHints`}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(e){return e.getContribution($y.ID)??void 0}constructor(e,t,n,r,i,a,o){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=r,this._commandService=i,this._notificationService=a,this._instaService=o,this._disposables=new S,this._sessionDisposables=new S,this._decorationsMetadata=new Map,this._activeRenderMode=0,this._ruleFactory=this._disposables.add(new zs(this._editor)),this._debounceInfo=n.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(e=>{e.hasChanged(159)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();let e=this._editor.getOption(159);if(e.enabled===`off`)return;let t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled===`on`)this._activeRenderMode=0;else{let t,r;e.enabled===`onUnlessPressed`?(t=0,r=1):(t=1,r=0),this._activeRenderMode=t,this._sessionDisposables.add(n.getInstance().event(e=>{if(!this._editor.hasModel())return;let n=e.altKey&&e.ctrlKey&&!(e.shiftKey||e.metaKey)?r:t;if(n!==this._activeRenderMode){this._activeRenderMode=n;let e=this._editor.getModel(),t=this._copyInlayHintsWithCurrentAnchor(e);this._updateHintsDecorators([e.getFullModelRange()],t),o.schedule(0)}}))}let r=this._inlayHintsCache.get(t);r&&this._updateHintsDecorators([t.getFullModelRange()],r),this._sessionDisposables.add(bn(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let i=new Set;this._sessionDisposables.add(t.onWillDispose(()=>void 0));let a=this._sessionDisposables.add(new ib),o=new Cl(async()=>{let e=Date.now(),{store:n,token:r}=a.reset();try{let a=await Ev.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),r);if(o.delay=this._debounceInfo.update(t,Date.now()-e),r.isCancellationRequested){a.dispose();return}for(let e of a.provider)typeof e.onDidChangeInlayHints==`function`&&!i.has(e)&&(i.add(e),n.add(e.onDidChangeInlayHints(()=>{o.isScheduled()||o.schedule()})));n.add(a),n.add(bn(()=>i.clear())),this._updateHintsDecorators(a.ranges,a.items),this._cacheHintsForFastRestore(t)}catch(e){Hc(e)}},this._debounceInfo.get(t));this._sessionDisposables.add(o),o.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(e=>{(e.scrollTopChanged||!o.isScheduled())&&o.schedule()}));let s=this._sessionDisposables.add(new Ae);this._sessionDisposables.add(this._editor.onDidChangeModelContent(e=>{let t=Math.max(o.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+t},s.value=oo(()=>o.schedule(0),t),o.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(159)&&o.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>o.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){let e=new S,t=e.add(new Cv(this._editor)),n=new S;return e.add(n),e.add(t.onMouseMoveOrRelevantKeyDown(e=>{let[t]=e,r=this._getInlayHintLabelPart(t),i=this._editor.getModel();if(!r||!i){n.clear();return}let a=new ou;n.add(bn(()=>a.dispose(!0))),r.item.resolve(a.token),this._activeInlayHintPart=r.part.command||r.part.location?new rb(r,t.hasTriggerModifier):void 0;let o=i.validatePosition(r.item.hint.position).lineNumber,s=new T(o,1,o,i.getLineMaxColumn(o)),c=this._getInlineHintsForRange(s);this._updateHintsDecorators([s],c),n.add(bn(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([s],c)}))})),e.add(t.onCancel(()=>n.clear())),e.add(t.onExecute(async e=>{let t=this._getInlayHintLabelPart(e);if(t){let n=t.part;n.location?this._instaService.invokeFunction(Xy,e,this._editor,n.location):Jn.is(n.command)&&await this._invokeCommand(n.command,t.item)}})),e}_getInlineHintsForRange(e){let t=new Set;for(let n of this._decorationsMetadata.values())e.containsRange(n.item.anchor.range)&&t.add(n.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;let n=this._getInlayHintLabelPart(t);if(n&&(t.event.preventDefault(),await n.item.resolve(B.None),Fu(n.item.hint.textEdits))){let t=n.item.hint.textEdits.map(e=>Ss.replace(T.lift(e.range),e.text));this._editor.executeEdits(`inlayHint.default`,t),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!Br(e.event.target))return;let t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(Yy,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){if(e.target.type!==6)return;let t=e.target.detail.injectedText?.options;if(t instanceof ba&&t?.attachedData instanceof nb)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(e){this._notificationService.notify({severity:Ni.Error,source:t.provider.displayName,message:e})}}_cacheHintsForFastRestore(e){let t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){let t=new Map;for(let[n,r]of this._decorationsMetadata){if(t.has(r.item))continue;let i=e.getDecorationRange(n);if(i){let e=new wv(i,r.item.anchor.direction),n=r.item.with({anchor:e});t.set(r.item,n)}}return Array.from(t.values())}_getHintsRanges(){let e=this._editor.getModel(),t=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(let r of t.sort(T.compareRangesUsingStarts)){let t=e.validateRange(new T(r.startLineNumber-30,r.startColumn,r.endLineNumber+30,r.endColumn));n.length===0||!T.areIntersectingOrTouching(n[n.length-1],t)?n.push(t):n[n.length-1]=T.plusRange(n[n.length-1],t)}return n}_updateHintsDecorators(e,t){let n=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&e.some(e=>e.containsPosition(this._cursorInfo.position))){let{position:e}=this._cursorInfo;this._cursorInfo=void 0;let r=new Map;for(let t of this._editor.getLineDecorations(e.lineNumber)??[]){let n=this._decorationsMetadata.get(t.id);if(t.range.startColumn>e.column)continue;let i=n?.decoration.options[n.item.anchor.direction];if(i&&i.attachedData!==$y._whitespaceData){let e=r.get(n.item)??0;r.set(n.item,e+i.content.length)}}let i=t.filter(t=>t.anchor.range.startLineNumber===e.lineNumber&&t.anchor.range.endColumn<=e.column),a=Array.from(r.values()),o;for(;;){let e=i.shift(),t=a.shift();if(!t&&!e)break;if(e)n.set(e,t??0),o=e;else if(o&&t){let e=n.get(o);e+=t,e+=a.reduce((e,t)=>e+t,0),a.length=0;break}}}let r=[],i=(e,t,n,i,a)=>{let o={content:n,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:t.className,cursorStops:i,attachedData:a};r.push({item:e,classNameRef:t,decoration:{range:e.anchor.range,options:{description:`InlayHint`,showIfCollapsed:e.anchor.range.isEmpty(),collapseOnReplaceEdit:!e.anchor.range.isEmpty(),stickiness:0,[e.anchor.direction]:this._activeRenderMode===0?o:void 0}}})},a=(e,t)=>{i(e,this._ruleFactory.createClassNameRef({width:`${o/3|0}px`,display:`inline-block`}),` `,t?we.Right:we.None,$y._whitespaceData)},{fontSize:o,fontFamily:s,padding:c,isUniform:l}=this._getLayoutInfo(),u=this._editor.getOption(159).maximumLength,d=`--code-editorInlayHintsFontFamily`;this._editor.getContainerDomNode().style.setProperty(d,s);let f={line:0,totalLen:0};for(let e=0;e<t.length;e++){let s=t[e];if(f.line!==s.anchor.range.startLineNumber&&(f={line:s.anchor.range.startLineNumber,totalLen:0}),u&&f.totalLen>u)continue;s.hint.paddingLeft&&a(s,!1);let p=typeof s.hint.label==`string`?[{label:s.hint.label}]:s.hint.label,m=n.get(s),h=0;for(let e=0;e<p.length;e++){let t=p[e],n=e===0,r=e===p.length-1,a={fontSize:`${o}px`,fontFamily:`var(${d}), ${Ri.fontFamily}`,verticalAlign:l?`baseline`:`middle`,unicodeBidi:`isolate`};Fu(s.hint.textEdits)&&(a.cursor=`default`),this._fillInColors(a,s.hint),(t.command||t.location)&&this._activeInlayHintPart?.part.item===s&&this._activeInlayHintPart.part.index===e&&(a.textDecoration=`underline`,this._activeInlayHintPart.hasTriggerModifier&&(a.color=pl(Vi),a.cursor=`pointer`));let g=t.label;f.totalLen+=g.length;let _=!1,v=u===0?0:f.totalLen-u;if(v>0&&(g=g.slice(0,-v)+`…`,_=!0),h+=g.length,m!==void 0){let e=h-m;e>=0&&(h-=e,g=g.slice(0,-(1+e))+`…`,_=!0)}if(c&&(n&&(r||_)?(a.padding=`1px ${Math.max(1,o/4)|0}px`,a.borderRadius=`${o/4|0}px`):n?(a.padding=`1px 0 1px ${Math.max(1,o/4)|0}px`,a.borderRadius=`${o/4|0}px 0 0 ${o/4|0}px`):r||_?(a.padding=`1px ${Math.max(1,o/4)|0}px 1px 0`,a.borderRadius=`0 ${o/4|0}px ${o/4|0}px 0`):a.padding=`1px 0 1px 0`),i(s,this._ruleFactory.createClassNameRef(a),ob(g),r&&!s.hint.paddingRight?we.Right:we.None,new nb(s,e)),_)break}if(m!==void 0&&h<m){let e=m-h;i(s,this._ruleFactory.createClassNameRef({}),` `.repeat(e),we.None)}if(s.hint.paddingRight&&a(s,!0),r.length>$y._MAX_DECORATORS)break}let p=[];for(let[t,n]of this._decorationsMetadata){let r=this._editor.getModel()?.getDecorationRange(t);r&&e.some(e=>e.containsRange(r))&&(p.push(t),n.classNameRef.dispose(),this._decorationsMetadata.delete(t))}let m=ja.capture(this._editor);this._editor.changeDecorations(e=>{let t=e.deltaDecorations(p,r.map(e=>e.decoration));for(let e=0;e<t.length;e++){let n=r[e];this._decorationsMetadata.set(t[e],n)}}),m.restore(this._editor)}_fillInColors(e,t){t.kind===or.Parameter?(e.backgroundColor=pl(zc),e.color=pl(ac)):t.kind===or.Type?(e.backgroundColor=pl(ts),e.color=pl(Ho)):(e.backgroundColor=pl(io),e.color=pl(ko))}_getLayoutInfo(){let e=this._editor.getOption(159),t=e.padding,n=this._editor.getOption(61),r=this._editor.getOption(58),i=e.fontSize;(!i||i<5||i>n)&&(i=n);let a=e.fontFamily||r;return{fontSize:i,fontFamily:a,padding:t,isUniform:!t&&a===r&&i===n}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(let e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}};ab=$y=Zy([Qy(1,q),Qy(2,Sa),Qy(3,tb),Qy(4,tr),Qy(5,di),Qy(6,w)],ab);function ob(e){return e.replace(/[ \t]/g,`\xA0`)}jn.registerCommand(`_executeInlayHintProvider`,async(e,...t)=>{let[n,r]=t;Bi(On.isUri(n)),Bi(T.isIRange(r));let{inlayHintsProvider:i}=e.get(q),a=await e.get(gi).createModelReference(n);try{let e=await Ev.create(i,a.object.textEditorModel,[T.lift(r)],B.None),t=e.items.map(e=>e.hint);return setTimeout(()=>e.dispose(),0),t}finally{a.dispose()}});var sb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},cb=function(e,t){return function(n,r){t(n,r,e)}},lb=class extends Vm{constructor(e,t,n,r){super(10,t,e.item.anchor.range,n,r,!0),this.part=e}},ub=class extends U_{constructor(e,t,n,r,i,a,o,s){super(e,t,i,o,n,r,s),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){if(!ab.get(this._editor)||e.target.type!==6)return null;let t=e.target.detail.injectedText?.options;return t instanceof ba&&t.attachedData instanceof nb?new lb(t.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,n,r){return e instanceof lb?new hs(async t=>{let{part:n}=e;if(await n.item.resolve(r),r.isCancellationRequested)return;let i;typeof n.item.hint.tooltip==`string`?i=new li().appendText(n.item.hint.tooltip):n.item.hint.tooltip&&(i=n.item.hint.tooltip),i&&t.emitOne(new V_(this,e.range,[i],!1,0)),Fu(n.item.hint.textEdits)&&t.emitOne(new V_(this,e.range,[new li().appendText(V(1205,`Double-click to insert`))],!1,10001));let a;if(typeof n.part.tooltip==`string`?a=new li().appendText(n.part.tooltip):n.part.tooltip&&(a=n.part.tooltip),a&&t.emitOne(new V_(this,e.range,[a],!1,1)),n.part.location||n.part.command){let r,i=this._editor.getOption(86)===`altKey`?oi?V(1206,`cmd + click`):V(1207,`ctrl + click`):oi?V(1208,`option + click`):V(1209,`alt + click`);n.part.location&&n.part.command?r=new li().appendText(V(1210,`Go to Definition ({0}), right click for more`,i)):n.part.location?r=new li().appendText(V(1211,`Go to Definition ({0})`,i)):n.part.command&&(r=new li(`[${V(1212,`Execute Command`)}](${Dv(n.part.command)} "${n.part.command.title}") (${i})`,{isTrusted:!0})),r&&t.emitOne(new V_(this,e.range,[r],!1,1e4))}let o=this._resolveInlayHintLabelPartHover(n,r);for await(let e of o)t.emitOne(e)}):hs.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;let{uri:n,range:r}=e.part.location,i=await this._resolverService.createModelReference(n);try{let n=i.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(n))return;for await(let i of N_(this._languageFeaturesService.hoverProvider,n,new M(r.startLineNumber,r.startColumn),t))dt(i.hover.contents)||(yield new V_(this,e.item.anchor.range,i.hover.contents,!1,2+i.ordinal))}finally{i.dispose()}}};ub=sb([cb(1,it),cb(2,jr),cb(3,fa),cb(4,xa),cb(5,gi),cb(6,q),cb(7,tr)],ub);var db=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},fb=function(e,t){return function(n,r){t(n,r,e)}},pb,mb,hb=pb=class extends j{constructor(e,t,n,r,i,a,o){super();let s=t.hoverParts;this._renderedHoverParts=this._register(new _b(e,n,s,r,i,a,o));let c=t.options,l=c.anchor,{showAtPosition:u,showAtSecondaryPosition:d}=pb.computeHoverPositions(e,l.range,s);this.shouldAppearBeforeContent=s.some(e=>e.isBeforeContent),this.showAtPosition=u,this.showAtSecondaryPosition=d,this.initialMousePosX=l.initialMousePosX,this.initialMousePosY=l.initialMousePosY,this.shouldFocus=c.shouldFocus,this.source=c.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,n){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,n)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,n){let r=1;if(e.hasModel()){let n=e._getViewModel(),i=n.coordinatesConverter,a=i.convertModelRangeToViewRange(t),o=n.getLineMinColumn(a.startLineNumber),s=new M(a.startLineNumber,o);r=i.convertViewPositionToModelPosition(s).column}let i=t.startLineNumber,a=t.startColumn,o;for(let e of n){let t=e.range,n=t.startLineNumber===i,s=t.endLineNumber===i;if(n&&s){let e=t.startColumn;a=Math.max(Math.min(a,e),r)}e.forceShowAtRange&&(o=t)}let s,c;if(o){let e=o.getStartPosition();s=e,c=e}else s=t.getStartPosition(),c=new M(i,a);return{showAtPosition:s,showAtSecondaryPosition:c}}};hb=pb=db([fb(4,jr),fb(5,fa),fb(6,xe)],hb);var gb=class{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}},_b=class extends j{static{mb=this}static{this._DECORATION_OPTIONS=Y.register({description:`content-hover-highlight`,className:`hoverHighlight`})}constructor(e,t,n,r,i,a,o){super(),this._hoverService=a,this._clipboardService=o,this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=r,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,n,r,i,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,n)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return j.None;let n=t[0].range;for(let e of t){let t=e.range;n=T.plusRange(n,t)}let r=e.createDecorationsCollection();return r.set([{range:n,options:mb._DECORATION_OPTIONS}]),bn(()=>{r.clear()})}_renderParts(e,t,n,r,i){let a=new lg(r,i),o={fragment:this._fragment,statusBar:a,...n},s=new S;s.add(a);for(let n of e){let e=this._renderHoverPartsForParticipant(t,n,o);s.add(e);for(let t of e.renderedHoverParts)this._renderedParts.push({type:`hoverPart`,participant:n,hoverPart:t.hoverPart,hoverElement:t.hoverElement})}let c=this._renderStatusBar(this._fragment,a);return c&&(s.add(c),this._renderedParts.push({type:`statusBar`,hoverElement:c.hoverElement,actions:c.actions})),s}_renderHoverPartsForParticipant(e,t,n){let r=e.filter(e=>e.owner===t);return r.length>0?t.renderHoverParts(n,r):new Hm([])}_renderStatusBar(e,t){if(t.hasContent)return new gb(e,t)}_registerListenersOnRenderedParts(){let e=new S;return this._renderedParts.forEach((t,n)=>{let r=t.hoverElement;r.tabIndex=0,e.add(K(r,pr.FOCUS_IN,e=>{e.stopPropagation(),this._focusedHoverPartIndex=n})),e.add(K(r,pr.FOCUS_OUT,e=>{e.stopPropagation(),this._focusedHoverPartIndex=-1})),t.type===`hoverPart`&&!t.participant.hideCopyButton&&e.add(new A_(r,()=>t.participant.getAccessibleContent(t.hoverPart),this._clipboardService,this._hoverService))}),e}_updateMarkdownAndColorParticipantInfo(e){let t=e.find(e=>e instanceof U_&&!(e instanceof ub));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(e=>e instanceof _v)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}async updateHoverVerbosityLevel(e,t,n){if(!this._markdownHoverParticipant)return;let r;r=t>=0?{start:t,endExclusive:t+1}:this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let t=r.start;t<r.endExclusive;t++){let n=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,t);if(n===void 0)continue;let r=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,n);r&&(this._renderedParts[t]={type:`hoverPart`,participant:this._markdownHoverParticipant,hoverPart:r.hoverPart,hoverElement:r.hoverElement})}n&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){let n=this._renderedParts[t];if(!n||n.type!==`hoverPart`||n.participant!==e)return;let r=this._renderedParts.findIndex(t=>t.type===`hoverPart`&&t.participant===e);if(r===-1)throw new Xs;return t-r}_findRangeOfMarkdownHoverParts(e){let t=this._renderedParts.slice(),n=t.findIndex(t=>t.type===`hoverPart`&&t.participant===e),r=t.reverse().findIndex(t=>t.type===`hoverPart`&&t.participant===e);return{start:n,endExclusive:(r>=0?t.length-r:r)+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};_b=mb=db([fb(4,jr),fb(5,fa),fb(6,xe)],_b);var vb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},yb=function(e,t){return function(n,r){t(n,r,e)}},bb=class extends j{constructor(e,t,n,r,i){super(),this._editor=e,this._instantiationService=t,this._keybindingService=n,this._hoverService=r,this._clipboardService=i,this._currentResult=null,this._renderedContentHover=this._register(new Ae),this._onContentsChanged=this._register(new U),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(tg,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new Gh(this._editor,new rg(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let e=[];for(let t of Um.getAll()){let n=this._instantiationService.createInstance(t,this._editor);e.push(n)}return e.sort((e,t)=>e.hoverOrdinal-t.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(e=>e.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(e=>{this._participants.forEach(t=>t.handleScroll?.(e))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(e=>e.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(e=>{let t=e.hasLoadingMessage?this._addLoadingMessage(e):e.value;this._withResult(new ig(t,e.isComplete,e.options))}));let e=this._contentHoverWidget.getDomNode();this._register(vs(e,`keydown`,e=>{e.equals(9)&&this.hide()})),this._register(vs(e,`mouseleave`,e=>{this._onMouseLeave(e)})),this._register(Mi.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,n,r,i){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,n,r,!1),!0):!1;let a=this._editor.getOption(69).sticky,o=i&&this._contentHoverWidget.isMouseGettingCloser(i.event.posx,i.event.posy);return a&&o?(e&&this._startHoverOperationIfNecessary(e,t,n,r,!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,n,r,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,n,r,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,n,r,i){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();let a={anchor:e,source:n,shouldFocus:r,insistOnKeepingHoverVisible:i};this._hoverOperation.start(t,a)}_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(let t of this._participants){if(!t.createLoadingMessage)continue;let n=t.createLoadingMessage(e.options.anchor);if(n)return e.value.slice(0).concat([n])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;let t=e.hoverParts.length===0,n=e.options.insistOnKeepingHoverVisible;t&&n||this._setCurrentResult(e)}_showHover(e){let t=this._getHoverContext();this._renderedContentHover.value=new hb(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:e=>{this._contentHoverWidget.setMinimumDimensions(e)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;let t=this._findHoverAnchorCandidates(e);if(!(t.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);let n=t[0];return this._startShowingOrUpdateHover(n,0,0,!1,e)}_findHoverAnchorCandidates(e){let t=[];for(let n of this._participants){if(!n.suggestHoverAnchor)continue;let r=n.suggestHoverAnchor(e);r&&t.push(r)}let n=e.target;switch(n.type){case 6:t.push(new Bm(0,n.range,e.event.posx,e.event.posy));break;case 7:{let r=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!n.detail.isAfterLines&&typeof n.detail.horizontalDistanceToText==`number`&&n.detail.horizontalDistanceToText<r))break;t.push(new Bm(0,n.range,e.event.posx,e.event.posy));break}}return t.sort((e,t)=>t.priority-e.priority),t}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!Vh(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,n,r){this._startShowingOrUpdateHover(new Bm(0,e,void 0,void 0),t,n,r,null)}async updateHoverVerbosityLevel(e,t,n){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,n)}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}};bb=vb([yb(1,w),yb(2,jr),yb(3,fa),yb(4,xe)],bb);function xb(e){let t=e.target;return!!t&&t.type===6&&t.detail.injectedText?.options.attachedData===ih}var Sb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Cb=function(e,t){return function(n,r){t(n,r,e)}},wb,Tb=class extends j{static{wb=this}static{this.ID=`editor.contrib.contentHover`}constructor(e,t,n,r){super(),this._editor=e,this._instantiationService=n,this._keybindingService=r,this._onHoverContentsChanged=this._register(new U),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new S,this._isMouseDown=!1,this._ignoreMouseEvents=!1,this._reactToEditorMouseMoveRunner=this._register(new Cl(()=>{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(e=>{e.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(wb.ID)}_hookListeners(){let 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(e=>this._onEditorMouseDown(e))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(e=>this._onEditorMouseMove(e))),this._listenersStore.add(this._editor.onKeyDown(e=>this._onKeyDown(e))),this._listenersStore.add(this._editor.onMouseLeave(e=>this._onEditorMouseLeave(e))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(e=>this._onEditorScrollChanged(e)))}_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()||xb(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?Vh(this._contentWidget.getDomNode(),e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),!this._shouldKeepHoverWidgetVisible(e)&&this.hideContentHover())}_shouldKeepCurrentHover(e){let t=this._contentWidget;if(!t)return!1;let n=this._hoverSettings.sticky,r=(e,t)=>{let n=this._isMouseOnContentHoverWidget(e);return t&&n},i=e=>{let n=t.isColorPickerVisible,r=this._isMouseOnContentHoverWidget(e),i=n&&r,a=n&&this._isMouseDown;return i||a},a=(e,n)=>{let r=e.event.browserEvent.view;return r?n&&t.containsNode(r.document.activeElement)&&!r.getSelection()?.isCollapsed:!1},o=t.isFocused,s=t.isResizing,c=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||o||s||c||r(e,n)||i(e)||a(e,n)}_onEditorMouseMove(e){if(!this._ignoreMouseEvents){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(){let e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){Hh(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`&&Uh(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._contentWidget.isVisible||this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let t=this._isPotentialKeyboardShortcut(e),n=Er(e.keyCode);t||n||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;let t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),n=t.kind===1,r=t.kind===2&&(t.commandId===`editor.action.showHover`||t.commandId===`editor.action.increaseHoverVerbosityLevel`||t.commandId===`editor.action.decreaseHoverVerbosityLevel`)&&this._contentWidget.isVisible;return n||r}hideContentHover(){Lh.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(bb,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,n,r){this._getOrCreateContentWidget().startShowingAtRange(e,t,n,r)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,n){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,n)}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()}};Tb=wb=Sb([Cb(1,Au),Cb(2,w),Cb(3,jr)],Tb);var Eb=class extends j{static{this.ID=`editor.contrib.colorContribution`}constructor(e){super(),this._editor=e,this._register(e.onMouseDown(e=>this.onMouseDown(e)))}dispose(){super.dispose()}onMouseDown(e){let t=this._editor.getOption(168);if(t!==`click`&&t!==`clickAndHover`||!xb(e))return;let n=this._editor.getContribution(Tb.ID);if(!n||n.isColorPickerVisible)return;let r=e.target.range;if(!r)return;let i=new T(r.startLineNumber,r.startColumn+1,r.endLineNumber,r.endColumn+1);n.showContentHover(i,1,1,!1)}},Db=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Ob=function(e,t){return function(n,r){t(n,r,e)}},kb=class e{constructor(e,t,n,r){this.owner=e,this.range=t,this.model=n,this.provider=r}static fromBaseColor(t,n){return new e(t,n.range,n.model,n.provider)}},Ab=class extends j{constructor(e,t,n,r){super();let i=e.getModel(),a=n.model;this.color=n.model.color,this.colorPicker=this._register(new lv(t.fragment,a,e.getOption(163),r,`standalone`)),this._register(a.onColorFlushed(e=>{this.color=e})),this._register(a.onDidChangeColor(e=>{pv(i,a,e,n.range,n)})),this._register(e.onDidChangeModelContent(n=>{t.hide(),e.focus()})),pv(i,a,this.color,n.range,n)}},jb=class{constructor(e,t){this._editor=e,this._themeService=t}async createColorHover(e,t,n){if(!this._editor.hasModel()||!ah.get(this._editor))return null;let r=await Jm(n,this._editor.getModel(),B.None),i=null,a=null;for(let t of r){let n=t.colorInfo;T.containsRange(n.range,e.range)&&(i=n,a=t.provider)}let o=i??e,s=a??t,c=!!i;return{colorHover:kb.fromBaseColor(this,await dv(this._editor.getModel(),o,s)),foundInEditor:c}}async updateEditorModel(e){if(!this._editor.hasModel())return;let t=e.model,n=new T(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await pv(this._editor.getModel(),t,this._color,n,e),n=fv(this._editor,n,t))}renderHoverParts(e,t){if(!(t.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(e),this._renderedParts=new Ab(this._editor,e,t[0],this._themeService),this._renderedParts}_setMinimumDimensions(e){let t=this._editor.getOption(75)+8;e.setMinimumDimensions(new zi(302,t))}get _color(){return this._renderedParts?.color}};jb=Db([Ob(1,Ll)],jb);var Mb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Nb=function(e,t){return function(n,r){t(n,r,e)}},Pb,Fb=class{constructor(e,t){this.value=e,this.foundInEditor=t}},Ib=8,Lb=22,Rb=class extends j{static{Pb=this}static{this.ID=`editor.contrib.standaloneColorPickerWidget`}constructor(e,t,n,r,i,a,o,s){super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=n,this._keybindingService=i,this._languageFeaturesService=a,this._editorWorkerService=o,this._hoverService=s,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement(`div`),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new U),this.onResult=this._onResult.event,this._renderedHoverParts=this._register(new Ae),this._renderedStatusBar=this._register(new Ae),this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=r.createInstance(jb,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;let c=this._editor.getSelection(),l=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},u=this._register(Os(this._body));this._register(u.onDidBlur(e=>{this.hide()})),this._register(u.onDidFocus(e=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(e=>{let t=e.target.element?.classList;t&&t.contains(`colorpicker-color-decoration`)&&this.hide()})),this._register(this.onResult(e=>{this._render(e.value,e.foundInEditor)})),this._start(l),this._body.style.zIndex=`50`,this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return Pb.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;let 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){let t=await this._computeAsync(e);t&&this._onResult.fire(new Fb(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;let t={range:e,color:{red:0,green:0,blue:0,alpha:1}},n=await this._standaloneColorPickerParticipant.createColorHover(t,new Km(this._editorWorkerService),this._languageFeaturesService.colorProvider);return n?{result:n.colorHover,foundInEditor:n.foundInEditor}:null}_render(e,t){let n=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new lg(this._keybindingService,this._hoverService));let r={fragment:n,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(r,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}let i=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(n),i.layout();let a=i.body,o=a.saturationBox.domNode.clientWidth,s=a.domNode.clientWidth-o-Lb-Ib,c=i.body.enterButton;c?.onClicked(()=>{this.updateEditor(),this.hide()});let l=i.header,u=l.pickedColorNode;u.style.width=o+Ib+`px`;let d=l.originalColorNode;d.style.width=s+`px`,i.header.closeButton?.onClicked(()=>{this.hide()}),t&&(c&&(c.button.textContent=`Replace`),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}};Rb=Pb=Mb([Nb(3,w),Nb(4,jr),Nb(5,q),Nb(6,$i),Nb(7,fa)],Rb);var zb=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Bb=function(e,t){return function(n,r){t(n,r,e)}},Vb,Hb=class extends j{static{Vb=this}static{this.ID=`editor.contrib.standaloneColorPickerController`}constructor(e,t,n){super(),this._editor=e,this._instantiationService=n,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=z.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=z.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(Rb,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(Vb.ID)}};Hb=Vb=zb([Bb(1,G),Bb(2,w)],Hb);var Ub=class extends Pi{constructor(){super({id:`editor.action.showOrFocusStandaloneColorPicker`,title:{...J(925,`Show or Focus Standalone Color Picker`),mnemonicTitle:V(924,`&&Show or Focus Standalone Color Picker`)},precondition:void 0,menu:[{id:Z.CommandPalette}],metadata:{description:J(926,`Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.`)}})}runEditorCommand(e,t){Hb.get(t)?.showOrFocus()}},Wb=class extends N{constructor(){super({id:`editor.action.hideColorPicker`,label:J(927,`Hide the Color Picker`),precondition:z.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:J(928,`Hide the standalone color picker.`)}})}run(e,t){Hb.get(t)?.hide()}},Gb=class extends N{constructor(){super({id:`editor.action.insertColorWithStandaloneColorPicker`,label:J(929,`Insert Color with Standalone Color Picker`),precondition:z.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:J(930,`Insert hex/rgb/hsl colors with the focused standalone color picker.`)}})}run(e,t){Hb.get(t)?.insertColor()}};O(Wb),O(Gb),x(Ub),F(Eb.ID,Eb,2),F(Hb.ID,Hb,1),F(ah.ID,ah,1),Qo(qm),Um.register(_v),jn.registerCommand(`_executeDocumentColorProvider`,function(e,...t){let[n]=t;if(!(n instanceof On))throw so();let{model:r,colorProviderRegistry:i,defaultColorDecoratorsEnablement:a}=eh(e,n);return $m(new Zm,i,r,B.None,a)}),jn.registerCommand(`_executeColorPresentationProvider`,function(e,...t){let[n,r]=t;if(!r)return;let{uri:i,range:a}=r;if(!(i instanceof On)||!Array.isArray(n)||n.length!==4||!T.isIRange(a))throw so();let{model:o,colorProviderRegistry:s,defaultColorDecoratorsEnablement:c}=eh(e,i),[l,u,d,f]=n;return $m(new Qm({range:a,color:{red:l,green:u,blue:d,alpha:f}}),s,o,B.None,c)});var Kb=class e{constructor(e,t,n){this.languageConfigurationService=n,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,n){if(n<0)return!1;let r=t.length,i=e.length;if(n+r>i)return!1;for(let i=0;i<r;i++){let r=e.charCodeAt(n+i),a=t.charCodeAt(i);if(r!==a&&!(r>=65&&r<=90&&r+32===a)&&!(a>=65&&a<=90&&a+32===r))return!1}return!0}_createOperationsForBlockComment(t,n,r,i,a,o){let s=t.startLineNumber,c=t.startColumn,l=t.endLineNumber,u=t.endColumn,d=a.getLineContent(s),f=a.getLineContent(l),p=d.lastIndexOf(n,c-1+n.length),m=f.indexOf(r,u-1-r.length);if(p!==-1&&m!==-1)if(s===l)d.substring(p+n.length,m).indexOf(r)>=0&&(p=-1,m=-1);else{let e=d.substring(p+n.length),t=f.substring(0,m);(e.indexOf(r)>=0||t.indexOf(r)>=0)&&(p=-1,m=-1)}let h;p!==-1&&m!==-1?(i&&p+n.length<d.length&&d.charCodeAt(p+n.length)===32&&(n+=` `),i&&m>0&&f.charCodeAt(m-1)===32&&(r=` `+r,--m),h=e._createRemoveBlockCommentOperations(new T(s,p+n.length+1,l,m+1),n,r)):(h=e._createAddBlockCommentOperations(t,n,r,this._insertSpace),this._usedEndToken=h.length===1?r:null);for(let e of h)o.addTrackedEditOperation(e.range,e.text)}static _createRemoveBlockCommentOperations(e,t,n){let r=[];return T.isEmpty(e)?r.push(Ss.delete(new T(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+n.length))):(r.push(Ss.delete(new T(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),r.push(Ss.delete(new T(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+n.length)))),r}static _createAddBlockCommentOperations(e,t,n,r){let i=[];return T.isEmpty(e)?i.push(Ss.replace(new T(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+` `+n)):(i.push(Ss.insert(new M(e.startLineNumber,e.startColumn),t+(r?` `:``))),i.push(Ss.insert(new M(e.endLineNumber,e.endColumn),(r?` `:``)+n))),i}getEditOperations(e,t){let n=this._selection.startLineNumber,r=this._selection.startColumn;e.tokenization.tokenizeIfCheap(n);let i=e.getLanguageIdAtPosition(n,r),a=this.languageConfigurationService.getLanguageConfiguration(i).comments;!a||!a.blockCommentStartToken||!a.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,a.blockCommentStartToken,a.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){let n=t.getInverseEditOperations();if(n.length===2){let e=n[0],t=n[1];return new P(e.range.endLineNumber,e.range.endColumn,t.range.startLineNumber,t.range.startColumn)}else{let e=n[0].range,t=this._usedEndToken?-this._usedEndToken.length-1:0;return new P(e.endLineNumber,e.endColumn+t,e.endLineNumber,e.endColumn+t)}}},qb=class e{constructor(e,t,n,r,i,a,o){this.languageConfigurationService=e,this._selection=t,this._indentSize=n,this._type=r,this._insertSpace=i,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=a,this._ignoreFirstLine=o||!1}static _gatherPreflightCommentStrings(e,t,n,r){e.tokenization.tokenizeIfCheap(t);let i=e.getLanguageIdAtPosition(t,1),a=r.getLanguageConfiguration(i).comments,o=a?a.lineCommentToken:null;if(!o)return null;let s=[];for(let e=0,r=n-t+1;e<r;e++)s[e]={ignore:!1,commentStr:o,commentStrOffset:0,commentStrLength:o.length};return s}static _analyzeLines(e,t,n,r,i,a,o,s,c){let l=!0,u=s.getLanguageConfiguration(c).comments?.lineCommentNoIndent??!1,d;d=e===0?!0:e!==1;for(let s=0,c=r.length;s<c;s++){let c=r[s],f=i+s;if(f===i&&o){c.ignore=!0;continue}let p=n.getLineContent(f),m=Ii(p);if(m===-1){c.ignore=a,c.commentStrOffset=u?0:p.length;continue}l=!1;let h=u?0:m;if(c.ignore=!1,c.commentStrOffset=h,d&&!Kb._haystackHasNeedleAtOffset(p,c.commentStr,h)&&(e===0?d=!1:e===1||(c.ignore=!0)),d&&t){let e=m+c.commentStrLength;e<p.length&&p.charCodeAt(e)===32&&(c.commentStrLength+=1)}}if(e===0&&l){d=!1;for(let e=0,t=r.length;e<t;e++)r[e].ignore=!1}return{supported:!0,shouldRemoveComments:d,lines:r}}static _gatherPreflightData(t,n,r,i,a,o,s,c){let l=e._gatherPreflightCommentStrings(r,i,a,c),u=r.getLanguageIdAtPosition(i,1);return l===null?{supported:!1}:e._analyzeLines(t,n,r,l,i,o,s,c,u)}_executeLineComments(t,n,r,i){let a;r.shouldRemoveComments?a=e._createRemoveLineCommentsOperations(r.lines,i.startLineNumber):(e._normalizeInsertionPoint(t,r.lines,i.startLineNumber,this._indentSize),a=this._createAddLineCommentsOperations(r.lines,i.startLineNumber));let o=new M(i.positionLineNumber,i.positionColumn);for(let e=0,r=a.length;e<r;e++)n.addEditOperation(a[e].range,a[e].text),T.isEmpty(a[e].range)&&T.getStartPosition(a[e].range).equals(o)&&t.getLineContent(o.lineNumber).length+1===o.column&&(this._deltaColumn=(a[e].text||``).length);this._selectionId=n.trackSelection(i)}_attemptRemoveBlockComment(e,t,n,r){let i=t.startLineNumber,a=t.endLineNumber,o=r.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn),s=e.getLineContent(i).lastIndexOf(n,o-1),c=e.getLineContent(a).indexOf(r,t.endColumn-1-n.length);return s!==-1&&c===-1&&(c=e.getLineContent(i).indexOf(r,s+n.length),a=i),s===-1&&c!==-1&&(s=e.getLineContent(a).lastIndexOf(n,c),i=a),t.isEmpty()&&(s===-1||c===-1)&&(s=e.getLineContent(i).indexOf(n),s!==-1&&(c=e.getLineContent(i).indexOf(r,s+n.length))),s!==-1&&e.getLineContent(i).charCodeAt(s+n.length)===32&&(n+=` `),c!==-1&&e.getLineContent(a).charCodeAt(c-1)===32&&(r=` `+r,--c),s!==-1&&c!==-1?Kb._createRemoveBlockCommentOperations(new T(i,s+n.length+1,a,c+1),n,r):null}_executeBlockComment(e,t,n){e.tokenization.tokenizeIfCheap(n.startLineNumber);let r=e.getLanguageIdAtPosition(n.startLineNumber,1),i=this.languageConfigurationService.getLanguageConfiguration(r).comments;if(!i||!i.blockCommentStartToken||!i.blockCommentEndToken)return;let a=i.blockCommentStartToken,o=i.blockCommentEndToken,s=this._attemptRemoveBlockComment(e,n,a,o);if(!s){if(n.isEmpty()){let t=e.getLineContent(n.startLineNumber),r=Ii(t);r===-1&&(r=t.length),s=Kb._createAddBlockCommentOperations(new T(n.startLineNumber,r+1,n.startLineNumber,t.length+1),a,o,this._insertSpace)}else s=Kb._createAddBlockCommentOperations(new T(n.startLineNumber,e.getLineFirstNonWhitespaceColumn(n.startLineNumber),n.endLineNumber,e.getLineMaxColumn(n.endLineNumber)),a,o,this._insertSpace);s.length===1&&(this._deltaColumn=a.length+1)}this._selectionId=t.trackSelection(n);for(let e of s)t.addEditOperation(e.range,e.text)}getEditOperations(t,n){let r=this._selection;if(this._moveEndPositionDown=!1,r.startLineNumber===r.endLineNumber&&this._ignoreFirstLine){n.addEditOperation(new T(r.startLineNumber,t.getLineMaxColumn(r.startLineNumber),r.startLineNumber+1,1),r.startLineNumber===t.getLineCount()?``:`
9
+ `),this._selectionId=n.trackSelection(r);return}r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,t.getLineMaxColumn(r.endLineNumber-1)));let i=e._gatherPreflightData(this._type,this._insertSpace,t,r.startLineNumber,r.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return i.supported?this._executeLineComments(t,n,i,r):this._executeBlockComment(t,n,r)}computeCursorState(e,t){let n=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(n=n.setEndPosition(n.endLineNumber+1,1)),new P(n.selectionStartLineNumber,n.selectionStartColumn+this._deltaColumn,n.positionLineNumber,n.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){let n=[];for(let r=0,i=e.length;r<i;r++){let i=e[r];i.ignore||n.push(Ss.delete(new T(t+r,i.commentStrOffset+1,t+r,i.commentStrOffset+i.commentStrLength+1)))}return n}_createAddLineCommentsOperations(e,t){let n=[],r=this._insertSpace?` `:``;for(let i=0,a=e.length;i<a;i++){let a=e[i];a.ignore||n.push(Ss.insert(new M(t+i,a.commentStrOffset+1),a.commentStr+r))}return n}static nextVisibleColumn(e,t,n,r){return n?e+(t-e%t):e+r}static _normalizeInsertionPoint(t,n,r,i){let a=1073741824,o,s;for(let o=0,s=n.length;o<s;o++){if(n[o].ignore)continue;let s=t.getLineContent(r+o),c=0;for(let t=0,r=n[o].commentStrOffset;c<a&&t<r;t++)c=e.nextVisibleColumn(c,i,s.charCodeAt(t)===9,1);c<a&&(a=c)}a=Math.floor(a/i)*i;for(let c=0,l=n.length;c<l;c++){if(n[c].ignore)continue;let l=t.getLineContent(r+c),u=0;for(o=0,s=n[c].commentStrOffset;u<a&&o<s;o++)u=e.nextVisibleColumn(u,i,l.charCodeAt(o)===9,1);u>a?n[c].commentStrOffset=o-1:n[c].commentStrOffset=o}}},Jb=class extends N{constructor(e,t){super(t),this._type=e}run(e,t){let n=e.get(eu);if(!t.hasModel())return;let r=t.getModel(),i=[],a=r.getOptions(),o=t.getOption(29),s=t.getSelections().map((e,t)=>({selection:e,index:t,ignoreFirstLine:!1}));s.sort((e,t)=>T.compareRangesUsingStarts(e.selection,t.selection));let c=s[0];for(let e=1;e<s.length;e++){let t=s[e];c.selection.endLineNumber===t.selection.startLineNumber&&(c.index<t.index?t.ignoreFirstLine=!0:(c.ignoreFirstLine=!0,c=t))}for(let e of s)i.push(new qb(n,e.selection,a.indentSize,this._type,o.insertSpace,o.ignoreEmptyLines,e.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}},Yb=class extends Jb{constructor(){super(0,{id:`editor.action.commentLine`,label:J(933,`Toggle Line Comment`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:Z.MenubarEditMenu,group:`5_insert`,title:V(931,`&&Toggle Line Comment`),order:1},canTriggerInlineEdits:!0})}},Xb=class extends Jb{constructor(){super(1,{id:`editor.action.addCommentLine`,label:J(934,`Add Line Comment`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2081),weight:100},canTriggerInlineEdits:!0})}},Zb=class extends Jb{constructor(){super(2,{id:`editor.action.removeCommentLine`,label:J(935,`Remove Line Comment`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2099),weight:100},canTriggerInlineEdits:!0})}},Qb=class extends N{constructor(){super({id:`editor.action.blockComment`,label:J(936,`Toggle Block Comment`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:Z.MenubarEditMenu,group:`5_insert`,title:V(932,`Toggle &&Block Comment`),order:2},canTriggerInlineEdits:!0})}run(e,t){let n=e.get(eu);if(!t.hasModel())return;let r=t.getOption(29),i=[],a=t.getSelections();for(let e of a)i.push(new Kb(e,r.insertSpace,n));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}};O(Yb),O(Xb),O(Zb),O(Qb);var $b=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},ex=function(e,t){return function(n,r){t(n,r,e)}},tx,nx=class{static{tx=this}static{this.ID=`editor.contrib.contextmenu`}static get(e){return e.getContribution(tx.ID)}constructor(e,t,n,r,i,a,o,s){this._contextMenuService=t,this._contextViewService=n,this._contextKeyService=r,this._keybindingService=i,this._menuService=a,this._configurationService=o,this._workspaceContextService=s,this._toDispose=new S,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(e=>this._onContextMenu(e))),this._toDispose.add(this._editor.onMouseWheel(e=>{if(this._contextMenuIsBeingShownCount>0){let t=this._contextViewService.getContextViewElement(),n=e.srcElement;n.shadowRoot&&Wc(t)===n.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(e=>{this._editor.getOption(30)&&e.keyCode===58&&(e.preventDefault(),e.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 t=!1;for(let n of this._editor.getSelections())if(n.containsPosition(e.target.position)){t=!0;break}t||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;let t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){let n=[],r=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(let t of r){let[,r]=t,i=0;for(let t of r)if(t instanceof gu){let r=this._getMenuActions(e,t.item.submenu);r.length>0&&(n.push(new Xu(t.id,t.label,r)),i++)}else n.push(t),i++;i&&n.push(new Tr)}return n.length&&n.pop(),n}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;let n=t;if(!n){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();let e=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),t=Po(this._editor.getDomNode());n={x:t.left+e.left,y:t.top+e.top+e.height}}let r=this._editor.getOption(144)&&!oe;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:r?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>n,getActions:()=>e,getActionViewItem:e=>{let t=this._keybindingFor(e);if(t)return new ar(e,e,{label:!0,keybinding:t.getLabel(),isMenu:!0});let n=e;return typeof n.getActionViewItem==`function`?n.getActionViewItem():new ar(e,e,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:e=>this._keybindingFor(e),onHide:e=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||Dn(this._workspaceContextService.getWorkspace()))return;let t=this._editor.getOption(81),n=0,r=e=>({id:`menu-action-${++n}`,label:e.label,tooltip:``,class:void 0,enabled:e.enabled===void 0?!0:e.enabled,checked:e.checked,run:e.run}),i=(e,t)=>new Xu(`menu-action-${++n}`,e,t,void 0),a=(e,t,n,a,o)=>{if(!t)return r({label:e,enabled:t,run:()=>{}});let s=e=>()=>{this._configurationService.updateValue(n,e)},c=[];for(let e of o)c.push(r({label:e.label,checked:a===e.value,run:s(e.value)}));return i(e,c)},o=[];o.push(r({label:V(937,`Minimap`),checked:t.enabled,run:()=>{this._configurationService.updateValue(`editor.minimap.enabled`,!t.enabled)}})),o.push(new Tr),o.push(r({label:V(938,`Render Characters`),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue(`editor.minimap.renderCharacters`,!t.renderCharacters)}})),o.push(a(V(939,`Vertical size`),t.enabled,`editor.minimap.size`,t.size,[{label:V(940,`Proportional`),value:`proportional`},{label:V(941,`Fill`),value:`fill`},{label:V(942,`Fit`),value:`fit`}])),o.push(a(V(943,`Slider`),t.enabled,`editor.minimap.showSlider`,t.showSlider,[{label:V(944,`Mouse Over`),value:`mouseover`},{label:V(945,`Always`),value:`always`}])),o.push(a(V(946,`Side`),t.enabled,`editor.minimap.side`,t.side,[{label:V(947,`Right`),value:`right`},{label:V(948,`Left`),value:`left`}]));let s=this._editor.getOption(144)&&!oe;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:s?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>o,onHide:e=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}};nx=tx=$b([ex(1,Au),ex(2,Vr),ex(3,G),ex(4,jr),ex(5,La),ex(6,xa),ex(7,Zn)],nx);var rx=class extends N{constructor(){super({id:`editor.action.showContextMenu`,label:J(949,`Show Editor Context Menu`),precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:1092,weight:100}})}run(e,t){nx.get(t)?.showContextMenu()}};F(nx.ID,nx,2),O(rx);var ix=class{constructor(e){this.selections=e}equals(e){let t=this.selections.length;if(t!==e.selections.length)return!1;for(let n=0;n<t;n++)if(!this.selections[n].equalsSelection(e.selections[n]))return!1;return!0}},ax=class{constructor(e,t,n){this.cursorState=e,this.scrollTop=t,this.scrollLeft=n}},ox=class e extends j{static{this.ID=`editor.contrib.cursorUndoRedoController`}static get(t){return t.getContribution(e.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(e=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(e=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;let n=new ix(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(n)||(this._undoStack.push(new ax(n,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 ax(new ix(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 ax(new ix(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}},sx=class extends N{constructor(){super({id:`cursorUndo`,label:J(950,`Cursor Undo`),precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:2099,weight:100}})}run(e,t,n){ox.get(t)?.cursorUndo()}},cx=class extends N{constructor(){super({id:`cursorRedo`,label:J(951,`Cursor Redo`),precondition:void 0})}run(e,t,n){ox.get(t)?.cursorRedo()}};F(ox.ID,ox,0),O(sx),O(cx);var lx=class{constructor(e,t,n){this.selection=e,this.targetPosition=t,this.copy=n,this.targetSelection=null}getEditOperations(e,t){let n=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new T(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),n),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 P(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 P(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 P(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 P(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.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new P(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(e,t){return this.targetSelection}};function ux(e){return oi?e.altKey:e.ctrlKey}var dx=class e extends j{static{this.ID=`editor.contrib.dragAndDrop`}static{this.TRIGGER_KEY_VALUE=oi?6:5}constructor(e){super(),this._editor=e,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(e=>this._onEditorMouseDown(e))),this._register(this._editor.onMouseUp(e=>this._onEditorMouseUp(e))),this._register(this._editor.onMouseDrag(e=>this._onEditorMouseDrag(e))),this._register(this._editor.onMouseDrop(e=>this._onEditorMouseDrop(e))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(e=>this.onEditorKeyDown(e))),this._register(this._editor.onKeyUp(e=>this.onEditorKeyUp(e))),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)||(ux(e)&&(this._modifierPressed=!0),this._mouseDown&&ux(e)&&this._editor.updateOptions({mouseStyle:`copy`}))}onEditorKeyUp(t){!this._editor.getOption(42)||this._editor.getOption(28)||(ux(t)&&(this._modifierPressed=!1),this._mouseDown&&t.keyCode===e.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){let t=e.target;if(this._dragSelection===null){let e=(this._editor.getSelections()||[]).filter(e=>t.position&&e.containsPosition(t.position));if(e.length===1)this._dragSelection=e[0];else return}ux(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(t){if(t.target&&(this._hitContent(t.target)||this._hitMargin(t.target))&&t.target.position){let n=new M(t.target.position.lineNumber,t.target.position.column);if(this._dragSelection===null){let e=null;if(t.event.shiftKey){let t=this._editor.getSelection();if(t){let{selectionStartLineNumber:r,selectionStartColumn:i}=t;e=[new P(r,i,n.lineNumber,n.column)]}}else e=(this._editor.getSelections()||[]).map(e=>e.containsPosition(n)?new P(n.lineNumber,n.column,n.lineNumber,n.column):e);this._editor.setSelections(e||[],`mouse`,3)}else (!this._dragSelection.containsPosition(n)||(ux(t.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(n)||this._dragSelection.getStartPosition().equals(n)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(e.ID,new lx(this._dragSelection,n,ux(t.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:`text`}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=Y.register({description:`dnd-target`,className:`dnd-target`})}showAt(t){this._dndDecorationIds.set([{range:new T(t.lineNumber,t.column,t.lineNumber,t.column),options:e._DECORATION_OPTIONS}]),this._editor.revealPosition(t,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()}};F(dx.ID,dx,2);var fx=`editor.action.pasteAs`;F(ip.ID,ip,0),Qo(sf),R(new class extends mt{constructor(){super({id:ep,precondition:np,kbOpts:{weight:100,primary:2137}})}runEditorCommand(e,t){return ip.get(t)?.changePasteType()}}),R(new class extends mt{constructor(){super({id:`editor.hidePasteWidget`,precondition:np,kbOpts:{weight:100,primary:9}})}runEditorCommand(e,t){ip.get(t)?.clearWidgets()}}),O(class e extends N{static{this.argsSchema={oneOf:[{type:`object`,required:[`kind`],properties:{kind:{type:`string`,description:V(952,`The kind of the paste edit to try pasting with.
10
+ 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:V(953,`List of preferred paste edit kind to try applying.
11
+ The first edit matching the preferences will be applied.`),items:{type:`string`}}}}]}}constructor(){super({id:fx,label:J(954,`Paste As...`),precondition:z.writable,metadata:{description:`Paste as`,args:[{name:`args`,schema:e.argsSchema}]},canTriggerInlineEdits:!0})}run(e,t,n){let r;return n&&(`kind`in n?r={only:new zd(n.kind)}:`preferences`in n&&(r={preferences:n.preferences.map(e=>new zd(e))})),ip.get(t)?.pasteAs(r)}}),O(class extends N{constructor(){super({id:`editor.action.pasteAsText`,label:J(955,`Paste as Text`),precondition:z.writable,canTriggerInlineEdits:!0})}run(e,t){return ip.get(t)?.pasteAs({providerId:$d.id})}});var px=class{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){let t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}},mx=class{constructor(e){this.identifier=e}},hx=Xt(`treeViewsDndService`);us(hx,px,1);var gx=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},_x=function(e,t){return function(n,r){t(n,r,e)}},vx,yx=`editor.dropIntoEditor.preferences`,bx=`editor.changeDropType`,xx=new A(`dropWidgetVisible`,!1,V(973,`Whether the drop widget is showing`)),Sx=class extends j{static{vx=this}static{this.ID=`editor.contrib.dropIntoEditorController`}static get(e){return e.getContribution(vx.ID)}constructor(e,t,n,r,i){super(),this._configService=n,this._languageFeaturesService=r,this._treeViewsDragAndDropService=i,this.treeItemsTransfer=Zs.getInstance(),this._dropProgressManager=this._register(t.createInstance(Wd,`dropIntoEditor`,e)),this._postDropWidgetManager=this._register(t.createInstance(Xf,`dropIntoEditor`,e,xx,{id:bx,label:V(974,`Show drop options...`)},()=>vx._configureDefaultAction?[vx._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(t=>this.onDropIntoEditor(e,t.position,t.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,n){if(!n.dataTransfer||!e.hasModel())return;vx._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);let r=ql(async i=>{let a=new S,o=a.add(new pe(e,1,void 0,i));try{let r=await this.extractDataTransferData(n);if(r.size===0||o.token.isCancellationRequested)return;let s=e.getModel();if(!s)return;let c=this._languageFeaturesService.documentDropEditProvider.ordered(s).filter(e=>e.dropMimeTypes?e.dropMimeTypes.some(e=>r.matches(e)):!0),l=a.add(await this.getDropEdits(c,s,t,r,o.token));if(o.token.isCancellationRequested)return;if(l.edits.length){let n=this.getInitialActiveEditIndex(s,l.edits),r=e.getOption(43).showDropSelector===`afterDrop`;await this._postDropWidgetManager.applyEditAndShowIfNeeded([T.fromPositions(t)],{activeEditIndex:n,allEdits:l.edits},r,async e=>e,i)}}finally{a.dispose(),vx._currentDropOperation===r&&(vx._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,V(975,`Running drop handlers. Click to cancel`),r,{cancel:()=>r.cancel()}),vx._currentDropOperation=r}async getDropEdits(e,t,n,r,i){let a=new S;return{edits:xf(gc(await Vc(Promise.all(e.map(async e=>{try{let o=await e.provideDocumentDropEdits(t,n,r,i);return o&&a.add(o),o?.edits.map(t=>({...t,providerId:e.id}))}catch(e){Mo(e)||console.error(e),console.error(e)}})),i)??[]).flat()),dispose:()=>a.dispose()}}getInitialActiveEditIndex(e,t){let n=this._configService.getValue(yx,{resource:e.uri});for(let e of Array.isArray(n)?n:[]){let n=new zd(e),r=t.findIndex(e=>e.kind&&n.contains(e.kind));if(r>=0)return r}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new co;let t=Xa(e.dataTransfer);if(this.treeItemsTransfer.hasData(mx.prototype)){let e=this.treeItemsTransfer.getData(mx.prototype);if(Array.isArray(e))for(let n of e){let e=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(e)for(let[n,r]of e)t.replace(n,r)}}return t}};Sx=vx=gx([_x(1,w),_x(2,xa),_x(3,q),_x(4,hx)],Sx),F(Sx.ID,Sx,2),Qo(of),R(new class extends mt{constructor(){super({id:bx,precondition:xx,kbOpts:{weight:100,primary:2137}})}runEditorCommand(e,t,n){Sx.get(t)?.changeDropType()}}),R(new class extends mt{constructor(){super({id:`editor.hideDropWidget`,precondition:xx,kbOpts:{weight:100,primary:9}})}runEditorCommand(e,t,n){Sx.get(t)?.clearWidgets()}});var Cx=class e extends Ra{static{this.ID=`editor.contrib.findOptionsWidget`}constructor(e,t,n){super(),this._hideSoon=this._register(new Cl(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=n,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`);let r={inputActiveOptionBorder:An(un),inputActiveOptionForeground:An(Dr),inputActiveOptionBackground:An(At)},i={groupId:`find-options-widget`};this.caseSensitive=this._register(new jl({appendTitle:this._keybindingLabelFor(Ag.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:i,...r})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new rc({appendTitle:this._keybindingLabelFor(Ag.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:i,...r})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new no({appendTitle:this._keybindingLabelFor(Ag.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:i,...r})),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(e=>{let t=!1;e.isRegex&&(this.regex.checked=this._state.isRegex,t=!0),e.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,t=!0),e.matchCase&&(this.caseSensitive.checked=this._state.matchCase,t=!0),!this._state.isRevealed&&t&&this._revealTemporarily()})),this._register(K(this._domNode,pr.MOUSE_LEAVE,e=>this._onMouseLeave())),this._register(K(this._domNode,`mouseover`,e=>this._onMouseOver()))}_keybindingLabelFor(e){return this._keybindingService.appendKeybinding(``,e)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return e.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 wx(e,t){return e===1?!0:e===2?!1:t}var Tx=class extends j{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return wx(this._isRegexOverride,this._isRegex)}get wholeWord(){return wx(this._wholeWordOverride,this._wholeWord)}get matchCase(){return wx(this._matchCaseOverride,this._matchCase)}get preserveCase(){return wx(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 U),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(e,t,n){let r={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},i=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,r.matchesPosition=!0,i=!0),this._matchesCount!==t&&(this._matchesCount=t,r.matchesCount=!0,i=!0),n!==void 0&&(T.equalsRange(this._currentMatch,n)||(this._currentMatch=n,r.currentMatch=!0,i=!0)),i&&this._onFindReplaceStateChange.fire(r)}change(e,t,n=!0){let r={moveCursor:t,updateHistory:n,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},i=!1,a=this.isRegex,o=this.wholeWord,s=this.matchCase,c=this.preserveCase;e.searchString!==void 0&&this._searchString!==e.searchString&&(this._searchString=e.searchString,r.searchString=!0,i=!0),e.replaceString!==void 0&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,r.replaceString=!0,i=!0),e.isRevealed!==void 0&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,r.isRevealed=!0,i=!0),e.isReplaceRevealed!==void 0&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,r.isReplaceRevealed=!0,i=!0),e.isRegex!==void 0&&(this._isRegex=e.isRegex),e.wholeWord!==void 0&&(this._wholeWord=e.wholeWord),e.matchCase!==void 0&&(this._matchCase=e.matchCase),e.preserveCase!==void 0&&(this._preserveCase=e.preserveCase),e.searchScope!==void 0&&(e.searchScope?.every(e=>this._searchScope?.some(t=>!T.equalsRange(t,e)))||(this._searchScope=e.searchScope,r.searchScope=!0,i=!0)),e.loop!==void 0&&this._loop!==e.loop&&(this._loop=e.loop,r.loop=!0,i=!0),e.isSearching!==void 0&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,r.isSearching=!0,i=!0),e.filters!==void 0&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,r.filters=!0,i=!0),this._isRegexOverride=e.isRegexOverride===void 0?0:e.isRegexOverride,this._wholeWordOverride=e.wholeWordOverride===void 0?0:e.wholeWordOverride,this._matchCaseOverride=e.matchCaseOverride===void 0?0:e.matchCaseOverride,this._preserveCaseOverride=e.preserveCaseOverride===void 0?0:e.preserveCaseOverride,a!==this.isRegex&&(i=!0,r.isRegex=!0),o!==this.wholeWord&&(i=!0,r.wholeWord=!0),s!==this.matchCase&&(i=!0,r.matchCase=!0),c!==this.preserveCase&&(i=!0,r.preserveCase=!0),i&&this._onFindReplaceStateChange.fire(r)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=19999}},Ex=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Dx=function(e,t){return function(n,r){t(n,r,e)}},Ox,kx=class{static{Ox=this}static{this.FIND_HISTORY_KEY=`workbench.find.history`}static{this._instance=null}static getOrCreate(e){return Ox._instance||=new Ox(e),Ox._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new U,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){let 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,t=this.storageService.get(Ox.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){let e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(Ox.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}};kx=Ox=Ex([Dx(0,Gc)],kx);var Ax=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},jx=function(e,t){return function(n,r){t(n,r,e)}},Mx,Nx=class{static{Mx=this}static{this.FIND_HISTORY_KEY=`workbench.replace.history`}static{this._instance=null}static getOrCreate(e){return Mx._instance||=new Mx(e),Mx._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new U,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){let 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,t=this.storageService.get(Mx.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){let e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(Mx.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}};Nx=Mx=Ax([jx(0,Gc)],Nx);var Px=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Fx=function(e,t){return function(n,r){t(n,r,e)}},Ix,Lx=524288;function Rx(e,t=`single`,n=!1){if(!e.hasModel())return null;let r=e.getSelection();if(t===`single`&&r.startLineNumber===r.endLineNumber||t===`multiple`){if(r.isEmpty()){let t=e.getConfiguredWordAtPosition(r.getStartPosition());if(t&&!1===n)return t.word}else if(e.getModel().getValueLengthInRange(r)<Lx)return e.getModel().getValueInRange(r)}return null}var zx=class extends j{static{Ix=this}static{this.ID=`editor.contrib.findController`}get editor(){return this._editor}static get(e){return e.getContribution(Ix.ID)}constructor(e,t,n,r,i,a){super(),this._editor=e,this._findWidgetVisible=xg.bindTo(t),this._contextKeyService=t,this._storageService=n,this._clipboardService=r,this._notificationService=i,this._hoverService=a,this._updateHistoryDelayer=this._register(new kc(500)),this._state=this._register(new Tx),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(e=>this._onStateChanged(e))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{let e=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),e&&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(),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!!Sg.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(e=>(e.endColumn===1&&e.endLineNumber>e.startLineNumber&&(e=e.setEndPosition(e.endLineNumber-1,this._editor.getModel().getLineMaxColumn(e.endLineNumber-1))),e.isEmpty()?null:e)).filter(e=>!!e),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=pi(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;let n={...t,isRevealed:!0};if(e.seedSearchStringFromSelection===`single`){let t=Rx(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);t&&(this._state.isRegex?n.searchString=pi(t):n.searchString=t)}else if(e.seedSearchStringFromSelection===`multiple`&&!e.updateSearchScope){let t=Rx(this._editor,e.seedSearchStringFromSelection);t&&(n.searchString=t)}if(!n.searchString&&e.seedSearchStringFromGlobalClipboard){let e=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;e&&(n.searchString=e)}if(e.forceRevealReplace||n.isReplaceRevealed?n.isReplaceRevealed=!0:this._findWidgetVisible.get()||(n.isReplaceRevealed=!1),e.updateSearchScope){let e=this._editor.getSelections();e.some(e=>!e.isEmpty())&&(n.searchScope=e)}n.loop=e.loop,this._state.change(n,!1),this._model||=new Ng(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(V(979,`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)}};zx=Ix=Px([Fx(1,G),Fx(2,Gc),Fx(3,xe),Fx(4,di),Fx(5,fa)],zx);var Bx=class extends zx{constructor(e,t,n,r,i,a,o,s,c,l){super(e,n,a,o,i,s),this._contextViewService=t,this._keybindingService=r,this._configurationService=c,this._accessibilityService=l,this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=kx.getOrCreate(a),this._replaceWidgetHistory=Nx.getOrCreate(a)}async _start(e,t){this._widget||this._createFindWidget();let n=this._editor.getSelection(),r=!1;switch(this._editor.getOption(50).autoFindInSelection){case`always`:r=!0;break;case`never`:r=!1;break;case`multiline`:r=!!n&&n.startLineNumber!==n.endLineNumber;break}e.updateSearchScope=e.updateSearchScope||r,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 E_(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 Cx(this._editor,this._state,this._keybindingService))}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};Bx=Px([Fx(1,Vr),Fx(2,G),Fx(3,jr),Fx(4,di),Fx(5,Gc),Fx(6,xe),Fx(7,fa),Fx(8,xa),Fx(9,ai)],Bx),l(new ol({id:Ag.StartFindAction,label:J(987,`Find`),precondition:m.or(z.focus,m.has(`editorIsOpen`)),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:Z.MenubarEditMenu,group:`3_find`,title:V(980,`&&Find`),order:1}})).addImplementation(0,(e,t,n)=>{let r=zx.get(t);return r?r.start({forceRevealReplace:!1,seedSearchStringFromSelection:t.getOption(50).seedSearchStringFromSelection===`never`?`none`:`single`,seedSearchStringFromNonEmptySelection:t.getOption(50).seedSearchStringFromSelection===`selection`,seedSearchStringFromGlobalClipboard:t.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}):!1});var Vx={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`}}}}]},Hx=class extends N{constructor(){super({id:Ag.StartFindWithArgs,label:J(988,`Find with Arguments`),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:Vx})}async run(e,t,n){let r=zx.get(t);if(r){let e=n?{searchString:n.searchString,replaceString:n.replaceString,isReplaceRevealed:n.replaceString!==void 0,isRegex:n.isRegex,wholeWord:n.matchWholeWord,matchCase:n.isCaseSensitive,preserveCase:n.preserveCase}:{};await r.start({forceRevealReplace:!1,seedSearchStringFromSelection:r.getState().searchString.length===0&&t.getOption(50).seedSearchStringFromSelection!==`never`?`single`:`none`,seedSearchStringFromNonEmptySelection:t.getOption(50).seedSearchStringFromSelection===`selection`,seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:n?.findInSelection||!1,loop:t.getOption(50).loop},e),r.setGlobalBufferTerm(r.getState().searchString)}}},Ux=class extends N{constructor(){super({id:Ag.StartFindWithSelection,label:J(989,`Find with Selection`),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){let n=zx.get(t);n&&(await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:`multiple`,seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}),n.setGlobalBufferTerm(n.getState().searchString))}};async function Wx(e,t){let n=zx.get(e);if(!n)return;let r=e.getOption(50).closeOnResult,i=n.getState().isRevealed,a=()=>{let e=n.editor.getSelection(),a=t?n.moveToNextMatch():n.moveToPrevMatch(),o=!1;if(a){let t=n.editor.getSelection();(!e&&t||e&&t&&!e.equalsSelection(t))&&(o=!0)}return o?(n.editor.pushUndoStop(),r&&i&&n.isFindInputFocused()&&n.closeFindWidget(),!0):!1};if(!a()&&(await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:n.getState().searchString.length===0&&e.getOption(50).seedSearchStringFromSelection!==`never`?`single`:`none`,seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection===`selection`,seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}),!a())){let e=n.getState();i&&e.matchesCount===0&&e.searchString&&$c(V(981,`{0} found for '{1}'`,__,e.searchString))}}l(new ol({id:Ag.NextMatchFindAction,label:J(990,`Find Next`),precondition:void 0,kbOpts:[{kbExpr:z.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:m.and(z.focus,Sg),primary:3,weight:100}]})).addImplementation(0,async(e,t,n)=>Wx(t,!0)),l(new ol({id:Ag.PreviousMatchFindAction,label:J(991,`Find Previous`),precondition:void 0,kbOpts:[{kbExpr:z.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:m.and(z.focus,Sg),primary:1027,weight:100}]})).addImplementation(0,async(e,t,n)=>Wx(t,!1));var Gx=class extends N{constructor(){super({id:Ag.GoToMatchFindAction,label:J(992,`Go to Match...`),precondition:xg}),this._highlightDecorations=[]}run(e,t){let n=zx.get(t);if(!n)return;let r=n.getState().matchesCount;if(r<1){e.get(di).notify({severity:Ni.Warning,message:V(982,`No matches. Try searching for something else.`)});return}let i=e.get(Fi),a=new S,o=a.add(i.createInputBox());o.placeholder=V(983,`Type a number to go to a specific match (between 1 and {0})`,r);let s=e=>{let t=parseInt(e);if(isNaN(t))return;let r=n.getState().matchesCount;if(t>0&&t<=r)return t-1;if(t<0&&t>=-r)return r+t},c=e=>{let r=s(e);if(typeof r==`number`){o.validationMessage=void 0,n.goToMatch(r);let e=n.getState().currentMatch;e&&this.addDecorations(t,e)}else o.validationMessage=V(984,`Please type a number between 1 and {0}`,n.getState().matchesCount),this.clearDecorations(t)};a.add(o.onDidChangeValue(e=>{c(e)})),a.add(o.onDidAccept(()=>{let e=s(o.value);typeof e==`number`?(n.goToMatch(e),o.hide()):o.validationMessage=V(985,`Please type a number between 1 and {0}`,n.getState().matchesCount)})),a.add(o.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),o.show()}clearDecorations(e){e.changeDecorations(e=>{this._highlightDecorations=e.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(e=>{this._highlightDecorations=e.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:`find-match-quick-access-range-highlight`,className:`rangeHighlight`,isWholeLine:!0}},{range:t,options:{description:`find-match-quick-access-range-highlight-overview`,overviewRuler:{color:pl(xo),position:Su.Full}}}])})}},Kx=class extends N{async run(e,t){let n=zx.get(t);if(!n)return;let r=Rx(t,`single`,!1);r&&n.setSearchString(r),this._run(n)||(await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:`none`,seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}),this._run(n))}},qx=class extends Kx{constructor(){super({id:Ag.NextSelectionMatchFindAction,label:J(993,`Find Next Selection`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}},Jx=class extends Kx{constructor(){super({id:Ag.PreviousSelectionMatchFindAction,label:J(994,`Find Previous Selection`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}};l(new ol({id:Ag.StartFindReplaceAction,label:J(995,`Replace`),precondition:m.or(z.focus,m.has(`editorIsOpen`)),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:Z.MenubarEditMenu,group:`3_find`,title:V(986,`&&Replace`),order:2}})).addImplementation(0,(e,t,n)=>{if(!t.hasModel()||t.getOption(104))return!1;let r=zx.get(t);if(!r)return!1;let i=t.getSelection(),a=r.isFindInputFocused(),o=!i.isEmpty()&&i.startLineNumber===i.endLineNumber&&t.getOption(50).seedSearchStringFromSelection!==`never`&&!a,s=a||o?2:1;return r.start({forceRevealReplace:!0,seedSearchStringFromSelection:o?`single`:`none`,seedSearchStringFromNonEmptySelection:t.getOption(50).seedSearchStringFromSelection===`selection`,seedSearchStringFromGlobalClipboard:t.getOption(50).seedSearchStringFromSelection!==`never`,shouldFocus:s,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop})}),F(zx.ID,Bx,0),O(Hx),O(Ux),O(Gx),O(qx),O(Jx);var Yx=mt.bindToContribution(zx.get);R(new Yx({id:Ag.CloseFindWidgetCommand,precondition:xg,handler:e=>e.closeFindWidget(),kbOpts:{weight:105,kbExpr:m.and(z.focus,m.not(`isComposing`)),primary:9,secondary:[1033]}})),R(new Yx({id:Ag.ToggleCaseSensitiveCommand,precondition:void 0,handler:e=>e.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:z.focus,primary:Tg.primary,mac:Tg.mac,win:Tg.win,linux:Tg.linux}})),R(new Yx({id:Ag.ToggleWholeWordCommand,precondition:void 0,handler:e=>e.toggleWholeWords(),kbOpts:{weight:105,kbExpr:z.focus,primary:Eg.primary,mac:Eg.mac,win:Eg.win,linux:Eg.linux}})),R(new Yx({id:Ag.ToggleRegexCommand,precondition:void 0,handler:e=>e.toggleRegex(),kbOpts:{weight:105,kbExpr:z.focus,primary:Dg.primary,mac:Dg.mac,win:Dg.win,linux:Dg.linux}})),R(new Yx({id:Ag.ToggleSearchScopeCommand,precondition:void 0,handler:e=>e.toggleSearchScope(),kbOpts:{weight:105,kbExpr:z.focus,primary:Og.primary,mac:Og.mac,win:Og.win,linux:Og.linux}})),R(new Yx({id:Ag.TogglePreserveCaseCommand,precondition:void 0,handler:e=>e.togglePreserveCase(),kbOpts:{weight:105,kbExpr:z.focus,primary:kg.primary,mac:kg.mac,win:kg.win,linux:kg.linux}})),R(new Yx({id:Ag.ReplaceOneAction,precondition:xg,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:z.focus,primary:3094}})),R(new Yx({id:Ag.ReplaceOneAction,precondition:xg,handler:e=>e.replace(),kbOpts:{weight:105,kbExpr:m.and(z.focus,Cg,z.isComposing.negate()),primary:3}})),R(new Yx({id:Ag.ReplaceAllAction,precondition:xg,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:z.focus,primary:2563}})),R(new Yx({id:Ag.ReplaceAllAction,precondition:xg,handler:e=>e.replaceAll(),kbOpts:{weight:105,kbExpr:m.and(z.focus,Cg),primary:void 0,mac:{primary:2051}}})),R(new Yx({id:Ag.SelectAllMatchesAction,precondition:xg,handler:e=>e.selectAllMatches(),kbOpts:{weight:105,kbExpr:z.focus,primary:515}}));var Xx={0:` `,1:`u`,2:`r`},Zx=16777215,Qx=4278190080,$x=class{constructor(e){let t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){let t=e/32|0,n=e%32;return(this._states[t]&1<<n)!=0}set(e,t){let n=e/32|0,r=e%32,i=this._states[n];t?this._states[n]=i|1<<r:this._states[n]=i&~(1<<r)}},eS=class e{constructor(e,t,n){if(e.length!==t.length||e.length>65535)throw Error(`invalid startIndexes or endIndexes size`);this._startIndexes=e,this._endIndexes=t,this._collapseStates=new $x(e.length),this._userDefinedStates=new $x(e.length),this._recoveredStates=new $x(e.length),this._types=n,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let e=[],t=(t,n)=>{let r=e[e.length-1];return this.getStartLineNumber(r)<=t&&this.getEndLineNumber(r)>=n};for(let n=0,r=this._startIndexes.length;n<r;n++){let r=this._startIndexes[n],i=this._endIndexes[n];if(r>16777215||i>16777215)throw Error(`startLineNumber or endLineNumber must not exceed 16777215`);for(;e.length>0&&!t(r,i);)e.pop();let a=e.length>0?e[e.length-1]:-1;e.push(n),this._startIndexes[n]=r+((a&255)<<24),this._endIndexes[n]=i+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&Zx}getEndLineNumber(e){return this._endIndexes[e]&Zx}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 n=!1;if(this._types)for(let r=0;r<this._types.length;r++)this._types[r]===e&&(this.setCollapsed(r,t),n=!0);return n}toRegion(e){return new tS(this,e)}getParentIndex(e){this.ensureParentIndices();let t=((this._startIndexes[e]&Qx)>>>24)+((this._endIndexes[e]&Qx)>>>16);return t===65535?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,n=this._startIndexes.length;if(n===0)return-1;for(;t<n;){let r=Math.floor((t+n)/2);e<this.getStartLineNumber(r)?n=r:t=r+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(){let e=[];for(let t=0;t<this.length;t++)e[t]=`[${Xx[this.getSource(t)]}${this.isCollapsed(t)?`+`:`-`}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(`, `)}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&Zx,endLineNumber:this._endIndexes[e]&Zx,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(t){let n=t.length,r=new Uint32Array(n),i=new Uint32Array(n),a=[],o=!1;for(let e=0;e<n;e++){let n=t[e];r[e]=n.startLineNumber,i[e]=n.endLineNumber,a.push(n.type),n.type&&(o=!0)}o||(a=void 0);let s=new e(r,i,a);for(let e=0;e<n;e++)t[e].isCollapsed&&s.setCollapsed(e,!0),s.setSource(e,t[e].source);return s}static sanitizeAndMerge(e,t,n,r){n??=Number.MAX_VALUE;let i=(e,t)=>Array.isArray(e)?(n=>n<t?e[n]:void 0):(n=>n<t?e.toFoldRange(n):void 0),a=i(e,e.length),o=i(t,t.length),s=0,c=0,l=a(0),u=o(0),d=[],f,p=0,m=[];for(;l||u;){let e;if(u&&(!l||l.startLineNumber>=u.startLineNumber))l&&l.startLineNumber===u.startLineNumber?(u.source===1?e=u:(e=l,e.isCollapsed=u.isCollapsed&&(l.endLineNumber===u.endLineNumber||!r?.startsInside(l.startLineNumber+1,l.endLineNumber+1)),e.source=0),l=a(++s)):(e=u,u.isCollapsed&&u.source===0&&(e.source=2)),u=o(++c);else{let t=c,n=u;for(;;){if(!n||n.startLineNumber>l.endLineNumber){e=l;break}if(n.source===1&&n.endLineNumber>l.endLineNumber)break;n=o(++t)}l=a(++s)}if(e){for(;f&&f.endLineNumber<e.startLineNumber;)f=d.pop();e.endLineNumber>e.startLineNumber&&e.startLineNumber>p&&e.endLineNumber<=n&&(!f||f.endLineNumber>=e.endLineNumber)&&(m.push(e),p=e.startLineNumber,f&&d.push(f),f=e)}}return m}},tS=class{constructor(e,t){this.ranges=e,this.index=t}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(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}},nS=class{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new U,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new eS(new Uint32Array,new Uint32Array),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((e,t)=>e.regionIndex-t.regionIndex);let t={};this._decorationProvider.changeDecorations(n=>{let r=0,i=-1,a=-1,o=e=>{for(;r<e;){let e=this._regions.getEndLineNumber(r),t=this._regions.isCollapsed(r);if(e<=i){let i=this.regions.getSource(r)!==0;n.changeDecorationOptions(this._editorDecorationIds[r],this._decorationProvider.getDecorationOption(t,e<=a,i))}t&&e>a&&(a=e),r++}};for(let n of e){let e=n.regionIndex,r=this._editorDecorationIds[e];if(r&&!t[r]){t[r]=!0,o(e);let n=!this._regions.isCollapsed(e);this._regions.setCollapsed(e,n),i=Math.max(i,this._regions.getEndLineNumber(e))}}o(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){let t=[],n=t=>{for(let n of e)if(!(n.startLineNumber>t.endLineNumber||t.startLineNumber>n.endLineNumber))return!0;return!1};for(let e=0;e<this._regions.length;e++){let r=this._regions.toFoldRange(e);(r.source===0||!n(r))&&t.push(r)}this.updatePost(eS.fromFoldRanges(t))}update(e,t){let n=this._currentFoldedOrManualRanges(t),r=eS.sanitizeAndMerge(e,n,this._textModel.getLineCount(),t);this.updatePost(eS.fromFoldRanges(r))}updatePost(e){let t=[],n=-1;for(let r=0,i=e.length;r<i;r++){let i=e.getStartLineNumber(r),a=e.getEndLineNumber(r),o=e.isCollapsed(r),s=e.getSource(r)!==0,c={startLineNumber:i,startColumn:this._textModel.getLineMaxColumn(i),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:c,options:this._decorationProvider.getDecorationOption(o,a<=n,s)}),o&&a>n&&(n=a)}this._decorationProvider.changeDecorations(e=>this._editorDecorationIds=e.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){let t=[];for(let n=0,r=this._regions.length;n<r;n++){let r=this.regions.isCollapsed(n),i=this.regions.getSource(n);if(r||i!==0){let a=this._regions.toFoldRange(n),o=this._textModel.getDecorationRange(this._editorDecorationIds[n]);o&&(r&&e?.startsInside(o.startLineNumber+1,o.endLineNumber)&&(r=!1),t.push({startLineNumber:o.startLineNumber,endLineNumber:o.endLineNumber,type:a.type,isCollapsed:r,source:i}))}}return t}getMemento(){let e=this._currentFoldedOrManualRanges(),t=[],n=this._textModel.getLineCount();for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i.startLineNumber>=i.endLineNumber||i.startLineNumber<1||i.endLineNumber>n)continue;let a=this._getLinesChecksum(i.startLineNumber+1,i.endLineNumber);t.push({startLineNumber:i.startLineNumber,endLineNumber:i.endLineNumber,isCollapsed:i.isCollapsed,source:i.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;let t=[],n=this._textModel.getLineCount();for(let r of e){if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>n)continue;let e=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);(!r.checksum||e===r.checksum)&&t.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,type:void 0,isCollapsed:r.isCollapsed??!0,source:r.source??0})}let r=eS.sanitizeAndMerge(this._regions,t,n);this.updatePost(eS.fromFoldRanges(r))}_getLinesChecksum(e,t){return Re(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(e,t){let n=[];if(this._regions){let r=this._regions.findRange(e),i=1;for(;r>=0;){let e=this._regions.toRegion(r);(!t||t(e,i))&&n.push(e),i++,r=e.parentIndex}}return n}getRegionAtLine(e){if(this._regions){let t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){let n=[],r=e?e.regionIndex+1:0,i=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){let e=[];for(let a=r,o=this._regions.length;a<o;a++){let r=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<i){for(;e.length>0&&!r.containedBy(e[e.length-1]);)e.pop();e.push(r),t(r,e.length)&&n.push(r)}else break}}else for(let e=r,a=this._regions.length;e<a;e++){let r=this._regions.toRegion(e);if(this._regions.getStartLineNumber(e)<i)(!t||t(r))&&n.push(r);else break}return n}};function rS(e,t,n){let r=[];for(let i of n){let n=e.getRegionAtLine(i);if(n){let i=!n.isCollapsed;if(r.push(n),t>1){let a=e.getRegionsInside(n,(e,n)=>e.isCollapsed!==i&&n<t);r.push(...a)}}}e.toggleCollapseState(r)}function iS(e,t,n=Number.MAX_VALUE,r){let i=[];if(r&&r.length>0)for(let a of r){let r=e.getRegionAtLine(a);if(r&&(r.isCollapsed!==t&&i.push(r),n>1)){let a=e.getRegionsInside(r,(e,r)=>e.isCollapsed!==t&&r<n);i.push(...a)}}else{let r=e.getRegionsInside(null,(e,r)=>e.isCollapsed!==t&&r<n);i.push(...r)}e.toggleCollapseState(i)}function aS(e,t,n,r){let i=[];for(let a of r){let r=e.getAllRegionsAtLine(a,(e,r)=>e.isCollapsed!==t&&r<=n);i.push(...r)}e.toggleCollapseState(i)}function oS(e,t,n){let r=[];for(let i of n){let n=e.getAllRegionsAtLine(i,e=>e.isCollapsed!==t);n.length>0&&r.push(n[0])}e.toggleCollapseState(r)}function sS(e,t,n,r){let i=e.getRegionsInside(null,(e,i)=>i===t&&e.isCollapsed!==n&&!r.some(t=>e.containsLine(t)));e.toggleCollapseState(i)}function cS(e,t,n){let r=[];for(let t of n){let n=e.getAllRegionsAtLine(t,void 0);n.length>0&&r.push(n[0])}let i=e.getRegionsInside(null,e=>r.every(t=>!t.containedBy(e)&&!e.containedBy(t))&&e.isCollapsed!==t);e.toggleCollapseState(i)}function lS(e,t,n){let r=e.textModel,i=e.regions,a=[];for(let e=i.length-1;e>=0;e--)if(n!==i.isCollapsed(e)){let n=i.getStartLineNumber(e);t.test(r.getLineContent(n))&&a.push(i.toRegion(e))}e.toggleCollapseState(a)}function uS(e,t,n){let r=e.regions,i=[];for(let e=r.length-1;e>=0;e--)n!==r.isCollapsed(e)&&t===r.getType(e)&&i.push(r.toRegion(e));e.toggleCollapseState(i)}function dS(e,t){let n=null,r=t.getRegionAtLine(e);if(r!==null&&(n=r.startLineNumber,e===n)){let e=r.parentIndex;n=e===-1?null:t.regions.getStartLineNumber(e)}return n}function fS(e,t){let n=t.getRegionAtLine(e);if(n!==null&&n.startLineNumber===e){if(e!==n.startLineNumber)return n.startLineNumber;{let e=n.parentIndex,r=0;for(e!==-1&&(r=t.regions.getStartLineNumber(n.parentIndex));n!==null;)if(n.regionIndex>0){if(n=t.regions.toRegion(n.regionIndex-1),n.startLineNumber<=r)return null;if(n.parentIndex===e)return n.startLineNumber}else return null}}else if(t.regions.length>0)for(n=t.regions.toRegion(t.regions.length-1);n!==null;){if(n.startLineNumber<e)return n.startLineNumber;n=n.regionIndex>0?t.regions.toRegion(n.regionIndex-1):null}return null}function pS(e,t){let n=t.getRegionAtLine(e);if(n!==null&&n.startLineNumber===e){let e=n.parentIndex,r=0;if(e!==-1)r=t.regions.getEndLineNumber(n.parentIndex);else if(t.regions.length===0)return null;else r=t.regions.getEndLineNumber(t.regions.length-1);for(;n!==null;)if(n.regionIndex<t.regions.length){if(n=t.regions.toRegion(n.regionIndex+1),n.startLineNumber>=r)return null;if(n.parentIndex===e)return n.startLineNumber}else return null}else if(t.regions.length>0)for(n=t.regions.toRegion(0);n!==null;){if(n.startLineNumber>e)return n.startLineNumber;n=n.regionIndex<t.regions.length?t.regions.toRegion(n.regionIndex+1):null}return null}var mS=class{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new U,this._hasLineChanges=!1,this._foldingModel=e,this._foldingModelListener=e.onDidChange(e=>this.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(e=>e.range.endLineNumber!==e.range.startLineNumber||sr(e.text)[0]!==0))}updateHiddenRanges(){let e=!1,t=[],n=0,r=0,i=Number.MAX_VALUE,a=-1,o=this._foldingModel.regions;for(;n<o.length;n++){if(!o.isCollapsed(n))continue;let s=o.getStartLineNumber(n)+1,c=o.getEndLineNumber(n);i<=s&&c<=a||(!e&&r<this._hiddenRanges.length&&this._hiddenRanges[r].startLineNumber===s&&this._hiddenRanges[r].endLineNumber===c?(t.push(this._hiddenRanges[r]),r++):(e=!0,t.push(new T(s,1,c,1))),i=s,a=c)}(this._hasLineChanges||e||r<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return gS(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1,n=this._foldingModel.textModel,r=null,i=e=>((!r||!hS(e,r))&&(r=gS(this._hiddenRanges,e)),r?r.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let a=e[r],o=i(a.startLineNumber);o&&(a=a.setStartPosition(o,n.getLineMaxColumn(o)),t=!0);let s=i(a.endLineNumber);s&&(a=a.setEndPosition(s,n.getLineMaxColumn(s)),t=!0),e[r]=a}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&=(this._foldingModelListener.dispose(),null),this._updateEventEmitter.dispose()}};function hS(e,t){return e>=t.startLineNumber&&e<=t.endLineNumber}function gS(e,t){let n=Va(e,e=>t<e.startLineNumber)-1;return n>=0&&e[n].endLineNumber>=t?e[n]:null}var _S=5e3,vS=`indent`,yS=class{constructor(e,t,n){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=n,this.id=vS}dispose(){}compute(e){let t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,n=t&&!!t.offSide,r=t&&t.markers;return Promise.resolve(SS(this.editorModel,n,r,this.foldingRangesLimit))}},bS=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,n){if(e>16777215||t>16777215)return;let r=this._length;this._startIndexes[r]=e,this._endIndexes[r]=t,this._length++,n<1e3&&(this._indentOccurrences[n]=(this._indentOccurrences[n]||0)+1)}toIndentRanges(e){let t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let n=this._length-1,r=0;n>=0;n--,r++)e[r]=this._startIndexes[n],t[r]=this._endIndexes[n];return new eS(e,t)}else{this._foldingRangesLimit.update(this._length,t);let n=0,r=this._indentOccurrences.length;for(let e=0;e<this._indentOccurrences.length;e++){let i=this._indentOccurrences[e];if(i){if(i+n>t){r=e;break}n+=i}}let i=e.getOptions().tabSize,a=new Uint32Array(t),o=new Uint32Array(t);for(let s=this._length-1,c=0;s>=0;s--){let l=this._startIndexes[s],u=ua(e.getLineContent(l),i);(u<r||u===r&&n++<t)&&(a[c]=l,o[c]=this._endIndexes[s],c++)}return new eS(a,o)}}},xS={limit:_S,update:()=>{}};function SS(e,t,n,r=xS){let i=e.getOptions().tabSize,a=new bS(r),o,s,c;n&&(n.start.flags===n.end.flags?o=RegExp(`(${n.start.source})|(?:${n.end.source})`,n.start.flags):(s=n.start,c=n.end));let l=[],u=e.getLineCount()+1;l.push({indent:-1,endAbove:u,line:u});for(let n=e.getLineCount();n>0;n--){let r=e.getLineContent(n),u=ua(r,i),d=l[l.length-1];if(u===-1){t&&(d.endAbove=n);continue}let f=!1,p=!1,m;if(o?(o.lastIndex=0,(m=o.exec(r))&&(f=!!m[1],p=!f)):(s&&(s.lastIndex=0,f=s.test(r)),!f&&c&&(c.lastIndex=0,p=c.test(r))),f||p)if(f){let e=l.length-1;for(;e>0&&l[e].indent!==-2;)e--;if(e>0){l.length=e+1,d=l[e],a.insertFirst(n,d.line,u),d.line=n,d.indent=u,d.endAbove=n;continue}}else{l.push({indent:-2,endAbove:n,line:n});continue}if(d.indent>u){do l.pop(),d=l[l.length-1];while(d.indent>u);let e=d.endAbove-1;e-n>=1&&a.insertFirst(n,e,u)}d.indent===u?d.endAbove=n:l.push({indent:u,endAbove:n,line:n})}return a.toIndentRanges(e)}var CS=E(`editor.foldBackground`,{light:sn(ma,.3),dark:sn(ma,.3),hcDark:null,hcLight:null},V(1045,`Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations.`),!0);E(`editor.foldPlaceholderForeground`,{light:`#808080`,dark:`#808080`,hcDark:null,hcLight:null},V(1046,`Color of the collapsed text after the first line of a folded range.`)),E(`editorGutter.foldingControlForeground`,yn,V(1047,`Color of the folding control in the editor gutter.`));var wS=Vs(`folding-expanded`,D.chevronDown,V(1048,`Icon for expanded ranges in the editor glyph margin.`)),TS=Vs(`folding-collapsed`,D.chevronRight,V(1049,`Icon for collapsed ranges in the editor glyph margin.`)),ES=Vs(`folding-manual-collapsed`,TS,V(1050,`Icon for manually collapsed ranges in the editor glyph margin.`)),DS=Vs(`folding-manual-expanded`,wS,V(1051,`Icon for manually expanded ranges in the editor glyph margin.`)),OS={color:pl(CS),position:1},kS=V(1052,`Click to expand the range.`),AS=V(1053,`Click to collapse the range.`),jS=class e{static{this.COLLAPSED_VISUAL_DECORATION=Y.register({description:`folding-collapsed-visual-decoration`,stickiness:0,afterContentClassName:`inline-folded`,isWholeLine:!0,linesDecorationsTooltip:kS,firstLineDecorationClassName:C.asClassName(TS)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Y.register({description:`folding-collapsed-highlighted-visual-decoration`,stickiness:0,afterContentClassName:`inline-folded`,className:`folded-background`,minimap:OS,isWholeLine:!0,linesDecorationsTooltip:kS,firstLineDecorationClassName:C.asClassName(TS)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=Y.register({description:`folding-manually-collapsed-visual-decoration`,stickiness:0,afterContentClassName:`inline-folded`,isWholeLine:!0,linesDecorationsTooltip:kS,firstLineDecorationClassName:C.asClassName(ES)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Y.register({description:`folding-manually-collapsed-highlighted-visual-decoration`,stickiness:0,afterContentClassName:`inline-folded`,className:`folded-background`,minimap:OS,isWholeLine:!0,linesDecorationsTooltip:kS,firstLineDecorationClassName:C.asClassName(ES)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=Y.register({description:`folding-no-controls-range-decoration`,stickiness:0,afterContentClassName:`inline-folded`,isWholeLine:!0,linesDecorationsTooltip:kS})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=Y.register({description:`folding-no-controls-range-decoration`,stickiness:0,afterContentClassName:`inline-folded`,className:`folded-background`,minimap:OS,isWholeLine:!0,linesDecorationsTooltip:kS})}static{this.EXPANDED_VISUAL_DECORATION=Y.register({description:`folding-expanded-visual-decoration`,stickiness:1,isWholeLine:!0,firstLineDecorationClassName:`alwaysShowFoldIcons `+C.asClassName(wS),linesDecorationsTooltip:AS})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Y.register({description:`folding-expanded-auto-hide-visual-decoration`,stickiness:1,isWholeLine:!0,firstLineDecorationClassName:C.asClassName(wS),linesDecorationsTooltip:AS})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=Y.register({description:`folding-manually-expanded-visual-decoration`,stickiness:0,isWholeLine:!0,firstLineDecorationClassName:`alwaysShowFoldIcons `+C.asClassName(DS),linesDecorationsTooltip:AS})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Y.register({description:`folding-manually-expanded-auto-hide-visual-decoration`,stickiness:0,isWholeLine:!0,firstLineDecorationClassName:C.asClassName(DS),linesDecorationsTooltip:AS})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=Y.register({description:`folding-no-controls-range-decoration`,stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=Y.register({description:`folding-hidden-range-decoration`,stickiness:1})}constructor(e){this.editor=e,this.showFoldingControls=`mouseover`,this.showFoldingHighlights=!0}getDecorationOption(t,n,r){return n?e.HIDDEN_RANGE_DECORATION:this.showFoldingControls===`never`?t?this.showFoldingHighlights?e.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:e.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:e.NO_CONTROLS_EXPANDED_RANGE_DECORATION:t?r?this.showFoldingHighlights?e.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:e.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?e.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:e.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls===`mouseover`?r?e.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:e.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:r?e.MANUALLY_EXPANDED_VISUAL_DECORATION:e.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}},MS={},NS=`syntax`,PS=class{constructor(e,t,n,r,i){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=n,this.foldingRangesLimit=r,this.fallbackRangeProvider=i,this.id=NS,this.disposables=new S,i&&this.disposables.add(i);for(let e of t)typeof e.onDidChange==`function`&&this.disposables.add(e.onDidChange(n))}compute(e){return FS(this.providers,this.editorModel,e).then(t=>this.editorModel.isDisposed()?null:t?LS(t,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(e)??null)}dispose(){this.disposables.dispose()}};function FS(e,t,n){let r=null,i=e.map((e,i)=>Promise.resolve(e.provideFoldingRanges(t,MS,n)).then(e=>{if(!n.isCancellationRequested&&Array.isArray(e)){Array.isArray(r)||(r=[]);let n=t.getLineCount();for(let t of e)t.start>0&&t.end>t.start&&t.end<=n&&r.push({start:t.start,end:t.end,rank:i,kind:t.kind})}},cc));return Promise.all(i).then(e=>r)}var IS=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,n,r){if(e>16777215||t>16777215)return;let i=this._length;this._startIndexes[i]=e,this._endIndexes[i]=t,this._nestingLevels[i]=r,this._types[i]=n,this._length++,r<30&&(this._nestingLevelCounts[r]=(this._nestingLevelCounts[r]||0)+1)}toIndentRanges(){let e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);let e=new Uint32Array(this._length),t=new Uint32Array(this._length);for(let n=0;n<this._length;n++)e[n]=this._startIndexes[n],t[n]=this._endIndexes[n];return new eS(e,t,this._types)}else{this._foldingRangesLimit.update(this._length,e);let t=0,n=this._nestingLevelCounts.length;for(let r=0;r<this._nestingLevelCounts.length;r++){let i=this._nestingLevelCounts[r];if(i){if(i+t>e){n=r;break}t+=i}}let r=new Uint32Array(e),i=new Uint32Array(e),a=[];for(let o=0,s=0;o<this._length;o++){let c=this._nestingLevels[o];(c<n||c===n&&t++<e)&&(r[s]=this._startIndexes[o],i[s]=this._endIndexes[o],a[s]=this._types[o],s++)}return new eS(r,i,a)}}};function LS(e,t){let n=e.sort((e,t)=>{let n=e.start-t.start;return n===0&&(n=e.rank-t.rank),n}),r=new IS(t),i,a=[];for(let e of n)if(!i)i=e,r.add(e.start,e.end,e.kind&&e.kind.value,a.length);else if(e.start>i.start)if(e.end<=i.end)a.push(i),i=e,r.add(e.start,e.end,e.kind&&e.kind.value,a.length);else{if(e.start>i.end){do i=a.pop();while(i&&e.start>i.end);i&&a.push(i),i=e}r.add(e.start,e.end,e.kind&&e.kind.value,a.length)}return r.toIndentRanges()}var RS=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zS=function(e,t){return function(n,r){t(n,r,e)}},BS,VS=new A(`foldingEnabled`,!1),HS=class extends j{static{BS=this}static{this.ID=`editor.contrib.folding`}static get(e){return e.getContribution(BS.ID)}static getFoldingRangeProviders(e,t){let n=e.foldingRangeProvider.ordered(t);return BS._foldingRangeSelector?.(n,t)??n}constructor(e,t,n,r,i,a){super(),this.contextKeyService=t,this.languageConfigurationService=n,this.languageFeaturesService=a,this.localToDispose=this._register(new S),this.editor=e,this._foldingLimitReporter=this._register(new US(e));let o=this.editor.getOptions();this._isEnabled=o.get(52),this._useFoldingProviders=o.get(53)!==`indentation`,this._unfoldOnClickAfterEndOfLine=o.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=o.get(55),this.updateDebounceInfo=i.for(a.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 jS(e),this.foldingDecorationProvider.showFoldingControls=o.get(126),this.foldingDecorationProvider.showFoldingHighlights=o.get(54),this.foldingEnabled=VS.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(e=>{if(e.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),e.hasChanged(56)&&this.onModelChanged(),e.hasChanged(126)||e.hasChanged(54)){let e=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=e.get(126),this.foldingDecorationProvider.showFoldingHighlights=e.get(54),this.triggerFoldingModelChanged()}e.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!==`indentation`,this.onFoldingStrategyChanged()),e.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),e.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}saveViewState(){let e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){let t=this.foldingModel.getMemento(),n=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:n,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){let 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();let e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new nS(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new mS(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(e=>this.onHiddenRangesChanges(e))),this.updateScheduler=new kc(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new Cl(()=>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(e=>this.onDidChangeModelContent(e))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(e=>this.onEditorMouseDown(e))),this.localToDispose.add(this.editor.onMouseUp(e=>this.onEditorMouseUp(e))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&=(this.foldingRegionPromise.cancel(),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;let t=new yS(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){let n=BS.getFoldingRangeProviders(this.languageFeaturesService,e);n.length>0&&(this.rangeProvider=new PS(e,n,()=>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(),null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{let e=this.foldingModel;if(!e)return null;let t=new ve,n=this.getRangeProvider(e.textModel),r=this.foldingRegionPromise=ql(e=>n.compute(e));return r.then(n=>{if(n&&r===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let e=n.setCollapsedAllOfType(wn.Imports.value,!0);e&&(r=ja.capture(this.editor),this._currentModelHasFoldedImports=e)}let i=this.editor.getSelections();e.update(n,GS(i)),r?.restore(this.editor);let a=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=a)}return e})}).then(void 0,e=>(Hc(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){let e=this.editor.getSelections();e&&this.hiddenRangeModel.adjustSelections(e)&&this.editor.setSelections(e)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){let e=this.getFoldingModel();e&&e.then(e=>{if(e){let t=this.editor.getSelections();if(t&&t.length>0){let n=[];for(let r of t){let t=r.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(t)&&n.push(...e.getAllRegionsAtLine(t,e=>e.isCollapsed&&t>e.startLineNumber))}n.length&&(e.toggleCollapseState(n),this.reveal(t[0].getPosition()))}}}).then(void 0,Hc)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;let t=e.target.range,n=!1;switch(e.target.type){case 4:{let t=e.target.detail,r=e.target.element.offsetLeft;if(t.offsetX-r<4)return;n=!0;break}case 7:if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return;case 6:if(this.hiddenRangeModel.hasRanges()){let e=this.editor.getModel();if(e&&t.startColumn===e.getLineMaxColumn(t.startLineNumber))break}return;default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:n}}onEditorMouseUp(e){let t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;let n=this.mouseDownInfo.lineNumber,r=this.mouseDownInfo.iconClicked,i=e.target.range;if(!i||i.startLineNumber!==n)return;if(r){if(e.target.type!==4)return}else{let e=this.editor.getModel();if(!e||i.startColumn!==e.getLineMaxColumn(n))return}let a=t.getRegionAtLine(n);if(a&&a.startLineNumber===n){let i=a.isCollapsed;if(r||i){let r=e.event.altKey,o=[];if(r){let e=t.getRegionsInside(null,e=>!e.containedBy(a)&&!a.containedBy(e));for(let t of e)t.isCollapsed&&o.push(t);o.length===0&&(o=e)}else{let n=e.event.middleButton||e.event.shiftKey;if(n)for(let e of t.getRegionsInside(a))e.isCollapsed===i&&o.push(e);(i||!n||o.length===0)&&o.push(a)}t.toggleCollapseState(o),this.reveal({lineNumber:n,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}};HS=BS=RS([zS(1,G),zS(2,eu),zS(3,di),zS(4,Sa),zS(5,q)],HS);var US=class extends j{constructor(e){super(),this.editor=e,this._onDidChange=this._register(new U),this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(56)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}},WS=class extends N{runEditorCommand(e,t,n){let r=e.get(eu),i=HS.get(t);if(!i)return;let a=i.getFoldingModel();if(a)return this.reportTelemetry(e,t),a.then(e=>{if(e){this.invoke(i,e,t,n,r);let a=t.getSelection();a&&i.reveal(a.getStartPosition())}})}getSelectedLines(e){let t=e.getSelections();return t?t.map(e=>e.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(e=>e+1):this.getSelectedLines(t)}run(e,t){}};function GS(e){return!e||e.length===0?{startsInside:()=>!1}:{startsInside(t,n){for(let r of e){let e=r.startLineNumber;if(e>=t&&e<=n)return!0}return!1}}}function KS(e){if(!fl(e)){if(!Il(e))return!1;let t=e;if(!fl(t.levels)&&!bo(t.levels)||!fl(t.direction)&&!bc(t.direction)||!fl(t.selectionLines)&&(!Array.isArray(t.selectionLines)||!t.selectionLines.every(bo)))return!1}return!0}var qS=class extends WS{constructor(){super({id:`editor.unfold`,label:J(1025,`Unfold`),precondition:VS,kbOpts:{kbExpr:z.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:
12
+ * 'levels': Number of levels to unfold. If not set, defaults to 1.
13
+ * 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
14
+ * '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.
15
+ `,constraint:KS,schema:{type:`object`,properties:{levels:{type:`number`,default:1},direction:{type:`string`,enum:[`up`,`down`],default:`down`},selectionLines:{type:`array`,items:{type:`number`}}}}}]}})}invoke(e,t,n,r){let i=r&&r.levels||1,a=this.getLineNumbers(r,n);r&&r.direction===`up`?aS(t,!1,i,a):iS(t,!1,i,a)}},JS=class extends WS{constructor(){super({id:`editor.unfoldRecursively`,label:J(1026,`Unfold Recursively`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2142),weight:100}})}invoke(e,t,n,r){iS(t,!1,Number.MAX_VALUE,this.getSelectedLines(n))}},YS=class extends WS{constructor(){super({id:`editor.fold`,label:J(1027,`Fold`),precondition:VS,kbOpts:{kbExpr:z.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:
16
+ * 'levels': Number of levels to fold.
17
+ * 'direction': If 'up', folds given number of levels up otherwise folds down.
18
+ * '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.
19
+ If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
20
+ `,constraint:KS,schema:{type:`object`,properties:{levels:{type:`number`},direction:{type:`string`,enum:[`up`,`down`]},selectionLines:{type:`array`,items:{type:`number`}}}}}]}})}invoke(e,t,n,r){let i=this.getLineNumbers(r,n),a=r&&r.levels,o=r&&r.direction;typeof a!=`number`&&typeof o!=`string`?oS(t,!0,i):o===`up`?aS(t,!0,a||1,i):iS(t,!0,a||1,i)}},XS=class extends WS{constructor(){super({id:`editor.toggleFold`,label:J(1028,`Toggle Fold`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2090),weight:100}})}invoke(e,t,n){rS(t,1,this.getSelectedLines(n))}},ZS=class extends WS{constructor(){super({id:`editor.foldRecursively`,label:J(1029,`Fold Recursively`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2140),weight:100}})}invoke(e,t,n){let r=this.getSelectedLines(n);iS(t,!0,Number.MAX_VALUE,r)}},QS=class extends WS{constructor(){super({id:`editor.toggleFoldRecursively`,label:J(1030,`Toggle Fold Recursively`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,3114),weight:100}})}invoke(e,t,n){let r=this.getSelectedLines(n);rS(t,Number.MAX_VALUE,r)}},$S=class extends WS{constructor(){super({id:`editor.foldAllBlockComments`,label:J(1031,`Fold All Block Comments`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2138),weight:100}})}invoke(e,t,n,r,i){if(t.regions.hasTypes())uS(t,wn.Comment.value,!0);else{let e=n.getModel();if(!e)return;let r=i.getLanguageConfiguration(e.getLanguageId()).comments;r&&r.blockCommentStartToken&&lS(t,RegExp(`^\\s*`+pi(r.blockCommentStartToken)),!0)}}},eC=class extends WS{constructor(){super({id:`editor.foldAllMarkerRegions`,label:J(1032,`Fold All Regions`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2077),weight:100}})}invoke(e,t,n,r,i){if(t.regions.hasTypes())uS(t,wn.Region.value,!0);else{let e=n.getModel();if(!e)return;let r=i.getLanguageConfiguration(e.getLanguageId()).foldingRules;r&&r.markers&&r.markers.start&&lS(t,new RegExp(r.markers.start),!0)}}},tC=class extends WS{constructor(){super({id:`editor.unfoldAllMarkerRegions`,label:J(1033,`Unfold All Regions`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2078),weight:100}})}invoke(e,t,n,r,i){if(t.regions.hasTypes())uS(t,wn.Region.value,!1);else{let e=n.getModel();if(!e)return;let r=i.getLanguageConfiguration(e.getLanguageId()).foldingRules;r&&r.markers&&r.markers.start&&lS(t,new RegExp(r.markers.start),!1)}}},nC=class extends WS{constructor(){super({id:`editor.foldAllExcept`,label:J(1034,`Fold All Except Selected`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2136),weight:100}})}invoke(e,t,n){cS(t,!0,this.getSelectedLines(n))}},rC=class extends WS{constructor(){super({id:`editor.unfoldAllExcept`,label:J(1035,`Unfold All Except Selected`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2134),weight:100}})}invoke(e,t,n){cS(t,!1,this.getSelectedLines(n))}},iC=class extends WS{constructor(){super({id:`editor.foldAll`,label:J(1036,`Fold All`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2069),weight:100}})}invoke(e,t,n){iS(t,!0)}},aC=class extends WS{constructor(){super({id:`editor.unfoldAll`,label:J(1037,`Unfold All`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2088),weight:100}})}invoke(e,t,n){iS(t,!1)}},oC=class e extends WS{static{this.ID_PREFIX=`editor.foldLevel`}static{this.ID=t=>e.ID_PREFIX+t}getFoldingLevel(){return parseInt(this.id.substr(e.ID_PREFIX.length))}invoke(e,t,n){sS(t,this.getFoldingLevel(),!0,this.getSelectedLines(n))}},sC=class extends WS{constructor(){super({id:`editor.gotoParentFold`,label:J(1038,`Go to Parent Fold`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,weight:100}})}invoke(e,t,n){let r=this.getSelectedLines(n);if(r.length>0){let e=dS(r[0],t);e!==null&&n.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}},cC=class extends WS{constructor(){super({id:`editor.gotoPreviousFold`,label:J(1039,`Go to Previous Folding Range`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,weight:100}})}invoke(e,t,n){let r=this.getSelectedLines(n);if(r.length>0){let e=fS(r[0],t);e!==null&&n.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}},lC=class extends WS{constructor(){super({id:`editor.gotoNextFold`,label:J(1040,`Go to Next Folding Range`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,weight:100}})}invoke(e,t,n){let r=this.getSelectedLines(n);if(r.length>0){let e=pS(r[0],t);e!==null&&n.setSelection({startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1})}}},uC=class extends WS{constructor(){super({id:`editor.createFoldingRangeFromSelection`,label:J(1041,`Create Folding Range from Selection`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2135),weight:100}})}invoke(e,t,n){let r=[],i=n.getSelections();if(i){for(let e of i){let t=e.endLineNumber;e.endColumn===1&&--t,t>e.startLineNumber&&(r.push({startLineNumber:e.startLineNumber,endLineNumber:t,type:void 0,isCollapsed:!0,source:1}),n.setSelection({startLineNumber:e.startLineNumber,startColumn:1,endLineNumber:e.startLineNumber,endColumn:1}))}if(r.length>0){r.sort((e,t)=>e.startLineNumber-t.startLineNumber);let e=eS.sanitizeAndMerge(t.regions,r,n.getModel()?.getLineCount());t.updatePost(eS.fromFoldRanges(e))}}}},dC=class extends WS{constructor(){super({id:`editor.removeManualFoldingRanges`,label:J(1042,`Remove Manual Folding Ranges`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2137),weight:100}})}invoke(e,t,n){let r=n.getSelections();if(r){let n=[];for(let e of r){let{startLineNumber:t,endLineNumber:r}=e;n.push(r>=t?{startLineNumber:t,endLineNumber:r}:{endLineNumber:r,startLineNumber:t})}t.removeManualRanges(n),e.triggerFoldingModelChanged()}}},fC=class extends WS{constructor(){super({id:`editor.toggleImportFold`,label:J(1043,`Toggle Import Fold`),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,weight:100}})}async invoke(e,t){let n=[],r=t.regions;for(let e=r.length-1;e>=0;e--)r.getType(e)===wn.Imports.value&&n.push(r.toRegion(e));t.toggleCollapseState(n),e.triggerFoldingModelChanged()}};F(HS.ID,HS,0),O(qS),O(JS),O(YS),O(ZS),O(QS),O(iC),O(aC),O($S),O(eC),O(tC),O(nC),O(rC),O(XS),O(sC),O(cC),O(lC),O(uC),O(dC),O(fC);for(let e=1;e<=7;e++)da(new oC({id:oC.ID(e),label:J(1044,`Fold Level {0}`,e),precondition:VS,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2048|21+e),weight:100}}));jn.registerCommand(`_executeFoldingRangeProvider`,async function(e,...t){let[n]=t;if(!(n instanceof On))throw so();let r=e.get(q),i=e.get(yt).getModel(n);if(!i)throw so();let a=e.get(xa);if(!a.getValue(`editor.folding`,{resource:n}))return[];let o=e.get(eu),s=a.getValue(`editor.foldingStrategy`,{resource:n}),c={get limit(){return a.getValue(`editor.foldingMaximumRegions`,{resource:n})},update:(e,t)=>{}},l=new yS(i,o,c),u=l;if(s!==`indentation`){let e=HS.getFoldingRangeProviders(r,i);e.length&&(u=new PS(i,e,()=>{},c,l))}let d=await u.compute(B.None),f=[];try{if(d)for(let e=0;e<d.length;e++){let t=d.getType(e);f.push({start:d.getStartLineNumber(e),end:d.getEndLineNumber(e),kind:t?wn.fromValue(t):void 0})}return f}finally{u.dispose()}});var pC=class extends N{constructor(){super({id:`editor.action.fontZoomIn`,label:J(1054,`Increase Editor Font Size`),precondition:void 0})}run(e,t){ia.setZoomLevel(ia.getZoomLevel()+1)}},mC=class extends N{constructor(){super({id:`editor.action.fontZoomOut`,label:J(1055,`Decrease Editor Font Size`),precondition:void 0})}run(e,t){ia.setZoomLevel(ia.getZoomLevel()-1)}},hC=class extends N{constructor(){super({id:`editor.action.fontZoomReset`,label:J(1056,`Reset Editor Font Size`),precondition:void 0})}run(e,t){ia.setZoomLevel(0)}};O(pC),O(mC),O(hC);var gC=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},_C=function(e,t){return function(n,r){t(n,r,e)}},vC=class{static{this.ID=`editor.contrib.autoFormat`}constructor(e,t,n,r){this._editor=e,this._languageFeaturesService=t,this._workerService=n,this._accessibilitySignalService=r,this._disposables=new S,this._sessionDisposables=new S,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(e=>{e.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;let e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;let n=new En;for(let e of t.autoFormatTriggerCharacters)n.add(e.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(e=>{let t=e.charCodeAt(e.length-1);n.has(t)&&this._trigger(String.fromCharCode(t))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;let t=this._editor.getModel(),n=this._editor.getPosition(),r=new ou,i=this._editor.onDidChangeModelContent(e=>{if(e.isFlush){r.cancel(),i.dispose();return}for(let t=0,a=e.changes.length;t<a;t++)if(e.changes[t].range.endLineNumber<=n.lineNumber){r.cancel(),i.dispose();return}});Ju(this._workerService,this._languageFeaturesService,t,n,e,t.getFormattingOptions(),r.token).then(e=>{r.token.isCancellationRequested||Fu(e)&&(this._accessibilitySignalService.playSignal(po.format,{userGesture:!1}),re.execute(this._editor,e,!0))}).finally(()=>{i.dispose()})}};vC=gC([_C(1,q),_C(2,$i),_C(3,Lo)],vC);var yC=class{static{this.ID=`editor.contrib.formatOnPaste`}constructor(e,t,n){this.editor=e,this._languageFeaturesService=t,this._instantiationService=n,this._callOnDispose=new S,this._callOnModel=new S,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(on,this.editor,e,2,eo.None,B.None,!1).catch(Hc))}};yC=gC([_C(1,q),_C(2,w)],yC);var bC=class extends N{constructor(){super({id:`editor.action.formatDocument`,label:J(1057,`Format Document`),precondition:m.and(z.notInCompositeEditor,z.writable,z.hasDocumentFormattingProvider),kbOpts:{kbExpr:z.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:`1_modification`,order:1.3}})}async run(e,t){if(t.hasModel()){let n=e.get(w);await e.get(Fc).showWhile(n.invokeFunction(Cr,t,1,eo.None,B.None,!0),250)}}},xC=class extends N{constructor(){super({id:`editor.action.formatSelection`,label:J(1058,`Format Selection`),precondition:m.and(z.writable,z.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2084),weight:100},contextMenuOpts:{when:z.hasNonEmptySelection,group:`1_modification`,order:1.31}})}async run(e,t){if(!t.hasModel())return;let n=e.get(w),r=t.getModel(),i=t.getSelections().map(e=>e.isEmpty()?new T(e.startLineNumber,1,e.startLineNumber,r.getLineMaxColumn(e.startLineNumber)):e);await e.get(Fc).showWhile(n.invokeFunction(on,t,i,1,eo.None,B.None,!0),250)}};F(vC.ID,vC,2),F(yC.ID,yC,2),O(bC),O(xC),jn.registerCommand(`editor.action.format`,async e=>{let t=e.get(Di).getFocusedCodeEditor();if(!t||!t.hasModel())return;let n=e.get(tr);t.getSelection().isEmpty()?await n.executeCommand(`editor.action.formatDocument`):await n.executeCommand(`editor.action.formatSelection`)});var SC=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},CC=function(e,t){return function(n,r){t(n,r,e)}},wC=class{remove(){this.parent?.children.delete(this.id)}static findId(e,t){let n;typeof e==`string`?n=`${t.id}/${e}`:(n=`${t.id}/${e.name}`,t.children.get(n)!==void 0&&(n=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let r=n;for(let e=0;t.children.get(r)!==void 0;e++)r=`${n}_${e}`;return r}static empty(e){return e.children.size===0}},TC=class extends wC{constructor(e,t,n){super(),this.id=e,this.parent=t,this.symbol=n,this.children=new Map}},EC=class extends wC{constructor(e,t,n,r){super(),this.id=e,this.parent=t,this.label=n,this.order=r,this.children=new Map}},DC=class e extends wC{static create(t,n,r){let i=new ou(r),a=new e(n.uri),o=t.ordered(n),s=o.map((t,r)=>{let o=wC.findId(`provider_${r}`,a),s=new EC(o,a,t.displayName??`Unknown Outline Provider`,r);return Promise.resolve(t.provideDocumentSymbols(n,i.token)).then(t=>{for(let n of t||[])e._makeOutlineElement(n,s);return s},e=>(cc(e),s)).then(e=>{wC.empty(e)?e.remove():a._groups.set(o,e)})}),c=t.onDidChange(()=>{pu(t.ordered(n),o)||i.cancel()});return Promise.all(s).then(()=>i.token.isCancellationRequested&&!r.isCancellationRequested?e.create(t,n,r):a._compact()).finally(()=>{i.dispose(),c.dispose(),i.dispose()})}static _makeOutlineElement(t,n){let r=new TC(wC.findId(t,n),n,t);if(t.children)for(let n of t.children)e._makeOutlineElement(n,r);n.children.set(r.id,r)}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(let[t,n]of this._groups)n.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{let e=Mn.first(this._groups.values());for(let[,t]of e.children)t.parent=this,this.children.set(t.id,t)}return this}getTopLevelSymbols(){let e=[];for(let t of this.children.values())t instanceof TC?e.push(t.symbol):e.push(...Mn.map(t.children.values(),e=>e.symbol));return e.sort((e,t)=>T.compareRangesUsingStarts(e.range,t.range))}asListOfDocumentSymbols(){let t=this.getTopLevelSymbols(),n=[];return e._flattenDocumentSymbols(n,t,``),n.sort((e,t)=>M.compare(T.getStartPosition(e.range),T.getStartPosition(t.range))||M.compare(T.getEndPosition(t.range),T.getEndPosition(e.range)))}static _flattenDocumentSymbols(t,n,r){for(let i of n)t.push({kind:i.kind,tags:i.tags,name:i.name,detail:i.detail,containerName:i.containerName||r,range:i.range,selectionRange:i.selectionRange,children:void 0}),i.children&&e._flattenDocumentSymbols(t,i.children,i.name)}},OC=Xt(`IOutlineModelService`),kC=class{constructor(e,t,n){this._languageFeaturesService=e,this._disposables=new S,this._cache=new Uo(15,.7),this._debounceInformation=t.for(e.documentSymbolProvider,`DocumentSymbols`,{min:350}),this._disposables.add(n.onModelRemoved(e=>{this._cache.delete(e.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){let n=this._languageFeaturesService.documentSymbolProvider,r=n.ordered(e),i=this._cache.get(e.id);if(!i||i.versionId!==e.getVersionId()||!pu(i.provider,r)){let t=new ou;i={versionId:e.getVersionId(),provider:r,promiseCnt:0,source:t,promise:DC.create(n,e,t.token),model:void 0},this._cache.set(e.id,i);let a=Date.now();i.promise.then(t=>{i.model=t,this._debounceInformation.update(e,Date.now()-a)}).catch(t=>{this._cache.delete(e.id)})}if(i.model)return i.model;i.promiseCnt+=1;let a=t.onCancellationRequested(()=>{--i.promiseCnt===0&&(i.source.cancel(),this._cache.delete(e.id))});try{return await i.promise}finally{a.dispose()}}};kC=SC([CC(0,q),CC(1,Sa),CC(2,yt)],kC),us(OC,kC,1),jn.registerCommand(`_executeDocumentSymbolProvider`,async function(e,...t){let[n]=t;Bi(On.isUri(n));let r=e.get(OC),i=await e.get(gi).createModelReference(n);try{return(await r.getOrCreate(i.object.textEditorModel,B.None)).getTopLevelSymbols()}finally{i.dispose()}});var AC=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{let t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}},jC=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},MC=function(e,t){return function(n,r){t(n,r,e)}};function NC(e){return e instanceof PC?e._instance:e}var PC=class{constructor(e){this.instantiationService=e}init(...e){}};function FC(e){return e.get()}var IC=class extends PC{constructor(e,t){super(t),this.init(e)}};IC=jC([MC(1,w)],IC);var LC=class{validateOrThrow(e){let t=this.validate(e);if(t.error)throw Error(t.error.message);return t.content}},RC=class extends LC{constructor(e){super(),this.type=e}validate(e){return typeof e===this.type?{content:e,error:void 0}:{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof e}`}}}getJSONSchema(){return{type:this.type}}},zC=new RC(`string`);function BC(){return zC}new RC(`number`);var VC=new RC(`boolean`);function HC(){return VC}new RC(`object`);var UC=class extends LC{validate(e){return{content:e,error:void 0}}getJSONSchema(){return{}}};function WC(){return new UC}var GC=class extends LC{validate(e){return e===void 0?{content:void 0,error:void 0}:{content:void 0,error:{message:`Expected undefined, but got ${typeof e}`}}}getJSONSchema(){return{}}};function KC(){return new GC}var qC=class{constructor(e){this.validator=e}};function JC(e){return new qC(e)}var YC=class extends LC{constructor(e){super(),this.properties=e}validate(e){if(typeof e!=`object`||!e)return{content:void 0,error:{message:`Expected object`}};let t={};for(let n in this.properties){let r=this.properties[n],i=e[n],a=r instanceof qC,o=a?r.validator:r;if(a&&i===void 0)continue;let{content:s,error:c}=o.validate(i);if(c)return{content:void 0,error:{message:`Error in property '${n}': ${c.message}`}};t[n]=s}return{content:t,error:void 0}}getJSONSchema(){let e=[],t={};for(let[n,r]of Object.entries(this.properties)){let i=r instanceof qC;t[n]=(i?r.validator:r).getJSONSchema(),i||e.push(n)}return{type:`object`,properties:t,...e.length>0?{required:e}:{}}}};function XC(e){return new YC(e)}var ZC=class extends LC{constructor(e){super(),this.validators=e}validate(e){let t;for(let n of this.validators){let{content:r,error:i}=n.validate(e);if(!i)return{content:r,error:void 0};t=i}return{content:void 0,error:t}}getJSONSchema(){return{oneOf:Kr(this.validators,e=>{if(!(e instanceof GC))return e.getJSONSchema()})}}};function QC(...e){return new ZC(e)}var $C=class extends LC{constructor(e,t){super(),this._ref=e,this._validator=t}validate(e){return this._validator.validate(e)}getJSONSchema(){return{$ref:this._ref}}};function ew(e,t){return new $C(e,t)}var Q={Visible:Bg,HasFocusedSuggestion:new A(`suggestWidgetHasFocusedSuggestion`,!1,V(1505,`Whether any suggestion is focused`)),DetailsVisible:new A(`suggestWidgetDetailsVisible`,!1,V(1506,`Whether suggestion details are visible`)),DetailsFocused:new A(`suggestWidgetDetailsFocused`,!1,V(1507,`Whether the details pane of the suggest widget has focus`)),MultipleSuggestions:new A(`suggestWidgetMultipleSuggestions`,!1,V(1508,`Whether there are multiple suggestions to pick from`)),MakesTextEdit:new A(`suggestionMakesTextEdit`,!0,V(1509,`Whether inserting the current suggestion yields in a change or has everything already been typed`)),AcceptSuggestionsOnEnter:new A(`acceptSuggestionOnEnter`,!0,V(1510,`Whether suggestions are inserted when pressing Enter`)),HasInsertAndReplaceRange:new A(`suggestionHasInsertAndReplaceRange`,!1,V(1511,`Whether the current suggestion has insert and replace behaviour`)),InsertMode:new A(`suggestionInsertMode`,void 0,{type:`string`,description:V(1512,`Whether the default behaviour is to insert or replace`)}),CanResolve:new A(`suggestionCanResolve`,!1,V(1513,`Whether the current suggestion supports to resolve further details`))},tw=new Z(`suggestWidgetStatusBar`),nw=class{constructor(e,t,n,r){this.position=e,this.completion=t,this.container=n,this.provider=r,this.isInvalid=!1,this.score=Ut.Default,this.distance=0,this.textLabel=typeof t.label==`string`?t.label:t.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,T.isIRange(t.range)?(this.editStart=new M(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new M(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new M(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||T.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new M(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new M(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new M(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||T.spansMultipleLines(t.range.insert)||T.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof r.resolveCompletionItem!=`function`&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration===void 0?-1:this._resolveDuration}async resolve(e){if(!this._resolveCache){let t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),n=new ve(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(e=>{Object.assign(this.completion,e),this._resolveDuration=n.elapsed()},e=>{Mo(e)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}},rw=class e{static{this.default=new e}constructor(e=2,t=new Set,n=new Set,r=new Map,i=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=n,this.providerItemsToReuse=r,this.showDeprecated=i}},iw=class{constructor(e,t,n,r){this.items=e,this.needsClipboard=t,this.durations=n,this.disposable=r}};async function aw(e,t,n,r=rw.default,i={triggerKind:0},a=B.None){let o=new ve;n=n.clone();let s=t.getWordAtPosition(n),c=s?new T(n.lineNumber,s.startColumn,n.lineNumber,s.endColumn):T.fromPositions(n),l={replace:c,insert:c.setEndPosition(n.lineNumber,n.column)},u=[],d=new S,f=[],p=!1,m=(e,t,i)=>{let a=!1;if(!t)return a;for(let i of t.suggestions)if(!r.kindFilter.has(i.kind)){if(!r.showDeprecated&&i?.tags?.includes(1))continue;i.range||=l,i.sortText||=typeof i.label==`string`?i.label:i.label.label,!p&&i.insertTextRules&&i.insertTextRules&4&&(p=yf.guessNeedsClipboard(i.insertText)),u.push(new nw(n,i,t,e)),a=!0}return Es(t)&&d.add(t),f.push({providerName:e._debugDisplayName??`unknown_provider`,elapsedProvider:t.duration??-1,elapsedOverall:i.elapsed()}),a},h=(async()=>{})();for(let o of e.orderedGroups(t)){let e=!1;if(await Promise.all(o.map(async o=>{if(r.providerItemsToReuse.has(o)){let t=r.providerItemsToReuse.get(o);t.forEach(e=>u.push(e)),e||=t.length>0;return}if(!(r.providerFilter.size>0&&!r.providerFilter.has(o)))try{let r=new ve;e=m(o,await o.provideCompletionItems(t,n,i,a),r)||e}catch(e){cc(e)}})),e||a.isCancellationRequested)break}return await h,a.isCancellationRequested?(d.dispose(),Promise.reject(new Jl)):new iw(u.sort(uw(r.snippetSortOrder)),p,{entries:f,elapsed:o.elapsed()},d)}function ow(e,t){if(e.sortTextLow&&t.sortTextLow){if(e.sortTextLow<t.sortTextLow)return-1;if(e.sortTextLow>t.sortTextLow)return 1}return e.textLabel<t.textLabel?-1:e.textLabel>t.textLabel?1:e.completion.kind-t.completion.kind}function sw(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return-1;if(t.completion.kind===28)return 1}return ow(e,t)}function cw(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return 1;if(t.completion.kind===28)return-1}return ow(e,t)}var lw=new Map;lw.set(0,sw),lw.set(2,cw),lw.set(1,ow);function uw(e){return lw.get(e)}jn.registerCommand(`_executeCompletionItemProvider`,async(e,...t)=>{let[n,r,i,a]=t;Bi(On.isUri(n)),Bi(M.isIPosition(r)),Bi(typeof i==`string`||!i),Bi(typeof a==`number`||!a);let{completionProvider:o}=e.get(q),s=await e.get(gi).createModelReference(n);try{let e={incomplete:!1,suggestions:[]},t=[],n=s.object.textEditorModel.validatePosition(r),c=await aw(o,s.object.textEditorModel,n,void 0,{triggerCharacter:i??void 0,triggerKind:+!!i});for(let n of c.items)t.length<(a??0)&&t.push(n.resolve(B.None)),e.incomplete=e.incomplete||n.container.incomplete,e.suggestions.push(n.completion);try{return await Promise.all(t),e}finally{setTimeout(()=>c.disposable.dispose(),100)}}finally{s.dispose()}});function dw(e,t){e.getContribution(`editor.contrib.suggestController`)?.triggerSuggest(new Set().add(t),void 0,!0)}var fw=class{static isAllOff(e){return e.other===`off`&&e.comments===`off`&&e.strings===`off`}static isAllOn(e){return e.other===`on`&&e.comments===`on`&&e.strings===`on`}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}},pw=class{static{this.inlineSuggestionVisible=new A(`inlineSuggestionVisible`,!1,V(1234,`Whether an inline suggestion is visible`))}static{this.inlineSuggestionAlternativeActionVisible=new A(`inlineSuggestionAlternativeActionVisible`,!1,V(1235,`Whether an alternative action for the inline suggestion is visible.`))}static{this.inlineSuggestionHasIndentation=new A(`inlineSuggestionHasIndentation`,!1,V(1236,`Whether the inline suggestion starts with whitespace`))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new A(`inlineSuggestionHasIndentationLessThanTabSize`,!0,V(1237,`Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab`))}static{this.suppressSuggestions=new A(`inlineSuggestionSuppressSuggestions`,void 0,V(1238,`Whether suggestions should be suppressed for the current suggestion`))}static{this.cursorBeforeGhostText=new A(`cursorBeforeGhostText`,!1,V(1239,`Whether the cursor is at ghost text`))}static{this.cursorInIndentation=new A(`cursorInIndentation`,!1,V(1240,`Whether the cursor is in indentation`))}static{this.hasSelection=new A(`editor.hasSelection`,!1,V(1241,`Whether the editor has a selection`))}static{this.cursorAtInlineEdit=new A(`cursorAtInlineEdit`,!1,V(1242,`Whether the cursor is at an inline edit`))}static{this.inlineEditVisible=new A(`inlineEditIsVisible`,!1,V(1243,`Whether an inline edit is visible`))}static{this.tabShouldJumpToInlineEdit=new A(`tabShouldJumpToInlineEdit`,!1,V(1244,`Whether tab should jump to an inline edit.`))}static{this.tabShouldAcceptInlineEdit=new A(`tabShouldAcceptInlineEdit`,!1,V(1245,`Whether tab should accept the inline edit.`))}static{this.inInlineEditsPreviewEditor=new A(`inInlineEditsPreviewEditor`,!0,V(1246,`Whether the current code editor is showing an inline edits preview`))}},mw=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},hw=function(e,t){return function(n,r){t(n,r,e)}},gw=class{constructor(e,t,n){this.marker=e,this.index=t,this.total=n}},_w=class{constructor(e,t,n){this._markerService=t,this._configService=n,this._onDidChange=new U,this.onDidChange=this._onDidChange.event,this._dispoables=new S,this._markers=[],this._nextIdx=-1,On.isUri(e)?this._resourceFilter=t=>t.toString()===e.toString():e&&(this._resourceFilter=e);let r=this._configService.getValue(`problems.sortOrder`),i=(e,t)=>{let n=ad(e.resource.toString(),t.resource.toString());return n===0&&(n=r===`position`?T.compareRangesUsingStarts(e,t)||Pu.compare(e.severity,t.severity):Pu.compare(e.severity,t.severity)||T.compareRangesUsingStarts(e,t)),n},a=()=>{let t=this._markerService.read({resource:On.isUri(e)?e:void 0,severities:Pu.Error|Pu.Warning|Pu.Info});return typeof e==`function`&&(t=t.filter(e=>this._resourceFilter(e.resource))),t.sort(i),pu(t,this._markers,(e,t)=>e.resource.toString()===t.resource.toString()&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn&&e.severity===t.severity&&e.message===t.message)?!1:(this._markers=t,!0)};a(),this._dispoables.add(t.onMarkerChanged(e=>{(!this._resourceFilter||e.some(e=>this._resourceFilter(e)))&&a()&&(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(){let e=this._markers[this._nextIdx];return e&&new gw(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,n){let r=this._markers.findIndex(t=>ao(t.resource,e.uri));if(r<0)r=Bo(this._markers.length,t=>ad(this._markers[t].resource.toString(),e.uri.toString())),r<0&&(r=~r),n?this._nextIdx=r:this._nextIdx=(this._markers.length+r-1)%this._markers.length;else{let i=!1,a=!1;for(let n=r;n<this._markers.length;n++){let r=T.lift(this._markers[n]);if(r.isEmpty()){let t=e.getWordAtPosition(r.getStartPosition());t&&(r=new T(r.startLineNumber,t.startColumn,r.startLineNumber,t.endColumn))}if(t&&(r.containsPosition(t)||t.isBeforeOrEqual(r.getStartPosition()))){this._nextIdx=n,i=!0,a=!r.containsPosition(t);break}if(this._markers[n].resource.toString()!==e.uri.toString())break}i?a&&!n&&--this._nextIdx:this._nextIdx=n?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,n){if(this._markers.length===0)return!1;let r=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,n,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),r!==this._nextIdx}find(e,t){let n=this._markers.findIndex(t=>t.resource.toString()===e.toString());if(!(n<0)){for(;n<this._markers.length;n++)if(T.containsPosition(this._markers[n],t))return new gw(this._markers[n],n+1,this._markers.length)}}};_w=mw([hw(1,Wa),hw(2,xa)],_w);var vw=Xt(`IMarkerNavigationService`),yw=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new _u}getMarkerList(e){for(let t of this._provider){let n=t.getMarkerList(e);if(n)return n}return new _w(e,this._markerService,this._configService)}};yw=mw([hw(0,Wa),hw(1,xa)],yw),us(vw,yw,1);var bw;(function(e){function t(e){switch(e){case pt.Ignore:return`severity-ignore `+C.asClassName(D.info);case pt.Info:return C.asClassName(D.info);case pt.Warning:return C.asClassName(D.warning);case pt.Error:return C.asClassName(D.error);default:return``}}e.className=t})(bw||={});var xw=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Sw=function(e,t){return function(n,r){t(n,r,e)}},Cw,ww=class{constructor(e,t,n,r,i){this._openerService=r,this._labelService=i,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new S,this._editor=t;let a=document.createElement(`div`);a.className=`descriptioncontainer`,this._messageBlock=document.createElement(`div`),this._messageBlock.classList.add(`message`),this._messageBlock.setAttribute(`aria-live`,`assertive`),this._messageBlock.setAttribute(`role`,`alert`),a.appendChild(this._messageBlock),this._relatedBlock=document.createElement(`div`),a.appendChild(this._relatedBlock),this._disposables.add(vs(this._relatedBlock,`click`,e=>{e.preventDefault();let t=this._relatedDiagnostics.get(e.target);t&&n(t)})),this._scrollable=new Bu(a,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(e=>{a.style.left=`-${e.scrollLeft}px`,a.style.top=`-${e.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){h(this._disposables)}update(e){let{source:t,message:n,relatedInformation:r,code:i}=e,a=(t?.length||0)+2;i&&(typeof i==`string`?a+=i.length:a+=i.value.length);let o=yo(n);this._lines=o.length,this._longestLineLength=0;for(let e of o)this._longestLineLength=Math.max(e.length+a,this._longestLineLength);Mc(this._messageBlock),this._messageBlock.setAttribute(`aria-label`,this.getAriaLabel(e)),zt(this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let s=this._messageBlock;for(let e of o)s=document.createElement(`div`),s.innerText=e,e===``&&(s.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(s);if(t||i){let e=document.createElement(`span`);if(e.classList.add(`details`),s.appendChild(e),t){let n=document.createElement(`span`);n.innerText=t,n.classList.add(`source`),e.appendChild(n)}if(i)if(typeof i==`string`){let t=document.createElement(`span`);t.innerText=`(${i})`,t.classList.add(`code`),e.appendChild(t)}else{this._codeLink=I(`a.code-link`),this._codeLink.setAttribute(`href`,`${i.target.toString()}`),this._codeLink.onclick=e=>{this._openerService.open(i.target,{allowCommands:!0}),e.preventDefault(),e.stopPropagation()};let t=H(this._codeLink,I(`span`));t.innerText=i.value,e.appendChild(this._codeLink)}}if(Mc(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Fu(r)){let e=this._relatedBlock.appendChild(document.createElement(`div`));e.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(let t of r){let n=document.createElement(`div`),r=document.createElement(`a`);r.classList.add(`filename`),r.innerText=`${this._labelService.getUriBasenameLabel(t.resource)}(${t.startLineNumber}, ${t.startColumn}): `,r.title=this._labelService.getUriLabel(t.resource),this._relatedDiagnostics.set(r,t);let i=document.createElement(`span`);i.innerText=t.message,n.appendChild(r),n.appendChild(i),this._lines+=1,e.appendChild(n)}}let c=this._editor.getOption(59),l=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),u=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:l,scrollHeight:u})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t=``;switch(e.severity){case Pu.Error:t=V(1067,`Error`);break;case Pu.Warning:t=V(1068,`Warning`);break;case Pu.Info:t=V(1069,`Info`);break;case Pu.Hint:t=V(1070,`Hint`);break}let n=V(1071,`{0}: {1} at {2}. `,t,e.message,e.startLineNumber+`:`+e.startColumn),r=this._editor.getModel();return r&&e.startLineNumber<=r.getLineCount()&&e.startLineNumber>=1&&(n=`${r.getLineContent(e.startLineNumber)}, ${n}`),n}},Tw=class extends Gv{static{Cw=this}static{this.TitleMenu=new Z(`gotoErrorTitleMenu`)}constructor(e,t,n,r,i,a,o){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},i),this._themeService=t,this._openerService=n,this._menuService=r,this._contextKeyService=a,this._labelService=o,this._callOnDispose=new S,this._onDidSelectRelatedInformation=new U,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=Pu.Warning,this._backgroundColor=W.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(Fw);let t=kw,n=Aw;this._severity===Pu.Warning?(t=jw,n=Mw):this._severity===Pu.Info&&(t=Nw,n=Pw);let r=e.getColor(t),i=e.getColor(n);this.style({arrowColor:r,frameColor:r,headerBackgroundColor:i,primaryHeadingColor:e.getColor(qv),secondaryHeadingColor:e.getColor(Jv)})}_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(e=>this.editor.focus()));let t=Nc(this._menuService.getMenuActions(Cw.TitleMenu,this._contextKeyService));this._actionbarWidget.push(t,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=H(e,I(``))}_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 ww(this._container,this.editor,e=>this._onDidSelectRelatedInformation.fire(e),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw Error(`call showAtMarker`)}showAtMarker(e,t,n){this._container.classList.remove(`stale`),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());let r=T.lift(e),i=this.editor.getPosition(),a=i&&r.containsPosition(i)?i:r.getStartPosition();super.show(a,this.computeRequiredHeight());let o=this.editor.getModel();if(o){let e=n>1?V(1072,`{0} of {1} problems`,t,n):V(1073,`{0} of {1} problem`,t,n);this.setTitle(Oc(o.uri),e)}this._icon.className=`codicon ${bw.className(Pu.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(a,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()}};Tw=Cw=xw([Sw(1,Ll),Sw(2,gn),Sw(3,La),Sw(4,w),Sw(5,G),Sw(6,mi)],Tw);var Ew=Xe(i,hr),Dw=Xe(Ia,Lu),Ow=Xe(Gl,qs),kw=E(`editorMarkerNavigationError.background`,{dark:Ew,light:Ew,hcDark:Is,hcLight:Is},V(1074,`Editor marker navigation widget error color.`)),Aw=E(`editorMarkerNavigationError.headerBackground`,{dark:sn(kw,.1),light:sn(kw,.1),hcDark:null,hcLight:null},V(1075,`Editor marker navigation widget error heading background.`)),jw=E(`editorMarkerNavigationWarning.background`,{dark:Dw,light:Dw,hcDark:Is,hcLight:Is},V(1076,`Editor marker navigation widget warning color.`)),Mw=E(`editorMarkerNavigationWarning.headerBackground`,{dark:sn(jw,.1),light:sn(jw,.1),hcDark:`#0C141F`,hcLight:sn(jw,.2)},V(1077,`Editor marker navigation widget warning heading background.`)),Nw=E(`editorMarkerNavigationInfo.background`,{dark:Ow,light:Ow,hcDark:Is,hcLight:Is},V(1078,`Editor marker navigation widget info color.`)),Pw=E(`editorMarkerNavigationInfo.headerBackground`,{dark:sn(Nw,.1),light:sn(Nw,.1),hcDark:null,hcLight:null},V(1079,`Editor marker navigation widget info heading background.`)),Fw=E(`editorMarkerNavigation.background`,sa,V(1080,`Editor marker navigation widget background.`)),Iw=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Lw=function(e,t){return function(n,r){t(n,r,e)}},Rw,zw=class{static{Rw=this}static{this.ID=`editor.contrib.markerController`}static get(e){return e.getContribution(Rw.ID)}constructor(e,t,n,r,i){this._markerNavigationService=t,this._contextKeyService=n,this._editorService=r,this._instantiationService=i,this._sessionDispoables=new S,this._editor=e,this._widgetVisible=Gw.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(Tw,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(e=>{(!this._model?.selected||!T.containsPosition(this._model?.selected.marker,e.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;let e=this._model.find(this._editor.getModel().uri,this._widget.position);e?this._widget.updateMarker(e.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(e=>{this._editorService.openCodeEditor({resource:e.resource,options:{pinned:!0,revealIfOpened:!0,selection:T.lift(e).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;let t=this._editor.getModel(),n=this._getOrCreateModel(t.uri);n.resetIndex(),n.move(!0,t,new M(e.startLineNumber,e.startColumn)),n.selected&&this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}async navigate(e,t){if(!this._editor.hasModel())return;let n=this._editor.getModel(),r=this._getOrCreateModel(t?void 0:n.uri);if(r.move(e,n,this._editor.getPosition()),r.selected)if(r.selected.marker.resource.toString()!==n.uri.toString()){this._cleanUp();let n=await this._editorService.openCodeEditor({resource:r.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:r.selected.marker}},this._editor);n&&(Rw.get(n)?.close(),Rw.get(n)?.navigate(e,t))}else this._widget.showAtMarker(r.selected.marker,r.selected.index,r.selected.total)}};zw=Rw=Iw([Lw(1,vw),Lw(2,G),Lw(3,Di),Lw(4,w)],zw);var Bw=class extends N{constructor(e,t,n){super(n),this._next=e,this._multiFile=t}async run(e,t){t.hasModel()&&await zw.get(t)?.navigate(this._next,this._multiFile)}},Vw=class e extends Bw{static{this.ID=`editor.action.marker.next`}static{this.LABEL=J(1063,`Go to Next Problem (Error, Warning, Info)`)}constructor(){super(!0,!1,{id:e.ID,label:e.LABEL,precondition:void 0,kbOpts:{kbExpr:z.focus,primary:578,weight:100},menuOpts:{menuId:Tw.TitleMenu,title:e.LABEL.value,icon:Vs(`marker-navigation-next`,D.arrowDown,V(1059,`Icon for goto next marker.`)),group:`navigation`,order:1}})}},Hw=class e extends Bw{static{this.ID=`editor.action.marker.prev`}static{this.LABEL=J(1064,`Go to Previous Problem (Error, Warning, Info)`)}constructor(){super(!1,!1,{id:e.ID,label:e.LABEL,precondition:void 0,kbOpts:{kbExpr:z.focus,primary:1602,weight:100},menuOpts:{menuId:Tw.TitleMenu,title:e.LABEL.value,icon:Vs(`marker-navigation-previous`,D.arrowUp,V(1060,`Icon for goto previous marker.`)),group:`navigation`,order:2}})}},Uw=class e extends Bw{static{this.ID=`editor.action.marker.nextInFiles`}constructor(){super(!0,!0,{id:e.ID,label:J(1065,`Go to Next Problem in Files (Error, Warning, Info)`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:66,weight:100},menuOpts:{menuId:Z.MenubarGoMenu,title:V(1061,`Next &&Problem`),group:`6_problem_nav`,order:1}})}},Ww=class e extends Bw{static{this.ID=`editor.action.marker.prevInFiles`}constructor(){super(!1,!0,{id:e.ID,label:J(1066,`Go to Previous Problem in Files (Error, Warning, Info)`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:1090,weight:100},menuOpts:{menuId:Z.MenubarGoMenu,title:V(1062,`Previous &&Problem`),group:`6_problem_nav`,order:2}})}};F(zw.ID,zw,4),O(Vw),O(Hw),O(Uw),O(Ww);var Gw=new A(`markersNavigationVisible`,!1);R(new(mt.bindToContribution(zw.get))({id:`closeMarkersNavigation`,precondition:Gw,handler:e=>e.close(),kbOpts:{weight:150,kbExpr:z.focus,primary:9,secondary:[1033]}}));var Kw=class{constructor(e,t,n){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=n}getEditOperations(e,t){let n=qw(e,this._cursors,this._trimInRegexesAndStrings);for(let e=0,r=n.length;e<r;e++){let r=n[e];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}};function qw(e,t,n){t.sort((e,t)=>e.lineNumber===t.lineNumber?e.column-t.column:e.lineNumber-t.lineNumber);for(let e=t.length-2;e>=0;e--)t[e].lineNumber===t[e+1].lineNumber&&t.splice(e,1);let r=[],i=0,a=0,o=t.length;for(let s=1,c=e.getLineCount();s<=c;s++){let c=e.getLineContent(s),l=c.length+1,u=0;if(a<o&&t[a].lineNumber===s&&(u=t[a].column,a++,u===l)||c.length===0)continue;let f=d(c),p=0;if(f===-1)p=1;else if(f!==c.length-1)p=f+2;else continue;if(!n){if(!e.tokenization.hasAccurateTokensForLine(s))continue;let t=e.tokenization.getLineTokens(s),n=t.getStandardTokenType(t.findTokenIndexAtOffset(p));if(n===2||n===3)continue}p=Math.max(u,p),r[i++]=Ss.delete(new T(s,p,s,l))}return r}var Jw=class{constructor(e,t,n){this._selection=e,this._isCopyingDown=t,this._noop=n||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let n=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,n.startLineNumber<n.endLineNumber&&n.endColumn===1&&(this._endLineNumberDelta=1,n=n.setEndPosition(n.endLineNumber-1,e.getLineMaxColumn(n.endLineNumber-1)));let r=[];for(let t=n.startLineNumber;t<=n.endLineNumber;t++)r.push(e.getLineContent(t));let i=r.join(`
21
+ `);i===``&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new T(n.endLineNumber,e.getLineMaxColumn(n.endLineNumber),n.endLineNumber+1,1),n.endLineNumber===e.getLineCount()?``:`
22
+ `):this._isCopyingDown?t.addEditOperation(new T(n.startLineNumber,1,n.startLineNumber,1),i+`
23
+ `):t.addEditOperation(new T(n.endLineNumber,e.getLineMaxColumn(n.endLineNumber),n.endLineNumber,e.getLineMaxColumn(n.endLineNumber)),`
24
+ `+i),this._selectionId=t.trackSelection(n),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let n=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let e=n.startLineNumber,t=n.startColumn,r=n.endLineNumber,i=n.endColumn;this._startLineNumberDelta!==0&&(e+=this._startLineNumberDelta,t=1),this._endLineNumberDelta!==0&&(r+=this._endLineNumberDelta,i=1),n=P.createWithDirection(e,t,r,i,this._selectionDirection)}return n}};function Yw(e,t){let n=0;for(let r=0;r<e.length;r++)e.charAt(r)===` `?n+=t:n++;return n}function Xw(e,t,n){e=e<0?0:e;let r=``;if(!n){let n=Math.floor(e/t);e%=t;for(let e=0;e<n;e++)r+=` `}for(let t=0;t<e;t++)r+=` `;return r}var Zw=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qw=function(e,t){return function(n,r){t(n,r,e)}},$w=class{constructor(e,t,n,r){this._languageConfigurationService=r,this._selection=e,this._isMovingDown=t,this._autoIndent=n,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(e,t,n){return{tokenization:{getLineTokens:n=>e.tokenization.getLineTokens(t(n)),getLanguageId:()=>e.getLanguageId(),getLanguageIdAtPosition:(t,n)=>e.getLanguageIdAtPosition(t,n)},getLineContent:r=>{let i=n?.(r);return i===void 0?e.getLineContent(t(r)):i}}}getEditOperations(e,t){let n=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===n){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 r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));let{tabSize:i,indentSize:a,insertSpaces:o}=e.getOptions(),s=this.buildIndentConverter(i,a,o);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){let n=r.startLineNumber,i=this._isMovingDown?n+1:n-1;e.getLineMaxColumn(i)===1?t.addEditOperation(new T(1,1,1,1),null):(t.addEditOperation(new T(n,1,n,1),e.getLineContent(i)),t.addEditOperation(new T(i,1,i,e.getLineMaxColumn(i)),null)),r=new P(i,1,i,1)}else{let n,a;if(this._isMovingDown){n=r.endLineNumber+1,a=e.getLineContent(n),t.addEditOperation(new T(n-1,e.getLineMaxColumn(n-1),n,e.getLineMaxColumn(n)),null);let c=a;if(this.shouldAutoIndent(e,r)){let l=this.matchEnterRule(e,s,i,n,r.startLineNumber-1);if(l!==null)c=Xw(l+Yw(an(e.getLineContent(n)),i),i,o)+this.trimStart(a);else{let t=this.createVirtualModel(e,e=>e===r.startLineNumber?n:e),l=Eo(this._autoIndent,t,e.getLanguageIdAtPosition(n,1),r.startLineNumber,s,this._languageConfigurationService);if(l!==null){let t=an(e.getLineContent(n)),r=Yw(l,i);r!==Yw(t,i)&&(c=Xw(r,i,o)+this.trimStart(a))}}t.addEditOperation(new T(r.startLineNumber,1,r.startLineNumber,1),c+`
25
+ `);let u=this.matchEnterRuleMovingDown(e,s,i,r.startLineNumber,n,c);if(u!==null)u!==0&&this.getIndentEditsOfMovingBlock(e,t,r,i,o,u);else{let a=this.createVirtualModel(e,e=>e===r.startLineNumber?n:e>=r.startLineNumber+1&&e<=r.endLineNumber+1?e-1:e,e=>e===r.startLineNumber?c:void 0),l=Eo(this._autoIndent,a,e.getLanguageIdAtPosition(n,1),r.startLineNumber+1,s,this._languageConfigurationService);if(l!==null){let n=an(e.getLineContent(r.startLineNumber)),a=Yw(l,i),s=Yw(n,i);if(a!==s){let n=a-s;this.getIndentEditsOfMovingBlock(e,t,r,i,o,n)}}}}else t.addEditOperation(new T(r.startLineNumber,1,r.startLineNumber,1),c+`
26
+ `)}else if(n=r.startLineNumber-1,a=e.getLineContent(n),t.addEditOperation(new T(n,1,n+1,1),null),t.addEditOperation(new T(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
27
+ `+a),this.shouldAutoIndent(e,r)){let a=this.createVirtualModel(e,e=>e===n?r.startLineNumber:e),c=this.matchEnterRule(e,s,i,r.startLineNumber,r.startLineNumber-2);if(c!==null)c!==0&&this.getIndentEditsOfMovingBlock(e,t,r,i,o,c);else{let c=Eo(this._autoIndent,a,e.getLanguageIdAtPosition(r.startLineNumber,1),n,s,this._languageConfigurationService);if(c!==null){let n=an(e.getLineContent(r.startLineNumber)),a=Yw(c,i),s=Yw(n,i);if(a!==s){let n=a-s;this.getIndentEditsOfMovingBlock(e,t,r,i,o,n)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,n){return{shiftIndent:r=>wc.shiftIndent(r,r.length+1,e,t,n),unshiftIndent:r=>wc.unshiftIndent(r,r.length+1,e,t,n)}}parseEnterResult(e,t,n,r,i){if(i){let a=i.indentation;i.indentAction===Ua.None||i.indentAction===Ua.Indent?a=i.indentation+i.appendText:i.indentAction===Ua.IndentOutdent?a=i.indentation:i.indentAction===Ua.Outdent&&(a=t.unshiftIndent(i.indentation)+i.appendText);let o=e.getLineContent(r);if(this.trimStart(o).indexOf(this.trimStart(a))>=0){let i=an(e.getLineContent(r)),o=an(a),s=Hl(e,r,this._languageConfigurationService);return s!==null&&s&2&&(o=t.unshiftIndent(o)),Yw(o,n)-Yw(i,n)}}return null}matchEnterRuleMovingDown(e,t,n,r,i,a){if(d(a)>=0){let a=e.getLineMaxColumn(i),o=vl(this._autoIndent,e,new T(i,a,i,a),this._languageConfigurationService);return this.parseEnterResult(e,t,n,r,o)}else{let i=r-1;for(;i>=1&&!(d(e.getLineContent(i))>=0);)i--;if(i<1||r>e.getLineCount())return null;let a=e.getLineMaxColumn(i),o=vl(this._autoIndent,e,new T(i,a,i,a),this._languageConfigurationService);return this.parseEnterResult(e,t,n,r,o)}}matchEnterRule(e,t,n,r,i,a){let o=i;for(;o>=1;){let t;if(t=o===i&&a!==void 0?a:e.getLineContent(o),d(t)>=0)break;o--}if(o<1||r>e.getLineCount())return null;let s=e.getLineMaxColumn(o),c=vl(this._autoIndent,e,new T(o,s,o,s),this._languageConfigurationService);return this.parseEnterResult(e,t,n,r,c)}trimStart(e){return e.replace(/^\s+/,``)}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;let n=e.getLanguageIdAtPosition(t.startLineNumber,1);return!(n!==e.getLanguageIdAtPosition(t.endLineNumber,1)||this._languageConfigurationService.getLanguageConfiguration(n).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,n,r,i,a){for(let o=n.startLineNumber;o<=n.endLineNumber;o++){let s=an(e.getLineContent(o)),c=Xw(Yw(s,r)+a,r,i);c!==s&&(t.addEditOperation(new T(o,1,o,s.length+1),c),o===n.endLineNumber&&n.endColumn<=s.length+1&&c===``&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let n=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(n=n.setEndPosition(n.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&n.startLineNumber<n.endLineNumber&&(n=n.setEndPosition(n.endLineNumber,2)),n}};$w=Zw([Qw(3,eu)],$w);var eT=class{static{this._COLLATOR=Rn.Collator()}constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){let n=nT(e,this.selection,this.descending);n&&t.addEditOperation(n.range,n.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,n){if(e===null)return!1;let r=tT(e,t,n);if(!r)return!1;for(let e=0,t=r.before.length;e<t;e++)if(r.before[e]!==r.after[e])return!0;return!1}};function tT(e,t,n){let r=t.startLineNumber,i=t.endLineNumber;if(t.endColumn===1&&i--,r>=i)return null;let a=[];for(let t=r;t<=i;t++)a.push(e.getLineContent(t));let o=a.slice(0);return o.sort(eT._COLLATOR.value.compare),n===!0&&(o=o.reverse()),{startLineNumber:r,endLineNumber:i,before:a,after:o}}function nT(e,t,n){let r=tT(e,t,n);return r?Ss.replace(new T(r.startLineNumber,1,r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),r.after.join(`
28
+ `)):null}var rT=class extends N{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;let n=t.getSelections().map((e,t)=>({selection:e,index:t,ignore:!1}));n.sort((e,t)=>T.compareRangesUsingStarts(e.selection,t.selection));let r=n[0];for(let e=1;e<n.length;e++){let t=n[e];r.selection.endLineNumber===t.selection.startLineNumber&&(r.index<t.index?t.ignore=!0:(r.ignore=!0,r=t))}let i=[];for(let e of n)i.push(new Jw(e.selection,this.down,e.ignore));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}},iT=class extends rT{constructor(){super(!1,{id:`editor.action.copyLinesUpAction`,label:J(1295,`Copy Line Up`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`2_line`,title:V(1290,`&&Copy Line Up`),order:1},canTriggerInlineEdits:!0})}},aT=class extends rT{constructor(){super(!0,{id:`editor.action.copyLinesDownAction`,label:J(1296,`Copy Line Down`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`2_line`,title:V(1291,`Co&&py Line Down`),order:2},canTriggerInlineEdits:!0})}},oT=class extends N{constructor(){super({id:`editor.action.duplicateSelection`,label:J(1297,`Duplicate Selection`),precondition:z.writable,menuOpts:{menuId:Z.MenubarSelectionMenu,group:`2_line`,title:V(1292,`&&Duplicate Selection`),order:5},canTriggerInlineEdits:!0})}run(e,t,n){if(!t.hasModel())return;let r=[],i=t.getSelections(),a=t.getModel();for(let e of i)if(e.isEmpty())r.push(new Jw(e,!0));else{let t=new P(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn);r.push(new hn(t,a.getValueInRange(e)))}t.pushUndoStop(),t.executeCommands(this.id,r),t.pushUndoStop()}},sT=class extends N{constructor(e,t){super(t),this.down=e}run(e,t){let n=e.get(eu),r=[],i=t.getSelections()||[],a=t.getOption(16);for(let e of i)r.push(new $w(e,this.down,a,n));t.pushUndoStop(),t.executeCommands(this.id,r),t.pushUndoStop()}},cT=class extends sT{constructor(){super(!1,{id:`editor.action.moveLinesUpAction`,label:J(1298,`Move Line Up`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`2_line`,title:V(1293,`Mo&&ve Line Up`),order:3},canTriggerInlineEdits:!0})}},lT=class extends sT{constructor(){super(!0,{id:`editor.action.moveLinesDownAction`,label:J(1299,`Move Line Down`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`2_line`,title:V(1294,`Move &&Line Down`),order:4},canTriggerInlineEdits:!0})}},uT=class extends N{constructor(e,t){super(t),this.descending=e}run(e,t){if(!t.hasModel())return;let n=t.getModel(),r=t.getSelections();r.length===1&&r[0].isSingleLine()&&(r=[new P(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount()))]);for(let e of r)if(!eT.canRun(t.getModel(),e,this.descending))return;let i=[];for(let e=0,t=r.length;e<t;e++)i[e]=new eT(r[e],this.descending);t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}},dT=class extends uT{constructor(){super(!1,{id:`editor.action.sortLinesAscending`,label:J(1300,`Sort Lines Ascending`),precondition:z.writable,canTriggerInlineEdits:!0})}},fT=class extends uT{constructor(){super(!0,{id:`editor.action.sortLinesDescending`,label:J(1301,`Sort Lines Descending`),precondition:z.writable,canTriggerInlineEdits:!0})}},pT=class extends N{constructor(){super({id:`editor.action.removeDuplicateLines`,label:J(1302,`Delete Duplicate Lines`),precondition:z.writable,canTriggerInlineEdits:!0})}run(e,t){if(!t.hasModel())return;let n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let r=[],i=[],a=0,o=!0,s=t.getSelections();s.length===1&&s[0].isSingleLine()&&(s=[new P(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount()))],o=!1);for(let e of s){let t=new Set,o=[];for(let r=e.startLineNumber;r<=e.endLineNumber;r++){let e=n.getLineContent(r);t.has(e)||(o.push(e),t.add(e))}let s=new P(e.startLineNumber,1,e.endLineNumber,n.getLineMaxColumn(e.endLineNumber)),c=e.startLineNumber-a,l=new P(c,1,c+o.length-1,o[o.length-1].length+1);r.push(Ss.replace(s,o.join(`
29
+ `))),i.push(l),a+=e.endLineNumber-e.startLineNumber+1-o.length}t.pushUndoStop(),t.executeEdits(this.id,r,o?i:void 0),t.pushUndoStop()}},mT=class extends N{constructor(){super({id:`editor.action.reverseLines`,label:J(1303,`Reverse lines`),precondition:z.writable,canTriggerInlineEdits:!0})}run(e,t){if(!t.hasModel())return;let n=t.getModel(),r=t.getSelections(),i=r;i.length===1&&i[0].isSingleLine()&&(i=[new P(1,1,n.getLineCount(),n.getLineMaxColumn(n.getLineCount()))]);let a=[],o=[];for(let e=0;e<i.length;e++){let t=i[e],s=r[e],c=t.endLineNumber;t.startLineNumber<t.endLineNumber&&t.endColumn===1&&c--;let l=new T(t.startLineNumber,1,c,n.getLineMaxColumn(c));c===n.getLineCount()&&n.getLineContent(l.endLineNumber)===``&&(l=l.setEndPosition(l.endLineNumber-1,n.getLineMaxColumn(l.endLineNumber-1)));let u=[];for(let e=l.endLineNumber;e>=l.startLineNumber;e--)u.push(n.getLineContent(e));let d=Ss.replace(l,u.join(`
30
+ `));a.push(d);let f=function(e){return e<=l.endLineNumber?l.endLineNumber-e+l.startLineNumber:e};o.push(function(e){if(e.isEmpty())return new P(f(e.positionLineNumber),e.positionColumn,f(e.positionLineNumber),e.positionColumn);{let t=f(e.selectionStartLineNumber),n=f(e.positionLineNumber),r=e.selectionStartColumn,i=e.positionColumn;return new P(t,r,n,i)}}(s))}t.pushUndoStop(),t.executeEdits(this.id,a,o),t.pushUndoStop()}},hT=class e extends N{static{this.ID=`editor.action.trimTrailingWhitespace`}constructor(){super({id:e.ID,label:J(1304,`Trim Trailing Whitespace`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2102),weight:100}})}run(e,t,n){let r=[];n.reason===`auto-save`&&(r=(t.getSelections()||[]).map(e=>new M(e.positionLineNumber,e.positionColumn)));let i=t.getSelection();if(i===null)return;let a=e.get(xa),o=t.getModel(),s=a.getValue(`files.trimTrailingWhitespaceInRegexAndStrings`,{overrideIdentifier:o?.getLanguageId(),resource:o?.uri}),c=new Kw(i,r,s);t.pushUndoStop(),t.executeCommands(this.id,[c]),t.pushUndoStop()}},gT=class extends N{constructor(){super({id:`editor.action.deleteLines`,label:J(1305,`Delete Line`),precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(e,t){if(!t.hasModel())return;let n=this._getLinesToRemove(t),r=t.getModel();if(r.getLineCount()===1&&r.getLineMaxColumn(1)===1)return;let i=0,a=[],o=[];for(let e=0,t=n.length;e<t;e++){let t=n[e],s=t.startLineNumber,c=t.endLineNumber,l=1,u=r.getLineMaxColumn(c);c<r.getLineCount()?(c+=1,u=1):s>1&&(--s,l=r.getLineMaxColumn(s)),a.push(Ss.replace(new P(s,l,c,u),``)),o.push(new P(s-i,t.positionColumn,s-i,t.positionColumn)),i+=t.endLineNumber-t.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,a,o),t.revealAllCursors(!0),t.pushUndoStop()}_getLinesToRemove(e){let t=e.getSelections().map(e=>{let t=e.endLineNumber;return e.startLineNumber<e.endLineNumber&&e.endColumn===1&&--t,{startLineNumber:e.startLineNumber,selectionStartColumn:e.selectionStartColumn,endLineNumber:t,positionColumn:e.positionColumn}});t.sort((e,t)=>e.startLineNumber===t.startLineNumber?e.endLineNumber-t.endLineNumber:e.startLineNumber-t.startLineNumber);let n=[],r=t[0];for(let e=1;e<t.length;e++)r.endLineNumber+1>=t[e].startLineNumber?r.endLineNumber=t[e].endLineNumber:(n.push(r),r=t[e]);return n.push(r),n}},_T=class extends N{constructor(){super({id:`editor.action.indentLines`,label:J(1306,`Indent Line`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(e,t){let n=t._getViewModel();n&&(t.pushUndoStop(),t.executeCommands(this.id,vr.indent(n.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}},vT=class extends N{constructor(){super({id:`editor.action.outdentLines`,label:J(1307,`Outdent Line`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(e,t){Wi.Outdent.runEditorCommand(e,t,null)}},yT=class e extends N{static{this.ID=`editor.action.insertLineBefore`}constructor(){super({id:e.ID,label:J(1308,`Insert Line Above`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(e,t){let n=t._getViewModel();n&&(t.pushUndoStop(),t.executeCommands(this.id,s.lineInsertBefore(n.cursorConfig,t.getModel(),t.getSelections())))}},bT=class e extends N{static{this.ID=`editor.action.insertLineAfter`}constructor(){super({id:e.ID,label:J(1309,`Insert Line Below`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(e,t){let n=t._getViewModel();n&&(t.pushUndoStop(),t.executeCommands(this.id,s.lineInsertAfter(n.cursorConfig,t.getModel(),t.getSelections())))}},xT=class extends N{run(e,t){if(!t.hasModel())return;let n=t.getSelection(),r=this._getRangesToDelete(t),i=[];for(let e=0,t=r.length-1;e<t;e++){let t=r[e],n=r[e+1];T.intersectRanges(t,n)===null?i.push(t):r[e+1]=T.plusRange(t,n)}i.push(r[r.length-1]);let a=this._getEndCursorState(n,i),o=i.map(e=>Ss.replace(e,``));t.pushUndoStop(),t.executeEdits(this.id,o,a),t.pushUndoStop()}},ST=class extends xT{constructor(){super({id:`deleteAllLeft`,label:J(1310,`Delete All Left`),precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(e,t){let n=null,r=[],i=0;return t.forEach(t=>{let a;if(t.endColumn===1&&i>0){let e=t.startLineNumber-i;a=new P(e,t.startColumn,e,t.startColumn)}else a=new P(t.startLineNumber,t.startColumn,t.startLineNumber,t.startColumn);i+=t.endLineNumber-t.startLineNumber,t.intersectRanges(e)?n=a:r.push(a)}),n&&r.unshift(n),r}_getRangesToDelete(e){let t=e.getSelections();if(t===null)return[];let n=t,r=e.getModel();return r===null?[]:(n.sort(T.compareRangesUsingStarts),n=n.map(e=>{if(e.isEmpty())if(e.startColumn===1){let t=Math.max(1,e.startLineNumber-1);return new T(t,e.startLineNumber===1?1:r.getLineLength(t)+1,e.startLineNumber,1)}else return new T(e.startLineNumber,1,e.startLineNumber,e.startColumn);else return new T(e.startLineNumber,1,e.endLineNumber,e.endColumn)}),n)}},CT=class extends xT{constructor(){super({id:`deleteAllRight`,label:J(1311,`Delete All Right`),precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(e,t){let n=null,r=[];for(let i=0,a=t.length;i<a;i++){let a=t[i],o=new P(a.startLineNumber-0,a.startColumn,a.startLineNumber-0,a.startColumn);a.intersectRanges(e)?n=o:r.push(o)}return n&&r.unshift(n),r}_getRangesToDelete(e){let t=e.getModel();if(t===null)return[];let n=e.getSelections();if(n===null)return[];let r=n.map(e=>{if(e.isEmpty()){let n=t.getLineMaxColumn(e.startLineNumber);return e.startColumn===n?new T(e.startLineNumber,e.startColumn,e.startLineNumber+1,1):new T(e.startLineNumber,e.startColumn,e.startLineNumber,n)}return e});return r.sort(T.compareRangesUsingStarts),r}},wT=class extends N{constructor(){super({id:`editor.action.joinLines`,label:J(1312,`Join Lines`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(e,t){let n=t.getSelections();if(n===null)return;let r=t.getSelection();if(r===null)return;n.sort(T.compareRangesUsingStarts);let i=[],a=n.reduce((e,t)=>e.isEmpty()?e.endLineNumber===t.startLineNumber?(r.equalsSelection(e)&&(r=t),t):t.startLineNumber>e.endLineNumber+1?(i.push(e),t):new P(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn):t.startLineNumber>e.endLineNumber?(i.push(e),t):new P(e.startLineNumber,e.startColumn,t.endLineNumber,t.endColumn));i.push(a);let o=t.getModel();if(o===null)return;let s=[],c=[],l=r,u=0;for(let e=0,t=i.length;e<t;e++){let t=i[e],n=t.startLineNumber,a=0,d,f,p=o.getLineLength(t.endLineNumber)-t.endColumn;if(t.isEmpty()||t.startLineNumber===t.endLineNumber){let e=t.getStartPosition();e.lineNumber<o.getLineCount()?(d=n+1,f=o.getLineMaxColumn(d)):(d=e.lineNumber,f=o.getLineMaxColumn(e.lineNumber))}else d=t.endLineNumber,f=o.getLineMaxColumn(d);let m=o.getLineContent(n);for(let e=n+1;e<=d;e++){let t=o.getLineContent(e),n=o.getLineFirstNonWhitespaceColumn(e);if(n>=1){let e=!0;m===``&&(e=!1),e&&(m.charAt(m.length-1)===` `||m.charAt(m.length-1)===` `)&&(e=!1,m=m.replace(/[\s\uFEFF\xA0]+$/g,` `));let r=t.substr(n-1);m+=(e?` `:``)+r,a=e?r.length+1:r.length}else a=0}let h=new T(n,1,d,f);if(!h.isEmpty()){let e;t.isEmpty()?(s.push(Ss.replace(h,m)),e=new P(h.startLineNumber-u,m.length-a+1,n-u,m.length-a+1)):t.startLineNumber===t.endLineNumber?(s.push(Ss.replace(h,m)),e=new P(t.startLineNumber-u,t.startColumn,t.endLineNumber-u,t.endColumn)):(s.push(Ss.replace(h,m)),e=new P(t.startLineNumber-u,t.startColumn,t.startLineNumber-u,m.length-p)),T.intersectRanges(h,r)===null?c.push(e):l=e}u+=h.endLineNumber-h.startLineNumber}c.unshift(l),t.pushUndoStop(),t.executeEdits(this.id,s,c),t.pushUndoStop()}},TT=class extends N{constructor(){super({id:`editor.action.transpose`,label:J(1313,`Transpose Characters around the Cursor`),precondition:z.writable,canTriggerInlineEdits:!0})}run(e,t){let n=t.getSelections();if(n===null)return;let r=t.getModel();if(r===null)return;let i=[];for(let e=0,t=n.length;e<t;e++){let t=n[e];if(!t.isEmpty())continue;let a=t.getStartPosition(),o=r.getLineMaxColumn(a.lineNumber);if(a.column>=o){if(a.lineNumber===r.getLineCount())continue;let e=new T(a.lineNumber,Math.max(1,a.column-1),a.lineNumber+1,1),t=r.getValueInRange(e).split(``).reverse().join(``);i.push(new rt(new P(a.lineNumber,Math.max(1,a.column-1),a.lineNumber+1,1),t))}else{let e=new T(a.lineNumber,Math.max(1,a.column-1),a.lineNumber,a.column+1),t=r.getValueInRange(e).split(``).reverse().join(``);i.push(new Ft(e,t,new P(a.lineNumber,a.column+1,a.lineNumber,a.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}},ET=class extends N{run(e,t){let n=t.getSelections();if(n===null)return;let r=t.getModel();if(r===null)return;let i=t.getOption(148),a=[];for(let e of n)if(e.isEmpty()){let n=e.getStartPosition(),o=t.getConfiguredWordAtPosition(n);if(!o)continue;let s=new T(n.lineNumber,o.startColumn,n.lineNumber,o.endColumn),c=r.getValueInRange(s);a.push(Ss.replace(s,this._modifyText(c,i)))}else{let t=r.getValueInRange(e);a.push(Ss.replace(e,this._modifyText(t,i)))}t.pushUndoStop(),t.executeEdits(this.id,a),t.pushUndoStop()}},DT=class extends ET{constructor(){super({id:`editor.action.transformToUppercase`,label:J(1314,`Transform to Uppercase`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){return e.toLocaleUpperCase()}},OT=class extends ET{constructor(){super({id:`editor.action.transformToLowercase`,label:J(1315,`Transform to Lowercase`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(e,t){return e.toLocaleLowerCase()}},kT=class{constructor(e,t){this._pattern=e,this._flags=t,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}},AT=class e extends ET{static{this.titleBoundary=new kT(`(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}`,`gmu`)}constructor(){super({id:`editor.action.transformToTitlecase`,label:J(1316,`Transform to Title Case`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(t,n){let r=e.titleBoundary.get();return r?t.toLocaleLowerCase().replace(r,e=>e.toLocaleUpperCase()):t}},jT=class e extends ET{static{this.caseBoundary=new kT(`(\\p{Ll})(\\p{Lu})`,`gmu`)}static{this.singleLetters=new kT(`(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})`,`gmu`)}constructor(){super({id:`editor.action.transformToSnakecase`,label:J(1317,`Transform to Snake Case`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(t,n){let r=e.caseBoundary.get(),i=e.singleLetters.get();return!r||!i?t:t.replace(r,`$1_$2`).replace(i,`$1_$2$3`).toLocaleLowerCase()}},MT=class e extends ET{static{this.singleLineWordBoundary=new kT(`[_\\s-]+`,`gm`)}static{this.multiLineWordBoundary=new kT(`[_-]+`,`gm`)}static{this.validWordStart=new kT(`^(\\p{Lu}[^\\p{Lu}])`,`gmu`)}constructor(){super({id:`editor.action.transformToCamelcase`,label:J(1318,`Transform to Camel Case`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(t,n){let r=/\r\n|\r|\n/.test(t)?e.multiLineWordBoundary.get():e.singleLineWordBoundary.get(),i=e.validWordStart.get();if(!r||!i)return t;let a=t.split(r);return a.shift()?.replace(i,e=>e.toLocaleLowerCase())+a.map(e=>e.substring(0,1).toLocaleUpperCase()+e.substring(1)).join(``)}},NT=class e extends ET{static{this.wordBoundary=new kT(`[_ \\t-]`,`gm`)}static{this.wordBoundaryToMaintain=new kT(`(?<=\\.)`,`gm`)}static{this.upperCaseWordMatcher=new kT(`^\\p{Lu}+$`,`mu`)}constructor(){super({id:`editor.action.transformToPascalcase`,label:J(1319,`Transform to Pascal Case`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(t,n){let r=e.wordBoundary.get(),i=e.wordBoundaryToMaintain.get(),a=e.upperCaseWordMatcher.get();return!r||!i||!a?t:t.split(i).map(e=>e.split(r)).flat().map(e=>{let t=e.charAt(0).toLocaleUpperCase()+e.slice(1);return t.length>1&&a.test(t)?t.charAt(0)+t.slice(1).toLocaleLowerCase():t}).join(``)}},PT=class e extends ET{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(e=>e.isSupported())}static{this.caseBoundary=new kT(`(\\p{Ll})(\\p{Lu})`,`gmu`)}static{this.singleLetters=new kT(`(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})`,`gmu`)}static{this.underscoreBoundary=new kT(`(\\S)(_)(\\S)`,`gm`)}constructor(){super({id:`editor.action.transformToKebabcase`,label:J(1320,`Transform to Kebab Case`),precondition:z.writable,canTriggerInlineEdits:!0})}_modifyText(t,n){let r=e.caseBoundary.get(),i=e.singleLetters.get(),a=e.underscoreBoundary.get();return!r||!i||!a?t:t.replace(a,`$1-$3`).replace(r,`$1-$2`).replace(i,`$1-$2`).toLocaleLowerCase()}};O(iT),O(aT),O(oT),O(cT),O(lT),O(dT),O(fT),O(pT),O(hT),O(gT),O(_T),O(vT),O(yT),O(bT),O(ST),O(CT),O(wT),O(TT),O(DT),O(OT),O(mT),jT.caseBoundary.isSupported()&&jT.singleLetters.isSupported()&&O(jT),MT.singleLineWordBoundary.isSupported()&&MT.multiLineWordBoundary.isSupported()&&O(MT),NT.wordBoundary.isSupported()&&O(NT),AT.titleBoundary.isSupported()&&O(AT),PT.isSupported()&&O(PT);var FT=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},IT=function(e,t){return function(n,r){t(n,r,e)}};function LT(e){return e.sourceId+` @@ `+JSON.stringify({...e,modelUri:e.modelUri?.toString(),sourceId:void 0})}var RT=class extends j{static cast(){return this}constructor(e,t,n){super(),this._key=e,this._contextKeyService=t,this._dataChannelService=n,this._isEnabledContextKeyValue=zT(`structuredLogger.enabled:`+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(e=>e!==void 0)}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel(`structuredLogger:`+this._key).sendData(e),!0):!1}};RT=FT([IT(1,G),IT(2,Ot)],RT);function zT(e,t){return $u(t.onDidChangeContext,()=>t.getContextKeyValue(e))}var BT=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},VT=function(e,t){return function(n,r){t(n,r,e)}},HT=class extends j{constructor(e,t,n){super(),this._editor=e,this._instantiationService=t,this._loggerService=n,this._structuredLogger=this._register(this._instantiationService.createInstance(RT.cast(),`editor.inlineSuggest.logChangeReason.commandId`));let r=this._loggerService?.createLogger(`textModelChanges`,{hidden:!1,name:`Text Model Changes Reason`}),i=$u(this,r.onDidChangeLogLevel,()=>r.getLevel());this._register(k(e=>{ms(i.read(e),ul.Trace)&&e.store.add(this._editor.onDidChangeModelContent(e=>{this._editor.getModel()?.uri.scheme!==`output`&&r.trace(`onDidChangeModelContent: `+e.detailedReasons.map(e=>e.toKey(Number.MAX_VALUE)).join(`, `))}))})),this._register(k(e=>{this._editor instanceof ls&&this._structuredLogger.isEnabled.read(e)&&e.store.add(this._editor.onDidChangeModelContent(e=>{let t=this._editor.getModel();if(!t)return;let n=e.detailedReasons[0],r={...n.metadata,sourceId:`TextModel.setChangeReason`,source:n.metadata.source,time:Date.now(),modelUri:t.uri,modelVersion:t.getVersionId()};setTimeout(()=>{this._structuredLogger.log(r)},0)}))}))}};HT=BT([VT(1,w),VT(2,vc)],HT);function UT(e,t=Zt){return ns(e,t)?e.charAt(0).toUpperCase()+e.slice(1):e}var WT=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},GT=function(e,t){return function(n,r){t(n,r,e)}},KT=class{constructor(e){this._delegates=e}resolve(e){for(let t of this._delegates){let n=t.resolve(e);if(n!==void 0)return n}}},qT=class{constructor(e,t,n,r){this._model=e,this._selection=t,this._selectionIdx=n,this._overtypingCapturer=r}resolve(e){let{name:t}=e;if(t===`SELECTION`||t===`TM_SELECTED_TEXT`){let t=this._model.getValueInRange(this._selection)||void 0,n=this._selection.startLineNumber!==this._selection.endLineNumber;if(!t&&this._overtypingCapturer){let e=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);e&&(t=e.value,n=e.multiline)}if(t&&n&&e.snippet){let n=an(this._model.getLineContent(this._selection.startLineNumber),0,this._selection.startColumn-1),r=n;e.snippet.walk(t=>t===e?!1:(t instanceof uf&&(r=an(yo(t.value).pop())),!0));let i=_n(r,n);t=t.replace(/(\r\n|\r|\n)(.*)/g,(e,t,n)=>`${t}${r.substr(i)}${n}`)}return t}else if(t===`TM_CURRENT_LINE`)return this._model.getLineContent(this._selection.positionLineNumber);else if(t===`TM_CURRENT_WORD`){let e=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return e&&e.word||void 0}else if(t===`TM_LINE_INDEX`)return String(this._selection.positionLineNumber-1);else if(t===`TM_LINE_NUMBER`)return String(this._selection.positionLineNumber);else if(t===`CURSOR_INDEX`)return String(this._selectionIdx);else if(t===`CURSOR_NUMBER`)return String(this._selectionIdx+1)}},JT=class{constructor(e,t){this._labelService=e,this._model=t}resolve(e){let{name:t}=e;if(t===`TM_FILENAME`)return Bn(this._model.uri.fsPath);if(t===`TM_FILENAME_BASE`){let e=Bn(this._model.uri.fsPath),t=e.lastIndexOf(`.`);return t<=0?e:e.slice(0,t)}else if(t===`TM_DIRECTORY`)return ur(this._model.uri.fsPath)===`.`?``:this._labelService.getUriLabel(qa(this._model.uri));else if(t===`TM_DIRECTORY_BASE`)return ur(this._model.uri.fsPath)===`.`?``:Bn(ur(this._model.uri.fsPath));else if(t===`TM_FILEPATH`)return this._labelService.getUriLabel(this._model.uri);else if(t===`RELATIVE_FILEPATH`)return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}},YT=class{constructor(e,t,n,r){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=n,this._spread=r}resolve(e){if(e.name!==`CLIPBOARD`)return;let t=this._readClipboardText();if(t){if(this._spread){let e=t.split(/\r\n|\n|\r/).filter(e=>!qt(e));if(e.length===this._selectionCount)return e[this._selectionIdx]}return t}}},XT=class{constructor(e,t,n){this._model=e,this._selection=t,this._languageConfigurationService=n}resolve(e){let{name:t}=e,n=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),r=this._languageConfigurationService.getLanguageConfiguration(n).comments;if(r){if(t===`LINE_COMMENT`)return r.lineCommentToken||void 0;if(t===`BLOCK_COMMENT_START`)return r.blockCommentStartToken||void 0;if(t===`BLOCK_COMMENT_END`)return r.blockCommentEndToken||void 0}}};XT=WT([GT(2,eu)],XT);var ZT=class e{constructor(){this._date=new Date}static{this.dayNames=[V(1456,`Sunday`),V(1457,`Monday`),V(1458,`Tuesday`),V(1459,`Wednesday`),V(1460,`Thursday`),V(1461,`Friday`),V(1462,`Saturday`)]}static{this.dayNamesShort=[V(1463,`Sun`),V(1464,`Mon`),V(1465,`Tue`),V(1466,`Wed`),V(1467,`Thu`),V(1468,`Fri`),V(1469,`Sat`)]}static{this.monthNames=[V(1470,`January`),V(1471,`February`),V(1472,`March`),V(1473,`April`),V(1474,`May`),V(1475,`June`),V(1476,`July`),V(1477,`August`),V(1478,`September`),V(1479,`October`),V(1480,`November`),V(1481,`December`)]}static{this.monthNamesShort=[V(1482,`Jan`),V(1483,`Feb`),V(1484,`Mar`),V(1485,`Apr`),V(1486,`May`),V(1487,`Jun`),V(1488,`Jul`),V(1489,`Aug`),V(1490,`Sep`),V(1491,`Oct`),V(1492,`Nov`),V(1493,`Dec`)]}resolve(t){let{name:n}=t;switch(n){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 e.dayNames[this._date.getDay()];case`CURRENT_DAY_NAME_SHORT`:return e.dayNamesShort[this._date.getDay()];case`CURRENT_MONTH_NAME`:return e.monthNames[this._date.getMonth()];case`CURRENT_MONTH_NAME_SHORT`:return e.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`:{let e=this._date.getTimezoneOffset(),t=e>0?`-`:`+`,n=Math.trunc(Math.abs(e/60)),r=n<10?`0`+n:n,i=Math.abs(e)-n*60,a=i<10?`0`+i:i;return t+r+`:`+a}case`CURRENT_TIMEZONE_NAME`:return this._timezoneName??=Intl.DateTimeFormat().resolvedOptions().timeZone}}},QT=class{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;let t=zn(this._workspaceService.getWorkspace());if(!te(t)){if(e.name===`WORKSPACE_NAME`)return this._resolveWorkspaceName(t);if(e.name===`WORKSPACE_FOLDER`)return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(Ns(e))return Bn(e.uri.path);let t=Bn(e.configPath.path);return t.endsWith(`code-workspace`)&&(t=t.substr(0,t.length-Gs.length-1)),t}_resoveWorkspacePath(e){if(Ns(e))return UT(e.uri.fsPath);let t=Bn(e.configPath.path),n=e.configPath.fsPath;return n.endsWith(t)&&(n=n.substr(0,n.length-t.length-1)),n?UT(n):`/`}},$T=class{resolve(e){let{name:t}=e;if(t===`RANDOM`)return Math.random().toString().slice(-6);if(t===`RANDOM_HEX`)return Math.random().toString(16).slice(-6);if(t===`UUID`)return as()}},eE=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},tE=function(e,t){return function(n,r){t(n,r,e)}},nE,rE=class e{static{this._decor={active:Y.register({description:`snippet-placeholder-1`,stickiness:0,className:`snippet-placeholder`}),inactive:Y.register({description:`snippet-placeholder-2`,stickiness:1,className:`snippet-placeholder`}),activeFinal:Y.register({description:`snippet-placeholder-3`,stickiness:1,className:`finish-snippet-placeholder`}),inactiveFinal:Y.register({description:`snippet-placeholder-4`,stickiness:1,className:`finish-snippet-placeholder`})}}constructor(e,t,n){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=n,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=qu(t.placeholders,ff.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 Error(`Snippet not initialized!`);if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;let t=this._editor.getModel();this._editor.changeDecorations(n=>{for(let r of this._snippet.placeholders){let i=this._snippet.offset(r),a=this._snippet.fullLen(r),o=T.fromPositions(t.getPositionAt(this._offset+i),t.getPositionAt(this._offset+i+a)),s=r.isFinalTabstop?e._decor.inactiveFinal:e._decor.inactive,c=n.addDecoration(o,s);this._placeholderDecorations.set(r,c)}})}move(t){if(!this._editor.hasModel())return[];this._initDecorations();let n=this._editor.getModel();if(this._placeholderGroupsIdx>=0){let e=[];for(let t of this._placeholderGroups[this._placeholderGroupsIdx])if(t.transform){let r=this._placeholderDecorations.get(t),i=r?n.getDecorationRange(r):null;if(i){let r=n.getValueInRange(i),a=t.transform.resolve(r).split(/\r\n|\r|\n/);for(let e=1;e<a.length;e++)a[e]=n.normalizeIndentation(this._snippetLineLeadingWhitespace+a[e]);e.push(Ss.replace(i,a.join(n.getEOL())))}}e.length>0&&this._editor.executeEdits(`snippet.placeholderTransform`,e)}let r=!1;t===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,r=!0):t===!1&&this._placeholderGroupsIdx>0&&(--this._placeholderGroupsIdx,r=!0);let i=n.changeDecorations(t=>{let i=new Set,a=[];for(let o of this._placeholderGroups[this._placeholderGroupsIdx]){let s=this._placeholderDecorations.get(o),c=s?n.getDecorationRange(s):null;if(r&&=this._hasPlaceholderBeenCollapsed(o),!(!s||!c)){a.push(new P(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),t.changeDecorationOptions(s,o.isFinalTabstop?e._decor.activeFinal:e._decor.active),i.add(o);for(let n of this._snippet.enclosingPlaceholders(o)){let r=this._placeholderDecorations.get(n);r&&(t.changeDecorationOptions(r,n.isFinalTabstop?e._decor.activeFinal:e._decor.active),i.add(n))}}}for(let[n,r]of this._placeholderDecorations)i.has(n)||t.changeDecorationOptions(r,n.isFinalTabstop?e._decor.inactiveFinal:e._decor.inactive);return a});return r?this.move(t):i??[]}_hasPlaceholderBeenCollapsed(e){let t=this._editor.getModel(),n=e;for(;n;){if(n instanceof ff){let e=this._placeholderDecorations.get(n),r=e?t.getDecorationRange(e):null;if((!r||r.isEmpty())&&n.toString().length>0)return!0}n=n.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){let[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){let e=new Map;for(let t of this._placeholderGroups){let n;for(let r of t){if(r.isFinalTabstop)break;n||(n=[],e.set(r.index,n));let t=this._placeholderDecorations.get(r),i=this._editor.getModel().getDecorationRange(t);if(!i){e.delete(r.index);break}n.push(i)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;let e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;let t=this._placeholderDecorations.get(e);if(!t)return;let n=this._editor.getModel().getDecorationRange(t);if(n)return{range:n,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof pf,!e)),e}get activePlaceholderCount(){return this._placeholderGroupsIdx<0?0:this._placeholderGroups[this._placeholderGroupsIdx].length}merge(t){let n=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(r=>{for(let i of this._placeholderGroups[this._placeholderGroupsIdx]){let a=t.shift();console.assert(a._offset!==-1),console.assert(!a._placeholderDecorations);let o=a._snippet.placeholderInfo.last.index;for(let e of a._snippet.placeholderInfo.all)e.isFinalTabstop?e.index=i.index+(o+1)/this._nestingLevel:e.index=i.index+e.index/this._nestingLevel;this._snippet.replace(i,a._snippet.children);let s=this._placeholderDecorations.get(i);r.removeDecoration(s),this._placeholderDecorations.delete(i);for(let t of a._snippet.placeholders){let i=a._snippet.offset(t),o=a._snippet.fullLen(t),s=T.fromPositions(n.getPositionAt(a._offset+i),n.getPositionAt(a._offset+i+o)),c=r.addDecoration(s,e._decor.inactive);this._placeholderDecorations.set(t,c)}}this._renormalizePlaceholderIndices(),this._placeholderGroups=qu(this._snippet.placeholders,ff.compareByIndex)})}_renormalizePlaceholderIndices(){let e=this._snippet.placeholders,t=new Set;for(let n of e)n.isFinalTabstop||t.add(n.index);let n=[...t].sort((e,t)=>e-t),r=new Map;for(let e=0;e<n.length;e++)r.set(n[e],e+1);for(let t of e)t.isFinalTabstop||(t.index=r.get(t.index));this._nestingLevel=1}},iE={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},aE=nE=class{static adjustWhitespace(e,t,n,r,i){let a=an(e.getLineContent(t.lineNumber),0,t.column-1),o;return r.walk(t=>{if(!(t instanceof uf)||t.parent instanceof pf||i&&!i.has(t))return!0;let s=t.value.split(/\r\n|\r|\n/);if(n){let n=r.offset(t);if(n===0)s[0]=e.normalizeIndentation(s[0]);else{o??=r.toString();let t=o.charCodeAt(n-1);(t===10||t===13)&&(s[0]=e.normalizeIndentation(a+s[0]))}for(let t=1;t<s.length;t++)s[t]=e.normalizeIndentation(a+s[t])}let c=s.join(e.getEOL());return c!==t.value&&(t.parent.replace(t,[new uf(c)]),o=void 0),!0}),a}static adjustSelection(e,t,n,r){if(n!==0||r!==0){let{positionLineNumber:i,positionColumn:a}=t,o=a-n,s=a+r,c=e.validateRange({startLineNumber:i,startColumn:o,endLineNumber:i,endColumn:s});t=P.createWithDirection(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,n,r,i,a,o,s,c){let l=[],u=[];if(!e.hasModel())return{edits:l,snippets:u};let d=e.getModel(),f=e.invokeWithinContext(e=>e.get(Zn)),p=e.invokeWithinContext(e=>new JT(e.get(mi),d)),m=()=>o,h=d.getValueInRange(nE.adjustSelection(d,e.getSelection(),n,0)),g=d.getValueInRange(nE.adjustSelection(d,e.getSelection(),0,r)),_=d.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),v=e.getSelections().map((e,t)=>({selection:e,idx:t})).sort((e,t)=>T.compareRangesUsingStarts(e.selection,t.selection));for(let{selection:o,idx:y}of v){let b=nE.adjustSelection(d,o,n,0),ee=nE.adjustSelection(d,o,0,r);h!==d.getValueInRange(b)&&(b=o),g!==d.getValueInRange(ee)&&(ee=o);let te=o.setStartPosition(b.startLineNumber,b.startColumn).setEndPosition(ee.endLineNumber,ee.endColumn),ne=new yf().parse(t,!0,i),re=te.getStartPosition(),ie=nE.adjustWhitespace(d,re,a||y>0&&_!==d.getLineFirstNonWhitespaceColumn(o.positionLineNumber),ne);ne.resolveVariables(new KT([p,new YT(m,y,v.length,e.getOption(88)===`spread`),new qT(d,o,y,s),new XT(d,o,c),new ZT,new QT(f),new $T])),l[y]=Ss.replace(te,ne.toString()),l[y].identifier={major:y,minor:0},l[y]._isTracked=!0,u[y]=new rE(e,ne,ie)}return{edits:l,snippets:u}}static createEditsAndSnippetsFromEdits(e,t,n,r,i,a,o){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};let s=[],c=e.getModel(),l=new yf,u=new vf,d=e.invokeWithinContext(e=>new JT(e.get(mi),c)),f=new ZT,p=new QT(e.invokeWithinContext(e=>e.get(Zn))),m=new $T,h=()=>i,g=e.getOption(88)===`spread`,_=t.map((e,t)=>({edit:e,idx:t})).sort((e,t)=>T.compareRangesUsingStarts(e.edit.range,t.edit.range)),v=0;for(let e=0;e<_.length;e++){let{edit:{range:t,template:n,keepWhitespace:i},idx:y}=_[e];if(e>0){let n=_[e-1].edit.range,r=T.fromPositions(n.getEndPosition(),t.getStartPosition()),i=new uf(c.getValueInRange(r));u.appendChild(i),v+=i.value.length}let b=new Set;u.walk(e=>(e instanceof gf&&b.add(e),!0));let ee=l.parseFragment(n,u);nE.adjustWhitespace(c,t.getStartPosition(),i===void 0?r:!i,u,new Set(ee));let te=P.fromRange(t,0),ne=new KT([d,new YT(h,y,_.length,g),new qT(c,te,y,a),new XT(c,te,o),f,p,m]);u.walk(e=>(e instanceof gf&&!b.has(e)&&e.resolve(ne),!0));let re=u.toString(),ie=re.slice(v);v=re.length;let ae=Ss.replace(t,ie);ae.identifier={major:e,minor:0},ae._isTracked=!0,s.push(ae)}return l.ensureFinalTabstop(u,n,!0),{edits:s,snippets:[new rE(e,u,``)]}}constructor(e,t,n=iE,r){this._editor=e,this._template=t,this._options=n,this._languageConfigurationService=r,this._templateMerges=[],this._snippets=[]}dispose(){h(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(` -> `)}"`}insert(e){if(!this._editor.hasModel())return;let{edits:t,snippets:n}=typeof this._template==`string`?nE.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):nE.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=n,this._editor.executeEdits(e??Ln.snippet(),t,e=>{let t=e.filter(e=>!!e.identifier);for(let e=0;e<n.length;e++)n[e].initialize(t[e].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):t.map(e=>P.fromPositions(e.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=iE){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);let{edits:n,snippets:r}=nE.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits(`snippet`,n,e=>{let t=e.filter(e=>!!e.identifier);for(let e=0;e<r.length;e++)r[e].initialize(t[e].textChange);let n=r[0].isTrivialSnippet,i=r.length===this._snippets.reduce((e,t)=>e+t.activePlaceholderCount,0);if(!n&&i){for(let e of this._snippets)e.merge(r);console.assert(r.length===0)}return this._snippets[0].hasPlaceholder&&!n&&i?this._move(void 0):t.map(e=>P.fromPositions(e.range.getEndPosition()))})}next(){let e=this._move(!0);e.length>0&&(this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition()))}prev(){let e=this._move(!1);e.length>0&&(this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition()))}_move(e){let t=[];for(let n of this._snippets){let r=n.move(e);t.push(...r)}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;let e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;let t=new Map;for(let n of this._snippets){let r=n.computePossibleSelections();if(t.size===0)for(let[n,i]of r){i.sort(T.compareRangesUsingStarts);for(let r of e)if(i[0].containsRange(r)){t.set(n,[]);break}}if(t.size===0)return!1;t.forEach((e,t)=>{e.push(...r.get(t))})}e.sort(T.compareRangesUsingStarts);for(let[n,r]of t){if(r.length!==e.length){t.delete(n);continue}r.sort(T.compareRangesUsingStarts);for(let i=0;i<r.length;i++)if(!r[i].containsRange(e[i])){t.delete(n);continue}}return t.size>0}};aE=nE=eE([tE(3,eu)],aE);var oE=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sE=function(e,t){return function(n,r){t(n,r,e)}},cE,lE={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},uE=class{static{cE=this}static{this.ID=`snippetController2`}static get(e){return e.getContribution(cE.ID)}static{this.InSnippetMode=new A(`inSnippetMode`,!1,V(1451,`Whether the editor in current in snippet mode`))}static{this.HasNextTabstop=new A(`hasNextTabstop`,!1,V(1452,`Whether there is a next tab stop when in snippet mode`))}static{this.HasPrevTabstop=new A(`hasPrevTabstop`,!1,V(1453,`Whether there is a previous tab stop when in snippet mode`))}static{this.InSnippetChoice=new A(`inSnippetChoice`,!1,V(1454,`Whether the current snippet tab stop is a choice`))}constructor(e,t,n,r,i){this._editor=e,this._logService=t,this._languageFeaturesService=n,this._languageConfigurationService=i,this._inSnippetObservable=St(this,!1),this._snippetListener=new S,this._modelVersionId=-1,this._inSnippet=cE.InSnippetMode.bindTo(r),this._hasNextTabstop=cE.HasNextTabstop.bindTo(r),this._hasPrevTabstop=cE.HasPrevTabstop.bindTo(r),this._inSnippetChoice=cE.InSnippetChoice.bindTo(r)}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,t===void 0?lE:{...lE,...t})}catch(t){this.cancel(),this._logService.error(t),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?(Bi(typeof e==`string`),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new aE(this._editor,e,t,this._languageConfigurationService),this._session.insert(t.reason)),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){let e={_debugDisplayName:`snippetChoiceCompletions`,provideCompletionItems:(e,t)=>{if(!this._session||e!==this._editor.getModel()||!M.equals(this._editor.getPosition(),t))return;let{activeChoice:n}=this._session;if(!n||n.choice.options.length===0)return;let r=e.getValueInRange(n.range),i=!!n.choice.options.find(e=>e.value===r),a=[];for(let e=0;e<n.choice.options.length;e++){let t=n.choice.options[e];a.push({kind:13,label:t.value,insertText:t.value,sortText:`a`.repeat(e+1),range:n.range,filterText:i?`${r}_${t.value}`:void 0,command:{id:`jumpToNextSnippetPlaceholder`,title:V(1455,`Go to next placeholder...`)}})}return{suggestions:a}}},t=this._editor.getModel(),n,r=!1,i=()=>{n?.dispose(),r=!1},a=()=>{r||=(n=this._languageFeaturesService.completionProvider.register({language:t.getLanguageId(),pattern:t.uri.fsPath,scheme:t.uri.scheme,exclusive:!0},e),this._snippetListener.add(n),!0)};this._choiceCompletions={provider:e,enable:a,disable:i}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(e=>e.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()||!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}let{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(()=>{dw(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}};uE=cE=oE([sE(1,Pl),sE(2,q),sE(3,G),sE(4,eu)],uE),F(uE.ID,uE,4);var dE=mt.bindToContribution(uE.get);R(new dE({id:`jumpToNextSnippetPlaceholder`,precondition:m.and(uE.InSnippetMode,uE.HasNextTabstop),handler:e=>e.next(),kbOpts:{weight:130,kbExpr:z.textInputFocus,primary:2}})),R(new dE({id:`jumpToPrevSnippetPlaceholder`,precondition:m.and(uE.InSnippetMode,uE.HasPrevTabstop),handler:e=>e.prev(),kbOpts:{weight:130,kbExpr:z.textInputFocus,primary:1026}})),ke.registerKeybindingRule({id:`jumpToPrevSnippetPlaceholder`,weight:191,when:m.and(uE.InSnippetMode,uE.HasPrevTabstop,uE.InSnippetChoice,z.textInputFocus),primary:1026}),R(new dE({id:`leaveSnippet`,precondition:uE.InSnippetMode,handler:e=>e.cancel(!0),kbOpts:{weight:130,kbExpr:z.textInputFocus,primary:9,secondary:[1033]}})),R(new dE({id:`acceptSnippet`,precondition:uE.InSnippetMode,handler:e=>e.finish()}));function fE(e){return new pE(e)}var pE=class extends ya{constructor(e){super(),this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}},mE=[];function hE(){return mE}function gE(e){return _E(e).map(e=>e.getEndPosition())}function _E(e){let t=ic.createSortPermutation(e,fs(e=>e.range,T.compareRangesUsingStarts)),n=new Kc(t.apply(e)).getNewRanges();return t.inverse().apply(n)}function vE(e,t){let n=fE(t),r=t.getValue();return e.map(e=>n.getStringReplacement(e)).map(e=>e.removeCommonSuffixPrefix(r)).map(e=>n.getTextReplacement(e))}function yE(e,t){let n=St(`result`,[]),r=[];return t.add(k(t=>{let i=e.read(t);ut(e=>{if(i.length!==r.length){r.length=i.length;for(let e=0;e<r.length;e++)r[e]||(r[e]=St(`item`,i[e]));n.set([...r],e)}r.forEach((t,n)=>t.set(i[n],e))})})),n}var bE=class{constructor(e){this._contextKeyService=e}bind(e,t){return tc(e,this._contextKeyService,t instanceof Function?t:e=>t.read(e))}};function xE(e,t){return new Promise(n=>{let r,i=setTimeout(()=>{r&&r.dispose(),n()},e);t&&(r=t.onCancellationRequested(()=>{clearTimeout(i),r&&r.dispose(),n()}))})}var SE=class e{static message(t){return new e(void 0,t)}constructor(e,t=void 0){this.error=e,this.message=t}static is(t){return t instanceof e}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)}},CE=class e{static startNow(t,n,r,i=wE){return new e(t,n,r,Date.now(),i)}constructor(e,t,n,r,i=wE){this.startValue=e,this.endValue=t,this.durationMs=n,this.startTimeMs=r,this._interpolationFunction=i,e===t&&(this.durationMs=0)}isFinished(e){return e>=this.startTimeMs+this.durationMs}getValue(e){let t=e-this.startTimeMs;return t>=this.durationMs?this.endValue:this._interpolationFunction(t,this.startValue,this.endValue-this.startValue,this.durationMs)}};function wE(e,t,n,r){return e===r?t+n:n*(-(2**(-10*e/r))+1)+t}function TE(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}var EE=class{constructor(e){this._value=e}getValue(e){let t=Date.now();return this._value.isFinished(t)||DE.instance.invalidateOnNextAnimationFrame(e),this._value.getValue(t)}isFinished(e){let t=Date.now(),n=this._value.isFinished(t);return n||DE.instance.invalidateOnNextAnimationFrame(e),n}},DE=class e{constructor(){this._counter=Or(this),this._isScheduled=!1}static{this.instance=new e}invalidateOnNextAnimationFrame(e){this._counter.read(e),this._isScheduled||(this._isScheduled=!0,Qs().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}},OE=class{constructor(e,t){this.lineNumber=e,this.parts=t,Ac(()=>Ya(t,(e,t)=>e.column<=t.column))}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,n)=>t.equals(e.parts[n]))}renderForScreenReader(e){if(this.parts.length===0)return``;let t=this.parts[this.parts.length-1],n=e.substr(0,t.column-1);return new Kc([...this.parts.map(e=>new fc(T.fromPositions(new M(1,e.column)),e.lines.map(e=>e.line).join(`
31
+ `)))]).applyToString(n).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}},kE=class{constructor(e,t,n,r=[]){this.column=e,this.text=t,this.preview=n,this._inlineDecorations=r,this.lines=yo(this.text).map((e,t)=>({line:e,lineDecorations:Gn.filter(this._inlineDecorations,t+1,1,e.length+1)}))}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,n)=>t.line===e.lines[n].line&&Gn.equalsArr(t.lineDecorations,e.lines[n].lineDecorations))}},AE=class{constructor(e,t,n,r=0){this.lineNumber=e,this.columnRange=t,this.text=n,this.additionalReservedLineCount=r,this.parts=[new kE(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=yo(this.text)}renderForScreenReader(e){return this.newLines.join(`
32
+ `)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,n)=>t===e.newLines[n])&&this.additionalReservedLineCount===e.additionalReservedLineCount}};function jE(e,t){return pu(e,t,ME)}function ME(e,t){return e===t?!0:!e||!t?!1:e instanceof OE&&t instanceof OE||e instanceof AE&&t instanceof AE?e.equals(t):!1}function NE(e,t,n){let r=n?e.range.intersectRanges(n):e.range;if(!r)return e;let i=e.text.replaceAll(`\r
33
+ `,`
34
+ `),a=t.getValueInRange(r,1),o=_n(a,i),s=uu.ofText(a.substring(0,o)).addToPosition(e.range.getStartPosition()),c=i.substring(o);return new fc(T.fromPositions(s,e.range.getEndPosition()),c)}function PE(e,t){return e.text.startsWith(t.text)&&FE(e.range,t.range)}function FE(e,t){return t.getStartPosition().equals(e.getStartPosition())&&t.getEndPosition().isBeforeOrEqual(e.getEndPosition())}function IE(e,t,n,r,i=0){let a=NE(e,t);if(a.range.endLineNumber!==a.range.startLineNumber)return;let o=t.getLineContent(a.range.startLineNumber),s=an(o).length;if(a.range.startColumn-1<=s){let e=an(a.text).length,t=o.substring(a.range.startColumn-1,s),[n,r]=[a.range.getStartPosition(),a.range.getEndPosition()],i=n.column+t.length<=r.column?n.delta(0,t.length):r;a=new fc(T.fromPositions(i,r),a.text.startsWith(t)?a.text.substring(t.length):a.text.substring(e))}let c=t.getValueInRange(a.range),l=RE(c,a.text);if(!l)return;let u=a.range.startLineNumber,d=[];if(n===`prefix`){let e=l.filter(e=>e.originalLength===0);if(e.length>1||e.length===1&&e[0].originalStart!==c.length)return}let f=a.text.length-i;for(let e of l){let t=a.range.startColumn+e.originalStart+e.originalLength;if(n===`subwordSmart`&&r&&r.lineNumber===a.range.startLineNumber&&t<r.column||e.originalLength>0)return;if(e.modifiedLength===0)continue;let i=e.modifiedStart+e.modifiedLength,o=Math.max(e.modifiedStart,Math.min(i,f)),s=a.text.substring(e.modifiedStart,o),c=a.text.substring(o,Math.max(e.modifiedStart,i));s.length>0&&d.push(new kE(t,s,!1)),c.length>0&&d.push(new kE(t,c,!0))}return new OE(u,d)}var LE=void 0;function RE(e,t){if(LE?.originalValue===e&&LE?.newValue===t)return LE?.changes;{let n=BE(e,t,!0);if(n){let r=zE(n);if(r>0){let i=BE(e,t,!1);i&&zE(i)<r&&(n=i)}}return LE={originalValue:e,newValue:t,changes:n},n}}function zE(e){let t=0;for(let n of e)t+=n.originalLength;return t}function BE(e,t,n){if(e.length>5e3||t.length>5e3)return;function r(e){let t=0;for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);r>t&&(t=r)}return t}let i=Math.max(r(e),r(t));function a(e){if(e<0)throw Error(`unexpected`);return i+e+1}function o(e){let t=0,r=0,i=new Int32Array(e.length);for(let o=0,s=e.length;o<s;o++)n&&e[o]===`(`?(i[o]=a(2*(r*100+t)),t++):n&&e[o]===`)`?(t=Math.max(t-1,0),i[o]=a(2*(r*100+t)+1),t===0&&r++):i[o]=e.charCodeAt(o);return i}let s=o(e),c=o(t);return new il({getElements:()=>s},{getElements:()=>c}).ComputeDiff(!1).changes}function VE(e,t){let n,r=!1,i=new a(new Oo(e,void 0,t.update),(e,i)=>{r||=(n=t.initial instanceof Function?t.initial():t.initial,!0);let a=t.update(e,n,i);return n=a,a},t.changeTracker,()=>{r&&=(t.disposeFinal?.(n),!1)},t.equalityComparer??Rc,(e,t,a)=>{if(!r)throw new Xs(`Can only set when there is a listener! This is to prevent leaks.`);Ai(t,t=>{n=e,i.setValue(e,t,a)})},Wl.ofCaller());return i}var HE=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UE=function(e,t){return function(n,r){t(n,r,e)}},WE=class{constructor(e,t){this._baseService=e,this._intercept=t}publicLog2(e,t){this._intercept(e,t),this._baseService.publicLog2(e,t)}},GE=class extends WE{constructor(e,t){super(e,(e,n)=>{let r=!0;n&&KE in n&&(r=!!n[KE]),r&&t.getDataChannel(`editTelemetry`).sendData({eventName:e,data:n??{}})})}};GE=HE([UE(0,au),UE(1,Ot)],GE);var KE=Symbol(`shouldForwardToChannel`);function qE(e){return{[KE]:e}}function JE(e){if(!e)return!1;let t=e.toLowerCase();return t===`github.copilot`||t===`github.copilot-chat`}function YE(e,t){e.publicLog2(`inlineCompletion.endOfLife`,t)}var XE=new Set(`;,=+-*/{}()[]<>:.!?&|^%@#~\`\\'"$`.split(``));function ZE(e){return XE.has(e)}function QE(e){return/[a-zA-Z0-9_]/.test(e)}function $E(e){return e===` `||e===` `}function eD(e){let t=e.split(/\r\n|\r|\n/);if(t.length>1)return{kind:`multiLine`,lineCount:t.length};let n=e.length===1,r;n&&(ZE(e)?r=`syntactical`:QE(e)?r=`identifier`:$E(e)&&(r=`whitespace`));let i=e.match(/[ \t]+/g)||[],a=i.some(e=>e.length>1),o=i.some(e=>e.includes(` `)||e.includes(` `)),s=e.split(/\s+/).filter(e=>e.length>0),c=s.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(s[0]),l=s.length>1;return{kind:`singleLine`,isSingleCharacter:n,singleCharacterKind:r,isWord:c,isMultipleWords:l,isMultipleWhitespace:a,hasDuplicatedWhitespace:o}}var tD=class{constructor(e){this.edits=e}toString(){return JSON.stringify({edits:this.edits})}};function nD(e,t,n){if(e.replacements.length!==0)return new tD(e.replacements.map(e=>iD(e,t)))}function rD(e){return e.length===0?0:e.split(/\r\n|\r|\n/).length-1}function iD(e,t,n){let r=e.replaceRange,i=e.newText,a=r.length,o=i.length,s=rD(i);switch(r.isEmpty?`insert`:i.length===0?`delete`:`replace`){case`insert`:return{operation:`insert`,properties:aD(r.start,i,t),charactersInserted:o,charactersDeleted:0,linesInserted:s,linesDeleted:0};case`delete`:{let e=t.getValue().substring(r.start,r.endExclusive);return{operation:`delete`,properties:oD(r.start,r.endExclusive,t),charactersInserted:0,charactersDeleted:a,linesInserted:0,linesDeleted:rD(e)}}case`replace`:{let e=t.getValue().substring(r.start,r.endExclusive);return{operation:`replace`,properties:sD(e,i),charactersInserted:o,charactersDeleted:a,linesInserted:s,linesDeleted:rD(e)}}}}function aD(e,t,n,r){let i=eD(t),a=n.getPositionAt(e),o=n.getLineContent(a.lineNumber),s=o.length,c,l=o.trim().length===0,u=a.column>s,d=a.column===1;return c=l?`emptyLine`:u?`endOfLine`:d?`startOfLine`:`middleOfLine`,{textShape:i,locationShape:c,relativeToCursor:void 0}}function oD(e,t,n){let r=eD(n.getValue().substring(e,t)),i=n.getPositionAt(e),a=n.getPositionAt(t),o=n.getLineContent(a.lineNumber);return{textShape:r,isAtEndOfLine:a.column>o.length,deletesEntireLineContent:i.lineNumber===a.lineNumber&&i.column===1&&a.column>o.length}}function sD(e,t){let n=eD(e),r=eD(t),i=n.kind===`singleLine`&&n.isWord,a=r.kind===`singleLine`&&r.isWord;return{isWordToWordReplacement:i&&a,isAdditive:t.length>e.length,isSubtractive:t.length<e.length,isSingleLineToSingleLine:n.kind===`singleLine`&&r.kind===`singleLine`,isSingleLineToMultiLine:n.kind===`singleLine`&&r.kind===`multiLine`,isMultiLineToSingleLine:n.kind===`multiLine`&&r.kind===`singleLine`}}function cD(e,t,n,r){let i=NE(e,n),a=e.range;if(!a||t&&!t.getStartPosition().equals(a.getStartPosition())||r.lineNumber!==i.range.startLineNumber||i.isEmpty)return!1;let o=n.getValueInRange(i.range,1),s=i.text,c=Math.max(0,r.column-i.range.startColumn),l=s.substring(0,c),u=s.substring(c),d=o.substring(0,c),f=o.substring(c),p=n.getLineIndentColumn(i.range.startLineNumber);return i.range.startColumn<=p&&(d=d.trimStart(),d.length===0&&(f=f.trimStart()),l=l.trimStart(),l.length===0&&(u=u.trimStart())),l.startsWith(d)&&!!Vl(f,u)}var lD;(function(e){function t(e){return e?.command.id??void 0}e.toString=t})(lD||={});var uD=class e extends cs{static snapshot(t){return new e(t)}constructor(e){super(),this._textModel=e,this._version=e.getVersionId()}get uri(){return this._textModel.uri}_assertValid(){this._textModel.getVersionId()!==this._version&&Hc(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();let e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new uu(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}},dD;(function(e){function t(e,t,n=!0){return!e.isInlineEdit&&!e.action?.uri&&e.action?.kind===`edit`?gD.create(e,t,e.action):_D.create(e,t,n)}e.create=t})(dD||={});function fD(e){let t=e?.kind===`edit`?{...e,alternativeAction:lD.toString(e.alternativeAction),target:e?.target.uri.toString()}:{...e,target:e?.target.uri.toString()};return JSON.stringify(t)}var pD=class{constructor(e,t,n,r){this._data=e,this.identity=t,this.hint=n,this.originalTextRef=r}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===pn.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 T.fromPositions(this.action.position);throw new Xs(`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 fD(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(e,t,n,r,i){let a=this.action?.kind===`edit`?this.action.textReplacement.text:``;this._data.reportInlineEditShown(e,a,t,n,this.computeEditKind(r),i)}reportPartialAccept(e,t,n){this._data.reportPartialAccept(e,t,n)}reportEndOfLife(e){this._data.reportEndOfLife(e)}setEndOfLifeReason(e){this._data.setEndOfLifeReason(e)}setIsPreceeded(e){this._data.setIsPreceeded(e.partialAccepts)}setNotShownReasonIfNotSet(e){this._data.setNotShownReason(e)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(e){this._data.setRenameProcessingInfo(e)}withAction(e){return this._data.withAction(e)}addPerformanceMarker(e){this._data.addPerformanceMarker(e)}},mD=class e{constructor(){this._onDispose=Or(this),this.onDispose=this._onDispose,this._jumpedTo=St(this,!1),this._refCount=0,this.id=`InlineCompletionIdentity`+ e.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)}},hD=class e{static create(t){return new e(T.lift(t.range),t.content,t.style)}constructor(e,t,n){this.range=e,this.content=t,this.style=n}withEdit(t,n){let r=Ql([new to(n.getOffset(this.range.getStartPosition()),n.getOffset(this.range.getEndPosition()))],t)[0];if(r)return new e(n.getRange(r),this.content,this.style)}},gD=class e extends pD{static create(t,n,r){let i=new mD,a=n.getTransformer(),o=r.insertText.replace(/\r\n|\r|\n/g,n.getEOL()),s=xD(new ec(a.getOffsetRange(r.range),o),n),c=s.removeCommonSuffixAndPrefix(n.getValue()),l=a.getTextReplacement(s),u=t.hint?hD.create(t.hint):void 0;return new e(s,c,l,l.range,r.snippetInfo,t.additionalTextEdits,t,i,u,n)}constructor(e,t,n,r,i,a,o,s,c,l){super(o,s,c,l),this._edit=e,this._trimmedEdit=t,this._textEdit=n,this._originalRange=r,this.snippetInfo=i,this.additionalTextEdits=a,this.isInlineEdit=!1}get action(){return{kind:`edit`,textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new $a([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(t){return new e(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,t,this.hint,this.originalTextRef)}withEdit(t,n){if(!this.originalTextRef.targets(n))return this;let r=Ql([this._edit.replaceRange],t);if(r.length===0)return;let i=new ec(r[0],this._textEdit.text),a=fE(n),o=a.getTextReplacement(i),s=this.hint;if(!(s&&(s=s.withEdit(t,a),!s)))return new e(i,i.removeCommonSuffixAndPrefix(n.getValue()),o,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,s,this.originalTextRef)}canBeReused(e,t){let n=this._textEdit.range;return!!n&&n.containsPosition(t)&&this.isVisible(e,t)&&uu.ofRange(n).isGreaterThanOrEqualTo(uu.ofRange(this._originalRange))}isVisible(e,t){return cD(this.getSingleTextEdit(),this._originalRange,e,t)}computeEditKind(e){return nD(new $a([this._edit]),e)}get editRange(){return this.getSingleTextEdit().range}},_D=class e extends pD{static create(t,n,r=!0){let i,a=[];if(t.action?.kind===`edit`){let e=r?vD(n,t.action.range,t.action.insertText):yD(n,t.action.range,t.action.insertText),o=Kc.fromStringEdit(e,n),s=e.isEmpty()?new fc(new T(1,1,1,1),``):o.toReplacement(n);a=e.replacements.map(e=>{let t=T.fromPositions(n.getPositionAt(e.replaceRange.start),n.getTransformer().getPosition(e.replaceRange.endExclusive)),r=n.getValueInRange(t);return bD.create(e,r)}),i={kind:`edit`,snippetInfo:t.action.snippetInfo,stringEdit:e,textReplacement:s,alternativeAction:t.action.alternativeAction,target:n}}else if(t.action?.kind===`jumpTo`)i={kind:`jumpTo`,position:t.action.position,offset:n.getTransformer().getOffset(t.action.position),target:n};else if(i=void 0,!t.hint)throw new Xs(`InlineEditItem: action is undefined and no hint is provided`);let o=new mD,s=t.hint?hD.create(t.hint):void 0;return new e(i,t,o,a,s,!1,n.getVersionId(),n)}constructor(e,t,n,r,i,a=!1,o,s){super(t,n,i,s),this._action=e,this._edits=r,this._lastChangePartOfInlineEdit=a,this._inlineEditModelVersion=o,this.snippetInfo=void 0,this.additionalTextEdits=[],this.isInlineEdit=!0}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(t){return new e(this._action,this._data,t,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(t,n,r){let i=fE(r),a=!1,o=this._inlineEditModelVersion,s,c=uD.snapshot(r);if(this.action?.kind===`edit`){if(n=n.map(e=>e.applyTextModelChanges(t)),n.some(e=>e.edit===void 0))return;let e=r.getVersionId();if(a=n.some(e=>e.lastChangeUpdatedEdit),a&&(o=e??-1),e===null||o+20<e||(n=n.filter(e=>!e.edit.isEmpty),n.length===0))return;let l=new $a(n.map(e=>e.edit));s={kind:`edit`,textReplacement:i.getTextEdit(l).toReplacement(new Ki(r)),snippetInfo:this.snippetInfo,stringEdit:l,alternativeAction:this.action.alternativeAction,target:c}}else if(this.action?.kind===`jumpTo`){let e=this.action.offset,n=t.applyToOffsetOrUndefined(e);if(n===void 0)return;s={kind:`jumpTo`,position:i.getPosition(n),offset:n,target:c}}else s=void 0;let l=this.hint;if(!(l&&(l=l.withEdit(t,i),!l)))return new e(s,this._data,this.identity,n,l,a,o,c)}computeEditKind(e){let t=this.action?.kind===`edit`?this.action.stringEdit:void 0;if(t)return nD(t,e)}};function vD(e,t,n){let r=e.getEOL(),i=e.getValueOfRange(t),a=n.replace(/\r\n|\r|\n/g,r),o=Ol.getDefault().computeDiff(yo(i),yo(a),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap(e=>e.innerChanges??[]);function s(e,t){let n=uu.fromPosition(t.getStartPosition());return uu.ofRange(t).createRange(n.addToPosition(e))}let c=new Yo(a);return new $a(o.map(n=>{let r=s(t.getStartPosition(),n.originalRange);return SD(new ec(e.getTransformer().getOffsetRange(r),c.getValueOfRange(n.modifiedRange)),e.getValueOfRange(r),o.length,e)}))}function yD(e,t,n){return new $a([new ec(e.getTransformer().getOffsetRange(t),n)])}var bD=class e{static create(t,n){let r=_n(t.newText,n),i=Pr(t.newText,n);return new e(t,t.newText.substring(r,t.newText.length-i),r,i)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}constructor(e,t,n,r,i=!1){this._edit=e,this._trimmedNewText=t,this._prefixLength=n,this._suffixLength=r,this._lastChangeUpdatedEdit=i}applyTextModelChanges(e){let t=this._clone();return t._applyTextModelChanges(e),t}_clone(){return new e(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(e){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new Xs(`UpdatedInnerEdits: No edit to apply changes to`);let 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 n=e.replaceRange.start,r=e.replaceRange.endExclusive,i=e.newText,a=!1,o=this._prefixLength>0||this._suffixLength>0;for(let s=t.replacements.length-1;s>=0;s--){let c=t.replacements[s],l=c.newText.length>0&&c.replaceRange.isEmpty;if(l&&!o&&c.replaceRange.start===n&&i.startsWith(c.newText)){n+=c.newText.length,i=i.substring(c.newText.length),r+=c.newText.length,a=!0;continue}if(l&&o&&c.replaceRange.start===n+this._prefixLength&&this._trimmedNewText.startsWith(c.newText)){r+=c.newText.length,a=!0,this._prefixLength+=c.newText.length,this._trimmedNewText=this._trimmedNewText.substring(c.newText.length);continue}if(c.newText.length===0&&c.replaceRange.length>0&&c.replaceRange.start>=n+this._prefixLength&&c.replaceRange.endExclusive<=r-this._suffixLength){r-=c.replaceRange.length,a=!0;continue}if(c.equals(e)){a=!0,n=c.replaceRange.endExclusive,i=``;continue}if(!(c.replaceRange.start>r)){if(c.replaceRange.endExclusive<n){n+=c.newText.length-c.replaceRange.length,r+=c.newText.length-c.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&n+this._prefixLength===r-this._suffixLength?{edit:new ec(new to(n+this._prefixLength,n+this._prefixLength),``),editHasChanged:!0}:{edit:new ec(new to(n,r),i),editHasChanged:a}}};function xD(e,t){let n=t.getEOL();return e.replaceRange.isEmpty&&e.newText.includes(n)&&(e=CD(e,t)),e}function SD(e,t,n,r){let i=r.getEOL();if(e.newText.endsWith(i)&&t.endsWith(i)&&(e=new ec(e.replaceRange.deltaEnd(-i.length),e.newText.slice(0,-i.length))),n===1&&e.replaceRange.isEmpty&&e.newText.includes(i)){let t=r.getTransformer().getPosition(e.replaceRange.start);r.getLineLength(t.lineNumber)!==0&&(e=CD(e,r))}if(n===1){let n=_n(t,e.newText),r=Pr(t.slice(n),e.newText.slice(n));if(n+r===t.length)return new ec(e.replaceRange.deltaStart(n).deltaEnd(-r),e.newText.substring(n,e.newText.length-r));if(n+r===e.newText.length)return new ec(e.replaceRange.deltaStart(n).deltaEnd(-r),``)}return e}function CD(e,t){if(!e.replaceRange.isEmpty)throw new Xs(`Unexpected original range`);if(e.replaceRange.start===0)return e;let n=t.getEOL(),r=t.getTransformer().getPosition(e.replaceRange.start),i=r.column,a=r.lineNumber;return i===1&&a>1&&e.newText.endsWith(n)&&!e.newText.startsWith(n)?new ec(e.replaceRange.delta(-1),n+e.newText.slice(0,-n.length)):e}function wD(e,t){let n=new Fe(new Us,e=>t.getLanguageConfiguration(e)),r=Ge(new Yn(new TD([e]),n),[],void 0,!0),i=``,a=e.getLineContent();function o(e,t){if(e.kind===2)if(o(e.openingBracket,t),t=b(t,e.openingBracket.length),e.child&&(o(e.child,t),t=b(t,e.child.length)),e.closingBracket)o(e.closingBracket,t),t=b(t,e.closingBracket.length);else{let t=n.getSingleLanguageBracketTokens(e.openingBracket.languageId).findClosingTokenText(e.openingBracket.bracketIds);i+=t}else if(e.kind!==3){if(e.kind===0||e.kind===1)i+=a.substring(js(t),js(b(t,e.length)));else if(e.kind===4)for(let n of e.children)o(n,t),t=b(t,n.length)}}return o(r,0),i}var TD=class{constructor(e){this.lines=e,this.tokenization={getLineTokens:e=>this.lines[e-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}},ED;(function(e){e.Jump=`jump`,e.Accept=`accept`,e.Inactive=`inactive`})(ED||={});var DD=class e{static create(t,n=!1){return new e(new Ze(_a(t),t),n)}constructor(e,t=!1){this.event=e,this.alternativeAction=t}},$;(function(e){e.GhostText=`ghostText`,e.Custom=`custom`,e.SideBySide=`sideBySide`,e.Deletion=`deletion`,e.InsertionInline=`insertionInline`,e.InsertionMultiLine=`insertionMultiLine`,e.WordReplacements=`wordReplacements`,e.LineReplacement=`lineReplacement`,e.Collapsed=`collapsed`,e.JumpTo=`jumpTo`})($||={});var OD=class{constructor(e,t,n,r,i,a,o,s){this.cursorColumnDistance=e,this.cursorLineDistance=t,this.lineCountOriginal=n,this.lineCountModified=r,this.characterCountOriginal=i,this.characterCountModified=a,this.disjointReplacements=o,this.sameShapeReplacements=s,this.longDistanceHintVisible=void 0,this.longDistanceHintDistance=void 0}setLongDistanceViewData(e,t){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(t-e)}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}}},kD=class e{constructor(){this._nodes=new Set,this._outgoingEdges=new Map}static from(t,n){let r=new e;for(let e of t)r._nodes.add(e);for(let e of t){let t=n(e);if(t.length>0){let n=new Set;for(let e of t)n.add(e);r._outgoingEdges.set(e,n)}}return r}removeCycles(){let e=[],t=new Set,n=new Set,r=[],i=a=>{t.add(a),n.add(a);let o=this._outgoingEdges.get(a);if(o)for(let s of o)t.has(s)?n.has(s)&&(e.push(s),r.push({from:a,to:s})):i(s);n.delete(a)};for(let e of this._nodes)t.has(e)||i(e);for(let{from:e,to:t}of r){let n=this._outgoingEdges.get(e);n&&n.delete(t)}return{foundCycles:e}}getOutgoing(e){let t=this._outgoingEdges.get(e);return t?Array.from(t):[]}};function AD(e,t,n,r,i,a){let o=Ko(`icr`),s=new ou,c,l={...r,requestUuid:o},u=LD(t,n),d=nt(e,e=>e.groupId),f=kD.from(e,e=>e.yieldsToGroupIds?.flatMap(e=>d.get(e)??[])??[]),{foundCycles:p}=f.removeCycles();p.length>0&&cc(Error(`Inline completions: cyclic yield-to dependency detected. Path: ${p.map(e=>e.toString?e.toString():``+e).join(` -> `)}`));let m=0,h=new dl(async e=>{try{if(m++,s.token.isCancellationRequested)return;let r=f.getOutgoing(e);for(let e of r){let r=await h.get(e);if(r){for(let e of r.inlineSuggestions.items)if(e.isInlineEdit||typeof e.insertText!=`string`&&e.insertText!==void 0||e.insertText!==void 0&&cD(new fc(T.lift(e.range)??u,e.insertText),void 0,n,t))return}}let o,d=Date.now();try{o=await e.provideInlineCompletions(n,t,l,s.token)}catch(e){cc(e);return}let p=Date.now();if(!o)return;let g=[],_=new ID(o,g,e);if(_.addRef(),jD(s.token,()=>_.removeRef(c)),s.token.isCancellationRequested)return;for(let e of o.items){let t=MD(e,_,u,n,a,l,i,{startTime:d,endTime:p});if(SE.is(t)){t.logError();continue}g.push(t)}return _}finally{m--}});return{contextWithUuid:l,get didAllProvidersReturn(){return m===0},lists:hs.fromPromisesResolveOrder(e.map(e=>h.get(e))).filter(mr),cancelAndDispose:e=>{c===void 0&&(c=e,s.dispose(!0))}}}function jD(e,t){if(e.isCancellationRequested)return t(),j.None;{let n=e.onCancellationRequested(()=>{n.dispose(),t()});return{dispose:()=>n.dispose()}}}function MD(e,t,n,r,i,a,o,s){let c,l=e.uri?On.revive(e.uri):void 0;if(e.jumpToPosition!==void 0)c={kind:`jumpTo`,position:M.lift(e.jumpToPosition),uri:l};else if(e.insertText!==void 0){let t,a,o=e.range?T.lift(e.range):n;if(typeof e.insertText==`string`){if(t=e.insertText,i&&e.completeBracketPairs){t=RD(t,o.getStartPosition(),r,i);let n=t.length-e.insertText.length;n!==0&&(o=new T(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+n))}a=void 0}else if(`snippet`in e.insertText){let n=e.insertText.snippet.length;if(i&&e.completeBracketPairs){e.insertText.snippet=RD(e.insertText.snippet,o.getStartPosition(),r,i);let t=e.insertText.snippet.length-n;t!==0&&(o=new T(o.startLineNumber,o.startColumn,o.endLineNumber,o.endColumn+t))}let s=new yf().parse(e.insertText.snippet);s.children.length===1&&s.children[0]instanceof uf?(t=s.children[0].value,a=void 0):(t=s.toString(),a={snippet:e.insertText.snippet,range:o})}else wl(e.insertText);c={kind:`edit`,range:o,insertText:t,snippetInfo:a,uri:l,alternativeAction:void 0}}else if(c=void 0,!e.hint)return SE.message(`Inline completion has no insertText, jumpToPosition nor hint.`);return new ND(c,e.hint,e.additionalTextEdits||hE(),e,t,a,e.isInlineEdit??!1,e.supportsRename??!1,o,s,e.correlationId)}var ND=class{get action(){return this._action}constructor(e,t,n,r,i,a,o,s,c,l,u){this._action=e,this.hint=t,this.additionalTextEdits=n,this.sourceInlineCompletion=r,this.source=i,this.context=a,this.isInlineEdit=o,this.supportsRename=s,this._requestInfo=c,this._providerRequestInfo=l,this._correlationId=u,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 PD,this._viewData={editorType:c.editorType}}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(e,t,n,r,i,a){if(this.updateShownDuration(n),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker(`shown`),this._didShow=!0,this._editKind=i,this._viewData.viewKind=n,this._viewData.renderData=r,this._timeUntilShown=a-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;let o=new Tn(r.lineCountModified,r.lineCountOriginal,r.characterCountModified,r.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,t,o),this.sourceInlineCompletion.shownCommand&&await e.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(e,t,n){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=n.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*n.ratio,1),this._partiallyAcceptedSinceOriginal.count+=n.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,t)}reportEndOfLife(e){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),e||=this._lastSetEndOfLifeReason??{kind:tt.Ignored,userTypingDisagreed:!1,supersededBy:void 0},e.kind===tt.Rejected&&!this._didShow&&(e={kind:tt.Ignored,userTypingDisagreed:!1,supersededBy:void 0}),e.kind===tt.Rejected&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){let t={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(e=>e.toString()).join(`,`),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,e,t)}}setIsPreceeded(e){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=e}setNotShownReason(e){this._notShownReason??=e}setEndOfLifeReason(e){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=e}updateShownDuration(e){let t=Date.now();this._showStartTime||=t;let n=e===$.Collapsed;!n&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=t),n&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=t-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;let e=Date.now();this._shownDuration+=e-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}setRenameProcessingInfo(e){if(this._renameInfo)throw new Xs(`Rename info has already been set.`);this._renameInfo=e}withAction(e){return this._action=e,this}addPerformanceMarker(e){this.performance.mark(e)}},PD=class{constructor(){this.markers=[],this.markers.push({name:`start`,timeStamp:Date.now()})}mark(e){this.markers.push({name:e,timeStamp:Date.now()})}toString(){let e=[];for(let t=1;t<this.markers.length;t++){let n=this.markers[t].timeStamp-this.markers[t-1].timeStamp;e.push({[this.markers[t].name]:n})}return JSON.stringify(e)}},FD;(function(e){e.TextEditor=`textEditor`,e.DiffEditor=`diffEditor`,e.Notebook=`notebook`})(FD||={});var ID=class{constructor(e,t,n){this.inlineSuggestions=e,this.inlineSuggestionsData=t,this.provider=n,this.refCount=0}addRef(){this.refCount++}removeRef(e={kind:`other`}){if(this.refCount--,this.refCount===0){for(let e of this.inlineSuggestionsData)e.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,e)}else this.refCount<0&&Hc(new Xs(`InlineSuggestionList (provider=${this.provider.providerId?.toString()}) refCount went negative (${this.refCount}) — more removeRef than addRef calls.`))}};function LD(e,t){let n=t.getWordAtPosition(e),r=t.getLineMaxColumn(e.lineNumber);return n?new T(e.lineNumber,n.startColumn,e.lineNumber,r):T.fromPositions(e,e.with(void 0,r))}function RD(e,t,n,r){let i=n.getLineContent(t.lineNumber),a=ec.replace(new to(t.column-1,i.length),e),o=n.tokenization.tokenizeLinesAt(t.lineNumber,[a.replace(i)])?.[0].sliceZeroCopy(a.getRangeAfterReplace());return o?wD(o,r):e}var zD=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},BD=function(e,t){return function(n,r){t(n,r,e)}},VD=new A(`renameInputVisible`,!1,V(1440,`Whether the rename input widget is visible`));new A(`renameInputFocused`,!1,V(1441,`Whether the rename input widget is focused`));var HD=class{constructor(e,t,n,r,i,a){this._editor=e,this._acceptKeybindings=t,this._themeService=n,this._keybindingService=r,this._logService=a,this.allowEditorOverflow=!0,this._disposables=new S,this._visibleContextKey=VD.bindTo(i),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new ve,this._inputWithButton=new WD,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(59)&&this._updateFont()})),this._disposables.add(n.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 UD(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;let t=e.getColor(Be),n=e.getColor(Jr);this._domNode.style.backgroundColor=String(e.getColor(Eu)??``),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:``,this._domNode.style.border=n?`1px solid ${n}`:``,this._domNode.style.color=String(e.getColor(vi)??``);let r=e.getColor(se);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(Qu)??``),this._inputWithButton.input.style.backgroundColor=String(e.getColor(Qu)??``),this._inputWithButton.domNode.style.borderWidth=r?`1px`:`0px`,this._inputWithButton.domNode.style.borderStyle=r?`solid`:`none`,this._inputWithButton.domNode.style.borderColor=r?.toString()??`none`}_updateFont(){if(this._domNode===void 0)return;Bi(this._label!==void 0,`RenameWidget#_updateFont: _label must not be undefined given _domNode is defined`),this._editor.applyFontInfo(this._inputWithButton.input);let 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;let e=Xl(this.getDomNode().ownerDocument.body),t=Po(this._editor.getDomNode()),n=this._getTopForPosition();this._nPxAvailableAbove=n+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;let r=this._editor.getOption(75),{totalHeight:i}=GD.getLayoutInfo({lineHeight:r}),a=this._nPxAvailableBelow>i*6?[2,1]:[1,2];return{position:this._position,preference:a}}beforeRender(){let[e,t]=this._acceptKeybindings;return this._label.innerText=V(1442,`{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;Bi(this._renameCandidateListView),Bi(this._nPxAvailableAbove!==void 0),Bi(this._nPxAvailableBelow!==void 0);let t=os(this._inputWithButton.domNode),n=os(this._label),r;r=e===2?this._nPxAvailableBelow:this._nPxAvailableAbove,this._renameCandidateListView.layout({height:r-n-t,width:qo(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,n,r,i){let{start:a,end:o}=this._getSelection(e,t);this._renameCts=i;let s=new S;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,r===void 0?this._inputWithButton.button.style.display=`none`:(this._inputWithButton.button.style.display=`flex`,this._requestRenameCandidatesOnce=r,this._requestRenameCandidates(t,!1),s.add(K(this._inputWithButton.button,`click`,()=>this._requestRenameCandidates(t,!0))),s.add(K(this._inputWithButton.button,pr.KEY_DOWN,e=>{let n=new kt(e);(n.equals(3)||n.equals(10))&&(n.stopPropagation(),n.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle(`preview`,n),this._position=new M(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute(`selectionStart`,a.toString()),this._inputWithButton.input.setAttribute(`selectionEnd`,o.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),s.add(bn(()=>{this._renameCts=void 0,i.dispose(!0)})),s.add(bn(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),s.add(bn(()=>this._candidates.clear()));let c=new Ea;return c.p.finally(()=>{s.dispose(),this._hide()}),this._currentCancelInput=e=>(this._trace(`invoking _currentCancelInput`),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(e),!0),this._currentAcceptInput=e=>{this._trace(`invoking _currentAcceptInput`),Bi(this._renameCandidateListView!==void 0);let r=this._renameCandidateListView.nCandidates,i,a,o=this._renameCandidateListView.focusedCandidate;if(o===void 0?(this._trace(`using new name from inputField`),i=this._inputWithButton.input.value,a=this._isEditingRenameCandidate?{k:`userEditedRenameSuggestion`}:{k:`inputField`}):(this._trace(`using new name from renameSuggestion`),i=o,a={k:`renameSuggestion`}),i===t||i.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(),c.complete({newName:i,wantsPreview:n&&e,stats:{source:a,nRenameSuggestions:r,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},s.add(i.token.onCancellationRequested(()=>this.cancelInput(!0,`cts.token.onCancellationRequested`))),s.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),`editor.onDidBlurEditorWidget`))),this._show(),c.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),Bi(this._renameCts),this._inputWithButton.buttonState!==`stop`)){this._renameCandidateProvidersCts=new ou;let n=t?td.Invoke:td.Automatic,r=this._requestRenameCandidatesOnce(n,this._renameCandidateProvidersCts.token);if(r.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(r,e,this._renameCts.token)}}_getSelection(e,t){Bi(this._editor.hasModel());let n=this._editor.getSelection(),r=0,i=t.length;return!T.isEmpty(n)&&!T.spansMultipleLines(n)&&T.containsRange(e,n)&&(r=Math.max(0,n.startColumn-e.startColumn),i=Math.min(e.endColumn,n.endColumn)-e.startColumn),{start:r,end:i}}_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,n){let r=(...e)=>this._trace(`_updateRenameCandidates`,...e);r(`start`);let i=await Vc(Promise.allSettled(e),n);if(this._inputWithButton.setSparkleButton(),i===void 0){r(`returning early - received updateRenameCandidates results - undefined`);return}let a=i.flatMap(e=>e.status===`fulfilled`&&mr(e.value)?e.value:[]);r(`received updateRenameCandidates results - total (unfiltered) ${a.length} candidates.`);let o=Ca(a,e=>e.newSymbolName);r(`distinct candidates - ${o.length} candidates.`);let s=o.filter(({newSymbolName:e})=>e.trim().length>0&&e!==this._inputWithButton.input.value&&e!==t&&!this._candidates.has(e));if(r(`valid distinct candidates - ${a.length} candidates.`),s.forEach(e=>this._candidates.add(e.newSymbolName)),s.length<1){r(`returning early - no valid distinct candidates`);return}r(`setting candidates`),this._renameCandidateListView.setCandidates(s),r(`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(){let e=this._editor.getVisibleRanges(),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)}};HD=zD([BD(2,Ll),BD(3,jr),BD(4,G),BD(5,Pl)],HD);var UD=class e{constructor(t,n){this._disposables=new S,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=n.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=n.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement(`div`),this._listContainer.className=`rename-box rename-candidate-list-container`,t.appendChild(this._listContainer),this._listWidget=e._createListWidget(this._listContainer,this._candidateViewHeight,n.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(e=>{e.elements.length===1&&n.onFocusChange(e.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(e=>{e.elements.length===1&&n.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(e=>{this._listWidget.setFocus([])})),this._listWidget.style(Fo({listInactiveFocusForeground:xn,listInactiveFocusBackground:Ds}))}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);let t=this._pickListHeight(this._listWidget.length),n=this._pickListWidth(e);this._listWidget.layout(t,n),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${n}px`,zt(V(1443,`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;let e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;let t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;let 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();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;let e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}else if(e[0]===0)return this._listWidget.setFocus([]),!1;else{this._listWidget.focusPrevious();let e=this._listWidget.getFocus()[0];return this._listWidget.reveal(e),!0}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){let{totalHeight:e}=GD.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){let t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){let t=Math.ceil(Math.max(...e.map(e=>e.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,n){return new et(`NewSymbolNameCandidates`,e,new class{getTemplateId(e){return`candidate`}getHeight(e){return t}},[new class{constructor(){this.templateId=`candidate`}renderTemplate(e){return new GD(e,n)}renderElement(e,t,n){n.populate(e)}disposeTemplate(e){e.dispose()}}],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}},WD=class{constructor(){this._buttonHoverContent=``,this._disposables=new S,this._onDidInputChange=this._disposables.add(new U),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`,V(1444,`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=V(1445,`Generate New Name Suggestions`),this._buttonCancelHoverText=V(1446,`Cancel`),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(fn().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(K(this.input,pr.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(K(this.input,pr.KEY_DOWN,e=>{let t=new kt(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(K(this.input,pr.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(K(this.input,pr.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(K(this.input,pr.BLUR,()=>{this.domNode.style.outline=`none`}))),this._domNode}get input(){return Bi(this._inputNode),this._inputNode}get button(){return Bi(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState=`sparkle`,this._sparkleIcon??=ed(D.sparkle),Mc(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??=ed(D.stopCircle),Mc(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()}},GD=class e{static{this._PADDING=2}constructor(n,r){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=`${r.lineHeight}px`,this._domNode.style.padding=`${e._PADDING}px`;let i=document.createElement(`div`);i.style.display=`flex`,i.style.alignItems=`center`,i.style.width=i.style.height=`${r.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=ed(D.sparkle),this._icon.style.display=`none`,i.appendChild(this._icon),this._label=document.createElement(`div`),t(this._label,r),this._domNode.appendChild(this._label),n.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){let t=!!e.tags?.includes(Ar.AIGenerated);this._icon.style.display=t?`inherit`:`none`}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:t}){return{totalHeight:t+e._PADDING*2}}dispose(){}},KD=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},qD=function(e,t){return function(n,r){t(n,r,e)}},JD,YD=class{constructor(e,t,n){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=n.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){let t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){let n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;let r=await n.resolveRenameLocation(this.model,this.position,e);if(r){if(r.rejectReason){t.push(r.rejectReason);continue}return r}}this._providerRenameIdx=0;let n=this.model.getWordAtPosition(this.position);return n?{range:new T(this.position.lineNumber,n.startColumn,this.position.lineNumber,n.endColumn),text:n.word,rejectReason:t.length>0?t.join(`
35
+ `):void 0}:{range:T.fromPositions(this.position),text:``,rejectReason:t.length>0?t.join(`
36
+ `):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,n,r){let i=this._providers[t];if(!i)return{edits:[],rejectReason:n.join(`
37
+ `)};let a=await i.provideRenameEdits(this.model,this.position,e,r);return a?a.rejectReason?this._provideRenameEdits(e,t+1,n.concat(a.rejectReason),r):a:this._provideRenameEdits(e,t+1,n.concat(V(1429,`No result.`)),r)}};function XD(e,t){return e.ordered(t).length>0}async function ZD(e,t,n,r,i){return new YD(t,n,e).provideRenameEdits(r,i??B.None)}async function QD(e,t,n,r){let i=new YD(t,n,e),a=await i.resolveRenameLocation(B.None);return a?.rejectReason?{edits:[],rejectReason:a.rejectReason}:i.provideRenameEdits(r,B.None)}var $D=class{static{JD=this}static{this.ID=`editor.contrib.renameController`}static get(e){return e.getContribution(JD.ID)}constructor(e,t,n,r,i,a,o,s){this.editor=e,this._instaService=t,this._notificationService=n,this._bulkEditService=r,this._progressService=i,this._logService=a,this._configService=o,this._languageFeaturesService=s,this._disposableStore=new S,this._cts=new ou,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(HD,this.editor,[`acceptRenameInput`,`acceptRenameInputWithPreview`]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){let e=this._logService.trace.bind(this._logService,`[rename]`);if(this._cts.dispose(!0),this._cts=new ou,!this.editor.hasModel()){e(`editor has no model`);return}let t=this.editor.getPosition(),n=new YD(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!n.hasProvider()){e(`skeleton has no provider`);return}let r=new pe(this.editor,5,void 0,this._cts.token),i;try{e(`resolving rename location`);let t=n.resolveRenameLocation(r.token);this._progressService.showWhile(t,250),i=await t,e(`resolved rename location`)}catch(n){n instanceof Jl?e(`resolve rename location cancelled`,JSON.stringify(n,null,` `)):(e(`resolve rename location failed`,n instanceof Error?n:JSON.stringify(n,null,` `)),(typeof n==`string`||$t(n))&&Jd.get(this.editor)?.showMessage(n||V(1430,`An unknown error occurred while resolving rename location`),t));return}finally{r.dispose()}if(!i){e(`returning early - no loc`);return}if(i.rejectReason){e(`returning early - rejected with reason: ${i.rejectReason}`,i.rejectReason),Jd.get(this.editor)?.showMessage(i.rejectReason,t);return}if(r.token.isCancellationRequested){e(`returning early - cts1 cancelled`);return}let a=new pe(this.editor,5,i.range,this._cts.token),o=this.editor.getModel(),s=this._languageFeaturesService.newSymbolNamesProvider.all(o),c=await Promise.all(s.map(async e=>[e,await e.supportsAutomaticNewSymbolNamesTriggerKind??!1])),l=(e,t)=>{let n=c.slice();return e===td.Automatic&&(n=n.filter(([e,t])=>t)),n.map(([n])=>n.provideNewSymbolNames(o,i.range,e,t))};e(`creating rename input field and awaiting its result`);let u=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,`editor.rename.enablePreview`),d=await this._renameWidget.getInput(i.range,i.text,u,s.length>0?l:void 0,a);if(e(`received response from rename input field`),typeof d==`boolean`){e(`returning early - rename input field response - ${d}`),d&&this.editor.focus(),a.dispose();return}this.editor.focus(),e(`requesting rename edits`);let f=Vc(n.provideRenameEdits(d.newName,a.token),a.token).then(async t=>{if(!t){e(`returning early - no rename edits result`);return}if(!this.editor.hasModel()){e(`returning early - no model after rename edits are provided`);return}if(t.rejectReason){e(`returning early - rejected with reason: ${t.rejectReason}`),this._notificationService.info(t.rejectReason);return}this.editor.setSelection(T.fromPositions(this.editor.getSelection().getPosition())),e(`applying edits`),this._bulkEditService.apply(t,{editor:this.editor,showPreview:d.wantsPreview,label:V(1431,`Renaming '{0}' to '{1}'`,i?.text,d.newName),code:`undoredo.rename`,quotableLabel:V(1432,`Renaming {0} to {1}`,i?.text,d.newName),respectAutoSaveConfig:!0,reason:Ln.rename(i?.text,d.newName)}).then(t=>{e(`edits applied`),t.ariaSummary&&$c(V(1433,`Successfully renamed '{0}' to '{1}'. Summary: {2}`,i.text,d.newName,t.ariaSummary))}).catch(t=>{e(`error when applying edits ${JSON.stringify(t,null,` `)}`),this._notificationService.error(V(1434,`Rename failed to apply edits`)),this._logService.error(t)})},t=>{e(`error when providing rename edits`,JSON.stringify(t,null,` `)),this._notificationService.error(V(1435,`Rename failed to compute edits`)),this._logService.error(t)}).finally(()=>{a.dispose()});return e(`returning rename operation`),this._progressService.showWhile(f,250),f}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,`cancelRenameInput command`)}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};$D=JD=KD([qD(1,w),qD(2,di),qD(3,Et),qD(4,Fc),qD(5,Pl),qD(6,gl),qD(7,q)],$D);var eO=class extends N{constructor(){super({id:`editor.action.rename`,label:J(1437,`Rename Symbol`),precondition:m.and(z.writable,z.hasRenameProvider),kbOpts:{kbExpr:z.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:`1_modification`,order:1.1},canTriggerInlineEdits:!0})}runCommand(e,t){let n=e.get(Di),[r,i]=Array.isArray(t)&&t||[void 0,void 0];return On.isUri(r)&&M.isIPosition(i)?n.openCodeEditor({resource:r},n.getActiveCodeEditor()).then(e=>{e&&(e.setPosition(i),e.invokeWithinContext(t=>(this.reportTelemetry(t,e),this.run(t,e))))},Hc):super.runCommand(e,t)}run(e,t){let n=e.get(Pl),r=$D.get(t);return r?(n.trace(`[RenameAction] got controller, running...`),r.run()):(n.trace(`[RenameAction] returning early - controller missing`),Promise.resolve())}};F($D.ID,$D,4),O(eO);var tO=mt.bindToContribution($D.get);R(new tO({id:`acceptRenameInput`,precondition:VD,handler:e=>e.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:m.and(z.focus,m.not(`isComposing`)),primary:3}})),R(new tO({id:`acceptRenameInputWithPreview`,precondition:m.and(VD,m.has(`config.editor.rename.enablePreview`)),handler:e=>e.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:m.and(z.focus,m.not(`isComposing`)),primary:2051}})),R(new tO({id:`cancelRenameInput`,precondition:VD,handler:e=>e.cancelRenameInput(),kbOpts:{weight:199,kbExpr:z.focus,primary:9,secondary:[1033]}})),x(class extends Ru{constructor(){super({id:`focusNextRenameSuggestion`,title:{...J(1438,`Focus Next Rename Suggestion`)},precondition:VD,keybinding:[{primary:18,weight:199}]})}run(e){let t=e.get(Di).getFocusedCodeEditor();if(!t)return;let n=$D.get(t);n&&n.focusNextRenameSuggestion()}}),x(class extends Ru{constructor(){super({id:`focusPreviousRenameSuggestion`,title:{...J(1439,`Focus Previous Rename Suggestion`)},precondition:VD,keybinding:[{primary:16,weight:199}]})}run(e){let t=e.get(Di).getFocusedCodeEditor();if(!t)return;let n=$D.get(t);n&&n.focusPreviousRenameSuggestion()}}),br(`_executeDocumentRenameProvider`,function(e,t,n,...r){let[i]=r;Bi(typeof i==`string`);let{renameProvider:a}=e.get(q);return QD(a,t,n,i)}),br(`_executePrepareRename`,async function(e,t,n){let{renameProvider:r}=e.get(q),i=await new YD(t,n,r).resolveRenameLocation(B.None);if(i?.rejectReason)throw Error(i.rejectReason);return i}),Un.as(Ro.Configuration).registerConfiguration({id:`editor`,properties:{"editor.rename.enablePreview":{scope:6,description:V(1436,`Enable/disable the ability to preview changes before renaming`),default:!0,type:`boolean`}}});var nO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},rO=function(e,t){return function(n,r){t(n,r,e)}},iO;(function(e){e.no=`no`,e.yes=`yes`,e.maybe=`maybe`})(iO||={}),(function(e){function t(t){switch(t){case`no`:return e.no;case`yes`:return e.yes;case`maybe`:return e.maybe;default:return e.no}}e.fromString=t})(iO||={});var aO=class{constructor(){}inferRename(e,t,n,r){let i=new T(t.startLineNumber,1,t.endLineNumber,e.getLineMaxColumn(t.endLineNumber)),a=t.startColumn-i.startColumn,o=i.endColumn-t.endColumn,s=e.getValueInRange(i),c=e.getValueInRange(new T(i.startLineNumber,i.startColumn,i.startLineNumber,i.startColumn+a))+n+e.getValueInRange(new T(i.endLineNumber,i.endColumn-o,i.endLineNumber,i.endColumn)),l=[],u=[],d,f,p,m=e.getOffsetAt(i.getStartPosition()),{changes:h}=new il(new Wt(s),new Wt(c)).ComputeDiff(!0);if(h.length===0)return;let g=[];for(let t of h){if(g.length===0){g.push(t);continue}let n=g[g.length-1],r=t.originalStart-(n.originalStart+n.originalLength);if(r>0){let i=m+n.originalStart+n.originalLength,a=e.getPositionAt(i),o=e.getWordAtPosition(a);if(o){let s=e.getOffsetAt(new M(a.lineNumber,o.startColumn)),c=e.getOffsetAt(new M(a.lineNumber,o.endColumn)),l=i+r;if(s<=i&&l<=c&&s<=l&&l<=c){n.originalLength=t.originalStart+t.originalLength-n.originalStart,n.modifiedLength=t.modifiedStart+t.modifiedLength-n.modifiedStart;continue}}}g.push(t)}let _=0;for(let t of g){let n=s.substring(t.originalStart,t.originalStart+t.originalLength),i=c.substring(t.modifiedStart,t.modifiedStart+t.modifiedLength),a=m+t.originalStart,o=e.getPositionAt(a),h=a+t.originalLength,g=e.getPositionAt(h),v=T.fromPositions(o,g),y=i.length-t.originalLength;if(/\s/.test(n)){l.push(new fc(v,i)),_+=y;continue}if(n.length>0){r.lastIndex=0;let e=r.exec(n);if(e===null||e.index!==0||e[0].length!==n.length){l.push(new fc(v,i)),_+=y;continue}}if(/\s/.test(i)){l.push(new fc(v,i)),_+=y;continue}if(i.length>0){r.lastIndex=0;let e=r.exec(i);if(e===null||e.index!==0||e[0].length!==i.length){l.push(new fc(v,i)),_+=y;continue}}let b=e.getWordAtPosition(o);if(b===null){l.push(new fc(v,i)),_+=y;continue}let ee=t.originalStart+1,te=t.originalLength===0&&t.modifiedLength>0,ne;if(ne=te&&ee===b.endColumn&&b.endColumn>b.startColumn?this.getTokenAtPosition(e,new M(o.lineNumber,b.startColumn)):this.getTokenAtPosition(e,o),b.startColumn!==ne.range.startColumn||b.endColumn!==ne.range.endColumn){l.push(new fc(v,i)),_+=y;continue}if(ne.type===0){let t=e.getValueInRange(ne.range);if(t.length===0){l.push(new fc(v,i)),_+=y;continue}if(d===void 0)d=t;else if(d!==t){l.push(new fc(v,i)),_+=y;continue}let n=e.getOffsetAt(ne.range.getStartPosition())-m+_,r=e.getOffsetAt(ne.range.getEndPosition())-m+_;if(t=c.substring(n,r+y),t.length===0){l.push(new fc(v,i)),_+=y;continue}if(f===void 0)f=t;else if(f!==t){l.push(new fc(v,i)),_+=y;continue}p===void 0&&(p=ne.range.getStartPosition()),d!==void 0&&f!==void 0&&d.length>0&&f.length>0&&d!==f?u.push(new fc(ne.range,f)):u.push(new fc(v,i)),_+=y}else l.push(new fc(v,i)),_+=i.length-t.originalLength}if(d===void 0||f===void 0||p===void 0||d.length===0||f.length===0||d===f)return;r.lastIndex=0;let v=r.exec(d);if(!(v===null||v.index!==0||v[0].length!==d.length)&&(r.lastIndex=0,v=r.exec(f),!(v===null||v.index!==0||v[0].length!==f.length)))return{renames:{edits:u,position:p,oldName:d,newName:f},others:{edits:l}}}getTokenAtPosition(e,t){e.tokenization.tokenizeIfCheap(t.lineNumber);let n=e.tokenization.getLineTokens(t.lineNumber),r=n.findTokenIndexAtOffset(t.column-1);return{type:n.getStandardTokenType(r),range:new T(t.lineNumber,1+n.getStartOffset(r),t.lineNumber,1+n.getEndOffset(r))}}},oO=class e{static create(t,n){let r=t.getFocusedCodeEditor();if(r!==null&&r.getModel()===n)return new e(r,n.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}},sO=class{constructor(e,t,n,r,i,a,o,s,c){if(this._result=void 0,this._commandService=t,this._textModel=r,this._state=i,this._requestUuid=n,this._cancellationTokenSource=new ou,s===void 0||c===void 0){this._promise=ZD(e.renameProvider,r,a,o,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(r,a,c,o,s)}get requestUuid(){return this._requestUuid}isValid(e){return this._state.equals(oO.create(e,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;let e=await this.getResult();return e===void 0||this._cancellationTokenSource.token.isCancellationRequested?0:e.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(e,t,n,r,i){try{let a=await this._commandService.executeCommand(`github.copilot.nes.postRename`,e.uri,t,n,r,i);if(a===void 0)return{rejectReason:`Rename failed`,edits:[]};let o=[];for(let e of a)for(let t of e.changes){let n=new T(t.range.start.line+1,t.range.start.character+1,t.range.end.line+1,t.range.end.character+1),i=new fi(e.file,new fc(n,t.newText??r));o.push(i)}return{edits:o}}catch{return{rejectReason:`Rename failed`,edits:[]}}}},cO=class extends j{constructor(e,t,n,r,i,a){super(),this._commandService=e,this._languageFeaturesService=t,this._languageConfigurationService=n,this._renameSymbolTrackerService=i,this._codeEditorService=a,this._renameInferenceEngine=new aO,this._renameRunnable=void 0,this._register(jn.registerCommand(Ah,async(e,t,n)=>{if(!(n===void 0||!n.isValid(this._codeEditorService)))try{let e=await n.getWorkspaceEdit();if(e===void 0)return;r.apply(e,{reason:t})}finally{this._renameRunnable===n&&(this._renameRunnable=void 0)}}))}async proposeRenameRefactoring(e,t,n){if(!t.supportsRename||t.action?.kind!==`edit`||n.selectedSuggestionInfo||!XD(this._languageFeaturesService.renameProvider,e))return t;let r=oO.create(this._codeEditorService,e);if(r===void 0)return t;let i=Date.now(),a=t.action.textReplacement,o=this._languageConfigurationService.getLanguageConfiguration(e.getLanguageId()),s=this._renameInferenceEngine.inferRename(e,a.range,a.text,o.wordDefinition);if(s===void 0||s.renames.edits.length===0)return t;let{oldName:c,newName:l,position:u,edits:d}=s.renames,f=this._renameSymbolTrackerService.trackedWord.get(),p;f!==void 0&&f.model===e&&f.originalWord===c&&f.currentWord===l&&(p=f.currentRange);let m=!1,h=await rs(this.checkRenamePrecondition(t,e,u,c,l,p),100,()=>{m=!0}),g=this.isRenamePossible(t,h,r,e);if(t.setRenameProcessingInfo({createdRename:g,duration:Date.now()-i,timedOut:m,droppedOtherEdits:g?s.others.edits.length:void 0,droppedRenameEdits:g?d.length-1:void 0}),!g)return t;this._renameRunnable===void 0&&(this._renameRunnable=new sO(this._languageFeaturesService,this._commandService,t.requestUuid,e,r,u,l,p,p===void 0?void 0:c));let _=Ln.inlineCompletionAccept({nes:t.isInlineEdit,requestUuid:t.requestUuid,providerId:t.source.provider.providerId,languageId:e.getLanguageId(),correlationId:t.getSourceCompletion().correlationId}),v={id:Ah,title:V(1254,`Rename`),arguments:[_,this._renameRunnable]},y={label:V(1255,`Rename`),icon:D.replaceAll,command:v,count:this._renameRunnable.getCount()},b={kind:`edit`,range:d[0].range,insertText:d[0].text,snippetInfo:t.snippetInfo,alternativeAction:y,uri:e.uri},ee=uD.snapshot(e);return dD.create(t.withAction(b),ee,!1)}async checkRenamePrecondition(e,t,n,r,i,a){let o={canRename:iO.no,timedOut:!1};try{let s=await this._commandService.executeCommand(`github.copilot.nes.prepareRename`,t.uri,n,r,i,e.requestUuid,a);if(s===void 0)return o;if(typeof s==`string`){let e=iO.fromString(s);return e===iO.yes||e===iO.maybe?{canRename:e,oldName:r,onOldState:!1}:{canRename:e,timedOut:!1}}else return s}catch{return o}}isRenamePossible(e,t,n,r){return t===void 0||t.canRename===iO.no||!n.equals(oO.create(this._codeEditorService,r))?!1:this._renameRunnable===void 0?!0:this._renameRunnable.requestUuid===e.requestUuid?!1:(this._renameRunnable.cancel(),this._renameRunnable=void 0,!0)}};cO=nO([rO(0,tr),rO(1,q),rO(2,eu),rO(3,Et),rO(4,Ye),rO(5,Di)],cO);var lO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},uO=function(e,t){return function(n,r){t(n,r,e)}},dO,fO=class extends j{static{dO=this}static{this._requestId=0}constructor(e,t,n,r,i,a,o,s,c,l){super(),this._textModel=e,this._versionId=t,this._debounceValue=n,this._cursorPosition=r,this._languageConfigurationService=i,this._logService=a,this._configurationService=o,this._instantiationService=s,this._contextKeyService=c,this._textModelService=l,this._updateOperation=this._register(new Ae),this._state=VE(this,{initial:()=>({inlineCompletions:_O.createEmpty(),suggestWidgetInlineCompletions:_O.createEmpty()}),disposeFinal:e=>{e.inlineCompletions.dispose(),e.suggestWidgetInlineCompletions.dispose()},changeTracker:Mu(()=>({versionId:this._versionId})),update:(e,t,n)=>{let r=$a.compose(n.changes.map(e=>e.change?ei(e.change.changes):$a.empty).filter(mr));if(r.isEmpty())return t;try{return{inlineCompletions:t.inlineCompletions.createStateWithAppliedEdit(r,this._textModel),suggestWidgetInlineCompletions:t.suggestWidgetInlineCompletions.createStateWithAppliedEdit(r,this._textModel)}}finally{t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}}}),this.inlineCompletions=this._state.map(this,e=>e.inlineCompletions),this.suggestWidgetInlineCompletions=this._state.map(this,e=>e.suggestWidgetInlineCompletions),this._completionsEnabled=void 0,this.clearOperationOnTextModelChange=L(this,e=>{this._versionId.read(e),this._updateOperation.clear()}),this._loadingCount=St(this,0),this.loading=this._loadingCount.map(this,e=>e>0),this._loggingEnabled=$l(`editor.inlineSuggest.logFetch`,!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=$l(`editor.inlineSuggest.emptyResponseInformation`,!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(RT.cast(),`editor.inlineSuggest.logFetch.commandId`)),this._renameProcessor=this._store.add(this._instantiationService.createInstance(cO)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store);let u=Jc.defaultChatAgent?.completionsEnablementSetting??void 0;u&&(this._updateCompletionsEnablement(u),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(u)&&this._updateCompletionsEnablement(u)}))),this._state.recomputeInitiallyAndOnChange(this._store)}_updateCompletionsEnablement(e){let t=this._configurationService.getValue(e);Il(t)?this._completionsEnabled=t:this._completionsEnabled=void 0}_log(e){this._loggingEnabled.get()&&this._logService.info(LT(e)),this._structuredFetchLogger.log(e)}fetch(e,t,n,r,i,a,o){let s=new pO(this._cursorPosition.get(),n,this._textModel.getVersionId(),new Set(e)),c=n.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(s))return this._updateOperation.value.promise;if(c?.request?.satisfies(s))return Promise.resolve(!0);let l=!!this._updateOperation.value;this._updateOperation.clear();let u=new ou,d=(async()=>{let c=new S;this._loadingCount.set(this._loadingCount.get()+1,void 0);let d=!1,f=()=>{d||(d=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0))};c.add(new Cl(()=>f(),10*1e3)).schedule();let p=new mO(n,o,e.filter(e=>e.providerId));try{let d=this._debounceValue.get(this._textModel),f=bu(e.map(e=>e.debounceDelayMs),$o(Ee))??d;if((l||i&&n.triggerKind===pn.Automatic)&&await xE(f,u.token),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==s.versionId)return p.setNoSuggestionReasonIfNotSet(`canceled:beforeFetch`),!1;let m=dO._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:`InlineCompletions.fetch`,kind:`start`,requestId:m,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:n.triggerKind,suggestInfo:n.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});let h=new Date,g=AD(e,this._cursorPosition.get(),this._textModel,n,o,this._languageConfigurationService);jD(u.token,()=>g.cancelAndDispose({kind:`tokenCancellation`}));let _=!1,v=!1,y=[];for await(let e of g.lists)if(e){e.addRef(),c.add(bn(()=>e.removeRef(e.inlineSuggestionsData.length===0?{kind:`empty`}:{kind:`notTaken`})));for(let t of e.inlineSuggestionsData){if(v=!0,!n.includeInlineEdits&&(t.isInlineEdit||t.showInlineEditMenu)){t.setNotShownReason(`notInlineEditRequested`);continue}if(!n.includeInlineCompletions&&!(t.isInlineEdit||t.showInlineEditMenu)){t.setNotShownReason(`notInlineCompletionRequested`);continue}t.addPerformanceMarker(`providerReturned`);let e=t.action?.uri,r,i;if(e&&e.toString()!==this._textModel.uri.toString()){let t=await this._textModelService.createModelReference(e);r=t.object.textEditorModel,i=t}else r=this._textModel,i=void 0;let a=uD.snapshot(r),o=dD.create(t,a);if(i){let e=de(o.identity.onDispose,()=>{i?.dispose(),e.dispose()})}t.addPerformanceMarker(`itemCreated`),y.push(o),!o.isInlineEdit&&!o.showInlineEditMenu&&n.triggerKind===pn.Automatic&&o.isVisible(this._textModel,this._cursorPosition.get())&&(_=!0)}if(_)break}y.forEach(e=>e.addPerformanceMarker(`providersResolved`));let b=await Promise.all(y.map(async e=>this._renameProcessor.proposeRenameRefactoring(this._textModel,e,n)));if(b.forEach(e=>e.addPerformanceMarker(`renameProcessed`)),g.cancelAndDispose({kind:`lostRace`}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let e=g.didAllProvidersReturn,t;(u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==s.versionId)&&(t=`canceled`);let n=b.map(e=>{let t=e.getSourceCompletion();if(!t.doNotLog)return{...Ke({insertText:t.insertText,range:t.range,additionalTextEdits:t.additionalTextEdits,uri:t.uri,command:t.command,gutterMenuLinkAction:t.gutterMenuLinkAction,shownCommand:t.shownCommand,completeBracketPairs:t.completeBracketPairs,isInlineEdit:t.isInlineEdit,showInlineEditMenu:t.showInlineEditMenu,showRange:t.showRange,warning:t.warning,hint:t.hint,supportsRename:t.supportsRename,correlationId:t.correlationId,jumpToPosition:t.jumpToPosition},e=>T.isIRange(e)?T.lift(e).toString():M.isIPosition(e)?M.lift(e).toString():Jn.is(e)?{$commandId:e.id}:e),$providerId:e.source.provider.providerId?.toString()}}).filter(e=>e!==void 0);this._log({sourceId:`InlineCompletions.fetch`,kind:`end`,requestId:m,durationMs:Date.now()-h.getTime(),error:t,result:n,time:Date.now(),didAllProvidersReturn:e})}if(p.setRequestUuid(g.contextWithUuid.requestUuid),v)p.setHasProducedSuggestion(),b.length>0&&u.token.isCancellationRequested&&b.forEach(e=>e.setNotShownReasonIfNotSet(`canceled:whileAwaitingOtherProviders`));else if(u.token.isCancellationRequested)p.setNoSuggestionReasonIfNotSet(`canceled:whileFetching`);else{let e=this._contextKeyService.getContextKeyValue(`completionsQuotaExceeded`);p.setNoSuggestionReasonIfNotSet(e?`completionsQuotaExceeded`:`noSuggestion`)}let ee=n.earliestShownDateTime-Date.now();if(ee>0&&await xE(ee,u.token),b.forEach(e=>e.addPerformanceMarker(`minShowDelayPassed`)),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==s.versionId||a.get()){let e=u.token.isCancellationRequested?`canceled:afterMinShowDelay`:this._store.isDisposed?`canceled:disposed`:this._textModel.getVersionId()===s.versionId?a.get()?`canceled:userJumped`:`unknown`:`canceled:documentChanged`;return b.forEach(t=>t.setNotShownReasonIfNotSet(e)),!1}let te=new Date;this._debounceValue.update(this._textModel,te.getTime()-h.getTime());let ne=this._cursorPosition.get();this._updateOperation.clear(),ut(e=>{let t=this._state.get();n.selectedSuggestionInfo?this._state.set({inlineCompletions:_O.createEmpty(),suggestWidgetInlineCompletions:t.suggestWidgetInlineCompletions.createStateWithAppliedResults(b,s,this._textModel,ne,r)},e):this._state.set({inlineCompletions:t.inlineCompletions.createStateWithAppliedResults(b,s,this._textModel,ne,r),suggestWidgetInlineCompletions:_O.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()})}finally{c.dispose(),f(),this._sendInlineCompletionsRequestTelemetry(p)}return!0})(),f=new gO(s,u,d);return this._updateOperation.value=f,d}clear(e){if(this._store.isDisposed)return;this._updateOperation.clear();let t=this._state.get();this._state.set({inlineCompletions:_O.createEmpty(),suggestWidgetInlineCompletions:_O.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&ut(n=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();let r=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:_O.createEmpty()},n),r.inlineCompletions.dispose(),r.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(n)})}seedWithCompletion(e,t){let n=this._state.get();this._state.set({inlineCompletions:new _O([e],void 0),suggestWidgetInlineCompletions:_O.createEmpty()},t),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue(`isRunningUnificationExperiment`)||e.requestUuid===void 0||e.hasProducedSuggestion||!Bl(this._completionsEnabled,this._textModel.getLanguageId())||!e.providers.some(e=>JE(e.providerId?.extensionId)))return;let 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(e=>e.providerId?.toString()).filter(mr).join(`,`),...qE(e.providers.some(e=>JE(e.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,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0};YE(this._instantiationService.createInstance(GE),t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};fO=dO=lO([uO(4,eu),uO(5,Pl),uO(6,xa),uO(7,w),uO(8,G),uO(9,gi)],fO);var pO=class{constructor(e,t,n,r){this.position=e,this.context=t,this.versionId=n,this.providers=r}satisfies(e){return this.position.equals(e.position)&&Cs(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,ro())&&(e.context.triggerKind===pn.Automatic||this.context.triggerKind===pn.Explicit)&&this.versionId===e.versionId&&hO(e.providers,this.providers)}},mO=class{constructor(e,t,n){this.context=e,this.requestInfo=t,this.providers=n,this.hasProducedSuggestion=!1}setRequestUuid(e){this.requestUuid=e}setNoSuggestionReasonIfNotSet(e){this.noSuggestionReason??=e}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}};function hO(e,t){return[...e].every(e=>t.has(e))}var gO=class{constructor(e,t,n){this.request=e,this.cancellationTokenSource=t,this.promise=n}dispose(){this.cancellationTokenSource.cancel()}},_O=class e extends j{static createEmpty(){return new e([],void 0)}constructor(e,t){super(),this.inlineCompletions=e,this.request=t;for(let e of this.inlineCompletions)e.addRef();this._register({dispose:()=>{for(let e of this.inlineCompletions)e.removeRef()}})}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(t,n){return new e(this.inlineCompletions.map(e=>e.withEdit(t,n)).filter(mr),this.request)}createStateWithAppliedResults(t,n,r,i,a){let o;if(a){let e=this._findById(a);if(e&&e.canBeReused(r,n.position)){o=e;let n=t.find(t=>t.hash===e.hash);t=n?yO(n,t):[e,...t]}}let s=o?!o.isInlineEdit:t.some(e=>!e.isInlineEdit&&e.isVisible(r,i)),c=[];for(let e of t){let t=this._findByHash(e.hash),n;t&&t!==e?(n=e.withIdentity(t.identity),e.setIsPreceeded(t),t.setEndOfLifeReason({kind:tt.Ignored,userTypingDisagreed:!1,supersededBy:e.getSourceCompletion()})):n=e,s!==n.isInlineEdit&&c.push(n)}return c.sort(fs(e=>e.showInlineEditMenu,Xc)),c=vO(c,e=>e.semanticId),new e(c,n)}clone(){return new e(this.inlineCompletions,this.request)}};function vO(e,t){let n=new Set;return e.filter(e=>{let r=t(e);return n.has(r)?!1:(n.add(r),!0)})}function yO(e,t){let n=t.indexOf(e);return n>-1?[e,...t.slice(0,n),...t.slice(n+1)]:t}var bO=class e extends j{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(e=>this._updateTypingSpeed(e)))}_updateTypingSpeed(t){let n=Date.now();if(!this._isUserTyping(t)){this._finalizeCurrentSession();return}this._currentSession&&n-this._lastChangeTime>e.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||={startTime:n,endTime:n,characterCount:0},this._currentSession.endTime=n,this._currentSession.characterCount+=this._getActualCharacterCount(t),this._lastChangeTime=n,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(let n of e.changes)t+=Math.max(n.text.length,n.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(let t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;switch(e.metadata.source){case`cursor`:{let t=e.metadata.kind;return t===`type`||t===`compositionType`||t===`compositionEnd`}default:return!1}}_finalizeCurrentSession(){this._currentSession&&=(this._currentSession.endTime-this._currentSession.startTime>=e.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>e.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),null)}_calculateTypingInterval(){if(this._currentSession){let t={...this._currentSession};if(t.endTime-t.startTime>=e.MIN_SESSION_DURATION_MS&&t.characterCount>0){let e=[...this._typingSessions,t];return this._calculateSpeedFromSessions(e)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(t){if(t.length===0)return{averageInterval:0,characterCount:0};let n=[...t].sort((e,t)=>t.endTime-e.endTime),r=Date.now()-e.TYPING_SPEED_WINDOW_MS,i=n.filter(e=>e.endTime>r),a=n.splice(i.length),o=Je(i.map(e=>e.characterCount));for(let t=0;t<a.length&&o<e.MIN_CHARS_FOR_RELIABLE_SPEED;t++)i.push(a[t]),o+=a[t].characterCount;let s=Je(i.map(e=>e.endTime-e.startTime));if(s===0||o<=1)return{averageInterval:0,characterCount:o};let c=s/Math.max(1,o-1);return{averageInterval:Math.round(c),characterCount:o}}dispose(){this._finalizeCurrentSession(),super.dispose()}},xO;function SO(e){return xO?.(e)??null}function CO(e){xO=e}var wO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},TO=function(e,t){return function(n,r){t(n,r,e)}},EO=class extends j{get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){super(),this.textModel=e,this._selectedSuggestItem=t,this._textModelVersionId=n,this._positions=r,this._debounceValue=i,this._enabled=a,this._editor=o,this._instantiationService=s,this._commandService=c,this._languageConfigurationService=l,this._accessibilityService=u,this._languageFeaturesService=d,this._codeEditorService=f,this._inlineCompletionsService=p,this._isActive=St(this,!1),this._onlyRequestInlineEditsSignal=Or(this),this._forceUpdateExplicitlySignal=Or(this),this._noDelaySignal=Or(this),this._fetchSpecificProviderSignal=Or(this),this._selectedInlineCompletionId=St(this,void 0),this.primaryPosition=L(this,e=>this._positions.read(e)[0]??new M(1,1)),this.allPositions=L(this,e=>this._positions.read(e)),this.sku=St(this,void 0),this._isAcceptingPartially=!1,this._appearedInsideViewport=L(this,e=>{let t=this.state.read(e);return!t||!t.inlineSuggestion?!1:AO(this._editor,t.inlineSuggestion,e)}),this._onDidAccept=this._register(new U),this.onDidAccept=this._onDidAccept.event,this._lastShownInlineCompletionInfo=void 0,this._lastAcceptedInlineCompletionInfo=void 0,this._didUndoInlineEdits=ca({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(e,t)=>(t.didUndo=e.didChange(this._textModelVersionId)&&!!e.change?.isUndoing,!0)}},(e,t)=>{let n=this._textModelVersionId.read(e);return n!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===n-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&t.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1}),this._preserveCurrentCompletionReasons=new Set([DO.Redo,DO.Undo,DO.AcceptWord]),this.dontRefetchSignal=Or(this),this._fetchInlineCompletionsPromise=ca({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:pn.Automatic,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:``}),handleChange:(e,t)=>{if(e.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(e.change))&&(t.preserveCurrentCompletion=!0);let n=e.change?.detailedReasons??[];t.changeReason=n.length>0?n[0].getType():``,t.textChange=!0}else e.didChange(this._forceUpdateExplicitlySignal)?(t.preserveCurrentCompletion=!0,t.inlineCompletionTriggerKind=pn.Explicit):e.didChange(this.dontRefetchSignal)?t.dontRefetch=!0:e.didChange(this._onlyRequestInlineEditsSignal)?t.onlyRequestInlineEdits=!0:e.didChange(this._fetchSpecificProviderSignal)&&(t.provider=e.change?.provider,t.changeHint=e.change?.changeHint);return!0}}},(e,t)=>{if(this._source.clearOperationOnTextModelChange.read(e),this._noDelaySignal.read(e),this.dontRefetchSignal.read(e),this._onlyRequestInlineEditsSignal.read(e),this._forceUpdateExplicitlySignal.read(e),this._fetchSpecificProviderSignal.read(e),!((this._enabled.read(e)&&this._selectedSuggestItem.read(e)||this._isActive.read(e))&&(!this._inlineCompletionsService.isSnoozing()||t.inlineCompletionTriggerKind===pn.Explicit))){this._source.cancelUpdate();return}this._textModelVersionId.read(e);let n=this._source.suggestWidgetInlineCompletions.read(void 0),r=this._selectedSuggestItem.read(e);if(this._shouldShowOnSuggestConflict.read(void 0)&&(r=void 0),n&&!r&&this._source.seedInlineCompletionsWithSuggestWidget(),t.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(e)&&t.inlineCompletionTriggerKind!==pn.Explicit){ut(e=>{this._source.clear(e)});return}let i=``;t.provider?i+=`providerOnDidChange`:t.inlineCompletionTriggerKind===pn.Explicit&&(i+=`explicit`),t.changeReason&&(i+=i.length>0?`:${t.changeReason}`:t.changeReason);let a=this._typing.getTypingInterval(),o={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:i,typingInterval:a.averageInterval,typingIntervalCharacterCount:a.characterCount,availableProviders:[],sku:this.sku.read(void 0)},s={triggerKind:t.inlineCompletionTriggerKind,selectedSuggestionInfo:r?.toSelectedSuggestionInfo(),includeInlineCompletions:!t.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(e),requestIssuedDateTime:o.startTime,earliestShownDateTime:o.startTime+(t.inlineCompletionTriggerKind===pn.Explicit||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:t.changeHint};s.triggerKind===pn.Automatic&&t.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(s={...s,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});let c=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,l=t.preserveCurrentCompletion||c?.forwardStable?c:void 0,u=this._jumpedToId.map(e=>!!e&&e===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),d=t.provider?{providers:[t.provider],label:`single:`+t.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},f=this.getAvailableProviders(d.providers);return o.availableProviders=f.map(e=>e.providerId).filter(mr),this._source.fetch(f,d.label,s,l?.identity,t.shouldDebounce,u,o)}),this._inlineSuggestionItems=gr({owner:this},e=>{let t=this._source.inlineCompletions.read(e);if(!t)return;let n=this.primaryPosition.read(e),r,i=[];for(let e of t.inlineCompletions)e.isInlineEdit?r=e:e.isVisible(this.textModel,n)&&i.push(e);return i.length!==0&&(r=void 0),{inlineCompletions:i,inlineEdit:r}}),this._inlineCompletionItems=gr({owner:this,equalsFn:Ec()},e=>this._inlineSuggestionItems.read(e)?.inlineCompletions??[]),this.selectedInlineCompletionIndex=L(this,e=>{let t=this._selectedInlineCompletionId.read(e),n=this._inlineCompletionItems.read(e),r=this._selectedInlineCompletionId===void 0?-1:n.findIndex(e=>e.semanticId===t);return r===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):r}),this.selectedInlineCompletion=L(this,e=>this._inlineCompletionItems.read(e)[this.selectedInlineCompletionIndex.read(e)]),this.activeCommands=gr({owner:this,equalsFn:Ec()},e=>this.selectedInlineCompletion.read(e)?.source.inlineSuggestions.commands??[]),this.inlineCompletionsCount=L(this,e=>{if(this.lastTriggerKind.read(e)===pn.Explicit)return this._inlineCompletionItems.read(e).length}),this._hasVisiblePeekWidgets=L(this,e=>this._editorObs.openedPeekWidgets.read(e)>0),this._shouldShowOnSuggestConflict=L(this,e=>{let t=this._showOnSuggestConflict.read(e);if(t!==`never`&&this.selectedInlineCompletion.read(e)){let n=this._selectedSuggestItem.read(e);return n?t===`whenSuggestListIsIncomplete`?n.listIncomplete:!0:!1}return!1}),this.state=gr({owner:this,equalsFn:(e,t)=>!e||!t?e===t:e.kind===`ghostText`&&t.kind===`ghostText`?jE(e.ghostTexts,t.ghostTexts)&&e.inlineSuggestion===t.inlineSuggestion&&e.suggestItem===t.suggestItem:e.kind===`inlineEdit`&&t.kind===`inlineEdit`?e.inlineSuggestion===t.inlineSuggestion:!1},e=>{let t=this.textModel;if(this._suppressInSnippetMode.read(e)&&this._isInSnippetMode.read(e))return;let n=this._inlineSuggestionItems.read(e),r=n?.inlineEdit;if(r){if(this._hasVisiblePeekWidgets.read(e))return;let t=this.primaryPosition.map(e=>Uu.fromRangeInclusive(r.targetRange).addMargin(1,1).contains(e.lineNumber)),i=r.action?.kind===`edit`?r.action.stringEdit:void 0,a=i?Kc.fromStringEdit(i,new Ki(this.textModel)).replacements:[],o=(n.inlineEdit?.command?.id===`vscode.open`||n.inlineEdit?.command?.id===`_workbench.open`)&&n.inlineEdit?.command.arguments?.length?On.from(n.inlineEdit?.command.arguments[0]):void 0;return r.originalTextRef.targets(this.textModel)||(o=r.originalTextRef.uri),{kind:`inlineEdit`,inlineSuggestion:r,edits:a,cursorAtInlineEdit:t,nextEditUri:o}}let i=this._selectedSuggestItem.read(e);if(!this._shouldShowOnSuggestConflict.read(e)&&i){let n=NE(i.getSingleTextEdit(),t),r=this._computeAugmentation(n,e);if(!this._suggestPreviewEnabled.read(e)&&!r)return;let a=r?.edit??n,o=r?r.edit.text.length-n.text.length:0,s=this._suggestPreviewMode.read(e),c=this._positions.read(e),l=[a,...OO(this.textModel,c,a)].map((e,n)=>({edit:e,ghostText:e?IE(e,t,s,c[n],o):void 0})).filter(({edit:e,ghostText:t})=>e!==void 0&&t!==void 0),u=l.map(({edit:e})=>e),d=l.map(({ghostText:e})=>e);return{kind:`ghostText`,edits:u,primaryGhostText:d[0]??new OE(a.range.endLineNumber,[]),ghostTexts:d,inlineSuggestion:r?.completion,suggestItem:i}}else{if(!this._isActive.read(e))return;let n=this.selectedInlineCompletion.read(e);if(!n)return;let r=n.getSingleTextEdit(),i=this._inlineSuggestMode.read(e),a=this._positions.read(e),o=[r,...OO(this.textModel,a,r)].map((e,n)=>({edit:e,ghostText:e?IE(e,t,i,a[n],0):void 0})).filter(({edit:e,ghostText:t})=>e!==void 0&&t!==void 0),s=o.map(({edit:e})=>e),c=o.map(({ghostText:e})=>e);return c[0]?{kind:`ghostText`,edits:s,primaryGhostText:c[0],ghostTexts:c,inlineSuggestion:n,suggestItem:void 0}:void 0}}),this.status=L(this,e=>{if(this._source.loading.read(e))return`loading`;let t=this.state.read(e);return t?.kind===`ghostText`?`ghostText`:t?.kind===`inlineEdit`?`inlineEdit`:`noSuggestion`}),this.inlineCompletionState=L(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!==`ghostText`)&&!this._editorObs.inComposition.read(e))return t}),this.inlineEditState=L(this,e=>{let t=this.state.read(e);if(!(!t||t.kind!==`inlineEdit`))return t}),this.inlineEditAvailable=L(this,e=>!!this.inlineEditState.read(e)),this.warning=L(this,e=>this.inlineCompletionState.read(e)?.inlineSuggestion?.warning),this.ghostTexts=gr({owner:this,equalsFn:jE},e=>{let t=this.inlineCompletionState.read(e);if(t)return t.ghostTexts}),this.primaryGhostText=gr({owner:this,equalsFn:ME},e=>{let t=this.inlineCompletionState.read(e);if(t)return t?.primaryGhostText}),this.showCollapsed=L(this,e=>{let t=this.state.read(e);if(!t||t.kind!==`inlineEdit`||t.inlineSuggestion.hint||t.inlineSuggestion.action?.kind===`jumpTo`)return!1;let n=t.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(e);return(this._inlineEditsShowCollapsedEnabled.read(e)||!n)&&this._jumpedToId.read(e)!==t.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(e)}),this._tabShouldIndent=L(this,e=>{if(this._inAcceptFlow.read(e))return!1;function t(e){return e.startLineNumber!==e.endLineNumber}function n(e,t){let n=e.getLineIndentColumn(t),r=e.getLineLastNonWhitespaceColumn(t);return new T(t,n,t,Math.max(r,n))}return this._editorObs.selections.read(e)?.some(e=>e.isEmpty()?this.textModel.getLineLength(e.startLineNumber)===0:t(e)||e.containsRange(n(this.textModel,e.startLineNumber)))}),this.tabShouldJumpToInlineEdit=L(this,e=>{if(this._tabShouldIndent.read(e))return!1;let t=this.inlineEditState.read(e);return t?t.inlineSuggestion.action?.kind===`jumpTo`||this.showCollapsed.read(e)?!0:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)?!1:!t.cursorAtInlineEdit.read(e):!1}),this.tabShouldAcceptInlineEdit=L(this,e=>{let t=this.inlineEditState.read(e);return!t||t.inlineSuggestion.action?.kind===`jumpTo`||this.showCollapsed.read(e)||this._tabShouldIndent.read(e)?!1:this._inAcceptFlow.read(e)&&this._appearedInsideViewport.read(e)||t.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(e)||this._jumpedToId.read(e)===t.inlineSuggestion.semanticId?!0:t.cursorAtInlineEdit.read(e)}),this._jumpedToId=St(this,void 0),this._inAcceptFlow=St(this,!1),this.inAcceptFlow=this._inAcceptFlow,this._source=this._register(this._instantiationService.createInstance(fO,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,e=>e?.request?.context.triggerKind),this._editorObs=lu(this._editor);let h=this._editorObs.getOption(134);this._suggestPreviewEnabled=h.map(e=>e.preview),this._suggestPreviewMode=h.map(e=>e.previewMode);let g=this._editorObs.getOption(71);this._inlineSuggestMode=g.map(e=>e.mode),this._suppressedInlineCompletionGroupIds=g.map(e=>new Set(e.experimental.suppressInlineSuggestions.split(`,`))),this._inlineEditsEnabled=g.map(e=>!!e.edits.enabled),this._inlineEditsShowCollapsedEnabled=g.map(e=>e.edits.showCollapsed),this._triggerCommandOnProviderChange=g.map(e=>e.triggerCommandOnProviderChange),this._minShowDelay=g.map(e=>e.minShowDelay),this._showOnSuggestConflict=g.map(e=>e.experimental.showOnSuggestConflict),this._suppressInSnippetMode=g.map(e=>e.suppressInSnippetMode);let _=uE.get(this._editor);this._isInSnippetMode=_?.isInSnippetObservable??pc(!1),m.getDefaultAccount().then(NO(e=>this.sku.set(jO(e),void 0),this._store)),this._register(m.onDidChangeDefaultAccount(e=>this.sku.set(jO(e),void 0))),this._typing=this._register(new bO(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(e=>{e&&this.stop()}));{let e=this.textModel.uri.scheme===Ks.vscodeNotebookCell,[t]=this._codeEditorService.listDiffEditors().filter(e=>e.getOriginalEditor().getId()===this._editor.getId()||e.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!t,this.editorType=e?FD.Notebook:this.isInDiffEditor?FD.DiffEditor:FD.TextEditor}this._register(dn(this.state,e=>{e&&e.inlineSuggestion&&this._inlineCompletionsService.reportNewCompletion(e.inlineSuggestion.requestUuid)})),this._register(dn(this._fetchInlineCompletionsPromise)),this._register(k(e=>{this._editorObs.versionId.read(e),this._inAcceptFlow.set(!1,void 0)})),this._register(k(e=>{this.state.map((e,t)=>!e||e.kind===`inlineEdit`&&!e.cursorAtInlineEdit.read(t)).read(e)&&this._jumpedToId.set(void 0,void 0)})),this._register(k(e=>{let t=this.state.map(e=>e?.inlineSuggestion).read(e);t&&t.addPerformanceMarker(`activeSuggestion`)}));let v=this.inlineEditState.map(e=>e?.inlineSuggestion.semanticId);this._register(k(e=>{v.read(e)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion})}));let y=$u(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));$e(this,y,(e,t)=>{e.onDidChangeInlineCompletions&&t.add(e.onDidChangeInlineCompletions(t=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}let n=this.state.get();n&&(n.inlineSuggestion||n.edits)&&n.inlineSuggestion?.source.provider!==e||ut(n=>{this._fetchSpecificProviderSignal.trigger(n,{provider:e,changeHint:t??void 0}),this.trigger(n)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}getIndentationInfo(e){let t=!1,n=!0,r=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&r&&r.parts.length>0){let{column:e,lines:i}=r.parts[0],a=i[0].line;if(e<=this.textModel.getLineIndentColumn(r.lineNumber)){let e=Ii(a);e===-1&&(e=a.length-1),t=e>0;let r=this.textModel.getOptions().tabSize;n=fe.visibleColumnFromColumn(a,e+1,r)<r}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:n}}_getReason(e){return e?.isUndoing?DO.Undo:e?.isRedoing?DO.Redo:this.isAcceptingPartially?DO.AcceptWord:DO.Other}getAvailableProviders(e){let t=this._suppressedInlineCompletionGroupIds.get(),n=e.filter(e=>!(e.groupId&&t.has(e.groupId))),r=new Set;for(let e of n)e.excludesGroupIds?.forEach(e=>r.add(e));let i=[];for(let e of n)e.groupId&&r.has(e.groupId)||i.push(e);return i}async trigger(e,t={}){Ai(e,e=>{t.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(e),t.noDelay&&this._noDelaySignal.trigger(e),this._isActive.set(!0,e),t.explicit&&(this._inAcceptFlow.set(!0,e),this._forceUpdateExplicitlySignal.trigger(e)),t.provider&&this._fetchSpecificProviderSignal.trigger(e,{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){Ai(t,t=>{if(e===`explicitCancel`){let e=this.state.get()?.inlineSuggestion;e&&e.reportEndOfLife({kind:tt.Rejected})}this._isActive.set(!1,t),this._source.clear(t)})}_computeAugmentation(e,t){let n=this.textModel,r=this._source.suggestWidgetInlineCompletions.read(t);return $r(r?r.inlineCompletions.filter(e=>!e.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(mr),t=>{let r=t.getSingleTextEdit();return r=NE(r,n,T.fromPositions(r.range.getStartPosition(),e.range.getEndPosition())),PE(r,e)?{completion:t,edit:r}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();let t=this._inlineCompletionItems.get()||[];if(t.length>0){let n=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[n].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,n=void 0){return n?Ln.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:n,correlationId:e.getSourceCompletion().correlationId}):Ln.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 Xs;let n,r=!1,i=this.state.get();if(i?.kind===`ghostText`){if(!i||i.primaryGhostText.isEmpty()||!i.inlineSuggestion)return;n=i.inlineSuggestion}else if(i?.kind===`inlineEdit`)n=i.inlineSuggestion,r=!!i.nextEditUri;else return;n.addRef();try{let a=!1;if(e.pushUndoStop(),!n.originalTextRef.targets(this.textModel)){let e=await this._codeEditorService.openCodeEditor({resource:n.originalTextRef.uri},this._editor);if(e){let t=SO(e)?.model.get();e.focus(),t?.transplantCompletion(n),e.revealLineInCenter(n.targetRange.startLineNumber)}}else if(!r&&n.action?.kind===`edit`){let r=n.action;if(t&&r.alternativeAction){a=!0;let e=r.alternativeAction.command;await this._commandService.executeCommand(e.id,...e.arguments||[]).then(void 0,cc)}else if(r.snippetInfo){let t=fc.delete(r.textReplacement.range),i=n.additionalTextEdits.map(e=>new fc(T.lift(e.range),e.text??``)),a=Kc.fromParallelReplacementsUnsorted([t,...i]);e.edit(a,this._getMetadata(n,this.textModel.getLanguageId())),e.setPosition(r.snippetInfo.range.getStartPosition(),`inlineCompletionAccept`),uE.get(e)?.insert(r.snippetInfo.snippet,{undoStopBefore:!1})}else{let t=i.edits,r=t;i.kind===`ghostText`&&(r=vE(t,this.textModel));let a=gE(r).map(e=>P.fromPositions(e)),o=n.additionalTextEdits.map(e=>new fc(T.lift(e.range),e.text??``)),s=Kc.fromParallelReplacementsUnsorted([...t,...o]);if(e.edit(s,this._getMetadata(n,this.textModel.getLanguageId())),n.hint===void 0&&e.setSelections(i.kind===`inlineEdit`?a.slice(-1):a,`inlineCompletionAccept`),i.kind===`inlineEdit`&&!this._accessibilityService.isMotionReduced()){let t=s.getNewRanges(),n=this._store.add(new kO(e,t,()=>{this._store.delete(n)}))}}}this._onDidAccept.fire(),this.stop(),n.command&&await this._commandService.executeCommand(n.command.id,...n.command.arguments||[]).then(void 0,cc),a&&this.trigger(void 0),n.reportEndOfLife({kind:tt.Accepted,alternativeAction:t})}finally{n.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:n}}}async acceptNextWord(){await this._acceptNext(this._editor,`word`,(e,t)=>{let n=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),r=this._languageConfigurationService.getLanguageConfiguration(n),i=new RegExp(r.wordDefinition.source,r.wordDefinition.flags.replace(`g`,``)),a=t.match(i),o=0;o=a&&a.index!==void 0?a.index===0?a[0].length:a.index:t.length;let s=/\s+/g.exec(t);return s&&s.index!==void 0&&s.index+s[0].length<o&&(o=s.index+s[0].length),o},0)}async acceptNextLine(){await this._acceptNext(this._editor,`line`,(e,t)=>{let n=t.match(/\n/);return n&&n.index!==void 0?n.index+1:t.length},1)}async _acceptNext(e,t,n,r){if(e.getModel()!==this.textModel)throw new Xs;let i=this.inlineCompletionState.get();if(!i||i.primaryGhostText.isEmpty()||!i.inlineSuggestion)return;let a=i.primaryGhostText,o=i.inlineSuggestion;if(o.snippetInfo){await this.accept(e);return}let s=a.parts[0],c=new M(a.lineNumber,s.column),l=s.text,u=n(c,l);if(u===l.length&&a.parts.length===1){this.accept(e);return}let d=l.substring(0,u),f=this._positions.get(),p=f[0];o.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();let n=T.fromPositions(p,c),r=new fc(n,e.getModel().getValueInRange(n)+d),i=[r,...OO(this.textModel,f,r)].filter(mr),a=gE(i).map(e=>P.fromPositions(e));e.edit(Kc.fromParallelReplacementsUnsorted(i),this._getMetadata(o,t)),e.setSelections(a,`inlineCompletionPartialAccept`),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),0)}finally{this._isAcceptingPartially=!1}let n=T.fromPositions(o.editRange.getStartPosition(),uu.ofText(d).addToPosition(c)),i=e.getModel().getValueInRange(n,1).length;o.reportPartialAccept(i,{kind:r,acceptedLength:i},{characters:u,ratio:u/l.length,count:1})}finally{o.removeRef()}}handleSuggestAccepted(e){let t=NE(e.getSingleTextEdit(),this.textModel),n=this._computeAugmentation(t,void 0);if(!n)return;let r=this.textModel.getValueInRange(n.completion.editRange,1).length+t.text.length;n.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:r},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){return{documentValue:this.textModel.getValue(),inlineCompletion:(this.state.get()?.inlineSuggestion)?.getSourceCompletion()}}jump(){let e=this.inlineEditState.get();if(!e)return;let t=e.inlineSuggestion;if(!t.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}t.addRef();try{ut(n=>{t.action?.kind===`jumpTo`&&(this.stop(void 0,n),t.reportEndOfLife({kind:tt.Accepted,alternativeAction:!1})),this._jumpedToId.set(e.inlineSuggestion.semanticId,n),this.dontRefetchSignal.trigger(n);let r=e.inlineSuggestion.targetRange,i=r.getStartPosition();if(this._editor.setPosition(i,`inlineCompletions.jump`),r.isSingleLine()&&(e.inlineSuggestion.hint||e.inlineSuggestion.action?.kind===`edit`&&!e.inlineSuggestion.action.textReplacement.text.includes(`
38
+ `))||e.inlineSuggestion.action?.kind===`jumpTo`)this._editor.revealPosition(i,0);else{let e=new T(r.startLineNumber-1,1,r.endLineNumber+1,1);this._editor.revealRange(e,0)}e.inlineSuggestion.identity.setJumpTo(n),this._editor.focus()})}finally{t.removeRef()}}async handleInlineSuggestionShown(e,t,n,r){await e.reportInlineEditShown(this._commandService,t,n,this.textModel,r)}transplantCompletion(e){ut(t=>{this._source.seedWithCompletion(e,t),this._isActive.set(!0,t),this._inAcceptFlow.set(!0,t),this.dontRefetchSignal.trigger(t)})}};EO=wO([TO(7,w),TO(8,tr),TO(9,eu),TO(10,ai),TO(11,q),TO(12,Di),TO(13,kn),TO(14,ws)],EO);var DO;(function(e){e[e.Undo=0]=`Undo`,e[e.Redo=1]=`Redo`,e[e.AcceptWord=2]=`AcceptWord`,e[e.Other=3]=`Other`})(DO||={});function OO(e,t,n){if(t.length===1)return[];let r=new Ki(e),i=r.getTransformer(),a=i.getOffset(t[0]),o=t.slice(1).map(e=>i.getOffset(e));n=n.removeCommonPrefixAndSuffix(r);let s=i.getStringReplacement(n),c=s.replaceRange.start-a,l=s.replaceRange.join(to.emptyAt(a)),u=r.getValueOfOffsetRange(l);return o.map(e=>{let t=e+c,n=new to(t,t+s.replaceRange.length),a=n.join(to.emptyAt(e));if(r.getValueOfOffsetRange(a)!==u)return;let o=new ec(n,s.newText);return i.getTextReplacement(o)}).filter(mr)}var kO=class extends j{constructor(e,t,n){super(),n&&this._register({dispose:()=>n()}),this._register(lu(e).setDecorations(pc(t.map(e=>({range:e,options:{description:`animation`,className:`edits-fadeout-decoration`,zIndex:1}})))));let r=new EE(CE.startNow(1,0,1e3,TE));this._register(k(t=>{let n=r.getValue(t);e.getContainerDomNode().style.setProperty(`--animation-opacity`,n.toString()),r.isFinished(t)&&this.dispose()}))}};function AO(e,t,n=void 0){let r=t.targetRange;lu(e).scrollTop.read(n);let i=e.getVisibleRanges();return i.length<1?!1:new T(i[0].startLineNumber,i[0].startColumn,i[i.length-1].endLineNumber,i[i.length-1].endColumn).containsRange(r)}function jO(e){if(e?.entitlementsData?.access_type_sku&&e?.entitlementsData?.copilot_plan)return{type:e.entitlementsData.access_type_sku,plan:e.entitlementsData.copilot_plan}}var MO=class{constructor(e){this.handler=e=>this._cb?.(e),this._cb=e}dispose(){this._cb=void 0}};function NO(e,t){let n=new MO(e);return t.add(n),n.handler}var PO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},FO=function(e,t){return function(n,r){t(n,r,e)}},IO,LO=class{constructor(e){this.name=e}select(e,t,n){if(n.length===0)return 0;let r=n[0].score[0];for(let e=0;e<n.length;e++){let{score:t,completion:i}=n[e];if(t[0]!==r)break;if(i.preselect)return e}return 0}},RO=class extends LO{constructor(){super(`first`)}memorize(e,t,n){}toJSON(){}fromJSON(){}},zO=class extends LO{constructor(){super(`recentlyUsed`),this._cache=new Uo(300,.66),this._seq=0}memorize(e,t,n){let r=`${e.getLanguageId()}/${n.textLabel}`;this._cache.set(r,{touch:this._seq++,type:n.completion.kind,insertText:n.completion.insertText})}select(e,t,n){if(n.length===0)return 0;let r=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(r))return super.select(e,t,n);let i=n[0].score[0],a=-1,o=-1,s=-1;for(let t=0;t<n.length&&n[t].score[0]===i;t++){let r=`${e.getLanguageId()}/${n[t].textLabel}`,i=this._cache.peek(r);if(i&&i.touch>s&&i.type===n[t].completion.kind&&i.insertText===n[t].completion.insertText&&(s=i.touch,o=t),n[t].completion.preselect&&a===-1)return a=t}return o===-1?a===-1?0:a:o}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();for(let[t,n]of e)n.touch=0,n.type=typeof n.type==`number`?n.type:Hs.fromString(n.type),this._cache.set(t,n);this._seq=this._cache.size}},BO=class extends LO{constructor(){super(`recentlyUsedByPrefix`),this._trie=lr.forStrings(),this._seq=0}memorize(e,t,n){let{word:r}=e.getWordUntilPosition(t),i=`${e.getLanguageId()}/${r}`;this._trie.set(i,{type:n.completion.kind,insertText:n.completion.insertText,touch:this._seq++})}select(e,t,n){let{word:r}=e.getWordUntilPosition(t);if(!r)return super.select(e,t,n);let i=`${e.getLanguageId()}/${r}`,a=this._trie.get(i);if(a||=this._trie.findSubstr(i),a)for(let e=0;e<n.length;e++){let{kind:t,insertText:r}=n[e].completion;if(t===a.type&&r===a.insertText)return e}return super.select(e,t,n)}toJSON(){let e=[];return this._trie.forEach((t,n)=>e.push([n,t])),e.sort((e,t)=>-(e[1].touch-t[1].touch)).forEach((e,t)=>e[1].touch=t),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(let[t,n]of e)n.type=typeof n.type==`number`?n.type:Hs.fromString(n.type),this._trie.set(t,n)}}},VO=class{static{IO=this}static{this._strategyCtors=new Map([[`recentlyUsedByPrefix`,BO],[`recentlyUsed`,zO],[`first`,RO]])}static{this._storagePrefix=`suggest/memories`}constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new S,this._persistSoon=new Cl(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(e=>{e.reason===dc.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,n){this._withStrategy(e,t).memorize(e,t,n),this._persistSoon.schedule()}select(e,t,n){return this._withStrategy(e,t).select(e,t,n)}_withStrategy(e,t){let n=this._configService.getValue(`editor.suggestSelection`,{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(this._strategy?.name!==n){this._saveState();let e=IO._strategyCtors.get(n)||RO;this._strategy=new e;try{let e=+!this._configService.getValue(`editor.suggest.shareSuggestSelections`),t=this._storageService.get(`${IO._storagePrefix}/${n}`,e);t&&this._strategy.fromJSON(JSON.parse(t))}catch{}}return this._strategy}_saveState(){if(this._strategy){let e=+!this._configService.getValue(`editor.suggest.shareSuggestSelections`),t=JSON.stringify(this._strategy);this._storageService.store(`${IO._storagePrefix}/${this._strategy.name}`,t,e,1)}}};VO=IO=PO([FO(0,Gc),FO(1,xa)],VO);var HO=Xt(`ISuggestMemories`);us(HO,VO,1);var UO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},WO=function(e,t){return function(n,r){t(n,r,e)}},GO,KO=class{static{GO=this}static{this.AtEnd=new A(`atEndOfWord`,!1,{type:`boolean`,description:V(1546,`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=GO.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(e=>e.hasChanged(139)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){let e=this._editor.getOption(139)===`on`;if(this._enabled!==e)if(this._enabled=e,this._enabled){let e=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}let e=this._editor.getModel(),t=this._editor.getSelection(),n=e.getWordAtPosition(t.getStartPosition());if(!n){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(n.endColumn===t.getStartPosition().column&&t.getStartPosition().lineNumber===t.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(e),e()}else this._selectionListener&&=(this._ckAtEnd.reset(),this._selectionListener.dispose(),void 0)}};KO=GO=UO([WO(1,G)],KO);var qO=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},JO=function(e,t){return function(n,r){t(n,r,e)}},YO,XO=class{static{YO=this}static{this.OtherSuggestions=new A(`hasOtherSuggestions`,!1)}constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=YO.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},n){if(e.items.length===0){this.reset();return}if(YO._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=n,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,n){let r=n;for(let i=t.items.length;i>0&&(r=(r+t.items.length+(e?1:-1))%t.items.length,!(r===n||!t.items[r].completion.additionalTextEdits));i--);return r}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=YO._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};XO=YO=qO([JO(1,G)],XO);var ZO=class{constructor(e,t,n,r){this._disposables=new S,this._disposables.add(n.onDidSuggest(e=>{e.completionModel.items.length===0&&this.reset()})),this._disposables.add(n.onDidCancel(e=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(i=>{if(this._active&&!t.isFrozen()&&n.state!==0){let t=i.charCodeAt(i.length-1);this._active.acceptCharacters.has(t)&&e.getOption(0)&&r(this._active.item)}}))}_onItem(e){if(!e||!Fu(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;let t=new En;for(let n of e.item.completion.commitCharacters)n.length>0&&t.add(n.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}},QO=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}},$O=class e{constructor(t,n,r,i,a,o,s=Qi.default,c=void 0){this.clipboardText=c,this._snippetCompareFn=e._compareCompletionItems,this._items=t,this._column=n,this._wordDistance=i,this._options=a,this._refilterKind=1,this._lineContext=r,this._fuzzyScoreOptions=s,o===`top`?this._snippetCompareFn=e._compareCompletionItemsSnippetsUp:o===`bottom`&&(this._snippetCompareFn=e._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();let e=new Set;for(let[t,n]of this.getItemsByProvider())n.length>0&&n[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;let e=[],{leadingLineContent:t,characterCountDelta:n}=this._lineContext,r=``,i=``,a=this._refilterKind===1?this._items:this._filteredItems,s=[],c=!this._options.filterGraceful||a.length>2e3?_r:o;for(let o=0;o<a.length;o++){let l=a[o];if(l.isInvalid)continue;let u=this._itemsByProvider.get(l.provider);u?u.push(l):this._itemsByProvider.set(l.provider,[l]);let d=l.position.column-l.editStart.column,f=d+n-(l.position.column-this._column);if(r.length!==f&&(r=f===0?``:t.slice(-f),i=r.toLowerCase()),l.word=r,f===0)l.score=Ut.Default;else{let e=0;for(;e<d;){let t=r.charCodeAt(e);if(t===32||t===9)e+=1;else break}if(e>=f)l.score=Ut.Default;else if(typeof l.completion.filterText==`string`){let t=c(r,i,e,l.completion.filterText,l.filterTextLow,0,this._fuzzyScoreOptions);if(!t)continue;me(l.completion.filterText,l.textLabel)===0?l.score=t:(l.score=Ui(r,i,e,l.textLabel,l.labelLow,0),l.score[0]=t[0])}else{let t=c(r,i,e,l.textLabel,l.labelLow,0,this._fuzzyScoreOptions);if(!t)continue;l.score=t}}l.idx=o,l.distance=this._wordDistance.distance(l.position,l.completion),s.push(l),e.push(l.textLabel.length)}this._filteredItems=s.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?wu(e.length-.85,e,(e,t)=>e-t):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)}static _compareCompletionItemsSnippetsDown(t,n){if(t.completion.kind!==n.completion.kind){if(t.completion.kind===28)return 1;if(n.completion.kind===28)return-1}return e._compareCompletionItems(t,n)}static _compareCompletionItemsSnippetsUp(t,n){if(t.completion.kind!==n.completion.kind){if(t.completion.kind===28)return-1;if(n.completion.kind===28)return 1}return e._compareCompletionItems(t,n)}},ek=class e{async provideSelectionRanges(t,n){let r=[];for(let i of n){let n=[];r.push(n);let a=new Map;await new Promise(n=>e._bracketsRightYield(n,0,t,i,a)),await new Promise(r=>e._bracketsLeftYield(r,0,t,i,a,n))}return r}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(t,n,r,i,a){let o=new Map,s=Date.now();for(;;){if(n>=e._maxRounds){t();break}if(!i){t();break}let c=r.bracketPairs.findNextBracket(i);if(!c){t();break}if(Date.now()-s>e._maxDuration){setTimeout(()=>e._bracketsRightYield(t,n+1,r,i,a));break}if(c.bracketInfo.isOpeningBracket){let e=c.bracketInfo.bracketText,t=o.has(e)?o.get(e):0;o.set(e,t+1)}else{let e=c.bracketInfo.getOpeningBrackets()[0].bracketText,t=o.has(e)?o.get(e):0;if(--t,o.set(e,Math.max(0,t)),t<0){let t=a.get(e);t||(t=new _u,a.set(e,t)),t.push(c.range)}}i=c.range.getEndPosition()}}static _bracketsLeftYield(t,n,r,i,a,o){let s=new Map,c=Date.now();for(;;){if(n>=e._maxRounds&&a.size===0){t();break}if(!i){t();break}let l=r.bracketPairs.findPrevBracket(i);if(!l){t();break}if(Date.now()-c>e._maxDuration){setTimeout(()=>e._bracketsLeftYield(t,n+1,r,i,a,o));break}if(l.bracketInfo.isOpeningBracket){let t=l.bracketInfo.bracketText,n=s.has(t)?s.get(t):0;if(--n,s.set(t,Math.max(0,n)),n<0){let n=a.get(t);if(n){let i=n.shift();n.size===0&&a.delete(t);let s=T.fromPositions(l.range.getEndPosition(),i.getStartPosition()),c=T.fromPositions(l.range.getStartPosition(),i.getEndPosition());o.push({range:s}),o.push({range:c}),e._addBracketLeading(r,c,o)}}}else{let e=l.bracketInfo.getOpeningBrackets()[0].bracketText,t=s.has(e)?s.get(e):0;s.set(e,t+1)}i=l.range.getStartPosition()}}static _addBracketLeading(e,t,n){if(t.startLineNumber===t.endLineNumber)return;let r=t.startLineNumber,i=e.getLineFirstNonWhitespaceColumn(r);i!==0&&i!==t.startColumn&&(n.push({range:T.fromPositions(new M(r,i),t.getEndPosition())}),n.push({range:T.fromPositions(new M(r,1),t.getEndPosition())}));let a=r-1;if(a>0){let r=e.getLineFirstNonWhitespaceColumn(a);r===t.startColumn&&r!==e.getLineLastNonWhitespaceColumn(a)&&(n.push({range:T.fromPositions(new M(a,r),t.getEndPosition())}),n.push({range:T.fromPositions(new M(a,1),t.getEndPosition())}))}}},tk=class e{static{this.None=new class extends e{distance(){return 0}}}static async create(t,n){if(!n.getOption(134).localityBonus||!n.hasModel())return e.None;let r=n.getModel(),i=n.getPosition();if(!t.canComputeWordRanges(r.uri))return e.None;let[a]=await new ek().provideSelectionRanges(r,[i]);if(a.length===0)return e.None;let o=await t.computeWordRanges(r.uri,a[0].range);if(!o)return e.None;let s=r.getWordUntilPosition(i);return delete o[s.word],new class extends e{distance(e,t){if(!i.equals(n.getPosition()))return 0;if(t.kind===17)return 2<<20;let r=o[typeof t.label==`string`?t.label:t.label.label];if(Ga(r))return 2<<20;let s=go(r,T.fromPositions(e),T.compareRangesUsingStarts),c=s>=0?r[s]:r[Math.max(0,~s-1)],l=a.length;for(let e of a){if(!T.containsRange(e.range,c))break;--l}return l}}}},nk=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},rk=function(e,t){return function(n,r){t(n,r,e)}},ik,ak=class{static shouldAutoTrigger(e){if(!e.hasModel())return!1;let t=e.getModel(),n=e.getPosition();t.tokenization.tokenizeIfCheap(n.lineNumber);let r=t.getWordAtPosition(n);return!(!r||r.endColumn!==n.column&&r.startColumn+1!==n.column||!isNaN(Number(r.word)))}constructor(e,t,n){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=n}};function ok(e,t,n){if(!t.getContextKeyValue(pw.inlineSuggestionVisible.key))return!0;let r=t.getContextKeyValue(pw.suppressSuggestions.key);return r===void 0?!e.getOption(71).suppressSuggestions:!r}function sk(e,t,n){if(!t.getContextKeyValue(`inlineSuggestionVisible`))return!0;let r=t.getContextKeyValue(pw.suppressSuggestions.key);return r===void 0?!e.getOption(71).suppressSuggestions:!r}var ck=ik=class{constructor(e,t,n,r,i,a,o,s,c){this._editor=e,this._editorWorkerService=t,this._clipboardService=n,this._telemetryService=r,this._logService=i,this._contextKeyService=a,this._configurationService=o,this._languageFeaturesService=s,this._envService=c,this._toDispose=new S,this._triggerCharacterListener=new S,this._triggerQuickSuggest=new Ja,this._triggerState=void 0,this._completionDisposables=new S,this._onDidCancel=new U,this._onDidTrigger=new U,this._onDidSuggest=new U,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._currentSelection=this._editor.getSelection()||new P(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let l=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{l=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{l=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(e=>{l||this._onCursorChange(e)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!l&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){h(this._triggerCharacterListener),h([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;let e=new Map;for(let t of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(let n of t.triggerCharacters||[]){let r=e.get(n);r||(r=new Set,e.set(n,r)),r.add(t)}let t=t=>{if(!sk(this._editor,this._contextKeyService,this._configurationService)||ak.shouldAutoTrigger(this._editor))return;if(!t){let e=this._editor.getPosition();t=this._editor.getModel().getLineContent(e.lineNumber).substr(0,e.column-1)}let n=``;qi(t.charCodeAt(t.length-1))?na(t.charCodeAt(t.length-2))&&(n=t.substr(t.length-2)):n=t.charAt(t.length-1);let r=e.get(n);if(r){let e=new Map;if(this._completionModel)for(let[t,n]of this._completionModel.getItemsByProvider())r.has(t)||e.set(t,n);this.trigger({auto:!0,triggerKind:1,triggerCharacter:n,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:r,providerItemsToReuse:e}})}};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;let 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(){fw.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&uE.get(this._editor)?.isInSnippet()||(this.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!ak.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;let e=this._editor.getModel(),t=this._editor.getPosition(),n=this._editor.getOption(102);if(fw.isAllOff(n))return;let r=!1;if(!fw.isAllOn(n)){e.tokenization.tokenizeIfCheap(t.lineNumber);let i=e.tokenization.getLineTokens(t.lineNumber),a=i.getStandardTokenType(i.findTokenIndexAtOffset(Math.max(t.column-1-1,0))),o=fw.valueFor(n,a);if(o===`off`||o===`inline`)return;o===`offWhenInlineCompletions`&&(r=this._languageFeaturesService.inlineCompletionsProvider.has(e)&&this._editor.getOption(71).enabled)}ok(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&(r?this._waitForInlineCompletionsAndTrigger(e,t):this.trigger({auto:!0}))},this._editor.getOption(103)))}_waitForInlineCompletionsAndTrigger(e,t){let n=e.getVersionId(),r=SO(this._editor),i=r?.model.get();if(!r||!i){this.trigger({auto:!0});return}if(i.state.get()?.inlineSuggestion)return;let a=new S;this._waitForInlineCompletions=a;let o=r=>{if(a.dispose(),this._waitForInlineCompletions===a&&(this._waitForInlineCompletions=void 0),this._triggerState!==void 0||!r)return;let i=this._editor.getModel(),o=this._editor.getPosition();i===e&&i.getVersionId()===n&&o?.equals(t)&&this._editor.hasWidgetFocus()&&this.trigger({auto:!0})};oo(()=>{o(!0),i.stop(`automatic`)},750,a),a.add(k(e=>{if(r.model.read(e)!==i){o(!1);return}let t=i.status.read(e),n=i.state.read(e);!n&&t===`loading`||o(!n)}))}_refilterCompletionItems(){Bi(this._editor.hasModel()),Bi(this._triggerState!==void 0);let e=new ak(this._editor.getModel(),this._editor.getPosition(),{...this._triggerState,refilter:!0});this._onNewContext(e)}trigger(e){if(!this._editor.hasModel())return;let t=this._editor.getModel(),n=new ak(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=n;let r={triggerKind:e.triggerKind??0};e.triggerCharacter&&(r={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new ou;let i=this._editor.getOption(128),a=1;switch(i){case`top`:a=0;break;case`bottom`:a=2;break}let{itemKind:o,showDeprecated:s}=ik.createSuggestFilter(this._editor),c=new rw(a,e.completionOptions?.kindFilter??o,e.completionOptions?.providerFilter,e.completionOptions?.providerItemsToReuse,s),l=tk.create(this._editorWorkerService,this._editor),u=aw(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),c,r,this._requestToken.token);Promise.all([u,l]).then(async([t,n])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){t.disposable.dispose();return}let r=e?.clipboardText;if(!r&&t.needsClipboard&&(r=await this._clipboardService.readText()),this._triggerState===void 0){t.disposable.dispose();return}let i=new ak(this._editor.getModel(),this._editor.getPosition(),e),a={...Qi.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new $O(t.items,this._context.column,{leadingLineContent:i.leadingLineContent,characterCountDelta:i.column-this._context.column},n,this._editor.getOption(134),this._editor.getOption(128),a,r),this._completionDisposables.add(t.disposable),this._onNewContext(i),this._reportDurationsTelemetry(t.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(let e of t.items)e.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${e.provider._debugDisplayName}`,e.completion)}).catch(Hc)}_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){let t=new Set;e.getOption(128)===`none`&&t.add(28);let n=e.getOption(134);return n.showMethods||t.add(0),n.showFunctions||t.add(1),n.showConstructors||t.add(2),n.showFields||t.add(3),n.showVariables||t.add(4),n.showClasses||t.add(5),n.showStructs||t.add(6),n.showInterfaces||t.add(7),n.showModules||t.add(8),n.showProperties||t.add(9),n.showEvents||t.add(10),n.showOperators||t.add(11),n.showUnits||t.add(12),n.showValues||t.add(13),n.showConstants||t.add(14),n.showEnums||t.add(15),n.showEnumMembers||t.add(16),n.showKeywords||t.add(17),n.showWords||t.add(18),n.showColors||t.add(19),n.showFiles||t.add(20),n.showReferences||t.add(21),n.showColors||t.add(22),n.showFolders||t.add(23),n.showTypeParameters||t.add(24),n.showSnippets||t.add(28),n.showUsers||t.add(25),n.showIssues||t.add(26),{itemKind:t,showDeprecated:n.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(an(e.leadingLineContent)!==an(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(ak.shouldAutoTrigger(this._editor)&&this._context){let e=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:e}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){let e=new Map,t=new Set;for(let[n,r]of this._completionModel.getItemsByProvider())r.length>0&&r[0].container.incomplete?t.add(n):e.set(n,r);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:t,providerItemsToReuse:e}})}else{let t=this._completionModel.lineContext,n=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){let r=ak.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(r&&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,n=this._completionModel.items.length>0,n&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:n})}}}}};ck=ik=nk([rk(1,$i),rk(2,xe),rk(3,au),rk(4,Pl),rk(5,G),rk(6,xa),rk(7,q),rk(8,fu)],ck);var lk=class e{static{this._maxSelectionLength=51200}constructor(t,n){this._disposables=new S,this._lastOvertyped=[],this._locked=!1,this._disposables.add(t.onWillType(()=>{if(this._locked||!t.hasModel())return;let n=t.getSelections(),r=n.length,i=!1;for(let e=0;e<r;e++)if(!n[e].isEmpty()){i=!0;break}if(!i){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];let a=t.getModel();for(let t=0;t<r;t++){let r=n[t];if(a.getValueLengthInRange(r)>e._maxSelectionLength)return;this._lastOvertyped[t]={value:a.getValueInRange(r),multiline:r.startLineNumber!==r.endLineNumber}}})),this._disposables.add(n.onDidTrigger(e=>{this._locked=!0})),this._disposables.add(n.onDidCancel(e=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}},uk=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},dk=function(e,t){return function(n,r){t(n,r,e)}},fk=class{constructor(e,t,n,r,i,a){this._menuId=t,this._menuService=i,this._contextKeyService=a,this._menuDisposables=new S,this.element=H(e,I(`.suggest-status-bar`));let o=(e=>n?.showIconsNoKeybindings?e instanceof Lr?r.createInstance(Sc,e,void 0):void 0:e instanceof Lr?r.createInstance(hl,e,{useComma:!1}):void 0);this._leftActions=new Fn(this.element,{actionViewItemProvider:o}),this._rightActions=new Fn(this.element,{actionViewItemProvider:o}),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(){let e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{let t=[],n=[];for(let[r,i]of e.getActions())r===`left`?t.push(...i):n.push(...i);this._leftActions.clear(),this._leftActions.push(t),this._rightActions.clear(),this._rightActions.push(n)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};fk=uk([dk(3,w),dk(4,La),dk(5,G)],fk);var pk=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},mk=function(e,t){return function(n,r){t(n,r,e)}};function hk(e){return!!e&&!!(e.completion.documentation||e.completion.detail&&e.completion.detail!==e.completion.label)}var gk=class{constructor(e,t,n){this._editor=e,this._themeService=t,this._markdownRendererService=n,this._onDidClose=new U,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new U,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new S,this._renderDisposeable=new S,this._size=new zi(330,0),this.domNode=I(`.suggest-details`),this.domNode.classList.add(`no-docs`),this._body=I(`.body`),this._scrollbar=new su(this._body,{alwaysConsumeMouseWheel:!0}),H(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=H(this._body,I(`.header`)),this._close=H(this._header,I(`span`+C.asCSSSelector(D.close))),this._close.title=V(1542,`Close`),this._close.role=`button`,this._close.tabIndex=-1,this._type=H(this._header,I(`p.type`)),this._docs=H(this._body,I(`p.docs`)),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){let e=this._editor.getOptions(),t=e.get(59),n=t.getMassagedFontFamily(),r=e.get(135)||t.fontSize,i=e.get(136)||t.lineHeight,a=t.fontWeight,o=`${r}px`,s=`${i}px`;this.domNode.style.fontSize=o,this.domNode.style.lineHeight=`${i/r}`,this.domNode.style.fontWeight=a,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=n,this._close.style.height=s,this._close.style.width=s}getLayoutInfo(){let e=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,t=Xr(this._themeService.getColorTheme().type)?2:1;return{lineHeight:e,borderWidth:t,borderHeight:t*2,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=V(1543,`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:n,documentation:r}=e.completion;if(t){let t=``;t+=`score: ${e.score[0]}\n`,t+=`prefix: ${e.word??`(no prefix)`}\n`,t+=`word: ${e.completion.filterText?e.completion.filterText+` (filterText)`:e.textLabel}\n`,t+=`distance: ${e.distance} (localityBonus-setting)\n`,t+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||`label`}\n`,t+=`commit_chars: ${e.completion.commitCharacters?.join(``)}\n`,r=new li().appendCodeblock(`empty`,t),n=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!hk(e)){this.clearContents();return}if(this.domNode.classList.remove(`no-docs`,`no-type`),n){let e=n.length>1e5?`${n.substr(0,1e5)}…`:n;this._type.textContent=e,this._type.title=e,Bs(this._type),this._type.classList.toggle(`auto-wrap`,!/\r?\n^\s+/gim.test(e))}else Mc(this._type),this._type.title=``,Vu(this._type),this.domNode.classList.add(`no-type`);if(Mc(this._docs),typeof r==`string`)this._docs.classList.remove(`markdown-docs`),this._docs.textContent=r;else if(r){this._docs.classList.add(`markdown-docs`),Mc(this._docs);let e=this._markdownRendererService.render(r,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(e.element),this._renderDisposeable.add(e)}this.domNode.classList.toggle(`detail-and-doc`,!!n&&!!r),this.domNode.style.userSelect=`text`,this.domNode.tabIndex=-1,this._close.onmousedown=e=>{e.preventDefault(),e.stopPropagation()},this._close.onclick=e=>{e.preventDefault(),e.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){let n=new zi(e,t);zi.equals(n,this._size)||(this._size=n,_(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()}};gk=pk([mk(1,Ll),mk(2,it)],gk);var _k=class{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new S,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new qh,this._resizable.domNode.classList.add(`suggest-details-container`),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let n,r,i=0,a=0;this._disposables.add(this._resizable.onDidWillResize(()=>{n=this._topLeft,r=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(e=>{if(n&&r){this.widget.layout(e.dimension.width,e.dimension.height);let t=!1;e.west&&(a=r.width-e.dimension.width,t=!0),e.north&&(i=r.height-e.dimension.height,t=!0),t&&this._applyTopLeft({top:n.top+i,left:n.left+a})}e.done&&(n=void 0,r=void 0,i=0,a=0,this._userSize=e.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),!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){let n=e.getBoundingClientRect();this._anchorBox=n,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,n){let r=Xl(this.getDomNode().ownerDocument.body),i=this.widget.getLayoutInfo(),a=new zi(220,2*i.lineHeight),o=e.top,s=(function(){let n=r.width-(e.left+e.width+i.borderWidth+i.horizontalPadding),s=-i.borderWidth+e.left+e.width,c=new zi(n,r.height-e.top-i.borderHeight-i.verticalPadding),l=c.with(void 0,e.top+e.height-i.borderHeight-i.verticalPadding);return{top:o,left:s,fit:n-t.width,maxSizeTop:c,maxSizeBottom:l,minSize:a.with(Math.min(n,a.width))}})(),c=(function(){let n=e.left-i.borderWidth-i.horizontalPadding,s=Math.max(i.horizontalPadding,e.left-t.width-i.borderWidth),c=new zi(n,r.height-e.top-i.borderHeight-i.verticalPadding),l=c.with(void 0,e.top+e.height-i.borderHeight-i.verticalPadding);return{top:o,left:s,fit:n-t.width,maxSizeTop:c,maxSizeBottom:l,minSize:a.with(Math.min(n,a.width))}})(),l=(function(){let n=e.left,o=-i.borderWidth+e.top+e.height,s=new zi(e.width-i.borderHeight,r.height-e.top-e.height-i.verticalPadding);return{top:o,left:n,fit:s.height-t.height,maxSizeBottom:s,maxSizeTop:s,minSize:a.with(s.width)}})(),u=(function(){let n=e.left,r=new zi(e.width-i.borderHeight,e.top-i.verticalPadding);return{top:Math.max(i.verticalPadding,e.top-t.height),left:n,fit:r.height-t.height,maxSizeTop:r,maxSizeBottom:r,minSize:a.with(r.width)}})(),d=[s,c,n?l:u],f=d.find(e=>e.fit>=0)??d.sort((e,t)=>t.fit-e.fit)[0],p=e.top+e.height-i.borderHeight,m,h=t.height,g=Math.max(f.maxSizeTop.height,f.maxSizeBottom.height);h>g&&(h=g);let _;n?h<=f.maxSizeTop.height?(m=!0,_=f.maxSizeTop):(m=!1,_=f.maxSizeBottom):h<=f.maxSizeBottom.height?(m=!1,_=f.maxSizeBottom):(m=!0,_=f.maxSizeTop);let{top:v,left:y}=f;f===u?v=e.top-h+i.borderWidth:!m&&h>e.height&&(v=p-h);let b=this._editor.getDomNode();if(b){let e=b.getBoundingClientRect();v-=e.top,y-=e.left}this._applyTopLeft({left:y,top:v}),f===u?this._resizable.enableSashes(!0,!1,!1,!0):this._resizable.enableSashes(!m,f===s,m,f!==s),this._resizable.minSize=f.minSize,this._resizable.maxSize=_,this._resizable.layout(h,Math.min(_.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}},vk=Xt(`fileService`),yk;(function(e){e[e.FILE=0]=`FILE`,e[e.FOLDER=1]=`FOLDER`,e[e.ROOT_FOLDER=2]=`ROOT_FOLDER`})(yk||={});var bk=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function xk(e,t,n,r,i){if(C.isThemeIcon(i))return[`codicon-${i.id}`,`predefined-file-icon`];if(On.isUri(i))return[];let a=r===yk.ROOT_FOLDER?[`rootfolder-icon`]:r===yk.FOLDER?[`folder-icon`]:[`file-icon`];if(n){let i;if(n.scheme===Ks.data)i=Ta.parseMetaData(n).get(Ta.META_DATA_LABEL);else{let e=n.path.match(bk);e?(i=Ck(e[2].toLowerCase()),e[1]&&a.push(`${Ck(e[1].toLowerCase())}-name-dir-icon`)):i=Ck(n.authority.toLowerCase())}if(r===yk.ROOT_FOLDER)a.push(`${i}-root-name-folder-icon`);else if(r===yk.FOLDER)a.push(`${i}-name-folder-icon`);else{if(i){if(a.push(`${i}-name-file-icon`),a.push(`name-file-icon`),i.length<=255){let e=i.split(`.`);for(let t=1;t<e.length;t++)a.push(`${e.slice(t).join(`.`)}-ext-file-icon`)}a.push(`ext-file-icon`)}let r=Sk(e,t,n);r&&a.push(`${Ck(r)}-lang-file-icon`)}}return a}function Sk(e,t,n){if(!n)return null;let r=null;if(n.scheme===Ks.data){let e=Ta.parseMetaData(n).get(Ta.META_DATA_MIME);e&&(r=t.getLanguageIdByMimeType(e))}else{let t=e.getModel(n);t&&(r=t.getLanguageId())}return r&&r!==`plaintext`?r:t.guessLanguageIdByFilepathOrFirstLine(n)}function Ck(e){return e.replace(/[\s]/g,`/`)}var wk=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Tk=function(e,t){return function(n,r){t(n,r,e)}},Ek=Vs(`suggest-more-info`,D.chevronRight,V(1544,`Icon for more information in the suggest widget.`)),Dk=new class e{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=RegExp(`^${e._regexRelaxed.source}$`,`i`)}extract(t,n){if(t.textLabel.match(e._regexStrict))return n[0]=t.textLabel,!0;if(t.completion.detail&&t.completion.detail.match(e._regexStrict))return n[0]=t.completion.detail,!0;if(t.completion.documentation){let r=typeof t.completion.documentation==`string`?t.completion.documentation:t.completion.documentation.value,i=e._regexRelaxed.exec(r);if(i&&(i.index===0||i.index+i[0].length===r.length))return n[0]=i[0],!0}return!1}},Ok=class{constructor(e,t,n,r){this._editor=e,this._modelService=t,this._languageService=n,this._themeService=r,this._onDidToggleDetails=new U,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId=`suggestion`}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){let t=new S,n=e;n.classList.add(`show-file-icons`);let r=H(e,I(`.icon`)),i=H(r,I(`span.colorspan`)),a=H(H(e,I(`.contents`)),I(`.main`)),o=H(a,I(`.icon-label.codicon`)),s=H(a,I(`span.left`)),c=H(a,I(`span.right`)),l=new _t(s,{supportHighlights:!0,supportIcons:!0});t.add(l);let u=H(s,I(`span.signature-label`)),d=H(s,I(`span.qualifier-label`)),f=H(c,I(`span.details-label`)),p=H(c,I(`span.readMore`+C.asCSSSelector(Ek)));return p.title=V(1545,`Read More`),{root:n,left:s,right:c,icon:r,colorspan:i,iconLabel:l,iconContainer:o,parametersLabel:u,qualifierLabel:d,detailsLabel:f,readMore:p,disposables:t,configureFont:()=>{let e=this._editor.getOptions(),t=e.get(59),i=t.getMassagedFontFamily(),o=t.fontFeatureSettings,s=t.fontVariationSettings,c=e.get(135)||t.fontSize,l=e.get(136)||t.lineHeight,u=t.fontWeight,d=t.letterSpacing,f=`${c}px`,m=`${l}px`,h=`${d}px`;n.style.fontSize=f,n.style.fontWeight=u,n.style.letterSpacing=h,a.style.fontFamily=i,a.style.fontFeatureSettings=o,a.style.fontVariationSettings=s,a.style.lineHeight=m,r.style.height=m,r.style.width=m,p.style.height=m,p.style.width=m}}}renderElement(e,t,n){n.configureFont();let{completion:r}=e;n.colorspan.style.backgroundColor=``;let i={labelEscapeNewLines:!0,matches:la(e.score)},a=[];if(r.kind===19&&Dk.extract(e,a))n.icon.className=`icon customcolor`,n.iconContainer.className=`icon hide`,n.colorspan.style.backgroundColor=a[0];else if(r.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){n.icon.className=`icon hide`,n.iconContainer.className=`icon hide`;let t=xk(this._modelService,this._languageService,On.from({scheme:`fake`,path:e.textLabel}),yk.FILE),a=xk(this._modelService,this._languageService,On.from({scheme:`fake`,path:r.detail}),yk.FILE);i.extraClasses=t.length>a.length?t:a}else r.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(n.icon.className=`icon hide`,n.iconContainer.className=`icon hide`,i.extraClasses=[xk(this._modelService,this._languageService,On.from({scheme:`fake`,path:e.textLabel}),yk.FOLDER),xk(this._modelService,this._languageService,On.from({scheme:`fake`,path:r.detail}),yk.FOLDER)].flat()):(n.icon.className=`icon hide`,n.iconContainer.className=``,n.iconContainer.classList.add(`suggest-icon`,...C.asClassNameArray(Hs.toIcon(r.kind))));r.tags&&r.tags.indexOf(1)>=0&&(i.extraClasses=(i.extraClasses||[]).concat([`deprecated`]),i.matches=[]),n.iconLabel.setLabel(e.textLabel,void 0,i),typeof r.label==`string`?(n.parametersLabel.textContent=``,n.detailsLabel.textContent=kk(r.detail||``),n.root.classList.add(`string-label`)):(n.parametersLabel.textContent=kk(r.label.detail||``),n.detailsLabel.textContent=kk(r.label.description||``),n.root.classList.remove(`string-label`)),this._editor.getOption(134).showInlineDetails?Bs(n.detailsLabel):Vu(n.detailsLabel),hk(e)?(n.right.classList.add(`can-expand-details`),Bs(n.readMore),n.readMore.onmousedown=e=>{e.stopPropagation(),e.preventDefault()},n.readMore.onclick=e=>{e.stopPropagation(),e.preventDefault(),this._onDidToggleDetails.fire()}):(n.right.classList.remove(`can-expand-details`),Vu(n.readMore),n.readMore.onmousedown=null,n.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};Ok=wk([Tk(1,yt),Tk(2,Zo),Tk(3,Ll)],Ok);function kk(e){return e.replace(/\r\n|\r|\n/g,``)}var Ak=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},jk=function(e,t){return function(n,r){t(n,r,e)}},Mk;E(`editorSuggestWidget.background`,Eu,V(1525,`Background color of the suggest widget.`)),E(`editorSuggestWidget.border`,Ir,V(1526,`Border color of the suggest widget.`));var Nk=E(`editorSuggestWidget.foreground`,wa,V(1527,`Foreground color of the suggest widget.`));E(`editorSuggestWidget.selectedForeground`,xn,V(1528,`Foreground color of the selected entry in the suggest widget.`)),E(`editorSuggestWidget.selectedIconForeground`,Nn,V(1529,`Icon foreground color of the selected entry in the suggest widget.`));var Pk=E(`editorSuggestWidget.selectedBackground`,Ds,V(1530,`Background color of the selected entry in the suggest widget.`));E(`editorSuggestWidget.highlightForeground`,ki,V(1531,`Color of the match highlights in the suggest widget.`)),E(`editorSuggestWidget.focusHighlightForeground`,si,V(1532,`Color of the match highlights in the suggest widget when an item is focused.`)),E(`editorSuggestWidgetStatus.foreground`,sn(Nk,.5),V(1533,`Foreground color of the suggest widget status.`));var Fk=class{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Av}`}restore(){let e=this._service.get(this._key,0)??``;try{let t=JSON.parse(e);if(zi.is(t))return zi.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}},Ik=class{static{Mk=this}static{this.LOADING_MESSAGE=V(1534,`Loading...`)}static{this.NO_SUGGESTIONS_MESSAGE=V(1535,`No suggestions.`)}constructor(e,t,n,r,i){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._loadingTimeout=new Ae,this._pendingLayout=new Ae,this._pendingShowDetails=new Ae,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new Ja,this._disposables=new S,this._onDidSelect=new Rr,this._onDidFocus=new Rr,this._onDidHide=new U,this._onDidShow=new U,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new U,this.element=new qh,this.element.domNode.classList.add(`editor-widget`,`suggest-widget`),this._contentWidget=new Lk(this,e),this._persistedSize=new Fk(t,e);class a{constructor(e,t,n=!1,r=!1){this.persistedSize=e,this.currentSize=t,this.persistHeight=n,this.persistWidth=r}}let o;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),o=new a(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(e=>{if(this._resize(e.dimension.width,e.dimension.height),o&&(o.persistHeight=o.persistHeight||!!e.north||!!e.south,o.persistWidth=o.persistWidth||!!e.east||!!e.west),e.done){if(o){let{itemHeight:e,defaultSize:t}=this.getLayoutInfo(),n=Math.round(e/2),{width:r,height:i}=this.element.size;(!o.persistHeight||Math.abs(o.currentSize.height-i)<=n)&&(i=o.persistedSize?.height??t.height),(!o.persistWidth||Math.abs(o.currentSize.width-r)<=n)&&(r=o.persistedSize?.width??t.width),this._persistedSize.store(new zi(r,i))}this._contentWidget.unlockPreference(),o=void 0}})),this._messageElement=H(this.element.domNode,I(`.message`)),this._listElement=H(this.element.domNode,I(`.tree`));let s=this._disposables.add(i.createInstance(gk,this.editor));s.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new _k(s,this.editor);let c=()=>this.element.domNode.classList.toggle(`no-icons`,!this.editor.getOption(134).showIcons);c();let l=i.createInstance(Ok,this.editor);this._disposables.add(l),this._disposables.add(l.onDidToggleDetails(()=>this.toggleDetails())),this._list=new et(`SuggestWidget`,this._listElement,{getHeight:e=>this.getLayoutInfo().itemHeight,getTemplateId:e=>`suggestion`},[l],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>Zt?`listitem`:`option`,getWidgetAriaLabel:()=>V(1536,`Suggest`),getWidgetRole:()=>`listbox`,getAriaLabel:e=>{let t=e.textLabel,n=Hs.toLabel(e.completion.kind);if(typeof e.completion.label!=`string`){let{detail:r,description:i}=e.completion.label;r&&i?t=V(1537,`{0} {1}, {2}, {3}`,t,r,i,n):r?t=V(1538,`{0} {1}, {2}`,t,r,n):i&&(t=V(1539,`{0}, {1}, {2}`,t,i,n))}else t=V(1540,`{0}, {1}`,t,n);if(!e.isResolved||!this._isDetailsVisible())return t;let{documentation:r,detail:i}=e.completion,a=gt(`{0}{1}`,i||``,r?typeof r==`string`?r:r.value:``);return V(1541,`{0}, docs: {1}`,t,a)}}}),this._list.style(Fo({listInactiveFocusBackground:Pk,listInactiveFocusOutline:Hn})),this._status=i.createInstance(fk,this.element.domNode,tw,void 0);let u=()=>this.element.domNode.classList.toggle(`with-status-bar`,this.editor.getOption(134).showStatusBar);u(),this._disposables.add(this._list.onMouseDown(e=>this._onListMouseDownOrTap(e))),this._disposables.add(this._list.onTap(e=>this._onListMouseDownOrTap(e))),this._disposables.add(this._list.onDidChangeSelection(e=>this._onListSelection(e))),this._disposables.add(this._list.onDidChangeFocus(e=>this._onListFocus(e))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(e=>{e.hasChanged(134)&&(u(),c()),this._completionModel&&(e.hasChanged(59)||e.hasChanged(135)||e.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Q.Visible.bindTo(n),this._ctxSuggestWidgetDetailsVisible=Q.DetailsVisible.bindTo(n),this._ctxSuggestWidgetMultipleSuggestions=Q.MultipleSuggestions.bindTo(n),this._ctxSuggestWidgetHasFocusedSuggestion=Q.HasFocusedSuggestion.bindTo(n),this._ctxSuggestWidgetDetailsFocused=Q.DetailsFocused.bindTo(n);let d=Os(this._details.widget.domNode);this._disposables.add(d),this._disposables.add(d.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(d.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(vs(this._details.widget.domNode,`keydown`,e=>{this._onDetailsKeydown.fire(e)})),this._disposables.add(this.editor.onMouseDown(e=>this._onEditorMouseDown(e)))}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){e.element===void 0||e.index===void 0||(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){let n=this._completionModel;n&&(this._onDidSelect.fire({item:e,index:t,model:n}),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);let t=e.elements[0],n=e.indexes[0];t!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(n),this._currentSuggestionDetails=ql(async e=>{let n=oo(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=e.onCancellationRequested(()=>n.dispose());try{return await t.resolve(e)}finally{n.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{n>=this._list.length||t!==this._list.element(n)||(this._ignoreFocusEvents=!0,this._list.splice(n,1,[t]),this._list.setFocus([n]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove(`docs-side`),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(n)}))}).catch(Hc)),this._onDidFocus.fire({item:t,index:n,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:Vu(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=Mk.LOADING_MESSAGE,Vu(this._listElement,this._status.element),Bs(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,zt(Mk.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add(`message`),this._messageElement.textContent=Mk.NO_SUGGESTIONS_MESSAGE,Vu(this._listElement,this._status.element),Bs(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,zt(Mk.NO_SUGGESTIONS_MESSAGE);break;case 3:Vu(this._messageElement),Bs(this._listElement,this._status.element),this._show();break;case 4:Vu(this._messageElement),Bs(this._listElement,this._status.element),this._show();break;case 5:Vu(this._messageElement),Bs(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus();break}}_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=oo(()=>this._setState(1),t)))}showSuggestions(e,t,n,r,i){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout.clear(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),n&&this._state!==2&&this._state!==0){this._setState(4);return}let a=this._completionModel.items.length,o=a===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(a>1),o){this._setState(r?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(n?4:3),this._list.reveal(t,0,t===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(i?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=He(_a(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`)):(hk(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=He(_a(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let n=!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(),n=!0)),n||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();let 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;let t=Xl(this.element.domNode.ownerDocument.body),n=this.getLayoutInfo();e||=n.defaultSize;let r=e.height,i=e.width;if(this._status.element.style.height=`${n.itemHeight}px`,this._state===2||this._state===1)r=n.itemHeight+n.borderHeight,i=n.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new zi(i,r),this._contentWidget.setPreference(2);else{let a=t.width-n.borderHeight-2*n.horizontalPadding;i>a&&(i=a);let o=this._completionModel?this._completionModel.stats.pLabelLen*n.typicalHalfwidthCharacterWidth:i,s=n.statusBarHeight+this._list.contentHeight+n.borderHeight,c=n.itemHeight+n.statusBarHeight,l=Po(this.editor.getDomNode()),u=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),d=l.top+u.top+u.height,f=Math.min(t.height-d-n.verticalPadding,s),p=l.top+u.top-n.verticalPadding,m=Math.min(p,s),h=Math.min(Math.max(m,f)+n.borderHeight,s);r===this._cappedHeight?.capped&&(r=this._cappedHeight.wanted),r<c&&(r=c),r>h&&(r=h),r>f&&m>f||this._forceRenderingAbove&&p>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),h=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),h=f),this.element.preferredSize=new zi(o,n.defaultSize.height),this.element.maxSize=new zi(a,h),this.element.minSize=new zi(220,c),this._cappedHeight=r===s?{wanted:this._cappedHeight?.wanted??e.height,capped:r}:void 0}this._resize(i,r)}_resize(e,t){let{width:n,height:r}=this.element.maxSize;e=Math.min(n,e),t=Math.min(r,t);let{statusBarHeight:i}=this.getLayoutInfo();this._list.layout(t-i,e),this._listElement.style.height=`${t-i}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)}getLayoutInfo(){let e=this.editor.getOption(59),t=Mt(this.editor.getOption(136)||e.lineHeight,8,1e3),n=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:t,r=this._details.widget.getLayoutInfo().borderWidth;return{itemHeight:t,statusBarHeight:n,borderWidth:r,borderHeight:2*r,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new zi(430,n+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}};Ik=Mk=Ak([jk(1,Gc),jk(2,G),jk(3,Ll),jk(4,w)],Ik);var Lk=class{constructor(e,t){this._widget=e,this._editor=t,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(){let{height:e,width:t}=this._widget.element.size,{borderWidth:n,horizontalPadding:r}=this._widget.getLayoutInfo();return new zi(t+2*n+r,e+2*n)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}},Rk=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zk=function(e,t){return function(n,r){t(n,r,e)}},Bk,Vk=class{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=Y.register({description:`suggest-line-suffix`,stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){let n=e.getOffsetAt(t),r=e.getPositionAt(n+1);e.changeDecorations(e=>{this._marker&&e.removeDecoration(this._marker),this._marker=e.addDecoration(T.fromPositions(t,r),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){let t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}},Hk=class{static{Bk=this}static{this.ID=`editor.contrib.suggestController`}static get(e){return e.getContribution(Bk.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}constructor(e,t,n,r,i,a,o){this._memoryService=t,this._commandService=n,this._contextKeyService=r,this._instantiationService=i,this._logService=a,this._telemetryService=o,this._lineSuffix=new Ae,this._toDispose=new S,this._selectors=new Uk(e=>e.priority),this._onWillInsertSuggestItem=new U,this._wantsForceRenderingAbove=!1,this.editor=e,this.model=i.createInstance(ck,this.editor),this._selectors.register({priority:0,select:(e,t,n)=>this._memoryService.select(e,t,n)});let s=Q.InsertMode.bindTo(r);s.set(e.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>s.set(e.getOption(134).insertMode))),this.widget=this._toDispose.add(new So(_a(e.getDomNode()),()=>{let e=this._instantiationService.createInstance(Ik,this.editor);this._toDispose.add(e),this._toDispose.add(e.onDidSelect(e=>this._insertSuggestion(e,0),this));let t=new ZO(this.editor,e,this.model,e=>this._insertSuggestion(e,2));this._toDispose.add(t);let n=Q.MakesTextEdit.bindTo(this._contextKeyService),r=Q.HasInsertAndReplaceRange.bindTo(this._contextKeyService),i=Q.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(bn(()=>{n.reset(),r.reset(),i.reset()})),this._toDispose.add(e.onDidFocus(({item:e})=>{let t=this.editor.getPosition(),a=e.editStart.column,o=t.column,s=!0;this.editor.getOption(1)===`smart`&&this.model.state===2&&!e.completion.additionalTextEdits&&!(e.completion.insertTextRules&4)&&o-a===e.completion.insertText.length&&(s=this.editor.getModel().getValueInRange({startLineNumber:t.lineNumber,startColumn:a,endLineNumber:t.lineNumber,endColumn:o})!==e.completion.insertText),n.set(s),r.set(!M.equals(e.editInsertEnd,e.editReplaceEnd)),i.set(!!e.provider.resolveCompletionItem||!!e.completion.documentation||e.completion.detail!==e.completion.label)})),this._wantsForceRenderingAbove&&e.forceRenderingAbove(),e})),this._overtypingCapturer=this._toDispose.add(new So(_a(e.getDomNode()),()=>this._toDispose.add(new lk(this.editor,this.model)))),this._alternatives=this._toDispose.add(new So(_a(e.getDomNode()),()=>this._toDispose.add(new XO(this.editor,this._contextKeyService)))),this._toDispose.add(i.createInstance(KO,e)),this._toDispose.add(this.model.onDidTrigger(e=>{this.widget.value.showTriggered(e.auto,e.shy?250:50),this._lineSuffix.value=new Vk(this.editor.getModel(),e.position)})),this._toDispose.add(this.model.onDidSuggest(e=>{if(e.triggerOptions.shy)return;let t=-1;for(let n of this._selectors.itemsOrderedByPriorityDesc)if(t=n.select(this.editor.getModel(),this.editor.getPosition(),e.completionModel.items),t!==-1)break;if(t===-1&&(t=0),this.model.state===0)return;let n=!1;if(e.triggerOptions.auto){let t=this.editor.getOption(134);t.selectionMode===`never`||t.selectionMode===`always`?n=t.selectionMode===`never`:t.selectionMode===`whenTriggerCharacter`?n=e.triggerOptions.triggerKind!==1:t.selectionMode===`whenQuickSuggestion`&&(n=e.triggerOptions.triggerKind===1&&!e.triggerOptions.refilter)}this.widget.value.showSuggestions(e.completionModel,t,e.isFrozen,e.triggerOptions.auto,n)})),this._toDispose.add(this.model.onDidCancel(e=>{e.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));let c=Q.AcceptSuggestionsOnEnter.bindTo(r),l=()=>{let e=this.editor.getOption(1);c.set(e===`on`||e===`smart`)};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>l())),l()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;let n=uE.get(this.editor);if(!n)return;this._onWillInsertSuggestItem.fire({item:e.item});let r=this.editor.getModel(),i=r.getAlternativeVersionId(),{item:a}=e,o=[],s=new ou;t&1||this.editor.pushUndoStop();let c=this.getOverwriteInfo(a,!!(t&8));this._memoryService.memorize(r,this.editor.getPosition(),a);let l=a.isResolved,u=-1,d=-1;if(Array.isArray(a.completion.additionalTextEdits)){this.model.cancel();let e=ja.capture(this.editor);this.editor.executeEdits(`suggestController.additionalTextEdits.sync`,a.completion.additionalTextEdits.map(e=>{let t=T.lift(e.range);if(t.startLineNumber===a.position.lineNumber&&t.startColumn>a.position.column){let e=this.editor.getPosition().column-a.position.column,n=e,r=T.spansMultipleLines(t)?0:e;t=new T(t.startLineNumber,t.startColumn+n,t.endLineNumber,t.endColumn+r)}return Ss.replaceMove(t,e.text)})),e.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!l){let e=new ve,n,i=r.onDidChangeContent(e=>{if(e.isFlush){s.cancel(),i.dispose();return}for(let t of e.changes){let e=T.getEndPosition(t.range);(!n||M.isBefore(e,n))&&(n=e)}}),c=t;t|=2;let l=!1,u=this.editor.onWillType(()=>{u.dispose(),l=!0,c&2||this.editor.pushUndoStop()});o.push(a.resolve(s.token).then(()=>{if(!a.completion.additionalTextEdits||s.token.isCancellationRequested)return;if(n&&a.completion.additionalTextEdits.some(e=>M.isBefore(n,T.getStartPosition(e.range))))return!1;l&&this.editor.pushUndoStop();let e=ja.capture(this.editor);return this.editor.executeEdits(`suggestController.additionalTextEdits.async`,a.completion.additionalTextEdits.map(e=>Ss.replaceMove(T.lift(e.range),e.text))),e.restoreRelativeVerticalPositionOfCursor(this.editor),(l||!(c&2))&&this.editor.pushUndoStop(),!0}).then(t=>{this._logService.trace(`[suggest] async resolving of edits DONE (ms, applied?)`,e.elapsed(),t),d=t===!0?1:t===!1?0:-2}).finally(()=>{i.dispose(),u.dispose()}))}let{insertText:f}=a.completion;if(a.completion.insertTextRules&4||(f=yf.escape(f)),this.model.cancel(),n.insert(f,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(a.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:Ln.suggest({providerId:ue.fromExtensionId(a.extensionId?.value)})}),t&2||this.editor.pushUndoStop(),a.completion.command)if(a.completion.command.id===Wk.id)this.model.trigger({auto:!0,retrigger:!0});else{let e=new ve;o.push(this._commandService.executeCommand(a.completion.command.id,...a.completion.command.arguments?[...a.completion.command.arguments]:[]).catch(e=>{a.completion.extensionId?cc(e):Hc(e)}).finally(()=>{u=e.elapsed()}))}t&4&&this._alternatives.value.set(e,e=>{for(s.cancel();r.canUndo();){i!==r.getAlternativeVersionId()&&r.undo(),this._insertSuggestion(e,3|(t&8?8:0));break}}),this._alertCompletionItem(a),Promise.all(o).finally(()=>{this._reportSuggestionAcceptedTelemetry(a,r,l,u,d,e.index,e.model.items),this.model.clear(),s.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,n,r,i,a,o){if(Math.random()>1e-4)return;let s=new Map;for(let e=0;e<Math.min(30,o.length);e++){let t=o[e].textLabel;s.has(t)?s.get(t).push(e):s.set(t,[e])}let c=s.get(e.textLabel),l=c&&c.length>1?c[0]:-1;this._telemetryService.publicLog2(`suggest.acceptedSuggestion`,{extensionId:e.extensionId?.value??`unknown`,providerId:e.provider._debugDisplayName??`unknown`,kind:e.completion.kind,basenameHash:Re(Oc(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:Kl(t.uri),resolveInfo:e.provider.resolveCompletionItem?+!!n:-1,resolveDuration:e.resolveDuration,commandDuration:r,additionalEditsAsync:i,index:a,firstIndex:l})}getOverwriteInfo(e,t){Bi(this.editor.hasModel());let n=this.editor.getOption(134).insertMode===`replace`;t&&(n=!n);let r=e.position.column-e.editStart.column,i=(n?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,a=this.editor.getPosition().column-e.position.column,o=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:r+a,overwriteAfter:i+o}}_alertCompletionItem(e){Fu(e.completion.additionalTextEdits)&&$c(V(1514,`Accepting '{0}' made {1} additional edits`,e.textLabel,e.completion.additionalTextEdits.length))}triggerSuggest(e,t,n){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:n?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;let t=this.editor.getPosition(),n=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},r=e=>{if(e.completion.insertTextRules&4||e.completion.additionalTextEdits)return!0;let t=this.editor.getPosition(),n=e.editStart.column,r=t.column;return r-n===e.completion.insertText.length?this.editor.getModel().getValueInRange({startLineNumber:t.lineNumber,startColumn:n,endLineNumber:t.lineNumber,endColumn:r})!==e.completion.insertText:!0};Du.once(this.model.onDidTrigger)(e=>{let t=[];Du.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{h(t),n()},void 0,t),this.model.onDidSuggest(({completionModel:e})=>{if(h(t),e.items.length===0){n();return}let i=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),e.items),a=e.items[i];if(!r(a)){n();return}this.editor.pushUndoStop(),this._insertSuggestion({index:i,item:a,model:e},7)},void 0,t)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){let n=this.widget.value.getFocusedItem(),r=0;e&&(r|=4),t&&(r|=8),this._insertSuggestion(n,r)}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)}};Hk=Bk=Rk([zk(1,HO),zk(2,tr),zk(3,G),zk(4,w),zk(5,Pl),zk(6,au)],Hk);var Uk=class{constructor(e){this.prioritySelector=e,this._items=[]}register(e){if(this._items.indexOf(e)!==-1)throw Error(`Value is already registered`);return this._items.push(e),this._items.sort((e,t)=>this.prioritySelector(t)-this.prioritySelector(e)),{dispose:()=>{let t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}},Wk=class e extends N{static{this.id=`editor.action.triggerSuggest`}constructor(){super({id:e.id,label:J(1523,`Trigger Suggest`),precondition:m.and(z.writable,z.hasCompletionItemProvider,Q.Visible.toNegated()),kbOpts:{kbExpr:z.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,n){let r=Hk.get(t);if(!r)return;let i;n&&typeof n==`object`&&n.auto===!0&&(i=!0),r.triggerSuggest(void 0,i,void 0)}};F(Hk.ID,Hk,2),O(Wk);var Gk=190,Kk=mt.bindToContribution(Hk.get);R(new Kk({id:`acceptSelectedSuggestion`,precondition:m.and(Q.Visible,Q.HasFocusedSuggestion),handler(e){e.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:m.and(Q.Visible,z.textInputFocus),weight:Gk},{primary:3,kbExpr:m.and(Q.Visible,z.textInputFocus,Q.AcceptSuggestionsOnEnter,Q.MakesTextEdit),weight:Gk}],menuOpts:[{menuId:tw,title:V(1515,`Insert`),group:`left`,order:1,when:m.and(Q.HasFocusedSuggestion,Q.HasInsertAndReplaceRange.toNegated())},{menuId:tw,title:V(1516,`Insert`),group:`left`,order:1,when:m.and(Q.HasFocusedSuggestion,Q.HasInsertAndReplaceRange,Q.InsertMode.isEqualTo(`insert`))},{menuId:tw,title:V(1517,`Replace`),group:`left`,order:1,when:m.and(Q.HasFocusedSuggestion,Q.HasInsertAndReplaceRange,Q.InsertMode.isEqualTo(`replace`))}]})),R(new Kk({id:`acceptAlternativeSelectedSuggestion`,precondition:m.and(Q.Visible,z.textInputFocus,Q.HasFocusedSuggestion),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:1027,secondary:[1026]},handler(e){e.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:tw,group:`left`,order:2,when:m.and(Q.HasFocusedSuggestion,Q.HasInsertAndReplaceRange,Q.InsertMode.isEqualTo(`insert`)),title:V(1518,`Replace`)},{menuId:tw,group:`left`,order:2,when:m.and(Q.HasFocusedSuggestion,Q.HasInsertAndReplaceRange,Q.InsertMode.isEqualTo(`replace`)),title:V(1519,`Insert`)}]})),jn.registerCommandAlias(`acceptSelectedSuggestionOnEnter`,`acceptSelectedSuggestion`),R(new Kk({id:`hideSuggestWidget`,precondition:Q.Visible,handler:e=>e.cancelSuggestWidget(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:9,secondary:[1033]}})),R(new Kk({id:`selectNextSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectNextSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:tw,group:`left`,order:0,when:Q.HasFocusedSuggestion.toNegated(),title:V(1520,`Select`)}})),R(new Kk({id:`selectNextPageSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectNextPageSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:12,secondary:[2060]}})),R(new Kk({id:`selectLastSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectLastSuggestion()})),R(new Kk({id:`selectPrevSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectPrevSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),R(new Kk({id:`selectPrevPageSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectPrevPageSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:11,secondary:[2059]}})),R(new Kk({id:`selectFirstSuggestion`,precondition:m.and(Q.Visible,m.or(Q.MultipleSuggestions,Q.HasFocusedSuggestion.negate())),handler:e=>e.selectFirstSuggestion()})),R(new Kk({id:`focusSuggestion`,precondition:m.and(Q.Visible,Q.HasFocusedSuggestion.negate()),handler:e=>e.focusSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),R(new Kk({id:`focusAndAcceptSuggestion`,precondition:m.and(Q.Visible,Q.HasFocusedSuggestion.negate()),handler:e=>{e.focusSuggestion(),e.acceptSelectedSuggestion(!0,!1)}})),R(new Kk({id:`toggleSuggestionDetails`,precondition:m.and(Q.Visible,Q.HasFocusedSuggestion),handler:e=>e.toggleSuggestionDetails(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:tw,group:`right`,order:1,when:m.and(Q.DetailsVisible,Q.CanResolve),title:V(1521,`Show Less`)},{menuId:tw,group:`right`,order:1,when:m.and(Q.DetailsVisible.toNegated(),Q.CanResolve),title:V(1522,`Show More`)}]})),R(new Kk({id:`toggleExplainMode`,precondition:Q.Visible,handler:e=>e.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),R(new Kk({id:`toggleSuggestionFocus`,precondition:Q.Visible,handler:e=>e.toggleSuggestionFocus(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:2570,mac:{primary:778}}})),R(new Kk({id:`insertBestCompletion`,precondition:m.and(z.textInputFocus,m.equals(`config.editor.tabCompletion`,`on`),KO.AtEnd,Q.Visible.toNegated(),XO.OtherSuggestions.toNegated(),uE.InSnippetMode.toNegated()),handler:(e,t)=>{e.triggerSuggestAndAcceptBest(Il(t)?{fallback:`tab`,...t}:{fallback:`tab`})},kbOpts:{weight:Gk,primary:2}})),R(new Kk({id:`insertNextSuggestion`,precondition:m.and(z.textInputFocus,m.equals(`config.editor.tabCompletion`,`on`),XO.OtherSuggestions,Q.Visible.toNegated(),uE.InSnippetMode.toNegated()),handler:e=>e.acceptNextSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:2}})),R(new Kk({id:`insertPrevSuggestion`,precondition:m.and(z.textInputFocus,m.equals(`config.editor.tabCompletion`,`on`),XO.OtherSuggestions,Q.Visible.toNegated(),uE.InSnippetMode.toNegated()),handler:e=>e.acceptPrevSuggestion(),kbOpts:{weight:Gk,kbExpr:z.textInputFocus,primary:1026}})),R(new class extends mt{constructor(){super({id:`suggestWidgetCopy`,precondition:Q.DetailsFocused,kbOpts:{weight:200,kbExpr:Q.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(e,t){_a(t.getDomNode()).document.execCommand(`copy`)}}),O(class extends N{constructor(){super({id:`editor.action.resetSuggestSize`,label:J(1524,`Reset Suggest Widget Size`),precondition:void 0})}run(e,t){Hk.get(t)?.resetWidgetSize()}});var qk=class extends j{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,n){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=n,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new U),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(e=>{e.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(e=>{e.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));let r=Hk.get(this.editor);if(r){this._register(r.registerSelector({priority:100,select:(e,t,n)=>{let i=this.editor.getModel();if(!i)return-1;let a=this.suggestControllerPreselector(),o=a?NE(a,i):void 0;if(!o)return-1;let s=M.lift(t),c=ju(n.map((e,t)=>{let n=NE(Jk.fromSuggestion(r,i,s,e,this.isShiftKeyPressed).getSingleTextEdit(),i);return{index:t,valid:PE(o,n),prefixLength:n.text.length,suggestItem:e}}).filter(e=>e&&e.valid&&e.prefixLength>0),fs(e=>e.prefixLength,Ee));return c?c.index:-1}}));let e=!1,t=()=>{e||(e=!0,this._register(r.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(r.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(r.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(Du.once(r.model.onDidTrigger)(e=>{t()})),this._register(r.onWillInsertSuggestItem(e=>{let t=this.editor.getPosition(),n=this.editor.getModel();if(!t||!n)return;let i=Jk.fromSuggestion(r,n,t,e.item,this.isShiftKeyPressed);this.onWillAccept(i)}))}this.update(this._isActive)}update(e){let t=this.getSuggestItemInfo();(this._isActive!==e||!Yk(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){let e=Hk.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;let t=e.widget.value.getFocusedItem(),n=this.editor.getPosition(),r=this.editor.getModel();if(!(!t||!n||!r))return Jk.fromSuggestion(e,r,n,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Hk.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Hk.get(this.editor)?.forceRenderingAbove()}},Jk=class e{static fromSuggestion(t,n,r,i,a){let{insertText:o}=i.completion,s=!1;if(i.completion.insertTextRules&4){let e=new yf().parse(o);e.children.length<100&&aE.adjustWhitespace(n,r,!0,e),o=e.toString(),s=!0}let c=t.getOverwriteInfo(i,a);return new e(T.fromPositions(r.delta(0,-c.overwriteBefore),r.delta(0,Math.max(c.overwriteAfter,0))),o,i.completion.kind,s,i.container.incomplete??!1)}constructor(e,t,n,r,i){this.range=e,this.insertText=t,this.completionItemKind=n,this.isSnippetText=r,this.listIncomplete=i}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new xi(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new fc(this.range,this.insertText)}};function Yk(e,t){return e===t?!0:!e||!t?!1:e.equals(t)}var Xk=class extends j{constructor(e,t,n){super(),this._editorObs=e,this._handleSuggestAccepted=t,this._suggestControllerPreselector=n,this._suggestWidgetAdaptor=this._register(new qk(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),e=>this._editorObs.forceUpdate(t=>{this._handleSuggestAccepted(e)}))),this.selectedItem=$u(this,e=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(t=>e(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}},Zk=class{constructor(e,t){this.lineNumber=e,this.columnRange=t}},Qk=class{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Xs(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new T(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}toZeroBasedOffsetRange(){return new to(this.startColumn-1,this.endColumnExclusive-1)}},$k=class e{static fromLineTokens(t){let n=[];for(let e=0;e<t.getCount();e++)n.push(new eA(t.getTokenText(e),t.getMetadata(e)));return e.create(n)}static create(t){return new e(t)}constructor(e){this._tokenInfo=e}toLineTokens(e){return Ma.createFromTextAndMetadata(this.map((e,t)=>({text:t.text,metadata:t.metadata})),e)}map(e){let t=[],n=0;for(let r of this._tokenInfo){let i=new to(n,n+r.text.length);t.push(e(i,r)),n+=r.text.length}return t}slice(t){let n=[],r=0;for(let e of this._tokenInfo){let i=r,a=i+e.text.length;if(a>t.start){if(i>=t.endExclusive)break;let r=Math.max(0,t.start-i),o=Math.max(0,a-t.endExclusive);n.push(new eA(e.text.slice(r,e.text.length-o),e.metadata))}r+=e.text.length}return e.create(n)}append(t){let n=this._tokenInfo.concat(t._tokenInfo);return e.create(n)}},eA=class{constructor(e,t){this.text=e,this.metadata=t}},tA=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},nA=function(e,t){return function(n,r){t(n,r,e)}},rA=class e{static from(t){if(t)return new e(t.icon)}constructor(e=D.warning){this.icon=e}},iA=`ghost-text`,aA=class extends j{constructor(e,t,n,r){super(),this._editor=e,this._data=t,this._languageService=r,this._isDisposed=St(this,!1),this._warningState=L(e=>{let t=this._data.read(e),n=t?.warning;if(!t||!n)return;let r=t.ghostText;return{lineNumber:r.lineNumber,position:new M(r.lineNumber,r.parts[0].column),icon:n.icon}}),this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._nonWhitespaceCount=L(this,e=>{let t=this._data.read(e);if(t)return t.ghostText.parts.map(e=>e.lines.map(e=>e.line).join(``)).join(``).replace(/\s/g,``).length}),this._extraClassNames=L(this,e=>{let t=this._extraClasses.slice();this._warningState.read(e)&&t.push(`warning`);let n=this._nonWhitespaceCount.read(e);return this._highlightShortText&&n&&n<3?t.push(`short-text`):this._useSyntaxHighlighting.read(e)&&t.push(`syntax-highlighted`),t.map(e=>` ${e}`).join(``)}),this._state=L(this,e=>{if(this._isDisposed.read(e))return;let t=this._data.read(e);if(!t)return;let n=this._editorObs.model.read(e);if(!n)return;let r=t.ghostText,i=r instanceof AE?r.columnRange:void 0,a=this._useSyntaxHighlighting.read(e),{inlineTexts:o,additionalLines:s,hiddenRange:c,additionalLinesOriginalSuffix:l}=sA(r,n,iA+this._extraClassNames.read(e)),u=n.getLineContent(r.lineNumber),d=new $a(o.map(e=>ec.insert(e.column-1,e.text))),f=a?n.tokenization.tokenizeLinesAt(r.lineNumber,[d.apply(u),...s.map(e=>e.content)]):void 0,p=d.getNewRanges(),m=o.map((e,t)=>({...e,tokens:f?.[0]?.getTokensInRange(p[t])})),h=s.map((e,t)=>{let r=f?.[t+1]??Ma.createEmpty(e.content,this._languageService.languageIdCodec);if(t===s.length-1&&l){let e=$k.fromLineTokens(n.tokenization.getLineTokens(l.lineNumber)).slice(l.columnRange.toZeroBasedOffsetRange());r=$k.fromLineTokens(r).append(e).toLineTokens(r.languageIdCodec)}return new dA(r,e.decorations)}),g=this._editor.getSelection()?.getStartPosition().column,_=m.filter(e=>e.text!==``),v=_.length!==0,y=new OD((v?_[0].column:1)-g,v?0:s.findIndex(e=>e.content!==``)+1,+!!v,s.length+ +!!v,0,Je(_.map(e=>e.text.length))+Je(h.map(e=>e.content.getTextLength())),_.length+ +(s.length>0),_.length>1&&h.length===0?_.every(e=>e.text===_[0].text):void 0);return{replacedRange:i,inlineTexts:m,additionalLines:h,hiddenRange:c,lineNumber:r.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(e),targetTextModel:n,syntaxHighlightingEnabled:a,telemetryViewData:y,handleInlineCompletionShown:t.handleInlineCompletionShown}}),this._decorations=L(this,e=>{let t=this._state.read(e);if(!t)return[];let n=[],r=this._extraClassNames.read(e);t.replacedRange&&n.push({range:t.replacedRange.toRange(t.lineNumber),options:{inlineClassName:`inline-completion-text-to-replace`+r,description:`GhostTextReplacement`}}),t.hiddenRange&&n.push({range:t.hiddenRange.toRange(t.lineNumber),options:{inlineClassName:`ghost-text-hidden`,description:`ghost-text-hidden`}});for(let e of t.inlineTexts){let i=``;this._highlightShortText&&e.text.length<5&&(i+=` short-text`),n.push({range:T.fromPositions(new M(t.lineNumber,e.column)),options:{description:`ghost-text-decoration`,after:{content:e.text,tokens:e.tokens,inlineClassName:(e.preview?`ghost-text-decoration-preview`:`ghost-text-decoration`)+(this._isClickable?` clickable`:``)+r+i+e.lineDecorations.map(e=>` `+e.className).join(` `),cursorStops:we.Left,attachedData:new oA(this)},showIfCollapsed:!0}})}return n}),this.isHovered=L(this,e=>this._isDisposed.read(e)?!1:this._isInlineTextHovered.read(e)||this._additionalLinesWidget.isHovered.read(e)),this.height=L(this,e=>this._editorObs.getOption(75).read(e)+(this._additionalLinesWidget.viewZoneHeight.read(e)??0)),this._extraClasses=n.extraClasses??[],this._isClickable=n.isClickable??!1,this._shouldKeepCursorStable=n.shouldKeepCursorStable??!1,this._minReservedLineCount=n.minReservedLineCount??pc(0),this._useSyntaxHighlighting=n.useSyntaxHighlighting??pc(!0),this._highlightShortText=n.highlightShortSuggestions??!1,this._editorObs=lu(this._editor),this._additionalLinesWidget=this._register(new lA(this._editor,gr({owner:this,equalsFn:Pa(ro())},e=>{let t=this._state.read(e);return t?new cA(t.lineNumber,t.additionalLines,t.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(e=>e.target.type===6&&e.target.detail.injectedText?.options.attachedData instanceof oA&&e.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(bn(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(e=>this._onDidClick.fire(e))),this._register(this._editor.onMouseUp(e=>{if(e.target.type!==6)return;let t=e.target.detail.injectedText?.options.attachedData;t instanceof oA&&t.owner===this&&this._onDidClick.fire(e.event)}))),this._register(k(e=>{let t=this._state.read(e);t?.handleInlineCompletionShown(t.telemetryViewData)})),this._register(Ht((e,t)=>{}))}static getWarningWidgetContext(e){let t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}};aA=tA([nA(3,Zo)],aA);var oA=class{constructor(e){this.owner=e}};function sA(e,t,n){let r=[],i=[];function a(e,t){if(i.length>0){let n=i[i.length-1];t&&n.decorations.push(new Gn(n.content.length+1,n.content.length+1+e[0].line.length,t,0)),n.content+=e[0].line,e=e.slice(1)}for(let n of e)i.push({content:n.line,decorations:t?[new Gn(1,n.line.length+1,t,0),...n.lineDecorations]:[...n.lineDecorations]})}let o=t.getLineContent(e.lineNumber),s,c=0;for(let t of e.parts){let e=t.lines;s===void 0?(r.push({column:t.column,text:e[0].line,preview:t.preview,lineDecorations:e[0].lineDecorations}),e=e.slice(1)):a([{line:o.substring(c,t.column-1),lineDecorations:[]}],void 0),e.length>0&&(a(e,n),s===void 0&&t.column<=o.length&&(s=t.column)),c=t.column-1}let l;return s!==void 0&&(l=new Zk(e.lineNumber,new Qk(c+1,o.length+1))),{inlineTexts:r,additionalLines:i,hiddenRange:s===void 0?void 0:new Qk(s,o.length+1),additionalLinesOriginalSuffix:l}}var cA=class{constructor(e,t,n){this.lineNumber=e,this.additionalLines=t,this.minReservedLineCount=n}equals(e){return this.lineNumber!==e.lineNumber||this.minReservedLineCount!==e.minReservedLineCount?!1:pu(this.additionalLines,e.additionalLines,ro())}},lA=class extends j{get viewZoneId(){return this._viewZoneInfo?.viewZoneId}get viewZoneHeight(){return this._viewZoneHeight}constructor(e,t,n,r){super(),this._editor=e,this._lines=t,this._shouldKeepCursorStable=n,this._isClickable=r,this._viewZoneHeight=St(`viewZoneHeight`,void 0),this.editorOptionsChanged=Ne(`editorOptionChanged`,Du.filter(this._editor.onDidChangeConfiguration,e=>e.hasChanged(40)||e.hasChanged(133)||e.hasChanged(113)||e.hasChanged(108)||e.hasChanged(60)||e.hasChanged(59)||e.hasChanged(75))),this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new Ae),this.isHovered=lu(this._editor).isTargetHovered(e=>uA(e.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof ls&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(e=>this.hasBeenAccepted=e.source===`inlineSuggestion.accept`)),this._register(k(e=>{let t=this._lines.read(e);this.editorOptionsChanged.read(e),t?(this.hasBeenAccepted=!1,this.updateLines(t.lineNumber,t.additionalLines,t.minReservedLineCount)):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(e=>{this.removeActiveViewZone(e)})}updateLines(e,t,n){let r=this._editor.getModel();if(!r)return;let{tabSize:i}=r.getOptions();lu(this._editor).transaction(r=>{this._editor.changeViewZones(r=>{let a=new S;this.removeActiveViewZone(r);let o=Math.max(t.length,n);if(o>0){let n=document.createElement(`div`);fA(n,i,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(a.add(K(n,`mousedown`,e=>{e.preventDefault()})),a.add(K(n,`click`,e=>{uA(e.target)&&this._onDidClick.fire(new Ze(_a(e),e))}))),this.addViewZone(r,e,o,n)}this._viewZoneListener.value=a})})}addViewZone(e,t,n,r){let i=e.addZone({afterLineNumber:t,heightInLines:n,domNode:r,afterColumnAffinity:1,onComputedHeight:e=>{this._viewZoneHeight.set(e,void 0)}});this.keepCursorStable(t,n),this._viewZoneInfo={viewZoneId:i,heightInLines:n,lineNumber:t}}removeActiveViewZone(e){this._viewZoneInfo&&(e.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(e,t){if(!this._shouldKeepCursorStable)return;let n=this._editor.getSelection()?.getStartPosition()?.lineNumber;n!==void 0&&e<n&&this._editor.setScrollTop(this._editor.getScrollTop()+t*this._editor.getOption(75))}};function uA(e){return Br(e)&&e.classList.contains(iA)}var dA=class{constructor(e,t){this.content=e,this.decorations=t}equals(e){return this.content.equals(e.content)?Gn.equalsArr(this.decorations,e.decorations):!1}};function fA(e,n,r,i,a){let o=i.get(40),s=i.get(133),c=i.get(108),l=i.get(60),u=i.get(59),d=i.get(75),f=`suggest-preview-text`;a&&(f+=` clickable`);let p=new du(1e4);p.appendString(`<div class="${f}">`);for(let e=0,t=r.length;e<t;e++){let t=r[e],i=t.content;p.appendString(`<div class="view-line`),p.appendString(`" style="top:`),p.appendString(String(e*d)),p.appendString(`px;width:1000000px;">`);let a=i.getLineContent(),f=cl(a),m=wi(a);je(new Ve(u.isMonospace&&!o,u.canUseHalfwidthRightwardsArrow,a,!1,f,m,0,i,t.decorations.slice(),n,0,u.spaceWidth,u.middotWidth,u.wsmiddotWidth,s,`none`,c,l!==st.OFF,null,null,0),p),p.appendString(`</div>`)}p.appendString(`</div>`),t(e,u);let m=p.build();e.innerHTML=pA?pA.createHTML(m):m}var pA=_s(`editorGhostText`,{createHTML:e=>e}),mA=class e{constructor(e,t){this.width=e,this.height=t}toString(){return`(${this.width},${this.height})`}transpose(){return new e(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}},hA=class e{static fromPoints(t,n){return new e(t.x,t.y,n.x,n.y)}static fromPointSize(t,n){return new e(t.x,t.y,t.x+n.x,t.y+n.y)}static fromLeftTopRightBottom(t,n,r,i){return new e(t,n,r,i)}static fromLeftTopWidthHeight(t,n,r,i){return new e(t,n,t+r,n+i)}static fromRanges(t,n){return new e(t.start,n.start,t.endExclusive,n.endExclusive)}static hull(t){let n=2**53-1,r=2**53-1,i=-(2**53-1),a=-(2**53-1);for(let e of t)n=Math.min(n,e.left),r=Math.min(r,e.top),i=Math.max(i,e.right),a=Math.max(a,e.bottom);return new e(n,r,i,a)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(e,t,n,r){if(this.left=e,this.top=t,this.right=n,this.bottom=r,e>n)throw new Xs(`Invalid arguments: Horizontally offset by `+(e-n));if(t>r)throw new Xs(`Invalid arguments: Vertically offset by `+(t-r))}withMargin(t,n,r,i){let a,o,s,c;return n===void 0&&r===void 0&&i===void 0?a=o=s=c=t:r===void 0&&i===void 0?(a=o=n,s=c=t):(a=i,o=n,s=t,c=r),new e(this.left-a,this.top-s,this.right+o,this.bottom+c)}intersectVertical(t){let n=Math.max(this.top,t.start),r=Math.min(this.bottom,t.endExclusive);return new e(this.left,n,this.right,Math.max(n,r))}intersectHorizontal(t){let n=Math.max(this.left,t.start),r=Math.min(this.right,t.endExclusive);return new e(n,this.top,Math.max(n,r),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(t){let n=Math.max(this.left,t.left),r=Math.min(this.right,t.right),i=Math.max(this.top,t.top),a=Math.min(this.bottom,t.bottom);if(!(n>r||i>a))return new e(n,i,r,a)}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(t){let n=this.width,r=this.height,i=this.left,a=this.top;return i<t.left?i=t.left:i+n>t.right&&(i=t.right-n),a<t.top?a=t.top:a+r>t.bottom&&(a=t.bottom-r),new e(i,a,i+n,a+r)}withWidth(t){return new e(this.left,this.top,this.left+t,this.bottom)}withHeight(t){return new e(this.left,this.top,this.right,this.top+t)}withTop(t){return new e(this.left,t,this.right,this.bottom)}withLeft(t){return new e(t,this.top,this.right,this.bottom)}translateX(t){return new e(this.left+t,this.top,this.right+t,this.bottom)}translateY(t){return new e(this.left,this.top+t,this.right,this.bottom+t)}getLeftBottom(){return new Hu(this.left,this.bottom)}getRightBottom(){return new Hu(this.right,this.bottom)}getRightTop(){return new Hu(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(t){return new e(t.start,this.top,t.endExclusive,this.bottom)}getSize(){return new mA(this.width,this.height)}},gA=class e{constructor(e,t,n,r=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=n,this.showEndForLine=r}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&pu(this.startLineNumbers,e.startLineNumbers)&&pu(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new e([],[],0)}},_A=_s(`stickyScrollViewLayer`,{createHTML:e=>e}),vA=`data-sticky-line-index`,yA=`data-sticky-is-line`,bA=`data-sticky-is-line-number`,xA=`data-sticky-is-folding-icon`,SA=class extends j{get height(){return this._height}constructor(e){super(),this._foldingIconStore=this._register(new S),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 U),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._editor=e,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`,e instanceof Av),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);let t=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:`0px`};this._register(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(131)&&t()})),this._register(this._editor.onDidScrollChange(e=>{e.scrollLeftChanged&&t(),e.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),t(),this._register(this._editor.onDidLayoutChange(e=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,n){let r=!this._state&&!e,i=this._state&&this._state.equals(e);if(n===void 0&&(r||i))return;let a=this._findRenderingData(e),o=this._lineNumbers;this._lineNumbers=a.lineNumbers,this._lastLineRelativePosition=a.lastLineRelativePosition;let s=this._findIndexToRebuildFrom(o,this._lineNumbers,n);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,t,s),this._state=e}_findRenderingData(e){if(!e)return{lineNumbers:[],lastLineRelativePosition:0};let t=[...e.startLineNumbers];e.showEndForLine!==null&&(t[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]);let n=0;for(let e=0;e<t.length;e++)n+=this._editor.getLineHeightForPosition(new M(t[e],1));return n===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:t,lastLineRelativePosition:e.lastLineRelativePosition}}_findIndexToRebuildFrom(e,t,n){if(t.length===0)return 0;if(n!==void 0)return n;let r=t.findIndex(t=>!e.includes(t));return r===-1?0:r}_updateWidgetWidth(){let e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty(`--vscode-editorStickyScroll-scrollableWidth`,`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty(`--vscode-editorStickyScroll-foldingOpacityTransition`,`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(let t of this._renderedStickyLines){let n=t.foldingIcon;n&&n.setVisible(e?!0:n.isCollapsed)}}async _renderRootNode(e,t,n,r){let i=this._editor._getViewModel();if(!i){this._clearWidget();return}if(e.length===0){this._clearWidget();return}let a=[],o=e[e.length-1],s=0;for(let e=0;e<this._renderedStickyLines.length;e++)if(e<r){let t=this._renderedStickyLines[e];a.push(this._updatePosition(t,s,t.lineNumber===o)),s+=t.height}else{let t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}let c=this._editor.getLayoutInfo();for(let t=r;t<e.length;t++){let r=this._renderChildNode(i,t,e[t],s,o===e[t],n,c);s+=r.height,this._linesDomNode.appendChild(r.lineDomNode),this._lineNumbersDomNode.appendChild(r.lineNumberDomNode),a.push(r)}n&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(e=>e.scrollWidth))+c.verticalScrollbarWidth,this._renderedStickyLines=a,this._setHeight(s+t),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let e=0;e<this._renderedStickyLines.length;e++){let t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}this._setHeight(0)}_setHeight(e){this._height!==e&&(this._height=e,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(K(this._lineNumbersDomNode,pr.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(K(this._lineNumbersDomNode,pr.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,n,r,i,a,o){let s=new CA(this._editor,e,o,a,this._isOnGlyphMargin,t,n);return this._updatePosition(s,r,i)}_updatePosition(e,t,n){let r=e.lineDomNode,i=e.lineNumberDomNode;if(n){r.style.zIndex=`0`,i.style.zIndex=`0`;let n=`${t+this._lastLineRelativePosition+ +!!e.foldingIcon?.isCollapsed}px`;r.style.top=n,i.style.top=n}else r.style.zIndex=`1`,i.style.zIndex=`1`,r.style.top=`${t}px`,i.style.top=`${t}px`;return e}getId(){return`editor.contrib.stickyScrollWidget`}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;let t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;let n=ye(t.characterMapping,e,0);return new M(t.lineNumber,n)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){let t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){let t=this._getAttributeValue(e,vA);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,yA)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,xA)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){let n=e.getAttribute(t);if(n!==null)return n;e=e.parentElement}}},CA=class{constructor(e,t,n,r,i,a,o){this.index=a,this.lineNumber=o;let s=t.coordinatesConverter.convertModelPositionToViewPosition(new M(o,1)).lineNumber,c=t.getViewLineRenderingData(s),l=e.getOption(76),u=e.getOption(117).verticalScrollbarSize,d;try{d=Gn.filter(c.inlineDecorations,s,c.minColumn,c.maxColumn)}catch{d=[]}let f=e.getLineHeightForPosition(new M(o,1)),p=t.getTextDirection(o),m=new Ve(!0,!0,c.content,c.continuesWithWrappedLine,c.isBasicASCII,c.containsRTL,0,c.tokens,d,c.tabSize,c.startVisibleColumn,1,1,1,500,`none`,!0,!0,null,p,u),h=new du(2e3),g=je(m,h);this.characterMapping=g.characterMapping;let _;_=_A?_A.createHTML(h.build()):h.build();let v=document.createElement(`span`);v.setAttribute(vA,String(a)),v.setAttribute(yA,``),v.setAttribute(`role`,`listitem`),v.tabIndex=0,v.className=`sticky-line-content`,v.classList.add(`stickyLine${o}`),v.style.lineHeight=`${f}px`,v.innerHTML=_;let y=document.createElement(`span`);y.setAttribute(vA,String(a)),y.setAttribute(bA,``),y.className=`sticky-line-number`,y.style.lineHeight=`${f}px`;let b=n.contentLeft;y.style.width=`${b}px`;let ee=document.createElement(`span`);l.renderType===1||l.renderType===3&&o%10==0?ee.innerText=o.toString():l.renderType===2&&(ee.innerText=Math.abs(o-e.getPosition().lineNumber).toString()),ee.className=`sticky-line-number-inner`,ee.style.width=`${n.lineNumbersWidth}px`,ee.style.paddingLeft=`${n.lineNumbersLeft}px`,y.appendChild(ee),this.foldingIcon=this._renderFoldingIconForLine(e,r,o,f,i),this.foldingIcon&&(y.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${n.lineNumbersWidth+n.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${f}px`),e.applyFontInfo(v),e.applyFontInfo(y),y.style.lineHeight=`${f}px`,v.style.lineHeight=`${f}px`,y.style.height=`${f}px`,v.style.height=`${f}px`,this.scrollWidth=v.scrollWidth,this.lineDomNode=v,this.lineNumberDomNode=y,this.height=f}_renderFoldingIconForLine(e,t,n,r,i){let a=e.getOption(126);if(!t||a===`never`)return;let o=t.regions,s=o.findRange(n),c=o.getStartLineNumber(s);if(n!==c)return;let l=o.isCollapsed(s),u=new wA(l,c,o.getEndLineNumber(s),r);return u.setVisible(i?!0:l||a===`always`),u.domNode.setAttribute(xA,``),u}},wA=class{constructor(e,t,n,r){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=n,this.dimension=r,this.domNode=document.createElement(`div`),this.domNode.style.width=`26px`,this.domNode.style.height=`${r}px`,this.domNode.style.lineHeight=`${r}px`,this.domNode.className=C.asClassName(e?TS:wS)}setVisible(e){this.domNode.style.cursor=e?`pointer`:`default`,this.domNode.style.opacity=e?`1`:`0`}},TA=class{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}},EA=class{constructor(e,t,n){this.range=e,this.children=t,this.parent=n}},DA=class{constructor(e,t,n,r){this.uri=e,this.version=t,this.element=n,this.outlineProviderId=r}},OA=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},kA=function(e,t){return function(n,r){t(n,r,e)}},AA;(function(e){e.OUTLINE_MODEL=`outlineModel`,e.FOLDING_PROVIDER_MODEL=`foldingProviderModel`,e.INDENTATION_MODEL=`indentationModel`})(AA||={});var jA;(function(e){e[e.VALID=0]=`VALID`,e[e.INVALID=1]=`INVALID`,e[e.CANCELED=2]=`CANCELED`})(jA||={});var MA=class extends j{constructor(e,t,n,r){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new kc(300)),this._updateOperation=this._register(new S),this._editor.getOption(131).defaultModel){case AA.OUTLINE_MODEL:this._modelProviders.push(new PA(this._editor,r));case AA.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new LA(this._editor,t,r));case AA.INDENTATION_MODEL:this._modelProviders.push(new IA(this._editor,n));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&=(this._modelPromise.cancel(),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(let t of this._modelProviders){let{statusPromise:n,modelPromise:r}=t.computeStickyModel(e);this._modelPromise=r;let i=await n;if(this._modelPromise!==r)return null;switch(i){case jA.CANCELED:return this._updateOperation.clear(),null;case jA.VALID:return t.stickyModel}}return null}).catch(e=>(Hc(e),null))}};MA=OA([kA(2,w),kA(3,q)],MA);var NA=class extends j{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,jA.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};let t=ql(e=>this.createModelFromProvider(e));return{statusPromise:t.then(t=>this.isModelValid(t)?e.isCancellationRequested?jA.CANCELED:(this._stickyModel=this.createStickyModel(e,t),jA.VALID):this._invalid()).then(void 0,e=>(Hc(e),jA.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}},PA=class extends NA{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return DC.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){let{stickyOutlineElement:n,providerID:r}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),i=this._editor.getModel();return new DA(i.uri,i.getVersionId(),n,r)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let n;if(Mn.first(e.children.values())instanceof EC){let r=Mn.find(e.children.values(),e=>e.id===t);if(r)n=r.children;else{let r=``,i=-1,a;for(let[t,n]of e.children.entries()){let e=this._findSumOfRangesOfGroup(n);e>i&&(a=n,i=e,r=n.id)}t=r,n=a.children}}else n=e.children;let r=[],i=Array.from(n.values()).sort((e,t)=>{let n=new TA(e.symbol.range.startLineNumber,e.symbol.range.endLineNumber),r=new TA(t.symbol.range.startLineNumber,t.symbol.range.endLineNumber);return this._comparator(n,r)});for(let e of i)r.push(this._stickyModelFromOutlineElement(e,e.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new EA(void 0,r,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){let n=[];for(let r of e.children.values())if(r.symbol.selectionRange.startLineNumber!==r.symbol.range.endLineNumber)if(r.symbol.selectionRange.startLineNumber!==t)n.push(this._stickyModelFromOutlineElement(r,r.symbol.selectionRange.startLineNumber));else for(let e of r.children.values())n.push(this._stickyModelFromOutlineElement(e,r.symbol.selectionRange.startLineNumber));return n.sort((e,t)=>this._comparator(e.range,t.range)),new EA(new TA(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber),n,void 0)}_comparator(e,t){return e.startLineNumber===t.startLineNumber?t.endLineNumber-e.endLineNumber:e.startLineNumber-t.startLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(let n of e.children.values())t+=this._findSumOfRangesOfGroup(n);return e instanceof TC?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};PA=OA([kA(1,q)],PA);var FA=class extends NA{constructor(e){super(e),this._foldingLimitReporter=this._register(new US(e))}createStickyModel(e,t){let n=this._fromFoldingRegions(t),r=this._editor.getModel();return new DA(r.uri,r.getVersionId(),n,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){let t=e.length,n=[],r=new EA(void 0,[],void 0);for(let i=0;i<t;i++){let t=e.getParentIndex(i),a;a=t===-1?r:n[t];let o=new EA(new TA(e.getStartLineNumber(i),e.getEndLineNumber(i)+1),[],a);a.children.push(o),n.push(o)}return r}},IA=class extends FA{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new yS(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};IA=OA([kA(1,eu)],IA);var LA=class extends FA{constructor(e,t,n){super(e),this._languageFeaturesService=n,this.provider=this._register(new Ae),this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){let n=HS.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());n.length!==0&&(this.provider.value=new PS(e.getModel(),n,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};LA=OA([kA(2,q)],LA);var RA=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},zA=function(e,t){return function(n,r){t(n,r,e)}},BA=class{constructor(e,t,n,r){this.startLineNumber=e,this.endLineNumber=t,this.top=n,this.height=r}},VA=class extends j{constructor(e,t,n){super(),this._languageFeaturesService=t,this._languageConfigurationService=n,this._onDidChangeStickyScroll=this._register(new U),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new S),this._updateSoon=this._register(new Cl(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(e=>{e.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(bn(()=>{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 MA(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new ou,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}let t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];let t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,n,r,i,a){let o=this._editor.getModel();if(!o||t.children.length===0)return;let s=a,c=[];for(let e=0;e<t.children.length;e++){let n=t.children[e];n.range&&c.push(n.range.startLineNumber)}let l=this.updateIndex(go(c,e.startLineNumber,(e,t)=>e-t)),u=this.updateIndex(go(c,e.endLineNumber,(e,t)=>e-t));for(let a=l;a<=u;a++){let c=t.children[a];if(!c||!c.range)continue;let{startLineNumber:l,endLineNumber:u}=c.range;if(u>l+1&&e.startLineNumber<=u+1&&l-1<=e.endLineNumber&&l!==s&&o.isValidRange(new T(l,1,u,1))){s=l;let t=this._editor.getLineHeightForPosition(new M(l,1));n.push(new BA(l,u-1,i,t)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,c,n,r+1,i+t,l)}}}filterHiddenRanges(e){let t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(e=>!t.some(t=>e.startLineNumber>=t.startLineNumber&&e.endLineNumber<=t.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};VA=RA([zA(1,q),zA(2,eu)],VA);var HA=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UA=function(e,t){return function(n,r){t(n,r,e)}},WA,GA=class extends j{static{WA=this}static{this.ID=`store.contrib.stickyScrollController`}constructor(e,t,n,r,i,a,o){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=n,this._instaService=r,this._contextKeyService=o,this._sessionStore=new S,this._maxStickyLines=2**53-1,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 U),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._stickyScrollWidget=new SA(this._editor),this._stickyLineCandidateProvider=new VA(this._editor,n,i),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=gA.Empty;let s=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(e=>{e.changes.forEach(e=>{let t=e.lineNumber;this._widgetState.startLineNumbers.includes(t)&&this._renderStickyScroll(t)})})),this._register(this._editor.onDidChangeFont(e=>{e.changes.forEach(e=>{let t=e.lineNumber;this._widgetState.startLineNumbers.includes(t)&&this._renderStickyScroll(t)})})),this._register(this._editor.onDidChangeConfiguration(e=>{this._readConfigurationChange(e)})),this._register(K(s,pr.CONTEXT_MENU,async e=>{this._onContextMenu(_a(s),e)})),this._stickyScrollFocusedContextKey=z.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=z.stickyScrollVisible.bindTo(this._contextKeyService);let c=this._register(Os(s));this._register(c.onDidBlur(e=>{this._positionRevealed===!1&&s.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(c.onDidFocus(e=>{this.focus()})),this._registerMouseListeners(),this._register(K(s,pr.MOUSE_DOWN,e=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(e=>{this._onDidChangeStickyScrollHeight.fire(e)})),this._onDidResize(),this._readConfiguration()}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(WA.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 S,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(){let 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(T.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){let e=this._register(new S),t=this._register(new Cv(this._editor,{extractLineNumberFromMouseEvent:e=>{let t=this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);return t?t.lineNumber:0}})),n=e=>{if(!this._editor.hasModel()||e.target.type!==12||e.target.detail!==this._stickyScrollWidget.getId())return null;let t=e.target.element;if(!t||t.innerText!==t.innerHTML)return null;let n=this._stickyScrollWidget.getEditorPositionFromNode(t);return n?{range:new T(n.lineNumber,n.column,n.lineNumber,n.column+t.innerText.length),textElement:t}:null},r=this._stickyScrollWidget.getDomNode();this._register(vs(r,pr.CLICK,e=>{if(e.ctrlKey||e.altKey||e.metaKey||!e.leftButton)return;if(e.shiftKey){let t=this._stickyScrollWidget.getLineIndexFromChildDomNode(e.target);if(t===null)return;let n=new M(this._endLineNumbers[t],1);this._revealLineInCenterIfOutsideViewport(n);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(e.target)){let t=this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);this._toggleFoldingRegionForLine(t);return}if(!this._stickyScrollWidget.isInStickyLine(e.target))return;let t=this._stickyScrollWidget.getEditorPositionFromNode(e.target);if(!t){let n=this._stickyScrollWidget.getLineNumberFromChildDomNode(e.target);if(n===null)return;t=new M(n,1)}this._revealPosition(t)})),this._register(K(Go,pr.MOUSE_MOVE,e=>{this._mouseTarget=e.target,this._onMouseMoveOrKeyDown(e)})),this._register(K(Go,pr.KEY_DOWN,e=>{this._onMouseMoveOrKeyDown(e)})),this._register(K(Go,pr.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([t,r])=>{let i=n(t);if(!i||!t.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}let{range:a,textElement:o}=i;if(!a.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=a,e.clear();else if(o.style.textDecoration===`underline`)return;let s=new ou;e.add(bn(()=>s.dispose(!0)));let c;Fy(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new M(a.startLineNumber,a.startColumn+1),!1,s.token).then((t=>{if(!s.token.isCancellationRequested)if(t.length!==0){this._candidateDefinitionsLength=t.length;let n=o;c===n?c||(c=n,c.style.textDecoration=`underline`,e.add(bn(()=>{c.style.textDecoration=`none`}))):(e.clear(),c=n,c.style.textDecoration=`underline`,e.add(bn(()=>{c.style.textDecoration=`none`})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async e=>{if(e.target.type!==12||e.target.detail!==this._stickyScrollWidget.getId())return;let t=this._stickyScrollWidget.getEditorPositionFromNode(e.target.element);t&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:t.lineNumber,column:1})),this._instaService.invokeFunction(Xy,e,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){let n=new Ze(e,t);this._contextMenuService.showContextMenu({menuId:Z.StickyScrollContext,getAnchor:()=>n,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!Br(this._mouseTarget))return;let t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;let t=this._stickyScrollWidget.getRenderedStickyLine(e),n=t?.foldingIcon;if(!n)return;rS(this._foldingModel,1,[e]),n.isCollapsed=!n.isCollapsed;let r=(n.isCollapsed?this._editor.getTopForLineNumber(n.foldingEndLine):this._editor.getTopForLineNumber(n.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(r),this._renderStickyScroll(e)}_readConfiguration(){let 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(e=>{e.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(e=>this._onTokensChange(e))),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(e=>{this._positionLineNumber!==e.position.lineNumber&&(this._positionLineNumber=e.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0))}),this._sessionStore.add(this._cursorPositionListener)):this._cursorPositionListener&&=(this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),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))&&this._renderStickyScroll(0)}_needsUpdate(e){let t=this._stickyScrollWidget.getCurrentLines();for(let n of t)for(let t of e.ranges)if(n>=t.fromLineNumber&&n<=t.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){let e=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(e*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){let t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}let n=this._updateAndGetMinRebuildFromLine(e),r=this._stickyLineCandidateProvider.getVersionId();if(r===void 0||r===t.getVersionId())if(!this._focused)await this._updateState(n);else if(this._focusedStickyElementIndex===-1)await this._updateState(n),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{let e=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(n),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(e)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){let t=this._minRebuildFromLine===void 0?1/0:this._minRebuildFromLine;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await HS.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();let 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=gA.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){let e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop(),n=0,r=[],i=[],a=this._editor.getVisibleRanges();if(a.length!==0){let o=new TA(a[0].startLineNumber,a[a.length-1].endLineNumber),s=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(o);for(let a of s){let o=a.startLineNumber,s=a.endLineNumber,c=a.top,l=c+a.height,u=this._editor.getTopForLineNumber(o)-t,d=this._editor.getBottomForLineNumber(s)-t;if(c>u&&c<=d&&(r.push(o),i.push(s+1),l>d&&(n=d-l)),r.length===e)break}}return this._endLineNumbers=i,new gA(r,i,n,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};GA=WA=HA([UA(1,Au),UA(2,q),UA(3,w),UA(4,eu),UA(5,Sa),UA(6,G)],GA);var KA=E(`inlineEdit.originalBackground`,sn(Zi,.2),V(1266,`Background color for the original text in inline edits.`),!0),qA=E(`inlineEdit.modifiedBackground`,sn(tl,.3),V(1267,`Background color for the modified text in inline edits.`),!0);E(`inlineEdit.originalChangedLineBackground`,sn(Zi,.8),V(1268,`Background color for the changed lines in the original text of inline edits.`),!0);var JA=E(`inlineEdit.originalChangedTextBackground`,sn(Zi,.8),V(1269,`Overlay color for the changed text in the original text of inline edits.`),!0),YA=E(`inlineEdit.modifiedChangedLineBackground`,{light:sn(Vt,.7),dark:sn(Vt,.7),hcDark:Vt,hcLight:Vt},V(1270,`Background color for the changed lines in the modified text of inline edits.`),!0),XA=E(`inlineEdit.modifiedChangedTextBackground`,sn(tl,.7),V(1271,`Overlay color for the changed text in the modified text of inline edits.`),!0),ZA=E(`inlineEdit.gutterIndicator.primaryForeground`,Qe,V(1272,`Foreground color for the primary inline edit gutter indicator.`)),QA=E(`inlineEdit.gutterIndicator.primaryBorder`,rr,V(1273,`Border color for the primary inline edit gutter indicator.`)),$A=E(`inlineEdit.gutterIndicator.primaryBackground`,{light:sn(QA,.5),dark:sn(QA,.4),hcDark:sn(QA,.4),hcLight:sn(QA,.5)},V(1274,`Background color for the primary inline edit gutter indicator.`)),ej=E(`inlineEdit.gutterIndicator.secondaryForeground`,Ka,V(1275,`Foreground color for the secondary inline edit gutter indicator.`)),tj=E(`inlineEdit.gutterIndicator.secondaryBorder`,xl,V(1276,`Border color for the secondary inline edit gutter indicator.`)),nj=E(`inlineEdit.gutterIndicator.secondaryBackground`,Dc,V(1277,`Background color for the secondary inline edit gutter indicator.`)),rj=E(`inlineEdit.gutterIndicator.successfulForeground`,Qe,V(1278,`Foreground color for the successful inline edit gutter indicator.`)),ij=E(`inlineEdit.gutterIndicator.successfulBorder`,rr,V(1279,`Border color for the successful inline edit gutter indicator.`)),aj=E(`inlineEdit.gutterIndicator.successfulBackground`,ij,V(1280,`Background color for the successful inline edit gutter indicator.`)),oj=E(`inlineEdit.gutterIndicator.background`,{hcDark:sn(`tab.inactiveBackground`,.5),hcLight:sn(`tab.inactiveBackground`,.5),dark:sn(`tab.inactiveBackground`,.5),light:`#5f5f5f18`},V(1281,`Background color for the inline edit gutter indicator.`)),sj=E(`inlineEdit.originalBorder`,{light:Zi,dark:Zi,hcDark:Zi,hcLight:Zi},V(1282,`Border color for the original text in inline edits.`)),cj=E(`inlineEdit.modifiedBorder`,{light:er(tl,.6),dark:tl,hcDark:tl,hcLight:tl},V(1283,`Border color for the modified text in inline edits.`)),lj=E(`inlineEdit.tabWillAcceptModifiedBorder`,{light:er(cj,0),dark:er(cj,0),hcDark:er(cj,0),hcLight:er(cj,0)},V(1284,`Modified border color for the inline edits widget when tab will accept it.`)),uj=E(`inlineEdit.tabWillAcceptOriginalBorder`,{light:er(sj,0),dark:er(sj,0),hcDark:er(sj,0),hcLight:er(sj,0)},V(1285,`Original border color for the inline edits widget over the original text when tab will accept it.`));function dj(e){return e.map(e=>e===ED.Accept?lj:cj)}function fj(e){return e.map(e=>e===ED.Accept?uj:sj)}function pj(e,t){let n;n=typeof e==`string`?hj(e,t):e.map((e,n)=>hj(e,t).read(n));let r=hj(sa,t);return n.map((e,t)=>e.makeOpaque(r.read(t)))}function mj(e){let t;switch(e){case FD.TextEditor:t=sa;break;case FD.DiffEditor:t=sa;break;case FD.Notebook:t=`notebook.cellEditorBackground`;break;default:wl(e,`Not supported editor type yet`)}return An(t)}function hj(e,t){return ce({owner:{observeColor:e},equalsFn:(e,t)=>e.equals(t),debugName:()=>`observeColor(${e})`},t.onDidColorThemeChange,()=>{let n=t.getColorTheme().getColor(e);if(!n)throw new Xs(`Missing color: ${e}`);return n})}function gj(e,t,n){let r=e.model.read(n);if(!r)return 0;let i=0;for(let r=t.startLineNumber;r<t.endLineNumberExclusive;r++){let t=e.getWidthOfLine(r,n);i=Math.max(i,t)}let a=t.mapToLineArray(e=>r.getLineContent(e));return i<5&&a.some(e=>e.length>0)&&r.uri.scheme!==`file`&&console.log(`unexpected width`),i}function _j(e,t,n){Ne(e,e.editor.onDidChangeLineHeight).read(n);let r=e.model.read(n);if(!r)throw new Xs(`Model is required`);let i=[];for(let a=t.startLineNumber;a<t.endLineNumberExclusive;a++){let t=e.getWidthOfLine(a,n);t===-1&&(t=r.getLineMaxColumn(a)*e.editor.getOption(59).typicalHalfwidthCharacterWidth);let o=e.editor.getLineHeightForPosition(new M(a,1));i.push(new mA(t,o))}return i}function vj(e,t,n){return e.layoutInfo.read(n),e.value.read(n),e.model.read(n)?(e.scrollTop.read(n),e.editor.getOffsetForColumn(t.lineNumber,t.column)):0}function yj(e,t,n,r,i=void 0){let a=r.getModel();if(!a)return{prefixTrim:0,prefixLeftOffset:0};let o=e.map(e=>e.isSingleLine()?e.startColumn-1:0),s=t.mapToLineArray(e=>Ha(a.getLineContent(e))),c=n.filter(e=>e!==``).map(e=>Ha(e)),l=Math.min(...o,...s,...c),u;if(a.getLineIndentColumn(t.startLineNumber)>=l+1)lu(r).scrollTop.read(i),u=r.getOffsetForColumn(t.startLineNumber,l+1);else if(n.length>0)u=bj(n[0].slice(0,l),r,a);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:l,prefixLeftOffset:u}}function bj(e,t,n){let r=t.getOption(59).typicalHalfwidthCharacterWidth,i=n.getOptions().tabSize*r,a=e.split(` `).length-1;return(e.length-a)*r+a*i}function xj(e){let t=e.layoutInfoContentLeft,n=L({name:`editor.validOverlay.width`},n=>{let r=e.layoutInfoMinimap.read(n).minimapLeft!==0,i=Math.max(0,e.layoutInfoWidth.read(n)-t.read(n));if(r){let t=e.layoutInfoMinimap.read(n).minimapWidth+e.layoutInfoVerticalScrollbarWidth.read(n);return Math.max(0,i-t)}return i}),r=L({name:`editor.validOverlay.height`},t=>e.layoutInfoHeight.read(t)+e.contentHeight.read(t));return L({name:`editor.validOverlay`},e=>hA.fromLeftTopWidthHeight(t.read(e),0,n.read(e),r.read(e)))}function Sj(e,t){let n=[];for(let r of e){let e=t.mapRange(r.modifiedRange);n.push(new fo(r.originalRange,e))}return n}function Cj(...e){return e.filter(e=>typeof e==`string`).join(` `)}function wj(e,t){return new T(t.lineNumber,t.column+e.start,t.lineNumber,t.column+e.endExclusive)}function Tj(e,t){let n=0;loop:for(let r=0,i=e.length;r<i;r++)switch(e.charCodeAt(r)){case 9:n+=t;break;case 32:n++;break;default:break loop}return n-n%t}function Ej(e,t,n){let r=t-t%n,i=0;for(;i<e.length&&r!==0;i++)switch(e.charCodeAt(i)){case 9:r-=n;break;case 32:r--;break;default:throw new Xs(`Unexpected character found while calculating indent length`)}return i}function Dj(e,t,n){let r=yo(e),i=[],a=Hr(t.mapToLineArray(e=>Tj(r[e-1],n)),Ee);return t.forEach(e=>{let t=Ej(r[e-1],a,n);i.push(new fc(wj(new to(0,t),new M(e,1)),``))}),new Kc(i)}var Oj=class{constructor(){this._data=``}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}build(){return this._data}};function kj(e){let t=ir(void 0,(t,n)=>e.read(t)||n);return gr({debugName:()=>`${e.debugName}.mapOutFalsy`},n=>{if(t.read(n),e.read(n))return t})}function Aj(e,t=Wl.ofCaller()){return{left:L({name:`editor.validOverlay.left`},t=>e(t)?.left,t),top:L({name:`editor.validOverlay.top`},t=>e(t)?.top,t),width:L({name:`editor.validOverlay.width`},t=>{let n=e(t);if(n)return n.width},t),height:L({name:`editor.validOverlay.height`},t=>{let n=e(t);if(n)return n.height},t)}}function jj(e,t){let n=e.getContainerDomNode(),r=St(`domRect`,n.getBoundingClientRect());return t.add(e.onDidLayoutChange(e=>{r.set(n.getBoundingClientRect(),void 0)})),r}var Mj=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Nj=function(e,t){return function(n,r){t(n,r,e)}},Pj=class{constructor(e,t,n,r,i,a){this._editorObs=e,this._data=t,this._close=n,this._contextKeyService=r,this._keybindingService=i,this._commandService=a,this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(e=>e.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){let e=St(`active`,void 0),t=t=>({title:t.title,icon:t.icon,keybinding:typeof t.commandId==`string`?this._getKeybinding(t.commandArgs?void 0:t.commandId):L(this,e=>typeof t.commandId==`string`?void 0:this._getKeybinding(t.commandArgs?void 0:t.commandId.read(e)).read(e)),isActive:e.map(e=>e===t.id),onHoverChange:n=>e.set(n?t.id:void 0,void 0),onAction:()=>{let e=typeof t.commandId==`string`?t.commandId:t.commandId.get();return this._close(!0,e),this._commandService.executeCommand(e,...t.commandArgs??[])}}),n=this._data.extensionCommands.map(e=>e.map((e,n)=>Lj(t({id:e.command.id+`_`+n,title:e.command.title,icon:e.icon??D.symbolEvent,commandId:e.command.id,commandArgs:e.command.arguments})))),r=[];for(let e of n)e.length>0&&(r.push(zj()),r.push(...e));if(this._data.extensionCommandsOnly)return Fj(r.slice(1));let i=Ij(this._data.displayName),a=Lj(t({id:`gotoAndAccept`,title:V(1256,`Go To / Accept`),icon:D.check,commandId:Ch})),o=Lj(t({id:`reject`,title:V(1257,`Reject`),icon:D.close,commandId:Oh})),s=this._data.alternativeAction?Lj(t({id:`alternativeCommand`,title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:wh})):void 0,c=[],l=this._inlineEditsShowCollapsed.map(e=>Lj(t(e?{id:`showExpanded`,title:V(1258,`Show Expanded`),icon:D.expandAll,commandId:kh}:{id:`showCollapsed`,title:V(1259,`Show Collapsed`),icon:D.collapseAll,commandId:kh}))),d=Lj(t({id:`snooze`,title:V(1260,`Snooze`),icon:D.bellSlash,commandId:`editor.action.inlineSuggest.snooze`})),f=Lj(t({id:`settings`,title:V(1261,`Settings`),icon:D.gear,commandId:`workbench.action.openSettings`,commandArgs:[`@tag:nextEditSuggestions`]})),p=this._data.action?[this._data.action]:[],m=p.length>0?Rj(p.map(e=>({id:e.id,label:e.title+`...`,enabled:!0,run:()=>this._commandService.executeCommand(e.id,...e.arguments??[]),class:void 0,tooltip:e.tooltip??e.title})),{hoverDelegate:u}):void 0;return Fj([i,a,s,o,l,c.length?zj():void 0,...c,d,f,...r,m?zj():void 0,m])}_getKeybinding(e){return e?$u(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e)):pc(void 0)}};Pj=Mj([Nj(3,G),Nj(4,jr),Nj(5,tr)],Pj);function Fj(e){return X.div({class:`content`,style:{margin:4,minWidth:180}},e)}function Ij(e){return X.div({class:`header`,style:{color:An(p),fontSize:`13px`,fontWeight:`600`,padding:`0 4px`,lineHeight:28}},[e])}function Lj(e){return L({name:`inlineEdits.option`},t=>X.div({class:[`monaco-menu-option`,e.isActive?.map(e=>e&&`active`)],onmouseenter:()=>e.onHoverChange?.(!0),onmouseleave:()=>e.onHoverChange?.(!1),onclick:e.onAction,onkeydown:t=>{t.key===`Enter`&&e.onAction?.()},tabIndex:0,style:{borderRadius:3}},[X.elem(`span`,{style:{fontSize:16,display:`flex`}},[C.isThemeIcon(e.icon)?ed(e.icon):e.icon.map(e=>ed(e))]),X.elem(`span`,{},[e.title]),X.div({style:{marginLeft:`auto`},ref:n=>{let r=t.store.add(new Cu(n,Zu,{disableTitle:!0,...$s,keybindingLabelShadow:void 0,keybindingLabelForeground:An(p),keybindingLabelBackground:`transparent`,keybindingLabelBorder:`transparent`,keybindingLabelBottomBorder:void 0}));t.store.add(k(t=>{r.set(e.keybinding.read(t))}))}})]))}function Rj(e,t){return L({name:`inlineEdits.actionBar`},n=>X.div({class:[`action-widget-action-bar`],style:{padding:`3px 24px`}},[X.div({ref:r=>{n.store.add(new Fn(r,t)).push(e,{icon:!1,label:!0})}})]))}function zj(){return X.div({id:`inline-edit-gutter-indicator-menu-separator`,class:`menu-separator`,style:{color:An(xt),padding:`2px 0`}},X.div({style:{borderBottom:`1px solid ${An(xl)}`}}))}var Bj=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Vj=function(e,t){return function(n,r){t(n,r,e)}},Hj=class{constructor(e,t,n,r,i){this.gutterMenuData=e,this.originalRange=t,this.model=n,this.altAction=r,this.customization=i}},Uj=class e{static fromInlineSuggestion(t){let n=t.action?.kind===`edit`?t.action.alternativeAction:void 0,r=t.source.inlineSuggestions.commands??[];return new e(t.gutterMenuLinkAction,t.source.provider.displayName??V(1262,`Inline Suggestion`),r.length>0?[r]:[],n,t.source.provider.modelInfo,t.source.provider.setModelId?.bind(t.source.provider))}constructor(e,t,n,r,i,a,o=!1){this.action=e,this.displayName=t,this.extensionCommands=n,this.alternativeAction=r,this.modelInfo=i,this.setModelId=a,this.extensionCommandsOnly=o}},Wj=class e{static fromInlineCompletionModel(t){return new e(()=>t.accept(),()=>t.jump())}constructor(e,t){this.accept=e,this.jump=t}},Gj=16,Kj=2,qj=class extends j{constructor(e,t,n,r,i,a,o,s,c,l,u){super(),this._editorObs=e,this._data=t,this._tabAction=n,this._verticalOffset=r,this._isHoveringOverInlineEdit=i,this._focusIsInMenu=a,this._hoverService=o,this._instantiationService=s,this._accessibilityService=c,this._themeService=l,this._userInteractionService=u,this._onDidCloseWithCommand=this._register(new U),this._modifierPressed=L(this,e=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),e).shiftKey),this._gutterIndicatorStyles=L(this,e=>{let t=this._tabAction.read(e),n=this._data.read(e)?.altAction,r=this._modifierPressed.read(e);switch(n&&r&&(t=ED.Inactive),t){case ED.Inactive:return{background:pj(nj,this._themeService).read(e).toString(),foreground:pj(ej,this._themeService).read(e).toString(),border:pj(tj,this._themeService).read(e).toString()};case ED.Jump:return{background:pj($A,this._themeService).read(e).toString(),foreground:pj(ZA,this._themeService).read(e).toString(),border:pj(QA,this._themeService).read(e).toString()};case ED.Accept:return{background:pj(aj,this._themeService).read(e).toString(),foreground:pj(rj,this._themeService).read(e).toString(),border:pj(ij,this._themeService).read(e).toString()};default:wl()}}),this._state=L(this,e=>{let t=this._originalRangeObs.read(e);if(t)return{range:t,lineOffsetRange:this._editorObs.observeLineOffsetRange(t,e.store)}}),this._lineNumberToRender=L(this,e=>{if(this._verticalOffset.read(e)!==0)return``;let t=this._data.read(e)?.originalRange.startLineNumber,n=this._editorObs.getOption(76).read(e);if(t===void 0||n.renderType===0)return``;if(n.renderType===3){let n=this._editorObs.cursorPosition.read(e);return t%10==0||n&&n.lineNumber===t?t.toString():``}if(n.renderType===2){let n=this._editorObs.cursorPosition.read(e);if(!n)return``;let r=Math.abs(t-n.lineNumber);return r===0?t.toString():r.toString()}return n.renderType===4?n.renderFn?n.renderFn(t):``:t.toString()}),this._availableWidthForIcon=L(this,e=>{let t=this._editorObs.editor.getModel(),n=this._editorObs.editor,r=this._editorObs.layoutInfo.read(e),i=r.decorationsLeft+r.decorationsWidth-r.glyphMarginLeft;if(!t||i<=0)return()=>0;if(r.lineNumbersLeft===0)return()=>i;let a=this._editorObs.getOption(76).read(e);if(a.renderType===2||a.renderType===0)return()=>i;let o=n.getOption(59).typicalHalfwidthCharacterWidth,s=r.lineNumbersLeft+r.lineNumbersWidth,c=(t.getLineCount()+1).toString().length,l=[];for(let e=1;e<=c;e++){let t=10**(e-1),a=n.getTopForLineNumber(t),c=e*o,u=Math.min(i,Math.max(0,s-c-r.glyphMarginLeft));l.push({firstLineNumberWithDigitCount:t,topOfLineNumber:a,usableWidthLeftOfLineNumber:u})}return e=>{for(let t=l.length-1;t>=0;t--)if(e>=l[t].topOfLineNumber)return l[t].usableWidthLeftOfLineNumber;throw new Xs(`Could not find avilable width for icon`)}}),this._layout=L(this,e=>{let t=this._state.read(e);if(!t)return;let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.observeLineHeightForLine(t.range.map(e=>e.startLineNumber)).read(e),i=n.decorationsLeft+n.decorationsWidth-n.glyphMarginLeft-2,a=n.height-4,o=hA.fromLeftTopWidthHeight(1,2,i,a),s=o.withTop(this._stickyScrollHeight.read(e)),c=o.withTop(s.top+2),l=t.lineOffsetRange.read(e),u=hA.fromRanges(to.fromTo(c.left,c.right),l),d=r,f=this._verticalOffset.read(e),p=u.withHeight(d).translateY(f),m=s.containsRect(p),h=this._data.read(e)?.customization?.icon,g=h?pc(h):this._tabAction.map(e=>e===ED.Accept?D.keyboardTab:D.arrowRight),_=h?pc(h):L(this,e=>this._isHoveredOverIconDebounced.read(e)||this._isHoveredOverInlineEditDebounced.read(e)?D.check:this._tabAction.read(e)===ED.Accept?D.keyboardTab:(this._editorObs.cursorLineNumber.read(e)??0)<=t.range.read(e).startLineNumber?D.keyboardTabAbove:D.keyboardTabBelow),v=e=>{let t=this._availableWidthForIcon.read(void 0)(e.bottom+this._editorObs.editor.getScrollTop())-1;return Math.max(Math.min(t,22),Gj)};if(m){let e=p,t;t=n.lineNumbersWidth===0?Math.max(0,Math.min(Math.max(n.lineNumbersLeft-o.left,0),e.width-22)):Math.max(n.lineNumbersLeft+n.lineNumbersWidth-o.left,0);let r=e.withWidth(t),i=Math.min(e.width-t,22);return{gutterEditArea:u,icon:_,iconDirection:`right`,iconRect:e.withWidth(Math.max(i,18)).translateX(t),iconVisible:i>=18,pillRect:e,lineNumberRect:r}}let y=o.intersect(u);if(y&&y.height>=d){let e=p.moveToBeContainedIn(c).moveToBeContainedIn(y),t=e.withWidth(v(e));return{gutterEditArea:u,icon:_,iconDirection:`right`,iconRect:t,pillRect:t,iconVisible:!0}}let b=p.moveToBeContainedIn(o),ee=b.withWidth(v(b)),te=ee;return{gutterEditArea:u,icon:g,iconDirection:ee.top<p.top?`top`:`bottom`,iconRect:te,pillRect:ee,iconVisible:!0}}),this._iconRef=X.ref(),this.isVisible=this._layout.map(e=>!!e),this._hoverVisible=St(this,!1),this.isHoverVisible=this._hoverVisible,this._isHoveredOverIcon=St(this,!1),this._isHoveredOverIconDebounced=Sn(this._isHoveredOverIcon,100),this.isHoveredOverIcon=this._isHoveredOverIconDebounced,this._indicator=X.div({class:`inline-edits-view-gutter-indicator`,style:{position:`absolute`,overflow:`visible`}},kj(this._layout).map(e=>e?[X.div({style:{position:`absolute`,background:An(oj),borderRadius:`3px`,...Aj(t=>e.read(t).gutterEditArea)}}),X.div({class:`icon`,ref:this._iconRef,tabIndex:0,onclick:()=>{let e=this._layout.get()?.icon.get()===D.check,t=this._data.get();if(!t)throw new Xs(`Gutter indicator data not available`);this._editorObs.editor.focus(),e?t.model.accept():t.model.jump()},onmouseenter:()=>{this._showHover()},style:{cursor:`pointer`,zIndex:`20`,position:`absolute`,backgroundColor:this._gutterIndicatorStyles.map(e=>e.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(e=>e.foreground),border:this._gutterIndicatorStyles.map(e=>`1px solid ${e.border}`),boxSizing:`border-box`,borderRadius:`3px`,display:`flex`,justifyContent:e.map(e=>e.iconDirection===`bottom`?`flex-start`:`flex-end`),transition:this._modifierPressed.map(e=>e?``:`background-color 0.2s ease-in-out, width 0.2s ease-in-out`),...Aj(t=>e.read(t).pillRect)}},[X.div({className:`line-number`,style:{lineHeight:e.map(e=>e.lineNumberRect?e.lineNumberRect.height:0),display:e.map(e=>e.lineNumberRect?`flex`:`none`),alignItems:`center`,justifyContent:`flex-end`,width:e.map(e=>e.lineNumberRect?e.lineNumberRect.width:0),height:`100%`,color:this._gutterIndicatorStyles.map(e=>e.foreground)}},this._lineNumberToRender),X.div({style:{transform:e.map(e=>`rotate(${Jj(e.iconDirection)}deg)`),transition:`rotate 0.2s ease-in-out, opacity 0.2s ease-in-out`,display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,opacity:e.map(e=>e.iconVisible?`1`:`0`),marginRight:e.map(e=>e.pillRect.width-e.iconRect.width-(e.lineNumberRect?.width??0)),width:e.map(e=>e.iconRect.width),position:`relative`,right:e.map(e=>e.iconDirection===`top`?`1px`:`0`),color:this._data.map(e=>e?.customization?.icon?.color?An(e.customization.icon.color.id):void 0)}},[e.map((e,t)=>Yj(ed(e.icon.read(t)),{fontSize:Xj(Math.min(e.iconRect.width-Kj,Gj))}))])])]:[])),this._originalRangeObs=kj(this._data.map(e=>e?.originalRange)),this._stickyScrollController=GA.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?$u(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):pc(0),this._isHoveredOverInlineEditDebounced=Sn(this._isHoveringOverInlineEdit,100);let d=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:d.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:pc(0)})),this._register(this._editorObs.editor.onMouseMove(e=>{if(this._state.get()===void 0)return;let t=this._iconRef.element.getBoundingClientRect(),n=hA.fromLeftTopWidthHeight(t.left,t.top,t.width,t.height),r=new Hu(e.event.posx,e.event.posy);this._isHoveredOverIcon.set(n.containsPoint(r),void 0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._register(de(this._isHoveredOverInlineEditDebounced,e=>{e&&this.triggerAnimation()})),this._register(k(e=>{d.readEffect(e),d.element&&this._editorObs.editor.applyFontInfo(d.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;let e=this._data.get();if(!e)throw new Xs(`Gutter indicator data not available`);let t=new S,n=t.add(this._instantiationService.createInstance(Pj,this._editorObs,e.gutterMenuData,(e,t)=>{e&&this._editorObs.editor.focus(),t&&this._onDidCloseWithCommand.fire(t),i?.dispose()}).toDisposableLiveElement()),r=this._userInteractionService.createFocusTracker(n.element,t);t.add(k(e=>{this._focusIsInMenu.set(r.read(e),void 0)})),t.add(bn(()=>this._focusIsInMenu.set(!1,void 0)));let i=this._hoverService.showInstantHover({target:this._iconRef.element,content:n.element});i?(this._hoverVisible.set(!0,void 0),t.add(this._editorObs.editor.onDidScrollChange(()=>i.dispose())),t.add(i.onDispose(()=>{this._hoverVisible.set(!1,void 0),t.dispose()}))):t.dispose()}};qj=Bj([Vj(6,fa),Vj(7,w),Vj(8,ai),Vj(9,Ll),Vj(10,Pt)],qj);function Jj(e){switch(e){case`top`:return 90;case`bottom`:return-90;case`right`:return 0}}function Yj(e,t){for(let n in t)e.style[n]=t[n];return e}function Xj(e){return`${e}px`}var Zj=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qj=function(e,t){return function(n,r){t(n,r,e)}},$j;(function(e){e.FirstTime=`firstTime`,e.SecondTime=`secondTime`,e.Active=`active`})($j||={});var eM=class extends j{constructor(e,t,n,r,i){super(),this._model=e,this._indicator=t,this._collapsedView=n,this._storageService=r,this._configurationService=i,this._disposables=this._register(new Ae),this._setupDone=St({name:`setupDone`},!1),this._activeCompletionId=L(e=>{let t=this._model.read(e);if(!t||!this._setupDone.read(e))return;let n=this._indicator.read(e);if(!(!n||!n.isVisible.read(e)))return t.inlineEdit.inlineCompletion.identity.id}),this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()===$j.Active)return;let e=new S,t=!1,n=!1,r=0,i=0;return e.add(Si(this._activeCompletionId,async(e,a,o,s)=>{if(e===void 0)return;let c=this.getNewUserType();switch(c){case $j.FirstTime:(r++>=5||t)&&(c=$j.SecondTime,this.setNewUserType(c));break;case $j.SecondTime:i++>=3&&n&&(c=$j.Active,this.setNewUserType(c));break}switch(c){case $j.FirstTime:for(let e=0;e<3&&!s.isCancellationRequested;e++)await this._indicator.get()?.triggerAnimation(),await Wo(500);break;case $j.SecondTime:this._indicator.get()?.triggerAnimation();break}})),e.add(k(e=>{this._collapsedView.isVisible.read(e)&&this.getNewUserType()!==$j.Active&&this._collapsedView.triggerAnimation()})),e.add(k(e=>{let n=this._indicator.read(e);n&&e.store.add(de(n.isHoveredOverIcon,async e=>{e&&(t=!0)}))})),e.add(k(e=>{let t=this._model.read(e);t&&e.store.add(t.onDidAccept(()=>{n=!0}))})),e}getNewUserType(){return this._storageService.get(`inlineEditsGutterIndicatorUserKind`,-1,$j.FirstTime)}setNewUserType(e){switch(e){case $j.FirstTime:throw new Xs(`UserKind should not be set to first time`);case $j.SecondTime:break;case $j.Active:this._disposables.clear();break}this._storageService.store(`inlineEditsGutterIndicatorUserKind`,e,-1,0)}_initializeDebugSetting(){let 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())})}};eM=Zj([Qj(3,Gc),Qj(4,xa)],eM);var tM=class e{static{this.empty=new e([])}constructor(e){this.replacements=e,Da(Ya(e,(e,t)=>e.lineRange.endLineNumberExclusive<=t.lineRange.startLineNumber))}toString(){return this.replacements.map(e=>e.toString()).join(`,`)}getNewLineRanges(){let e=[],t=0;for(let n of this.replacements)e.push(Uu.ofLength(n.lineRange.startLineNumber+t,n.newLines.length)),t+=n.newLines.length-n.lineRange.length;return e}},nM=class e{static fromSingleTextEdit(t,n){let r=yo(t.text),i=t.range.startLineNumber,a=n.getValueOfRange(T.fromPositions(new M(t.range.startLineNumber,1),t.range.getStartPosition()));r[0]=a+r[0];let o=t.range.endLineNumber+1,s=n.getTransformer().getLineLength(t.range.endLineNumber)+1,c=n.getValueOfRange(T.fromPositions(t.range.getEndPosition(),new M(t.range.endLineNumber,s)));r[r.length-1]=r[r.length-1]+c;let l=t.range.startColumn===n.getTransformer().getLineLength(t.range.startLineNumber)+1,u=t.range.endColumn===1;return l&&r[0].length===a.length&&(i++,r.shift()),r.length>0&&i<o&&u&&r[r.length-1].length===c.length&&(o--,r.pop()),new e(new Uu(i,o),r)}constructor(e,t){this.lineRange=e,this.newLines=t}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}toLineEdit(){return new tM([this])}},rM=class{get lineEdit(){return this.action?.kind===`jumpTo`?new nM(Uu.ofLength(this.action.position.lineNumber,0),[]):this.action?.kind===`edit`?nM.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText):new nM(new Uu(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(Uu.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}constructor(e,t,n,r,i,a,o){this.originalText=e,this.action=t,this.edit=n,this.cursorPosition=r,this.multiCursorPositions=i,this.commands=a,this.inlineCompletion=o}},iM=class{constructor(e,t,n){this._model=e,this.inlineEdit=t,this.tabAction=n,this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=L(this,e=>AO(this._model.editor,this.inlineEdit.inlineCompletion,e)),this.onDidAccept=this._model.onDidAccept}accept(e){this._model.accept(void 0,e)}handleInlineEditShownNextFrame(e,t){let n=this.inlineEdit.inlineCompletion,r=Date.now();n.addRef(),Bt(()=>{this._model.handleInlineSuggestionShown(n,e,t,r),n.removeRef()})}},aM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},oM=function(e,t){return function(n,r){t(n,r,e)}},sM=class extends j{constructor(e,t,n){super(),this._editor=e,this._edit=t,this._accessibilityService=n,this.onDidClick=Du.None,this._iconRef=X.ref(),this.isHovered=pc(!1),this._editorObs=lu(this._editor);let r=this._edit.map(e=>e?.edit?.replacements[0]??null).map(e=>e?NE(e,this._editor.getModel()).range.getStartPosition():null),i=this._editorObs.observePosition(r,this._store),a=L(e=>{let t=i.read(e);if(!t)return null;let n=this._editorObs.layoutInfoContentLeft.read(e),r=this._editorObs.scrollLeft.read(e);return new Hu(n+t.x-r,t.y)}),o=X.div({class:`inline-edits-collapsed-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:`block`}},[[this.getCollapsedIndicator(a)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:o,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:pc(0)})),this.isVisible=this._edit.map((e,t)=>!!e&&a.read(t)!==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){let t=this._editorObs.layoutInfoContentLeft,n=e.map((e,n)=>e?e.deltaX(-t.read(n)):null),r=this.createIconPath(n);return X.svg({class:`collapsedView`,ref:this._iconRef,style:{position:`absolute`,...Aj(e=>xj(this._editorObs).read(e)),overflow:`hidden`,pointerEvents:`none`}},[X.svgElem(`path`,{class:`collapsedViewPath`,d:r,fill:An(QA)})])}createIconPath(e){return e.map(e=>{if(!e)return new Oj().build();let t=e.deltaX(-6/2).deltaY(-1),n=t.deltaX(6),r=t.deltaY(1),i=n.deltaY(1),a=r.deltaX(6/2).deltaY(3);return new Oj().moveTo(t).lineTo(n).lineTo(i).lineTo(a).lineTo(r).lineTo(t).build()})}};sM=aM([oM(2,ai)],sM);var cM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},lM=function(e,t){return function(n,r){t(n,r,e)}},uM=14,dM=0,fM=4,pM=4,mM=class extends j{constructor(e,t,n,r,i,a){super(),this._editor=e,this._languageService=a,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._isHovered=St(this,!1),this.isHovered=this._isHovered,this._viewRef=X.ref(),this._editorObs=lu(this._editor);let o=n.map((e,t)=>{let n;switch(e){case ED.Inactive:n=nj;break;case ED.Jump:n=$A;break;case ED.Accept:n=aj;break}return{border:pj(n,i).read(t).toString(),background:mj(r.read(t))}}),s=t.map(e=>e?this.getState(e):void 0),c=s.map(e=>e?this.getRendering(e,o):void 0);this.minEditorScrollHeight=L(this,e=>{let t=s.read(e);return t?t.rect.read(e).bottom+this._editor.getScrollTop():0});let l=X.div({class:`inline-edits-custom-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:`block`}},[c]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:l.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:ir(this,(e,t)=>{let n=s.read(e);if(!n)return t??0;let r=n.rect.map(e=>e.right).read(e)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(e)+fM-this._editorObs.layoutInfoContentLeft.read(e);return Math.max(t??0,r)}).recomputeInitiallyAndOnChange(this._store)})),this._register(k(e=>{if(!c.read(e)){this._isHovered.set(!1,void 0);return}this._isHovered.set(l.isHovered.read(e),void 0)}))}fitsInsideViewport(e,t,n){let r=this._editorObs.layoutInfoWidth.read(n),i=this._editorObs.layoutInfoContentLeft.read(n),a=this._editor.getLayoutInfo().verticalScrollbarWidth,o=this._editorObs.layoutInfoMinimap.read(n).minimapLeft===0?0:this._editorObs.layoutInfoMinimap.read(n).minimapWidth;return gj(this._editorObs,e,void 0)+bj(t,this._editor,this._editor.getModel())+18<r-i-a-o}getState(e){let t=L(this,t=>{let n=e.range.startLineNumber,r=e.range.endLineNumber,i=e.range.startColumn,a=e.range.endColumn,o=this._editor.getModel()?.getLineCount()??0;return{lineWidth:gj(this._editorObs,new Uu(n,n+1),t),lineWidthBelow:n+1<=o?gj(this._editorObs,new Uu(n+1,n+2),t):void 0,lineWidthAbove:n-1>=1?gj(this._editorObs,new Uu(n-1,n),t):void 0,startContentLeftOffset:this._editor.getOffsetForColumn(n,i),endContentLeftOffset:this._editor.getOffsetForColumn(r,a)}}),n=e.range.startLineNumber,r=e.range.endLineNumber,i=this.fitsInsideViewport(new Uu(n,r+1),e.content,void 0);return{rect:L(this,a=>{let o=this._editorObs.getOption(59).read(a).typicalHalfwidthCharacterWidth,{lineWidth:s,lineWidthBelow:c,lineWidthAbove:l,startContentLeftOffset:u,endContentLeftOffset:d}=t.read(a),f=this._editorObs.layoutInfoContentLeft.read(a),p=this._editorObs.observeLineHeightForLine(n).recomputeInitiallyAndOnChange(a.store).read(a),m=this._editorObs.scrollTop.read(a),h=this._editorObs.scrollLeft.read(a),g;g=n===r&&d+5*o>=s&&i?`end`:c!==void 0&&c+uM-pM-fM<u?`below`:l!==void 0&&l+uM-pM-fM<u?`above`:`end`;let _,v,y=0,b=0;switch(g){case`end`:_=this._editorObs.editor.getTopForLineNumber(n),v=s,y=18;break;case`below`:_=this._editorObs.editor.getTopForLineNumber(n+1),v=u,y=8,b=2;break;case`above`:_=this._editorObs.editor.getTopForLineNumber(n-1),v=u,y=8,b=2;break}return hA.fromLeftTopWidthHeight(f+v-h,_-m,o*e.content.length,p).withMargin(dM,fM).translateX(y).translateY(b)}),label:e.content,kind:e.style}}getRendering(e,t){let n=document.createElement(`div`),r=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0],i;i=r&&e.kind===Nt.Code?Ic.fromLineTokens(r).toLineTokens(e.label,this._languageService.languageIdCodec):Ma.createEmpty(e.label,this._languageService.languageIdCodec);let a=Ue(new yu([i]),Qr.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],n,!0);n.style.width=`${a.minWidthInPx}px`;let o=e.rect.map(e=>e.withMargin(0,fM));return X.div({class:`collapsedView`,ref:this._viewRef,style:{position:`absolute`,...Aj(e=>o.read(e)),overflow:`hidden`,boxSizing:`border-box`,cursor:`pointer`,border:t.map(e=>`1px solid ${e.border}`),borderRadius:`3px`,backgroundColor:t.map(e=>e.background),display:`flex`,alignItems:`center`,justifyContent:`center`,whiteSpace:`nowrap`},onmousedown:e=>{e.preventDefault()},onclick:e=>{this._onDidClick.fire(DD.create(e))}},[n])}};mM=cM([lM(4,Ll),lM(5,Zo)],mM);var hM=0,gM=0,_M=1,vM=1,yM=3,bM=3,xM=class extends j{constructor(e,t,n,r){super(),this._editor=e,this._edit=t,this._uiState=n,this._tabAction=r,this.onDidClick=Du.None,this._display=L(this,e=>this._uiState.read(e)?`block`:`none`),this._editorMaxContentWidthInRange=L(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),ir(this,(e,n)=>{let r=gj(this._editorObs,t,e);return Math.max(r,n??0)})):pc(0)}).map((e,t)=>e.read(t)),this._maxPrefixTrim=L(this,e=>{let t=this._uiState.read(e);return t?yj(t.deletions,t.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}}),this._editorLayoutInfo=L(this,e=>{let t=this._edit.read(e);if(!t||!this._uiState.read(e))return null;let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.scrollLeft.read(e),i=this._editorObs.getOption(59).map(e=>e.typicalHalfwidthCharacterWidth).read(e),a=n.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(e),i)-r,o=t.originalLineRange,s=this._originalVerticalStartPosition.read(e)??this._editor.getTopForLineNumber(o.startLineNumber)-this._editorObs.scrollTop.read(e),c=this._originalVerticalEndPosition.read(e)??this._editor.getTopForLineNumber(o.endLineNumberExclusive)-this._editorObs.scrollTop.read(e),l=n.contentLeft+this._maxPrefixTrim.read(e).prefixLeftOffset-r;return a<=l?null:{codeRect:hA.fromLeftTopRightBottom(l,s,a,c).withMargin(gM,hM),contentLeft:n.contentLeft}}).recomputeInitiallyAndOnChange(this._store),this._originalOverlay=X.div({style:{pointerEvents:`none`}},L(this,e=>{let t=kj(this._editorLayoutInfo).read(e);if(!t)return;let n=t.map(e=>hA.fromLeftTopRightBottom(e.contentLeft-bM-_M,e.codeRect.top,e.contentLeft,e.codeRect.bottom)),r=L(this,e=>{let r=t.read(e).codeRect,i=n.read(e);return r.intersectHorizontal(new to(i.left,2**53-1))}),i=this._uiState.map(e=>e?.editorType===FD.DiffEditor?yM:vM).read(e),a=r.map(e=>e.withMargin(i,i)),o=mj(this._uiState.map(e=>e?.editorType??FD.TextEditor).read(e));return[X.div({class:`originalSeparatorDeletion`,style:{...a.read(e).toStyles(),borderRadius:`${bM}px`,border:`${_M+i}px solid ${o}`,boxSizing:`border-box`}}),X.div({class:`originalOverlayDeletion`,style:{...r.read(e).toStyles(),borderRadius:`${bM}px`,border:fj(this._tabAction).map(e=>`${_M}px solid ${An(e)}`),boxSizing:`border-box`,backgroundColor:An(KA)}}),X.div({class:`originalOverlayHiderDeletion`,style:{...n.read(e).toStyles(),backgroundColor:o}})]})).keepUpdated(this._store),this._nonOverflowView=X.div({class:`inline-edits-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store),this.isHovered=pc(!1),this._editorObs=lu(this._editor);let i=L(this,e=>{let t=this._edit.read(e);return t?new M(t.originalLineRange.startLineNumber,1):null}),a=L(this,e=>{let t=this._edit.read(e);return t?new M(t.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(e=>e?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(i,this._store).map(e=>e?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(a,this._store).map(e=>e?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:L(this,e=>{let t=this._editorLayoutInfo.read(e);return t===null?0:t.codeRect.width})}))}},SM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},CM=function(e,t){return function(n,r){t(n,r,e)}},wM=1,TM=1,EM=3,DM=3,OM=class extends j{constructor(e,t,n,r,i){super(),this._editor=e,this._input=t,this._tabAction=n,this._languageService=i,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._state=L(this,e=>{let t=this._input.read(e);if(!t)return;let n=this._editor.getModel(),r=n.getEOL();if(t.startColumn===1&&t.lineNumber>1&&n.getLineLength(t.lineNumber)!==0&&t.text.endsWith(r)&&!t.text.startsWith(r)){let e=n.getLineLength(t.lineNumber-1)+1;return{lineNumber:t.lineNumber-1,column:e,text:r+t.text.slice(0,-r.length)}}return{lineNumber:t.lineNumber,column:t.startColumn,text:t.text}}),this._trimVertically=L(this,e=>{let t=this._state.read(e),n=t?.text;if(!n||n.trim()===``)return{topOffset:0,bottomOffset:0,linesTop:0,linesBottom:0};let r=this._editor.getLineHeightForPosition(new M(t.lineNumber,1)),i=this._editor.getModel().getEOL(),a=0,o=0,s=0;for(;s<n.length&&n.startsWith(i,s);s+=i.length)a+=1;for(let e=n.length;e>s&&n.endsWith(i,e);e-=i.length)o+=1;return{topOffset:a*r,bottomOffset:o*r,linesTop:a,linesBottom:o}}),this._maxPrefixTrim=L(this,e=>{let t=this._state.read(e);if(!t)return{prefixLeftOffset:0,prefixTrim:0};let n=this._editor.getModel(),r=n.getEOL(),i=this._trimVertically.read(e),a=t.text.split(r),o=a.slice(i.linesTop,a.length-i.linesBottom);return i.linesTop===0&&(o[0]=n.getLineContent(t.lineNumber)+o[0]),yj([],new Uu(t.lineNumber,t.lineNumber+(i.linesTop>0?0:1)),o,this._editor)}),this._ghostText=L(e=>{let t=this._state.read(e),n=this._maxPrefixTrim.read(e);if(!t)return;let r=this._editor.getModel().getEOL(),i=t.text.split(r).map((e,t)=>new Xo(new T(t+1,t===0?1:n.prefixTrim+1,t+1,e.length+1),`modified-background`,0));return new OE(t.lineNumber,[new kE(t.column,t.text,!1,i)])}),this._display=L(this,e=>this._state.read(e)?`block`:`none`),this._editorMaxContentWidthInRange=L(this,e=>{let t=this._state.read(e);if(!t)return 0;this._editorObs.versionId.read(e);let n=this._editor.getModel(),r=n.getEOL(),i=t.text.startsWith(r)?``:n.getValueInRange(new T(t.lineNumber,1,t.lineNumber,t.column)),a=n.getValueInRange(new T(t.lineNumber,t.column,t.lineNumber,n.getLineLength(t.lineNumber)+1)),o=(i+t.text+a).split(r),s=Qr.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),c=o.map(e=>{let r=n.tokenization.tokenizeLinesAt(t.lineNumber,[e])?.[0],i;return i=r?Ic.fromLineTokens(r).toLineTokens(e,this._languageService.languageIdCodec):Ma.createEmpty(e,this._languageService.languageIdCodec),Ue(new yu([i]),s,[],I(`div`),!0).minWidthInPx});return Math.max(...c)}),this.startLineOffset=this._trimVertically.map(e=>e.topOffset),this.originalLines=this._state.map(e=>e?new Uu(e.lineNumber,Math.min(e.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0),this._overlayLayout=L(this,e=>{this._ghostText.read(e);let t=this._state.read(e);if(!t)return null;this._editorObs.observePosition(St(this,new M(t.lineNumber,t.column)),e.store).read(e);let n=this._editorObs.layoutInfo.read(e),r=this._editorObs.scrollLeft.read(e),i=this._editorObs.layoutInfoVerticalScrollbarWidth.read(e),a=n.contentLeft+this._editorMaxContentWidthInRange.read(e)-r,o=this._maxPrefixTrim.read(e).prefixLeftOffset??0,s=n.contentLeft+o-r;if(a<=s)return null;let{topOffset:c,bottomOffset:l}=this._trimVertically.read(e),u=this._editorObs.scrollTop.read(e),d=this._ghostTextView.height.read(e)-c-l,f=this._editor.getTopForLineNumber(t.lineNumber)-u+c,p=new hA(s,f,a,f+d);return{overlay:p,startsAtContentLeft:o===0,contentLeft:n.contentLeft,minContentWidthRequired:o+p.width+i}}).recomputeInitiallyAndOnChange(this._store),this._modifiedOverlay=X.div({style:{pointerEvents:`none`}},L(this,e=>{let t=kj(this._overlayLayout).read(e);if(!t)return;let n=t.map(e=>hA.fromLeftTopRightBottom(e.contentLeft-DM-wM,e.overlay.top,e.contentLeft,e.overlay.bottom)).read(e),r=this._input.map(e=>e?.editorType===FD.DiffEditor?EM:TM).read(e),i=t.map(e=>e.overlay.withMargin(0,wM,0,e.startsAtContentLeft?0:wM).intersectHorizontal(new to(n.left,2**53-1))),a=i.map(e=>e.withMargin(r,r)),o=mj(this._input.read(void 0)?.editorType??FD.TextEditor);return[X.div({class:`originalUnderlayInsertion`,style:{...a.read(e).toStyles(),borderRadius:DM,border:`${wM+r}px solid ${o}`,boxSizing:`border-box`}}),X.div({class:`originalOverlayInsertion`,style:{...i.read(e).toStyles(),borderRadius:DM,border:dj(this._tabAction).map(e=>`${wM}px solid ${An(e)}`),boxSizing:`border-box`,backgroundColor:An(qA)}}),X.div({class:`originalOverlayHiderInsertion`,style:{...n.toStyles(),backgroundColor:o}})]})).keepUpdated(this._store),this._view=X.div({class:`inline-edits-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store),this._editorObs=lu(this._editor),this._ghostTextView=this._register(r.createInstance(aA,this._editor,L(e=>{let t=this._ghostText.read(e);if(t)return{ghostText:t,handleInlineCompletionShown:e=>{},warning:void 0}}),{extraClasses:[`inline-edit`],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(e=>{this._onDidClick.fire(new DD(e))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:L(this,e=>{let t=this._overlayLayout.read(e);return t===null?0:t.minContentWidthRequired})}))}};OM=SM([CM(3,w),CM(4,Zo)],OM);var kM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},AM=function(e,t){return function(n,r){t(n,r,e)}},jM=class extends j{constructor(e,t,n,r,i,a){super(),this._editor=e,this._edit=t,this._editorType=n,this._tabAction=r,this._languageService=i,this._themeService=a,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._maxPrefixTrim=this._edit.map((e,t)=>e?yj(e.replacements.flatMap(e=>[e.originalRange,e.modifiedRange]),e.originalRange,e.modifiedLines,this._editor.editor,t):void 0),this._modifiedLineElements=L(this,e=>{let t=[],n=0,r=this._maxPrefixTrim.read(e),i=this._edit.read(e);if(!i||!r)return;let a=r.prefixTrim,o=MM(i.replacements.map(e=>e.modifiedRange)).map(e=>new T(e.startLineNumber,e.startColumn-a,e.endLineNumber,e.endColumn-a)),s=this._editor.model.get(),c=i.modifiedRange.startLineNumber;for(let r=0;r<i.modifiedRange.length;r++){let l=document.createElement(`div`),u=c+r,d=i.modifiedLines[r].slice(a),f=s.tokenization.tokenizeLinesAt(u,[d])?.[0],p;p=f?Ic.fromLineTokens(f).toLineTokens(d,this._languageService.languageIdCodec):Ma.createEmpty(d,this._languageService.languageIdCodec);let m=[];for(let e of o.filter(e=>e.startLineNumber===u)){let t=Math.min(e.endColumn,d.length+1);m.push(new Xo(new T(1,e.startColumn,1,t),`inlineCompletions-modified-bubble`,0))}let h=Ue(new yu([p]),Qr.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),m,l,!0);this._editor.getOption(59).read(e),n=Math.max(n,h.minWidthInPx),t.push(l)}return{lines:t,requiredWidth:n}}),this._layout=L(this,e=>{let t=this._modifiedLineElements.read(e),n=this._maxPrefixTrim.read(e),r=this._edit.read(e);if(!t||!n||!r)return;let{prefixLeftOffset:i}=n,{requiredWidth:a}=t,o=this._editor.observeLineHeightsForLineRange(r.originalRange).read(e),s=(()=>{let e=o.slice(0,r.modifiedRange.length);for(;e.length<r.modifiedRange.length;)e.push(o[o.length-1]);return e})(),c=this._editor.layoutInfoContentLeft.read(e),l=this._editor.layoutInfoVerticalScrollbarWidth.read(e),u=this._editor.scrollLeft.read(e),d=this._editor.scrollTop.read(e),f=c-u,p=this._editor.editor.getModel(),m=r.originalRange.mapToLineArray(e=>this._editor.editor.getOffsetForColumn(e,p.getLineMaxColumn(e))-i),h=Math.max(...m,a),g=r.originalRange.startLineNumber,_=r.originalRange.endLineNumberExclusive-1,v=this._editor.editor.getTopForLineNumber(g)-d,y=this._editor.editor.getBottomForLineNumber(_)-d,b=hA.fromLeftTopWidthHeight(f+i,v,h,y-v),ee=hA.fromLeftTopWidthHeight(b.left,b.bottom,b.width,s.reduce((e,t)=>e+t,0)),te=hA.hull([b,ee]),ne=te.intersectVertical(new to(b.bottom,2**53-1));return{originalLinesOverlay:b,modifiedLinesOverlay:ee,background:te,lowerBackground:ne,lowerText:new hA(ne.left,ne.top,ne.right,ne.bottom),modifiedLineHeights:s,minContentWidthRequired:i+h+l}}),this._viewZoneInfo=L(e=>{if(!this._editor.getOption(71).map(e=>e.edits.allowCodeShifting===`always`).read(e))return;let t=this._layout.read(e),n=this._edit.read(e);if(!(!t||!n))return{height:t.lowerBackground.height,lineNumber:n.originalRange.endLineNumberExclusive}}),this.minEditorScrollHeight=L(this,e=>{let t=kj(this._layout).read(e);return!t||this._viewZoneInfo.read(e)!==void 0?0:t.read(e).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=X.div({class:`line-replacement`},[L(this,e=>{let t=kj(this._layout).read(e),n=this._modifiedLineElements.read(e);if(!t||!n)return[];let r=t.read(e),i=this._editor.layoutInfoContentLeft.read(e),a=this._editorType.read(e)===FD.DiffEditor?3:1;n.lines.forEach((e,t)=>{e.style.width=`${r.lowerText.width}px`,e.style.height=`${r.modifiedLineHeights[t]}px`,e.style.position=`relative`});let o=dj(this._tabAction).read(e),s=fj(this._tabAction).read(e),c=mj(this._editorType.read(e));return[X.div({style:{position:`absolute`,...Aj(e=>xj(this._editor).read(e)),overflow:`hidden`,pointerEvents:`none`}},[X.div({class:`borderAroundLineReplacement`,style:{position:`absolute`,...Aj(e=>t.read(e).background.translateX(-i).withMargin(a)),borderRadius:`3px`,border:`${a+1}px solid ${c}`,boxSizing:`border-box`,pointerEvents:`none`}}),X.div({class:`originalOverlayLineReplacement`,style:{position:`absolute`,...Aj(e=>t.read(e).background.translateX(-i)),borderRadius:`3px`,border:pj(s,this._themeService).map(e=>`1px solid ${e.toString()}`),pointerEvents:`none`,boxSizing:`border-box`,background:An(KA)}}),X.div({class:`modifiedOverlayLineReplacement`,style:{position:`absolute`,...Aj(e=>t.read(e).lowerBackground.translateX(-i)),borderRadius:`0 0 3px 3px`,background:c,boxShadow:`${An(Oe)} 0 6px 6px -6px`,border:`1px solid ${An(o)}`,boxSizing:`border-box`,overflow:`hidden`,cursor:`pointer`,pointerEvents:`auto`},onmousedown:e=>{e.preventDefault()},onclick:e=>this._onDidClick.fire(DD.create(e))},[X.div({style:{position:`absolute`,top:0,left:0,width:`100%`,height:`100%`,background:An(YA)}})]),X.div({class:`modifiedLinesLineReplacement`,style:{position:`absolute`,boxSizing:`border-box`,...Aj(e=>t.read(e).lowerText.translateX(-i)),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`}},[...n.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(e=>this._isMouseOverWidget(e),this._store),this._previousViewZoneInfo=void 0,this._register(bn(()=>this._editor.editor.changeViewZones(e=>this.removePreviousViewZone(e)))),this._register(nl(this._viewZoneInfo,({lastValue:e,newValue:t})=>{e===t||e?.height===t?.height&&e?.lineNumber===t?.lineNumber||this._editor.editor.changeViewZones(e=>{this.removePreviousViewZone(e),t&&this.addViewZone(t,e)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:L(this,e=>this._layout.read(e)?.minContentWidthRequired??0),position:pc({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){let t=this._layout.get();return!t||!(e.event instanceof g)?!1:t.lowerBackground.containsPoint(new Hu(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);let 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){let n=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:I(`div`)});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:n};let r=this._editor.cursorLineNumber.get();r!==null&&r>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};jM=kM([AM(4,Zo),AM(5,Ll)],jM);function MM(e){let t=[];for(;e.length;){let n=e.shift();n.startLineNumber!==n.endLineNumber&&(e.push(new T(n.startLineNumber+1,1,n.endLineNumber,n.endColumn)),n=new T(n.startLineNumber,n.startColumn,n.startLineNumber,2**53-1)),t.push(n)}return t}function NM(e,t){let n={};for(let[e,r]of Object.entries(t))Array.isArray(r)?n[e]={min:0,rules:r}:n[e]={min:r.min??0,rules:r.rules??[{max:r.max,priority:r.priority,share:r.share}]};let r={},i=0;for(let[e,t]of Object.entries(n))r[e]=t.min,i+=t.min;if(i>e)return null;let a=e-i;for(;a>0;){let e=[];for(let[t,i]of Object.entries(n))for(let n=0;n<i.rules.length;n++){let a=i.rules[n];r[t]<(a.max??1/0)&&e.push({partKey:t,ruleIndex:n,rule:a,priority:a.priority??0,share:a.share??1})}if(e.length===0)break;let t=Math.max(...e.map(e=>e.priority)),i=e.filter(e=>e.priority===t),o=i.reduce((e,t)=>e+t.share,0),s=0,c=[];for(let e of i){let t=e.rule,n=r[e.partKey],i=(t.max??1/0)-n,l=a*e.share/o,u=Math.min(l,i);c.push({partKey:e.partKey,ruleIndex:e.ruleIndex,amount:u}),s+=u}if(s===0)break;for(let e of c)r[e.partKey]+=e.amount;if(a-=s,a<1e-4)break}return r}var PM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},FM=function(e,t){return function(n,r){t(n,r,e)}},IM=class extends j{constructor(e,t,n,r,i,a){super(),this._editor=e,this._data=n,this._themeService=r,this._keybindingService=i,this._contextKeyService=a,this._styles=L(this,e=>({background:pj($A,this._themeService).read(e).toString(),foreground:pj(ZA,this._themeService).read(e).toString(),border:pj(QA,this._themeService).read(e).toString()})),this._pos=L(this,e=>this._editor.observePosition(L(e=>this._data.read(e)?.jumpToPosition||null),e.store)).flatten(),this._layout=L(this,e=>{let t=this._data.read(e);if(!t)return;let n=t.jumpToPosition,r=this._editor.observeLineHeightForLine(pc(n.lineNumber)).read(e),i=this._editor.scrollLeft.read(e),a=this._pos.read(e);if(!a)return;let o=this._editor.layoutInfo.read(e);return{widgetRect:hA.fromLeftTopWidthHeight(a.x+o.contentLeft+2-i,a.y,100,r)}}),this._blink=LM([{value:!0,durationMs:600},{value:!1,durationMs:600}]),this._widget=X.div({class:`inline-edit-jump-to-widget`,style:{position:`absolute`,display:this._layout.map(e=>e?`flex`:`none`),alignItems:`center`,cursor:`pointer`,userSelect:`none`,...Aj(e=>this._layout.read(e)?.widgetRect)}},L(e=>this._data.read(e)===void 0?[]:X.div({style:{display:`flex`,alignItems:`center`,gap:`4px`,padding:`0 4px`,height:`100%`,backgroundColor:this._styles.map(e=>e.background),"--vscodeIconForeground":this._styles.map(e=>e.foreground),border:this._styles.map(e=>`1px solid ${e.border}`),borderRadius:`3px`,boxSizing:`border-box`,fontSize:`11px`,color:this._styles.map(e=>e.foreground)}},[this._style===`cursor`?X.elem(`div`,{style:{borderLeft:`2px solid`,height:14,opacity:this._blink.map(e=>e?`0`:`1`)}}):[L(()=>X.elem(`div`,{},RM(this._keybinding))),X.elem(`div`,{style:{lineHeight:this._layout.map(e=>e?.widgetRect.height),marginTop:`-2px`}},[`to jump`])]]))),this._style=t.style,this._keybinding=this._getKeybinding(Ch);let o=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:o.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:pc(0)})),this._register(this._editor.setDecorations(L(e=>{let t=this._data.read(e);return t?[{range:T.fromPositions(t.jumpToPosition,t.jumpToPosition),options:{description:`inline-edit-jump-to-decoration`,inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style===`label`?` `:` `}}}]:[]})))}_getKeybinding(e,t=Wl.ofCaller()){return e?$u(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e),t):pc(void 0)}};IM=PM([FM(3,Ll),FM(4,jr),FM(5,G)],IM);function LM(e,t=Wl.ofCaller()){let n=0;return $u(void 0,t=>{n=0;let r=new Cl(()=>{n=(n+1)%e.length,t(null),r.schedule(e[n].durationMs)},0);return r.schedule(0),r},()=>e[n].value,t)}function RM(e){return L(t=>X.div({style:{},ref:n=>{let r=t.store.add(new Cu(n,Zu,{disableTitle:!0,...$s,keybindingLabelShadow:void 0,keybindingLabelForeground:An(ZA),keybindingLabelBackground:`transparent`,keybindingLabelBorder:An(ZA),keybindingLabelBottomBorder:void 0}));t.store.add(k(t=>{r.set(e.read(t))}))}}))}var zM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},BM=function(e,t){return function(n,r){t(n,r,e)}},VM=class extends j{constructor(e,t,n,r,i){super(),this._previewTextModel=e,this._properties=t,this._parentEditor=n,this._tabAction=r,this._instantiationService=i,this._previewRef=X.ref(),this.element=X.div({class:`preview`,style:{},ref:this._previewRef}),this._state=L(this,e=>{let t=this._properties.read(e);if(!t)return;let n,r;t.nextCursorPosition===null?t.diff[0].innerChanges?.every(e=>e.modifiedRange.isEmpty())?(n=`original`,r=Uu.ofLength(t.diff[0].original.startLineNumber,1)):(n=`modified`,r=Uu.ofLength(t.diff[0].modified.startLineNumber,1)):(n=`original`,r=Uu.ofLength(t.nextCursorPosition.lineNumber,1));let i=n===`modified`?uD.snapshot(this._previewTextModel):t.target;return{mode:n,visibleLineRange:r,textModel:i,diff:t.diff}}),this.updatePreviewEditorEffect=L(this,e=>{this._previewEditorObs.model.read(e);let t=this._state.read(e)?.visibleLineRange;if(!t)return;let n=[];t.startLineNumber>1&&n.push(new T(1,1,t.startLineNumber-1,1)),t.endLineNumberExclusive<this._previewTextModel.getLineCount()+1&&n.push(new T(t.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(n,void 0,!0)}),this.horizontalContentRangeInPreviewEditorToShow=L(this,e=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,e)),this.contentHeight=L(this,e=>{let t=this._state.read(e);return t?this._previewEditorObs.observeLineHeightForLine(t.visibleLineRange.startLineNumber):pc(null)}).flatten(),this._editorDecorations=L(this,e=>{let t=this._state.read(e);if(!t)return;let n={diff:t.diff},r=[],i=[],a=Y.register({className:`inlineCompletions-char-delete`,description:`char-delete`,isWholeLine:!1,zIndex:1}),o=Y.register({className:`inlineCompletions-char-insert`,description:`char-insert`,isWholeLine:!0}),s=Y.register({className:`inlineCompletions-char-insert`,description:`char-insert`,shouldFillLineOnLineBreak:!0});for(let e of n.diff)if(e.modified.isEmpty||e.original.isEmpty)e.original.isEmpty||r.push({range:e.original.toInclusiveRange(),options:a}),e.modified.isEmpty||i.push({range:e.modified.toInclusiveRange(),options:o});else for(let t of e.innerChanges||[])e.original.contains(t.originalRange.startLineNumber)&&!t.originalRange.isEmpty()&&r.push({range:t.originalRange,options:{description:`char-delete`,shouldFillLineOnLineBreak:!1,className:Cj(`inlineCompletions-char-delete`,t.originalRange.isEmpty()&&`empty`),zIndex:1}}),e.modified.contains(t.modifiedRange.startLineNumber)&&i.push({range:t.modifiedRange,options:s});return{originalDecorations:r,modifiedDecorations:i}}),this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=lu(this._parentEditor),this._register(k(e=>{let t=this._state.read(e)?.textModel||null;t&&this.previewEditor.setModel(t.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=lu(this.previewEditor),this._register(this._previewEditorObs.setDecorations(L(e=>{let t=this._state.read(e),n=this._editorDecorations.read(e);return(t?.mode===`original`?n?.originalDecorations:n?.modifiedDecorations)??[]}))),this._register(k(e=>{if(!this._properties.read(e))return;let t=this._parentEditorObs.cursorPosition.read(e);t&&this.previewEditor.setPosition(this._previewTextModel.validatePosition(t),`longDistanceHintPreview`)})),this._register(k(e=>{let t=this._state.read(e);if(!t)return;let n=t.visibleLineRange.startLineNumber.toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:n+1})})),this._register(this._instantiationService.createInstance(qj,this._previewEditorObs,L(e=>{let t=this._state.read(e);if(!t)return;let n=this._properties.read(e);if(n)return new Hj(n.inlineSuggestInfo,Uu.ofLength(t.visibleLineRange.startLineNumber,1),n.model,void 0)}),this._tabAction,pc(0),pc(!1),St(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(Av,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:{[pw.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(e,t){let n=this._state.read(t);if(!n)return;let r=n.diff,i=this._properties.read(t)?.nextCursorPosition,a=n.visibleLineRange,o=this._previewEditorObs.layoutInfo.read(t),s=gj(this._previewEditorObs,a,t),c;if(i)c=T.fromPositions(i);else if(r[0].innerChanges)c=n.mode===`modified`?r[0].innerChanges[0].modifiedRange:r[0].innerChanges[0].originalRange;else return;let l=HM(e.getModel(),c,5),u=this._previewEditorObs.getLeftOfPosition(l.getStartPosition(),t),d=this._previewEditorObs.getLeftOfPosition(l.getEndPosition(),t),f=Mt(u,0,s),p=Mt(d,f,s),m=e.getModel().getLineFirstNonWhitespaceColumn(l.startLineNumber);return{indentationEnd:this._previewEditorObs.getLeftOfPosition(new M(l.startLineNumber,m),t),preferredRangeToReveal:new to(f,p),maxEditorWidth:s+o.contentLeft,contentWidth:s,nonContentWidth:o.contentLeft}}layout(e,t){this.previewEditor.layout(e),this._previewEditorObs.editor.setScrollLeft(t)}};VM=zM([BM(4,w)],VM);function HM(e,t,n){let r=t.getStartPosition(),i=t.getEndPosition(),a=e.getLineContent(r.lineNumber);function o(e){let t=a.charAt(e-1);return/[a-zA-Z0-9_]/.test(t)}function s(e){let t=a.charAt(e-1);return t===` `||t===` `}let c=r.column;for(;c>1&&o(c)&&!s(c-1)&&r.column-c<n;)c--;let l=i.column-1;for(;l<=a.length&&o(l)&&!s(l+1)&&l-i.column<n;)l++;return new T(r.lineNumber,r.column,i.lineNumber,l+1)}function UM(e,t){let n=e.start,r=e.endExclusive,i=Number.MAX_VALUE,a=0;for(let e of t){let t=a+e.width;Math.max(n,a)<Math.min(r,t)&&(i=Math.min(i,e.height)),a=t}return r>a||i===Number.MAX_VALUE?0:i}var WM=class{constructor(e,t,n){this._lineRangeInfo=e,this.availableSpaceSizes=e.sizes.map((r,i)=>{let a=n(e.lineRange.startLineNumber+i);return new mA(Math.max(0,t-r.width-a),r.height)}),this.availableSpaceHeightPrefixSums=qM(this.availableSpaceSizes,e=>e.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map(e=>e.transpose())}getWidgetVerticalOutline(e,t,n){let r=e-this._lineRangeInfo.lineRange.startLineNumber,i=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[r],a=to.ofStartAndLength(i,t),{previewEditorMargin:o,widgetPadding:s,widgetBorder:c,lowerBarHeight:l}=n;return a.withMargin(o+s+c).withMargin(0,l)}tryFindWidgetOutline(e,t,n,r){if(!(this._lineRangeInfo.lineRange.length<3))return KM(this._lineRangeInfo.lineRange.addMargin(-1,-1),e,e=>{let i=this.getWidgetVerticalOutline(e,t,r),a=UM(i.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);if(!(a<r.minWidgetWidth))return{horizontalWidgetRange:to.ofStartAndLength(n-a,a),verticalWidgetRange:i}})}};function GM(e,t,n,r,i){let a=[],o=e.startLineNumber,s=n,c=[];for(let n=0;n<t.length;n++){let i=e.startLineNumber+n,l=s+c.reduce((e,t)=>e+t.height,0),u=r.editor.getTopForLineNumber(i);n>0&&u!==l&&(a.push({lineRange:Uu.ofLength(o,i-o),top:s,sizes:c}),o=i,s=u,c=[]),c.push(t[n])}return a.push({lineRange:Uu.ofLength(o,e.endLineNumberExclusive-o),top:s,sizes:c}),L({owner:`splitIntoContinuousLineRanges`},t=>r.observeTopForLineNumber(e.endLineNumberExclusive-1).read(t)).read(i),a}function KM(e,t,n){for(let r=0;;r++){let i=t+r;if(i<=e.endLineNumberExclusive){let e=n(i);if(e!==void 0)return e}let a=t-r;if(a>=e.startLineNumber){let e=n(a);if(e!==void 0)return e}if(a<e.startLineNumber&&i>e.endLineNumberExclusive)return}}function qM(e,t){let n=[0],r=0;for(let i of e)r+=t(i),n.push(r);return n}var JM=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},YM=function(e,t){return function(n,r){t(n,r,e)}},XM=6,ZM={EMPTY_SPACE:425,OVERLAY:375},QM={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:250},$M=class extends j{constructor(e,t,n,r,i,a,o,s,c){super(),this._editor=e,this._viewState=t,this._previewTextModel=n,this._tabAction=r,this._instantiationService=i,this._themeService=a,this._keybindingService=o,this._modelService=s,this._languageService=c,this.onDidClick=Du.None,this._viewWithElement=void 0,this._hintTextPosition=L(this,e=>{let t=this._viewState.read(e);return t?new M(t.hint.lineNumber,2**53-1):null}),this._lineSizesAroundHintPosition=L(this,e=>{let t=this._viewState.read(e),n=this._hintTextPosition.read(e);if(!t||!n)return[];let r=this._editorObs.model.read(e);if(!r)return[];let i=Uu.ofLength(n.lineNumber,1).addMargin(5,5).intersect(Uu.ofLength(1,r.getLineCount()));return i?GM(i,_j(this._editorObs,i,e),this._editorObs.observeTopForLineNumber(i.startLineNumber).read(e),this._editorObs,e):[]}),this._isVisibleDelayed=Pn(L(this,e=>this._viewState.read(e)?.hint.isVisible),(e,t)=>e===!0&&t===!1?200:0),this._previewEditorLayoutInfo=L(this,e=>{let t=this._viewState.read(e);if(!t||!this._isVisibleDelayed.read(e))return;let n=this._lineSizesAroundHintPosition.read(e);if(n.length===0)return;let r=this._editorObs.scrollTop.read(e),i=this._editorObs.scrollLeft.read(e),a=this._editorObs.layoutInfo.read(e),o=this._previewEditor.contentHeight.read(e),s=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(e);if(!o||!s)return;let c=a.contentWidth-a.verticalScrollbarWidth,l=a.contentLeft+c;if(!this._editorObs.cursorLineNumber.read(e))return;let u=QM,d=o+2,f,p,m=e=>e===t.hint.lineNumber?40:20;for(let e of n){let n=new WM(e,c,m);if(p=n,f=n.tryFindWidgetOutline(t.hint.lineNumber,d,l,u),f)break}let h=`empty-space`;if(!f){h=`overlay`;let e=Math.min(a.width-a.contentLeft,ZM.OVERLAY),r=p??new WM(n[0],c,m);f={horizontalWidgetRange:to.ofStartAndLength(l-e,e),verticalWidgetRange:r.getWidgetVerticalOutline(t.hint.lineNumber+2,d,u).delta(10)}}if(!f)return;let g=hA.fromRanges(f.horizontalWidgetRange,f.verticalWidgetRange).translateX(-i).translateY(-r),{previewEditorMargin:_,widgetPadding:v,widgetBorder:y,lowerBarHeight:b}=u,ee=Math.min(h===`overlay`?ZM.OVERLAY:ZM.EMPTY_SPACE,s.maxEditorWidth+_+v),te=NM(g.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:ee,priority:1}]},spaceAfter:{min:10}});if(!te)return null;let ne=eN([te.spaceBefore,te.content,te.spaceAfter],g.left);g.withHorizontalRange(ne[0]);let re=g.withHorizontalRange(ne[1]);g.withHorizontalRange(ne[2]);let ie=re.withMargin(-v-y-_).withMargin(0,0,-b,0),ae=ie.width-s.nonContentWidth,oe=ae*.8,se=s.preferredRangeToReveal.intersect(to.ofStartAndLength(s.preferredRangeToReveal.start,oe))??s.preferredRangeToReveal,ce=tN(s.indentationEnd,ae,se);return{codeEditorSize:ie.getSize(),codeScrollLeft:i,contentLeft:a.contentLeft,widgetRect:re,previewEditorMargin:_,widgetPadding:v,widgetBorder:y,lowerBarHeight:b,desiredPreviewEditorScrollLeft:ce.newScrollPosition}}),this._view=X.div({class:`inline-edits-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:L(this,e=>this._previewEditorLayoutInfo.read(e)?`block`:`none`)}},[L(this,e=>[this._widgetContent])]),this._widgetContent=L(this,e=>X.div({class:[`inline-edits-long-distance-hint-widget`,`show-file-icons`],style:{position:`absolute`,overflow:`hidden`,cursor:`pointer`,background:An(Eu),padding:this._previewEditorLayoutInfo.map(e=>e?.widgetPadding),boxSizing:`border-box`,borderRadius:XM,border:L(e=>`${this._previewEditorLayoutInfo.read(e)?.widgetBorder}px solid ${this._styles.read(e).border}`),display:`flex`,flexDirection:`column`,opacity:L(e=>this._viewState.read(e)?.hint.isVisible?`1`:`0`),transition:`opacity 200ms ease-in-out`,...Aj(e=>this._previewEditorLayoutInfo.read(e)?.widgetRect)},onmousedown:e=>{e.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[X.div({class:[`editorContainer`],style:{overflow:`hidden`,padding:this._previewEditorLayoutInfo.map(e=>e?.previewEditorMargin),background:this._styles.map(e=>e.background),pointerEvents:`none`}},[L(this,e=>this._previewEditor.element)]),X.div({class:`bar`,style:{color:An(p),pointerEvents:`none`,margin:`0 4px`,height:this._previewEditorLayoutInfo.map(e=>e?.lowerBarHeight),display:`flex`,justifyContent:`space-between`,alignItems:`center`}},[L(this,e=>{let t=[],n=this._viewState.read(e);if(!n)return t;let r=this._editorObs.model.read(e)?.uri,i=n.target.uri,a=i&&(!r||i.toString()!==r.toString());if(a){let e=Oc(i),n=xk(this._modelService,this._languageService,i,yk.FILE);t.push(X.div({class:`target-file`,style:{display:`flex`,alignItems:`center`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},[X.elem(`span`,{class:n,style:{flexShrink:`0`,marginRight:`4px`}}),e]))}else{let n=this._originalOutlineSource.read(e),r=this._originalTargetLineNumber.read(e),i=n?.getAt(r,e).slice(0,1)??[],a=[];if(i.length>0)for(let e=0;e<i.length;e++){let t=i[e],n=ui.toIcon(t.kind);a.push(X.div({class:`breadcrumb-item`,style:{display:`flex`,alignItems:`center`,flex:`1 1 auto`,whiteSpace:`nowrap`,overflow:`hidden`,textOverflow:`ellipsis`}},[ed(n),`\xA0`,t.name,...e===i.length-1?[]:[ed(D.chevronRight)]]))}t.push(X.div({class:`outline-elements`,style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}},a))}let o=this._originalTargetLineNumber.read(e),s=a?D.arrowRight:n.hint.lineNumber<o?D.arrowDown:D.arrowUp,c=this._keybindingService.lookupKeybinding(Dh),l=a?`Go to file`:`Go to suggestion`;return c&&c.getLabel()===`Tab`&&(l=a?`Tab to open`:`Tab to jump`),t.push(X.div({class:`go-to-label`,style:{position:`relative`,display:`flex`,alignItems:`center`,flex:`0 0 auto`,paddingLeft:`6px`}},[l,`\xA0`,ed(s)])),t})])])),this._originalTargetLineNumber=L(this,e=>{let t=this._viewState.read(e);return t?t.edit.action?.kind===`jumpTo`?t.edit.action.position.lineNumber:t.diff[0]?.original.startLineNumber??-1:-1}),this._originalOutlineSource=Hi(this,e=>{let t=this._editorObs.model.read(e),n=ta._breadcrumbsSourceFactory.read(e);return!t||!n?void 0:n(t,this._instantiationService)}),this._styles=L(e=>{let t=this._tabAction.read(e),n=hj(Ir,this._themeService).read(e),r=$u(this._themeService.onDidColorThemeChange,()=>{let e=this._themeService.getColorTheme();return e.type===`hcDark`||e.type===`hcLight`}).read(e),i;if(r)i=n;else{let n;switch(t){case ED.Inactive:n=nj;break;case ED.Jump:n=$A;break;case ED.Accept:n=aj;break}i=pj(n,this._themeService).read(e)}return{border:i.toString(),background:mj(this._viewState.map(e=>e?.editorType??FD.TextEditor).read(e))}}),this._editorObs=lu(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(VM,this._previewTextModel,L(e=>{let t=this._viewState.read(e);if(t)return{diff:t.diff,model:t.model,inlineSuggestInfo:t.inlineSuggestInfo,nextCursorPosition:t.nextCursorPosition,target:t.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:pc(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(k(e=>{let t=this._previewEditorLayoutInfo.read(e);t&&this._previewEditor.layout(t.codeEditorSize.toDimension(),t.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};$M=JM([YM(4,w),YM(5,Ll),YM(6,jr),YM(7,yt),YM(8,Zo)],$M);function eN(e,t=0){let n=[],r=t;for(let t of e)n.push(new to(r,r+t)),r+=t;return n}function tN(e,t,n){let r=new to(e,e+t);return r.containsRange(n)?{newScrollPosition:e}:n.length>t?{newScrollPosition:n.start}:n.endExclusive>r.endExclusive?{newScrollPosition:n.endExclusive-t}:n.start<r.start?{newScrollPosition:n.start}:{newScrollPosition:e}}var nN=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},rN=function(e,t){return function(n,r){t(n,r,e)}},iN=0,aN=0,oN=1,sN=1,cN=3,lN=3,uN=20,dN=12,fN=class extends j{static fitsInsideViewport(e,t,n,r){let i=lu(e),a=i.layoutInfoWidth.read(r),o=i.layoutInfoContentLeft.read(r),s=e.getLayoutInfo().verticalScrollbarWidth,c=i.layoutInfoMinimap.read(r).minimapLeft===0?0:i.layoutInfoMinimap.read(r).minimapWidth,l=gj(i,n.displayRange,void 0),u=n.lineEdit.newLines.reduce((n,r)=>Math.max(n,bj(r,e,t)),0),d=uN;return l+u+d+14<a-o-s-c}constructor(e,t,n,r,i,a,o,s){super(),this._editor=e,this._edit=t,this._previewTextModel=n,this._uiState=r,this._tabAction=i,this._instantiationService=a,this._themeService=o,this._userInteractionService=s,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._editorObs=lu(this._editor),this._display=L(this,e=>this._uiState.read(e)?`block`:`none`),this.previewRef=X.ref();let c=this._uiState.map(e=>e?.editorType===FD.DiffEditor?cN:sN);this._editorContainer=X.div({class:[`editorContainer`],style:{position:`absolute`,overflow:`hidden`,cursor:`pointer`},onmousedown:e=>{e.preventDefault()},onclick:e=>{this._onDidClick.fire(DD.create(e))}},[X.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(Av,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:{[pw.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=lu(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=L(this,e=>{this._editorContainer.readEffect(e),this._previewEditorObs.model.read(e),this._display.read(e),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(e));let t=this._uiState.read(e),n=this._edit.read(e);if(!t||!n)return;let r=n.originalLineRange,i=[];r.startLineNumber>1&&i.push(new T(1,1,r.startLineNumber-1,1)),r.startLineNumber+t.newTextLineCount<this._previewTextModel.getLineCount()+1&&i.push(new T(r.startLineNumber+t.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(i,void 0,!0);let a=[...this._activeViewZones];this._activeViewZones=[];let o=r.endLineNumberExclusive-r.startLineNumber-t.newTextLineCount;this.previewEditor.changeViewZones(e=>{a.forEach(t=>e.removeZone(t)),o>0&&this._activeViewZones.push(e.addZone({afterLineNumber:r.startLineNumber+t.newTextLineCount-1,heightInLines:o,showInHiddenAreas:!0,domNode:I(`div.diagonal-fill.inline-edits-view-zone`)}))})}),this._previewEditorWidth=L(this,e=>{let t=this._edit.read(e);return t?(this._updatePreviewEditor.read(e),gj(this._previewEditorObs,t.modifiedLineRange,e)):0}),this._cursorPosIfTouchesEdit=L(this,e=>{let t=this._editorObs.cursorPosition.read(e),n=this._edit.read(e);if(!(!n||!t))return n.modifiedLineRange.contains(t.lineNumber)?t:void 0}),this._originalStartPosition=L(this,e=>{let t=this._edit.read(e);return t?new M(t.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=L(this,e=>{let t=this._edit.read(e);return t?new M(t.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(e=>e?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(e=>e?.y),this._originalDisplayRange=this._edit.map(e=>e?.displayRange),this._editorMaxContentWidthInRange=L(this,e=>{let t=this._originalDisplayRange.read(e);return t?(this._editorObs.versionId.read(e),ir(this,(e,n)=>{let r=gj(this._editorObs,t,e);return Math.max(r,n??0)})):pc(0)}).map((e,t)=>e.read(t));let l=jj(this._editor,this._store);this._previewEditorLayoutInfo=L(this,e=>{let t=this._edit.read(e);if(!t||!this._uiState.read(e))return null;let n=t.originalLineRange,r=this._editorObs.scrollLeft.read(e),i=this._editorMaxContentWidthInRange.read(e),a=this._editorObs.layoutInfo.read(e),o=this._previewEditorWidth.read(e),s=a.contentWidth-a.verticalScrollbarWidth,c=l.read(e),u=a.contentLeft+a.contentWidth+c.left,d=_a(this._editor.getContainerDomNode()).innerWidth-u,f=_a(this._editor.getContainerDomNode()).innerWidth-c.right,p=Math.min(a.contentWidth*.3,o,100),m=0+d,h=this._cursorPosIfTouchesEdit.read(e),g=Math.max(s+r-0-Math.max(0,p-m),Math.min(h?vj(this._editorObs,h,e)+50:0,s+r)),_=Math.min(i+uN,g),v=i+uN+o+70,y=g-_,b,ee;_>r?(b=0,ee=a.contentLeft+_-r):(b=r-_,ee=a.contentLeft);let te=this._originalVerticalStartPosition.read(e)??this._editor.getTopForLineNumber(n.startLineNumber)-this._editorObs.scrollTop.read(e),ne=this._originalVerticalEndPosition.read(e)??this._editor.getBottomForLineNumber(n.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(e),re=a.contentLeft-r,ie=hA.fromLeftTopRightBottom(re,te,ee,ne),ae=ie.height===0;ae||(ie=ie.withMargin(aN,iN));let oe=this._previewEditorObs.observeLineHeightsForLineRange(t.modifiedLineRange).read(e).reduce((e,t)=>e+t,0),se=ne-te,ce=Math.max(se,oe),le=y===0,ue=Math.min(o+dN,f+a.width-a.contentLeft-0),de=hA.fromLeftTopWidthHeight(ie.right+0,te,ue,ce);return de=ae?de.withMargin(aN,iN).translateY(aN):de.withMargin(aN,iN).translateX(1),{codeRect:ie,editRect:de,codeScrollLeft:r,contentLeft:a.contentLeft,isInsertion:ae,maxContentWidth:v,shouldShowShadow:le,desiredPreviewEditorScrollLeft:b,previewEditorWidth:ue}}),this._stickyScrollController=GA.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?$u(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):pc(0),this._shouldOverflow=L(this,e=>!1),this._originalBackgroundColor=$u(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(KA)??W.transparent),this._editorBackgroundColor=this._uiState.map(e=>mj(e?.editorType??FD.TextEditor)),this._backgroundSvg=X.svg({transform:`translate(-0.5 -0.5)`,style:{overflow:`visible`,pointerEvents:`none`,position:`absolute`}},[X.svgElem(`path`,{class:`rightOfModifiedBackgroundCoverUp`,d:L(this,e=>{let t=this._previewEditorLayoutInfo.read(e);if(t&&!this._originalBackgroundColor.read(e).isTransparent())return new Oj().moveTo(t.codeRect.getRightTop()).lineTo(t.codeRect.getRightTop().deltaX(1e3)).lineTo(t.codeRect.getRightBottom().deltaX(1e3)).lineTo(t.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=X.div({style:{pointerEvents:`none`,display:this._previewEditorLayoutInfo.map(e=>e?.isInsertion?`none`:`block`)}},L(this,e=>{let t=kj(this._previewEditorLayoutInfo).read(e);if(!t)return;let n=this._editorBackgroundColor.read(e),r=c.read(e),i=fj(this._tabAction).map(e=>`${oN}px solid ${An(e)}`),a=`${oN+r}px solid ${n}`,o=t.read(e).codeScrollLeft!==0,s=t.map(e=>e.codeRect.bottom<e.editRect.bottom),l=lN*2+oN*2,u=t.map(e=>hA.fromLeftTopRightBottom(e.contentLeft-lN-oN,e.codeRect.top,e.contentLeft,e.codeRect.bottom+l)).read(e),d=new to(u.left,2**53-1),f=t.map(e=>e.codeRect.intersectHorizontal(d)),p=f.map(e=>e.withMargin(r,0,r,r).intersectHorizontal(d)),m=f.map(e=>hA.fromLeftTopWidthHeight(e.right-l+oN,e.bottom-oN,l,l).intersectHorizontal(d));return[X.div({class:`originalSeparatorSideBySide`,style:{...p.read(e).toStyles(),boxSizing:`border-box`,borderRadius:`${lN}px 0 0 ${lN}px`,borderTop:a,borderBottom:a,borderLeft:o?`none`:a}}),X.div({class:`originalOverlaySideBySide`,style:{...f.read(e).toStyles(),boxSizing:`border-box`,borderRadius:`${lN}px 0 0 ${lN}px`,borderTop:i,borderBottom:i,borderLeft:o?`none`:i,backgroundColor:An(KA)}}),X.div({class:`originalCornerCutoutSideBySide`,style:{pointerEvents:`none`,display:s.map(e=>e?`block`:`none`),...m.read(e).toStyles()}},[X.div({class:`originalCornerCutoutBackground`,style:{position:`absolute`,top:`0px`,left:`0px`,width:`100%`,height:`100%`,backgroundColor:pj(KA,this._themeService).map(e=>e.toString())}}),X.div({class:`originalCornerCutoutBorder`,style:{position:`absolute`,top:`0px`,left:`0px`,width:`100%`,height:`100%`,boxSizing:`border-box`,borderTop:i,borderRight:i,borderRadius:`0 100% 0 0`,backgroundColor:n}})]),X.div({class:`originalOverlaySideBySideHider`,style:{...u.toStyles(),backgroundColor:n}})]})).keepUpdated(this._store),this._modifiedOverlay=X.div({style:{pointerEvents:`none`}},L(this,e=>{let t=kj(this._previewEditorLayoutInfo).read(e);if(!t)return;let n=t.map(e=>e.codeRect.bottom<e.editRect.bottom),r=this._editorBackgroundColor.read(e),i=c.read(e),a=n.map(e=>`0 ${lN}px ${lN}px ${e?lN:0}px`),o=pj(dj(this._tabAction),this._themeService).map(e=>`1px solid ${e.toString()}`),s=`${oN+i}px solid ${r}`,l=t.map(e=>e.editRect.withMargin(0,oN)),u=l.map(e=>e.withMargin(i,i,i,0)),d=L(this,e=>{let n=l.read(e),r=t.read(e);return!r.isInsertion||r.contentLeft>=n.left?hA.fromLeftTopWidthHeight(n.left,n.top,0,0):new hA(r.contentLeft,n.top,n.left,n.top+oN*2)});return[X.div({class:`modifiedInsertionSideBySide`,style:{...d.read(e).toStyles(),backgroundColor:dj(this._tabAction).map(e=>An(e))}}),X.div({class:`modifiedSeparatorSideBySide`,style:{...u.read(e).toStyles(),borderRadius:a,borderTop:s,borderBottom:s,borderRight:s,boxSizing:`border-box`}}),X.div({class:`modifiedOverlaySideBySide`,style:{...l.read(e).toStyles(),borderRadius:a,border:o,boxSizing:`border-box`,backgroundColor:An(qA)}})]})).keepUpdated(this._store),this._nonOverflowView=X.div({class:`inline-edits-view`,style:{position:`absolute`,overflow:`visible`,top:`0px`,left:`0px`,display:this._display}},[this._backgroundSvg,L(this,e=>this._shouldOverflow.read(e)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:pc(null),allowEditorOverflow:!1,minContentWidthInPx:L(this,e=>{let t=this._previewEditorLayoutInfo.read(e)?.maxContentWidth;return t===void 0?0:t})})),this.previewEditor.setModel(this._previewTextModel),this._register(k(e=>{let t=this._previewEditorLayoutInfo.read(e);if(!t)return;let n=t.editRect.withMargin(-0,-0);this.previewEditor.layout({height:n.height,width:t.previewEditorWidth+15}),this._editorContainer.element.style.top=`${n.top}px`,this._editorContainer.element.style.left=`${n.left}px`,this._editorContainer.element.style.width=`${t.previewEditorWidth+iN}px`})),this._register(k(e=>{let t=this._previewEditorLayoutInfo.read(e);t&&this._previewEditorObs.editor.setScrollLeft(t.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}};fN=nN([rN(5,w),rN(6,Ll),rN(7,Pt)],fN);var pN=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},mN=function(e,t){return function(n,r){t(n,r,e)}},hN=class{constructor(e,t,n){this.edit=e,this.editorType=t,this.alternativeAction=n}equals(e){return this.edit.equals(e.edit)&&this.alternativeAction===e.alternativeAction}},gN=1,_N=`word-replacement-view-overlay`,vN=`word-replacement-view-widget`,yN=`word-replacement-view-replacement`,bN=`word-replacement-view-rename`,xN=class extends j{static{this.MAX_LENGTH=100}constructor(e,t,n,r,i,a,o,s){super(),this._editor=e,this._viewData=t,this._tabAction=n,this._languageService=r,this._themeService=i,this._keybindingService=a,this._hoverService=o,this._userInteractionService=s,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this._start=this._editor.observePosition(pc(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(pc(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement(`div`),this._primaryElement=St(this,null),this._secondaryElement=St(this,null),this.isHovered=L(this,e=>{let t=this._primaryElement.read(e);return t?this._userInteractionService.createHoverTracker(t.element,e.store).read(e):!1}),this._renderTextEffect=L(this,e=>{let t=this._editor.model.read(void 0);if(!t)return;let n=t.getLineContent(this._viewData.edit.range.startLineNumber),r=ec.replace(new to(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),i=r.replace(n),a=t.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[i])?.[0],o;o=a?Ic.fromLineTokens(a).slice(r.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec):Ma.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let s=Ue(new yu([o]),Qr.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${s.minWidthInPx}px`});let c=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),l=jt(this._viewData.alternativeAction?.count??new Promise(e=>e(void 0))).map(e=>e.value),u=L(this,e=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),e).shiftKey);this._layout=L(this,e=>{this._renderTextEffect.read(e);let t=this._start.read(e),n=this._end.read(e);if(!t||!n||t.x>n.x||t.y>n.y)return;let r=c.read(e);if(r<=0)return;let i=this._editor.scrollLeft.read(e),a=this._editor.getOption(59).read(e).typicalHalfwidthCharacterWidth,o=new Hu(3*a,4),s;if(this._viewData.alternativeAction){let t=this._viewData.alternativeAction.label,n=l.read(e),r=u.read(e),i=n===void 0?t:n===1?V(1263,`{0} 1 occurrence`,t):V(1264,`{0} {1} occurrences`,t,n),a=V(1265,`{0} show occurrences`,`[shift]`);s={label:n===void 0?t:r?i:t,tooltip:i?`${i}\n${a}`:void 0,icon:void 0,count:n,keybinding:this._keybindingService.lookupKeybinding(wh),active:u}}let d=hA.fromPoints(t,n).withHeight(r).translateX(-i),f=hA.fromPointSize(d.getLeftBottom().add(o),new Hu(this._viewData.edit.text.length*a,d.height)),p=f.withWidth(f.width+(s?s.label.length*a+8+4+12:0)),m=p.withLeft(d.left);return{alternativeAction:s,originalLine:d,codeLine:f,modifiedLine:p,lowerBackground:m,lineHeight:r}}),this.minEditorScrollHeight=L(this,e=>{let t=kj(this._layout).read(e);return t?t.read(e).modifiedLine.bottom+gN+this._editor.editor.getScrollTop():0}),this._root=X.div({class:`word-replacement`},[L(this,e=>{let t=kj(this._layout).read(e);if(!t)return[];let n=fj(this._tabAction).map(e=>An(e)).read(e),r=dj(this._tabAction).map(e=>An(e)).read(e);this._line.style.lineHeight=`${t.read(e).modifiedLine.height+2*gN}px`;let i=pc(!1),a=t.map(e=>e.alternativeAction),o=L(e=>(a.read(e)?.active.read(e)??!1)||i.read(e)),s=$u(this._themeService.onDidColorThemeChange,()=>{let e=this._themeService.getColorTheme();return e.type===`hcDark`||e.type===`hcLight`}).read(e)?hj(Is,this._themeService).read(e):null,c={borderColor:s?s.toString():r,backgroundColor:An(XA),color:``,opacity:`1`},l={borderColor:s?s.toString():An(QA),backgroundColor:An($A),color:An(ZA),opacity:`1`},u={borderColor:s?s.toString():hj(Ka,this._themeService).map(e=>e.transparent(.2).toString()).read(e),backgroundColor:mj(this._viewData.editorType),color:``,opacity:`0.7`},d=mj(this._viewData.editorType),f=L(this,e=>(o.read(e),c)),p=L(this,e=>o.read(e)?l:u);return[X.div({id:_N,style:{position:`absolute`,...Aj(e=>xj(this._editor).read(e)),overflow:`hidden`,pointerEvents:`none`}},[X.div({style:{position:`absolute`,...Aj(e=>t.read(e).lowerBackground.withMargin(gN,2*gN,gN,0)),background:d,cursor:`pointer`,pointerEvents:`auto`},onmousedown:e=>this._mouseDown(e)}),X.div({id:vN,style:{position:`absolute`,...Aj(e=>t.read(e).modifiedLine.withMargin(gN,2*gN)),width:void 0,pointerEvents:`auto`,boxSizing:`border-box`,borderRadius:`3px`,background:d,display:`flex`,justifyContent:`left`,outline:`2px solid ${d}`},onmousedown:e=>this._mouseDown(e)},[X.div({id:yN,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:Aj(e=>t.read(e).codeLine.withMargin(gN,2*gN)).width,borderRadius:`3px`,border:f.map(e=>`${gN}px solid ${e.borderColor}`),boxSizing:`border-box`,padding:`${gN}px`,opacity:f.map(e=>e.opacity),background:f.map(e=>e.backgroundColor),display:`flex`,justifyContent:`left`,alignItems:`center`,pointerEvents:`auto`,cursor:`pointer`},obsRef:e=>{this._primaryElement.set(e,void 0)}},[this._line]),L(this,e=>{let t=a.read(e);if(!t)return;let n=document.createElement(`div`);return e.store.add(new Cu(n,Zu,{...ni,disableTitle:!0})).set(t.keybinding),X.div({id:bN,style:{position:`relative`,borderRadius:`3px`,borderTop:`${gN}px solid`,borderRight:`${gN}px solid`,borderBottom:`${gN}px solid`,borderLeft:`${gN}px solid`,borderColor:p.map(e=>e.borderColor),opacity:p.map(e=>e.opacity),color:p.map(e=>e.color),display:`flex`,justifyContent:`center`,alignItems:`center`,padding:`0 4px 0 1px`,marginLeft:`4px`,background:p.map(e=>e.backgroundColor),cursor:`pointer`,textWrap:`nowrap`},class:`inline-edit-alternative-action-label`,obsRef:e=>{this._secondaryElement.set(e,void 0)},ref:n=>{t.tooltip&&e.store.add(this._hoverService.setupDelayedHoverAtMouse(n,{content:t.tooltip,appearance:{compact:!0}}))}},[n,I(`div.inline-edit-alternative-action-label-separator`),t.icon?ed(t.icon):void 0,t.label])})]),X.div({style:{position:`absolute`,...Aj(e=>t.read(e).originalLine.withMargin(gN)),boxSizing:`border-box`,borderRadius:`3px`,border:`${gN}px solid ${n}`,background:An(JA),pointerEvents:`none`}},[]),X.svg({width:11,height:14,viewBox:`0 0 11 14`,fill:`none`,style:{position:`absolute`,left:t.map(e=>e.modifiedLine.left-16),top:t.map(e=>e.modifiedLine.top+Math.round((e.lineHeight-14-5)/2)),pointerEvents:`none`},onmousedown:e=>this._mouseDown(e)},[X.svgElem(`path`,{d:`M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5`,stroke:An(Ka)}),X.svgElem(`path`,{d:`M6 7.5L9.99999 10.49998L6 13.5`,stroke:An(Ka)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:pc(0),position:pc({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_mouseDown(e){let t=SN(e.target,new Set([vN,yN,bN,_N]));t&&(e.preventDefault(),this._onDidClick.fire(DD.create(e,t===bN)))}};xN=pN([mN(3,Zo),mN(4,Ll),mN(5,jr),mN(6,fa),mN(7,Pt)],xN);function SN(e,t){let n=e;for(;n;){if(t.has(n.id))return n.id;n=n.parentElement}return null}var CN=class extends j{constructor(e,t,n){super(),this._originalEditor=e,this._state=t,this._modifiedTextModel=n,this._onDidClick=this._register(new U),this.onDidClick=this._onDidClick.event,this.isHovered=lu(this._originalEditor).isTargetHovered(e=>e.target.type===6&&e.target.detail.injectedText?.options.attachedData instanceof wN&&e.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=DN(this._modifiedTextModel),this._decorations=L(this,e=>{let t=this._state.read(e);if(!t)return;let n=t.modifiedText,r=t.mode===`insertionInline`,i=t.diff.length===1&&t.diff[0].innerChanges?.length===1,a=[],o=[],s=Y.register({className:`inlineCompletions-line-insert`,description:`line-insert`,isWholeLine:!0,marginClassName:`gutter-insert`}),c=Y.register({className:`inlineCompletions-line-delete`,description:`line-delete`,isWholeLine:!0,marginClassName:`gutter-delete`}),l=Y.register({className:`inlineCompletions-char-delete`,description:`char-delete`,isWholeLine:!1,zIndex:1}),u=Y.register({className:`inlineCompletions-char-insert`,description:`char-insert`,isWholeLine:!0}),d=Y.register({className:`inlineCompletions-char-insert`,description:`char-insert`,shouldFillLineOnLineBreak:!0}),f=Y.register({className:`inlineCompletions-char-insert diff-range-empty`,description:`char-insert diff-range-empty`}),p=Y.register({className:`inlineCompletions-original-lines`,description:`inlineCompletions-original-lines`,isWholeLine:!1,shouldFillLineOnLineBreak:!0}),m=t.mode!==`sideBySide`&&t.mode!==`deletion`&&t.mode!==`insertionInline`&&t.mode!==`lineReplacement`,h=t.mode===`lineReplacement`;for(let p of t.diff)if(m&&(p.original.isEmpty||a.push({range:p.original.toInclusiveRange(),options:c}),p.modified.isEmpty||o.push({range:p.modified.toInclusiveRange(),options:s})),p.modified.isEmpty||p.original.isEmpty)p.original.isEmpty||a.push({range:p.original.toInclusiveRange(),options:l}),p.modified.isEmpty||o.push({range:p.modified.toInclusiveRange(),options:u});else{let s=r&&TN(p);for(let r of p.innerChanges||[]){if(p.original.contains(r.originalRange.startLineNumber)&&!(h&&r.originalRange.isEmpty())){let e=this._originalEditor.getModel()?.getValueInRange(r.originalRange,1);a.push({range:r.originalRange,options:{description:`char-delete`,shouldFillLineOnLineBreak:!1,className:Cj(`inlineCompletions-char-delete`,r.originalRange.isSingleLine()&&t.mode===`insertionInline`&&`single-line-inline`,r.originalRange.isEmpty()&&`empty`,(r.originalRange.isEmpty()&&i||t.mode===`deletion`&&e===`
39
+ `)&&!s&&`diff-range-empty`),inlineClassName:s?Cj(`strike-through`,`inlineCompletions`):null,zIndex:1}})}if(p.modified.contains(r.modifiedRange.startLineNumber)&&o.push({range:r.modifiedRange,options:r.modifiedRange.isEmpty()&&!s&&i?f:d}),s){let i=n.getValueOfRange(r.modifiedRange),o=i.length>3?[{text:i.slice(0,1),extraClasses:[`start`],offsetRange:new to(r.modifiedRange.startColumn-1,r.modifiedRange.startColumn)},{text:i.slice(1,-1),extraClasses:[],offsetRange:new to(r.modifiedRange.startColumn,r.modifiedRange.endColumn-2)},{text:i.slice(-1),extraClasses:[`end`],offsetRange:new to(r.modifiedRange.endColumn-2,r.modifiedRange.endColumn-1)}]:[{text:i,extraClasses:[`start`,`end`],offsetRange:new to(r.modifiedRange.startColumn-1,r.modifiedRange.endColumn)}];this._tokenizationFinished.read(e);let s=this._modifiedTextModel.tokenization.getLineTokens(r.modifiedRange.startLineNumber);for(let{text:e,extraClasses:n,offsetRange:i}of o)a.push({range:T.fromPositions(r.originalRange.getEndPosition()),options:{description:`inserted-text`,before:{tokens:s.getTokensInRange(i),content:e,inlineClassName:Cj(`inlineCompletions-char-insert`,r.modifiedRange.isSingleLine()&&t.mode===`insertionInline`&&`single-line-inline`,...n),cursorStops:we.None,attachedData:new wN(this)},zIndex:2,showIfCollapsed:!0}})}}}if(t.editorType===FD.DiffEditor)for(let e of t.diff)e.original.isEmpty||a.push({range:e.original.toExclusiveRange(),options:p});return{originalDecorations:a,modifiedDecorations:o}}),this._register(lu(this._originalEditor).setDecorations(this._decorations.map(e=>e?.originalDecorations??[])));let r=this._state.map(e=>e?.modifiedCodeEditor);this._register(Ht((e,t)=>{let n=r.read(e);n&&t.add(lu(n).setDecorations(this._decorations.map(e=>e?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(e=>{if(e.target.type!==6)return;let t=e.target.detail.injectedText?.options.attachedData;t instanceof wN&&t.owner===this&&this._onDidClick.fire(new DD(e.event))}))}},wN=class{constructor(e){this.owner=e}};function TN(e){return e.innerChanges?e.innerChanges.every(e=>Ba(e.modifiedRange)&&Ba(e.originalRange)):!1}var EN=0;function DN(e){return $u(e.onDidChangeTokens,()=>EN++)}var ON=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},kN=function(e,t){return function(n,r){t(n,r,e)}},AN=class extends j{constructor(e,t,n,r,i,a){super(),this._editor=e,this._model=t,this._simpleModel=n,this._inlineSuggestInfo=r,this._showCollapsed=i,this._instantiationService=a,this._tabAction=L(e=>this._model.read(e)?.tabAction.read(e)??ED.Inactive),this.displayRange=L(this,e=>{let t=this._uiState.read(e);if(t&&t.target.uri.toString()===this._editorObs.model.read(e)?.uri.toString()){if(t.state?.kind===`custom`){let e=t.state.displayLocation?.range;if(!e)throw new Xs(`custom view should have a range`);return new Uu(e.startLineNumber,e.endLineNumber)}return t.state?.kind===`insertionMultiLine`?this._insertion.originalLines.read(e):t.edit.displayRange}}),this._currentInlineEditCache=void 0,this._uiState=L(this,e=>{let t=this._model.read(e),n=this._editorObs.model.read(e);if(!t||!n||!this._constructorDone.read(e))return;let r=t.inlineEdit,i,a,o;r.edit?(a=fo.fromEdit(r.edit),o=new Yo(r.edit.apply(r.originalText)),i=Io(a,r.originalText,o)):(a=[],i=[],o=r.originalText);let s=this._determineRenderState(t,e,i,o);if(!s){Hc(Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}let c=this._getLongDistanceHintState(t,e);if(c&&c.isVisible&&s.viewData.setLongDistanceViewData(c.lineNumber,r.lineEdit.lineRange.startLineNumber),s.kind===$.SideBySide){let e=Dj(o.getValue(),r.modifiedLineRange,n.getOptions().tabSize);o=new Yo(e.applyToString(o.getValue())),a=Sj(a,e),i=Io(a,r.originalText,o)}this._previewTextModel.setLanguage(n.getLanguageId());let l=this._previewTextModel.getValue();if(l!==o.getValue()){this._previewTextModel.setEOL(n.getEndOfLineSequence());let e=$a.replace(new to(0,l.length),o.getValue()).removeCommonSuffixPrefix(l),t=fE(this._previewTextModel).getTextEdit(e);this._previewTextModel.edit(t)}this._showCollapsed.read(e)&&(s={kind:$.Collapsed,viewData:s.viewData}),t.handleInlineEditShownNextFrame(s.kind,s.viewData);let u=r.action?.kind===`jumpTo`?r.action.position:null;return{state:s,diff:i,edit:r,newText:o.getValue(),newTextLineCount:r.modifiedLineRange.length,editorType:t.editorType,longDistanceHint:c,nextCursorPosition:u,target:r.inlineCompletion.originalTextRef}}),this.inlineEditsIsHovered=L(this,e=>this._sideBySide.isHovered.read(e)||this._wordReplacementViews.read(e).some(t=>t.isHovered.read(e))||this._deletion.isHovered.read(e)||this._inlineDiffView.isHovered.read(e)||this._lineReplacementView.isHovered.read(e)||this._insertion.isHovered.read(e)||this._customView.isHovered.read(e)||this._longDistanceHint.map((e,t)=>e?.isHovered.read(t)??!1).read(e)),this.gutterIndicatorOffset=L(this,e=>this._uiState.read(e)?.state?.kind===`insertionMultiLine`?this._insertion.startLineOffset.read(e):0),this._editorObs=lu(this._editor),this._constructorDone=St(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(Wu,``,this._editor.getModel().getLanguageId(),{...Wu.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(fN,this._editor,this._model.map(e=>e?.inlineEdit),this._previewTextModel,this._uiState.map(e=>e&&e.state?.kind===$.SideBySide?{newTextLineCount:e.newTextLineCount,editorType:e.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(xM,this._editor,this._model.map(e=>e?.inlineEdit),this._uiState.map(e=>e&&e.state?.kind===$.Deletion?{originalRange:e.state.originalRange,deletions:e.state.deletions,editorType:e.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(OM,this._editor,this._uiState.map(e=>e&&e.state?.kind===$.InsertionMultiLine?{lineNumber:e.state.lineNumber,startColumn:e.state.column,text:e.state.text,editorType:e.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(sM,this._editor,this._model.map((e,t)=>this._uiState.read(t)?.state?.kind===$.Collapsed?e?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(mM,this._editor,this._model.map((e,t)=>this._uiState.read(t)?.state?.kind===$.Custom?e?.displayLocation:void 0),this._tabAction,this._uiState.map(e=>e?.editorType??FD.TextEditor))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,e=>e.edits.showLongDistanceHint),this._longDistanceHint=L(this,e=>{if(this._showLongDistanceHint.read(e))return e.store.add(this._instantiationService.createInstance($M,this._editor,this._uiState.map((e,t)=>e?.longDistanceHint?{hint:e.longDistanceHint,newTextLineCount:e.newTextLineCount,edit:e.edit,diff:e.diff,editorType:e.editorType,model:this._simpleModel.read(t),inlineSuggestInfo:this._inlineSuggestInfo.read(t),nextCursorPosition:e.nextCursorPosition,target:e.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=L(this,e=>{let t=this._uiState.read(e);if(!(!t||!t.state)&&!(t.state.kind===`wordReplacements`||t.state.kind===`insertionMultiLine`||t.state.kind===`collapsed`||t.state.kind===`custom`||t.state.kind===`jumpTo`))return{modifiedText:new Yo(t.newText),diff:t.diff,mode:t.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:t.editorType}}),this._inlineDiffView=this._register(new CN(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(IM,this._editorObs,{style:`label`},L(e=>{let t=this._uiState.read(e);if(t?.state?.kind===$.JumpTo)return{jumpToPosition:t.state.position}})));let o=gr({equalsFn:bl.arrayC(bl.thisC())},e=>{let t=this._uiState.read(e);return t?.state?.kind===$.WordReplacements?t.state.replacements.map(e=>new hN(e,t.editorType,t.state?.alternativeAction)):[]});this._wordReplacementViews=$e(this,o,(e,t)=>t.add(this._instantiationService.createInstance(xN,this._editorObs,e,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(jM,this._editorObs,this._uiState.map(e=>e?.state?.kind===$.LineReplacement?{originalRange:e.state.originalRange,modifiedRange:e.state.modifiedRange,modifiedLines:e.state.modifiedLines,replacements:e.state.replacements}:void 0),this._uiState.map(e=>e?.editorType??FD.TextEditor),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(e=>e.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(e=>e.edits.renderSideBySide),this._register(k(e=>{let t=this._model.read(e);t&&e.store.add(Du.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(e).map(e=>e.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(e=>{this._viewHasBeenShownLongerThan(350)&&(e.event.preventDefault(),t.accept(e.alternativeAction))}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);let s=L(this,e=>Math.max(...this._wordReplacementViews.read(e).map(t=>t.minEditorScrollHeight.read(e)),this._lineReplacementView.minEditorScrollHeight.read(e),this._customView.minEditorScrollHeight.read(e))).recomputeInitiallyAndOnChange(this._store),c;this._register(k(e=>{let t=s.read(e),n=this._editorObs.model.read(e);n&&this._editor.changeViewZones(e=>{let r=t-this._editor.getScrollHeight()+1;r!==0&&c!==void 0&&(e.removeZone(c),c=void 0),!(r<=0)&&(c=e.addZone({afterLineNumber:n.getLineCount(),heightInPx:r,domNode:I(`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 e.inlineEdit.originalText.uri.toString()===this._editorObs.model.read(t)?.uri.toString()?(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)}):{isVisible:!0,lineNumber:e.inlineEdit.cursorPosition.lineNumber}}_getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}_determineView(e,t,n,r){let i=e.inlineEdit,a=this._previousView?.id===this._getCacheId(e)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),o=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view===$.SideBySide||this._previousView?.view===$.LineReplacement);if(a&&!o)return this._previousView.view;let s=e.inlineEdit.inlineCompletion.action;if(s?.kind===`edit`&&s.alternativeAction)return $.WordReplacements;let c=e.inlineEdit.inlineCompletion.originalTextRef.uri,l=this._editorObs.model.read(t)?.uri;if(l&&c.toString()!==l.toString()||e.displayLocation&&!e.inlineEdit.inlineCompletion.identity.jumpedTo.read(t))return $.Custom;let u=i.originalLineRange.length,d=i.modifiedLineRange.length,f=n.flatMap(e=>e.innerChanges??[]),p=f.length===1;if(e.editorType!==FD.DiffEditor){if(p&&this._useCodeShifting.read(t)!==`never`&&NN(n))return PN(n,i.cursorPosition)?$.InsertionInline:$.LineReplacement;if(IN(f,i,r))return $.Deletion;if(FN(n)&&this._useCodeShifting.read(t)===`always`)return $.InsertionMultiLine;if(f.every(e=>uu.ofRange(e.originalRange).columnCount<xN.MAX_LENGTH&&uu.ofRange(e.modifiedRange).columnCount<xN.MAX_LENGTH)&&p&&u===1&&d===1){let t=f.map(e=>r.getValueOfRange(e.modifiedRange)),n=f.map(t=>e.inlineEdit.originalText.getValueOfRange(t.originalRange));if(!t.some(e=>e.includes(` `))&&!n.some(e=>e.includes(` `))&&(!f.some(e=>e.originalRange.isEmpty())||!RN(f.map(e=>new fc(e.originalRange,``)),i.originalText).some(e=>e.range.isEmpty()&&uu.ofRange(e.range).columnCount<xN.MAX_LENGTH)))return $.WordReplacements}}if(u>0&&d>0)return u===1&&d===1&&e.editorType!==FD.DiffEditor?$.LineReplacement:this._renderSideBySide.read(t)!==`never`&&fN.fitsInsideViewport(this._editor,this._previewTextModel,i,t)?$.SideBySide:$.LineReplacement;if(e.editorType===FD.DiffEditor){if(IN(f,i,r))return $.Deletion;if(FN(n)&&this._useCodeShifting.read(t)===`always`)return $.InsertionMultiLine}return $.SideBySide}_determineRenderState(e,t,n,r){if(e.inlineEdit.action?.kind===`jumpTo`)return{kind:$.JumpTo,position:e.inlineEdit.action.position,viewData:jN};let i=e.inlineEdit,a=this._determineView(e,t,n,r);if(this._willRenderAboveCursor(t,i,a))switch(a){case $.LineReplacement:case $.WordReplacements:a=$.SideBySide;break}this._previousView={id:this._getCacheId(e),view:a,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};let o=n.flatMap(e=>e.innerChanges??[]),s=this._editor.getModel(),c=o.map(e=>({originalRange:e.originalRange,modifiedRange:e.modifiedRange,original:i.originalText.getValueOfRange(e.originalRange),modified:r.getValueOfRange(e.modifiedRange)})),l=MN(i,c,s);switch(a){case $.InsertionInline:return{kind:$.InsertionInline,viewData:l};case $.SideBySide:return{kind:$.SideBySide,viewData:l};case $.Collapsed:return{kind:$.Collapsed,viewData:l};case $.Custom:return{kind:$.Custom,displayLocation:e.displayLocation,viewData:l}}if(a===$.Deletion)return{kind:$.Deletion,originalRange:i.originalLineRange,deletions:o.map(e=>e.originalRange),viewData:l};if(a===$.InsertionMultiLine){let e=o[0];return{kind:$.InsertionMultiLine,lineNumber:e.originalRange.startLineNumber,column:e.originalRange.startColumn,text:r.getValueOfRange(e.modifiedRange),viewData:l}}let u=c.map(e=>new fc(e.originalRange,e.modified));if(u.length!==0){if(a===$.WordReplacements){let t=LN(u,i.originalText);return t.some(e=>e.range.isEmpty())&&(t=RN(u,i.originalText)),{kind:$.WordReplacements,replacements:t,alternativeAction:e.inlineEdit.action?.alternativeAction,viewData:l}}if(a===$.LineReplacement)return{kind:$.LineReplacement,originalRange:i.originalLineRange,modifiedRange:i.modifiedLineRange,modifiedLines:i.modifiedLineRange.mapToLineArray(e=>r.getLineAt(e)),replacements:o.map(e=>({originalRange:e.originalRange,modifiedRange:e.modifiedRange})),viewData:l}}}_willRenderAboveCursor(e,t,n){if(this._useCodeShifting.read(e)===`always`)return!1;for(let e of t.multiCursorPositions)if(n===$.WordReplacements&&e.lineNumber===t.originalLineRange.startLineNumber+1||n===$.LineReplacement&&e.lineNumber>=t.originalLineRange.endLineNumberExclusive&&e.lineNumber<t.modifiedLineRange.endLineNumberExclusive+t.modifiedLineRange.length)return!0;return!1}_viewHasBeenShownLongerThan(e){let t=this._previousView?.timestamp;if(!t)throw new Xs(`viewHasBeenShownLongThan called before a view has been shown`);return Date.now()-t>=e}};AN=ON([kN(5,w)],AN);var jN=new OD(-1,-1,-1,-1,-1,-1,-1,!0);function MN(e,t,n){if(!e.edit)return jN;let r=e.cursorPosition,i=t.length===0?!1:t[0].modified.startsWith(n.getEOL());return new OD(e.edit.replacements.length===0?0:e.edit.replacements[0].range.getStartPosition().column-r.column,e.lineEdit.lineRange.startLineNumber-r.lineNumber+(i&&e.lineEdit.lineRange.startLineNumber>=r.lineNumber?1:0),e.lineEdit.lineRange.length,e.lineEdit.newLines.length,t.reduce((e,t)=>e+t.original.length,0),t.reduce((e,t)=>e+t.modified.length,0),t.length,t.every(e=>e.original===t[0].original&&e.modified===t[0].modified))}function NN(e){return e.every(e=>e.innerChanges.every(e=>t(e)));function t(e){return!(!e.originalRange.isEmpty()||e.modifiedRange.startLineNumber!==e.modifiedRange.endLineNumber)}}function PN(e,t){if(!t||!NN(e))return!1;let n=t;return e.every(e=>e.innerChanges.every(e=>r(e)));function r(e){let t=e.originalRange.getStartPosition();return!!(n.isBeforeOrEqual(t)||t.lineNumber<n.lineNumber)}}function FN(e){let t=e.flatMap(e=>e.innerChanges??[]);if(t.length!==1)return!1;let n=t[0];return!(!n.originalRange.isEmpty()||n.modifiedRange.startLineNumber===n.modifiedRange.endLineNumber)}function IN(e,t,n){return e.map(e=>({original:t.originalText.getValueOfRange(e.originalRange),modified:n.getValueOfRange(e.modifiedRange)})).every(({original:e,modified:t})=>t.trim()===``&&e.length>0&&(e.length>t.length||e.trim()!==``))}function LN(e,t){return zN(e,t,e=>/^[a-zA-Z]$/.test(e))}function RN(e,t){return zN(e,t,e=>!/^\s$/.test(e))}function zN(e,t,n){let r=[];e.sort((e,t)=>T.compareRangesUsingStarts(e.range,t.range));for(let n of e){let e=n.range.startColumn-1,a=n.range.endColumn-2,o=``,s=``,c=t.getLineAt(n.range.startLineNumber),l=t.getLineAt(n.range.endLineNumber);if(i(c[e]))for(;i(c[e-1]);)o=c[e-1]+o,e--;if(i(l[a])||a<e)for(;i(l[a+1]);)s+=l[a+1],a++;let u=new fc(new T(n.range.startLineNumber,e+1,n.range.endLineNumber,a+2),o+n.text+s);r.length>0&&T.areIntersectingOrTouching(r[r.length-1].range,u.range)&&(u=fc.joinReplacements([r.pop(),u],t)),r.push(u)}function i(e){return e===void 0?!1:n(e)}return r}var BN=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},VN=function(e,t){return function(n,r){t(n,r,e)}},HN=class extends j{constructor(e,t,n,r){super(),this._editor=e,this._model=t,this._showCollapsed=n,this._inlineEdit=L(this,e=>{let t=this._model.read(e);if(!t||!this._editor.getModel())return;let n=t.inlineEditState.read(e);if(!n)return;let r=n.inlineSuggestion.action,i;if(r?.kind===`edit`){let e=r.stringEdit,t=n.inlineSuggestion.originalTextRef.getTransformer();i=new Kc(e.replacements.map(e=>new fc(T.fromPositions(t.getPosition(e.replaceRange.start),t.getPosition(e.replaceRange.endExclusive)),e.newText)))}else i=void 0;return new rM(n.inlineSuggestion.originalTextRef,r,i,t.primaryPosition.read(void 0),t.allPositions.read(void 0),n.inlineSuggestion.source.inlineSuggestions.commands??[],n.inlineSuggestion)}),this._inlineEditModel=L(this,e=>{let t=this._model.read(e);if(!t)return;let n=this._inlineEdit.read(e);if(n)return new iM(t,n,L(this,e=>{if(this._editorObs.isFocused.read(e)){if(t.tabShouldJumpToInlineEdit.read(e))return ED.Jump;if(t.tabShouldAcceptInlineEdit.read(e))return ED.Accept}return ED.Inactive}))}),this._editorObs=lu(this._editor),this.view=this._register(r.createInstance(AN,this._editor,this._inlineEditModel,this._model.map(e=>e?Wj.fromInlineCompletionModel(e):void 0),this._inlineEdit.map(e=>e?Uj.fromInlineSuggestion(e.inlineCompletion):void 0),this._showCollapsed))}};HN=BN([VN(3,w)],HN);var UN=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},WN=function(e,t){return function(n,r){t(n,r,e)}},GN=class extends j{static{this.hot=qc(this)}constructor(e,t,n,r){super(),this._editor=e,this._model=t,this._focusIsInMenu=n,this._instantiationService=r,this._ghostTexts=L(this,e=>this._model.read(e)?.ghostTexts.read(e)??[]),this._inlineEdit=L(this,e=>this._model.read(e)?.inlineEditState.read(e)?.inlineSuggestion),this._everHadInlineEdit=ir(this,(e,t)=>t||!!this._inlineEdit.read(e)||!!this._model.read(e)?.inlineCompletionState.read(e)?.inlineSuggestion?.showInlineEditMenu),this._indicatorIsHoverVisible=St(this,void 0),this._showInlineEditCollapsed=L(this,e=>(this._model.read(e)?.showCollapsed.read(e)??!1)&&!this._indicatorIsHoverVisible.read(e)?.read(e)),this._inlineEditWidget=Hi(e=>{if(this._everHadInlineEdit.read(e))return this._instantiationService.createInstance(HN,this._editor,this._model,this._showInlineEditCollapsed)}),this._gutterIndicatorState=L(e=>{let t=this._model.read(e);if(!t)return;let n=t.state.read(e);if(n?.kind===`ghostText`&&n.inlineSuggestion?.showInlineEditMenu)return{displayRange:Uu.ofLength(n.primaryGhostText.lineNumber,1),tabAction:L(this,e=>this._editorObs.isFocused.read(e)?ED.Accept:ED.Inactive),gutterIndicatorOffset:pc(KN(n.inlineSuggestion,this._editor)),inlineSuggestion:n.inlineSuggestion,model:t};if(n?.kind===`inlineEdit`){let r=this._inlineEditWidget.read(e)?.view;if(!r)return;let i=r.displayRange.read(e);return i?{displayRange:i,tabAction:L(e=>{if(this._editorObs.isFocused.read(e)){if(t.tabShouldJumpToInlineEdit.read(e))return ED.Jump;if(t.tabShouldAcceptInlineEdit.read(e))return ED.Accept}return ED.Inactive}),gutterIndicatorOffset:r.gutterIndicatorOffset,inlineSuggestion:n.inlineSuggestion,model:t}:void 0}else return}),this._stablizedGhostTexts=yE(this._ghostTexts,this._store),this._editorObs=lu(this._editor),this._ghostTextWidgets=$e(this,this._stablizedGhostTexts,(e,t)=>t.add(this._createGhostText(e))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(e=>e.fontFamily),this._register(ie(L(e=>`
40
+ .monaco-editor .ghost-text-decoration,
41
+ .monaco-editor .ghost-text-decoration-preview,
42
+ .monaco-editor .ghost-text {
43
+ font-family: ${this._fontFamily.read(e)};
44
+ }`))),this._register(new Ph(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(qj,this._editorObs,L(e=>{let t=this._gutterIndicatorState.read(e);if(t)return new Hj(Uj.fromInlineSuggestion(t.inlineSuggestion),t.displayRange,Wj.fromInlineCompletionModel(t.model),t.inlineSuggestion.action?.kind===`edit`?t.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((e,t)=>e?.tabAction?.read(t)??ED.Inactive),this._gutterIndicatorState.map((e,t)=>e?.gutterIndicatorOffset?.read(t)??0),this._inlineEditWidget.map((e,t)=>e?.view.inlineEditsIsHovered.read(t)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),L(e=>{let t=this._inlineEditWidget.read(e);if(t)return e.store.add(this._instantiationService.createInstance(eM,t._inlineEditModel,pc(this._indicator),t.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}_createGhostText(e){return this._instantiationService.createInstance(aA,this._editor,L(t=>{let n=this._model.read(t),r=n?.inlineCompletionState.read(t)?.inlineSuggestion;return!n||!r?{ghostText:e.read(t),handleInlineCompletionShown:()=>{},warning:void 0}:{ghostText:e.read(t),handleInlineCompletionShown:e=>n.handleInlineSuggestionShown(r,$.GhostText,e,Date.now()),warning:rA.from(n?.warning.read(t))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map(e=>e.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.ownsViewZone(e)??!1}};GN=UN([WN(3,w)],GN);function KN(e,t){let n=e.getSingleTextEdit(),r=t.getModel();if(!r)return 0;let i=r.getEOL();if(n.range.isEmpty()&&n.text.startsWith(i)){let e=t.getLineHeightForPosition(n.range.getStartPosition());return qN(n.text,i)*e}return 0}function qN(e,t){if(!t.length)return 0;let n=0,r=0;for(;e.startsWith(t,r);)n++,r+=t.length;return n}var JN=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},YN=function(e,t){return function(n,r){t(n,r,e)}},XN;CO(e=>ZN.get(e));var ZN=class extends j{static{XN=this}static{this._instances=new Set}static{this.hot=qc(this)}static{this.ID=`editor.contrib.inlineCompletionsController`}static getInFocusedEditorOrParent(e){let t=jv(e);return t?XN.get(t):null}static get(e){return NC(e.getContribution(XN.ID))}constructor(e,t,n,r,i,a,o,s,c,l){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=n,this._configurationService=r,this._commandService=i,this._debounceService=a,this._languageFeaturesService=o,this._accessibilitySignalService=s,this._keybindingService=c,this._accessibilityService=l,this._enabled=L(this,e=>this._enabledInConfig.read(e)&&(!this._isScreenReaderEnabled.read(e)||!this._editorDictationInProgress.read(e))),this._focusIsInMenu=St(this,!1),this._focusIsInEditorOrMenu=L(this,e=>{let t=this._editorObs.isFocused.read(e),n=this._focusIsInMenu.read(e);return t||n}),this._cursorIsInIndentation=L(this,e=>{let t=this._editorObs.cursorPosition.read(e);if(t===null)return!1;let n=this._editorObs.model.read(e);if(!n)return!1;this._editorObs.versionId.read(e);let r=n.getLineIndentColumn(t.lineNumber);return t.column<=r}),this.model=Hi(this,e=>{if(this._editorObs.isReadonly.read(e))return;let t=this._editorObs.model.read(e);if(t)return this._instantiationService.createInstance(EO,t,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor)}),this._playAccessibilitySignal=Or(this),this._view=L(e=>e.store.add(this._instantiationService.createInstance(GN.hot.read(e),this.editor,this.model,this._focusIsInMenu))),this._editorObs=lu(this.editor),this._positions=L(this,e=>this._editorObs.selections.read(e)?.map(e=>e.getEndPosition())??[new M(1,1)]),this._suggestWidgetAdapter=this._register(new Xk(this._editorObs,e=>this.model.get()?.handleSuggestAccepted(e),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=$u(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._isScreenReaderEnabled=$u(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=$u(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue(`editorDictation.inProgress`)===!0),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(e=>!0),this._view.recomputeInitiallyAndOnChange(this._store),XN._instances.add(this),this._register(bn(()=>XN._instances.delete(this))),this._register(k(e=>{let t=this.model.read(e);if(!t)return;let n=t.state.read(e);if(!n||!this._focusIsInEditorOrMenu.read(void 0))return;let r=n.kind===`inlineEdit`?n.nextEditUri:void 0;for(let e of XN._instances)if(e===this)continue;else r&&ao(r,e.editor.getModel()?.uri)?e.model.read(void 0)?.trigger():e.reject()})),this._register(k(e=>{let t=this.model.read(e),n=this.editor.getModel()?.uri;!t||!n||e.store.add(t.onDidAccept(()=>{for(let e of XN._instances){if(e===this)continue;let t=e.model.read(void 0)?.state.read(void 0);t?.kind===`inlineEdit`&&ao(t.nextEditUri,n)&&e.model.read(void 0)?.stop(`automatic`)}}))})),this._register(de(this._editorObs.onDidType,(e,t)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(de(this._editorObs.onDidPaste,(e,t)=>{this._enabled.get()&&this.model.get()?.trigger()}));let u=new Set([Wi.Tab.id,Wi.DeleteLeft.id,Wi.DeleteRight.id,Ch,`acceptSelectedSuggestion`,bT.ID,yT.ID,Ag.NextMatchFindAction,Vw.ID,Hw.ID,Uw.ID,Ww.ID,...vo.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand(t=>{if(u.has(t.commandId)&&e.hasTextFocus()&&this._enabled.get()){let e=!1;t.commandId===`editor.action.inlineSuggest.commit`&&(e=!0),this._editorObs.forceUpdate(t=>{this.model.get()?.trigger(t,{noDelay:e})})}})),this._register(de(this._editorObs.selections,(e,t,n)=>{if(n.some(e=>e.reason===3||e.source===`api`)){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind===`inlineEdit`)return;let e=this.model.get();if(!e)return;e.state.get()?.kind===`ghostText`&&this.model.get()?.stop()}})),this._register(k(t=>{let n=this._focusIsInEditorOrMenu.read(t),r=this.model.read(void 0);if(n){let e=r?.state.read(void 0);(!e||e.kind!==`inlineEdit`||!e.nextEditUri)&&ut(e=>{for(let t of XN._instances)t!==this&&t.model.read(void 0)?.stop(`automatic`,e)});return}this._contextKeyService.getContextKeyValue(`accessibleViewIsShown`)||this._configurationService.getValue(`editor.inlineSuggest.keepOnBlur`)||e.getOption(71).keepOnBlur||Lh.dropDownVisible||r&&(r.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&r.inlineEditAvailable.read(void 0)||ut(e=>{r.stop(`automatic`,e)}))})),this._register(k(e=>{let t=this.model.read(e)?.inlineCompletionState.read(e);t?.suggestItem?t.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(bn(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));let d=ir(this,(e,t)=>{let n=this.model.read(e)?.state.read(e);return this._suggestWidgetAdapter.selectedItem.get()?t:n?.inlineSuggestion?.semanticId});this._register(Tt(L(e=>(this._playAccessibilitySignal.read(e),d.read(e),{})),async(e,t,n,r)=>{let i=this.model.get(),a=i?.state.get();if(!a||!i||(await Wo(50,zu(r)),await qn(this._suggestWidgetAdapter.selectedItem,fl,()=>!1,zu(r)),i=this.model.get(),a=i?.state.get(),!a||!i))return;let o=a.kind===`ghostText`?i.textModel.getLineContent(a.primaryGhostText.lineNumber):``;this._accessibilitySignalService.playSignal(a.kind===`ghostText`?po.inlineSuggestion:po.nextEditSuggestion),this.editor.getOption(12)&&(a.kind===`ghostText`?this._provideScreenReaderUpdate(a.primaryGhostText.renderForScreenReader(o)):this._provideScreenReaderUpdate(``))})),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(`accessibility.verbosity.inlineCompletions`)&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue(`accessibility.verbosity.inlineCompletions`)})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue(`accessibility.verbosity.inlineCompletions`)});let f=new bE(this._contextKeyService);this._register(f.bind(pw.cursorInIndentation,this._cursorIsInIndentation)),this._register(f.bind(pw.hasSelection,e=>!this._editorObs.cursorSelection.read(e)?.isEmpty())),this._register(f.bind(pw.cursorAtInlineEdit,this.model.map((e,t)=>e?.inlineEditState?.read(t)?.cursorAtInlineEdit.read(t)))),this._register(f.bind(pw.tabShouldAcceptInlineEdit,this.model.map((e,t)=>!!e?.tabShouldAcceptInlineEdit.read(t)))),this._register(f.bind(pw.tabShouldJumpToInlineEdit,this.model.map((e,t)=>!!e?.tabShouldJumpToInlineEdit.read(t)))),this._register(f.bind(pw.inlineEditVisible,e=>this.model.read(e)?.inlineEditState.read(e)!==void 0)),this._register(f.bind(pw.inlineSuggestionHasIndentation,e=>this.model.read(e)?.getIndentationInfo(e)?.startsWithIndentation)),this._register(f.bind(pw.inlineSuggestionHasIndentationLessThanTabSize,e=>this.model.read(e)?.getIndentationInfo(e)?.startsWithIndentationLessThanTabSize)),this._register(f.bind(pw.suppressSuggestions,e=>{let t=this.model.read(e)?.inlineCompletionState.read(e);return t?.primaryGhostText&&t?.inlineSuggestion?t.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(f.bind(pw.inlineSuggestionAlternativeActionVisible,e=>{let t=(this.model.read(e)?.inlineEditState.read(e))?.inlineSuggestion.action;return t&&t.kind===`edit`&&t.alternativeAction!==void 0})),this._register(f.bind(pw.inlineSuggestionVisible,e=>{let t=this.model.read(e)?.inlineCompletionState.read(e);return!!t?.inlineSuggestion&&t?.primaryGhostText!==void 0&&!t?.primaryGhostText.isEmpty()}));let p=L(this,e=>{let t=this.model.read(e)?.inlineCompletionState.read(e)?.primaryGhostText;if(!(!t||t.isEmpty()))return new M(t.lineNumber,t.parts[0].column)});this._register(f.bind(pw.cursorBeforeGhostText,e=>{let t=p.read(e);if(!t)return!1;let n=this._editorObs.cursorPosition.read(e);return n?t.equals(n):!1})),this._register(this._instantiationService.createInstance(HT,this.editor))}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){let t=this._contextKeyService.getContextKeyValue(`accessibleViewIsShown`),n=this._keybindingService.lookupKeybinding(`editor.action.accessibleView`),r;!t&&n&&this.editor.getOption(169)&&(r=V(1247,`Inspect this in the accessible view ({0})`,n.getAriaLabel())),$c(r?e+`, `+r:e)}shouldShowHoverAt(e){let t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(n=>e.containsPosition(new M(t.lineNumber,n.column))):!1}shouldShowHoverAtViewZone(e){return this._view.get().shouldShowHoverAtViewZone(e)}reject(){ut(e=>{let t=this.model.get();if(t&&(t.stop(`explicitCancel`,e),this._focusIsInEditorOrMenu.get()))for(let t of XN._instances)t!==this&&!t._focusIsInEditorOrMenu.get()&&t.model.get()?.stop(`automatic`,e)})}jump(){let e=this.model.get();e&&e.jump()}};ZN=XN=JN([YN(1,w),YN(2,G),YN(3,xa),YN(4,tr),YN(5,Sa),YN(6,q),YN(7,Lo),YN(8,jr),YN(9,ai)],ZN);var QN=class e extends N{static{this.ID=Eh}constructor(){super({id:e.ID,label:J(1224,`Show Next Inline Suggestion`),precondition:m.and(z.writable,pw.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){ZN.get(t)?.model.get()?.next()}},$N=class e extends N{static{this.ID=Th}constructor(){super({id:e.ID,label:J(1225,`Show Previous Inline Suggestion`),precondition:m.and(z.writable,pw.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){ZN.get(t)?.model.get()?.previous()}},eP=`vscode://schemas/inlineCompletionProviderIdArgs`;function tP(e){let t=[];return e.providerId&&(t.push(e.providerId.toStringWithoutVersion()),t.push(e.providerId.extensionId+`:*`)),t}var nP=QC(XC({showNoResultNotification:JC(HC()),providerId:JC(ew(eP,BC())),explicit:JC(HC()),changeHintData:JC(WC())}),KC()),rP=class extends N{constructor(){super({id:`editor.action.inlineSuggest.trigger`,label:J(1226,`Trigger Inline Suggestion`),precondition:z.writable,metadata:{description:V(1213,`Triggers an inline suggestion in the editor.`),args:[{name:`args`,description:V(1214,`Options for triggering inline suggestions.`),isOptional:!0,schema:nP.getJSONSchema()}]}})}async run(e,t,n){let r=e.get(di),i=e.get(q),a=ZN.get(t),o=nP.validateOrThrow(n),s=o?.providerId?i.inlineCompletionsProvider.all(t.getModel()).find(e=>tP(e).some(e=>e===o.providerId)):void 0;await ci(async e=>{await a?.model.get()?.trigger(e,{provider:s,explicit:o?.explicit??!0,changeHint:o?.changeHintData?{data:o.changeHintData}:void 0}),a?.playAccessibilitySignal(e)}),o?.showNoResultNotification&&(a?.model.get()?.state.get()||r.notify({severity:Ni.Info,message:V(1215,`No inline suggestion is available.`)}))}},iP=class extends N{constructor(){super({id:`editor.action.inlineSuggest.acceptNextWord`,label:J(1227,`Accept Next Word Of Inline Suggestion`),precondition:m.and(z.writable,pw.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:m.and(z.writable,pw.inlineSuggestionVisible,pw.cursorBeforeGhostText,vt.negate())},menuOpts:[{menuId:Z.InlineSuggestionToolbar,title:V(1216,`Accept Word`),group:`primary`,order:2}]})}async run(e,t){await ZN.get(t)?.model.get()?.acceptNextWord()}},aP=class extends N{constructor(){super({id:`editor.action.inlineSuggest.acceptNextLine`,label:J(1228,`Accept Next Line Of Inline Suggestion`),precondition:m.and(z.writable,pw.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:Z.InlineSuggestionToolbar,title:V(1217,`Accept Line`),group:`secondary`,order:2}]})}async run(e,t){await ZN.get(t)?.model.get()?.acceptNextLine()}},oP=class extends N{constructor(){super({id:Ch,label:J(1229,`Accept Inline Suggestion`),precondition:m.or(pw.inlineSuggestionVisible,pw.inlineEditVisible),menuOpts:[{menuId:Z.InlineSuggestionToolbar,title:V(1218,`Accept`),group:`primary`,order:2},{menuId:Z.InlineEditsActions,title:V(1219,`Accept`),group:`primary`,order:2}],kbOpts:[{primary:2,weight:200,kbExpr:m.or(m.and(pw.inlineSuggestionVisible,z.tabMovesFocus.toNegated(),Q.Visible.toNegated(),z.hoverFocused.toNegated(),pw.hasSelection.toNegated(),pw.inlineSuggestionHasIndentationLessThanTabSize),m.and(pw.inlineEditVisible,z.tabMovesFocus.toNegated(),Q.Visible.toNegated(),z.hoverFocused.toNegated(),pw.tabShouldAcceptInlineEdit))}]})}async run(e,t){let n=ZN.getInFocusedEditorOrParent(e);n&&(n.model.get()?.accept(n.editor),n.editor.focus())}};ke.registerKeybindingRule({id:Ch,weight:202,primary:2,when:m.and(pw.inInlineEditsPreviewEditor)});var sP=class extends N{constructor(){super({id:wh,label:J(1230,`Accept Inline Suggestion Alternative Action`),precondition:m.and(pw.inlineSuggestionAlternativeActionVisible,pw.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(e,t){let n=ZN.getInFocusedEditorOrParent(e);n&&(n.model.get()?.accept(n.editor,!0),n.editor.focus())}};ke.registerKeybindingRule({id:wh,weight:203,primary:1026,when:m.and(pw.inInlineEditsPreviewEditor)});var cP=class extends N{constructor(){super({id:Dh,label:J(1231,`Jump to next inline edit`),precondition:pw.inlineEditVisible,menuOpts:[{menuId:Z.InlineEditsActions,title:V(1220,`Jump`),group:`primary`,order:1,when:pw.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:m.and(pw.inlineEditVisible,z.tabMovesFocus.toNegated(),Q.Visible.toNegated(),z.hoverFocused.toNegated(),pw.tabShouldJumpToInlineEdit)}})}async run(e,t){let n=ZN.get(t);n&&n.jump()}},lP=class e extends N{static{this.ID=Oh}constructor(){super({id:e.ID,label:J(1232,`Hide Inline Suggestion`),precondition:m.or(pw.inlineSuggestionVisible,pw.inlineEditVisible),kbOpts:{kbExpr:z.editorTextFocus,weight:190,primary:9},menuOpts:[{menuId:Z.InlineEditsActions,title:V(1221,`Reject`),group:`primary`,order:3}]})}async run(e,t){let n=ZN.getInFocusedEditorOrParent(e);ut(e=>{n?.model.get()?.stop(`explicitCancel`,e)}),n?.editor.focus()}},uP=class e extends N{static{this.ID=kh}constructor(){super({id:e.ID,label:J(1233,`Toggle Inline Suggestions Show Collapsed`),precondition:m.true()})}async run(e,t){let n=e.get(xa),r=n.getValue(`editor.inlineSuggest.edits.showCollapsed`);n.updateValue(`editor.inlineSuggest.edits.showCollapsed`,!r)}};ke.registerKeybindingRule({id:lP.ID,weight:-1,primary:9,secondary:[1033],when:m.and(pw.inInlineEditsPreviewEditor)});var dP=class e extends Ru{static{this.ID=`editor.action.inlineSuggest.toggleAlwaysShowToolbar`}constructor(){super({id:e.ID,title:V(1222,`Always Show Toolbar`),f1:!1,precondition:void 0,menu:[{id:Z.InlineSuggestionToolbar,group:`secondary`,order:10}],toggled:m.equals(`config.editor.inlineSuggest.showToolbar`,`always`)})}async run(e){let t=e.get(xa),n=t.getValue(`editor.inlineSuggest.showToolbar`)===`always`?`onHover`:`always`;t.updateValue(`editor.inlineSuggest.showToolbar`,n)}},fP=class extends N{constructor(){super({id:`editor.action.inlineSuggest.dev.extractRepro`,label:V(1223,`Developer: Extract Inline Suggest State`),alias:`Developer: Inline Suggest Extract Repro`,precondition:m.or(pw.inlineEditVisible,pw.inlineSuggestionVisible)})}async run(e,t){let n=e.get(xe),r=ZN.get(t)?.model.get();if(!r)return;let i=r.extractReproSample(),a=yo(JSON.stringify({inlineCompletion:i.inlineCompletion},null,4)).map(e=>`// `+e).join(`
45
+ `),o=`${i.documentValue}\n\n// <json>\n${a}\n// </json>\n`;return await n.writeText(o),{reproCase:o}}},pP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},mP=function(e,t){return function(n,r){t(n,r,e)}},hP=class{constructor(e,t,n){this.owner=e,this.range=t,this.controller=n}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}},gP=class{constructor(e,t,n,r,i){this._editor=e,this.accessibilityService=t,this._instantiationService=n,this._telemetryService=r,this._markdownRendererService=i,this.hoverOrdinal=4,this.hideCopyButton=!0}suggestHoverAnchor(e){let t=ZN.get(this._editor);if(!t)return null;let n=e.target;if(n.type===8){let r=n.detail;if(t.shouldShowHoverAtViewZone(r.viewZoneId))return new Vm(1e3,this,T.fromPositions(this._editor.getModel().validatePosition(r.positionBefore||r.position)),e.event.posx,e.event.posy,!1)}if(n.type===7&&t.shouldShowHoverAt(n.range)||n.type===6&&n.detail.mightBeForeignElement&&t.shouldShowHoverAt(n.range))return new Vm(1e3,this,n.range,e.event.posx,e.event.posy,!1);if(n.type===9&&n.element){let r=aA.getWarningWidgetContext(n.element);if(r&&t.shouldShowHoverAt(r.range))return new Vm(1e3,this,r.range,e.event.posx,e.event.posy,!1)}return null}computeSync(e,t){if(this._editor.getOption(71).showToolbar!==`onHover`)return[];let n=ZN.get(this._editor);return n&&n.shouldShowHoverAt(e.range)?[new hP(this,e.range,n)]:[]}renderHoverParts(e,t){let n=new S,r=t[0];this._telemetryService.publicLog2(`inlineCompletionHover.shown`),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&n.add(this.renderScreenReaderText(e,r));let i=r.controller.model.get(),a=document.createElement(`div`);return e.fragment.appendChild(a),n.add(Ht((t,n)=>{let r=n.add(this._instantiationService.createInstance(Lh.hot.read(t),this._editor,!1,pc(null),i.selectedInlineCompletionIndex,i.inlineCompletionsCount,i.activeCommands,i.warning,()=>{e.onContentsChanged()}));a.replaceChildren(r.getDomNode())})),i.triggerExplicitly(),new Hm([{hoverPart:r,hoverElement:a,dispose(){n.dispose()}}])}getAccessibleContent(e){return V(1248,`There are inline completions here`)}renderScreenReaderText(e,t){let n=new S,r=I,i=r(`div.hover-row.markdown-hover`),a=H(i,r(`div.hover-contents`,{"aria-live":`assertive`})),o=t=>{let r=V(1249,`Suggestion:`),i=n.add(this._markdownRendererService.render(new li().appendText(r).appendCodeblock(`text`,t),{context:this._editor,asyncRenderCallback:()=>{a.className=`hover-contents code-hover-contents`,e.onContentsChanged()}}));a.replaceChildren(i.element)};return n.add(k(e=>{let n=t.controller.model.read(e)?.primaryGhostText.read(e);if(n){let e=this._editor.getModel().getLineContent(n.lineNumber);o(n.renderForScreenReader(e))}else Zr(a)})),e.fragment.appendChild(i),n}};gP=pP([mP(1,ai),mP(2,w),mP(3,au),mP(4,it)],gP);var _P=class{};F(ZN.ID,FC(ZN.hot),3),O(rP),O(QN),O($N),O(iP),O(aP),O(oP),O(sP),O(uP),O(lP),O(cP),x(dP),O(fP),x($n),x(vn),Um.register(gP),AC.register(new _P);var vP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},yP=function(e,t){return function(n,r){t(n,r,e)}},bP,xP=class{static{bP=this}static{this.ID=`editor.contrib.gotodefinitionatposition`}static{this.MAX_SOURCE_PREVIEW_LINES=8}constructor(e,t,n,r){this.textModelResolverService=t,this.languageService=n,this.languageFeaturesService=r,this.toUnhook=new S,this.toUnhookForKeyboard=new S,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();let i=new Cv(e);this.toUnhook.add(i),this.toUnhook.add(i.onMouseMoveOrRelevantKeyDown(([e,t])=>{this.startFindDefinitionFromMouse(e,t??void 0)})),this.toUnhook.add(i.onExecute(e=>{this.isEnabled(e)&&this.gotoDefinition(e.target.position,e.hasSideBySideModifier).catch(e=>{Hc(e)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(i.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(bP.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(e=>{e&&(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}let n=e.target.position;this.startFindDefinition(n)}async startFindDefinition(e){this.toUnhookForKeyboard.clear();let 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;let n=new id(this.editor,15);this.previousPromise&&=(this.previousPromise.cancel(),null),this.previousPromise=ql(t=>this.findDefinition(e,t));let r;try{r=await this.previousPromise}catch(e){Hc(e);return}if(!r||!r.length||!n.validate(this.editor)){this.removeLinkDecorations();return}let i=r[0].originSelectionRange?T.lift(r[0].originSelectionRange):new T(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(r.length>1){let e=i;for(let{originSelectionRange:t}of r)t&&(e=T.plusRange(e,t));this.addDecoration(e,new li().appendText(V(1120,`Click to show {0} definitions.`,r.length)))}else{let e=r[0];return e.uri?this.textModelResolverService.createModelReference(e.uri).then(t=>{if(!t.object||!t.object.textEditorModel){t.dispose();return}let{object:{textEditorModel:n}}=t,{startLineNumber:r}=e.range;if(r<1||r>n.getLineCount()){t.dispose();return}let a=this.getPreviewValue(n,r,e),o=this.languageService.guessLanguageIdByFilepathOrFirstLine(n.uri);this.addDecoration(i,a?new li().appendCodeblock(o||``,a):void 0),t.dispose()}):void 0}}getPreviewValue(e,t,n){let r=n.range;return r.endLineNumber-r.startLineNumber>=bP.MAX_SOURCE_PREVIEW_LINES&&(r=this.getPreviewRangeBasedOnIndentation(e,t)),r=e.validateRange(r),this.stripIndentationFromPreviewRange(e,t,r)}stripIndentationFromPreviewRange(e,t,n){let r=e.getLineFirstNonWhitespaceColumn(t);for(let i=t+1;i<n.endLineNumber;i++){let t=e.getLineFirstNonWhitespaceColumn(i);r=Math.min(r,t)}return e.getValueInRange(n).replace(RegExp(`^\\s{${r-1}}`,`gm`),``).trim()}getPreviewRangeBasedOnIndentation(e,t){let n=e.getLineFirstNonWhitespaceColumn(t),r=Math.min(e.getLineCount(),t+bP.MAX_SOURCE_PREVIEW_LINES),i=t+1;for(;i<r&&n!==e.getLineFirstNonWhitespaceColumn(i);i++);return new T(t,1,i+1,1)}addDecoration(e,t){let n={range:e,options:{description:`goto-definition-link`,inlineClassName:`goto-definition-link`,hoverMessage:t}};this.linkDecorations.set([n])}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 ba)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){let n=this.editor.getModel();return n?Fy(this.languageFeaturesService.definitionProvider,n,e,!1,t):Promise.resolve(null)}async gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(e=>new Uy({openToSide:t,openInPeek:!t&&this.editor.getOption(101)&&!this.isInPeekEditor(e),muteMessage:!0},{title:{value:``,original:``},id:``,precondition:void 0}).run(e))}isInPeekEditor(e){let t=e.get(G);return Hv.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};xP=bP=vP([yP(1,gi),yP(2,Zo),yP(3,q)],xP),F(xP.ID,xP,2);var SP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},CP=function(e,t){return function(n,r){t(n,r,e)}},wP=class extends j{static{this.ID=`editor.contrib.markerSelectionStatus`}constructor(e,t,n){super(),this._editor=e,this._markerService=n,this._ctxHasDiagnostics=z.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(e=>{let t=this._editor.getModel();t&&e.some(e=>ao(e,t.uri))&&this._update()})),this._update()}dispose(){this._ctxHasDiagnostics.reset(),super.dispose()}_update(){let e=this._editor.getModel(),t=this._editor.getSelection();if(!e||!t){this._ctxHasDiagnostics.reset();return}let n=this._markerService.read({resource:e.uri,severities:Pu.Error|Pu.Warning|Pu.Info}).some(e=>T.areIntersecting({startLineNumber:e.startLineNumber,startColumn:e.startColumn,endLineNumber:e.endLineNumber,endColumn:e.endColumn},t));this._ctxHasDiagnostics.set(n)}};wP=SP([CP(1,G),CP(2,Wa)],wP),F(wP.ID,wP,1),O(class extends N{constructor(){super({id:`editor.action.debugEditorGpuRenderer`,label:J(1144,`Developer: Debug Editor GPU Renderer`),precondition:m.true()})}async run(e,t){let n=e.get(w),r=await e.get(Fi).pick([{label:V(1141,`Log Texture Atlas Stats`),id:`logTextureAtlasStats`},{label:V(1142,`Save Texture Atlas`),id:`saveTextureAtlas`},{label:V(1143,`Draw Glyph`),id:`drawGlyph`}],{canPickMany:!1});if(r)switch(r.id){case`logTextureAtlasStats`:n.invokeFunction(e=>{let t=e.get(Pl),n=nd.atlas;if(!nd.atlas){t.error(`No texture atlas found`);return}let r=n.getStats();t.info([`Texture atlas stats`,...r].join(`
46
+
47
+ `))});break;case`saveTextureAtlas`:n.invokeFunction(async e=>{let t=e.get(Zn),n=e.get(vk),r=t.getWorkspace().folders;if(r.length>0){let e=nd.atlas,t=[];for(let[i,a]of e.pages.entries())t.push(n.writeFile(On.joinPath(r[0].uri,`textureAtlasPage${i}_actual.png`),Qn.wrap(new Uint8Array(await(await a.source.convertToBlob()).arrayBuffer()))),n.writeFile(On.joinPath(r[0].uri,`textureAtlasPage${i}_usage.png`),Qn.wrap(new Uint8Array(await(await a.getUsagePreview()).arrayBuffer()))));await Promise.all(t)}});break;case`drawGlyph`:n.invokeFunction(async e=>{let t=e.get(xa),n=e.get(vk),r=e.get(Fi),i=e.get(Zn).getWorkspace().folders;if(i.length===0)return;let a=nd.atlas,o=t.getValue(`editor.fontFamily`),s=t.getValue(`editor.fontSize`),c=new tn(s,o,Qs().devicePixelRatio,nd.decorationStyleCache),l=await r.input({prompt:`Enter a character to draw (prefix with 0x for code point))`});if(!l)return;let u=l.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;u!==void 0&&(l=String.fromCodePoint(parseInt(u,16)));let d=a.getGlyph(c,l,0,0,0);if(!d)return;let f=a.pages[d.pageIndex].source.getContext(`2d`)?.getImageData(d.x,d.y,d.w,d.h);if(!f)return;let p=new OffscreenCanvas(f.width,f.height);al(p.getContext(`2d`)).putImageData(f,0,0);let m=await p.convertToBlob({type:`image/png`}),h=On.joinPath(i[0].uri,`glyph_${l}_0_${s}px_${o.replaceAll(/[,\\\/\.'\s]/g,`_`)}.png`);await n.writeFile(h,Qn.wrap(new Uint8Array(await m.arrayBuffer())))});break}}});var TP;(function(e){e.NoAutoFocus=`noAutoFocus`,e.FocusIfVisible=`focusIfVisible`,e.AutoFocusImmediately=`autoFocusImmediately`})(TP||={});var EP=class extends N{constructor(){super({id:sh,label:J(1150,`Show or Focus Hover`),metadata:{description:J(1151,`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:[TP.NoAutoFocus,TP.FocusIfVisible,TP.AutoFocusImmediately],enumDescriptions:[V(1147,`The hover will not automatically take focus.`),V(1148,`The hover will take focus only if it is already visible.`),V(1149,`The hover will automatically take focus when it appears.`)],default:TP.FocusIfVisible}}}}]},precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:ln(2089,2087),weight:100}})}run(e,t,n){if(!t.hasModel())return;let r=Tb.get(t);if(!r)return;let i=n?.focus,a=TP.FocusIfVisible;Object.values(TP).includes(i)?a=i:typeof i==`boolean`&&i&&(a=TP.AutoFocusImmediately);let o=e=>{let n=t.getPosition(),i=new T(n.lineNumber,n.column,n.lineNumber,n.column);r.showContentHover(i,1,2,e)},s=t.getOption(2)===2;r.isHoverVisible?a===TP.NoAutoFocus?o(s):r.focus():o(s||a===TP.AutoFocusImmediately)}},DP=class extends N{constructor(){super({id:ch,label:J(1152,`Show Definition Preview Hover`),precondition:void 0,metadata:{description:J(1153,`Show the definition preview hover in the editor.`)}})}run(e,t){let n=Tb.get(t);if(!n)return;let r=t.getPosition();if(!r)return;let i=new T(r.lineNumber,r.column,r.lineNumber,r.column),a=xP.get(t);a&&a.startFindDefinitionFromCursor(r).then(()=>{n.showContentHover(i,1,2,!0)})}},OP=class extends N{constructor(){super({id:lh,label:J(1154,`Hide Hover`),alias:`Hide Content Hover`,precondition:void 0})}run(e,t){Tb.get(t)?.hideContentHover()}},kP=class extends N{constructor(){super({id:uh,label:J(1155,`Scroll Up Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:16,weight:100},metadata:{description:J(1156,`Scroll up the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.scrollUp()}},AP=class extends N{constructor(){super({id:dh,label:J(1157,`Scroll Down Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:18,weight:100},metadata:{description:J(1158,`Scroll down the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.scrollDown()}},jP=class extends N{constructor(){super({id:fh,label:J(1159,`Scroll Left Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:15,weight:100},metadata:{description:J(1160,`Scroll left the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.scrollLeft()}},MP=class extends N{constructor(){super({id:ph,label:J(1161,`Scroll Right Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:17,weight:100},metadata:{description:J(1162,`Scroll right the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.scrollRight()}},NP=class extends N{constructor(){super({id:mh,label:J(1163,`Page Up Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:J(1164,`Page up the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.pageUp()}},PP=class extends N{constructor(){super({id:hh,label:J(1165,`Page Down Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:J(1166,`Page down the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.pageDown()}},FP=class extends N{constructor(){super({id:gh,label:J(1167,`Go To Top Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:J(1168,`Go to the top of the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.goToTop()}},IP=class extends N{constructor(){super({id:_h,label:J(1169,`Go To Bottom Hover`),precondition:z.hoverFocused,kbOpts:{kbExpr:z.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:J(1170,`Go to the bottom of the editor hover.`)}})}run(e,t){let n=Tb.get(t);n&&n.goToBottom()}},LP=class extends N{constructor(){super({id:vh,label:yh,alias:`Increase Hover Verbosity Level`,precondition:z.hoverVisible})}run(e,t,n){let r=Tb.get(t);if(!r)return;let i=n?.index===void 0?r.focusedHoverPartIndex():n.index;r.updateHoverVerbosityLevel(In.Increase,i,n?.focus)}},RP=class extends N{constructor(){super({id:bh,label:xh,alias:`Decrease Hover Verbosity Level`,precondition:z.hoverVisible})}run(e,t,n){let r=Tb.get(t);if(!r)return;let i=n?.index===void 0?r.focusedHoverPartIndex():n.index;Tb.get(t)?.updateHoverVerbosityLevel(In.Decrease,i,n?.focus)}},zP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},BP=function(e,t){return function(n,r){t(n,r,e)}},VP=I,HP=class{constructor(e,t,n){this.owner=e,this.range=t,this.marker=n}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}},UP={type:1,filter:{include:_p.QuickFix},triggerAction:vp.QuickFixHover},WP=class{constructor(e,t,n,r,i,a){this._editor=e,this._markerDecorationsService=t,this._openerService=n,this._languageFeaturesService=r,this._menuService=i,this._contextKeyService=a,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];let n=this._editor.getModel(),r=e.range;if(!n.isValidRange(e.range))return[];let i=r.startLineNumber,a=n.getLineMaxColumn(i),o=[];for(let r of t){let t=r.range.startLineNumber===i?r.range.startColumn:1,s=r.range.endLineNumber===i?r.range.endColumn:a,c=this._markerDecorationsService.getMarker(n.uri,r);if(!c)continue;let l=new T(e.range.startLineNumber,t,e.range.startLineNumber,s);o.push(new HP(this,l,c))}return o}renderHoverParts(e,t){if(!t.length)return new Hm([]);let n=[];t.forEach(t=>{let r=this._renderMarkerHover(t);e.fragment.appendChild(r.hoverElement),n.push(r)});let r=t.length===1?t[0]:t.sort((e,t)=>Pu.compare(e.marker.severity,t.marker.severity))[0];return new Hm(n,this._renderMarkerStatusbar(e,r))}getAccessibleContent(e){return e.marker.message}_renderMarkerHover(e){let t=new S,n=VP(`div.hover-row`),r=H(n,VP(`div.marker.hover-contents`)),{source:i,message:a,code:o,relatedInformation:s}=e.marker;this._editor.applyFontInfo(r);let c=H(r,VP(`span`));if(c.style.whiteSpace=`pre-wrap`,c.innerText=a,i||o)if(o&&typeof o!=`string`){let e=VP(`span`);if(i){let t=H(e,VP(`span`));t.innerText=i}let n=H(e,VP(`a.code-link`));n.setAttribute(`href`,o.target.toString(!0)),t.add(K(n,`click`,e=>{this._openerService.open(o.target,{allowCommands:!0}),e.preventDefault(),e.stopPropagation()}));let a=H(n,VP(`span`));a.innerText=o.value;let s=H(r,e);s.style.opacity=`0.6`,s.style.paddingLeft=`6px`}else{let e=H(r,VP(`span`));e.style.opacity=`0.6`,e.style.paddingLeft=`6px`,e.innerText=i&&o?`${i}(${o})`:i||`(${o})`}if(Fu(s))for(let{message:e,resource:n,startLineNumber:i,startColumn:a}of s){let o=H(r,VP(`div`));o.style.marginTop=`8px`;let s=H(o,VP(`a`));s.innerText=`${Oc(n)}(${i}, ${a}): `,s.style.cursor=`pointer`,t.add(K(s,`click`,e=>{if(e.stopPropagation(),e.preventDefault(),this._openerService){let e={selection:{startLineNumber:i,startColumn:a}};this._openerService.open(n,{fromUserGesture:!0,editorOptions:e}).catch(Hc)}}));let c=H(o,VP(`span`));c.innerText=e,this._editor.applyFontInfo(c)}return{hoverPart:e,hoverElement:n,dispose:()=>t.dispose()}}_renderMarkerStatusbar(e,t){let n=new S;if(t.marker.severity===Pu.Error||t.marker.severity===Pu.Warning||t.marker.severity===Pu.Info){let n=zw.get(this._editor);n&&e.statusBar.addAction({label:V(1180,`View Problem`),commandId:Vw.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}let r=[];for(let[,e]of this._menuService.getMenuActions(Z.MarkerHoverStatusBar,this._contextKeyService))for(let t of e)t instanceof Lr&&t.enabled&&r.push(t);let i=()=>{for(let n of r)e.statusBar.addAction({label:n.label,commandId:n.id,iconClass:n.class,run:()=>{e.hide(),this._editor.setSelection(T.lift(t.range)),n.run()}})};if(this._editor.getOption(104))i();else{let a=e.statusBar.append(VP(`div`));this.recentMarkerCodeActionsInfo&&(Ku.makeKey(this.recentMarkerCodeActionsInfo.marker)===Ku.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||r.length===0&&(a.textContent=V(1181,`No quick fixes available`)):this.recentMarkerCodeActionsInfo=void 0);let o=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?j.None:oo(()=>a.textContent=V(1182,`Checking for quick fixes...`),200,n);a.textContent||=`\xA0`;let s=this.getCodeActions(t.marker);n.add(bn(()=>s.cancel())),s.then(s=>{if(o.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:s.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){s.dispose(),r.length===0?a.textContent=V(1183,`No quick fixes available`):a.style.display=`none`,i();return}a.style.display=`none`;let c=!1;n.add(bn(()=>{c||s.dispose()})),e.statusBar.addAction({label:V(1184,`Quick Fix...`),commandId:Tp,run:t=>{c=!0;let n=mm.get(this._editor),r=Po(t);e.hide(),n?.showCodeActions(UP,s,{x:r.left,y:r.top,width:r.width,height:r.height})}});let l=s.validActions.find(e=>e.action.isAI);l?e.statusBar.addAction({label:l.action.title,commandId:l.action.command?.id??``,iconClass:C.asClassName(D.sparkle),run:()=>{mm.get(this._editor)?.applyCodeAction(l,!1,!1,Rp.FromProblemsHover)}}):i(),e.onContentsChanged()},Hc)}return n}getCodeActions(e){return ql(t=>Pp(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new T(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),UP,eo.None,t))}};WP=zP([BP(1,wo),BP(2,gn),BP(3,q),BP(4,La),BP(5,G)],WP);var GP=class{constructor(e){this._editor=e}computeSync(e){let t=e=>({value:e}),n=this._editor.getLineDecorations(e.lineNumber),r=[],i=e.laneOrLine===`lineNo`;if(!n)return r;for(let a of n){let n=a.options.glyphMargin?.position??Wr.Center;if(!i&&n!==e.laneOrLine)continue;let o=i?a.options.lineNumberHoverMessage:a.options.glyphMarginHoverMessage;!o||dt(o)||r.push(...nu(o).map(t))}return r}},KP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},qP=function(e,t){return function(n,r){t(n,r,e)}},JP,YP=I,XP=class extends j{static{JP=this}static{this.ID=`editor.contrib.modesGlyphHoverWidget`}constructor(e,t){super(),this._markdownRendererService=t,this.allowEditorOverflow=!0,this._renderDisposeables=this._register(new S),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new Yc(!0)),this._hover.containerDomNode.classList.toggle(`hidden`,!this._isVisible),this._hoverOperation=this._register(new Gh(this._editor,new GP(this._editor))),this._register(this._hoverOperation.onResult(e=>this._withResult(e))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(59)&&this._updateFont()})),this._register(vs(this._hover.containerDomNode,`mouseleave`,e=>{this._onMouseLeave(e)})),this._editor.addOverlayWidget(this)}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return JP.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){let 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,n){this._renderDisposeables.clear();let r=document.createDocumentFragment();for(let e of n){let t=YP(`div.hover-row.markdown-hover`),n=H(t,YP(`div.hover-contents`)),i=this._renderDisposeables.add(this._markdownRendererService.render(e.value,{context:this._editor}));n.appendChild(i.element),r.appendChild(t)}this._updateContents(r),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));let n=this._editor.getLayoutInfo(),r=this._editor.getTopForLineNumber(e),i=this._editor.getScrollTop(),a=this._editor.getOption(75),o=this._hover.containerDomNode.clientHeight,s=r-i-(o-a)/2,c=n.glyphMarginLeft+n.glyphMarginWidth+(t===`lineNo`?n.lineNumbersWidth:0),l=n.height-o,u=Math.max(0,Math.min(Math.round(s),l));if(this._editor.getOption(51)){let e=this._editor.getDomNode();if(e){let t=Po(e);this._hover.containerDomNode.style.position=`fixed`,this._hover.containerDomNode.style.left=`${t.left+c}px`,this._hover.containerDomNode.style.top=`${t.top+u}px`}}else this._hover.containerDomNode.style.position=`absolute`,this._hover.containerDomNode.style.left=`${c}px`,this._hover.containerDomNode.style.top=`${u}px`;this._hover.containerDomNode.style.zIndex=`11`}_onMouseLeave(e){let t=this._editor.getDomNode();(!t||!Vh(t,e.x,e.y))&&this.hide()}};XP=JP=KP([qP(1,it)],XP);var ZP=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},QP=function(e,t){return function(n,r){t(n,r,e)}},$P=class extends j{static{this.ID=`editor.contrib.marginHover`}constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new S,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new Cl(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){let e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled===`off`?(this._listenersStore.add(this._editor.onMouseMove(e=>this._onEditorMouseMove(e))),this._listenersStore.add(this._editor.onKeyDown(e=>this._onKeyDown(e)))):(this._listenersStore.add(this._editor.onMouseDown(e=>this._onEditorMouseDown(e))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(e=>this._onEditorMouseMove(e))),this._listenersStore.add(this._editor.onKeyDown(e=>this._onKeyDown(e)))),this._listenersStore.add(this._editor.onMouseLeave(e=>this._onEditorMouseLeave(e))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(e=>this._onEditorScrollChanged(e)))}_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){let t=this._glyphWidget?.getDomNode();return t?Vh(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){let t=this._hoverSettings.sticky,n=this._isMouseOnGlyphHoverWidget(e);return t&&n}_onEditorMouseMove(e){if(!this.shouldKeepOpenOnEditorMouseMoveOrLeave){if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}}_reactToEditorMouseMove(e){if(e){if(!Hh(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`&&Uh(this._editor.getOption(86),e)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}Er(e.keyCode)||this.hideGlyphHover()}}hideGlyphHover(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||=this._instantiationService.createInstance(XP,this._editor),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};$P=ZP([QP(1,w)],$P);var eF=class{},tF=class{},nF=class{};F(Tb.ID,Tb,2),F($P.ID,$P,2),O(EP),O(DP),O(OP),O(kP),O(AP),O(jP),O(MP),O(NP),O(PP),O(FP),O(IP),O(LP),O(RP),Um.register(U_),Um.register(WP),jn.registerCommand(Sh,e=>{e.get(xa).updateValue(`editor.hover.showLongLineWarning`,!1)}),xc((e,t)=>{let n=e.getColor(xl);n&&(t.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${n.transparent(.5)}; }`),t.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${n.transparent(.5)}; }`),t.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${n.transparent(.5)}; }`))}),AC.register(new eF),AC.register(new tF),AC.register(new nF);function rF(e,t,n,r){if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return[];let i=t.getLanguageConfiguration(e.getLanguageId()).indentRulesSupport;if(!i)return[];let a=new xs(e,i,t);for(r=Math.min(r,e.getLineCount());n<=r&&a.shouldIgnore(n);)n++;if(n>r-1)return[];let{tabSize:o,indentSize:s,insertSpaces:c}=e.getOptions(),l=(e,t)=>(t||=1,wc.shiftIndent(e,e.length+t,o,s,c)),u=(e,t)=>(t||=1,wc.unshiftIndent(e,e.length+t,o,s,c)),d=[],f=an(e.getLineContent(n)),p=f;a.shouldIncrease(n)?(p=l(p),f=l(f)):a.shouldIndentNextLine(n)&&(p=l(p)),n++;for(let t=n;t<=r;t++){if(iF(e,t))continue;let n=an(e.getLineContent(t)),r=p;a.shouldDecrease(t,r)&&(p=u(p),f=u(f)),n!==p&&d.push(Ss.replaceMove(new P(t,1,t,n.length+1),rd(p,s,c))),!a.shouldIgnore(t)&&(a.shouldIncrease(t,r)?(f=l(f),p=f):p=a.shouldIndentNextLine(t,r)?l(p):f)}return d}function iF(e,t){return e.tokenization.isCheapToTokenize(t)?e.tokenization.getLineTokens(t).getStandardTokenType(0)===2:!1}var aF=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},oF=function(e,t){return function(n,r){t(n,r,e)}},sF=class e extends N{static{this.ID=`editor.action.indentationToSpaces`}constructor(){super({id:e.ID,label:J(1189,`Convert Indentation to Spaces`),precondition:z.writable,metadata:{description:J(1190,`Convert the tab indentation to spaces.`)}})}run(e,t){let n=t.getModel();if(!n)return;let r=n.getOptions(),i=t.getSelection();if(!i)return;let a=new bF(i,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[a]),t.pushUndoStop(),n.updateOptions({insertSpaces:!0})}},cF=class e extends N{static{this.ID=`editor.action.indentationToTabs`}constructor(){super({id:e.ID,label:J(1191,`Convert Indentation to Tabs`),precondition:z.writable,metadata:{description:J(1192,`Convert the spaces indentation to tabs.`)}})}run(e,t){let n=t.getModel();if(!n)return;let r=n.getOptions(),i=t.getSelection();if(!i)return;let a=new xF(i,r.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[a]),t.pushUndoStop(),n.updateOptions({insertSpaces:!1})}},lF=class extends N{constructor(e,t,n){super(n),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){let n=e.get(Fi),r=e.get(yt),i=t.getModel();if(!i)return;let a=r.getCreationOptions(i.getLanguageId(),i.uri,i.isForSimpleWidget),o=i.getOptions(),s=[1,2,3,4,5,6,7,8].map(e=>({id:e.toString(),label:e.toString(),description:e===a.tabSize&&e===o.tabSize?V(1185,`Configured Tab Size`):e===a.tabSize?V(1186,`Default Tab Size`):e===o.tabSize?V(1187,`Current Tab Size`):void 0})),c=Math.min(i.getOptions().tabSize-1,7);setTimeout(()=>{n.pick(s,{placeHolder:V(1188,`Select Tab Size for Current File`),activeItem:s[c]}).then(e=>{if(e&&i&&!i.isDisposed()){let t=parseInt(e.label,10);this.displaySizeOnly?i.updateOptions({tabSize:t}):i.updateOptions({tabSize:t,indentSize:t,insertSpaces:this.insertSpaces})}})},50)}},uF=class e extends lF{static{this.ID=`editor.action.indentUsingTabs`}constructor(){super(!1,!1,{id:e.ID,label:J(1193,`Indent Using Tabs`),precondition:void 0,metadata:{description:J(1194,`Use indentation with tabs.`)}})}},dF=class e extends lF{static{this.ID=`editor.action.indentUsingSpaces`}constructor(){super(!0,!1,{id:e.ID,label:J(1195,`Indent Using Spaces`),precondition:void 0,metadata:{description:J(1196,`Use indentation with spaces.`)}})}},fF=class e extends lF{static{this.ID=`editor.action.changeTabDisplaySize`}constructor(){super(!0,!0,{id:e.ID,label:J(1197,`Change Tab Display Size`),precondition:void 0,metadata:{description:J(1198,`Change the space size equivalent of the tab.`)}})}},pF=class e extends N{static{this.ID=`editor.action.detectIndentation`}constructor(){super({id:e.ID,label:J(1199,`Detect Indentation from Content`),precondition:void 0,metadata:{description:J(1200,`Detect the indentation from content.`)}})}run(e,t){let n=e.get(yt),r=t.getModel();if(!r)return;let i=n.getCreationOptions(r.getLanguageId(),r.uri,r.isForSimpleWidget);r.detectIndentation(i.insertSpaces,i.tabSize)}},mF=class extends N{constructor(){super({id:`editor.action.reindentlines`,label:J(1201,`Reindent Lines`),precondition:z.writable,metadata:{description:J(1202,`Reindent the lines of the editor.`)},canTriggerInlineEdits:!0})}run(e,t){let n=e.get(eu),r=t.getModel();if(!r)return;let i=rF(r,n,1,r.getLineCount());i.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,i),t.pushUndoStop())}},hF=class extends N{constructor(){super({id:`editor.action.reindentselectedlines`,label:J(1203,`Reindent Selected Lines`),precondition:z.writable,metadata:{description:J(1204,`Reindent the selected lines of the editor.`)},canTriggerInlineEdits:!0})}run(e,t){let n=e.get(eu),r=t.getModel();if(!r)return;let i=t.getSelections();if(i===null)return;let a=[];for(let e of i){let t=e.startLineNumber,i=e.endLineNumber;if(t!==i&&e.endColumn===1&&i--,t===1){if(t===i)continue}else t--;let o=rF(r,n,t,i);a.push(...o)}a.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,a),t.pushUndoStop())}},gF=class{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(let t of e)t.range&&typeof t.text==`string`&&this._edits.push(t)}getEditOperations(e,t){for(let e of this._edits)t.addEditOperation(T.lift(e.range),e.text);let n=!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?(n=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(n=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),n||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}},_F=class{static{this.ID=`editor.contrib.autoIndentOnPaste`}constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new S,this.callOnModel=new S,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){let t=this.editor.getSelections();if(t===null||t.length>1)return;let n=this.editor.getModel();if(!n||this.rangeContainsOnlyWhitespaceCharacters(n,e)||!this.editor.getOption(18)&&vF(n,e)||!n.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;let r=this.editor.getOption(16),{tabSize:i,indentSize:a,insertSpaces:o}=n.getOptions(),s=[],c={shiftIndent:e=>wc.shiftIndent(e,e.length+1,i,a,o),unshiftIndent:e=>wc.unshiftIndent(e,e.length+1,i,a,o)},l=e.startLineNumber,u=n.getLineContent(l);if(!/\S/.test(u.substring(0,e.startColumn-1))){let e=Eo(r,n,n.getLanguageId(),l,c,this._languageConfigurationService);if(e!==null){let t=an(u),r=Yw(e,i);if(r!==Yw(t,i)){let e=Xw(r,i,o);s.push({range:new T(l,1,l,t.length+1),text:e}),u=e+u.substring(t.length)}else{let e=Hl(n,l,this._languageConfigurationService);if(e===0||e===8)return}}}let d=l;for(;l<e.endLineNumber;){if(!/\S/.test(n.getLineContent(l+1))){l++;continue}break}if(l!==e.endLineNumber){let t=Eo(r,{tokenization:{getLineTokens:e=>n.tokenization.getLineTokens(e),getLanguageId:()=>n.getLanguageId(),getLanguageIdAtPosition:(e,t)=>n.getLanguageIdAtPosition(e,t)},getLineContent:e=>e===d?u:n.getLineContent(e)},n.getLanguageId(),l+1,c,this._languageConfigurationService);if(t!==null){let r=Yw(t,i),a=Yw(an(n.getLineContent(l+1)),i);if(r!==a){let t=r-a;for(let r=l+1;r<=e.endLineNumber;r++){let e=an(n.getLineContent(r)),a=Xw(Yw(e,i)+t,i,o);a!==e&&s.push({range:new T(r,1,r,e.length+1),text:a})}}}}if(s.length>0){this.editor.pushUndoStop();let e=new gF(s,this.editor.getSelection());this.editor.executeCommand(`autoIndentOnPaste`,e),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){let n=e=>e.trim().length===0,r=!0;if(t.startLineNumber===t.endLineNumber)r=n(e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1));else for(let i=t.startLineNumber;i<=t.endLineNumber;i++){let a=e.getLineContent(i);if(r=i===t.startLineNumber?n(a.substring(t.startColumn-1)):i===t.endLineNumber?n(a.substring(0,t.endColumn-1)):e.getLineFirstNonWhitespaceColumn(i)===0,!r)break}return r}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};_F=aF([oF(1,eu)],_F);function vF(e,t){let n=t=>Al(e,t)===2;return n(t.getStartPosition())||n(t.getEndPosition())}function yF(e,t,n,r){if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return;let i=``;for(let e=0;e<n;e++)i+=` `;let a=new RegExp(i,`gi`);for(let n=1,o=e.getLineCount();n<=o;n++){let o=e.getLineFirstNonWhitespaceColumn(n);if(o===0&&(o=e.getLineMaxColumn(n)),o===1)continue;let s=new T(n,1,n,o),c=e.getValueInRange(s),l=r?c.replace(/\t/gi,i):c.replace(a,` `);t.addEditOperation(s,l)}}var bF=class{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),yF(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}},xF=class{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),yF(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}};F(_F.ID,_F,2),O(sF),O(cF),O(uF),O(dF),O(fF),O(pF),O(mF),O(hF),F(ab.ID,ab,1),Um.register(ub);var SF=class{constructor(e,t,n){this._editRange=e,this._originalSelection=t,this._text=n}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){let n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new P(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new P(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}},CF=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},wF=function(e,t){return function(n,r){t(n,r,e)}},TF,EF=class{static{TF=this}static{this.ID=`editor.contrib.inPlaceReplaceController`}static get(e){return e.getContribution(TF.ID)}static{this.DECORATION=Y.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();let n=this.editor.getSelection(),r=this.editor.getModel();if(!r||!n)return;let i=n;if(i.startLineNumber!==i.endLineNumber)return;let a=new id(this.editor,5),o=r.uri;return this.editorWorkerService.canNavigateValueSet(o)?(this.currentRequest=ql(e=>this.editorWorkerService.navigateValueSet(o,i,t)),this.currentRequest.then(t=>{if(!t||!t.range||!t.value||!a.validate(this.editor))return;let n=T.lift(t.range),r=t.range,o=t.value.length-(i.endColumn-i.startColumn);r={startLineNumber:r.startLineNumber,startColumn:r.startColumn,endLineNumber:r.endLineNumber,endColumn:r.startColumn+t.value.length},o>1&&(i=new P(i.startLineNumber,i.startColumn,i.endLineNumber,i.endColumn+o-1));let s=new SF(n,i,t.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,s),this.editor.pushUndoStop(),this.decorations.set([{range:r,options:TF.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=Wo(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Hc)}).catch(Hc)):Promise.resolve(void 0)}};EF=TF=CF([wF(1,$i)],EF);var DF=class extends N{constructor(){super({id:`editor.action.inPlaceReplace.up`,label:J(1286,`Replace with Previous Value`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:3159,weight:100}})}run(e,t){let n=EF.get(t);return n?n.run(this.id,!1):Promise.resolve(void 0)}},OF=class extends N{constructor(){super({id:`editor.action.inPlaceReplace.down`,label:J(1287,`Replace with Next Value`),precondition:z.writable,kbOpts:{kbExpr:z.editorTextFocus,primary:3161,weight:100}})}run(e,t){let n=EF.get(t);return n?n.run(this.id,!0):Promise.resolve(void 0)}};F(EF.ID,EF,4),O(DF),O(OF);var kF=class{constructor(e){this._selection=e,this._selectionId=null}getEditOperations(e,t){let n=AF(e);n&&t.addEditOperation(n.range,n.text),this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}};function AF(e){let t=e.getLineCount(),n=d(e.getLineContent(t))===-1;if(!(!t||n))return Ss.insert(new M(t,e.getLineMaxColumn(t)),e.getEOL())}O(class e extends N{static{this.ID=`editor.action.insertFinalNewLine`}constructor(){super({id:e.ID,label:J(1288,`Insert Final New Line`),precondition:z.writable})}run(e,t,n){let r=t.getSelection();if(r===null)return;let i=new kF(r);t.pushUndoStop(),t.executeCommands(this.id,[i]),t.pushUndoStop()}}),O(class extends N{constructor(){super({id:`expandLineSelection`,label:J(1289,`Expand Line Selection`),precondition:void 0,kbOpts:{weight:0,kbExpr:z.textInputFocus,primary:2090}})}run(e,t,n){if(n||={},!t.hasModel())return;let r=t._getViewModel();r.model.pushStackElement(),r.setCursorStates(n.source,3,Nu.expandLineSelection(r,r.getCursorStates())),r.revealAllCursors(n.source,!0)}});var jF=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},MF=function(e,t){return function(n,r){t(n,r,e)}},NF,PF=new A(`LinkedEditingInputVisible`,!1),FF=`linked-editing-decoration`,IF=class extends j{static{NF=this}static{this.ID=`editor.contrib.linkedEditing`}static{this.DECORATION=Y.register({description:`linked-editing`,stickiness:0,className:FF})}static get(e){return e.getContribution(NF.ID)}constructor(e,t,n,r,i){super(),this.languageConfigurationService=r,this._syncRangesToken=0,this._localToDispose=this._register(new S),this._editor=e,this._providers=n.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=PF.bindTo(t),this._debounceInformation=i.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 S),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(e=>{(e.hasChanged(78)||e.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){let t=this._editor.getModel(),n=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(n===this._enabled&&!e||(this._enabled=n,this.clearRanges(),this._localToDispose.clear(),!n||t===null))return;this._localToDispose.add(Du.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));let r=new kc(this._debounceInformation.get(t)),i=()=>{this._rangeUpdateTriggerPromise=r.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},a=new kc(0),o=e=>{this._rangeSyncTriggerPromise=a.trigger(()=>this._syncRanges(e))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{i()})),this._localToDispose.add(this._editor.onDidChangeModelContent(e=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){let t=this._currentDecorations.getRange(0);if(t&&e.changes.every(e=>t.intersectRanges(e.range))){o(this._syncRangesToken);return}}i()})),this._localToDispose.add({dispose:()=>{r.dispose(),a.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;let t=this._editor.getModel(),n=this._currentDecorations.getRange(0);if(!n||n.startLineNumber!==n.endLineNumber)return this.clearRanges();let r=t.getValueInRange(n);if(this._currentWordPattern){let e=r.match(this._currentWordPattern);if((e?e[0].length:0)!==r.length)return this.clearRanges()}let i=[];for(let e=1,n=this._currentDecorations.length;e<n;e++){let n=this._currentDecorations.getRange(e);if(n)if(n.startLineNumber!==n.endLineNumber)i.push({range:n,text:r});else{let e=t.getValueInRange(n),a=r,o=n.startColumn,s=n.endColumn,c=_n(e,a);o+=c,e=e.substr(c),a=a.substr(c);let l=Pr(e,a);s-=l,e=e.substr(0,e.length-l),a=a.substr(0,a.length-l),(o!==s||a.length!==0)&&i.push({range:new T(n.startLineNumber,o,n.endLineNumber,s),text:a})}}if(i.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;let e=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits(`linkedEditing`,i),this._editor._getViewModel().setPrevEditOperationType(e)}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}let t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}let n=this._editor.getModel(),r=n.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===r){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){let e=this._currentDecorations.getRange(0);if(e&&e.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=r;let i=this._currentRequestCts=new ou;try{let e=new ve(!1),a=await RF(this._providers,n,t,i.token);if(this._debounceInformation.update(n,e.elapsed()),i!==this._currentRequestCts||(this._currentRequestCts=null,r!==n.getVersionId()))return;let o=[];a?.ranges&&(o=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let s=!1;for(let e=0,n=o.length;e<n;e++)if(T.containsPosition(o[e],t)){if(s=!0,e!==0){let t=o[e];o.splice(e,1),o.unshift(t)}break}if(!s){this.clearRanges();return}let c=o.map(e=>({range:e,options:NF.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(c),this._syncRangesToken++}catch(e){Mo(e)||Hc(e),(this._currentRequestCts===i||!this._currentRequestCts)&&this.clearRanges()}}};IF=NF=jF([MF(1,G),MF(2,q),MF(3,eu),MF(4,Sa)],IF);var LF=class extends N{constructor(){super({id:`editor.action.linkedEditing`,label:J(1322,`Start Linked Editing`),precondition:m.and(z.writable,z.hasRenameProvider),kbOpts:{kbExpr:z.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){let n=e.get(Di),[r,i]=Array.isArray(t)&&t||[void 0,void 0];return On.isUri(r)&&M.isIPosition(i)?n.openCodeEditor({resource:r},n.getActiveCodeEditor()).then(e=>{e&&(e.setPosition(i),e.invokeWithinContext(t=>(this.reportTelemetry(t,e),this.run(t,e))))},Hc):super.runCommand(e,t)}run(e,t){let n=IF.get(t);return n?Promise.resolve(n.updateRanges(!0)):Promise.resolve()}};R(new(mt.bindToContribution(IF.get))({id:`cancelLinkedEditingInput`,precondition:PF,handler:e=>e.clearRanges(),kbOpts:{kbExpr:z.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function RF(e,t,n,r){return jo(e.ordered(t).map(e=>async()=>{try{return await e.provideLinkedEditingRanges(t,n,r)}catch(e){cc(e);return}}),e=>!!e&&Fu(e?.ranges))}E(`editor.linkedEditingBackground`,{dark:W.fromHex(`#f00`).transparent(.3),light:W.fromHex(`#f00`).transparent(.3),hcDark:W.fromHex(`#f00`).transparent(.3),hcLight:W.white},V(1321,`Background color when the editor auto renames on type.`)),br(`_executeLinkedEditingProvider`,(e,t,n)=>{let{linkedEditingRangeProvider:r}=e.get(q);return RF(r,t,n,B.None)}),F(IF.ID,IF,1),O(LF);var zF=class{constructor(e,t){this._link=e,this._provider=t}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(e){return this._link.url?this._link.url:typeof this._provider.resolveLink==`function`?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(Error(`missing`)))):Promise.reject(Error(`missing`))}},BF=class e{static{this.Empty=new e([])}constructor(t){this._disposables=new S;let n=[];for(let[r,i]of t){let t=r.links.map(e=>new zF(e,i));n=e._union(n,t),Es(r)&&(this._disposables??=new S,this._disposables.add(r))}this.links=n}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(e,t){let n=[],r,i,a,o;for(r=0,a=0,i=e.length,o=t.length;r<i&&a<o;){let i=e[r],o=t[a];if(T.areIntersectingOrTouching(i.range,o.range)){r++;continue}T.compareRangesUsingStarts(i.range,o.range)<0?(n.push(i),r++):(n.push(o),a++)}for(;r<i;r++)n.push(e[r]);for(;a<o;a++)n.push(t[a]);return n}};async function VF(e,t,n){let r=[],i=e.ordered(t).reverse().map(async(e,i)=>{try{let a=await e.provideLinks(t,n);a&&(r[i]=[a,e])}catch(e){cc(e)}});await Promise.all(i);let a=new BF(gc(r));return n.isCancellationRequested&&(a.dispose(),a=BF.Empty),a}jn.registerCommand(`_executeLinkProvider`,async(e,...t)=>{let[n,r]=t;Bi(n instanceof On),typeof r!=`number`&&(r=0);let{linkProvider:i}=e.get(q),a=e.get(yt).getModel(n);if(!a)return[];let o=await VF(i,a,B.None);if(!o)return[];for(let e=0;e<Math.min(r,o.links.length);e++)await o.links[e].resolve(B.None);let s=o.links.slice(0);return o.dispose(),s});var HF=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UF=function(e,t){return function(n,r){t(n,r,e)}},WF,GF=class extends j{static{WF=this}static{this.ID=`editor.linkDetector`}static get(e){return e.getContribution(WF.ID)}constructor(e,t,n,r,i){super(),this.editor=e,this.openerService=t,this.notificationService=n,this.languageFeaturesService=r,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=i.for(this.providers,`Links`,{min:1e3,max:4e3}),this.computeLinks=this._register(new Cl(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;let a=this._register(new Cv(e));this._register(a.onMouseMoveOrRelevantKeyDown(([e,t])=>{this._onEditorMouseMove(e,t)})),this._register(a.onExecute(e=>{this.onEditorMouseUp(e)})),this._register(a.onCancel(e=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(e=>{e.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(e=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(e=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(e=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(e=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;let e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&=(this.activeLinksList.dispose(),null),this.computePromise=ql(t=>VF(this.providers,e,t));try{let t=new ve(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(e){Hc(e)}finally{this.computePromise=null}}}updateDecorations(e){let t=this.editor.getOption(86)===`altKey`,n=[],r=Object.keys(this.currentOccurrences);for(let e of r){let t=this.currentOccurrences[e];n.push(t.decorationId)}let i=[];if(e)for(let n of e)i.push(qF.decoration(n,t));this.editor.changeDecorations(t=>{let r=t.deltaDecorations(n,i);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let t=0,n=r.length;t<n;t++){let n=new qF(e[t],r[t]);this.currentOccurrences[n.decorationId]=n}})}_onEditorMouseMove(e,t){let n=this.editor.getOption(86)===`altKey`;if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();let t=this.getLinkOccurrence(e.target.position);t&&this.editor.changeDecorations(e=>{t.activate(e,n),this.activeLinkDecorationId=t.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){let e=this.editor.getOption(86)===`altKey`;if(this.activeLinkDecorationId){let t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(n=>{t.deactivate(n,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;let t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,n=!1){if(!this.openerService)return;let{link:r}=e;r.resolve(B.None).then(e=>{if(typeof e==`string`&&this.editor.hasModel()){let t=this.editor.getModel().uri;if(t.scheme===Ks.file&&e.startsWith(`${Ks.file}:`)){let n=On.parse(e);if(n.scheme===Ks.file){let r=Bc(n),i=null;r.startsWith(`/./`)||r.startsWith(`\\.\\`)?i=`.${r.substr(1)}`:(r.startsWith(`//./`)||r.startsWith(`\\\\.\\`))&&(i=`.${r.substr(2)}`),i&&(e=Ao(t,i))}}}return this.openerService.open(e,{openToSide:t,fromUserGesture:n,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},e=>{let t=e instanceof Error?e.message:e;t===`invalid`?this.notificationService.warn(V(1323,`Failed to open this link because it is not well-formed: {0}`,r.url.toString())):t===`missing`?this.notificationService.warn(V(1324,`Failed to open this link because its target is missing.`)):Hc(e)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;let t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(let e of t){let t=this.currentOccurrences[e.id];if(t)return t}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(),null),this.computePromise&&=(this.computePromise.cancel(),null)}dispose(){super.dispose(),this.stop()}};GF=WF=HF([UF(1,gn),UF(2,di),UF(3,q),UF(4,Sa)],GF);var KF={general:Y.register({description:`detected-link`,stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:`detected-link`}),active:Y.register({description:`detected-link-active`,stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:`detected-link-active`})},qF=class e{static decoration(t,n){return{range:t.range,options:e._getOptions(t,n,!1)}}static _getOptions(e,t,n){let r={...n?KF.active:KF.general};return r.hoverMessage=JF(e,t),r}constructor(e,t){this.link=e,this.decorationId=t}activate(t,n){t.changeDecorationOptions(this.decorationId,e._getOptions(this.link,n,!0))}deactivate(t,n){t.changeDecorationOptions(this.decorationId,e._getOptions(this.link,n,!1))}};function JF(e,t){let n=e.url&&/^command:/i.test(e.url.toString()),r=e.tooltip?e.tooltip:n?V(1325,`Execute command`):V(1326,`Follow link`),i=t?oi?V(1327,`cmd + click`):V(1328,`ctrl + click`):oi?V(1329,`option + click`):V(1330,`alt + click`);if(e.url){let t=``;if(/^command:/i.test(e.url.toString())){let n=e.url.toString().match(/^command:([^?#]+)/);if(n){let e=n[1];t=V(1331,`Execute command {0}`,e)}}return new li(``,!0).appendLink(e.url.toString(!0).replace(/ /g,`%20`),r,t).appendMarkdown(` (${i})`)}else return new li().appendText(`${r} (${i})`)}var YF=class extends N{constructor(){super({id:`editor.action.openLink`,label:J(1332,`Open Link`),precondition:void 0})}run(e,t){let n=GF.get(t);if(!n||!t.hasModel())return;let r=t.getSelections();for(let e of r){let t=n.getLinkOccurrence(e.getEndPosition());t&&n.openLinkOccurrence(t,!1)}}};F(GF.ID,GF,1),O(YF);var XF=class extends j{static{this.ID=`editor.contrib.longLinesHelper`}constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(e=>{let t=this._editor.getOption(133);t>=0&&e.target.type===6&&e.target.position.column>=t&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}};F(XF.ID,XF,2);var ZF=class extends j{static{this.ID=`editor.contrib.middleScroll`}constructor(e){super(),this._editor=e;let t=lu(this._editor),n=t.getOption(171);this._register(k(e=>{if(!n.read(e))return;let r=t.domNode.read(e);if(!r)return;let i=e.store.add(yi(`scrollingSession`,void 0));e.store.add(this._editor.onMouseDown(e=>{if(i.read(void 0)){i.set(void 0,void 0);return}if(!e.event.middleButton)return;e.event.stopPropagation(),e.event.preventDefault();let t=new S,n=new Hu(e.event.posx,e.event.posy),a=QF(_a(r),n,t).map(e=>e.subtract(n).withThreshold(5)),o=r.getBoundingClientRect(),s=new Hu(n.x-o.left,n.y-o.top);i.set({mouseDeltaAfterThreshold:a,initialMousePosInEditor:s,didScroll:!1,dispose:()=>t.dispose()},void 0),t.add(this._editor.onMouseUp(e=>{let t=i.read(void 0);t&&t.didScroll&&i.set(void 0,void 0)})),t.add(this._editor.onKeyDown(e=>{i.set(void 0,void 0)}))})),e.store.add(k(e=>{let t=i.read(e);if(!t)return;let n=Date.now();e.store.add(k(e=>{DE.instance.invalidateOnNextAnimationFrame(e);let r=Date.now(),i=r-n;n=r;let a=t.mouseDeltaAfterThreshold.read(void 0),o=i/32,s=a.scale(o),c=new Hu(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition($F(c.add(s))),s.isZero()||(t.didScroll=!0)}));let a=L(e=>{let n=t.mouseDeltaAfterThreshold.read(e),r=``;return r+=n.y<0?`n`:n.y>0?`s`:``,r+=n.x<0?`w`:n.x>0?`e`:``,r});e.store.add(k(e=>{r.setAttribute(`data-scroll-direction`,a.read(e))}))}));let a=e.store.add(X.div({class:[`scroll-editor-on-middle-click-dot`,i.map(e=>e?``:`hidden`)],style:{left:i.map(e=>e?e.initialMousePosInEditor.x:0),top:i.map(e=>e?e.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());e.store.add(Cn(r,a.element)),e.store.add(k(e=>{let t=i.read(e);r.classList.toggle(`scroll-editor-on-middle-click-editor`,!!t)}))}))}};function QF(e,t,n){let r=St(`pos`,t);return n.add(K(e,`mousemove`,e=>{r.set(new Hu(e.pageX,e.pageY),void 0)})),r}function $F(e){return{scrollLeft:e.x,scrollTop:e.y}}F(ZF.ID,ZF,2);var eI=E(`editor.wordHighlightBackground`,{dark:`#575757B8`,light:`#57575740`,hcDark:null,hcLight:null},V(1615,`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);E(`editor.wordHighlightStrongBackground`,{dark:`#004972B8`,light:`#0e639c40`,hcDark:null,hcLight:null},V(1616,`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),E(`editor.wordHighlightTextBackground`,eI,V(1617,`Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations.`),!0);var tI=E(`editor.wordHighlightBorder`,{light:null,dark:null,hcDark:Hn,hcLight:Hn},V(1618,`Border color of a symbol during read-access, like reading a variable.`));E(`editor.wordHighlightStrongBorder`,{light:null,dark:null,hcDark:Hn,hcLight:Hn},V(1619,`Border color of a symbol during write-access, like writing to a variable.`)),E(`editor.wordHighlightTextBorder`,tI,V(1620,`Border color of a textual occurrence for a symbol.`));var nI=E(`editorOverviewRuler.wordHighlightForeground`,`#A0A0A0CC`,V(1621,`Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations.`),!0),rI=E(`editorOverviewRuler.wordHighlightStrongForeground`,`#C0A0C0CC`,V(1622,`Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations.`),!0),iI=E(`editorOverviewRuler.wordHighlightTextForeground`,hu,V(1623,`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),aI=Y.register({description:`word-highlight-strong`,stickiness:1,className:`wordHighlightStrong`,overviewRuler:{color:pl(rI),position:Su.Center},minimap:{color:pl(Qt),position:1}}),oI=Y.register({description:`word-highlight-text`,stickiness:1,className:`wordHighlightText`,overviewRuler:{color:pl(iI),position:Su.Center},minimap:{color:pl(Qt),position:1}}),sI=Y.register({description:`selection-highlight-overview`,stickiness:1,className:`selectionHighlight`,overviewRuler:{color:pl(hu),position:Su.Center},minimap:{color:pl(Qt),position:1}}),cI=Y.register({description:`selection-highlight`,stickiness:1,className:`selectionHighlight`}),lI=Y.register({description:`word-highlight`,stickiness:1,className:`wordHighlight`,overviewRuler:{color:pl(nI),position:Su.Center},minimap:{color:pl(Qt),position:1}});function uI(e){return e===y.Write?aI:e===y.Text?oI:lI}function dI(e){return e?cI:sI}xc((e,t)=>{let n=e.getColor(iu);n&&t.addRule(`.monaco-editor .selectionHighlight { background-color: ${n.transparent(.5)}; }`)});var fI=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},pI=function(e,t){return function(n,r){t(n,r,e)}},mI;function hI(e,t){let n=t.filter(t=>!e.find(e=>e.equals(t)));if(n.length>=1){let e=n.map(e=>`line ${e.viewState.position.lineNumber} column ${e.viewState.position.column}`).join(`, `);zt(n.length===1?V(1334,`Cursor added: {0}`,e):V(1335,`Cursors added: {0}`,e))}}var gI=class extends N{constructor(){super({id:`editor.action.insertCursorAbove`,label:J(1344,`Add Cursor Above`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1336,`&&Add Cursor Above`),order:2}})}run(e,t,n){if(!t.hasModel())return;let r=!0;n&&n.logicalLine===!1&&(r=!1);let i=t._getViewModel();if(i.cursorConfig.readOnly)return;i.model.pushStackElement();let a=i.getCursorStates();i.setCursorStates(n.source,3,Nu.addCursorUp(i,a,r)),i.revealTopMostCursor(n.source),hI(a,i.getCursorStates())}},_I=class extends N{constructor(){super({id:`editor.action.insertCursorBelow`,label:J(1345,`Add Cursor Below`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1337,`A&&dd Cursor Below`),order:3}})}run(e,t,n){if(!t.hasModel())return;let r=!0;n&&n.logicalLine===!1&&(r=!1);let i=t._getViewModel();if(i.cursorConfig.readOnly)return;i.model.pushStackElement();let a=i.getCursorStates();i.setCursorStates(n.source,3,Nu.addCursorDown(i,a,r)),i.revealBottomMostCursor(n.source),hI(a,i.getCursorStates())}},vI=class extends N{constructor(){super({id:`editor.action.insertCursorAtEndOfEachLineSelected`,label:J(1346,`Add Cursors to Line Ends`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1338,`Add C&&ursors to Line Ends`),order:4}})}getCursorsForSelection(e,t,n){if(!e.isEmpty()){for(let r=e.startLineNumber;r<e.endLineNumber;r++){let e=t.getLineMaxColumn(r);n.push(new P(r,e,r,e))}e.endColumn>1&&n.push(new P(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;let n=t.getModel(),r=t.getSelections(),i=t._getViewModel(),a=i.getCursorStates(),o=[];r.forEach(e=>this.getCursorsForSelection(e,n,o)),o.length>0&&t.setSelections(o),hI(a,i.getCursorStates())}},yI=class extends N{constructor(){super({id:`editor.action.addCursorsToBottom`,label:J(1347,`Add Cursors to Bottom`),precondition:void 0})}run(e,t){if(!t.hasModel())return;let n=t.getSelections(),r=t.getModel().getLineCount(),i=[];for(let e=n[0].startLineNumber;e<=r;e++)i.push(new P(e,n[0].startColumn,e,n[0].endColumn));let a=t._getViewModel(),o=a.getCursorStates();i.length>0&&t.setSelections(i),hI(o,a.getCursorStates())}},bI=class extends N{constructor(){super({id:`editor.action.addCursorsToTop`,label:J(1348,`Add Cursors to Top`),precondition:void 0})}run(e,t){if(!t.hasModel())return;let n=t.getSelections(),r=[];for(let e=n[0].startLineNumber;e>=1;e--)r.push(new P(e,n[0].startColumn,e,n[0].endColumn));let i=t._getViewModel(),a=i.getCursorStates();r.length>0&&t.setSelections(r),hI(a,i.getCursorStates())}},xI=class{constructor(e,t,n){this.selections=e,this.revealRange=t,this.revealScrollType=n}},SI=class e{static create(t,n){if(!t.hasModel())return null;let r=n.getState();if(!t.hasTextFocus()&&r.isRevealed&&r.searchString.length>0)return new e(t,n,!1,r.searchString,r.wholeWord,r.matchCase,null);let i=!1,a,o,s=t.getSelections();s.length===1&&s[0].isEmpty()?(i=!0,a=!0,o=!0):(a=r.wholeWord,o=r.matchCase);let c=t.getSelection(),l,u=null;if(c.isEmpty()){let e=t.getConfiguredWordAtPosition(c.getStartPosition());if(!e)return null;l=e.word,u=new P(c.startLineNumber,e.startColumn,c.startLineNumber,e.endColumn)}else l=t.getModel().getValueInRange(c).replace(/\r\n/g,`
48
+ `);return new e(t,n,i,l,a,o,u)}constructor(e,t,n,r,i,a,o){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=n,this.searchText=r,this.wholeWord=i,this.matchCase=a,this.currentMatch=o}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let e=this._getNextMatch();return e?new xI(this._editor.getSelections().concat(e),e,0):null}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let e=this._getNextMatch();if(!e)return null;let t=this._editor.getSelections();return new xI(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let e=this.currentMatch;return this.currentMatch=null,e}this.findController.highlightFindOptions();let e=this._editor.getSelections(),t=e[e.length-1],n=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return n?new P(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let e=this._getPreviousMatch();return e?new xI(this._editor.getSelections().concat(e),e,0):null}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let e=this._getPreviousMatch();if(!e)return null;let t=this._editor.getSelections();return new xI(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let e=this.currentMatch;return this.currentMatch=null,e}this.findController.highlightFindOptions();let e=this._editor.getSelections(),t=e[e.length-1],n=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return n?new P(n.range.startLineNumber,n.range.startColumn,n.range.endLineNumber,n.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();let 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)}},CI=class e extends j{static{this.ID=`editor.contrib.multiCursorController`}static get(t){return t.getContribution(e.ID)}constructor(e){super(),this._sessionDispose=this._register(new S),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){let t=SI.create(this._editor,e);if(!t)return;this._session=t;let n={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(n.wholeWordOverride=1,n.matchCaseOverride=1,n.isRegexOverride=2),e.getState().change(n,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(e=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(e=>{(e.matchCase||e.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;let n=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return n?new P(t.startLineNumber,n.startColumn,t.startLineNumber,n.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){let t=this._editor.getSelections();if(t.length>1){let n=e.getState().matchCase;if(!NI(this._editor.getModel(),t,n)){let e=this._editor.getModel(),n=[];for(let r=0,i=t.length;r<i;r++)n[r]=this._expandEmptyToWord(e,t[r]);this._editor.setSelections(n);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,n=e.getState();if(n.isRevealed&&n.searchString.length>0&&n.isRegex){let e=this._editor.getModel();t=n.searchScope?e.findMatches(n.searchString,n.searchScope,n.isRegex,n.matchCase,n.wholeWord?this._editor.getOption(148):null,!1,1073741824):e.findMatches(n.searchString,!0,n.isRegex,n.matchCase,n.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(n.searchScope)}if(t.length>0){let e=this._editor.getSelection();for(let n=0,r=t.length;n<r;n++){let r=t[n];if(r.range.intersectRanges(e)){t[n]=t[0],t[0]=r;break}}this._setSelections(t.map(e=>new P(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn)))}}},wI=class extends N{run(e,t){let n=CI.get(t);if(!n)return;let r=t._getViewModel();if(r){let i=r.getCursorStates(),a=zx.get(t);if(a)this._run(n,a);else{let r=e.get(w).createInstance(zx,t);this._run(n,r),r.dispose()}hI(i,r.getCursorStates())}}},TI=class extends wI{constructor(){super({id:`editor.action.addSelectionToNextFindMatch`,label:J(1349,`Add Selection to Next Find Match`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:2082,weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1339,`Add &&Next Occurrence`),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}},EI=class extends wI{constructor(){super({id:`editor.action.addSelectionToPreviousFindMatch`,label:J(1350,`Add Selection to Previous Find Match`),precondition:void 0,menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1340,`Add P&&revious Occurrence`),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}},DI=class extends wI{constructor(){super({id:`editor.action.moveSelectionToNextFindMatch`,label:J(1351,`Move Last Selection to Next Find Match`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:ln(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}},OI=class extends wI{constructor(){super({id:`editor.action.moveSelectionToPreviousFindMatch`,label:J(1352,`Move Last Selection to Previous Find Match`),precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}},kI=class extends wI{constructor(){super({id:`editor.action.selectHighlights`,label:J(1353,`Select All Occurrences of Find Match`),precondition:void 0,kbOpts:{kbExpr:z.focus,primary:3114,weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`3_multi`,title:V(1341,`Select All &&Occurrences`),order:7}})}_run(e,t){e.selectAll(t)}},AI=class extends wI{constructor(){super({id:`editor.action.changeAll`,label:J(1354,`Change All Occurrences`),precondition:m.and(z.writable,z.editorTextFocus),kbOpts:{kbExpr:z.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:`1_modification`,order:1.2}})}_run(e,t){e.selectAll(t)}},jI=class{constructor(e,t,n,r,i){this._model=e,this._searchText=t,this._matchCase=n,this._wordSeparators=r,this._cachedFindMatches=null,this._modelVersionId=this._model.getVersionId(),i&&this._model===i._model&&this._searchText===i._searchText&&this._matchCase===i._matchCase&&this._wordSeparators===i._wordSeparators&&this._modelVersionId===i._modelVersionId&&(this._cachedFindMatches=i._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(T.compareRangesUsingStarts)),this._cachedFindMatches}},MI=class extends j{static{mI=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 Cl(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(t=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(e=>{this._isEnabled&&(e.selection.isEmpty()?e.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(e=>{this._setState(null)})),this._register(e.onDidChangeModelContent(e=>{this._isEnabled&&this.updateSoon.schedule()}));let n=zx.get(e);n&&this._register(n.getState().onFindReplaceStateChange(e=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(mI._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,n,r,i){if(!t||!i.hasModel())return null;if(!n){let e=i.getSelection();if(e.startLineNumber!==e.endLineNumber)return null}let a=CI.get(i);if(!a)return null;let o=zx.get(i);if(!o)return null;let s=a.getSession(o);if(!s){let e=i.getSelections();if(e.length>1){let t=o.getState().matchCase;if(!NI(i.getModel(),e,t))return null}s=SI.create(i,o)}if(!s||s.currentMatch||/^[ \t]+$/.test(s.searchText)||r>0&&s.searchText.length>r)return null;let c=o.getState(),l=c.matchCase;if(c.isRevealed){let e=c.searchString;l||(e=e.toLowerCase());let t=s.searchText;if(l||(t=t.toLowerCase()),e===t&&s.matchCase===c.matchCase&&s.wholeWord===c.wholeWord&&!c.isRegex)return null}return new jI(i.getModel(),s.searchText,s.matchCase,s.wholeWord?i.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;let t=this.editor.getModel();if(t.isTooLargeForTokenization())return;let n=this.state.findMatches(),r=this.editor.getSelections();r.sort(T.compareRangesUsingStarts);let i=[];for(let e=0,t=0,a=n.length,o=r.length;e<a;){let a=n[e];if(t>=o)i.push(a),e++;else{let n=T.compareRangesUsingStarts(a,r[t]);n<0?((r[t].isEmpty()||!T.areIntersecting(a,r[t]))&&i.push(a),e++):(n>0||e++,t++)}}let a=this.editor.getOption(90)!==`off`,o=this._languageFeaturesService.documentHighlightProvider.has(t)&&a,s=i.map(e=>({range:e,options:dI(o)}));this._decorations.set(s)}dispose(){this._setState(null),super.dispose()}};MI=mI=fI([pI(1,q)],MI);function NI(e,t,n){let r=PI(e,t[0],!n);for(let i=1,a=t.length;i<a;i++){let a=t[i];if(a.isEmpty()||r!==PI(e,a,!n))return!1}return!0}function PI(e,t,n){let r=e.getValueInRange(t);return n?r.toLowerCase():r}var FI=class extends N{constructor(){super({id:`editor.action.focusNextCursor`,label:J(1355,`Focus Next Cursor`),metadata:{description:V(1342,`Focuses the next cursor`),args:[]},precondition:void 0})}run(e,t,n){if(!t.hasModel())return;let r=t._getViewModel();if(r.cursorConfig.readOnly)return;r.model.pushStackElement();let i=Array.from(r.getCursorStates()),a=i.shift();a&&(i.push(a),r.setCursorStates(n.source,3,i),r.revealPrimaryCursor(n.source,!0),hI(i,r.getCursorStates()))}},II=class extends N{constructor(){super({id:`editor.action.focusPreviousCursor`,label:J(1356,`Focus Previous Cursor`),metadata:{description:V(1343,`Focuses the previous cursor`),args:[]},precondition:void 0})}run(e,t,n){if(!t.hasModel())return;let r=t._getViewModel();if(r.cursorConfig.readOnly)return;r.model.pushStackElement();let i=Array.from(r.getCursorStates()),a=i.pop();a&&(i.unshift(a),r.setCursorStates(n.source,3,i),r.revealPrimaryCursor(n.source,!0),hI(i,r.getCursorStates()))}};F(CI.ID,CI,4),F(MI.ID,MI,1),O(gI),O(_I),O(vI),O(TI),O(EI),O(DI),O(OI),O(kI),O(AI),O(yI),O(bI),O(FI),O(II);var LI={Visible:new A(`parameterHintsVisible`,!1),MultipleSignatures:new A(`parameterHintsMultipleSignatures`,!1)};async function RI(e,t,n,r,i){let a=e.ordered(t);for(let e of a)try{let a=await e.provideSignatureHelp(t,n,i,r);if(a)return a}catch(e){cc(e)}}jn.registerCommand(`_executeSignatureHelpProvider`,async(e,...t)=>{let[n,r,i]=t;Bi(On.isUri(n)),Bi(M.isIPosition(r)),Bi(typeof i==`string`||!i);let a=e.get(q),o=await e.get(gi).createModelReference(n);try{let e=await RI(a.signatureHelpProvider,o.object.textEditorModel,M.lift(r),{triggerKind:wt.Invoke,isRetrigger:!1,triggerCharacter:i},B.None);return e?(setTimeout(()=>e.dispose(),0),e.value):void 0}finally{o.dispose()}});var zI;(function(e){e.Default={type:0};class t{constructor(e,t){this.request=e,this.previouslyActiveHints=t,this.type=2}}e.Pending=t;class n{constructor(e){this.hints=e,this.type=1}}e.Active=n})(zI||={});var BI=class e extends j{static{this.DEFAULT_DELAY=120}constructor(t,n,r=e.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new U),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=zI.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new Ae),this.triggerChars=new En,this.retriggerChars=new En,this.triggerId=0,this.editor=t,this.providers=n,this.throttledDelayer=this._register(new kc(r)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(e=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(e=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(e=>this.onCursorChange(e))),this._register(this.editor.onDidChangeModelContent(e=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(e=>this.onDidType(e))),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=zI.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){let n=this.editor.getModel();if(!n||!this.providers.has(n))return;let r=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(r),t).catch(Hc)}next(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,n=t%e===e-1,r=this.editor.getOption(98).cycle;if((e<2||n)&&!r){this.cancel();return}this.updateActiveSignature(n&&r?0:t+1)}previous(){if(this.state.type!==1)return;let e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,n=t===0,r=this.editor.getOption(98).cycle;if((e<2||n)&&!r){this.cancel();return}this.updateActiveSignature(n&&r?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new zI.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){let t=this.state.type===1||this.state.type===2,n=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;let r=this._pendingTriggers.reduce(VI);this._pendingTriggers=[];let i={triggerKind:r.triggerKind,triggerCharacter:r.triggerCharacter,isRetrigger:t,activeSignatureHelp:n};if(!this.editor.hasModel())return!1;let a=this.editor.getModel(),o=this.editor.getPosition();this.state=new zI.Pending(ql(e=>RI(this.providers,a,o,i,e)),n);try{let t=await this.state.request;return e===this.triggerId?!t||!t.value.signatures||t.value.signatures.length===0?(t?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new zI.Active(t.value),this._lastSignatureHelpResult.value=t,this._onChangedHints.fire(this.state.hints),!0):(t?.dispose(),!1)}catch(t){return e===this.triggerId&&(this.state=zI.Default),Hc(t),!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();let e=this.editor.getModel();if(e)for(let t of this.providers.ordered(e)){for(let e of t.signatureHelpTriggerCharacters||[])if(e.length){let t=e.charCodeAt(0);this.triggerChars.add(t),this.retriggerChars.add(t)}for(let e of t.signatureHelpRetriggerCharacters||[])e.length&&this.retriggerChars.add(e.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;let t=e.length-1,n=e.charCodeAt(t);(this.triggerChars.has(n)||this.isTriggered&&this.retriggerChars.has(n))&&this.trigger({triggerKind:wt.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source===`mouse`?this.cancel():this.isTriggered&&this.trigger({triggerKind:wt.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:wt.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};function VI(e,t){switch(t.triggerKind){case wt.Invoke:return t;case wt.ContentChange:return e;case wt.TriggerCharacter:default:return t}}var HI=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UI=function(e,t){return function(n,r){t(n,r,e)}},WI,GI=I,KI=Vs(`parameter-hints-next`,D.chevronDown,V(1358,`Icon for show next parameter hint.`)),qI=Vs(`parameter-hints-previous`,D.chevronUp,V(1359,`Icon for show previous parameter hint.`)),JI=class extends j{static{WI=this}static{this.ID=`editor.widget.parameterHintsWidget`}constructor(e,t,n,r){super(),this.editor=e,this.model=t,this.markdownRendererService=r,this.renderDisposeables=this._register(new S),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.keyVisible=LI.Visible.bindTo(n),this.keyMultipleSignatures=LI.MultipleSignatures.bindTo(n)}createParameterHintDOMNodes(){let e=GI(`.editor-widget.parameter-hints-widget`),t=H(e,GI(`.phwrapper`));t.tabIndex=-1;let n=H(t,GI(`.controls`)),r=H(n,GI(`.button`+C.asCSSSelector(qI))),i=H(n,GI(`.overloads`)),a=H(n,GI(`.button`+C.asCSSSelector(KI)));this._register(K(r,`click`,e=>{aa.stop(e),this.previous()})),this._register(K(a,`click`,e=>{aa.stop(e),this.next()}));let o=GI(`.body`),s=new su(o,{alwaysConsumeMouseWheel:!0});this._register(s),t.appendChild(s.getDomNode());let c=H(o,GI(`.signature`)),l=H(o,GI(`.docs`));e.style.userSelect=`text`,this.domNodes={element:e,signature:c,overloads:i,docs:l,scrollbar:s},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(e=>{this.visible&&this.editor.layoutContentWidget(this)}));let u=()=>{if(!this.domNodes)return;let e=this.editor.getOption(59),t=this.domNodes.element;t.style.fontSize=`${e.fontSize}px`,t.style.lineHeight=`${e.lineHeight/e.fontSize}`,t.style.setProperty(`--vscode-parameterHintsWidget-editorFontFamily`,e.fontFamily),t.style.setProperty(`--vscode-parameterHintsWidget-editorFontFamilyDefault`,Ri.fontFamily)};u(),this._register(Du.chain(this.editor.onDidChangeConfiguration.bind(this.editor),e=>e.filter(e=>e.hasChanged(59)))(u)),this._register(this.editor.onDidLayoutChange(e=>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;let t=e.signatures.length>1;this.domNodes.element.classList.toggle(`multiple`,t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText=``,this.domNodes.docs.innerText=``;let n=e.signatures[e.activeSignature];if(!n)return;let r=H(this.domNodes.signature,GI(`.code`)),i=n.parameters.length>0,a=n.activeParameter??e.activeParameter;if(i)this.renderParameters(r,n,a);else{let e=H(r,GI(`span`));e.textContent=n.label}let o=n.parameters[a];if(o?.documentation){let e=GI(`span.documentation`);if(typeof o.documentation==`string`)e.textContent=o.documentation;else{let t=this.renderMarkdownDocs(o.documentation);e.appendChild(t.element)}H(this.domNodes.docs,GI(`p`,{},e))}if(n.documentation!==void 0)if(typeof n.documentation==`string`)H(this.domNodes.docs,GI(`p`,{},n.documentation));else{let e=this.renderMarkdownDocs(n.documentation);H(this.domNodes.docs,e.element)}let s=this.hasDocs(n,o);if(this.domNodes.signature.classList.toggle(`has-docs`,s),this.domNodes.docs.classList.toggle(`empty`,!s),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,`0`)+`/`+e.signatures.length,o){let e=``,t=n.parameters[a];e=Array.isArray(t.label)?n.label.substring(t.label[0],t.label[1]):t.label,t.documentation&&(e+=typeof t.documentation==`string`?`, ${t.documentation}`:`, ${t.documentation.value}`),n.documentation&&(e+=typeof n.documentation==`string`?`, ${n.documentation}`:`, ${n.documentation.value}`),this.announcedLabel!==e&&($c(V(1360,`{0}, hint`,e)),this.announcedLabel=e)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){let 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`&&Xi(t.documentation).length>0||t&&typeof t.documentation==`object`&&Xi(t.documentation).value.length>0||e.documentation&&typeof e.documentation==`string`&&Xi(e.documentation).length>0||e.documentation&&typeof e.documentation==`object`&&Xi(e.documentation.value).length>0)}renderParameters(e,t,n){let[r,i]=this.getParameterLabelOffsets(t,n),a=document.createElement(`span`);a.textContent=t.label.substring(0,r);let o=document.createElement(`span`);o.textContent=t.label.substring(r,i),o.className=`parameter active`;let s=document.createElement(`span`);s.textContent=t.label.substring(i),H(e,a,o,s)}getParameterLabelOffsets(e,t){let n=e.parameters[t];if(!n)return[0,0];if(Array.isArray(n.label))return n.label;if(n.label.length){let t=RegExp(`(\\W|^)${pi(n.label)}(?=\\W|$)`,`g`);t.test(e.label);let r=t.lastIndex-n.label.length;return r>=0?[r,t.lastIndex]:[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 WI.ID}updateMaxHeight(){if(!this.domNodes)return;let e=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=e;let t=this.domNodes.element.getElementsByClassName(`phwrapper`);t.length&&(t[0].style.maxHeight=e)}};JI=WI=HI([UI(2,G),UI(3,it)],JI),E(`editorHoverWidget.highlightForeground`,ki,V(1361,`Foreground color of the active item in the parameter hint.`));var YI=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},XI=function(e,t){return function(n,r){t(n,r,e)}},ZI,QI=class extends j{static{ZI=this}static{this.ID=`editor.controller.parameterHints`}static get(e){return e.getContribution(ZI.ID)}constructor(e,t,n){super(),this.editor=e,this.model=this._register(new BI(e,n.signatureHelpProvider)),this._register(this.model.onChangedHints(e=>{e?(this.widget.value.show(),this.widget.value.render(e)):this.widget.rawValue?.hide()})),this.widget=new yc(()=>this._register(t.createInstance(JI,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)}};QI=ZI=YI([XI(1,w),XI(2,q)],QI);var $I=class extends N{constructor(){super({id:`editor.action.triggerParameterHints`,label:J(1357,`Trigger Parameter Hints`),precondition:z.hasSignatureHelpProvider,kbOpts:{kbExpr:z.editorTextFocus,primary:3082,weight:100}})}run(e,t){QI.get(t)?.trigger({triggerKind:wt.Invoke})}};F(QI.ID,QI,2),O($I);var eL=175,tL=mt.bindToContribution(QI.get);R(new tL({id:`closeParameterHints`,precondition:LI.Visible,handler:e=>e.cancel(),kbOpts:{weight:eL,kbExpr:z.focus,primary:9,secondary:[1033]}})),R(new tL({id:`showPrevParameterHint`,precondition:m.and(LI.Visible,LI.MultipleSignatures),handler:e=>e.previous(),kbOpts:{weight:eL,kbExpr:z.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),R(new tL({id:`showNextParameterHint`,precondition:m.and(LI.Visible,LI.MultipleSignatures),handler:e=>e.next(),kbOpts:{weight:eL,kbExpr:z.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var nL=class extends j{static{this.ID=`editor.contrib.placeholderText`}constructor(e){super(),this._editor=e,this._editorObs=lu(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=gr({owner:this,equalsFn:Ml},e=>{let t=this._placeholderText.read(e);if(t&&this._editorObs.valueIsEmpty.read(e))return{placeholder:t}}),this._shouldViewBeAlive=rL(this,e=>this._state.read(e)?.placeholder!==void 0),this._view=L(e=>{if(!this._shouldViewBeAlive.read(e))return;let t=cu(`div.editorPlaceholder`);e.store.add(k(e=>{let n=this._state.read(e),r=n?.placeholder!==void 0;t.root.style.display=r?`block`:`none`,t.root.innerText=n?.placeholder??``})),e.store.add(k(e=>{let n=this._editorObs.layoutInfo.read(e);t.root.style.left=`${n.contentLeft}px`,t.root.style.width=n.contentWidth-n.verticalScrollbarWidth+`px`,t.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),e.store.add(k(e=>{t.root.style.fontFamily=this._editorObs.getOption(58).read(e),t.root.style.fontSize=this._editorObs.getOption(61).read(e)+`px`,t.root.style.lineHeight=this._editorObs.getOption(75).read(e)+`px`})),e.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:pc(0),position:pc(null),domNode:t.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};function rL(e,t){return ir(e,(e,n)=>n===!0?!0:t(e))}var iL=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},aL=function(e,t){return function(n,r){t(n,r,e)}},oL=class{constructor(e){this.instantiationService=e}init(...e){}};function sL(e){return e()}var cL=class extends oL{constructor(e,t){super(t),this.init(e)}};cL=iL([aL(1,w)],cL),F(nL.ID,sL(()=>nL),0),E(`editor.placeholder.foreground`,c,V(1380,`Foreground color of the placeholder text in the editor.`));var lL=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},uL=function(e,t){return function(n,r){t(n,r,e)}},dL=class extends j{static{this.ID=`editor.sectionHeaderDetector`}constructor(e,t,n){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=n,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(t=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(t=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(t=>{let n=this.editor.getModel()?.getLanguageId();n&&t.affects(n)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(t=>{this.options&&!t.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(e=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(e=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new Cl(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;let t=this.editor.getModel().getLanguageId();if(!t)return;let n=this.languageConfigurationService.getLanguageConfiguration(t).comments,r=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!n&&!r?.markers))return{foldingRules:r,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;let e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;let t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(n=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(n)})}updateDecorations(e){let t=this.editor.getModel();t&&(e=e.filter(e=>{if(!e.shouldBeInComments)return!0;let n=t.validateRange(e.range),r=t.tokenization.getLineTokens(n.startLineNumber),i=r.findTokenIndexAtOffset(n.startColumn-1),a=r.getStandardTokenType(i),o=t.getLanguageIdAtPosition(n.startLineNumber,n.startColumn);return r.getLanguageId(i)===o&&a===1}));let n=Object.values(this.currentOccurrences).map(e=>e.decorationId),r=e.map(e=>fL(e));this.editor.changeDecorations(t=>{let i=t.deltaDecorations(n,r);this.currentOccurrences={};for(let t=0,n=i.length;t<n;t++){let n={sectionHeader:e[t],decorationId:i[t]};this.currentOccurrences[n.decorationId]=n}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&=(this.computePromise.cancel(),null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}};dL=lL([uL(1,eu),uL(2,$i)],dL);function fL(e){return{range:e.range,options:Y.createDynamic({description:`section-header`,stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:e.hasSeparatorLine?2:1,sectionHeaderText:e.text}})}}F(dL.ID,dL,1);function pL(e){for(let t=0,n=e.length;t<n;t+=4){let n=e[t+0],r=e[t+1],i=e[t+2],a=e[t+3];e[t+0]=a,e[t+1]=i,e[t+2]=r,e[t+3]=n}}function mL(e){let t=new Uint8Array(e.buffer,e.byteOffset,e.length*4);return bt()||pL(t),Qn.wrap(t)}function hL(e){let t=new Uint32Array(gL(e)),n=0;if(t[n++]=e.id,e.type===`full`)t[n++]=1,t[n++]=e.data.length,t.set(e.data,n),n+=e.data.length;else{t[n++]=2,t[n++]=e.deltas.length;for(let r of e.deltas)t[n++]=r.start,t[n++]=r.deleteCount,r.data?(t[n++]=r.data.length,t.set(r.data,n),n+=r.data.length):t[n++]=0}return mL(t)}function gL(e){let t=0;if(t+=2,e.type===`full`)t+=1+e.data.length;else{t+=1,t+=3*e.deltas.length;for(let n of e.deltas)n.data&&(t+=n.data.length)}return t}function _L(e){return e&&!!e.data}function vL(e){return e&&Array.isArray(e.edits)}var yL=class{constructor(e,t,n){this.provider=e,this.tokens=t,this.error=n}};function bL(e,t){return e.has(t)}function xL(e,t){let n=e.orderedGroups(t);return n.length>0?n[0]:[]}async function SL(e,t,n,r,i){let a=xL(e,t),o=await Promise.all(a.map(async e=>{let a,o=null;try{a=await e.provideDocumentSemanticTokens(t,e===n?r:null,i)}catch(e){o=e,a=null}return(!a||!_L(a)&&!vL(a))&&(a=null),new yL(e,a,o)}));for(let e of o){if(e.error)throw e.error;if(e.tokens)return e}return o.length>0?o[0]:null}function CL(e,t){let n=e.orderedGroups(t);return n.length>0?n[0]:null}var wL=class{constructor(e,t){this.provider=e,this.tokens=t}};function TL(e,t){return e.has(t)}function EL(e,t){let n=e.orderedGroups(t);return n.length>0?n[0]:[]}async function DL(e,t,n,r){let i=EL(e,t),a=await Promise.all(i.map(async e=>{let i;try{i=await e.provideDocumentRangeSemanticTokens(t,n,r)}catch(e){cc(e),i=null}return(!i||!_L(i))&&(i=null),new wL(e,i)}));for(let e of a)if(e.tokens)return e;return a.length>0?a[0]:null}jn.registerCommand(`_provideDocumentSemanticTokensLegend`,async(e,...t)=>{let[n]=t;Bi(n instanceof On);let r=e.get(yt).getModel(n);if(!r)return;let{documentSemanticTokensProvider:i}=e.get(q),a=CL(i,r);return a?a[0].getLegend():e.get(tr).executeCommand(`_provideDocumentRangeSemanticTokensLegend`,n)}),jn.registerCommand(`_provideDocumentSemanticTokens`,async(e,...t)=>{let[n]=t;Bi(n instanceof On);let r=e.get(yt).getModel(n);if(!r)return;let{documentSemanticTokensProvider:i}=e.get(q);if(!bL(i,r))return e.get(tr).executeCommand(`_provideDocumentRangeSemanticTokens`,n,r.getFullModelRange());let a=await SL(i,r,null,null,B.None);if(!a)return;let{provider:o,tokens:s}=a;if(!s||!_L(s))return;let c=hL({id:0,type:`full`,data:s.data});return s.resultId&&o.releaseDocumentSemanticTokens(s.resultId),c}),jn.registerCommand(`_provideDocumentRangeSemanticTokensLegend`,async(e,...t)=>{let[n,r]=t;Bi(n instanceof On);let i=e.get(yt).getModel(n);if(!i)return;let{documentRangeSemanticTokensProvider:a}=e.get(q),o=EL(a,i);if(o.length===0)return;if(o.length===1)return o[0].getLegend();if(!r||!T.isIRange(r))return console.warn(`provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in`),o[0].getLegend();let s=await DL(a,i,T.lift(r),B.None);if(s)return s.provider.getLegend()}),jn.registerCommand(`_provideDocumentRangeSemanticTokens`,async(e,...t)=>{let[n,r]=t;Bi(n instanceof On),Bi(T.isIRange(r));let i=e.get(yt).getModel(n);if(!i)return;let{documentRangeSemanticTokensProvider:a}=e.get(q),o=await DL(a,i,T.lift(r),B.None);if(!(!o||!o.tokens))return hL({id:0,type:`full`,data:o.tokens.data})});var OL=`editor.semanticHighlighting`;function kL(e,t,n){let r=n.getValue(OL,{overrideIdentifier:e.getLanguageId(),resource:e.uri})?.enabled;return typeof r==`boolean`?r:t.getColorTheme().semanticHighlighting}var AL=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},jL=function(e,t){return function(n,r){t(n,r,e)}},ML,NL=class extends j{constructor(e,t,n,r,i,a){super(),this._watchers=new ha,this._providerChangeListeners=this._register(new S);let o=a.documentSemanticTokensProvider,s=t=>{this._watchers.get(t.uri)?.dispose(),this._watchers.set(t.uri,new PL(t,e,n,i,a))},c=(e,t)=>{t.dispose(),this._watchers.delete(e.uri)},l=()=>{for(let e of t.getModels()){let t=this._watchers.get(e.uri);kL(e,n,r)?t||s(e):t&&c(e,t)}},u=()=>{this._providerChangeListeners.clear();for(let e of o.allNoModel())typeof e.onDidChange==`function`&&this._providerChangeListeners.add(e.onDidChange(()=>{for(let t of this._watchers.values())t.handleProviderDidChange(e)}))};t.getModels().forEach(e=>{kL(e,n,r)&&s(e)}),this._register(t.onModelAdded(e=>{kL(e,n,r)&&s(e)})),this._register(t.onModelRemoved(e=>{let t=this._watchers.get(e.uri);t&&c(e,t)})),this._register(r.onDidChangeConfiguration(e=>{e.affectsConfiguration(`editor.semanticHighlighting`)&&l()})),this._register(n.onDidColorThemeChange(l)),u(),this._register(o.onDidChange(()=>{u();for(let e of this._watchers.values())e.handleRegistryChange()}))}dispose(){h(this._watchers.values()),this._watchers.clear(),super.dispose()}};NL=AL([jL(0,Fs),jL(1,yt),jL(2,Ll),jL(3,xa),jL(4,Sa),jL(5,q)],NL);var PL=class extends j{static{ML=this}static{this.REQUEST_MIN_DELAY=300}static{this.REQUEST_MAX_DELAY=2e3}constructor(e,t,n,r,i){super(),this._semanticTokensStylingService=t,this._relevantProviders=new Set,this._isDisposed=!1,this._model=e,this._provider=i.documentSemanticTokensProvider,this._debounceInformation=r.for(this._provider,`DocumentSemanticTokens`,{min:ML.REQUEST_MIN_DELAY,max:ML.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new Cl(()=>this._fetchDocumentSemanticTokensNow(),ML.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(),null),this._currentDocumentRequestCancellationTokenSource&&=(this._currentDocumentRequestCancellationTokenSource.cancel(),null),this._setDocumentSemanticTokens(null,null,null,[]),this._updateRelevantProviders(),this._fetchDocumentSemanticTokens.schedule(0)})),this._register(n.onDidColorThemeChange(e=>{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(),null),this._currentDocumentRequestCancellationTokenSource&&=(this._currentDocumentRequestCancellationTokenSource.cancel(),null),this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!bL(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;let e=new ou,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,n=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,r=SL(this._provider,this._model,t,n,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;let i=[],a=this._model.onDidChangeContent(e=>{i.push(e)}),o=new ve(!1);r.then(e=>{if(this._debounceInformation.update(this._model,o.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,a.dispose(),!e)this._setDocumentSemanticTokens(null,null,null,i);else{let{provider:t,tokens:n}=e,r=this._semanticTokensStylingService.getStyling(t);this._setDocumentSemanticTokens(t,n||null,r,i)}},e=>{e&&(Mo(e)||typeof e.message==`string`&&e.message.indexOf(`busy`)!==-1)||Hc(e),this._currentDocumentRequestCancellationTokenSource=null,a.dispose(),(i.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,n,r,i){i=Math.min(i,n.length-r,e.length-t);for(let a=0;a<i;a++)n[r+a]=e[t+a]}_setDocumentSemanticTokens(e,t,n,r){let i=this._currentDocumentResponse,a=()=>{(r.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&=(this._currentDocumentResponse.dispose(),null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!n){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),a();return}if(vL(t)){if(!i){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:i.data};else{let e=0;for(let n of t.edits)e+=(n.data?n.data.length:0)-n.deleteCount;let r=i.data,a=new Uint32Array(r.length+e),o=r.length,s=a.length;for(let e=t.edits.length-1;e>=0;e--){let c=t.edits[e];if(c.start>r.length){n.warnInvalidEditStart(i.resultId,t.resultId,e,c.start,r.length),this._model.tokenization.setSemanticTokens(null,!0);return}let l=o-(c.start+c.deleteCount);l>0&&(ML._copy(r,o-l,a,s-l,l),s-=l),c.data&&(ML._copy(c.data,0,a,s-c.data.length,c.data.length),s-=c.data.length),o=c.start}o>0&&ML._copy(r,0,a,0,o),t={resultId:t.resultId,data:a}}}if(_L(t)){this._currentDocumentResponse=new FL(e,t.resultId,t.data);let i=f(t,n,this._model.getLanguageId());if(r.length>0)for(let e of r)for(let t of i)for(let n of e.changes)t.applyEdit(n.range,n.text);this._model.tokenization.setSemanticTokens(i,!0)}else this._model.tokenization.setSemanticTokens(null,!0);a()}};PL=ML=AL([jL(1,Fs),jL(2,Ll),jL(3,Sa),jL(4,q)],PL);var FL=class{constructor(e,t,n){this.provider=e,this.resultId=t,this.data=n}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}};Qo(NL);var IL=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},LL=function(e,t){return function(n,r){t(n,r,e)}},RL=class extends j{static{this.ID=`editor.contrib.viewportSemanticTokens`}constructor(e,t,n,r,i,a){super(),this._semanticTokensStylingService=t,this._themeService=n,this._configurationService=r,this._editor=e,this._provider=a.documentRangeSemanticTokensProvider,this._debounceInformation=i.for(this._provider,`DocumentRangeSemanticTokens`,{min:100,max:500}),this._tokenizeViewport=this._register(new Cl(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[],this._rangeProvidersChangeListeners=[];let o=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))},s=()=>{if(this._cleanupProviderListeners(),this._editor.hasModel()){let e=this._editor.getModel();for(let t of this._provider.all(e)){let e=t.onDidChange?.(()=>{this._cancelAll(),o()});e&&this._rangeProvidersChangeListeners.push(e)}}};this._register(this._editor.onDidScrollChange(()=>{o()})),this._register(this._editor.onDidChangeModel(()=>{s(),this._cancelAll(),o()})),this._register(this._editor.onDidChangeModelLanguage(()=>{s(),this._cancelAll(),o()})),this._register(this._editor.onDidChangeModelContent(e=>{this._cancelAll(),o()})),s(),this._register(this._provider.onDidChange(()=>{s(),this._cancelAll(),o()})),this._register(this._configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(`editor.semanticHighlighting`)&&(this._cancelAll(),o())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),o()})),o()}dispose(){this._cleanupProviderListeners(),super.dispose()}_cleanupProviderListeners(){h(this._rangeProvidersChangeListeners),this._rangeProvidersChangeListeners=[]}_cancelAll(){for(let e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,n=this._outstandingRequests.length;t<n;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;let e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!kL(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!TL(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}let t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(t=>this._requestRange(e,t)))}_requestRange(e,t){let n=e.getVersionId(),r=ql(n=>Promise.resolve(DL(this._provider,e,t,n))),i=new ve(!1);return r.then(r=>{if(this._debounceInformation.update(e,i.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==n)return;let{provider:a,tokens:o}=r,s=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,f(o,s,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(r),()=>this._removeOutstandingRequest(r)),r}};RL=IL([LL(1,Fs),LL(2,Ll),LL(3,xa),LL(4,Sa),LL(5,q)],RL),F(RL.ID,RL,1);var zL=class{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){let n=[];for(let r of t){let t=[];n.push(t),this.selectSubwords&&this._addInWordRanges(t,e,r),this._addWordRanges(t,e,r),this._addWhitespaceLine(t,e,r),t.push({range:e.getFullModelRange()})}return n}_addInWordRanges(e,t,n){let r=t.getWordAtPosition(n);if(!r)return;let{word:i,startColumn:a}=r,o=n.column-a,s=o,c=o,l=0;for(;s>=0;s--){let e=i.charCodeAt(s);if(s!==o&&(e===95||e===45)||pa(e)&&Sr(l))break;l=e}for(s+=1;c<i.length;c++){let e=i.charCodeAt(c);if(Sr(e)&&pa(l)||e===95||e===45)break;l=e}s<c&&e.push({range:new T(n.lineNumber,a+s,n.lineNumber,a+c)})}_addWordRanges(e,t,n){let r=t.getWordAtPosition(n);r&&e.push({range:new T(n.lineNumber,r.startColumn,n.lineNumber,r.endColumn)})}_addWhitespaceLine(e,t,n){t.getLineLength(n.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(n.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(n.lineNumber)===0&&e.push({range:new T(n.lineNumber,1,n.lineNumber,t.getLineMaxColumn(n.lineNumber))})}},BL=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},VL=function(e,t){return function(n,r){t(n,r,e)}},HL,UL=class e{constructor(e,t){this.index=e,this.ranges=t}mov(t){let n=this.index+(t?1:-1);if(n<0||n>=this.ranges.length)return this;let r=new e(n,this.ranges);return r.ranges[n].equalsRange(this.ranges[this.index])?r.mov(t):r}},WL=class{static{HL=this}static{this.ID=`editor.contrib.smartSelectController`}static get(e){return e.getContribution(HL.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;let t=this._editor.getSelections(),n=this._editor.getModel();if(this._state||await JL(this._languageFeaturesService.selectionRangeProvider,n,t.map(e=>e.getPosition()),this._editor.getOption(129),B.None).then(e=>{if(!(!Fu(e)||e.length!==t.length)&&!(!this._editor.hasModel()||!pu(this._editor.getSelections(),t,(e,t)=>e.equalsSelection(t)))){for(let n=0;n<e.length;n++)e[n]=e[n].filter(e=>e.containsPosition(t[n].getStartPosition())&&e.containsPosition(t[n].getEndPosition())),e[n].unshift(t[n]);this._state=e.map(e=>new UL(0,e)),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(t=>t.mov(e));let r=this._state.map(e=>P.fromPositions(e.ranges[e.index].getStartPosition(),e.ranges[e.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(r)}finally{this._ignoreSelection=!1}}};WL=HL=BL([VL(1,q)],WL);var GL=class extends N{constructor(e,t){super(t),this._forward=e}async run(e,t){let n=WL.get(t);n&&await n.run(this._forward)}},KL=class extends GL{constructor(){super(!0,{id:`editor.action.smartSelect.expand`,label:J(1449,`Expand Selection`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`1_basic`,title:V(1447,`&&Expand Selection`),order:2}})}};jn.registerCommandAlias(`editor.action.smartSelect.grow`,`editor.action.smartSelect.expand`);var qL=class extends GL{constructor(){super(!1,{id:`editor.action.smartSelect.shrink`,label:J(1450,`Shrink Selection`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:Z.MenubarSelectionMenu,group:`1_basic`,title:V(1448,`&&Shrink Selection`),order:3}})}};F(WL.ID,WL,4),O(KL),O(qL);async function JL(e,t,n,r,i){let a=e.all(t).concat(new zL(r.selectSubwords));a.length===1&&a.unshift(new ek);let o=[],s=[];for(let e of a)o.push(Promise.resolve(e.provideSelectionRanges(t,n,i)).then(e=>{if(Fu(e)&&e.length===n.length)for(let t=0;t<n.length;t++){s[t]||(s[t]=[]);for(let r of e[t])T.isIRange(r.range)&&T.containsPosition(r.range,n[t])&&s[t].push(T.lift(r.range))}},cc));return await Promise.all(o),s.map(e=>{if(e.length===0)return[];e.sort((e,t)=>M.isBefore(e.getStartPosition(),t.getStartPosition())?1:M.isBefore(t.getStartPosition(),e.getStartPosition())||M.isBefore(e.getEndPosition(),t.getEndPosition())?-1:+!!M.isBefore(t.getEndPosition(),e.getEndPosition()));let n=[],i;for(let t of e)(!i||T.containsRange(t,i)&&!T.equalsRange(t,i))&&(n.push(t),i=t);if(!r.selectLeadingAndTrailingWhitespace)return n;let a=[n[0]];for(let e=1;e<n.length;e++){let r=n[e-1],i=n[e];if(i.startLineNumber!==r.startLineNumber||i.endLineNumber!==r.endLineNumber){let e=new T(r.startLineNumber,t.getLineFirstNonWhitespaceColumn(r.startLineNumber),r.endLineNumber,t.getLineLastNonWhitespaceColumn(r.endLineNumber));e.containsRange(r)&&!e.equalsRange(r)&&i.containsRange(e)&&!i.equalsRange(e)&&a.push(e);let n=new T(r.startLineNumber,1,r.endLineNumber,t.getLineMaxColumn(r.endLineNumber));n.containsRange(r)&&!n.equalsRange(e)&&i.containsRange(n)&&!i.equalsRange(n)&&a.push(n)}a.push(i)}return a})}jn.registerCommand(`_executeSelectionRangeProvider`,async function(e,...t){let[n,r]=t;Bi(On.isUri(n)),Bi(oa(r,e=>M.isIPosition(e)));let i=e.get(q).selectionRangeProvider,a=await e.get(gi).createModelReference(n);try{return JL(i,a.object.textEditorModel,r.map(M.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},B.None)}finally{a.dispose()}});var YL=Object.freeze({View:J(1692,`View`),Help:J(1693,`Help`),Test:J(1694,`Test`),File:J(1695,`File`),Preferences:J(1696,`Preferences`),Developer:J(1697,`Developer`)}),XL=class extends Pi{constructor(){super({id:`editor.action.toggleStickyScroll`,title:{...J(1498,`Toggle Editor Sticky Scroll`),mnemonicTitle:V(1494,`&&Toggle Editor Sticky Scroll`)},metadata:{description:J(1499,`Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport`)},category:YL.View,toggled:{condition:m.equals(`config.editor.stickyScroll.enabled`,!0),title:V(1495,`Sticky Scroll`),mnemonicTitle:V(1496,`&&Sticky Scroll`)},menu:[{id:Z.CommandPalette},{id:Z.MenubarAppearanceMenu,group:`4_editor`,order:3},{id:Z.StickyScrollContext}]})}async runEditorCommand(e,t){let n=e.get(xa),r=!n.getValue(`editor.stickyScroll.enabled`),i=GA.get(t)?.isFocused();n.updateValue(`editor.stickyScroll.enabled`,r),i&&t.focus()}},ZL=100,QL=class extends Pi{constructor(){super({id:`editor.action.focusStickyScroll`,title:{...J(1500,`Focus Editor Sticky Scroll`),mnemonicTitle:V(1497,`&&Focus Editor Sticky Scroll`)},precondition:m.and(m.has(`config.editor.stickyScroll.enabled`),z.stickyScrollVisible),menu:[{id:Z.CommandPalette}]})}runEditorCommand(e,t){GA.get(t)?.focus()}},$L=class extends Pi{constructor(){super({id:`editor.action.selectNextStickyScrollLine`,title:J(1501,`Select the next editor sticky scroll line`),precondition:z.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ZL,primary:18}})}runEditorCommand(e,t){GA.get(t)?.focusNext()}},eR=class extends Pi{constructor(){super({id:`editor.action.selectPreviousStickyScrollLine`,title:J(1502,`Select the previous sticky scroll line`),precondition:z.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ZL,primary:16}})}runEditorCommand(e,t){GA.get(t)?.focusPrevious()}},tR=class extends Pi{constructor(){super({id:`editor.action.goToFocusedStickyScrollLine`,title:J(1503,`Go to the focused sticky scroll line`),precondition:z.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ZL,primary:3}})}runEditorCommand(e,t){GA.get(t)?.goToFocused()}},nR=class extends Pi{constructor(){super({id:`editor.action.selectEditor`,title:J(1504,`Select Editor`),precondition:z.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:ZL,primary:9}})}runEditorCommand(e,t){GA.get(t)?.selectEditor()}};F(GA.ID,GA,1),x(XL),x(QL),x(eR),x($L),x(tR),x(nR);var rR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},iR=function(e,t){return function(n,r){t(n,r,e)}},aR=class{constructor(e,t,n,r,i,a,o){this.range=e,this.insertText=t,this.filterText=n,this.additionalTextEdits=r,this.command=i,this.gutterMenuLinkAction=a,this.completion=o,this.doNotLog=!0}},oR=class extends Wn{constructor(e,t,n,r,i,a){super(i.disposable),this.model=e,this.line=t,this.word=n,this.completionModel=r,this._suggestMemoryService=a}canBeReused(e,t,n){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===n.startColumn&&this.word.endColumn<n.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){let e=[],{items:t}=this.completionModel,n=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),r=Mn.slice(t,n),i=Mn.slice(t,0,n),a=5;for(let t of Mn.concat(r,i)){if(t.score===Ut.Default)continue;let n=new T(t.editStart.lineNumber,t.editStart.column,t.editInsertEnd.lineNumber,t.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),r=t.completion.insertTextRules&&t.completion.insertTextRules&4?{snippet:t.completion.insertText}:t.completion.insertText;e.push(new aR(n,r,t.filterTextLow??t.labelLow,t.completion.additionalTextEdits,t.completion.command,t.completion.action,t)),a-->=0&&t.resolve(B.None)}return e}};oR=rR([iR(5,HO)],oR);var sR=class extends j{constructor(e,t,n,r){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=n,this._editorService=r,this._store.add(e.inlineCompletionsProvider.register(`*`,this))}async provideInlineCompletions(e,t,n,r){if(n.selectedSuggestionInfo)return;let i;for(let t of this._editorService.listCodeEditors())if(t.getModel()===e){i=t;break}if(!i)return;let a=i.getOption(102);if(fw.isAllOff(a))return;e.tokenization.tokenizeIfCheap(t.lineNumber);let o=e.tokenization.getLineTokens(t.lineNumber),s=o.getStandardTokenType(o.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(fw.valueFor(a,s)!==`inline`)return;let c=e.getWordAtPosition(t),l;if(c?.word||(l=this._getTriggerCharacterInfo(e,t)),!c?.word&&!l||(c||=e.getWordUntilPosition(t),c.endColumn!==t.column))return;let u,d=e.getValueInRange(new T(t.lineNumber,1,t.lineNumber,t.column));if(!l&&this._lastResult?.canBeReused(e,t.lineNumber,c)){let e=new QO(d,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=e,this._lastResult.acquire(),u=this._lastResult}else{let n=await aw(this._languageFeatureService.completionProvider,e,t,new rw(void 0,ck.createSuggestFilter(i).itemKind,l?.providers),l&&{triggerKind:1,triggerCharacter:l.ch},r),a;n.needsClipboard&&(a=await this._clipboardService.readText());let o=new $O(n.items,t.column,new QO(d,0),tk.None,i.getOption(134),i.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},a);u=new oR(e,t.lineNumber,c,o,n,this._suggestMemoryService)}return this._lastResult=u,u}handleItemDidShow(e,t){t.completion.resolve(B.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){let n=e.getValueInRange(T.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),r=new Set;for(let t of this._languageFeatureService.completionProvider.all(e))t.triggerCharacters?.includes(n)&&r.add(t);if(r.size!==0)return{providers:r,ch:n}}};sR=rR([iR(0,q),iR(1,xe),iR(2,HO),iR(3,Di)],sR),Qo(sR),O(class extends N{constructor(){super({id:`editor.action.forceRetokenize`,label:J(1584,`Developer: Force Retokenize`),precondition:void 0})}run(e,t){if(!t.hasModel())return;let n=t.getModel();n.tokenization.resetTokenization();let r=new ve;n.tokenization.forceTokenization(n.getLineCount()),r.stop(),console.log(`tokenization took ${r.elapsed()}`)}}),x(class e extends Ru{static{this.ID=`editor.action.toggleTabFocusMode`}constructor(){super({id:e.ID,title:J(1582,`Toggle Tab Key Moves Focus`),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:J(1583,`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(){let e=!Ei.getTabFocusMode();Ei.setTabFocusMode(e),$c(e?V(1580,`Pressing Tab will now move focus to the next focusable element`):V(1581,`Pressing Tab will now insert the tab character`))}});var cR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},lR=function(e,t){return function(n,r){t(n,r,e)}},uR=class extends j{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,n={},r,i){super(),this._link=t,this._hoverService=r,this._enabled=!0,this.el=H(e,I(`a.monaco-link`,{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=n.hoverDelegate??bs(`mouse`),this.setTooltip(t.title),this.el.setAttribute(`role`,`button`);let a=this._register(new ga(this.el,`click`)),o=this._register(new ga(this.el,`keydown`)),s=Du.chain(o.event,e=>e.map(e=>new kt(e)).filter(e=>e.keyCode===3||e.keyCode===10)),c=this._register(new ga(this.el,Ou.Tap)).event;this._register(zr.addTarget(this.el));let l=Du.any(a.event,s,c);this._register(l(e=>{this.enabled&&(aa.stop(e,!0),n?.opener?n.opener(this._link.href):i.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)}};uR=cR([lR(3,fa),lR(4,gn)],uR);var dR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},fR=function(e,t){return function(n,r){t(n,r,e)}},pR=26,mR=class extends j{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(hR))}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,pR)}};mR=dR([fR(1,w)],mR);var hR=class extends j{constructor(e,t){super(),this.instantiationService=e,this.markdownRendererService=t,this.element=I(`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`){let t=I(`span`);return t.innerText=e,t}return this.markdownRendererService.render(e).element}clear(){Mc(this.element)}show(e){Mc(this.element);let t=this.getAriaLabel(e);t&&this.element.setAttribute(`aria-label`,t);let n=H(this.element,I(`div.icon-container`));n.setAttribute(`aria-hidden`,`true`),e.icon&&n.appendChild(I(`div${C.asCSSSelector(e.icon)}`));let r=H(this.element,I(`div.message-container`));if(r.setAttribute(`aria-hidden`,`true`),r.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=H(this.element,I(`div.message-actions-container`)),e.actions)for(let t of e.actions)this._register(this.instantiationService.createInstance(uR,this.messageActionsContainer,{...t,tabIndex:-1},{}));let i=H(this.element,I(`div.action-container`));this.actionBar=this._register(new Fn(i)),this.actionBar.push(this._register(new cn(`banner.close`,V(1585,`Close Banner`),C.asClassName(v),!0,()=>{typeof e.onClose==`function`&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};hR=dR([fR(0,w),fR(1,it)],hR);var gR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},_R=function(e,t){return function(n,r){t(n,r,e)}},vR=Vs(`extensions-warning-message`,D.warning,V(1586,`Icon shown with a warning message in the extensions editor.`)),yR=class extends j{static{this.ID=`editor.contrib.unicodeHighlighter`}constructor(e,t,n,r){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=n,this._highlighter=null,this._bannerClosed=!1,this._updateState=e=>{if(e&&e.hasMore){if(this._bannerClosed)return;let t=Math.max(e.ambiguousCharacterCount,e.nonBasicAsciiCharacterCount,e.invisibleCharacterCount),n;if(e.nonBasicAsciiCharacterCount>=t)n={message:V(1587,`This document contains many non-basic ASCII unicode characters`),command:new PR};else if(e.ambiguousCharacterCount>=t)n={message:V(1588,`This document contains many ambiguous unicode characters`),command:new MR};else if(e.invisibleCharacterCount>=t)n={message:V(1589,`This document contains many invisible unicode characters`),command:new NR};else throw Error(`Unreachable`);this._bannerController.show({id:`unicodeHighlightBanner`,message:n.message,icon:vR,actions:[{label:n.command.shortLabel,href:`command:${n.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(r.createInstance(mR,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(n.onDidChangeTrust(e=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(142)&&(this._options=e.getOption(142),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&=(this._highlighter.dispose(),null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&=(this._highlighter.dispose(),null),!this._editor.hasModel())return;let e=bR(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(e=>e===!1))return;let t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(e=>e.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(e=>e===`_os`?Rn.NumberFormat().value.resolvedOptions().locale:e===`_vscode`?el:e)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new xR(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new SR(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}};yR=gR([_R(1,$i),_R(2,Vn),_R(3,w)],yR);function bR(e,t){return{nonBasicASCII:t.nonBasicASCII===`inUntrustedWorkspace`?!e:t.nonBasicASCII,ambiguousCharacters:t.ambiguousCharacters,invisibleCharacters:t.invisibleCharacters,includeComments:t.includeComments===`inUntrustedWorkspace`?!e:t.includeComments,includeStrings:t.includeStrings===`inUntrustedWorkspace`?!e:t.includeStrings,allowedCharacters:t.allowedCharacters,allowedLocales:t.allowedLocales}}var xR=class extends j{constructor(e,t,n,r){super(),this._editor=e,this._options=t,this._updateState=n,this._editorWorkerService=r,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Cl(()=>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}let 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);let n=[];if(!t.hasMore)for(let e of t.ranges)n.push({range:e,options:kR.instance.getDecorationFromOptions(this._options)});this._decorations.set(n)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel();return Gi(t,e)?{reason:OR(t.getValueInRange(e.range),this._options),inComment:Gt(t,e),inString:ea(t,e)}:null}};xR=gR([_R(3,$i)],xR);var SR=class extends j{constructor(e,t,n){super(),this._editor=e,this._options=t,this._updateState=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new Cl(()=>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}let e=this._editor.getVisibleRanges(),t=[],n={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(let t of e){let e=We.computeUnicodeHighlights(this._model,this._options,t);for(let t of e.ranges)n.ranges.push(t);n.ambiguousCharacterCount+=n.ambiguousCharacterCount,n.invisibleCharacterCount+=n.invisibleCharacterCount,n.nonBasicAsciiCharacterCount+=n.nonBasicAsciiCharacterCount,n.hasMore=n.hasMore||e.hasMore}if(!n.hasMore)for(let e of n.ranges)t.push({range:e,options:kR.instance.getDecorationFromOptions(this._options)});this._updateState(n),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;let t=this._editor.getModel(),n=t.getValueInRange(e.range);return Gi(t,e)?{reason:OR(n,this._options),inComment:Gt(t,e),inString:ea(t,e)}:null}},CR=V(1590,`Configure Unicode Highlight Options`),wR=class{constructor(e,t){this._editor=e,this._markdownRendererService=t,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];let n=this._editor.getModel(),r=this._editor.getContribution(yR.ID);if(!r)return[];let i=[],a=new Set,o=300;for(let e of t){let t=r.getDecorationInfo(e);if(!t)continue;let s=n.getValueInRange(e.range).codePointAt(0),c=ER(s),l;switch(t.reason.kind){case 0:l=cl(t.reason.confusableWith)?V(1591,`The character {0} could be confused with the ASCII character {1}, which is more common in source code.`,c,ER(t.reason.confusableWith.codePointAt(0))):V(1592,`The character {0} could be confused with the character {1}, which is more common in source code.`,c,ER(t.reason.confusableWith.codePointAt(0)));break;case 1:l=V(1593,`The character {0} is invisible.`,c);break;case 2:l=V(1594,`The character {0} is not a basic ASCII character.`,c);break}if(a.has(l))continue;a.add(l);let u={codePoint:s,reason:t.reason,inComment:t.inComment,inString:t.inString},d=V(1595,`Adjust settings`),f=ji(FR.ID,u),p=new li(``,!0).appendMarkdown(l).appendText(` `).appendLink(f,d,CR);i.push(new V_(this,e.range,[p],!1,o++))}return i}renderHoverParts(e,t){return K_(e,t,this._editor,this._markdownRendererService)}getAccessibleContent(e){return e.contents.map(e=>e.value).join(`
49
+ `)}};wR=gR([_R(1,it)],wR);function TR(e){return`U+${e.toString(16).padStart(4,`0`)}`}function ER(e){let t=`\`${TR(e)}\``;return Lt.isInvisibleCharacter(e)||(t+=` "${`${DR(e)}`}"`),t}function DR(e){return e===96?"`` ` ``":"`"+String.fromCodePoint(e)+"`"}function OR(e,t){return We.computeUnicodeHighlightReason(e,t)}var kR=class e{constructor(){this.map=new Map}static{this.instance=new e}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){let n=`${e}${t}`,r=this.map.get(n);return r||(r=Y.createDynamic({description:`unicode-highlight`,stickiness:1,className:`unicode-highlight`,showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(n,r)),r}},AR=class extends N{constructor(){super({id:MR.ID,label:J(1604,`Disable highlighting of characters in comments`),precondition:void 0}),this.shortLabel=V(1596,`Disable Highlight In Comments`)}async run(e,t){let n=e.get(xa);n&&this.runAction(n)}async runAction(e){await e.updateValue(Yi.includeComments,!1,2)}},jR=class extends N{constructor(){super({id:MR.ID,label:J(1605,`Disable highlighting of characters in strings`),precondition:void 0}),this.shortLabel=V(1597,`Disable Highlight In Strings`)}async run(e,t){let n=e.get(xa);n&&this.runAction(n)}async runAction(e){await e.updateValue(Yi.includeStrings,!1,2)}},MR=class e extends Ru{static{this.ID=`editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters`}constructor(){super({id:e.ID,title:J(1606,`Disable highlighting of ambiguous characters`),precondition:void 0,f1:!1}),this.shortLabel=V(1598,`Disable Ambiguous Highlight`)}async run(e,t){let n=e.get(xa);n&&this.runAction(n)}async runAction(e){await e.updateValue(Yi.ambiguousCharacters,!1,2)}},NR=class e extends Ru{static{this.ID=`editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters`}constructor(){super({id:e.ID,title:J(1607,`Disable highlighting of invisible characters`),precondition:void 0,f1:!1}),this.shortLabel=V(1599,`Disable Invisible Highlight`)}async run(e,t){let n=e.get(xa);n&&this.runAction(n)}async runAction(e){await e.updateValue(Yi.invisibleCharacters,!1,2)}},PR=class e extends Ru{static{this.ID=`editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters`}constructor(){super({id:e.ID,title:J(1608,`Disable highlighting of non basic ASCII characters`),precondition:void 0,f1:!1}),this.shortLabel=V(1600,`Disable Non ASCII Highlight`)}async run(e,t){let n=e.get(xa);n&&this.runAction(n)}async runAction(e){await e.updateValue(Yi.nonBasicASCII,!1,2)}},FR=class e extends Ru{static{this.ID=`editor.action.unicodeHighlight.showExcludeOptions`}constructor(){super({id:e.ID,title:J(1609,`Show Exclude Options`),precondition:void 0,f1:!1})}async run(e,t){let{codePoint:n,reason:r,inString:i,inComment:a}=t,o=String.fromCodePoint(n),s=e.get(Fi),c=e.get(xa);function l(e){return Lt.isInvisibleCharacter(e)?V(1601,`Exclude {0} (invisible character) from being highlighted`,TR(e)):V(1602,`Exclude {0} from being highlighted`,`${TR(e)} "${o}"`)}let u=[];if(r.kind===0)for(let e of r.notAmbiguousInLocales)u.push({label:V(1603,`Allow unicode characters that are more common in the language "{0}".`,e),run:async()=>{LR(c,[e])}});if(u.push({label:l(n),run:()=>IR(c,[n])}),a){let e=new AR;u.push({label:e.label,run:async()=>e.runAction(c)})}else if(i){let e=new jR;u.push({label:e.label,run:async()=>e.runAction(c)})}function d(e){return typeof e.desc.title==`string`?e.desc.title:e.desc.title.value}if(r.kind===0){let e=new MR;u.push({label:d(e),run:async()=>e.runAction(c)})}else if(r.kind===1){let e=new NR;u.push({label:d(e),run:async()=>e.runAction(c)})}else if(r.kind===2){let e=new PR;u.push({label:d(e),run:async()=>e.runAction(c)})}else RR(r);let f=await s.pick(u,{title:CR});f&&await f.run()}};async function IR(e,t){let n=e.getValue(Yi.allowedCharacters),r;r=typeof n==`object`&&n?n:{};for(let e of t)r[String.fromCodePoint(e)]=!0;await e.updateValue(Yi.allowedCharacters,r,2)}async function LR(e,t){let n=e.inspect(Yi.allowedLocales).user?.value,r;r=typeof n==`object`&&n?Object.assign({},n):{};for(let e of t)r[e]=!0;await e.updateValue(Yi.allowedLocales,r,2)}function RR(e){throw Error(`Unexpected value: ${e}`)}x(MR),x(NR),x(PR),x(FR),F(yR.ID,yR,1),Um.register(wR);var zR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},BR=function(e,t){return function(n,r){t(n,r,e)}},VR=`ignoreUnusualLineTerminators`;function HR(e,t,n){e.setModelProperty(t.uri,VR,n)}function UR(e,t){return e.getModelProperty(t.uri,VR)}var WR=class extends j{static{this.ID=`editor.contrib.unusualLineTerminatorsDetector`}constructor(e,t,n){super(),this._editor=e,this._dialogService=t,this._codeEditorService=n,this._isPresentingDialog=!1,this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(e=>{e.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(e=>{e.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config===`off`||!this._editor.hasModel())return;let e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||UR(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:V(1610,`Unusual Line Terminators`),message:V(1611,`Detected unusual line terminators`),detail:V(1612,`The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).
50
+
51
+ It is recommended to remove them from the file. This can be configured via \`editor.unusualLineTerminators\`.`,Oc(e.uri)),primaryButton:V(1613,`&&Remove Unusual Line Terminators`),cancelButton:V(1614,`Ignore`)})}finally{this._isPresentingDialog=!1}if(!t.confirmed){HR(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}};WR=zR([BR(1,De),BR(2,Di)],WR),F(WR.ID,WR,1);var GR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},KR=function(e,t){return function(n,r){t(n,r,e)}},qR=class{constructor(){this.selector={language:`*`}}provideDocumentHighlights(e,t,n){if(e.isDisposed())return;let r=[],i=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return i?e.findMatches(i.word,!0,!1,!0,Gu,!1).map(e=>({range:e.range,kind:y.Text})):Promise.resolve(r)}provideMultiDocumentHighlights(e,t,n,r){if(e.isDisposed())return;let i=new ha,a=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!a)return Promise.resolve(i);for(let t of[e,...n]){if(t.isDisposed())continue;let e=t.findMatches(a.word,!0,!1,!0,Gu,!1).map(e=>({range:e.range,kind:y.Text}));e&&i.set(t.uri,e)}return i}},JR=class extends j{constructor(e){super(),this._register(e.documentHighlightProvider.register(`*`,new qR)),this._register(e.multiDocumentHighlightProvider.register(`*`,new qR))}};JR=GR([KR(0,q)],JR);var YR=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},XR=function(e,t){return function(n,r){t(n,r,e)}},ZR,QR,$R=new A(`hasWordHighlights`,!1);function ez(e,t,n,r){return jo(e.ordered(t).map(e=>()=>Promise.resolve(e.provideDocumentHighlights(t,n,r)).then(void 0,cc)),e=>e!=null).then(e=>{if(e){let n=new ha;return n.set(t.uri,e),n}return new ha})}function tz(e,t,n,r,i){return jo(e.ordered(t).map(e=>()=>{let a=i.filter(e=>ti(e)).filter(t=>ze(e.selector,t.uri,t.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(e.provideMultiDocumentHighlights(t,n,a,r)).then(void 0,cc)}),e=>e!=null)}var nz=class{constructor(e,t,n){this._model=e,this._selection=t,this._wordSeparators=n,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||=ql(e=>this._compute(this._model,this._selection,this._wordSeparators,e)),this._result}_getCurrentWordRange(e,t){let n=e.getWordAtPosition(t.getPosition());return n?new T(t.startLineNumber,n.startColumn,t.startLineNumber,n.endColumn):null}cancel(){this.result.cancel()}},rz=class extends nz{constructor(e,t,n,r){super(e,t,n),this._providers=r}_compute(e,t,n,r){return ez(this._providers,e,t.getPosition(),r).then(e=>e||new ha)}},iz=class extends nz{constructor(e,t,n,r,i){super(e,t,n),this._providers=r,this._otherModels=i}_compute(e,t,n,r){return tz(this._providers,e,t.getPosition(),r,this._otherModels).then(e=>e||new ha)}};function az(e,t,n,r){return new rz(t,n,r,e)}function oz(e,t,n,r,i){return new iz(t,n,r,e,i)}br(`_executeDocumentHighlights`,async(e,t,n)=>(await ez(e.get(q).documentHighlightProvider,t,n,B.None))?.get(t.uri));var sz=class{static{ZR=this}static{this.storedDecorationIDs=new ha}static{this.query=null}constructor(e,t,n,r,i,a,o,s){this.toUnhook=new S,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new ha,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,this.runDelayer=this.toUnhook.add(new kc(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=n,this.codeEditorService=a,this.textModelService=i,this.configurationService=o,this.logService=s,this._hasWordHighlights=$R.bindTo(r),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(e=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!==`off`&&this.runDelayer.trigger(()=>{this._onPositionChanged(e)}).catch(Hc)})),this.toUnhook.add(e.onDidFocusEditorText(e=>{this.occurrencesHighlightEnablement!==`off`&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}).catch(Hc))})),this.toUnhook.add(e.onDidChangeModelContent(e=>{ne(this.model.uri,`output`)||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(e=>{!e.newModelUrl&&e.oldModelUrl?this._stopSingular():ZR.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(e=>{let t=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==t)switch(this.occurrencesHighlightEnablement=t,t){case`off`:this._stopAll();break;case`singleFile`:this._stopAll(ZR.query?.modelInfo?.modelURI);break;case`multiFile`:ZR.query&&this._run(!0);break;default:console.warn(`Unknown occurrencesHighlight setting value:`,t);break}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(e=>{if(e.affectsConfiguration(`editor.occurrencesHighlightDelay`)){let e=o.getValue(`editor.occurrencesHighlightDelay`);this.occurrencesHighlightDelay!==e&&(this.occurrencesHighlightDelay=e)}})),this.toUnhook.add(e.onDidBlurEditorWidget(()=>{let e=this.codeEditorService.getFocusedCodeEditor();e?e.getModel()?.uri.scheme===Ks.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==Ks.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,ZR.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(Hc))}stop(){this.occurrencesHighlightEnablement!==`off`&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(T.compareRangesUsingStarts)}moveNext(){let e=this._getSortedHighlights(),t=(e.findIndex(e=>e.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);let r=this._getWord();r&&$c(`${this.editor.getModel().getLineContent(n.startLineNumber)}, ${t+1} of ${e.length} for '${r.word}'`)}finally{this._ignorePositionChangeEvent=!1}}moveBack(){let e=this._getSortedHighlights(),t=(e.findIndex(e=>e.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[t];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);let r=this._getWord();r&&$c(`${this.editor.getModel().getLineContent(n.startLineNumber)}, ${t+1} of ${e.length} for '${r.word}'`)}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;let e=ZR.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),ZR.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){let t=this.codeEditorService.listCodeEditors(),n=[];for(let r of t){if(!r.hasModel()||ao(r.getModel().uri,e))continue;let t=ZR.storedDecorationIDs.get(r.getModel().uri);if(!t)continue;r.removeDecorations(t),n.push(r.getModel().uri);let i=cz.get(r);i?.wordHighlighter&&i.wordHighlighter.decorations.length>0&&(i.wordHighlighter.decorations.clear(),i.wordHighlighter.workerRequest=null,i.wordHighlighter._hasWordHighlights.set(!1))}for(let e of n)ZR.storedDecorationIDs.delete(e)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==Ks.vscodeNotebookCell&&ZR.query?.modelInfo?.modelURI.scheme!==Ks.vscodeNotebookCell?(ZR.query=null,this._run()):ZR.query?.modelInfo&&(ZR.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++,!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++,!0)}_onPositionChanged(e){if(this.occurrencesHighlightEnablement===`off`){this._stopAll();return}if(e.source!==`api`&&e.reason!==3){this._stopAll();return}this._run()}_getWord(){let e=this.editor.getSelection(),t=e.startLineNumber,n=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:n})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===Ks.vscodeNotebookCell){let t=[],n=this.codeEditorService.listCodeEditors();for(let r of n){let n=r.getModel();n&&n!==e&&n.uri.scheme===Ks.vscodeNotebookCell&&t.push(n)}return t}let t=[],n=this.codeEditorService.listCodeEditors();for(let r of n){if(!yl(r))continue;let n=r.getModel();n&&e===n.modified&&t.push(n.modified)}if(t.length)return t;if(this.occurrencesHighlightEnablement===`singleFile`)return[];for(let r of n){let n=r.getModel();n&&n!==e&&t.push(n)}return t}async _run(e,t){if(this.editor.hasTextFocus()){let e=this.editor.getSelection();if(!e||e.startLineNumber!==e.endLineNumber){ZR.query=null,this._stopAll();return}let t=e.startColumn,n=e.endColumn,r=this._getWord();if(!r||r.startColumn>t||r.endColumn<n){ZR.query=null,this._stopAll();return}ZR.query={modelInfo:{modelURI:this.model.uri,selection:e}}}else if(!ZR.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),ao(this.editor.getModel().uri,ZR.query.modelInfo?.modelURI)){if(!e){let e=this.decorations.getRanges();for(let t of e)if(t.containsPosition(this.editor.getPosition()))return}this._stopAll(e?this.model.uri:void 0);let n=++this.workerRequestTokenId;this.workerRequestCompleted=!1;let r=this.getOtherModelsToHighlight(this.editor.getModel());if(!ZR.query||!ZR.query.modelInfo)return;let i=await this.textModelService.createModelReference(ZR.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(i.object.textEditorModel,ZR.query.modelInfo.selection,r),this.workerRequest?.result.then(e=>{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=e||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Hc)}catch(e){this.logService.error(`Unexpected error during occurrence request. Log: `,e)}finally{i.dispose()}}else if(this.model.uri.scheme===Ks.vscodeNotebookCell){let e=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!ZR.query||!ZR.query.modelInfo)return;let n=await this.textModelService.createModelReference(ZR.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(n.object.textEditorModel,ZR.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(n=>{e===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=n||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Hc)}catch(e){this.logService.error(`Unexpected error during occurrence request. Log: `,e)}finally{n.dispose()}}}computeWithModel(e,t,n){return n.length?oz(this.multiDocumentProviders,e,t,this.editor.getOption(148),n):az(this.providers,e,t,this.editor.getOption(148))}_beginRenderDecorations(e){let t=new Date().getTime(),n=this.lastCursorPositionChangeTime+e;t>=n?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},n-t)}renderDecorations(){this.renderDecorationsTimer=void 0;let e=this.codeEditorService.listCodeEditors();for(let t of e){let e=cz.get(t);if(!e)continue;let n=[],r=t.getModel()?.uri;if(r&&this.workerRequestValue.has(r)){let i=ZR.storedDecorationIDs.get(r),a=this.workerRequestValue.get(r);if(a)for(let e of a)e.range&&n.push({range:e.range,options:uI(e.kind)});let o=[];t.changeDecorations(e=>{o=e.deltaDecorations(i??[],n)}),ZR.storedDecorationIDs=ZR.storedDecorationIDs.set(r,o),n.length>0&&(e.wordHighlighter?.decorations.set(n),e.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}};sz=ZR=YR([XR(4,gi),XR(5,Di),XR(6,xa),XR(7,Pl)],sz);var cz=class extends j{static{QR=this}static{this.ID=`editor.contrib.wordHighlighter`}static get(e){return e.getContribution(QR.ID)}constructor(e,t,n,r,i,a,o){super(),this._wordHighlighter=null;let s=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&e.getModel().uri.scheme!==Ks.accessibleView&&(this._wordHighlighter=new sz(e,n.documentHighlightProvider,n.multiDocumentHighlightProvider,t,i,r,a,o))};this._register(e.onDidChangeModel(e=>{this._wordHighlighter&&=(!e.newModelUrl&&e.oldModelUrl?.scheme!==Ks.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),null),s()})),s()}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(),null),super.dispose()}};cz=QR=YR([XR(1,G),XR(2,q),XR(3,Di),XR(4,gi),XR(5,xa),XR(6,Pl)],cz);var lz=class extends N{constructor(e,t){super(t),this._isNext=e}run(e,t){let n=cz.get(t);n&&(this._isNext?n.moveNext():n.moveBack())}},uz=class extends lz{constructor(){super(!0,{id:`editor.action.wordHighlight.next`,label:J(1624,`Go to Next Symbol Highlight`),precondition:$R,kbOpts:{kbExpr:z.editorTextFocus,primary:65,weight:100}})}},dz=class extends lz{constructor(){super(!1,{id:`editor.action.wordHighlight.prev`,label:J(1625,`Go to Previous Symbol Highlight`),precondition:$R,kbOpts:{kbExpr:z.editorTextFocus,primary:1089,weight:100}})}},fz=class extends N{constructor(){super({id:`editor.action.wordHighlight.trigger`,label:J(1626,`Trigger Symbol Highlight`),precondition:void 0,kbOpts:{kbExpr:z.editorTextFocus,primary:0,weight:100}})}run(e,t){let n=cz.get(t);n&&n.restoreViewState(!0)}};F(cz.ID,cz,0),O(uz),O(dz),O(fz),Qo(JR);var pz=class extends mt{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,n){if(!t.hasModel())return;let r=Ms(t.getOption(148),t.getOption(147)),i=t.getModel(),a=t.getSelections(),o=a.length>1,s=a.map(e=>{let t=new M(e.positionLineNumber,e.positionColumn),n=this._move(r,i,t,this._wordNavigationType,o);return this._moveTo(e,n,this._inSelectionMode)});if(i.pushStackElement(),t._getViewModel().setCursorStates(`moveWordCommand`,3,s.map(e=>Mr.fromModelSelection(e))),s.length===1){let e=new M(s[0].positionLineNumber,s[0].positionColumn);t.revealPosition(e,0)}}_moveTo(e,t,n){return n?new P(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new P(t.lineNumber,t.column,t.lineNumber,t.column)}},mz=class extends pz{_move(e,t,n,r,i){return Ws.moveWordLeft(e,t,n,r,i)}},hz=class extends pz{_move(e,t,n,r,i){return Ws.moveWordRight(e,t,n,r)}},gz=class extends mz{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:`cursorWordStartLeft`,precondition:void 0})}},_z=class extends mz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:`cursorWordEndLeft`,precondition:void 0})}},vz=class extends mz{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:`cursorWordLeft`,precondition:void 0,kbOpts:{kbExpr:m.and(z.textInputFocus,m.and(vt,dr)?.negate()),primary:2063,mac:{primary:527},weight:100}})}},yz=class extends mz{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:`cursorWordStartLeftSelect`,precondition:void 0})}},bz=class extends mz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:`cursorWordEndLeftSelect`,precondition:void 0})}},xz=class extends mz{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:`cursorWordLeftSelect`,precondition:void 0,kbOpts:{kbExpr:m.and(z.textInputFocus,m.and(vt,dr)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}},Sz=class extends mz{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:`cursorWordAccessibilityLeft`,precondition:void 0})}_move(e,t,n,r,i){return super._move(Ms(Yt.wordSeparators.defaultValue,e.intlSegmenterLocales),t,n,r,i)}},Cz=class extends mz{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:`cursorWordAccessibilityLeftSelect`,precondition:void 0})}_move(e,t,n,r,i){return super._move(Ms(Yt.wordSeparators.defaultValue,e.intlSegmenterLocales),t,n,r,i)}},wz=class extends hz{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:`cursorWordStartRight`,precondition:void 0})}},Tz=class extends hz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:`cursorWordEndRight`,precondition:void 0,kbOpts:{kbExpr:m.and(z.textInputFocus,m.and(vt,dr)?.negate()),primary:2065,mac:{primary:529},weight:100}})}},Ez=class extends hz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:`cursorWordRight`,precondition:void 0})}},Dz=class extends hz{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:`cursorWordStartRightSelect`,precondition:void 0})}},Oz=class extends hz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:`cursorWordEndRightSelect`,precondition:void 0,kbOpts:{kbExpr:m.and(z.textInputFocus,m.and(vt,dr)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}},kz=class extends hz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:`cursorWordRightSelect`,precondition:void 0})}},Az=class extends hz{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:`cursorWordAccessibilityRight`,precondition:void 0})}_move(e,t,n,r,i){return super._move(Ms(Yt.wordSeparators.defaultValue,e.intlSegmenterLocales),t,n,r,i)}},jz=class extends hz{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:`cursorWordAccessibilityRightSelect`,precondition:void 0})}_move(e,t,n,r,i){return super._move(Ms(Yt.wordSeparators.defaultValue,e.intlSegmenterLocales),t,n,r,i)}},Mz=class extends mt{constructor(e){super({canTriggerInlineEdits:!0,...e}),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,n){let r=e?.get(eu);if(!t.hasModel()||!r)return;let i=Ms(t.getOption(148),t.getOption(147)),a=t.getModel(),o=t.getSelections(),s=t.getOption(10),c=t.getOption(15),l=r.getLanguageConfiguration(a.getLanguageId()).getAutoClosingPairs(),u=t._getViewModel(),d=o.map(e=>new rt(this._delete({wordSeparators:i,model:a,selection:e,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(13),autoClosingBrackets:s,autoClosingQuotes:c,autoClosingPairs:l,autoClosedCharacters:u.getCursorAutoClosedCharacters()},this._wordNavigationType),``));t.pushUndoStop(),t.executeCommands(this.id,d),t.pushUndoStop()}},Nz=class extends Mz{_delete(e,t){return Ws.deleteWordLeft(e,t)||new T(1,1,1,1)}},Pz=class extends Mz{_delete(e,t){let n=Ws.deleteWordRight(e,t);if(n)return n;let r=e.model.getLineCount(),i=e.model.getLineMaxColumn(r);return new T(r,i,r,i)}},Fz=class extends Nz{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:`deleteWordStartLeft`,precondition:z.writable})}},Iz=class extends Nz{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:`deleteWordEndLeft`,precondition:z.writable})}},Lz=class extends Nz{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:`deleteWordLeft`,precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}},Rz=class extends Pz{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:`deleteWordStartRight`,precondition:z.writable})}},zz=class extends Pz{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:`deleteWordEndRight`,precondition:z.writable})}},Bz=class extends Pz{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:`deleteWordRight`,precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}},Vz=class extends N{constructor(){super({id:`deleteInsideWord`,precondition:z.writable,label:J(1628,`Delete Word`),metadata:{description:J(1629,`Delete the word at the cursor`),args:[{name:`args`,schema:{type:`object`,properties:{onlyWord:{type:`boolean`,default:!1,description:V(1627,`Delete only the word and leave surrounding whitespace`)}}}}]}})}run(e,t,n){if(!t.hasModel())return;let r=!!(n&&typeof n==`object`&&n.onlyWord),i=Ms(t.getOption(148),t.getOption(147)),a=t.getModel(),o=t.getSelections().map(e=>new rt(Ws.deleteInsideWord(i,a,e,r),``));t.pushUndoStop(),t.executeCommands(this.id,o),t.pushUndoStop()}};R(new gz),R(new _z),R(new vz),R(new yz),R(new bz),R(new xz),R(new wz),R(new Tz),R(new Ez),R(new Dz),R(new Oz),R(new kz),R(new Sz),R(new Cz),R(new Az),R(new jz),R(new Fz),R(new Iz),R(new Lz),R(new Rz),R(new zz),R(new Bz),O(Vz);var Hz=class extends Mz{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:`deleteWordPartLeft`,precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){return ee.deleteWordPartLeft(e)||new T(1,1,1,1)}},Uz=class extends Mz{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:`deleteWordPartRight`,precondition:z.writable,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){let n=ee.deleteWordPartRight(e);if(n)return n;let r=e.model.getLineCount(),i=e.model.getLineMaxColumn(r);return new T(r,i,r,i)}},Wz=class extends pz{_move(e,t,n,r,i){return ee.moveWordPartLeft(e,t,n,i)}},Gz=class extends Wz{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:`cursorWordPartLeft`,precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:783},weight:100}})}};jn.registerCommandAlias(`cursorWordPartStartLeft`,`cursorWordPartLeft`);var Kz=class extends Wz{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:`cursorWordPartLeftSelect`,precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}};jn.registerCommandAlias(`cursorWordPartStartLeftSelect`,`cursorWordPartLeftSelect`);var qz=class extends pz{_move(e,t,n,r,i){return ee.moveWordPartRight(e,t,n)}},Jz=class extends qz{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:`cursorWordPartRight`,precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:785},weight:100}})}},Yz=class extends qz{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:`cursorWordPartRightSelect`,precondition:void 0,kbOpts:{kbExpr:z.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}};R(new Hz),R(new Uz),R(new Gz),R(new Kz),R(new Jz),R(new Yz);var Xz=class extends j{static{this.ID=`editor.contrib.readOnlyMessageController`}constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){let e=Jd.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||=this.editor.isSimpleWidget?new li(V(1427,`Cannot edit in read-only input`)):new li(V(1428,`Cannot edit in read-only editor`)),e.showMessage(t,this.editor.getPosition())}}};F(Xz.ID,Xz,2);var Zz=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},Qz=function(e,t){return function(n,r){t(n,r,e)}},$z=class extends j{constructor(e,t,n){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=n,this._currentModel=St(this,void 0);let r=Ne(`documentSymbolProvider.onDidChange`,this._languageFeaturesService.documentSymbolProvider.onDidChange),i=Ne(`_textModel.onDidChangeContent`,Du.debounce(e=>this._textModel.onDidChangeContent(e),()=>void 0,100));this._register(Ht(async(e,t)=>{r.read(e),i.read(e);let n=t.add(new ks),a=await this._outlineModelService.getOrCreate(this._textModel,n.token);t.isDisposed||this._currentModel.set(a,void 0)}))}getBreadcrumbItems(e,t){let n=this._currentModel.read(t);if(!n)return[];let r=n.asListOfDocumentSymbols().filter(t=>e.contains(t.range.startLineNumber)&&!e.contains(t.range.endLineNumber));return r.sort(ri(fs(e=>e.range.endLineNumber-e.range.startLineNumber,Ee))),r.map(e=>({name:e.name,kind:e.kind,startLineNumber:e.range.startLineNumber}))}getAt(e,t){let n=this._currentModel.read(t);if(!n)return[];let r=n.asListOfDocumentSymbols().filter(t=>new Uu(t.range.startLineNumber,t.range.endLineNumber).contains(e));return r.length===0?[]:(r.sort(ri(fs(e=>e.range.endLineNumber-e.range.startLineNumber,Ee))),r.map(e=>({name:e.name,kind:e.kind,startLineNumber:e.range.startLineNumber})))}};$z=Zz([Qz(1,q),Qz(2,OC)],$z),ta.setBreadcrumbsSourceFactory((e,t)=>t.createInstance($z,e));var eB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},tB=function(e,t){return function(n,r){t(n,r,e)}},nB=class extends j{static{this.ID=`editor.contrib.floatingToolbar`}constructor(e,t,n,r){super();let i=this._register(lu(e)),a=L(e=>i.model.read(e)?.uri),o=this._register(t.createInstance(rB,Z.EditorContent,e.contextKeyService,a));this._register(k(e=>{o.hasActions.read(e)&&e.store.add(i.createOverlayWidget({allowEditorOverflow:!1,domNode:o.element,minContentWidthInPx:pc(0),position:pc({preference:1})}))}))}};nB=eB([tB(1,w),tB(2,jr),tB(3,La)],nB);var rB=class extends j{constructor(e,t,n,r,i,a){super();let o=this._register(a.createMenu(e,t)),s=$u(this,o.onDidChange,()=>o.getActions()),c=L(e=>{let{primary:t}=ka(s.read(e),()=>!0);return t.filter(e=>e.id!==Tr.ID)});this.hasActions=L(e=>c.read(e).length>0),this.element=cu(`div.floating-menu-overlay-widget`).root,this._register(bn(()=>this.element.remove())),this._register(k(t=>{let a=c.read(t),o=a.length>0,s=o?a[0].id:void 0,l=a.length===1;if(this.element.classList.toggle(`single-button`,l),this.element.style.height=l?`28px`:`26px`,!o)return;let u=r.createInstance(Co,this.element,e,{actionViewItemProvider:(e,t)=>{if(e instanceof Lr)return r.createInstance(class extends Sc{render(t){super.render(t),e.id===s&&this.element?.classList.add(`primary`)}updateLabel(){let t=i.lookupKeybinding(e.id),n=t?t.getLabel():void 0;this.options.label&&this.label&&(this.label.textContent=n?`${this._commandAction.label} (${n})`:this._commandAction.label)}},e,{...t,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:`editor.overlayToolbar`,toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});t.store.add(u),t.store.add(k(e=>{u.context=n.read(e)}))}))}};rB=eB([tB(3,w),tB(4,jr),tB(5,La)],rB),F(nB.ID,nB,1);var iB=class extends j{static{this.ID=`editor.contrib.iPadShowKeyboard`}constructor(e){super(),this.editor=e,this.widget=null,oe&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){let e=!this.editor.getOption(104);!this.widget&&e?this.widget=new aB(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&=(this.widget.dispose(),null)}},aB=class e extends j{static{this.ID=`editor.contrib.ShowKeyboardWidget`}constructor(e){super(),this.editor=e,this._domNode=document.createElement(`textarea`),this._domNode.className=`iPadShowKeyboard`,this._register(K(this._domNode,`touchstart`,e=>{this.editor.focus()})),this._register(K(this._domNode,`focus`,e=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return e.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};F(iB.ID,iB,3);var oB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sB=function(e,t){return function(n,r){t(n,r,e)}},cB,lB=class extends j{static{cB=this}static{this.ID=`editor.contrib.inspectTokens`}static get(e){return e.getContribution(cB.ID)}constructor(e,t,n){super(),this._editor=e,this._languageService=n,this._widget=null,this._register(this._editor.onDidChangeModel(e=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(e=>this.stop())),this._register(Mi.onDidChange(e=>this.stop())),this._register(this._editor.onKeyUp(e=>e.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new pB(this._editor,this._languageService))}stop(){this._widget&&=(this._widget.dispose(),null)}};lB=cB=oB([sB(1,Iu),sB(2,Zo)],lB);var uB=class extends N{constructor(){super({id:`editor.action.inspectTokens`,label:Tu.inspectTokensAction,alias:`Developer: Inspect Tokens`,precondition:void 0})}run(e,t){lB.get(t)?.launch()}};function dB(e){let t=``;for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);switch(r){case 9:t+=`→`;break;case 32:t+=`·`;break;default:t+=String.fromCharCode(r)}}return t}function fB(e,t){let n=Mi.get(t);if(n)return n;let r=e.encodeLanguageId(t);return{getInitialState:()=>Ur,tokenize:(e,n,r)=>Ce(t,r),tokenizeEncoded:(e,t,n)=>xu(r,n)}}var pB=class e extends j{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=fB(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(e=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return e._ID}_compute(e){let t=this._getTokensAtLine(e.lineNumber),n=0;for(let r=t.tokens1.length-1;r>=0;r--){let i=t.tokens1[r];if(e.column-1>=i.offset){n=r;break}}let r=0;for(let n=t.tokens2.length>>>1;n>=0;n--)if(e.column-1>=t.tokens2[n<<1]){r=n;break}let i=this._model.getLineContent(e.lineNumber),a=``;if(n<t.tokens1.length){let e=t.tokens1[n].offset,r=n+1<t.tokens1.length?t.tokens1[n+1].offset:i.length;a=i.substring(e,r)}Zr(this._domNode,I(`h2.tm-token`,void 0,dB(a),I(`span.tm-token-length`,void 0,`${a.length} ${a.length===1?`char`:`chars`}`))),H(this._domNode,I(`hr.tokens-inspect-separator`,{style:`clear:both`}));let o=(r<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(r<<1)+1]):null;H(this._domNode,I(`table.tm-metadata-table`,void 0,I(`tbody`,void 0,I(`tr`,void 0,I(`td.tm-metadata-key`,void 0,`language`),I(`td.tm-metadata-value`,void 0,`${o?o.languageId:`-?-`}`)),I(`tr`,void 0,I(`td.tm-metadata-key`,void 0,`token type`),I(`td.tm-metadata-value`,void 0,`${o?this._tokenTypeToString(o.tokenType):`-?-`}`)),I(`tr`,void 0,I(`td.tm-metadata-key`,void 0,`font style`),I(`td.tm-metadata-value`,void 0,`${o?this._fontStyleToString(o.fontStyle):`-?-`}`)),I(`tr`,void 0,I(`td.tm-metadata-key`,void 0,`foreground`),I(`td.tm-metadata-value`,void 0,`${o?W.Format.CSS.formatHex(o.foreground):`-?-`}`)),I(`tr`,void 0,I(`td.tm-metadata-key`,void 0,`background`),I(`td.tm-metadata-value`,void 0,`${o?W.Format.CSS.formatHex(o.background):`-?-`}`))))),H(this._domNode,I(`hr.tokens-inspect-separator`)),n<t.tokens1.length&&H(this._domNode,I(`span.tm-token-type`,void 0,t.tokens1[n].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){let t=Mi.getColorMap(),n=nc.getLanguageId(e),r=nc.getTokenType(e),i=nc.getFontStyle(e),a=nc.getForeground(e),o=nc.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(n),tokenType:r,fontStyle:i,foreground:t[a],background:t[o]}}_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){let t=this._getStateBeforeLine(e),n=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),r=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:n.tokens,tokens2:r.tokens,endState:n.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let n=1;n<e;n++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(n),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};F(lB.ID,lB,4),O(uB);var mB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},hB=function(e,t){return function(n,r){t(n,r,e)}},gB,_B=class{static{gB=this}static{this.PREFIX=`?`}constructor(e,t,n){this.quickInputService=e,this.keybindingService=t,this.contextKeyService=n,this.registry=Un.as(ru.Quickaccess)}provide(e){let t=new S;return t.add(e.onDidAccept(()=>{let[t]=e.selectedItems;t&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(e=>{let t=this.registry.getQuickAccessProvider(e.substr(gB.PREFIX.length),this.contextKeyService);t?.prefix&&t.prefix!==gB.PREFIX&&this.quickInputService.quickAccess.show(t.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(e=>e.prefix!==gB.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=>{let n=t.prefix||e.prefix,r=n||`…`;return{prefix:n,label:r,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:V(1811,`{0}, {1}`,r,t.description),description:t.description}})}};_B=gB=mB([hB(0,Fi),hB(1,jr),hB(2,G)],_B),Un.as(ru.Quickaccess).registerQuickAccessProvider({ctor:_B,prefix:``,helpEntries:[{description:he.helpQuickAccessActionLabel}]});var vB=class{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,n){let r=new S;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let i=r.add(new Ae);return i.value=this.doProvide(e,t,n),r.add(this.onDidActiveTextEditorControlChange(()=>{i.value=void 0,i.value=this.doProvide(e,t)})),r}doProvide(e,t,n){let r=new S,i=this.activeTextEditorControl;if(i&&this.canProvideWithTextEditor(i)){let a={editor:i},o=Ul(i);if(o){let e=i.saveViewState()??void 0;r.add(o.onDidChangeCursorPosition(()=>{e=i.saveViewState()??void 0})),a.restoreViewState=()=>{e&&i===this.activeTextEditorControl&&i.restoreViewState(e)},r.add(nr(t.onCancellationRequested)(()=>a.restoreViewState?.()))}r.add(bn(()=>this.clearDecorations(i))),r.add(this.provideWithTextEditor(a,e,t,n))}else r.add(this.provideWithoutTextEditor(e,t));return r}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,`code.jump`),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();let n=this.getModel(e);if(n){let e=n.getLineContent(t.range.startLineNumber);zt(V(1381,`Line {0}, column {1}: {2}`,t.range.startLineNumber,t.range.startColumn,e))}}getModel(e){return yl(e)?e.getModel()?.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(e=>{let n=[];this.rangeHighlightDecorationId&&=(n.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),n.push(this.rangeHighlightDecorationId.rangeHighlightId),void 0);let r=[{range:t,options:{description:`quick-access-range-highlight`,className:`rangeHighlight`,isWholeLine:!0}},{range:t,options:{description:`quick-access-range-highlight-overview`,overviewRuler:{color:pl(xo),position:Su.Full}}}],[i,a]=e.deltaDecorations(n,r);this.rangeHighlightDecorationId={rangeHighlightId:i,overviewRulerDecorationId:a}})}clearDecorations(e){let t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(e=>{e.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}},yB=class e extends vB{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(e.ZERO_BASED_OFFSET_STORAGE_KEY,-1,!1)}set useZeroBasedOffset(t){this.storageService.store(e.ZERO_BASED_OFFSET_STORAGE_KEY,t,-1,0)}provideWithoutTextEditor(e){let t=V(1382,`Open a text editor first to go to a line or an offset.`);return e.items=[{label:t}],e.ariaLabel=t,j.None}provideWithTextEditor(t,n,r){let i=t.editor,a=new S;n.ariaLabel=V(1383,`Go to line. Type a line number, optionally followed by colon and column number.`),a.add(n.onDidAccept(e=>{let[r]=n.selectedItems;if(r){if(!r.lineNumber)return;this.gotoLocation(t,{range:this.toRange(r.lineNumber,r.column),keyMods:n.keyMods,preserveFocus:e.inBackground}),e.inBackground||n.hide()}}));let o={iconClass:C.asClassName(D.indexZero),tooltip:V(1384,`Toggle Zero-Based Offset`),location:rn.Input,toggle:{checked:this.useZeroBasedOffset}},s=()=>{let t=n.value.trim().substring(e.GO_TO_LINE_PREFIX.length),{inOffsetMode:r,lineNumber:a,column:s,label:c}=this.parsePosition(i,t);if(n.buttons=r?[o]:[],n.items=[{lineNumber:a,column:s,label:c,ariaLabel:a?V(1385,`Go to line {0}, column {1}. Press Enter to navigate.`,a,s||1):c}],!a){this.clearDecorations(i);return}let l=this.toRange(a,s);i.revealRangeInCenter(l,0),this.addDecorations(i,l)};a.add(n.onDidTriggerButton(e=>{e===o&&(this.useZeroBasedOffset=e.toggle?.checked??!this.useZeroBasedOffset,s())})),s(),a.add(n.onDidChangeValue(()=>s()));let c=Ul(i);return c&&c.getOptions().get(76).renderType===2&&(c.updateOptions({lineNumbers:`on`}),a.add(bn(()=>c.updateOptions({lineNumbers:`relative`})))),a}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){let n=this.getModel(e);if(!n)return{label:V(1386,`Open a text editor first to go to a line or an offset.`)};if(t.startsWith(`:`)){let e=parseInt(t.substring(1),10),r=n.getValueLength();if(isNaN(e))return{inOffsetMode:!0,label:this.useZeroBasedOffset?V(1387,`Type a character position to go to (from 0 to {0}).`,r-1):V(1388,`Type a character position to go to (from 1 to {0}).`,r)};{let t=e<0;this.useZeroBasedOffset||(e-=Math.sign(e)),t&&(e+=r);let i=n.getPositionAt(e),a=fe.visibleColumnFromColumn(n.getLineContent(i.lineNumber),i.column,n.getOptions().tabSize)+1;return{...i,inOffsetMode:!0,label:V(1389,`Press 'Enter' to go to line {0} at column {1}.`,i.lineNumber,a)}}}else{let e=t.split(/,|:|#/),r=n.getLineCount(),i=parseInt(e[0]?.trim(),10);if(e.length<1||isNaN(i))return{label:V(1390,`Type a line number to go to (from 1 to {0}).`,r)};i=i>=0?i:r+1+i,i=Math.min(Math.max(1,i),r);let a=n.getOptions().tabSize,o=n.getLineContent(i),s=fe.visibleColumnFromColumn(o,n.getLineMaxColumn(i),a)+1,c=parseInt(e[1]?.trim(),10);if(e.length<2||isNaN(c))return{lineNumber:i,column:1,label:e.length<2?V(1391,`Press 'Enter' to go to line {0} or enter colon : to add a column number.`,i):V(1392,`Press 'Enter' to go to line {0} or enter a column number (from 1 to {1}).`,i,s)};c=c>=0?c:s+c,c=Math.min(Math.max(1,c),s);let l=fe.columnFromVisibleColumn(o,c-1,a);return{lineNumber:i,column:l,label:V(1393,`Press 'Enter' to go to line {0} at column {1}.`,i,c)}}}},bB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},xB=function(e,t){return function(n,r){t(n,r,e)}},SB=class extends yB{constructor(e,t){super(),this.editorService=e,this.storageService=t,this.onDidActiveTextEditorControlChange=Du.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};SB=bB([xB(0,Di),xB(1,Gc)],SB);var CB=class e extends N{static{this.ID=`editor.action.gotoLine`}constructor(){super({id:e.ID,label:Fa.gotoLineActionLabel,alias:`Go to Line/Column...`,precondition:void 0,kbOpts:{kbExpr:z.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Fi).quickAccess.show(SB.GO_TO_LINE_PREFIX)}};O(CB),Un.as(ru.Quickaccess).registerQuickAccessProvider({ctor:SB,prefix:SB.GO_TO_LINE_PREFIX,helpEntries:[{description:Fa.gotoLineActionLabel,commandId:CB.ID}]});var wB=class e extends N{static{this.ID=`editor.action.gotoOffset`}constructor(){super({id:e.ID,label:Fa.gotoOffsetActionLabel,alias:`Go to Offset...`,precondition:void 0})}run(e){e.get(Fi).quickAccess.show(SB.GO_TO_OFFSET_PREFIX)}};O(wB),Un.as(ru.Quickaccess).registerQuickAccessProvider({ctor:SB,prefix:SB.GO_TO_OFFSET_PREFIX,helpEntries:[{description:Fa.gotoOffsetActionLabel,commandId:wB.ID}]});var TB=[void 0,[]];function EB(e,t,n=0,r=0){let i=t;return i.values&&i.values.length>1?DB(e,i.values,n,r):OB(e,t,n,r)}function DB(e,t,n,r){let i=0,a=[];for(let o of t){let[t,s]=OB(e,o,n,r);if(typeof t!=`number`)return TB;i+=t,a.push(...s)}return[i,kB(a)]}function OB(e,t,n,r){let i=_r(t.normalized,t.normalizedLowercase,n,e,e.toLowerCase(),r,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return i?[i[0],la(i)]:TB}function kB(e){let t=e.sort((e,t)=>e.start-t.start),n=[],r;for(let e of t)!r||!AB(r,e)?(r=e,n.push(e)):(r.start=Math.min(r.start,e.start),r.end=Math.max(r.end,e.end));return n}function AB(e,t){return!(e.end<t.start||t.end<e.start)}function jB(e){return e.startsWith(`"`)&&e.endsWith(`"`)}var MB=` `;function NB(e){typeof e!=`string`&&(e=``);let t=e.toLowerCase(),{pathNormalized:n,normalized:r,normalizedLowercase:i}=PB(e),a=n.indexOf(at)>=0,o=jB(e),s,c=e.split(MB);if(c.length>1)for(let e of c){let t=jB(e),{pathNormalized:n,normalized:r,normalizedLowercase:i}=PB(e);r&&(s||=[],s.push({original:e,originalLowercase:e.toLowerCase(),pathNormalized:n,normalized:r,normalizedLowercase:i,expectContiguousMatch:t}))}return{original:e,originalLowercase:t,pathNormalized:n,normalized:r,normalizedLowercase:i,values:s,containsPathSeparator:a,expectContiguousMatch:o}}function PB(e){let t;t=Zt?e.replace(/\//g,at):e.replace(/\\/g,at);let n=t.replace(/[\*\u2026\s"]/g,``).replace(/(?<=.)#$/,``);return{pathNormalized:t,normalized:n,normalizedLowercase:n.toLowerCase()}}function FB(e){return NB(Array.isArray(e)?e.map(e=>e.original).join(MB):e.original)}var IB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},LB=function(e,t){return function(n,r){t(n,r,e)}},RB,zB=class extends vB{static{RB=this}static{this.PREFIX=`@`}static{this.SCOPE_PREFIX=`:`}static{this.PREFIX_BY_CATEGORY=`${this.PREFIX}${this.SCOPE_PREFIX}`}constructor(e,t,n=Object.create(null)){super(n),this._languageFeaturesService=e,this._outlineModelService=t,this.options=n,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,V(1394,`To go to a symbol, first open a text editor with symbol information.`)),j.None}provideWithTextEditor(e,t,n,r){let i=e.editor,a=this.getModel(i);return a?this._languageFeaturesService.documentSymbolProvider.has(a)?this.doProvideWithEditorSymbols(e,a,t,n,r):this.doProvideWithoutEditorSymbols(e,a,t,n):j.None}doProvideWithoutEditorSymbols(e,t,n,r){let i=new S;return this.provideLabelPick(n,V(1395,`The active text editor does not provide symbol information.`)),(async()=>{!await this.waitForLanguageSymbolRegistry(t,i)||r.isCancellationRequested||i.add(this.doProvideWithEditorSymbols(e,t,n,r))})(),i}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;let n=new Ea,r=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(r.dispose(),n.complete(!0))}));return t.add(bn(()=>n.complete(!1))),n.p}doProvideWithEditorSymbols(e,t,n,r,i){let a=e.editor,o=new S;o.add(n.onDidAccept(t=>{let[r]=n.selectedItems;if(r&&r.range){if(n.keyMods.shift&&r.attach){r.attach(n.keyMods,t);return}this.gotoLocation(e,{range:r.range.selection,keyMods:n.keyMods,preserveFocus:t.inBackground}),i?.handleAccept?.(r,t.inBackground),t.inBackground||n.hide()}})),o.add(n.onDidTriggerItemButton(({item:t})=>{t&&t.range&&(this.gotoLocation(e,{range:t.range.selection,keyMods:n.keyMods,forceSideBySide:!0}),n.hide())}));let s=this.getDocumentSymbols(t,r),c=o.add(new Ae),l=async e=>{c?.value?.cancel(),n.busy=!1,c.value=new ou,n.busy=!0;try{let i=NB(n.value.substr(RB.PREFIX.length).trim()),a=await this.doGetSymbolPicks(s,i,void 0,c.value.token,t);if(r.isCancellationRequested)return;if(a.length>0){if(n.items=a,e&&i.original.length===0){let t=Se(a,t=>!!(t.type!==`separator`&&t.range&&T.containsPosition(t.range.decoration,e)));t&&(n.activeItems=[t])}}else i.original.length>0?this.provideLabelPick(n,V(1396,`No matching editor symbols`)):this.provideLabelPick(n,V(1397,`No editor symbols`))}finally{r.isCancellationRequested||(n.busy=!1)}};return o.add(n.onDidChangeValue(()=>l(void 0))),l(a.getSelection()?.getPosition()),o.add(n.onDidChangeActive(()=>{let[e]=n.activeItems;e&&e.range&&(a.revealRangeInCenter(e.range.selection,0),this.addDecorations(a,e.range.decoration))})),o}async doGetSymbolPicks(e,t,n,r,i){let a=await e;if(r.isCancellationRequested)return[];let o=t.original.indexOf(RB.SCOPE_PREFIX)===0,s=+!!o,c,l;t.values&&t.values.length>1?(c=FB(t.values[0]),l=FB(t.values.slice(1))):c=t;let u,d=this.options?.openSideBySideDirection?.();d&&(u=[{iconClass:d===`right`?C.asClassName(D.splitHorizontal):C.asClassName(D.splitVertical),tooltip:d===`right`?V(1398,`Open to the Side`):V(1399,`Open to the Bottom`)}]);let f=[];for(let e=0;e<a.length;e++){let r=a[e],o=Fl(r.name),d=`$(${ui.toIcon(r.kind).id}) ${o}`,p=d.length-o.length,m=r.containerName;n?.extraContainerLabel&&(m=m?`${n.extraContainerLabel} • ${m}`:n.extraContainerLabel);let h,g,_,v;if(t.original.length>s){let e=!1;if(c!==t&&([h,g]=EB(d,{...t,values:void 0},s,p),typeof h==`number`&&(e=!0)),typeof h!=`number`&&([h,g]=EB(d,c,s,p),typeof h!=`number`))continue;if(!e&&l){if(m&&l.original.length>0&&([_,v]=EB(m,l)),typeof _!=`number`)continue;typeof h==`number`&&(h+=_)}}let y=r.tags&&r.tags.indexOf(1)>=0;f.push({index:e,kind:r.kind,score:h,label:d,ariaLabel:ft(r.name,r.kind),description:m,highlights:y?void 0:{label:g,description:v},range:{selection:T.collapseToStart(r.selectionRange),decoration:r.range},uri:i.uri,symbolName:o,strikethrough:y,buttons:u})}let p=f.sort((e,t)=>o?this.compareByKindAndScore(e,t):this.compareByScore(e,t)),m=[];if(o){let e,t,n=0;function r(){t&&typeof e==`number`&&n>0&&(t.label=gt(VB[e]||BB,n))}for(let i of p)e===i.kind?n++:(r(),e=i.kind,n=1,t={type:`separator`},m.push(t)),m.push(i);r()}else p.length>0&&(m=[{label:V(1400,`symbols ({0})`,f.length),type:`separator`},...p]);return m}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)}compareByKindAndScore(e,t){let n=VB[e.kind]||BB,r=VB[t.kind]||BB,i=n.localeCompare(r);return i===0?this.compareByScore(e,t):i}async getDocumentSymbols(e,t){let n=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:n.asListOfDocumentSymbols()}};zB=RB=IB([LB(0,q),LB(1,OC)],zB);var BB=V(1401,`properties ({0})`),VB={5:V(1402,`methods ({0})`),11:V(1403,`functions ({0})`),8:V(1404,`constructors ({0})`),12:V(1405,`variables ({0})`),4:V(1406,`classes ({0})`),22:V(1407,`structs ({0})`),23:V(1408,`events ({0})`),24:V(1409,`operators ({0})`),10:V(1410,`interfaces ({0})`),2:V(1411,`namespaces ({0})`),3:V(1412,`packages ({0})`),25:V(1413,`type parameters ({0})`),1:V(1414,`modules ({0})`),6:V(1415,`properties ({0})`),9:V(1416,`enumerations ({0})`),21:V(1417,`enumeration members ({0})`),14:V(1418,`strings ({0})`),0:V(1419,`files ({0})`),17:V(1420,`arrays ({0})`),15:V(1421,`numbers ({0})`),16:V(1422,`booleans ({0})`),18:V(1423,`objects ({0})`),19:V(1424,`keys ({0})`),7:V(1425,`fields ({0})`),13:V(1426,`constants ({0})`)},HB=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},UB=function(e,t){return function(n,r){t(n,r,e)}},WB=class extends zB{constructor(e,t,n){super(t,n),this.editorService=e,this.onDidActiveTextEditorControlChange=Du.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};WB=HB([UB(0,Di),UB(1,q),UB(2,OC)],WB);var GB=class e extends N{static{this.ID=`editor.action.quickOutline`}constructor(){super({id:e.ID,label:mu.quickOutlineActionLabel,alias:`Go to Symbol...`,precondition:z.hasDocumentSymbolProvider,kbOpts:{kbExpr:z.focus,primary:3117,weight:100},contextMenuOpts:{group:`navigation`,order:3}})}run(e){e.get(Fi).quickAccess.show(zB.PREFIX,{itemActivation:ht.NONE})}};O(GB),Un.as(ru.Quickaccess).registerQuickAccessProvider({ctor:WB,prefix:zB.PREFIX,helpEntries:[{description:mu.quickOutlineActionLabel,prefix:zB.PREFIX,commandId:GB.ID},{description:mu.quickOutlineByCategoryActionLabel,prefix:zB.PREFIX_BY_CATEGORY}]});function KB(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return t}var qB=class e{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){let n=this.computeEmbedding(e),r=new Map,i=[];for(let[e,a]of this.documents){if(t.isCancellationRequested)return[];for(let t of a.chunks){let a=this.computeSimilarityScore(t,n,r);a>0&&i.push({key:e,score:a})}}return i}static termFrequencies(t){return KB(e.splitTerms(t))}static*splitTerms(e){let t=e=>e.toLowerCase();for(let[n]of e.matchAll(/\b\p{Letter}[\p{Letter}\d]{2,}\b/gu)){yield t(n);let e=n.replace(/([a-z])([A-Z])/g,`$1 $2`).split(/\s+/g);if(e.length>1)for(let n of e)n.length>2&&/\p{Letter}{3,}/gu.test(n)&&(yield t(n))}}updateDocuments(t){for(let{key:e}of t)this.deleteDocument(e);for(let n of t){let t=[];for(let r of n.textChunks){let n=e.termFrequencies(r);for(let e of n.keys())this.chunkOccurrences.set(e,(this.chunkOccurrences.get(e)??0)+1);t.push({text:r,tf:n})}this.chunkCount+=t.length,this.documents.set(n.key,{chunks:t})}return this}deleteDocument(e){let t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(let e of t.chunks)for(let t of e.tf.keys()){let e=this.chunkOccurrences.get(t);if(typeof e==`number`){let n=e-1;n<=0?this.chunkOccurrences.delete(t):this.chunkOccurrences.set(t,n)}}}}computeSimilarityScore(e,t,n){let r=0;for(let[i,a]of Object.entries(t)){let t=e.tf.get(i);if(!t)continue;let o=n.get(i);typeof o!=`number`&&(o=this.computeIdf(i),n.set(i,o));let s=t*o;r+=s*a}return r}computeEmbedding(t){let n=e.termFrequencies(t);return this.computeTfidf(n)}computeIdf(e){let t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){let t=Object.create(null);for(let[n,r]of e){let e=this.computeIdf(n);e>0&&(t[n]=r*e)}return t}};function JB(e){let t=e.slice(0);t.sort((e,t)=>t.score-e.score);let n=t[0]?.score??0;if(n>0)for(let e of t)e.score/=n;return t}var YB;(function(e){e[e.NO_ACTION=0]=`NO_ACTION`,e[e.CLOSE_PICKER=1]=`CLOSE_PICKER`,e[e.REFRESH_PICKER=2]=`REFRESH_PICKER`,e[e.REMOVE_ITEM=3]=`REMOVE_ITEM`})(YB||={});function XB(e){let t=e;return Array.isArray(t.items)}function ZB(e){let t=e;return!!t.picks&&t.additionalPicks instanceof Promise}var QB=class extends j{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,n){let i=new S;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let a,o=i.add(new Ae),s=async()=>{a?.dispose(!0),e.busy=!1;let i=o.value=new S;a=i.add(new ou(t));let s=a.token,c=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(c=c.trim());let l=this._getPicks(c,i,s,n),u=(t,n)=>{let i,a;if(XB(t)?(i=t.items,a=t.active):i=t,i.length===0){if(n)return!1;(c.length>0||e.hideInput)&&this.options?.noResultsPick&&(i=r(this.options.noResultsPick)?[this.options.noResultsPick(c)]:[this.options.noResultsPick])}return e.items=i,a&&(e.activeItems=[a]),!0},d=async t=>{let n=!1,r=!1;await Promise.all([(async()=>{typeof t.mergeDelay==`number`&&(await Wo(t.mergeDelay),s.isCancellationRequested)||r||(n=u(t.picks,!0))})(),(async()=>{e.busy=!0;try{let r=await t.additionalPicks;if(s.isCancellationRequested)return;let i,a;XB(t.picks)?(i=t.picks.items,a=t.picks.active):i=t.picks;let o,c;if(XB(r)?(o=r.items,c=r.active):o=r,o.length>0||!n){let t;if(!a&&!c){let n=e.activeItems[0];n&&i.indexOf(n)!==-1&&(t=n)}u({items:[...i,...o],active:a||c||t})}}finally{s.isCancellationRequested||(e.busy=!1),r=!0}})()])};if(l!==null)if(ZB(l))await d(l);else if(!(l instanceof Promise))u(l);else{e.busy=!0;try{let e=await l;if(s.isCancellationRequested)return;ZB(e)?await d(e):u(e)}finally{s.isCancellationRequested||(e.busy=!1)}}};i.add(e.onDidChangeValue(()=>s())),s(),i.add(e.onDidAccept(t=>{if(n?.handleAccept){t.inBackground||e.hide(),n.handleAccept?.(e.activeItems[0],t.inBackground);return}let[r]=e.selectedItems;if(typeof r?.accept==`function`){if(sl(e.keyMods)&&r.attach){r.attach(e.keyMods,t);return}t.inBackground||e.hide(),r.accept(e.keyMods,t)}}));let c=async(n,r)=>{if(typeof r.trigger!=`function`)return;let i=r.buttons?.indexOf(n)??-1;if(i>=0){let n=r.trigger(i,e.keyMods),a=typeof n==`number`?n:await n;if(t.isCancellationRequested)return;switch(a){case YB.NO_ACTION:break;case YB.CLOSE_PICKER:e.hide();break;case YB.REFRESH_PICKER:s();break;case YB.REMOVE_ITEM:{let t=e.items.indexOf(r);if(t!==-1){let n=e.items.slice(),r=n.splice(t,1),i=e.activeItems.filter(e=>e!==r[0]),a=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=n,i&&(e.activeItems=i),e.keepScrollPosition=a}break}}}};return i.add(e.onDidTriggerItemButton(({button:e,item:t})=>c(e,t))),i.add(e.onDidTriggerSeparatorButton(({button:e,separator:t})=>c(e,t))),i}},$B=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},eV=function(e,t){return function(n,r){t(n,r,e)}},tV,nV,rV=class extends QB{static{tV=this}static{this.PREFIX=`>`}static{this.TFIDF_THRESHOLD=.5}static{this.TFIDF_MAX_RESULTS=5}static{this.WORD_FILTER=_l(To,Cc)}constructor(e,t,n,r,i,a){super(tV.PREFIX,e),this.keybindingService=n,this.commandService=r,this.telemetryService=i,this.dialogService=a,this.commandsHistory=this._register(t.createInstance(iV)),this.options=e}async _getPicks(e,t,n,r){let i=await this.getCommandPicks(n);if(n.isCancellationRequested)return[];let a=nr(()=>{let t=new qB;return t.updateDocuments(i.map(e=>({key:e.commandId,textChunks:[this.getTfIdfChunk(e)]}))),JB(t.calculateScores(e,n)).filter(e=>e.score>tV.TFIDF_THRESHOLD).slice(0,tV.TFIDF_MAX_RESULTS)}),o=[];for(let t of i){let r=tV.WORD_FILTER(e,t.label)??void 0,i;if(t.commandAlias&&(i=tV.WORD_FILTER(e,t.commandAlias)??void 0),r||i)t.highlights={label:r,detail:this.options.showAlias?i:void 0},o.push(t);else if(e===t.commandId)o.push(t);else if(e.length>=3){let e=a();if(n.isCancellationRequested)return[];let r=e.find(e=>e.key===t.commandId);r&&(t.tfIdfScore=r.score,o.push(t))}}let s=new Map;for(let e of o){let t=s.get(e.label);t?(e.description=e.commandId,t.description=t.commandId):s.set(e.label,e)}o.sort((e,t)=>{if(e.tfIdfScore&&t.tfIdfScore)return e.tfIdfScore===t.tfIdfScore?e.label.localeCompare(t.label):t.tfIdfScore-e.tfIdfScore;if(e.tfIdfScore)return 1;if(t.tfIdfScore)return-1;let n=this.commandsHistory.peek(e.commandId),r=this.commandsHistory.peek(t.commandId);if(n&&r)return n>r?-1:1;if(n)return-1;if(r)return 1;if(this.options.suggestedCommandIds){let n=this.options.suggestedCommandIds.has(e.commandId),r=this.options.suggestedCommandIds.has(t.commandId);if(n&&r)return 0;if(n)return-1;if(r)return 1}let i=e.commandCategory===YL.Developer.value,a=t.commandCategory===YL.Developer.value;return i&&!a?1:!i&&a?-1:e.label.localeCompare(t.label)});let c=[],l=!1,u=!0,d=!!this.options.suggestedCommandIds;for(let e=0;e<o.length;e++){let t=o[e],n=!!this.commandsHistory.peek(t.commandId);e===0&&n&&(c.push({type:`separator`,label:V(1803,`recently used`)}),l=!0),u&&t.tfIdfScore!==void 0&&(c.push({type:`separator`,label:V(1804,`similar commands`)}),u=!1),d&&t.tfIdfScore===void 0&&!n&&this.options.suggestedCommandIds?.has(t.commandId)&&(c.push({type:`separator`,label:V(1805,`commonly used`)}),l=!0,d=!1),l&&t.tfIdfScore===void 0&&!n&&!this.options.suggestedCommandIds?.has(t.commandId)&&(c.push({type:`separator`,label:V(1806,`other commands`)}),l=!1),c.push(this.toCommandPick(t,r,n))}return this.hasAdditionalCommandPicks(e,n)?{picks:c,additionalPicks:(async()=>{let t=await this.getAdditionalCommandPicks(i,o,e,n);if(n.isCancellationRequested)return[];let a=t.map(e=>this.toCommandPick(e,r));return u&&a[0]?.type!==`separator`&&a.unshift({type:`separator`,label:V(1807,`similar commands`)}),a})()}:c}toCommandPick(e,t,n=!1){if(e.type===`separator`)return e;let r=e.tooltip??e.commandDescription?.value,i=this.keybindingService.lookupKeybinding(e.commandId),a=i?V(1808,`{0}, {1}`,e.label,i.getAriaLabel()):e.label,o=e.buttons||[],s=n?[...o,{iconClass:C.asClassName(D.close),tooltip:V(1809,`Remove from Recently Used`)}]:e.buttons;return{...e,tooltip:r,ariaLabel:a,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,buttons:s,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(t){Mo(t)||this.dialogService.error(V(1810,`Command '{0}' resulted in an error`,e.label),Tf(t))}},trigger:n?(t,n)=>t===o.length?(this.commandsHistory.remove(e.commandId),YB.REMOVE_ITEM):e.trigger?e.trigger(t,n):YB.NO_ACTION:e.trigger}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:n}){let r=e;return t&&t!==e&&(r+=` - ${t}`),n&&n.value!==e&&(r+=` - ${n.value===n.original?n.value:`${n.value} (${n.original})`}`),r}};rV=tV=$B([eV(1,w),eV(2,jr),eV(3,tr),eV(4,au),eV(5,De)],rV);var iV=class extends j{static{nV=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,n){super(),this.storageService=e,this.configurationService=t,this.logService=n,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===dc.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration(`workbench.commandPalette.history`)||(this.configuredCommandsHistoryLength=nV.getConfiguredCommandHistoryLength(this.configurationService),nV.cache&&nV.cache.limit!==this.configuredCommandsHistoryLength&&(nV.cache.limit=this.configuredCommandsHistoryLength,nV.hasChanges=!0))}load(){let e=this.storageService.get(nV.PREF_KEY_CACHE,0),t;if(e)try{t=JSON.parse(e)}catch(e){this.logService.error(`[CommandsHistory] invalid data: ${e}`)}let n=nV.cache=new Uo(this.configuredCommandsHistoryLength,1);if(t){let e;e=t.usesLRU?t.entries:t.entries.sort((e,t)=>e.value-t.value),e.forEach(e=>n.set(e.key,e.value))}nV.counter=this.storageService.getNumber(nV.PREF_KEY_COUNTER,0,nV.counter)}push(e){nV.cache&&(nV.cache.set(e,nV.counter++),nV.hasChanges=!0)}peek(e){return nV.cache?.peek(e)}remove(e){nV.cache&&(nV.cache.delete(e),nV.hasChanges=!0)}saveState(){if(!nV.cache||!nV.hasChanges)return;let e={usesLRU:!0,entries:[]};nV.cache.forEach((t,n)=>e.entries.push({key:n,value:t})),this.storageService.store(nV.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(nV.PREF_KEY_COUNTER,nV.counter,0,0),nV.hasChanges=!1}static getConfiguredCommandHistoryLength(e){let t=e.getValue().workbench?.commandPalette?.history;return typeof t==`number`?t:nV.DEFAULT_COMMANDS_HISTORY_LENGTH}};iV=nV=$B([eV(0,Gc),eV(1,xa),eV(2,Pl)],iV);var aV=class extends rV{constructor(e,t,n,r,i,a){super(e,t,n,r,i,a)}getCodeEditorCommandPicks(){let e=this.activeTextEditorControl;if(!e)return[];let t=[];for(let n of e.getSupportedActions()){let e;n.metadata?.description&&(e=ss(n.metadata.description)?n.metadata.description:{original:n.metadata.description,value:n.metadata.description}),t.push({commandId:n.id,commandAlias:n.alias,commandDescription:e,label:rl(n.label)||n.id})}return t}},oV=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},sV=function(e,t){return function(n,r){t(n,r,e)}},cV=class extends aV{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,n,r,i,a){super({showAlias:!1},e,n,r,i,a),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};cV=oV([sV(0,w),sV(1,Di),sV(2,jr),sV(3,tr),sV(4,au),sV(5,De)],cV);var lV=class e extends N{static{this.ID=`editor.action.quickCommand`}constructor(){super({id:e.ID,label:Fr.quickCommandActionLabel,alias:`Command Palette`,precondition:void 0,kbOpts:{kbExpr:z.focus,primary:59,weight:100},contextMenuOpts:{group:`z_commands`,order:1}})}run(e){e.get(Fi).quickAccess.show(cV.PREFIX)}};O(lV),Un.as(ru.Quickaccess).registerQuickAccessProvider({ctor:cV,prefix:cV.PREFIX,helpEntries:[{description:Fr.quickCommandHelp,commandId:lV.ID}]});var uV=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},dV=function(e,t){return function(n,r){t(n,r,e)}},fV=class extends Ty{constructor(e,t,n,r,i,a,o){super(!0,e,t,n,r,i,a,o)}};fV=uV([dV(1,G),dV(2,Di),dV(3,di),dV(4,w),dV(5,Gc),dV(6,xa)],fV),F(Ty.ID,fV,4),O(class extends N{constructor(){super({id:`editor.action.toggleHighContrast`,label:qr.toggleHighContrast,alias:`Toggle High Contrast Theme`,precondition:void 0}),this._originalThemeName=null}run(e,t){let n=e.get(Iu),r=n.getColorTheme();Xr(r.type)?(n.setTheme(this._originalThemeName||(vu(r.type)?`vs-dark`:`vs`)),this._originalThemeName=null):(n.setTheme(vu(r.type)?es:Vo),this._originalThemeName=r.themeName)}});export{E_ as t};