@jxsuite/studio 10.4.0 → 10.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/locales/en/elements.json +434 -0
- package/data/webdata.json +116 -139
- package/dist/chunks/2020-rqm7qrje.js +4 -0
- package/dist/chunks/adapter-cyy8vbcx.js +4 -0
- package/dist/chunks/add-new-flow-8cgtejv2.js +4 -0
- package/dist/chunks/{cf-account-picker-xb8vvt2h.js → cf-account-picker-v3qd2dhw.js} +3 -3
- package/dist/chunks/cf-settings-1fnw874z.js +4 -0
- package/dist/chunks/{color-area-h8dbasp1.js → color-area-frd9y9q6.js} +2 -2
- package/dist/chunks/color-field-rebpbe33.js +4 -0
- package/dist/chunks/{color-slider-nz2mrzky.js → color-slider-6bzmk3s7.js} +2 -2
- package/dist/chunks/color-t2bnnj8y.js +4 -0
- package/dist/chunks/{combobox-6hs00996.js → combobox-c49x7gf1.js} +3 -3
- package/dist/chunks/components-y8yhdd7d.js +4 -0
- package/dist/chunks/content-source-9e7qvmsf.js +4 -0
- package/dist/chunks/convert-to-repeater-pd2w4z21.js +4 -0
- package/dist/chunks/editor-mb9jzdrw.js +4 -0
- package/dist/chunks/entry-commands-at0wnx3f.js +4 -0
- package/dist/chunks/extension-sections-4z9qq0gh.js +4 -0
- package/dist/chunks/file-ops-dtdvjmza.js +4 -0
- package/dist/chunks/files-8pf70854.js +4 -0
- package/dist/chunks/format-host-fd3m2y2a.js +4 -0
- package/dist/chunks/fs-events-hrk29vcv.js +4 -0
- package/dist/chunks/grid-open-bh74v82z.js +4 -0
- package/dist/chunks/{grid-view-2f03wcgw.js → grid-view-a51mgzmq.js} +17 -17
- package/dist/chunks/{icons-gb967qc8.js → icons-qp8fn1k8.js} +2 -2
- package/dist/chunks/{iframe-entry-btck0e9s.js → iframe-entry-mpwe5pwk.js} +4 -4
- package/dist/chunks/{iframe-entry-2x9bn5ng.js → iframe-entry-msd43x9h.js} +4 -4
- package/dist/chunks/iframe-entry-rt8jz5t8.js +5 -0
- package/dist/chunks/{iframe-entry-b5qgggyp.js → iframe-entry-v40cr813.js} +4 -4
- package/dist/chunks/iframe-host-q0s0wwy3.js +4 -0
- package/dist/chunks/{image-bake-4afr4y6a.js → image-bake-q9ajdjsj.js} +3 -3
- package/dist/chunks/{image-editor-x7t8jbjn.js → image-editor-ke9std9b.js} +3 -3
- package/dist/chunks/index-57ang7ma.js +4 -0
- package/dist/chunks/index-eytr7av4.js +17 -0
- package/dist/chunks/{index-yjrfeks8.js → index-x495reff.js} +3 -3
- package/dist/chunks/{javascript-hy2mws8v.js → javascript-qe34bvaz.js} +3 -3
- package/dist/chunks/jsonMode-m8rseh31.js +13 -0
- package/dist/chunks/jx-validate-bbd1mary.js +4 -0
- package/dist/chunks/layers-panel-wcjtdqsa.js +4 -0
- package/dist/chunks/layers-yscpys6q.js +4 -0
- package/dist/chunks/{listbox-7gka1h86.js → listbox-tktzq5xj.js} +2 -2
- package/dist/chunks/lit-html-qm5wbhqz.js +4 -0
- package/dist/chunks/media-library-2hfff88g.js +4 -0
- package/dist/chunks/media-open-4pb05cne.js +4 -0
- package/dist/chunks/media-picker-bzktmmwr.js +4 -0
- package/dist/chunks/menu-xc3cbgsd.js +4 -0
- package/dist/chunks/{monaco-binding-a51py33c.js → monaco-binding-7t38arh9.js} +3 -3
- package/dist/chunks/monaco-buffer-3vz94c9f.js +4 -0
- package/dist/chunks/monaco-setup-fstdew02.js +4 -0
- package/dist/chunks/notify-gbdcckrh.js +4 -0
- package/dist/chunks/parse-fpdzgk4c.js +4 -0
- package/dist/chunks/platform-9g72gdqr.js +4 -0
- package/dist/chunks/popover-cnmsav6b.js +4 -0
- package/dist/chunks/publish-panel-91x1cb5d.js +4 -0
- package/dist/chunks/publish-quick-e2dmf7eg.js +4 -0
- package/dist/chunks/publish-workspace-1x8mnzrj.js +4 -0
- package/dist/chunks/quick-search-2m4y6p1x.js +4 -0
- package/dist/chunks/references-yg1g9rwx.js +4 -0
- package/dist/chunks/right-panel-7mfyhzrk.js +4 -0
- package/dist/chunks/source-control-rrc4jgp5.js +4 -0
- package/dist/chunks/{split-m5rwn31z.js → split-d15yencd.js} +2 -2
- package/dist/chunks/studio-0jhhznxy.js +9 -0
- package/dist/chunks/studio-0nb57pjg.js +7 -0
- package/dist/chunks/{studio-s24mhq0z.js → studio-0wa4wv4s.js} +4 -4
- package/dist/chunks/studio-0z8kp4xk.js +5 -0
- package/dist/chunks/{studio-g0hxtcga.js → studio-18gc5t3v.js} +4 -4
- package/dist/chunks/{studio-4fnb5648.js → studio-1b79rpcb.js} +4 -4
- package/dist/chunks/studio-211q5j7m.js +4 -0
- package/dist/chunks/studio-213pyfxh.js +16 -0
- package/dist/chunks/studio-2b1smjvp.js +5 -0
- package/dist/chunks/{studio-nwf0c32p.js → studio-2v6tc9jp.js} +4 -4
- package/dist/chunks/studio-30j0wz99.js +5 -0
- package/dist/chunks/studio-3kmqhwtt.js +5 -0
- package/dist/chunks/studio-44drsmhw.js +5 -0
- package/dist/chunks/{studio-2pk7kc7z.js → studio-495b6f2r.js} +4 -4
- package/dist/chunks/{studio-jma2q8r9.js → studio-4gthb2fd.js} +4 -4
- package/dist/chunks/{studio-0gvvqj3h.js → studio-4xadhxj1.js} +4 -4
- package/dist/chunks/{studio-nvcn2ykc.js → studio-52mzbxqm.js} +4 -4
- package/dist/chunks/{studio-v7a7yb5w.js → studio-56mmnsw8.js} +7 -7
- package/dist/chunks/studio-59hz8f4r.js +5 -0
- package/dist/chunks/{studio-sce30r7b.js → studio-5k9mfafh.js} +3 -3
- package/dist/chunks/{studio-rr00ex23.js → studio-5qez462c.js} +6 -6
- package/dist/chunks/studio-6tnpg0vx.js +5 -0
- package/dist/chunks/studio-6w8mt734.js +6 -0
- package/dist/chunks/studio-7hm04x5z.js +5 -0
- package/dist/chunks/studio-8atmfjjm.js +7 -0
- package/dist/chunks/{studio-wmjmsw0p.js → studio-8n99z71s.js} +4 -4
- package/dist/chunks/studio-8vmad6x2.js +5 -0
- package/dist/chunks/studio-93p5k4r4.js +5 -0
- package/dist/chunks/{studio-2x972v58.js → studio-9gb0m81w.js} +4 -4
- package/dist/chunks/studio-a4ymg4vd.js +5 -0
- package/dist/chunks/studio-anc8067x.js +5 -0
- package/dist/chunks/{studio-2e4hry72.js → studio-dbdt67kr.js} +5 -5
- package/dist/chunks/studio-dbex091t.js +5 -0
- package/dist/chunks/{studio-amaz545p.js → studio-dj8ctxey.js} +4 -4
- package/dist/chunks/{studio-k2evngrj.js → studio-ed9bz68j.js} +5 -5
- package/dist/chunks/{studio-4bgvvzhv.js → studio-fe2d1fp5.js} +4 -4
- package/dist/chunks/{studio-45mj4jqe.js → studio-fgp4cyy3.js} +4 -4
- package/dist/chunks/studio-ft706q02.js +5 -0
- package/dist/chunks/studio-g79s1dyg.js +6 -0
- package/dist/chunks/{studio-pj216fmn.js → studio-gahswxp4.js} +4 -4
- package/dist/chunks/studio-gbqc12bk.js +5 -0
- package/dist/chunks/studio-gxphbetb.js +6 -0
- package/dist/chunks/studio-hdf01j7q.js +7 -0
- package/dist/chunks/studio-hf259xzd.js +48 -0
- package/dist/chunks/studio-jbva4wxw.js +5 -0
- package/dist/chunks/studio-jj9gf1qc.js +5 -0
- package/dist/chunks/studio-jsjg3mjv.js +5 -0
- package/dist/chunks/studio-jtvb8hd7.js +5 -0
- package/dist/chunks/{studio-g9brbewz.js → studio-kp4vzrct.js} +4 -4
- package/dist/chunks/studio-kpx02gaa.js +7 -0
- package/dist/chunks/{studio-3na1r48j.js → studio-kv1728ex.js} +8 -8
- package/dist/chunks/studio-m25ry0mf.js +5 -0
- package/dist/chunks/studio-mcbwmkyh.js +5 -0
- package/dist/chunks/studio-meajkr51.js +5 -0
- package/dist/chunks/studio-mkjrjpr2.js +6 -0
- package/dist/chunks/{studio-eqcddvc2.js → studio-mr084886.js} +201 -201
- package/dist/chunks/studio-mrb10hv3.js +5 -0
- package/dist/chunks/{studio-0939t1q1.js → studio-nhpg405j.js} +4 -4
- package/dist/chunks/studio-nsec0hxm.js +64 -0
- package/dist/chunks/{studio-xx3r3sb0.js → studio-nv0mh0p5.js} +4 -4
- package/dist/chunks/studio-pafmb06w.js +5 -0
- package/dist/chunks/{studio-pm17wdc4.js → studio-pgftd79b.js} +4 -4
- package/dist/chunks/{studio-4zd6an2b.js → studio-pk961xgz.js} +4 -4
- package/dist/chunks/studio-pzbr7g05.js +5 -0
- package/dist/chunks/studio-qcc5hsw2.js +10 -0
- package/dist/chunks/studio-qfq58c8n.js +5 -0
- package/dist/chunks/studio-qvb2jr83.js +5 -0
- package/dist/chunks/studio-r85zw6ay.js +5 -0
- package/dist/chunks/studio-s0kwce5w.js +9 -0
- package/dist/chunks/studio-s6ymkf3q.js +14 -0
- package/dist/chunks/{studio-0x6f3nk9.js → studio-s7p5ccxa.js} +4 -4
- package/dist/chunks/{studio-1410q5dw.js → studio-s9jjap3x.js} +4 -4
- package/dist/chunks/{studio-evq47j2z.js → studio-t5hde1ws.js} +4 -4
- package/dist/chunks/studio-vj9yv897.js +5 -0
- package/dist/chunks/studio-wmak8xjw.js +5 -0
- package/dist/chunks/{studio-bnc50f9h.js → studio-wqsmvtqj.js} +4 -4
- package/dist/chunks/studio-x3z3rhej.js +5 -0
- package/dist/chunks/{studio-bg8pzprg.js → studio-xb55kpmy.js} +4 -4
- package/dist/chunks/studio-xxtdajmv.js +12 -0
- package/dist/chunks/studio-xxttcym1.js +5 -0
- package/dist/chunks/{studio-90zkgne5.js → studio-y2zsnzye.js} +7 -7
- package/dist/chunks/{studio-3qr08sxq.js → studio-y3tjh2xb.js} +3 -3
- package/dist/chunks/studio-y4f1rdsj.js +5 -0
- package/dist/chunks/studio-ybkd5w8k.js +5 -0
- package/dist/chunks/{studio-tpxcryf2.js → studio-yetr4gg1.js} +4 -4
- package/dist/chunks/studio-z295anhs.js +6 -0
- package/dist/chunks/studio-z89e6wpg.js +9 -0
- package/dist/chunks/{studio-5tet77de.js → studio-zbwr6prc.js} +3 -3
- package/dist/chunks/{studio-daksw8kh.js → studio-zdbsv5q2.js} +4 -4
- package/dist/chunks/{studio-abh9kfdh.js → studio-zvthj8hg.js} +4 -4
- package/dist/chunks/toast-2kn2vrn4.js +4 -0
- package/dist/chunks/{toast-host-g3r2s0kn.js → toast-host-3rxeyj3d.js} +3 -3
- package/dist/chunks/{tooltip-dj1pvgz7.js → tooltip-ghkxkasp.js} +3 -3
- package/dist/chunks/{tree-j0ebwr5s.js → tree-vw4nc63s.js} +2 -2
- package/dist/chunks/tsMode-7gngmamr.js +14 -0
- package/dist/chunks/workspace-gv0hxgsm.js +4 -0
- package/dist/chunks/workspace-home-j7e0mjy5.js +4 -0
- package/dist/chunks/{ws-client-arz2qsy9.js → ws-client-vs11sxc5.js} +3 -3
- package/dist/iframe-entry.js +14 -14
- package/dist/manifest.json +84 -83
- package/dist/studio.js +99 -98
- package/dist/workers/ts.worker.js +3 -3
- package/package.json +12 -12
- package/src/browse/library-layouts.ts +9 -12
- package/src/browse/library-pane.ts +22 -16
- package/src/browse/library-source.ts +3 -4
- package/src/browse/preview-style.ts +2 -1
- package/src/canvas/canvas-live-render.ts +2 -5
- package/src/canvas/canvas-page-context.ts +5 -0
- package/src/canvas/canvas-render.ts +6 -1
- package/src/canvas/iframe-drop.ts +84 -1
- package/src/canvas/iframe-entry.ts +9 -6
- package/src/canvas/iframe-render.ts +13 -0
- package/src/collab/collab-session.ts +2 -2
- package/src/commands/levels.ts +1 -1
- package/src/content/entry-commands.ts +32 -27
- package/src/content/entry-editor.ts +46 -44
- package/src/content/entry-inspector.ts +15 -12
- package/src/content/entry-model.ts +3 -3
- package/src/content/entry-summaries.ts +5 -5
- package/src/content/hold-state.ts +172 -0
- package/src/content/page-summaries.ts +10 -14
- package/src/create/add-new-flow.ts +2 -1
- package/src/editor/convert-targets.ts +2 -23
- package/src/editor/inline-edit.ts +6 -1
- package/src/editor/repeater-scope.ts +333 -74
- package/src/editor/slash-menu.ts +35 -17
- package/src/files/files.ts +18 -0
- package/src/format/format-choices.ts +5 -5
- package/src/format/format-host.ts +35 -3
- package/src/grid/redirects-grid.ts +4 -4
- package/src/grid/sources/content-source.ts +42 -66
- package/src/locale/element-names.ts +131 -0
- package/src/panels/block-action-bar.ts +3 -4
- package/src/panels/dnd.ts +3 -1
- package/src/panels/elements-panel.ts +93 -36
- package/src/panels/events-panel.ts +6 -2
- package/src/panels/formula-workspace.ts +9 -0
- package/src/panels/imports-panel.ts +3 -2
- package/src/panels/navigator-panels.ts +10 -10
- package/src/panels/panel-registry.ts +3 -3
- package/src/panels/properties-panel.ts +127 -35
- package/src/panels/site-panel.ts +2 -1
- package/src/panels/statement-editor.ts +4 -0
- package/src/panels/style-panel.ts +2 -1
- package/src/panels/styles-panel.ts +2 -2
- package/src/panels/tab-strip.ts +29 -26
- package/src/platforms/cloud.ts +5 -2
- package/src/services/ai-command-tools.ts +2 -1
- package/src/services/ai-project-tools.ts +21 -8
- package/src/services/ai-tools.ts +5 -5
- package/src/services/ai-write-report.ts +22 -4
- package/src/services/context-manager.ts +110 -2
- package/src/services/document-assistant.ts +2 -2
- package/src/services/harness/chat-reducer.ts +9 -4
- package/src/services/jxn-language.ts +110 -0
- package/src/services/model-uri.ts +3 -0
- package/src/services/monaco-setup.ts +6 -2
- package/src/services/render-critic.ts +234 -12
- package/src/services/tool-executor.ts +16 -8
- package/src/settings/contributed-section.ts +2 -1
- package/src/settings/extension-commands.ts +2 -1
- package/src/settings/general-settings.ts +2 -2
- package/src/settings/settings-document.ts +5 -5
- package/src/shell.ts +1 -1
- package/src/studio.ts +28 -11
- package/src/style/variables-view.ts +2 -2
- package/src/surfaces/collections-panel.json +1 -1
- package/src/surfaces/collections-panel.ts +1 -1
- package/src/surfaces/entry-editor.json +10 -10
- package/src/surfaces/entry-editor.ts +22 -19
- package/src/surfaces/entry-inspector.json +11 -11
- package/src/surfaces/entry-inspector.ts +17 -10
- package/src/surfaces/panel-elements.json +466 -206
- package/src/surfaces/panel-elements.ts +61 -25
- package/src/surfaces/tab-strip.json +5 -5
- package/src/surfaces/tab-strip.ts +2 -2
- package/src/tabs/project-config.ts +13 -13
- package/src/tabs/tab.ts +7 -2
- package/src/types.ts +13 -2
- package/src/ui/expression-editor.ts +10 -5
- package/src/ui/schema-form.ts +18 -1
- package/src/utils/edit-display.ts +27 -1
- package/src/view.ts +9 -2
- package/src/workspace/tab-workspace.ts +2 -2
- package/src/workspace/workspace-back.ts +2 -2
- package/dist/chunks/2020-906vx2dq.js +0 -4
- package/dist/chunks/adapter-hnvad61x.js +0 -4
- package/dist/chunks/add-new-flow-v0pm96mr.js +0 -4
- package/dist/chunks/cf-settings-mkbcz4z2.js +0 -4
- package/dist/chunks/color-04361ttk.js +0 -4
- package/dist/chunks/color-field-qv5r2b16.js +0 -4
- package/dist/chunks/components-w5zqwva1.js +0 -4
- package/dist/chunks/content-source-g38w0d3f.js +0 -4
- package/dist/chunks/convert-to-repeater-r8sfxjjm.js +0 -4
- package/dist/chunks/editor-wvf5e6j9.js +0 -4
- package/dist/chunks/entry-commands-t13dyw3c.js +0 -4
- package/dist/chunks/extension-sections-vjzw46xb.js +0 -4
- package/dist/chunks/file-ops-1sghzgcr.js +0 -4
- package/dist/chunks/files-zrqtgt41.js +0 -4
- package/dist/chunks/format-host-9gy76erh.js +0 -4
- package/dist/chunks/fs-events-45rhg3me.js +0 -4
- package/dist/chunks/grid-open-t4fq6bbm.js +0 -4
- package/dist/chunks/iframe-entry-42hpmwz5.js +0 -5
- package/dist/chunks/iframe-host-9aq8ze3q.js +0 -4
- package/dist/chunks/index-f9qr7kzh.js +0 -4
- package/dist/chunks/jsonMode-vj30te2h.js +0 -13
- package/dist/chunks/jx-validate-r4ax11e3.js +0 -4
- package/dist/chunks/layers-m49nmwvx.js +0 -4
- package/dist/chunks/layers-panel-zr92pwdp.js +0 -4
- package/dist/chunks/lit-html-k2mb9k0r.js +0 -4
- package/dist/chunks/media-library-j74rt0w4.js +0 -4
- package/dist/chunks/media-open-mypr0k6b.js +0 -4
- package/dist/chunks/media-picker-pemtbsjv.js +0 -4
- package/dist/chunks/menu-d2jxpgma.js +0 -4
- package/dist/chunks/monaco-buffer-pa0g6ax7.js +0 -4
- package/dist/chunks/monaco-setup-0hw9f835.js +0 -4
- package/dist/chunks/notify-bwehrp7q.js +0 -4
- package/dist/chunks/parse-hee7ne9b.js +0 -4
- package/dist/chunks/platform-kv0k65cy.js +0 -4
- package/dist/chunks/popover-9tf4cjrk.js +0 -4
- package/dist/chunks/publish-panel-vg1n880b.js +0 -4
- package/dist/chunks/publish-quick-4fwngwrw.js +0 -4
- package/dist/chunks/publish-workspace-jv4w2bx2.js +0 -4
- package/dist/chunks/quick-search-nh29rt8a.js +0 -4
- package/dist/chunks/references-vqyr5s9x.js +0 -4
- package/dist/chunks/right-panel-3ws9f2w0.js +0 -4
- package/dist/chunks/source-control-h3hcs5gy.js +0 -4
- package/dist/chunks/studio-0khd8xtx.js +0 -4
- package/dist/chunks/studio-1ctnw3xv.js +0 -5
- package/dist/chunks/studio-1ks5d9y4.js +0 -5
- package/dist/chunks/studio-1y9mab9m.js +0 -5
- package/dist/chunks/studio-2kpxm0eh.js +0 -7
- package/dist/chunks/studio-2zz4qbv9.js +0 -5
- package/dist/chunks/studio-3pz4t5a2.js +0 -5
- package/dist/chunks/studio-4f7thq0p.js +0 -5
- package/dist/chunks/studio-61rg2cz5.js +0 -5
- package/dist/chunks/studio-7rrdbvex.js +0 -5
- package/dist/chunks/studio-9c6cbq2c.js +0 -4
- package/dist/chunks/studio-9dq7rwc7.js +0 -5
- package/dist/chunks/studio-9gr7xs9r.js +0 -6
- package/dist/chunks/studio-a88ej93p.js +0 -7
- package/dist/chunks/studio-acer0g8w.js +0 -5
- package/dist/chunks/studio-az3wvyh2.js +0 -5
- package/dist/chunks/studio-brh8d2pr.js +0 -5
- package/dist/chunks/studio-c2fa783p.js +0 -9
- package/dist/chunks/studio-cfnn70h1.js +0 -5
- package/dist/chunks/studio-cqxj4fcy.js +0 -5
- package/dist/chunks/studio-cw11h078.js +0 -5
- package/dist/chunks/studio-dn56z7sn.js +0 -5
- package/dist/chunks/studio-egnjpyde.js +0 -9
- package/dist/chunks/studio-ejrypvmq.js +0 -5
- package/dist/chunks/studio-frc16j8v.js +0 -10
- package/dist/chunks/studio-gnazwtv3.js +0 -5
- package/dist/chunks/studio-hfqpfmpk.js +0 -5
- package/dist/chunks/studio-hh394phe.js +0 -5
- package/dist/chunks/studio-j0zf5x2x.js +0 -5
- package/dist/chunks/studio-j5fcp6gj.js +0 -5
- package/dist/chunks/studio-jd1qb1st.js +0 -7
- package/dist/chunks/studio-k0xzrse2.js +0 -64
- package/dist/chunks/studio-k1xqrgm5.js +0 -5
- package/dist/chunks/studio-k3we3kqb.js +0 -5
- package/dist/chunks/studio-knsjyx7n.js +0 -5
- package/dist/chunks/studio-mrjtnm62.js +0 -5
- package/dist/chunks/studio-n9qba0gx.js +0 -5
- package/dist/chunks/studio-nzemfbkk.js +0 -14
- package/dist/chunks/studio-pwctzka3.js +0 -16
- package/dist/chunks/studio-q80fg1d6.js +0 -12
- package/dist/chunks/studio-q9hx2qp0.js +0 -5
- package/dist/chunks/studio-qrzmfaf6.js +0 -5
- package/dist/chunks/studio-r6mx7vm5.js +0 -7
- package/dist/chunks/studio-swedpd82.js +0 -5
- package/dist/chunks/studio-tmfcn347.js +0 -6
- package/dist/chunks/studio-v5wktj6f.js +0 -5
- package/dist/chunks/studio-vpevkfxw.js +0 -5
- package/dist/chunks/studio-wqfaqw4m.js +0 -5
- package/dist/chunks/studio-xpx91fby.js +0 -6
- package/dist/chunks/studio-xva3hzkv.js +0 -5
- package/dist/chunks/studio-z3fztxrp.js +0 -9
- package/dist/chunks/studio-z9453ypn.js +0 -6
- package/dist/chunks/toast-w11qpkyz.js +0 -4
- package/dist/chunks/tsMode-jg1dtphj.js +0 -14
- package/dist/chunks/workspace-6ztqcrsh.js +0 -4
- package/dist/chunks/workspace-home-rse9h8a0.js +0 -4
- package/src/content/draft-state.ts +0 -108
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{ot,Cg,Tf,X1,OI,wr,Q1,Kn,Ps,GM,pv,Bn,Ui,ek,YM,q_,fv,ee,vt,bi,Io,xr,H,pc,Uh,ua,cu,Ln,ZM,cn,Ms,sr,ni,He,fc,XM,za,mv,kg,e,y,rn,ye,ai,Zo,Fs,Dr,QM,Ua,Oi,js,Ie,ha,Ve,No,D,d,i,de,AI,Vn,dn,R,r,gc,Or,Do,Hs,pa,ms,pr,xe,Je,J_,un,qh,bv,Tl,q,s,t,F,C,gs,Jh,uo,K_,nk,yv,$l,Eg,Ll,Kh,e2,Gh,bs,ik,Tg,vv,G_,qt,Ge,wv,ii,rk,qa,qi,Ci,Yn,It,ho,$f,Y_,du,Rl,Ar,Bs,Rn,bc,Il,uu,i2,ok,fd,li,Qe,ci,Zt,yc,r2,o2,Ji,Oo,yi,di,ke,ma,s2,ri,se,Lg,hu,Ki,Gr,Yh,Rf,PI,pu,X_,Jt,vi,Q_,m,In,sk,po,W,oi,a2,l2,Ye,c2,md,j,je,Vs,ar,MI,lk,FI,Zh,fo,gd,B,mn,c,Ct,d2,fu,e0,t0,_v,ki,n0,ga,at,ck,u2,kt,Sv,Pr,Nl,en,Dl,At,Ws,mu,If,Ke,Le,Nf,T,Ee,wi,k,gn,_,h2,Mr,fr,Ja,i0,Re,Qo,jI,he,Df,Sn,O,ie,Te,Et,Nn,_r,ut,ys,wc,Y,Ue,$e,L,P,K,pt,Dn,Of,l,Ai,Zn,xc,Gi,Cn,lt,Wn,tn,Yi,p2,bd,On,vs,f2,Pi,m2,Af,dk,g2,gu,Ze,uk,lr,HI,Ng,Pf,nn,U,Cv,mo,Fr,G,A,r0,b2,fe,si,ws,oe,xt,_e,kn,Mf,Ao,cr,ht,kv,ba,Ff,_c,es,Yr,ts,xs,bu,Ev,z,jf,o0,pk,fk,y2,ne,Kt,s0,Dg,Ol,jr,gt,Zi,Hf,Sr,ui,BI,Og,N,Sc,v,Tv,V,VI,Hr,Tt,v2,Al,Qi,_s,yd,zn,Br,Mi,Lv,Qh,on,ep,Rv,mk,w2,Pl,M,a,Po,be,Ag,Ae,a0,Pg,Be,Xt,Mg,Zr,Ka,Vr,Vf,Fg,x2,Ga,Wf,zs,zf,_2,vd,jg,S2,ya,C2,Cc,k2,Hg,Iv,Uf,gk,bk,E2,T2,$2,L2,tp,vu,l0,wu,Nv,yk,WI,c0,d0,qf,u0,R2,h0,vk,wk,Bg,np,Vg,Dv,ip,wd,Wg,xd,Ml,Ov,go,rp,$t,Lt,Pt,Ei,p0,Fl,mt,jl,xk,_d,f0,Jf,zI,zg,I2,Kf,xu,Av,et,Ti,UI,Ug,Dt,Pv,Fi,Mv,op,ns,qg,Sk,Gf,kc,o,Yf,We,bn,$i,N2,Ck,Jg,g0,kk,Ek,hn,Tc,wt,Mo,qI,O2,ge,b0,Fo,A2,wa,Xn,Kg,mr,Fv,yn,y0,v0,w0,x0,Tk,P2,_u,$k,Sd,ue,Cd,$c,An,Su,M2,Ss,Qn,Gg,Zf,Lk,Rk,Ik,JI,H2,ap,is,jv,kd,B2,Pn,lp,jo,Dk,Hv,_0,Cr,Hl,Xr,V2,Wr,KI,S0,Ho,Yg,En,Mn,Lc,C0,Ok,Ak,Bv,ur,Cs,nt,xi,Qf,k0,GI,Qg,bo,Li,Ne,kr,Rc,Vv,Wv,zv,Mk,em,Ed,eb,U2,Bl,Fk,Uv,er,qv,jk,Ic,E0,gr,T0,$0,Nc,Hk,L0,R0,I0,N0,D0,_a,YI,Bk,Vk,Wk,sn,O0,Bo,zk,Za,Us,Sa,Uk,q2,J2,qk,K2,Jk,Dc,Oc,Kk,A0,Yt,Vl,tb,Ca,cp,Kv,ku,Eu,Xk,Xa,Mt,Qk,Gv,ZI,ks,rs,eE,Ri,$u,Td,Qa,M0,_i,ct,F0,up,hp,el,Yv,tE,rm,Es,Zv,om,QI,G2,eN,sm,ve}from"./studio-mr084886.js";import{ce}from"./studio-nhpg405j.js";class hC extends U{constructor(){super({id:"editor.action.forceRetokenize",label:y(1606,"Developer: Force Retokenize"),precondition:void 0})}run(u,n){if(!n.hasModel())return;let h=n.getModel();h.tokenization.resetTokenization();let g=new dn;h.tokenization.forceTokenization(h.getLineCount()),g.stop(),console.log(`tokenization took ${g.elapsed()}`)}}A(hC);class Ht{static{this.sep="."}static{this.None=new Ht("@@none@@")}static{this.Empty=new Ht("")}constructor(u){this.value=u}equals(u){return this.value===u.value}contains(u){return this.equals(u)||this.value===""||u.value.startsWith(this.value+Ht.sep)}intersects(u){return this.contains(u)||u.contains(this)}append(...u){return new Ht((this.value?[this.value,...u]:u).join(Ht.sep))}}var ID=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},LD=function(u,n){return function(h,g){n(h,g,u)}},ED=ue.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:ok,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0,widthInEm:1}});class bf extends i{static{this.baseId="editor.widget.inlineProgressWidget"}constructor(u,n,h,g,p){super();this.typeId=u,this.editor=n,this.range=h,this.delegate=p,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(g),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(u){this.domNode=_(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=u;let n=_("span.icon");this.domNode.append(n),n.classList.add(...Y.asClassNameArray(C.loading),"codicon-modifier-spin");let h=()=>{let g=this.editor.getOption(75);this.domNode.style.height=`${g}px`,this.domNode.style.width=`${Math.ceil(0.8*g)}px`};h(),this._register(this.editor.onDidChangeConfiguration((g)=>{if(g.hasChanged(61)||g.hasChanged(75))h()})),this._register(c(this.domNode,T.CLICK,(g)=>{this.delegate.cancel()}))}getId(){return bf.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)}}var sv=class u extends i{constructor(n,h,g){super();this.id=n,this._editor=h,this._instantiationService=g,this._showDelay=500,this._showPromise=this._register(new de),this._currentWidget=this._register(new de),this._operationIdPool=0,this._currentDecorations=h.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(n,h,g,p,f){let b=this._operationIdPool++;this._currentOperation=b,this.clear(),this._showPromise.value=yi(()=>{let S=t.fromPositions(n);if(this._currentDecorations.set([{range:S,options:ED}]).length>0)this._currentWidget.value=this._instantiationService.createInstance(bf,this.id,this._editor,S,h,p)},f??this._showDelay);try{return await g}finally{if(this._currentOperation===b)this.clear(),this._currentOperation=void 0}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};sv=ID([LD(2,O)],sv);var DD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},uC=function(u,n){return function(h,g){n(h,g,u)}},Nu,ti=class u{static{Nu=this}static{this.ID="editor.contrib.messageController"}static{this.MESSAGE_VISIBLE=new P("messageVisible",!1,e(1353,"Whether the editor is currently showing an inline message"))}static get(n){return n.getContribution(Nu.ID)}constructor(n,h,g){this._openerService=g,this._messageWidget=new de,this._messageListeners=new d,this._mouseOverMessage=!1,this._editor=n,this._visible=Nu.MESSAGE_VISIBLE.bindTo(h)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(n,h){if(zn(jo(n)?n.value:n),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),jo(n)){let p=this._messageListeners.add(Hl(n,{actionHandler:(f,b)=>{this.closeMessage(),KI(this._openerService,f,b.isTrusted)}}));this._messageWidget.value=new Ou(this._editor,h,p.element)}else this._messageWidget.value=new Ou(this._editor,h,n);this._messageListeners.add(R.debounce(this._editor.onDidBlurEditorText,(p,f)=>f,0)(()=>{if(this._mouseOverMessage)return;if(this._messageWidget.value&&en(At(),this._messageWidget.value.getDomNode()))return;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(c(this._messageWidget.value.getDomNode(),T.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(c(this._messageWidget.value.getDomNode(),T.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let g;this._messageListeners.add(this._editor.onMouseMove((p)=>{if(!p.target.position)return;if(!g)g=new t(h.lineNumber-3,1,p.target.position.lineNumber+3,1);else if(!g.containsPosition(p.target.position))this.closeMessage()}))}closeMessage(){if(this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value)this._messageListeners.add(Ou.fadeOut(this._messageWidget.value))}};ti=Nu=DD([uC(1,K),uC(2,Xr)],ti);var RD=nn.bindToContribution(ti.get);G(new RD({id:"leaveEditorMessage",precondition:ti.MESSAGE_VISIBLE,handler:(u)=>u.closeMessage(),kbOpts:{weight:130,primary:9}}));class Ou{static fadeOut(u){let n=()=>{u.dispose(),clearTimeout(h),u.getDomNode().removeEventListener("animationend",n)},h=setTimeout(n,110);return u.getDomNode().addEventListener("animationend",n),u.getDomNode().classList.add("fadeOut"),{dispose:n}}constructor(u,{lineNumber:n,column:h},g){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=u,this._editor.revealLinesInCenterIfOutsideViewport(n,n,0),this._position={lineNumber:n,column:h},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";let p=document.createElement("div");p.classList.add("anchor","top"),this._domNode.appendChild(p);let f=document.createElement("div");if(typeof g==="string")f.classList.add("message"),f.textContent=g;else g.classList.add("message"),f.appendChild(g);this._domNode.appendChild(f);let b=document.createElement("div");b.classList.add("anchor","below"),this._domNode.appendChild(b),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(u){this._domNode.classList.toggle("below",u===2)}}fe(ti.ID,ti,4);var vf=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ac=function(u,n){return function(h,g){n(h,g,u)}};class Pu{constructor(u){this.copyMimeTypes=[],this.kind=u,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(u,n,h,g,p){let f=await this.getEdit(h,p);if(!f)return;return{edits:[{insertText:f.insertText,title:f.title,kind:f.kind,handledMimeType:f.handledMimeType,yieldTo:f.yieldTo}],dispose(){}}}async provideDocumentDropEdits(u,n,h,g){let p=await this.getEdit(h,g);if(!p)return;return{edits:[{insertText:p.insertText,title:p.title,kind:p.kind,handledMimeType:p.handledMimeType,yieldTo:p.yieldTo}],dispose(){}}}}class Bh extends Pu{static{this.id="text"}constructor(){super(Ht.Empty.append("text","plain"));this.id=Bh.id,this.dropMimeTypes=[kn.text],this.pasteMimeTypes=[kn.text]}async getEdit(u,n){let h=u.get(kn.text);if(!h)return;if(u.has(kn.uriList))return;let g=await h.asString();return{handledMimeType:kn.text,title:e(980,"Insert Plain Text"),insertText:g,kind:this.kind}}}class Sf extends Pu{constructor(){super(Ht.Empty.append("uri","path","absolute"));this.dropMimeTypes=[kn.uriList],this.pasteMimeTypes=[kn.uriList]}async getEdit(u,n){let h=await pC(u);if(!h.length||n.isCancellationRequested)return;let g=0,p=h.map(({uri:b,originalText:S})=>{if(b.scheme===se.file)return b.fsPath;else return g++,S}).join(" "),f;if(g>0)f=h.length>1?e(981,"Insert Uris"):e(982,"Insert Uri");else f=h.length>1?e(983,"Insert Paths"):e(984,"Insert Path");return{handledMimeType:kn.uriList,insertText:p,title:f,kind:this.kind}}}var Mu=class u extends Pu{constructor(n){super(Ht.Empty.append("uri","path","relative"));this._workspaceContextService=n,this.dropMimeTypes=[kn.uriList],this.pasteMimeTypes=[kn.uriList]}async getEdit(n,h){let g=await pC(n);if(!g.length||h.isCancellationRequested)return;let p=wr(g.map(({uri:f})=>{let b=this._workspaceContextService.getWorkspaceFolder(f);return b?g2(b.uri,f):void 0}));if(!p.length)return;return{handledMimeType:kn.uriList,insertText:p.join(" "),title:g.length>1?e(985,"Insert Relative Paths"):e(986,"Insert Relative Path"),kind:this.kind}}};Mu=vf([ac(0,Sa)],Mu);class gC{constructor(){this.kind=new Ht("html"),this.providedPasteEditKinds=[this.kind],this.copyMimeTypes=[],this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:kn.text}]}async provideDocumentPasteEdits(u,n,h,g,p){if(g.triggerKind!==Eg.PasteAs&&!g.only?.contains(this.kind))return;let b=await h.get("text/html")?.asString();if(!b||p.isCancellationRequested)return;return{dispose(){},edits:[{insertText:b,yieldTo:this._yieldTo,title:e(987,"Insert HTML"),kind:this.kind}]}}}async function pC(u){let n=u.get(kn.uriList);if(!n)return[];let h=await n.asString(),g=[];for(let p of zg.parse(h))try{g.push({uri:q.parse(p),originalText:p})}catch{}return g}var xa={scheme:"*",hasAccessToAllModels:!0},V1=class u extends i{constructor(n,h){super();this._register(n.documentDropEditProvider.register(xa,new Bh)),this._register(n.documentDropEditProvider.register(xa,new Sf)),this._register(n.documentDropEditProvider.register(xa,new Mu(h)))}};V1=vf([ac(0,V),ac(1,Sa)],V1);var W1=class u extends i{constructor(n,h){super();this._register(n.documentPasteEditProvider.register(xa,new Bh)),this._register(n.documentPasteEditProvider.register(xa,new Sf)),this._register(n.documentPasteEditProvider.register(xa,new Mu(h))),this._register(n.documentPasteEditProvider.register(xa,new gC))}};W1=vf([ac(0,V),ac(1,Sa)],W1);class Xo{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(u){return u>=48&&u<=57}static isVariableCharacter(u){return u===95||u>=97&&u<=122||u>=65&&u<=90}text(u){this.value=u,this.pos=0}tokenText(u){return this.value.substr(u.pos,u.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};let u=this.pos,n=0,h=this.value.charCodeAt(u),g;if(g=Xo._table[h],typeof g==="number")return this.pos+=1,{type:g,pos:u,len:1};if(Xo.isDigitCharacter(h)){g=8;do n+=1,h=this.value.charCodeAt(u+n);while(Xo.isDigitCharacter(h));return this.pos+=n,{type:g,pos:u,len:n}}if(Xo.isVariableCharacter(h)){g=9;do h=this.value.charCodeAt(u+ ++n);while(Xo.isVariableCharacter(h)||Xo.isDigitCharacter(h));return this.pos+=n,{type:g,pos:u,len:n}}g=10;do n+=1,h=this.value.charCodeAt(u+n);while(!isNaN(h)&&typeof Xo._table[h]>"u"&&!Xo.isDigitCharacter(h)&&!Xo.isVariableCharacter(h));return this.pos+=n,{type:g,pos:u,len:n}}}class Ia{constructor(){this._children=[]}appendChild(u){if(u instanceof hi&&this._children[this._children.length-1]instanceof hi)this._children[this._children.length-1].value+=u.value;else u.parent=this,this._children.push(u);return this}replace(u,n){let{parent:h}=u,g=h.children.indexOf(u),p=h.children.slice(0);p.splice(g,1,...n),h._children=p,function f(b,S){for(let w of b)w.parent=S,f(w.children,w)}(n,h)}get children(){return this._children}get rightMostDescendant(){if(this._children.length>0)return this._children[this._children.length-1].rightMostDescendant;return this}get snippet(){let u=this;while(!0){if(!u)return;if(u instanceof Md)return u;u=u.parent}}toString(){return this.children.reduce((u,n)=>u+n.toString(),"")}len(){return 0}}class hi extends Ia{constructor(u){super();this.value=u}toString(){return this.value}len(){return this.value.length}clone(){return new hi(this.value)}}class wf extends Ia{}class oo extends wf{static compareByIndex(u,n){if(u.index===n.index)return 0;else if(u.isFinalTabstop)return 1;else if(n.isFinalTabstop)return-1;else if(u.index<n.index)return-1;else if(u.index>n.index)return 1;else return 0}constructor(u){super();this.index=u}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof La?this._children[0]:void 0}clone(){let u=new oo(this.index);if(this.transform)u.transform=this.transform.clone();return u._children=this.children.map((n)=>n.clone()),u}}class La extends Ia{constructor(){super(...arguments);this.options=[]}appendChild(u){if(u instanceof hi)u.parent=this,this.options.push(u);return this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){let u=new La;return this.options.forEach(u.appendChild,u),u}}class Cf extends Ia{constructor(){super(...arguments);this.regexp=new RegExp("")}resolve(u){let n=this,h=!1,g=u.replace(this.regexp,function(){return h=!0,n._replace(Array.prototype.slice.call(arguments,0,-2))});if(!h&&this._children.some((p)=>p instanceof Yo&&Boolean(p.elseValue)))g=this._replace([]);return g}_replace(u){let n="";for(let h of this._children)if(h instanceof Yo){let g=u[h.index]||"";g=h.resolve(g),n+=g}else n+=h.toString();return n}toString(){return""}clone(){let u=new Cf;return u.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),u._children=this.children.map((n)=>n.clone()),u}}class Yo extends Ia{constructor(u,n,h,g){super();this.index=u,this.shorthandName=n,this.ifValue=h,this.elseValue=g}resolve(u){if(this.shorthandName==="upcase")return!u?"":u.toLocaleUpperCase();else if(this.shorthandName==="downcase")return!u?"":u.toLocaleLowerCase();else if(this.shorthandName==="capitalize")return!u?"":u[0].toLocaleUpperCase()+u.substr(1);else if(this.shorthandName==="pascalcase")return!u?"":this._toPascalCase(u);else if(this.shorthandName==="camelcase")return!u?"":this._toCamelCase(u);else if(this.shorthandName==="kebabcase")return!u?"":this._toKebabCase(u);else if(this.shorthandName==="snakecase")return!u?"":this._toSnakeCase(u);else if(Boolean(u)&&typeof this.ifValue==="string")return this.ifValue;else if(!Boolean(u)&&typeof this.elseValue==="string")return this.elseValue;else return u||""}_toKebabCase(u){if(!u.match(/[\p{L}0-9]+/gu))return u;if(!u.match(/[\p{L}0-9]/u))return u.trim().toLowerCase().replace(/^_+|_+$/g,"").replace(/[\s_]+/g,"-");let h=u.trim().replace(/^_+|_+$/g,""),g=h.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);if(!g)return h.split(/[\s_-]+/).filter((p)=>p.length>0).map((p)=>p.toLowerCase()).join("-");return g.map((p)=>p.toLowerCase()).join("-")}_toPascalCase(u){let n=u.match(/[\p{L}0-9]+/gu);if(!n)return u;return n.map((h)=>h.charAt(0).toUpperCase()+h.substr(1)).join("")}_toCamelCase(u){let n=u.match(/[\p{L}0-9]+/gu);if(!n)return u;return n.map((h,g)=>{if(g===0)return h.charAt(0).toLowerCase()+h.substr(1);return h.charAt(0).toUpperCase()+h.substr(1)}).join("")}_toSnakeCase(u){return u.replace(/(\p{Ll})(\p{Lu})/gu,"$1_$2").replace(/[\s\-]+/g,"_").toLowerCase()}clone(){return new Yo(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class cs extends wf{constructor(u){super();this.name=u}resolve(u){let n=u.resolve(this);if(this.transform)n=this.transform.resolve(n||"");if(n!==void 0)return this._children=[new hi(n)],!0;return!1}clone(){let u=new cs(this.name);if(this.transform)u.transform=this.transform.clone();return u._children=this.children.map((n)=>n.clone()),u}}function mC(u,n){let h=[...u];while(h.length>0){let g=h.shift();if(!n(g))break;h.unshift(...g.children)}}class Md extends Ia{get placeholderInfo(){if(!this._placeholders){let u=[],n;this.walk(function(h){if(h instanceof oo)u.push(h),n=!n||n.index<h.index?h:n;return!0}),this._placeholders={all:u,last:n}}return this._placeholders}get placeholders(){let{all:u}=this.placeholderInfo;return u}offset(u){let n=0,h=!1;if(this.walk((g)=>{if(g===u)return h=!0,!1;return n+=g.len(),!0}),!h)return-1;return n}fullLen(u){let n=0;return mC([u],(h)=>(n+=h.len(),!0)),n}enclosingPlaceholders(u){let n=[],{parent:h}=u;while(h){if(h instanceof oo)n.push(h);h=h.parent}return n}resolveVariables(u){return this.walk((n)=>{if(n instanceof cs){if(n.resolve(u))this._placeholders=void 0}return!0}),this}appendChild(u){return this._placeholders=void 0,super.appendChild(u)}replace(u,n){return this._placeholders=void 0,super.replace(u,n)}clone(){let u=new Md;return u._children=this.children.map((n)=>n.clone()),u}walk(u){mC(this.children,u)}}class no{constructor(){this._scanner=new Xo,this._token={type:14,pos:0,len:0}}static escape(u){return u.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(u){return/\${?CLIPBOARD/.test(u)}parse(u,n,h){let g=new Md;return this.parseFragment(u,g),this.ensureFinalTabstop(g,h??!1,n??!1),g}parseFragment(u,n){let h=n.children.length;this._scanner.text(u),this._token=this._scanner.next();while(this._parse(n));let g=new Map,p=[];n.walk((S)=>{if(S instanceof oo)if(S.isFinalTabstop)g.set(0,void 0);else if(!g.has(S.index)&&S.children.length>0)g.set(S.index,S.children);else p.push(S);return!0});let f=(S,w)=>{let x=g.get(S.index);if(!x)return;let I=new oo(S.index);I.transform=S.transform;for(let E of x){let Z=E.clone();if(I.appendChild(Z),Z instanceof oo&&g.has(Z.index)&&!w.has(Z.index))w.add(Z.index),f(Z,w),w.delete(Z.index)}n.replace(S,[I])},b=new Set;for(let S of p)f(S,b);return n.children.slice(h)}ensureFinalTabstop(u,n,h){if(n||h&&u.placeholders.length>0){if(!u.placeholders.find((p)=>p.index===0))u.appendChild(new oo(0))}}_accept(u,n){if(u===void 0||this._token.type===u){let h=!n?!0:this._scanner.tokenText(this._token);return this._token=this._scanner.next(),h}return!1}_backTo(u){return this._scanner.pos=u.pos+u.len,this._token=u,!1}_until(u){let n=this._token;while(this._token.type!==u){if(this._token.type===14)return!1;else if(this._token.type===5){let g=this._scanner.next();if(g.type!==0&&g.type!==4&&g.type!==5)return!1}this._token=this._scanner.next()}let h=this._scanner.value.substring(n.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),h}_parse(u){return this._parseEscaped(u)||this._parseTabstopOrVariableName(u)||this._parseComplexPlaceholder(u)||this._parseComplexVariable(u)||this._parseAnything(u)}_parseEscaped(u){let n;if(n=this._accept(5,!0))return n=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||n,u.appendChild(new hi(n)),!0;return!1}_parseTabstopOrVariableName(u){let n,h=this._token;if(!(this._accept(0)&&(n=this._accept(9,!0)||this._accept(8,!0))))return this._backTo(h);return u.appendChild(/^\d+$/.test(n)?new oo(Number(n)):new cs(n)),!0}_parseComplexPlaceholder(u){let n,h=this._token;if(!(this._accept(0)&&this._accept(3)&&(n=this._accept(8,!0))))return this._backTo(h);let p=new oo(Number(n));if(this._accept(1))while(!0){if(this._accept(4))return u.appendChild(p),!0;if(this._parse(p))continue;return u.appendChild(new hi("${"+n+":")),p.children.forEach(u.appendChild,u),!0}else if(p.index>0&&this._accept(7)){let f=new La;while(!0){if(this._parseChoiceElement(f)){if(this._accept(2))continue;if(this._accept(7)){if(p.appendChild(f),this._accept(4))return u.appendChild(p),!0}}return this._backTo(h),!1}}else if(this._accept(6)){if(this._parseTransform(p))return u.appendChild(p),!0;return this._backTo(h),!1}else if(this._accept(4))return u.appendChild(p),!0;else return this._backTo(h)}_parseChoiceElement(u){let n=this._token,h=[];while(!0){if(this._token.type===2||this._token.type===7)break;let g;if(g=this._accept(5,!0))g=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||g;else g=this._accept(void 0,!0);if(!g)return this._backTo(n),!1;h.push(g)}if(h.length===0)return this._backTo(n),!1;return u.appendChild(new hi(h.join(""))),!0}_parseComplexVariable(u){let n,h=this._token;if(!(this._accept(0)&&this._accept(3)&&(n=this._accept(9,!0))))return this._backTo(h);let p=new cs(n);if(this._accept(1))while(!0){if(this._accept(4))return u.appendChild(p),!0;if(this._parse(p))continue;return u.appendChild(new hi("${"+n+":")),p.children.forEach(u.appendChild,u),!0}else if(this._accept(6)){if(this._parseTransform(p))return u.appendChild(p),!0;return this._backTo(h),!1}else if(this._accept(4))return u.appendChild(p),!0;else return this._backTo(h)}_parseTransform(u){let n=new Cf,h="",g="";while(!0){if(this._accept(6))break;let p;if(p=this._accept(5,!0)){p=this._accept(6,!0)||p,h+=p;continue}if(this._token.type!==14){h+=this._accept(void 0,!0);continue}return!1}while(!0){if(this._accept(6))break;let p;if(p=this._accept(5,!0)){p=this._accept(5,!0)||this._accept(6,!0)||p,n.appendChild(new hi(p));continue}if(this._parseFormatString(n)||this._parseAnything(n))continue;return!1}while(!0){if(this._accept(4))break;if(this._token.type!==14){g+=this._accept(void 0,!0);continue}return!1}try{n.regexp=new RegExp(h,g)}catch(p){return!1}return u.transform=n,!0}_parseFormatString(u){let n=this._token;if(!this._accept(0))return!1;let h=!1;if(this._accept(3))h=!0;let g=this._accept(8,!0);if(!g)return this._backTo(n),!1;else if(!h)return u.appendChild(new Yo(Number(g))),!0;else if(this._accept(4))return u.appendChild(new Yo(Number(g))),!0;else if(!this._accept(1))return this._backTo(n),!1;if(this._accept(6)){let p=this._accept(9,!0);if(!p||!this._accept(4))return this._backTo(n),!1;else return u.appendChild(new Yo(Number(g),p)),!0}else if(this._accept(11)){let p=this._until(4);if(p)return u.appendChild(new Yo(Number(g),void 0,p,void 0)),!0}else if(this._accept(12)){let p=this._until(4);if(p)return u.appendChild(new Yo(Number(g),void 0,void 0,p)),!0}else if(this._accept(13)){let p=this._until(1);if(p){let f=this._until(4);if(f)return u.appendChild(new Yo(Number(g),void 0,p,f)),!0}}else{let p=this._until(4);if(p)return u.appendChild(new Yo(Number(g),void 0,void 0,p)),!0}return this._backTo(n),!1}_parseAnything(u){if(this._token.type!==14)return u.appendChild(new hi(this._scanner.tokenText(this._token))),this._accept(void 0),!0;return!1}}function Au(u,n,h){if(typeof h.insertText==="string"?h.insertText==="":h.insertText.snippet==="")return{edits:h.additionalEdit?.edits??[]};return{edits:[...n.map((g)=>new Oc(u,{range:g,text:typeof h.insertText==="string"?no.escape(h.insertText)+"$0":h.insertText.snippet,insertAsSnippet:!0})),...h.additionalEdit?.edits??[]]}}function z1(u){function n(b,S){if("mimeType"in b)return b.mimeType===S.handledMimeType;return!!S.kind&&b.kind.contains(S.kind)}let h=new Map;for(let b of u)for(let S of b.yieldTo??[])for(let w of u){if(w===b)continue;if(n(S,w)){let x=h.get(b);if(!x)x=[],h.set(b,x);x.push(w)}}if(!h.size)return Array.from(u);let g=new Set,p=[];function f(b){if(!b.length)return[];let S=b[0];if(p.includes(S))return console.warn("Yield to cycle detected",S),b;if(g.has(S))return f(b.slice(1));let w=[],x=h.get(S);if(x)p.push(S),w=f(x),p.pop();return g.add(S),[...w,S,...f(b.slice(1))]}return f(Array.from(u))}function yf(u,n){if(n&&(u.stack||u.stacktrace))return e(33,"{0}: {1}",_C(u),fC(u.stack)||fC(u.stacktrace));return _C(u)}function fC(u){if(Array.isArray(u))return u.join(`
|
|
2
|
+
`);return u}function _C(u){if(u.code==="ERR_UNC_HOST_NOT_ALLOWED")return`${u.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`;if(typeof u.code==="string"&&typeof u.errno==="number"&&typeof u.syscall==="string")return e(34,"A system error occurred ({0})",u.message);return u.message||e(35,"An unknown error occurred. Please consult the log for more details.")}function av(u=null,n=!1){if(!u)return e(36,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(u)){let h=wr(u),g=av(h[0],n);if(h.length>1)return e(37,"{0} ({1} errors in total)",g,h.length);return g}if(Ln(u))return u;if(u.detail){let h=u.detail;if(h.error)return yf(h.error,n);if(h.exception)return yf(h.exception,n)}if(u.stack)return yf(u,n);if(u.message)return u.message;return e(38,"An unknown error occurred. Please consult the log for more details.")}class xf extends i{constructor(u){super();this._onChange=this._register(new r),this.onChange=this._onChange.event,this._checked=!!u.checked,this._title=u.title??u.ariaLabel,this.domNode=_("button.monaco-switch"),this.domNode.type="button",this.domNode.setAttribute("role","switch"),k(this.domNode,_(".monaco-switch-thumb")),this._register(Li().setupDelayedHover(this.domNode,()=>({content:this._title,style:1}))),this.setAriaLabel(u.ariaLabel,u.title),this.disabled=!!u.disabled,this._applyState(),this._register(c(this.domNode,T.CLICK,(n)=>{if(Ee.stop(n,!0),this.domNode.disabled)return;this._checked=!this._checked,this._applyState(),this._onChange.fire(this._checked)}))}get checked(){return this._checked}set checked(u){if(this._checked!==u)this._checked=u,this._applyState()}get disabled(){return this.domNode.disabled}set disabled(u){this.domNode.disabled=u}setAriaLabel(u,n=u){this.domNode.setAttribute("aria-label",u),this._title=n}_applyState(){this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked)}}var kD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},bC=function(u,n){return function(h,g){n(h,g,u)}},Pd=class u extends i{get enabled(){return this._enabled}set enabled(n){if(n)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;else 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=n}constructor(n,h,g={},p,f){super();this._link=h,this._hoverService=p,this._enabled=!0,this.el=k(n,_("a.monaco-link",{tabIndex:h.tabIndex??0,href:h.href},h.label)),this.hoverDelegate=g.hoverDelegate??bo("mouse"),this.setTooltip(h.title),this.el.setAttribute("role","button");let b=this._register(new mt(this.el,"click")),S=this._register(new mt(this.el,"keydown")),w=R.chain(S.event,(E)=>E.map((Z)=>new Qe(Z)).filter((Z)=>Z.keyCode===3||Z.keyCode===10)),x=this._register(new mt(this.el,Lt.Tap)).event;this._register(Pt.addTarget(this.el));let I=R.any(b.event,w,x);this._register(I((E)=>{if(!this.enabled)return;if(Ee.stop(E,!0),g?.opener)g.opener(this._link.href);else f.open(this._link.href,{allowCommands:!0})})),this.enabled=!0}setTooltip(n){if(!this.hover&&n)this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,n));else if(this.hover)this.hover.update(n)}};Pd=kD([bC(3,An),bC(4,Xr)],Pd);var e_=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},hs=function(u,n){return function(h,g){n(h,g,u)}},Lf,Hu="acceptSelectedCodeAction",Wu="previewSelectedCodeAction",TD=new Set([Hu,Wu,"toggleSectionCodeAction"]),ND="actionList.remove";class vC{get templateId(){return"header"}renderTemplate(u){u.classList.add("group-header");let n=document.createElement("span");return u.append(n),{container:u,text:n}}renderElement(u,n,h){h.text.textContent=u.group?.title??u.label??""}disposeTemplate(u){}}class SC{get templateId(){return"separator"}renderTemplate(u){u.classList.add("separator");let n=document.createElement("span");return u.append(n),{container:u,text:n}}renderElement(u,n,h){h.container.classList.toggle("has-label",!!u.label),h.text.textContent=u.label??""}disposeTemplate(u){}}function wC(u){return!!u.submenuActions?.length&&!u.hover?.content||!!u.hover?.expandable}function CC(u){return wC(u)&&u.hover?.showIndicator!==!1}var Ef=class u{get templateId(){return"action"}constructor(n,h,g,p,f,b,S,w,x,I,E,Z){this._supportsPreview=n,this._onRemoveItem=h,this._onShowSubmenu=g,this._reservesSubmenuSpace=p,this._groupTitleByIndex=f,this._linkHandler=b,this._hideDefaultKeybindingTooltip=S,this._stopToolbarPointerPropagation=w,this._registerStandaloneToggle=x,this._registerToolbar=I,this._keybindingService=E,this._openerService=Z}renderTemplate(n){n.classList.add(this.templateId);let h=document.createElement("div");h.className="icon",n.append(h);let g=document.createElement("span");g.className="title",n.append(g);let p=document.createElement("span");p.className="action-item-badge",p.ariaHidden="true",n.append(p);let f=document.createElement("span");f.className="description",n.append(f);let b=document.createElement("span");b.className="group-title",n.append(b);let S=document.createElement("span");S.className="detail",n.append(S);let w=new Xa(n,Oi),x=document.createElement("div");x.className="action-list-item-toolbar",n.append(x);let I=document.createElement("div");I.className="action-list-submenu-indicator",n.append(I);let E=document.createElement("div");E.className="action-list-item-inline-toggle",n.append(E);let Z=new d;return{container:n,icon:h,text:g,detail:S,badge:p,description:f,groupTitle:b,keybinding:w,toolbar:x,submenuIndicator:I,inlineToggleContainer:E,elementDisposables:Z}}renderElement(n,h,g){if(g.elementDisposables.clear(),n.iconClasses?.length)g.icon.className=["icon",...n.iconClasses].join(" "),g.icon.style.color="";else if(n.group?.icon)g.icon.className=Y.asClassName(n.group.icon),g.icon.style.color=n.group.icon.color?M(n.group.icon.color.id):"";else g.icon.className=Y.asClassName(C.lightBulb),g.icon.style.color="var(--vscode-editorLightBulb-foreground)";if(!n.item&&!n.standaloneToggle||!n.label)return;if(h2(!n.hideIcon,g.icon),n.isSectionToggle){let I=n.group?.icon===C.chevronDown;g.container.setAttribute("aria-expanded",String(I))}else g.container.removeAttribute("aria-expanded");if(g.previousClassNames?.length)g.container.classList.remove(...g.previousClassNames);let p=n.className?.split(/\s+/).filter((I)=>I.length>0)??[];if(g.container.classList.toggle("action-list-custom",p.length>0),p.length)g.container.classList.add(...p);if(g.previousClassNames=p,g.text.textContent=ko(n.label),n.badge)g.badge.textContent=n.badge,g.badge.style.display="";else g.badge.textContent="",g.badge.style.display="none";if(n.keybinding)g.description.textContent=n.keybinding.getLabel(),g.description.style.display="inline",g.description.style.letterSpacing="0.5px";else if(n.description){if(mn(g.description),typeof n.description==="string")g.description.textContent=ko(n.description);else{let I=Hl(n.description,{actionHandler:(E)=>{let Z=q.parse(E);if(this._linkHandler)this._linkHandler(Z,n);else this._openerService.open(Z,{allowCommands:!0})}});g.elementDisposables.add(I),g.description.appendChild(I.element)}g.description.style.display="inline"}else g.description.textContent="",g.description.style.display="none";let f=this._groupTitleByIndex.get(h);if(f)g.groupTitle.textContent=f,g.groupTitle.style.display="";else g.groupTitle.textContent="",g.groupTitle.style.display="none";if(n.detail)g.detail.textContent=ko(n.detail),g.detail.style.display="";else g.detail.textContent="",g.detail.style.display="none";g.container.classList.toggle("has-detail",!!n.detail),mn(g.inlineToggleContainer);let b=n.standaloneToggle??n.inlineToggle;if(b){let I=document.createElement("span");if(I.className="action-list-item-inline-toggle-label",I.textContent=ko(b.label),!n.standaloneToggle)g.inlineToggleContainer.append(I);g.inlineToggleContainer.style.display="",g.container.classList.toggle("has-inline-toggle",!!n.inlineToggle),g.container.classList.toggle("has-standalone-toggle",!!n.standaloneToggle);let E=g.elementDisposables.add(new xf({ariaLabel:b.title??b.label,checked:b.checked,disabled:b.disabled}));if(g.inlineToggleContainer.append(E.domNode),n.standaloneToggle)g.elementDisposables.add(this._registerStandaloneToggle(n,E));g.elementDisposables.add(E.onChange(()=>b.onChange(E.checked))),g.elementDisposables.add(c(g.inlineToggleContainer,T.CLICK,(Z)=>Z.stopPropagation()))}else g.inlineToggleContainer.style.display="none",g.container.classList.remove("has-inline-toggle"),g.container.classList.remove("has-standalone-toggle");let S=this._keybindingService.lookupKeybinding(Hu)?.getLabel(),w=this._keybindingService.lookupKeybinding(Wu)?.getLabel();if(g.container.classList.toggle("option-disabled",!!n.disabled),n.hover!==void 0)g.container.title="";else if(n.tooltip)g.container.title=n.tooltip;else if(n.disabled)g.container.title=n.label;else if(n.standaloneToggle)g.container.title="";else if(this._hideDefaultKeybindingTooltip)g.container.title="";else if(S&&w)if(this._supportsPreview&&n.canPreview)g.container.title=e(1731,"{0} to Apply, {1} to Preview",S,w);else g.container.title=e(1732,"{0} to Apply",S);else g.container.title="";mn(g.toolbar);let x=[...n.toolbarActions??[]];if(n.onRemove)x.push(wc({id:ND,label:e(1733,"Remove"),class:Y.asClassName(C.close),run:async()=>{await n.onRemove(),this._onRemoveItem?.(n)}}));if(g.container.classList.toggle("has-toolbar",x.length>0),x.length>0){let I=new er(g.toolbar);if(g.elementDisposables.add(I),this._stopToolbarPointerPropagation)g.elementDisposables.add(fu(g.toolbar,(E)=>{E.preventDefault(),E.stopPropagation()})),g.elementDisposables.add(c(g.toolbar,T.CLICK,(E)=>E.stopPropagation())),g.elementDisposables.add(c(g.toolbar,Lt.Tap,(E)=>E.stopPropagation()));else g.elementDisposables.add(fu(g.toolbar,(E)=>E.preventDefault()));I.push(x,{icon:!0,label:!1}),g.elementDisposables.add(this._registerToolbar(n,I))}if(CC(n))g.submenuIndicator.className="action-list-submenu-indicator has-submenu "+Y.asClassName(C.chevronRight),g.submenuIndicator.style.display="",g.submenuIndicator.style.visibility="",g.elementDisposables.add(c(g.submenuIndicator,T.CLICK,(I)=>{I.stopPropagation(),this._onShowSubmenu?.(n)}));else if(this._reservesSubmenuSpace())g.submenuIndicator.className="action-list-submenu-indicator",g.submenuIndicator.style.display="",g.submenuIndicator.style.visibility="hidden";else g.submenuIndicator.className="action-list-submenu-indicator",g.submenuIndicator.style.display="none";if(wC(n))g.container.setAttribute("aria-haspopup",n.hover?.expandable?"dialog":"menu"),g.container.setAttribute("aria-expanded","false");else if(g.container.removeAttribute("aria-haspopup"),!n.isSectionToggle)g.container.removeAttribute("aria-expanded")}disposeTemplate(n){n.keybinding.dispose(),n.elementDisposables.dispose()}};Ef=e_([hs(10,ge),hs(11,Xr)],Ef);class kf extends UIEvent{constructor(){super("acceptSelectedAction")}}class Bf extends UIEvent{constructor(){super("previewSelectedAction")}}function OD(u){if(u.kind==="action")return u.label;return}var Xf=Lf=class u extends i{constructor(n,h,g,p,f,b,S,w,x){super();if(this._supportsPreview=h,this._delegate=p,this._options=b,this._keybindingService=S,this._openerService=w,this._instantiationService=x,this._headerLineHeight=24,this._separatorLineHeight=8,this.cts=this._register(new Je),this._submenuDisposables=this._register(new d),this._submenuHoverActionElements=[],this._itemMoveAnimation=this._register(new de),this._collapsedSections=new Set,this._filterText="",this._imeSessionInProgress=!1,this._isMeasuringWidth=!1,this._suppressHover=!1,this._hoverEnabled=!0,this._ignoreInitialHover=!0,this._hasLaidOut=!1,this._filterCts=this._register(new de),this._groupTitleByIndex=new Map,this._standaloneToggles=new Map,this._itemToolbars=new Map,this._onDidRequestLayout=this._register(new r),this.onDidRequestLayout=this._onDidRequestLayout.event,this._visibleMenuItems=g,this._initialFocusItemId=this._options?.initialFocusItemId,this._filterText=this._options?.showFilter?this._options.initialFilterValue??"":"",this.domNode=document.createElement("div"),this.domNode.classList.add("actionList"),this._options?.inlineDescription)this.domNode.classList.add("inline-description");if(this._options?.className){let X=this._options.className.split(/\s+/).filter((J)=>J.length>0);if(X.length>0)this.domNode.classList.add(...X)}if(this._actionLineHeight=24,this._submenuContainer=document.createElement("div"),this._submenuContainer.className="action-list-submenu-panel action-widget",this._submenuContainer.style.display="none",this._options?.persistentHover)this._submenuContainer.style.boxSizing="border-box";if(this._submenuContainer.tabIndex=-1,this.domNode.append(this._submenuContainer),this._register(c(this._submenuContainer,"keydown",(X)=>{if((X.key==="Enter"||X.key===" ")&&this._currentSubmenuElement?.hover?.tabThroughPanel){let Q=Le(X.target)?X.target:void 0;if(Q&&this._currentSubmenuElement.hover.getTabbableElements?.().includes(Q)){X.stopPropagation();return}}if(X.key!=="ArrowLeft"&&X.key!=="Escape")return;Ee.stop(X,!0);let J=X.key==="Escape"&&this._currentSubmenuWidget!==void 0;if(this._hideSubmenu(),J){this.hide();return}this._setKeyboardNavigation(!0),this._list.domFocus()})),this._register(c(this._submenuContainer,"mouseenter",()=>{if(this._cancelSubmenuHide(),this._usesSubmenuPointerIntent())this._cancelSubmenuShow(),this._resetSubmenuPointer()})),this._register(c(this._submenuContainer,"mouseleave",()=>{this._scheduleSubmenuHide()})),this._register(c(this.domNode,T.MOUSE_LEAVE,()=>{this._cancelSubmenuShow(),this._resetSubmenuPointer()})),this._usesSubmenuPointerIntent())this._register(c(this.domNode,T.MOUSE_MOVE,(X)=>{if(Le(X.target)&&this._expandedTrigger?.contains(X.target))this._updateSubmenuPointer(X)}));if(this._register(D(()=>{this._cancelSubmenuHide(),this._cancelSubmenuShow()})),this._options?.collapsedByDefault)for(let X of this._options.collapsedByDefault)this._collapsedSections.add(X);let I={getHeight:(X)=>this._getItemHeight(X),getTemplateId:(X)=>X.kind},E=()=>{let X=this._options?.reserveSubmenuSpace??!0;return X==="always"||X&&this._allMenuItems.some(CC)};this._list=this._register(new kr(n,this.domNode,I,[new Ef(this._supportsPreview,(X)=>this._removeItem(X),(X)=>this._showSubmenuForItem(X),E,this._groupTitleByIndex,this._options?.linkHandler,this._options?.hideDefaultKeybindingTooltip??!1,this._options?.stopToolbarPointerPropagation??!1,(X,J)=>(this._standaloneToggles.set(X,J),D(()=>{if(this._standaloneToggles.get(X)===J)this._standaloneToggles.delete(X)})),(X,J)=>(this._itemToolbars.set(X,J),this._updateToolbarFocusability(),D(()=>{if(this._itemToolbars.get(X)===J)this._itemToolbars.delete(X)})),this._keybindingService,this._openerService),new vC,new SC],{keyboardSupport:!1,typeNavigationEnabled:!this._options?.showFilter&&!this._options?.onType,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:OD},accessibilityProvider:{getAriaLabel:(X)=>{if(X.kind==="action"){let J=X.label?ko(X?.label):"";if(X.badge)J=J+", "+ko(X.badge);if(X.detail)J=J+", "+ko(X.detail);if(X.ariaDescription)J=J+", "+ko(X.ariaDescription);else if(X.description){let te=typeof X.description==="string"?X.description:X.description.value;J=J+", "+ko(te)}if(X.hover?.content&&!X.ariaDescription&&!X.description){let te=X.hover.content,re=typeof te==="string"?te:jo(te)?te.value:Le(te)?te.textContent??void 0:void 0;if(re&&(!X.detail||ko(X.detail)!==ko(re)))J=J+", "+ko(re)}if(X.group?.title)J=J+", "+X.group.title;let Q=X.standaloneToggle??X.inlineToggle;if(Q)J=X.standaloneToggle?Q.checked?e(1734,"{0}, on",Q.label):e(1735,"{0}, off",Q.label):J+", "+(Q.checked?e(1736,"{0}, on",Q.label):e(1737,"{0}, off",Q.label));if(X.disabled)J=e(1738,"{0}, Disabled Reason: {1}",J,X.disabled);if(X.submenuActions?.length)J=e(1739,"{0}, use right arrow to access options",J);return J}return null},getWidgetAriaLabel:()=>e(1740,"Action Widget"),getSetSize:()=>this._visibleMenuItems.filter((X)=>X.kind==="action").length,getPosInSet:(X,J)=>Math.max(this._visibleMenuItems.slice(0,J+1).filter((Q)=>Q.kind==="action").length,1),getRole:(X)=>{switch(X.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...f}})),this._list.style(em),this._register(this._list.onKeyDown(()=>this._setKeyboardNavigation(!0))),this._register(c(this._list.getHTMLElement(),T.MOUSE_MOVE,(X)=>{if(X.movementX!==0||X.movementY!==0)this._setKeyboardNavigation(!1)})),this._register(this._list.onMouseClick((X)=>this.onListClick(X))),this._register(this._list.onMouseOver((X)=>{if(!this._ignoreInitialHover)this.onListHover(X)}));let Z=this._register(new de);if(Z.value=this._list.onMouseMove((X)=>{if(X.browserEvent.movementX!==0||X.browserEvent.movementY!==0)Z.clear(),this._ignoreInitialHover=!1,this.onListHover(X)}),this._register(this._list.onMouseDown(()=>{Z.clear(),this._ignoreInitialHover=!1,this._setKeyboardNavigation(!1)})),this._register(this._list.onDidChangeFocus(()=>{this._updateToolbarFocusability(),this.onFocus()})),this._register(this._list.onDidChangeSelection((X)=>this.onListSelection(X))),this._register(this._list.onDidScroll(()=>{if(!this._isMeasuringWidth)this._layoutSubmenu?.()})),this._allMenuItems=[...g],this._options?.showFilter||this._options?.secondaryHeading){this._filterContainer=document.createElement("div"),this._filterContainer.className="action-list-filter";let X=k(this._filterContainer,_(".action-list-filter-row"));if(this._options?.showFilter){if(this._filterInput=document.createElement("input"),this._filterInput.type="text",this._filterInput.className="action-list-filter-input",this._filterInput.placeholder=this._options?.filterPlaceholder??e(1741,"Search..."),this._filterInput.value=this._filterText,this._filterInput.setAttribute("aria-label",e(1742,"Filter items")),X.appendChild(this._filterInput),this._register(c(this._filterInput,T.KEY_DOWN,(te)=>{if(this._setKeyboardNavigation(!0),te.isComposing||!this._filterInput?.closest(".action-list-submenu-panel"))return;let re=this._keybindingService.softDispatch(new Qe(te),this._filterInput);if(re.kind===2&&re.commandId!==null&&TD.has(re.commandId)||te.key.length===1&&!te.ctrlKey&&!te.metaKey&&!te.altKey)te.stopPropagation()})),this._register(c(this._filterInput,T.MOUSE_DOWN,()=>this._setKeyboardNavigation(!1))),this._options.tabThroughItemActions)this._register(c(this._filterInput,"keydown",(te)=>this._handleTabThroughPanelKeyDown(te),!0));if(this._options.filterAsCombobox){let te=this._list.getHTMLElement();te.id=this._list.domId,this._filterInput.setAttribute("role","combobox"),this._filterInput.setAttribute("aria-label",this._filterInput.placeholder),this._filterInput.setAttribute("aria-autocomplete","list"),this._filterInput.setAttribute("aria-expanded","true"),this._filterInput.setAttribute("aria-controls",te.id),this._register(this._list.onDidChangeFocus(()=>this._updateFilterActiveDescendant())),this._register(c(this._filterInput,"focus",()=>this._updateFilterActiveDescendant())),this._register(c(this._filterInput,"blur",()=>this._updateFilterActiveDescendant())),this._register(Ct(this._filterInput,"keydown",(re)=>{if(this._imeSessionInProgress||re.browserEvent.isComposing||re.keyCode===114||re.keyCode===15||re.keyCode===17||re.keyCode===14||re.keyCode===13){re.stopPropagation();return}let pe=re.keyCode===16||re.keyCode===18;if(!pe&&re.keyCode!==3)return;if(re.ctrlKey||re.metaKey||re.altKey||re.shiftKey){if(pe)re.stopPropagation();return}if(Ee.stop(re,!0),re.keyCode===16)this.focusPrevious();else if(re.keyCode===18)this.focusNext();else this.acceptSelected()}))}let J=this._options?.filterActions??[];if(J.length>0){let te=k(X,_(".action-list-filter-actions"));this._register(new er(te)).push(J,{icon:!0,label:!1})}let Q=()=>{let te=this._filterInput.value;if(this._imeSessionInProgress||te===this._filterText&&!this._filterCts.value?.token.isCancellationRequested)return;this._filterText=te,this._applyOrUpdateFilter()};this._register(c(this._filterInput,"compositionstart",()=>{this._imeSessionInProgress=!0,this._filterCts.value?.cancel()})),this._register(c(this._filterInput,"compositionend",()=>{this._imeSessionInProgress=!1,Q()})),this._register(c(this._filterInput,"input",Q))}if(this._options?.secondaryHeading){let J=k(X,_(".action-list-filter-label"));J.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;if(this._options?.headerText){if(this._headerContainer=document.createElement("div"),this._headerContainer.className="action-list-header",this._options.headerIcon){let J=k(this._headerContainer,_("span.action-list-header-icon"));J.classList.add(...Y.asClassNameArray(this._options.headerIcon)),J.setAttribute("aria-hidden","true")}let X=k(this._headerContainer,_("span.action-list-header-text"));if(X.textContent=this._options.headerText,this._register(c(this._headerContainer,T.MOUSE_ENTER,()=>{if(this._options?.persistentHover)this._cancelSubmenuShow(),this._resetSubmenuPointer();else this._hideSubmenu()})),this._options.headerLink){let{label:J,uri:Q}=this._options.headerLink;X.textContent+=" ",this._register(this._instantiationService.createInstance(Pd,X,{label:J,href:Q.toString(!0)},{}))}if(this._options.headerDismiss){let J=this._options.headerDismiss,Q=k(this._headerContainer,_("span.action-list-header-dismiss"));Q.appendChild(_(Y.asCSSSelector(C.close))),Q.tabIndex=0,Q.setAttribute("role","button"),Q.setAttribute("aria-label",e(1743,"Dismiss"));let te=()=>{J(),this.focus(),this._headerContainer?.remove(),this._headerContainer=void 0,this._onDidRequestLayout.fire()};this._register(e0(Q,()=>te())),this._register(c(Q,T.KEY_DOWN,(re)=>{if(re.key==="Enter"||re.key===" ")re.preventDefault(),te()}))}}if(this._applyFilter(),this._list.length)this._focusCheckedOrFirst();if(this._register(c(this.domNode,"keydown",(X)=>{if(X.key==="ArrowRight"&&!X.isComposing){let J=this._list.getFocus();if(J.length>0){let Q=this._list.element(J[0]);if(Q?.submenuActions?.length||Q?.hover?.expandable){Ee.stop(X,!0);let te=this._getRowElement(J[0]);if(te)if(this._showSubmenuForElement(Q,te),Q.hover?.tabThroughPanel)this._focusFirstTabThroughPanelControl(Q,te);else if(this._currentSubmenuWidget)this._currentSubmenuWidget.focus();else this._submenuContainer.focus()}}}})),this._register(c(this.domNode,"keydown",(X)=>this._handleTabThroughPanelKeyDown(X),!0)),this._filterInput||this._options?.onType)this._register(c(this.domNode,"keydown",(X)=>{let J=X.target;if((this._options?.onType||this._options?.filterAsCombobox)&&Le(J)&&(Qo(J)||J.closest('button, a, [contenteditable="true"], .action-list-submenu-panel')))return;if((!this._filterInput||!Ws(this._filterInput))&&!X.isComposing&&X.key.length===1&&X.key!==" "&&!X.ctrlKey&&!X.metaKey&&!X.altKey)if(X.preventDefault(),X.stopPropagation(),this._filterInput)this._filterInput.focus(),this._filterInput.value=X.key,this._filterText=X.key,this._applyOrUpdateFilter();else this._options?.onType?.(X.key)}))}_toggleSection(n){let h=this._collapsedSections.has(n);if(h)this._collapsedSections.delete(n);else{this._collapsedSections.add(n);let g=this.getFocusedElement();if(g?.section===n&&!g.isSectionToggle){let p=this._visibleMenuItems.findIndex((f)=>f.section===n&&f.isSectionToggle);if(p>=0)this._list.setFocus([p])}}if(this._options?.onDidToggleSection?.(n,this._collapsedSections.has(n)),this._applyFilter(),h)this._revealFirstItemOfSection(n)}_revealFirstItemOfSection(n){for(let h=0;h<this._list.length;h++){let g=this._list.element(h);if(g.section===n&&!g.isSectionToggle){this._list.reveal(h);return}}}_applyOrUpdateFilter(){if(!this._delegate.onFilter){this._applyFilter();return}let n=this._filterText;this._filterCts.value?.cancel();let h=new Je;this._filterCts.value=h,this._delegate.onFilter(n,h.token).then((g)=>{if(h.token.isCancellationRequested)return;this._allMenuItems=[...g],this._applyFilter(!0)}).catch(()=>{}).finally(()=>{if(this._filterCts.value===h&&!h.token.isCancellationRequested)this._filterCts.clear()})}_applyFilter(n=!1,h=!0,g){this._itemMoveAnimation.clear();let p=n?"":this._filterText.toLowerCase(),f=!n&&p.length>0,b=[],S=this._list.getFocus(),w;if(S.length>0)w=this._list.element(S[0]);if(f){let Q,te=[],re=!1,le=()=>{if(Q&&re)b.push(Q);b.push(...te),Q=void 0,te=[],re=!1},pe=(Se)=>{let we=(Se.label??"").toLowerCase(),ae=typeof Se.description==="string"?Se.description:Se.description?.value??"";return we.includes(p)||ae.toLowerCase().includes(p)};for(let Se of this._allMenuItems){if(Se.kind==="header")continue;if(Se.kind==="separator"){le(),Q=Se.label?Se:void 0;continue}if(Se.showAlways){te.push(Se);continue}if(Se.isSectionToggle)continue;if(Se.filterItems){let we=pe(Se)?Se.filterItems:Se.filterItems.filter(pe);if(we.length>0)re=!0,te.push(...we);continue}if(pe(Se))re=!0,te.push(Se)}le()}else for(let Q of this._allMenuItems){if(Q.kind==="header"){b.push(Q);continue}if(Q.kind==="separator"){if(Q.section&&this._collapsedSections.has(Q.section))continue;b.push(Q);continue}if(Q.isSectionToggle&&Q.section){let te=this._collapsedSections.has(Q.section);b.push({...Q,group:{...Q.group,icon:te?C.chevronRight:C.chevronDown}});continue}if(Q.section&&this._collapsedSections.has(Q.section))continue;b.push(Q)}let x=[],I=!1;for(let Q=0;Q<b.length;Q++)if(x[Q]=I,b[Q].kind==="action")I=!0;let E=[],Z=!1;for(let Q=b.length-1;Q>=0;Q--){if(b[Q].kind==="action"){Z=!0;continue}if(b[Q].kind!=="separator")continue;E[Q]=Z,Z=!1}for(let Q=b.length-1;Q>=0;Q--){let te=b[Q];if(te.kind!=="separator")continue;let re=E[Q],le=!te.label&&!x[Q];if(!re||le)b.splice(Q,1)}if(this._options?.showGroupTitleOnFirstItem)this._recomputeGroupTitles(b);let X=this._filterInput&&Ws(this._filterInput),J=mu(this._list.getHTMLElement());if(this._visibleMenuItems=b,this._list.splice(0,this._list.length,b),h)this._onDidRequestLayout.fire();if(X)this._filterInput?.focus(),this._focusCheckedOrFirst();else if(this._hasLaidOut){if(w||g){let Q=g??w?.item?.id;if(Q){for(let te=0;te<this._list.length;te++)if(this._list.element(te).item?.id===Q){this._list.setFocus([te]),this._list.reveal(te);break}if(J)this._focusCheckedOrFirst(),this._list.domFocus()}}}}get filterContainer(){return this._filterContainer}get footerContainer(){return this._footerContainer}get headerContainer(){return this._headerContainer}get filterInput(){return this._filterInput}get closeAnimation(){return this._options?.closeAnimation}focusCondition(n){return!n.disabled&&n.kind==="action"}_setKeyboardNavigation(n){if(this._keyboardNavigation===n)return;this._keyboardNavigation=n;let h=this._list.getHTMLElement();h.classList.toggle("keyboard-navigation",n===!0),h.classList.toggle("mouse-navigation",n===!1)}_updateFilterActiveDescendant(){if(!this._filterInput)return;let[n]=this._list.getFocus();if(Ws(this._filterInput)&&n!==void 0)this._filterInput.setAttribute("aria-activedescendant",this._list.getElementID(n));else this._filterInput.removeAttribute("aria-activedescendant")}focus(){if(this._setKeyboardNavigation(void 0),this._filterInput&&this._options?.focusFilterOnOpen){this._filterInput.focus(),this._focusCheckedOrFirst();return}this._list.domFocus(),this._focusCheckedOrFirst(),this._showTabThroughPanelForFocusedItem()}clearFocus(){this._list.setFocus([])}getFocusedElement(){let n=this._list.getFocus();if(n.length>0)return this._list.element(n[0]);return}_updateToolbarFocusability(){if(!this._options?.tabThroughItemActions)return;let[n]=this._list.getFocus(),h=n!==void 0&&n<this._list.length?this._list.element(n):void 0;for(let[g,p]of this._itemToolbars)p.setFocusable(g===h)}_focusCheckedOrFirst(){let n=this._suppressHover;this._suppressHover=!0;try{let h=this._initialFocusItemId;if(this._initialFocusItemId=void 0,h)for(let f=0;f<this._list.length;f++){let b=this._list.element(f);if(this.focusCondition(b)&&b.item?.id===h){this._list.setFocus([f]),this._list.reveal(f);return}}let[g]=this._list.getFocus();if(g!==void 0){let f=this._list.element(g);if(f&&this.focusCondition(f)){this._list.reveal(g);return}}for(let f=0;f<this._list.length;f++){let b=this._list.element(f);if(this.focusCondition(b)&&b.item?.checked){this._list.setFocus([f]),this._list.reveal(f);return}}this._list.focusFirst(void 0,this.focusCondition);let p=this._list.getFocus();if(p.length>0)this._list.reveal(p[0])}finally{if(this._suppressHover=n,this._options?.filterAsCombobox)this._updateFilterActiveDescendant()}}hide(n){this._delegate.onHide(n),this.cts.cancel(),this._filterCts.value?.cancel(),this._filterCts.clear(),this._hideSubmenu()}clearFilter(){if(this._filterInput&&this._filterText)return this._filterInput.value="",this._filterText="",this._applyOrUpdateFilter(),!0;return!1}get hasDynamicHeight(){if(this._options?.showFilter)return!0;return this._allMenuItems.some((n)=>n.isSectionToggle)}get lineHeight(){return this._actionLineHeight}_getItemHeight(n){return this._itemHeightWith(n,this._options)}_itemHeightWith(n,h){switch(n.kind){case"header":return this._headerLineHeight;case"separator":return n.label?this._actionLineHeight:this._separatorLineHeight;default:if(n.inlineToggle)return h?.inlineToggleItemHeight??70;return n.detail?h?.detailItemHeight??48:this._actionLineHeight}}computeFullHeight(){return this.computeHeightForItems(this._allMenuItems,void 0,this._options)}computeHeightForItems(n,h,g){let p=0;for(let f of n){if(h&&f.section&&!f.isSectionToggle&&h.has(f.section))continue;p+=this._itemHeightWith(f,g)}return p}computeListHeight(){let n=this._list.length,h=0;for(let g=0;g<n;g++){let p=this._list.element(g);h+=this._getItemHeight(p)}return h}layout(n,h){this._hasLaidOut=!0,this._list.layout(n,h),this.domNode.style.height=`${n}px`;let g=this.domNode.parentElement;if(g&&this._filterContainer?.parentElement===g)g.insertBefore(this._filterContainer,this.domNode);this._layoutSubmenu?.()}computeMaxWidth(n){let h=this._list.length,g=Math.max(n,this._options?.minWidth??0),p=this._options?.maxWidth??Number.POSITIVE_INFINITY,f=Math.max(p,g),b=(I)=>Math.min(Math.max(I,g),f),S=this._allMenuItems.length;if(S>=50)return b(380);if(S>h){let I=[];for(let Q=0;Q<h;Q++)I.push(this._list.element(Q));let E=this._list.renderHeight,Z=this._list.scrollTop,X=this._list.getFocus(),J=this._isMeasuringWidth;this._isMeasuringWidth=!0;try{let Q=[...this._allMenuItems];this._list.splice(0,h,Q);let te=0;for(let le of Q)te+=this._getItemHeight(le);this._list.layout(te);let re=this._measureItemWidths(Q);return b(Math.max(...re))}finally{try{this._list.splice(0,this._list.length,I),this._list.layout(E),this._list.scrollTop=Z;let Q=this._suppressHover;this._suppressHover=!0;try{this._list.setFocus(X)}finally{this._suppressHover=Q}}finally{this._isMeasuringWidth=J}}}let w=[];for(let I=0;I<h;I++)w.push(this._list.element(I));let x=this._measureItemWidths(w);return b(Math.max(...x))}focusPrevious(){if(this._setKeyboardNavigation(!0),this._focusFilterResult("previous"))return;if(this._filterInput&&Ws(this._filterInput)){this._list.domFocus();let g=this._list.getFocus();if(g.length>0){this._list.focusPrevious(1,!1,void 0,this.focusCondition);let p=this._list.getFocus();if(p.length>0&&p[0]>=g[0])this._filterInput.focus();else if(p.length>0)this._list.reveal(p[0])}else{this._list.focusLast(void 0,this.focusCondition);let p=this._list.getFocus();if(p.length>0)this._list.reveal(p[0])}return}let n=this._list.getFocus();this._list.focusPrevious(1,!0,void 0,this.focusCondition);let h=this._list.getFocus();if(h.length>0){if(this._filterInput&&n.length>0&&h[0]>n[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(h[0])}}focusNext(){if(this._setKeyboardNavigation(!0),this._focusFilterResult("next"))return;if(this._filterInput&&Ws(this._filterInput)){if(this._list.domFocus(),this._list.getFocus().length>0){this._list.focusNext(1,!1,void 0,this.focusCondition);let p=this._list.getFocus();if(p.length>0)this._list.reveal(p[0])}else{this._list.focusFirst(void 0,this.focusCondition);let p=this._list.getFocus();if(p.length>0)this._list.reveal(p[0])}return}let n=this._list.getFocus();this._list.focusNext(1,!0,void 0,this.focusCondition);let h=this._list.getFocus();if(h.length>0){if(this._filterInput&&n.length>0&&h[0]<n[0]){this._list.setFocus([]),this._filterInput.focus();return}this._list.reveal(h[0])}}_focusFilterResult(n){if(!this._options?.filterAsCombobox||!this._filterInput||!Ws(this._filterInput))return!1;if(n==="previous")this._list.focusPrevious(1,!0,void 0,this.focusCondition);else this._list.focusNext(1,!0,void 0,this.focusCondition);let[h]=this._list.getFocus();if(h!==void 0)this._list.reveal(h);return!0}collapseFocusedSection(){let n=this._getFocusedSection();if(n&&!this._collapsedSections.has(n))this._toggleSection(n)}expandFocusedSection(){let n=this._getFocusedSection();if(n&&this._collapsedSections.has(n))this._toggleSection(n)}toggleFocusedSection(){let n=this._list.getFocus();if(n.length===0)return!1;let h=this._list.element(n[0]);if(h.isSectionToggle&&h.section)return this._toggleSection(h.section),!0;return!1}_getFocusedSection(){let n=this._list.getFocus();if(n.length===0)return;let h=this._list.element(n[0]);if(h.isSectionToggle&&h.section)return h.section;return h.section}acceptSelected(n){let h=this._list.getFocus();if(h.length===0)return;let g=h[0],p=this._list.element(g);if(!this.focusCondition(p))return;let f=n?new Bf:new kf;this._list.setSelection([g],f)}onListSelection(n){if(!n.elements.length)return;let h=n.elements[0];if(h.standaloneToggle){this._list.setSelection([]);let p=this._standaloneToggles.get(h);if(p&&!p.disabled)p.checked=!p.checked,h.standaloneToggle.onChange(p.checked);return}if(h.isSectionToggle&&h.section){this._list.setSelection([]);let p=h.section;queueMicrotask(()=>{this._toggleSection(p)});return}let g=Nf(n.browserEvent)||n.browserEvent?.type===Lt.Tap;if(g){let p=n.browserEvent.target;if(Le(p)&&(p.closest(".action-list-item-toolbar")||p.closest(".action-list-submenu-indicator")||p.closest(".action-list-item-inline-toggle"))){this._list.setSelection([]);return}}if(h.openSubmenuOnClick&&h.submenuActions?.length&&(g||n.browserEvent instanceof kf)){if(this._list.setSelection([]),this._showSubmenuForItem(h),!g)this._currentSubmenuWidget?.focus();return}if(h.item&&this.focusCondition(h)){let p=n.browserEvent instanceof Bf;this._delegate.onSelect(h.item,p&&this._supportsPreview)}else this._list.setSelection([])}onFocus(){let n=this._list.getFocus();if(n.length===0)return;let h=n[0],g=this._list.element(h);if(this._delegate.onFocus?.(g.item),!this._suppressHover){if(this._options?.persistentHover)this._cancelSubmenuShow(),this._resetSubmenuPointer(),this._list.reveal(h);this._showHoverForElement(g,h)}}_removeItem(n){let h=this._allMenuItems.indexOf(n);if(h>=0)this._allMenuItems.splice(h,1),this._applyFilter()}_recomputeGroupTitles(n){this._groupTitleByIndex.clear();let h=new Set;for(let g=0;g<n.length;g++){let p=n[g];if(p.kind==="action"&&p.group?.title&&!h.has(p.group.title))h.add(p.group.title),this._groupTitleByIndex.set(g,p.group.title)}}_measureItemWidths(n){let h=[];for(let g=0;g<n.length;g++){let p=this._getRowElement(g);if(p)p.style.width="auto",h.push({element:p,item:n[g]})}try{return h.map(({element:g,item:p})=>g.getBoundingClientRect().width+(p.detail?0:this._computeToolbarWidth(p)))}finally{for(let{element:g}of h)g.style.width=""}}_computeToolbarWidth(n){let h=n.toolbarActions?.length??0;if(n.onRemove)h++;if(h===0)return 0;return h*22+6+10}_getRowElement(n){if(n<0)return null;return this.domNode.ownerDocument.getElementById(this._list.getElementID(n))}_showTabThroughPanelForFocusedItem(){let n=this._list.getFocus();if(n.length===0)return;let h=n[0],g=this._list.element(h);if(!g.hover?.tabThroughPanel)return;let p=this._getRowElement(h);if(p)this._showSubmenuForElement(g,p)}_getTabThroughPanelControls(n,h){if(n.hover?.tabThroughPanel&&this._currentSubmenuElement!==n)this._showSubmenuForElement(n,h);return{toolbar:this._itemToolbars.get(n),panelControls:[...n.hover?.getTabbableElements?.()??[],...this._submenuHoverActionElements]}}_focusFirstTabThroughPanelControl(n,h){let g=this._getTabThroughPanelControls(n,h);if(g.toolbar?.length())g.toolbar.focus(0);else(g.panelControls[0]??this._list.getHTMLElement()).focus()}_handleTabThroughPanelKeyDown(n){if(n.isComposing)return;let h=this._list.getFocus();if(h.length===0)return;let g=h[0],p=this._list.element(g);if(!p.hover?.tabThroughPanel&&!this._options?.tabThroughItemActions)return;let f=this._getRowElement(g),b=At();if(!f||!Le(b))return;let S=this._getTabThroughPanelControls(p,f),w=S.toolbar?.isFocused()??!1,x=this._submenuContainer.contains(b);if((n.key==="ArrowUp"||n.key==="ArrowDown")&&(w||x)){if(Ee.stop(n,!0),this._list.domFocus(),n.key==="ArrowUp")this.focusPrevious();else this.focusNext();return}if(n.key!=="Tab"||n.ctrlKey||n.metaKey||n.altKey)return;let I;if(n.shiftKey){if(x){let E=S.panelControls.indexOf(b);if(E>0)I=S.panelControls[E-1];else if(S.toolbar?.length()){Ee.stop(n,!0),S.toolbar.focus(S.toolbar.length()-1);return}else I=this._list.getHTMLElement()}else if(S.toolbar?.isFocused()){let E=S.toolbar.viewItems.findIndex((Z,X)=>S.toolbar?.isFocused(X));if(E>0){Ee.stop(n,!0),S.toolbar.focus(E-1);return}I=this._options?.filterAsCombobox?this._filterInput:this._list.getHTMLElement()}}else if(b===this._list.getHTMLElement()||b===this._filterInput){if(S.toolbar?.length()){Ee.stop(n,!0),S.toolbar.focus(0);return}I=S.panelControls[0]}else if(S.toolbar?.isFocused()){let E=S.toolbar.viewItems.findIndex((Z,X)=>S.toolbar?.isFocused(X));if(E+1<S.toolbar.length()){Ee.stop(n,!0),S.toolbar.focus(E+1);return}I=S.panelControls[0]}else{let E=S.panelControls.indexOf(b);if(E>=0)I=S.panelControls[E+1]??this._list.getHTMLElement()}if(I)Ee.stop(n,!0),I.focus()}_showHoverForElement(n,h){if(this._currentSubmenuElement===n)return;let g=!!n.hover?.content,p=!!n.submenuActions?.length;if(g||p){let f=this._getRowElement(h);if(f)this._showSubmenuForElement(n,f);return}if(!this._options?.persistentHover)this._hideSubmenu()}_showSubmenuForItem(n){let h=this._list.indexOf(n);if(h>=0){let g=this._getRowElement(h);if(g)this._showSubmenuForElement(n,g)}}_showSubmenuForElement(n,h){if(!this._hoverEnabled||this._currentSubmenuElement===n)return;if(this._currentSubmenuElement=n,this._clearSubmenuContainer(),h.setAttribute("aria-expanded","true"),this._expandedTrigger=h,this._submenuPanelClassName=n.hover?.panelClassName,this._submenuPanelClassName)this._submenuContainer.classList.add(this._submenuPanelClassName);let g=n.hover?.preserveVerticalPosition,p=!!n.submenuActions?.length,f=g?_(".action-list-submenu-content"):this._submenuContainer,b=g?_(".action-list-submenu-viewport",void 0,f):void 0,S=b&&!p?this._submenuDisposables.add(new Fl(b,{horizontal:2,vertical:1,consumeMouseWheelIfScrollbarIsNeeded:!0,useShadows:!1})):void 0;if(S&&b)this._submenuContainer.appendChild(S.getDomNode()),this._submenuDisposables.add(c(b,T.SCROLL,()=>S.scanDomNode())),this._submenuDisposables.add(c(this._submenuContainer,T.KEY_DOWN,(re)=>{let le=new Qe(re);if(le.equals(12)||le.equals(11))Ee.stop(re,!0),S.setScrollPosition({scrollTop:S.getScrollPosition().scrollTop+(le.equals(12)?1:-1)*b.clientHeight})}));else if(b)this._submenuContainer.appendChild(b);let w,x=typeof n.hover?.content==="function"?n.hover.content():n.hover?.content;if(x){if(Le(x)){if(w=x,n.hover?.disposable)this._register(n.hover.disposable)}else{let re=typeof x==="string"?new Pn(x):x,le=this._options?.linkHandler,pe=Hl(re,{actionHandler:(Se)=>{let we=q.parse(Se);if(le)le(we,n);else this._openerService.open(we,{allowCommands:!0})}});this._submenuDisposables.add(pe),w=pe.element}if(w.classList.add("action-list-submenu-hover-header"),w.classList.toggle("content-owns-padding",n.hover?.contentOwnsPadding===!0),n.submenuActions?.length)w.classList.add("has-submenu");f.appendChild(w)}if(n.hover?.actions?.length){let re=_(".hover-row.status-bar"),le=k(re,_(".actions"));for(let pe of n.hover.actions){let Se=this._keybindingService.lookupKeybinding(pe.commandId),we=this._submenuDisposables.add(Zf.render(le,{label:pe.label,commandId:pe.commandId,run:(ae)=>pe.run(ae),iconClass:pe.iconClass},Se?.getLabel()??null));this._submenuHoverActionElements.push(we.actionContainer)}this._submenuContainer.appendChild(re)}if(this._submenuContainer.style.display="",this._submenuContainer.style.position="absolute",n.hover?.expandable){if(this._submenuContainer.setAttribute("role","dialog"),n.label)this._submenuContainer.setAttribute("aria-label",n.label)}else this._submenuContainer.removeAttribute("role");let I=B(this.domNode),E=0,Z=w?w.offsetWidth:0,X;if(p){let re=this._createSubmenuItems(n.submenuActions),le={onHide:()=>{},onSelect:(we)=>{we.run();let ae=this._currentSubmenuElement?.item;if(this._hideSubmenu(),ae)this._delegate.onSelect(ae);this.hide()}},pe=this._submenuDisposables.add(this._instantiationService.createInstance(Lf,"submenu",!1,re,le,void 0,n.submenuOptions));if(X=pe,pe.headerContainer)f.appendChild(pe.headerContainer);if(pe.filterContainer)f.appendChild(pe.filterContainer);if(f.appendChild(pe.domNode),pe.footerContainer)f.appendChild(pe.footerContainer);this._currentSubmenuWidget=pe,pe.clearFocus(),E=pe.computeListHeight(),pe.layout(E);let Se=pe.computeMaxWidth(0);if(Z=Math.max(Z,Se,pe.footerContainer?.offsetWidth??0),pe.layout(E,Z),pe.domNode.style.width=`${Z}px`,n.submenuOptions)this._submenuContainer.style.boxSizing="border-box",this._submenuContainer.style.width=`${Z+10}px`;this._submenuDisposables.add(pe.onDidRequestLayout(()=>{E=pe.computeListHeight(),pe.layout(E,Z),this._layoutSubmenu?.()})),this._submenuDisposables.add(c(f,"keydown",(we)=>{if(we.key==="Escape")Ee.stop(we,!0),this._hideSubmenu(),this.hide();else if(we.key==="ArrowLeft")Ee.stop(we,!0),this._hideSubmenu(),this._setKeyboardNavigation(!0),this._list.domFocus();else if(we.key==="Enter"||we.key===" ")Ee.stop(we,!0),pe.acceptSelected();else if(we.key==="ArrowDown")Ee.stop(we,!0),pe.focusNext();else if(we.key==="ArrowUp")Ee.stop(we,!0),pe.focusPrevious()}))}let J,Q,te=()=>{let re=this._currentSubmenuElement;if(!re||this._layoutSubmenu!==te)return;let le=this._list.indexOf(re),pe=le>=0?this._getRowElement(le):null,Se=this._options?.persistentHover;if(!pe&&(!Se||!this._allMenuItems.includes(re))){this._hideSubmenu();return}if(this._expandedTrigger!==pe){if(this._expandedTrigger?.hasAttribute("aria-expanded"))this._expandedTrigger.setAttribute("aria-expanded","false");this._expandedTrigger=pe??void 0}pe?.setAttribute("aria-expanded","true");let we=this.domNode.getBoundingClientRect(),ae=Se||re.hover?.alignToParent,me=ae?this.domNode.parentElement?.closest(".action-widget")?.getBoundingClientRect()??we:we,De=pe?.getBoundingClientRect()??me,Oe=ae||g?Sv(this.domNode):1;if(Se)this._submenuContainer.style.width=`${me.width/Oe}px`;let Me=this._submenuContainer.getBoundingClientRect(),Ce=ae?Me.width:Z+10,Pe=I.innerWidth-(ae?me.right:De.right),tt=me.left,ze=ae?0:4,rt=4;if(!ae){let Vt=I.innerWidth-2*rt;if(Ce>Vt)Ce=Math.max(Vt,0);this._submenuContainer.style.boxSizing="border-box",this._submenuContainer.style.width=`${Ce}px`}let qe=Pe>=Ce||Pe>=tt;if(Se&&this._submenuSide&&(this._submenuSide==="right"?Pe:tt)>=Ce)qe=this._submenuSide==="right";if(Se)this._submenuSide=qe?"right":"left";let Ft=qe?me.right-we.left+ze:me.left-we.left-Ce-ze,it=we.left+Ft;if(it<rt)Ft+=rt-it;else if(it+Ce>I.innerWidth-rt)Ft-=it+Ce-(I.innerWidth-rt);this._submenuContainer.style.left=`${Ft/Oe}px`;let ft=Me.height;if(g)J??=ft/Oe;let Bt=J!==void 0?J*Oe:ft,yt=Q!==void 0?Q*Oe:pe&&re.hover?.alignToAnchorTop?De.top-we.top:pe?De.top-we.top+(De.height-Bt)/2:Me.top-we.top;if(g&&re.hover?.alignToAnchorTop&&b&&X){let Vt=Me.height-b.getBoundingClientRect().height,Wt=(X.headerContainer?.offsetHeight??0)+(X.filterContainer?.offsetHeight??0)+(X.footerContainer?.offsetHeight??0),Rt=Vt+(Wt+E)*Oe;yt=Math.min(yt,I.innerHeight-we.top-Rt-8)}let St=we.top+yt+Bt;if(St>I.innerHeight&&!(g&&re.hover?.alignToAnchorTop))yt-=St-I.innerHeight+8;if(we.top+yt<0)yt=-we.top;if(g)Q??=yt/Oe;if(b&&S){let Vt=(Me.height-S.getDomNode().getBoundingClientRect().height)/Oe,Wt=Math.max(0,(I.innerHeight-we.top-yt-8)/Oe-Vt);b.style.height=`${Math.min(f.getBoundingClientRect().height/Oe,Wt)}px`,S.scanDomNode()}else if(b&&X){let Vt=(Me.height-b.getBoundingClientRect().height)/Oe,Wt=Math.max(0,(I.innerHeight-we.top-yt-8)/Oe-Vt),Rt=(X.headerContainer?.offsetHeight??0)+(X.filterContainer?.offsetHeight??0)+(X.footerContainer?.offsetHeight??0),fi=E===0?0:Math.max(this._actionLineHeight,Math.min(E,Wt-Rt));X.layout(fi,Z),b.style.height=`${Rt+fi}px`}this._submenuContainer.style.top=`${yt/Oe}px`};if(this._layoutSubmenu=te,te(),(this._options?.persistentHover||n.hover?.alignToParent||n.hover?.tabThroughPanel||g)&&this._currentSubmenuElement===n){if(!X){let re=this._submenuDisposables.add(new de),le=this._submenuDisposables.add(new i0("ActionListWidget.hoverPanel",()=>{if(!re.value)re.value=ki(I,()=>{re.clear(),te()})},I));this._submenuDisposables.add(le.observe(g?f:this._submenuContainer,{box:"border-box"}))}if(this._options?.persistentHover||g)this._submenuDisposables.add(c(I,T.RESIZE,()=>{this._cancelSubmenuShow(),this._resetSubmenuPointer(),te()}))}}_createSubmenuItems(n){let h=[],p=n.filter((f)=>f instanceof ys).filter((f)=>f.actions.length>0);for(let f=0;f<p.length;f++){let b=p[f];if(b.label)h.push({kind:"header",group:{title:b.label},label:b.label});for(let S of b.actions){let w=S,x=w.icon??Y.fromId(S.checked?C.check.id:C.blank.id),I=w.hoverContent,E=I?new Pn().appendText(`${S.label}
|
|
3
|
+
`).appendMarkdown(I):void 0;h.push({item:S,kind:"action",label:S.label,description:S.tooltip&&S.tooltip!==S.label?S.tooltip:void 0,group:{title:"",icon:x},hideIcon:!1,hover:E?{content:E}:void 0,tooltip:S.tooltip||S.label,onRemove:w.onRemove,submenuActions:S instanceof ys?[new ys(S.id,"",S.actions)]:void 0})}if(f<p.length-1)h.push({kind:"separator",label:""})}for(let f of n)if(!(f instanceof ys)){let b=f,S=b.icon??Y.fromId(f.checked?C.check.id:C.blank.id),w=b.hoverContent,x=w?new Pn().appendText(`${f.label}
|
|
4
|
+
`).appendMarkdown(w):void 0;h.push({item:f,kind:"action",label:f.label,description:f.tooltip&&f.tooltip!==f.label?f.tooltip:void 0,group:{title:"",icon:S},hideIcon:!1,hover:x?{content:x}:void 0,tooltip:f.tooltip||f.label,onRemove:b.onRemove})}return h}_hideSubmenu(){this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._currentSubmenuElement=void 0,this._submenuSide=void 0,this._clearSubmenuContainer(),this._submenuContainer.style.display="none"}_clearSubmenuContainer(){if(this._layoutSubmenu=void 0,this._resetSubmenuPointer(),this._submenuContainer.contains(At()))this._list.domFocus();if(this._submenuDisposables.clear(),this._currentSubmenuWidget=void 0,this._submenuHoverActionElements=[],this._submenuPanelClassName)this._submenuContainer.classList.remove(this._submenuPanelClassName),this._submenuPanelClassName=void 0;if(this._submenuContainer.removeAttribute("role"),this._submenuContainer.removeAttribute("aria-label"),this._expandedTrigger?.hasAttribute("aria-expanded"))this._expandedTrigger.setAttribute("aria-expanded","false");this._expandedTrigger=void 0,mn(this._submenuContainer),this._submenuContainer.style.width="",this._submenuContainer.style.boxSizing=this._options?.persistentHover?"border-box":""}_scheduleSubmenuHide(){if(this._cancelSubmenuHide(),this._options?.persistentHover)return;this._submenuHideTimeout=setTimeout(()=>{this._hideSubmenu()},300)}_cancelSubmenuHide(){if(this._submenuHideTimeout!==void 0)clearTimeout(this._submenuHideTimeout),this._submenuHideTimeout=void 0}_scheduleSubmenuShow(n,h){this._cancelSubmenuShow();let g=this._options?.submenuHoverDelay??500;if(this._usesSubmenuPointerIntent()){g=0;let f=this._submenuPointerOrigin;if(f&&h.clientX!==f.x&&this._currentSubmenuElement&&new jI(f.x,f.y,this._submenuContainer).contains(h.clientX,h.clientY)){let b=Date.now();this._submenuPointerGraceDeadline??=b+200,g=Math.max(0,this._submenuPointerGraceDeadline-b)}}let p=()=>{this._submenuShowTimeout=void 0;let f=this._list.indexOf(n),b=f>=0?this._getRowElement(f):null;if(b){if(this._showSubmenuForElement(n,b),this._usesSubmenuPointerIntent())this._updateSubmenuPointer(h)}};if(g===0)p();else this._submenuShowTimeout=setTimeout(p,g)}_updateSubmenuPointer(n){this._submenuPointerOrigin={x:n.clientX,y:n.clientY},this._submenuPointerGraceDeadline=void 0}_resetSubmenuPointer(){this._submenuPointerOrigin=void 0,this._submenuPointerGraceDeadline=void 0}_usesSubmenuPointerIntent(){return this._options?.persistentHover===!0||this._options?.submenuPointerIntent===!0}_cancelSubmenuShow(){if(this._submenuShowTimeout!==void 0)clearTimeout(this._submenuShowTimeout),this._submenuShowTimeout=void 0}async onListHover(n){this._setKeyboardNavigation(!1);let h=n.element;if(h&&h.item&&this.focusCondition(h)){let g=typeof n.index==="number"?[n.index]:[],p=At();if(this._options?.tabThroughItemActions&&this._list.getFocus()[0]!==n.index&&Le(p)&&this.domNode.contains(p)&&p.closest(".action-list-item-toolbar"))this._list.domFocus();if(Le(n.browserEvent.target)&&n.browserEvent.target.closest(".action-list-item-toolbar")!==null){if(!h.submenuActions?.length)this._cancelSubmenuShow();this._list.setFocus(this._options?.tabThroughItemActions?g:[]);return}let b=!!(h.submenuActions?.length||h.hover?.content),S=this._suppressHover;if(b||this._usesSubmenuPointerIntent())this._suppressHover=!0;try{this._list.setFocus(g)}finally{this._suppressHover=S}if(b){if(this._currentSubmenuElement===h){if(this._cancelSubmenuHide(),this._cancelSubmenuShow(),this._usesSubmenuPointerIntent())this._updateSubmenuPointer(n.browserEvent)}else{if(!this._usesSubmenuPointerIntent())this._hideSubmenu();this._scheduleSubmenuShow(h,n.browserEvent)}return}if(this._currentSubmenuElement===h)this._cancelSubmenuHide();else if(this._cancelSubmenuShow(),this._options?.submenuPointerIntent)this._scheduleSubmenuHide();else if(!this._options?.persistentHover)this._hideSubmenu();if(this._delegate.onHover&&!h.disabled&&h.kind==="action"&&this._currentSubmenuElement!==h){let w=await this._delegate.onHover(h.item,this.cts.token),x=w?w.canPreview:void 0;if(x!==h.canPreview){if(h.canPreview=x,typeof n.index==="number")this._list.splice(n.index,1,[h]),this._list.setFocus([n.index])}}}else if(h&&h.hover?.content&&typeof n.index==="number")if(this._currentSubmenuElement===h)this._cancelSubmenuHide(),this._cancelSubmenuShow();else{if(!this._options?.persistentHover)this._hideSubmenu();this._scheduleSubmenuShow(h,n.browserEvent)}}onListClick(n){if(n.element&&this.focusCondition(n.element))this._list.setFocus([])}};Xf=Lf=e_([hs(6,ge),hs(7,Xr),hs(8,O)],Xf);var Fu=class u extends i{get domNode(){return this._widget.domNode}get filterContainer(){return this._widget.filterContainer}get footerContainer(){return this._widget.footerContainer}get headerContainer(){return this._widget.headerContainer}get filterInput(){return this._widget.filterInput}get closeAnimation(){return this._widget.closeAnimation}get widgetClassName(){return this._widgetClassName}get anchorPosition(){if(this._preferredAnchorPosition!==void 0)return this._preferredAnchorPosition;if(this._showAbove===void 0)return;return this._showAbove?1:0}constructor(n,h,g,p,f,b,S,w,x,I){super();this._contextViewService=w,this._layoutService=x,this._lastMinWidth=0,this._hasLaidOut=!1,this._anchor=S,this._preferredAnchorPosition=b?.anchorPosition,this._useFullHeight=b?.useFullHeight??!1,this._widgetClassName=b?.widgetClassName,this._widget=this._register(I.createInstance(Xf,n,h,g,p,f,b)),this._register(this._widget.onDidRequestLayout(()=>{if(this._hasLaidOut)this.layout(this._lastMinWidth),this._contextViewService.layout()}))}focus(){this._widget.focus()}hide(n,h=!0){if(this._widget.hide(n),h)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(n){this._widget.acceptSelected(n)}hasDynamicHeight(){return this._widget.hasDynamicHeight}computeActionWidgetVerticalChromeHeight(){let n=this.domNode.parentElement?.closest(".action-widget");if(!n)return 0;let h=B(n).getComputedStyle(n),g=(p)=>Number.parseFloat(p)||0;return g(h.paddingTop)+g(h.paddingBottom)+g(h.borderTopWidth)+g(h.borderBottomWidth)}computeHeight(){let n=this._fixedContentHeight??this._widget.computeListHeight(),h=this._widget.filterContainer?36:0,g=this._widget.footerContainer?32:0,p=this._widget.headerContainer&&!this._widget.headerContainer.hidden?this._widget.headerContainer.offsetHeight||36:0,f=h+g+p,b=B(this.domNode),S;if(this.hasDynamicHeight()||this._preferredAnchorPosition!==void 0){let Z=b.innerHeight,X=S0(this._anchor),J=X.top-b.pageYOffset,Q=30,te=Z-J-X.height-30,re=J;if(this._showAbove===void 0){let le=this._fixedContentHeight??this._widget.computeFullHeight();this._showAbove=this._preferredAnchorPosition!==void 0?this._preferredAnchorPosition===1:f+le>te&&re>te}S=Math.max(0,(this._showAbove?re:te)-this.computeActionWidgetVerticalChromeHeight())}else{let X=this._layoutService.getContainer(b).clientHeight,J=this.domNode.getBoundingClientRect().top;S=J>0?X-J-10:X*0.7}let w=this._useFullHeight?b.innerHeight:Math.floor(b.innerHeight*0.6),x=this._widget.lineHeight;if(this._preferredAnchorPosition!==void 0){let Z=Math.min(S,w),X=Math.min(n+f,Math.max(0,Z));return Math.max(0,X-f)}let I=Math.min(Math.max(S,x*3+f),w);return Math.min(n+f,I)-f}layout(n,h){if(this._hasLaidOut=!0,this._lastMinWidth=n,h!==void 0)this._fixedContentHeight=h;let g=this.computeHeight();this._widget.layout(g);let p=this._widget.computeMaxWidth(n);return this._cachedMaxWidth=p,this._widget.layout(g,this._cachedMaxWidth),this._cachedMaxWidth}};Fu=e_([hs(7,Ss),hs(8,Ho),hs(9,O)],Fu);function ko(u){return u.replace(/\r\n|\r|\n/g," ")}var MD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},t_=function(u,n){return function(h,g){n(h,g,u)}};a("actionBar.toggledBackground",np,e(1744,"Background color for toggled action items in action bar."));var yC="--action-widget-close-start-opacity",xC="--action-widget-close-start-transform",zi={Visible:new P("codeActionMenuVisible",!1,e(1745,"Whether the action widget list is visible")),FilterFocused:new P("codeActionMenuFilterFocused",!1,e(1746,"Whether the action widget filter input is focused"))},ro=ie("actionWidgetService"),Jo=class u extends i{get isVisible(){return zi.Visible.getValue(this._contextKeyService)||!1}constructor(n,h,g){super();this._contextViewService=n,this._contextKeyService=h,this._instantiationService=g,this._list=this._register(new de),this._closeAnimation=this._register(new de)}show(n,h,g,p,f,b,S,w,x){let I=zi.Visible.bindTo(this._contextKeyService),E=this._instantiationService.createInstance(Fu,n,h,g,p,w,x,f);this._contextViewService.showContextView({getAnchor:()=>f,render:(Z)=>(I.set(!0),this._renderWidget(Z,E,S??[],x)),onHide:(Z)=>{I.reset(),this._onWidgetClosed(Z)},get anchorPosition(){return E.anchorPosition},focus:()=>E.focus()},b,!1)}acceptSelected(n){this._list.value?.acceptSelected(n)}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(n){let h=this._list.value,g=this._widgetElement;if(!h||this._closingList===h)return;let p=h.closeAnimation;if(!g||!p||p.duration<=0||!this._hasRequiredAncestorClasses(g,p.requiredAncestorClasses)){this._closingList=h,h.hide(n);return}this._closingList=h;let f=B(g).getComputedStyle(g);g.style.setProperty(yC,f.opacity),g.style.setProperty(xC,f.transform),g.classList.add(p.className),h.hide(n,!1),this._closeAnimation.value=yi(()=>{if(this._list.value===h)this._contextViewService.hideContextView(n)},p.duration)}clear(){this._closeAnimation.clear(),this._closingList=void 0,this._widgetElement?.style.removeProperty(yC),this._widgetElement?.style.removeProperty(xC),this._widgetElement=void 0,this._list.clear()}_renderWidget(n,h,g,p){let f=document.createElement("div");f.classList.add("action-widget");let b=h.widgetClassName?.split(/\s+/).filter(Boolean);if(b?.length)f.classList.add(...b);if(n.appendChild(f),this._widgetElement=f,this._list.value=h,this._list.value){if(this._list.value.headerContainer)f.appendChild(this._list.value.headerContainer);if(this._list.value.filterContainer)f.appendChild(this._list.value.filterContainer);if(f.appendChild(this._list.value.domNode),this._list.value.footerContainer)f.appendChild(this._list.value.footerContainer)}else throw Error("List has no value");let S=new d;if(p?.filterAsCombobox)S.add(Ct(f,"keydown",(re)=>{if(re.keyCode===9&&!re.browserEvent.isComposing)Ee.stop(re,!0),this.hide(!0)}));let w=this._list.value.headerContainer;if(w)S.add(fu(w,(re)=>re.preventDefault()));let x=0;S.add(fu(f,()=>{x=Date.now()+1000}));let I=document.createElement("div"),E=n.appendChild(I);E.classList.add("context-view-block"),S.add(fu(E,(re)=>re.stopPropagation()));let Z=0;if(g.length){let re=this._createActionBar(".action-widget-action-bar",g);if(re)f.appendChild(re.getContainer().parentElement),S.add(re),Z=re.getContainer().offsetWidth}let X=this._list.value?.layout(Z);f.style.width=`${X}px`;let J=zi.FilterFocused.bindTo(this._contextKeyService);if(S.add({dispose:()=>J.reset()}),this._list.value?.filterInput){let re=this._list.value.filterInput;S.add(c(re,"focus",()=>J.set(!0))),S.add(c(re,"blur",()=>J.set(!1)))}let Q=S.add(wi(n)),te=S.add(new de);return S.add(Q.onDidFocus(()=>te.clear())),S.add(Q.onDidBlur(()=>{let re=()=>{let le=x-Date.now();if(le>0){te.value=yi(re,le);return}let pe=At();if(pe&&(n.contains(pe)||pe.closest(".action-widget-hover")||pe.closest(".action-list-submenu-panel")))return;this.hide(!0)};te.value=yi(re,75)})),S}_createActionBar(n,h){if(!h.length)return;let g=_(n),p=new er(g);return p.push(h,{icon:!1,label:!0}),p}_hasRequiredAncestorClasses(n,h){if(!h?.length)return!0;for(let g=n;g;g=g.parentElement)if(h.every((p)=>g.classList.contains(p)))return!0;return!1}_onWidgetClosed(n){if(this._closingList===this._list.value){this.clear();return}this._closeAnimation.clear(),this._closingList=void 0,this._widgetElement=void 0,this._list.value?.hide(n)}};Jo=MD([t_(0,Ss),t_(1,K),t_(2,O)],Jo);_e(ro,Jo,1);var br=1100;lt(class extends Cn{constructor(){super({id:"hideCodeActionWidget",title:y(1747,"Hide action widget"),precondition:zi.Visible,keybinding:{weight:br,primary:9,secondary:[1033]}})}run(u){u.get(ro).hide(!0)}});lt(class extends Cn{constructor(){super({id:"clearFilterCodeActionWidget",title:y(1748,"Clear action widget filter"),precondition:L.and(zi.Visible,zi.FilterFocused),keybinding:{weight:br+1,primary:9}})}run(u){let n=u.get(ro);if(n instanceof Jo){if(!n.clearFilter())n.hide(!0)}}});lt(class extends Cn{constructor(){super({id:"selectPrevCodeAction",title:y(1749,"Select previous action"),precondition:zi.Visible,keybinding:{weight:br,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.focusPrevious()}});lt(class extends Cn{constructor(){super({id:"selectNextCodeAction",title:y(1750,"Select next action"),precondition:zi.Visible,keybinding:{weight:br,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.focusNext()}});lt(class extends Cn{constructor(){super({id:"collapseSectionCodeAction",title:y(1751,"Collapse section"),precondition:L.and(zi.Visible,zi.FilterFocused.negate()),keybinding:{weight:br,primary:15}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.collapseSection()}});lt(class extends Cn{constructor(){super({id:"expandSectionCodeAction",title:y(1752,"Expand section"),precondition:L.and(zi.Visible,zi.FilterFocused.negate()),keybinding:{weight:br,primary:17}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.expandSection()}});lt(class extends Cn{constructor(){super({id:"toggleSectionCodeAction",title:y(1753,"Toggle section"),precondition:L.and(zi.Visible,zi.FilterFocused.negate()),keybinding:{weight:br,primary:10}})}run(u){let n=u.get(ro);if(n instanceof Jo){if(!n.toggleSection())n.acceptSelected()}}});lt(class extends Cn{constructor(){super({id:Hu,title:y(1754,"Accept selected action"),precondition:zi.Visible,keybinding:{weight:br,primary:3,secondary:[2137]}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.acceptSelected()}});lt(class extends Cn{constructor(){super({id:Wu,title:y(1755,"Preview selected action"),precondition:zi.Visible,keybinding:{weight:br,primary:2051}})}run(u){let n=u.get(ro);if(n instanceof Jo)n.acceptSelected(!0)}});var IC=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Ad=function(u,n){return function(h,g){n(h,g,u)}},i_,o_=class u extends i{static{i_=this}static{this.baseId="editor.widget.postEditWidget"}constructor(n,h,g,p,f,b,S,w,x,I,E){super();this.typeId=n,this.editor=h,this.showCommand=p,this.range=f,this.edits=b,this.onSelectNewEdit=S,this.additionalActions=w,this._keybindingService=I,this._actionWidgetService=E,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=g.bindTo(x),this.visibleContext.set(!0),this._register(D(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(D(()=>this.editor.removeContentWidget(this))),this._register(this.editor.onDidChangeCursorPosition((Z)=>{this.dispose()})),this._register(R.runAndSubscribe(I.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){this.button.element.title=this._keybindingService.appendKeybinding(this.showCommand.label,this.showCommand.id)}create(){this.domNode=_(".post-edit-widget"),this.button=this._register(new cp(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(c(this.domNode,T.CLICK,()=>this.showSelector()))}getId(){return i_.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){let n=kt(this.button.element),h={x:n.left+n.width,y:n.top+n.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((g,p)=>({kind:"action",item:g,label:g.title,disabled:!1,canPreview:!1,group:{title:"",icon:Y.fromId(p===this.edits.activeEditIndex?C.check.id:C.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:(g)=>{this._actionWidgetService.hide(!1);let p=this.edits.allEdits.findIndex((f)=>f===g);if(p!==this.edits.activeEditIndex)return this.onSelectNewEdit(p)}},h,this.editor.getDomNode()??void 0,this.additionalActions)}};o_=i_=IC([Ad(8,K),Ad(9,ge),Ad(10,ro)],o_);var lv=class u extends i{constructor(n,h,g,p,f,b,S,w){super();this._id=n,this._editor=h,this._visibleContext=g,this._showCommand=p,this._getAdditionalActions=f,this._instantiationService=b,this._bulkEditService=S,this._notificationService=w,this._currentWidget=this._register(new de),this._register(R.any(h.onDidChangeModel,h.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(n,h,g,p,f){if(!n.length||!this._editor.hasModel())return;let b=this._editor.getModel(),S=h.allEdits.at(h.activeEditIndex);if(!S)return;let w=async(re)=>{let le=this._editor.getModel();if(!le)return;await le.undo(),this.applyEditAndShowIfNeeded(n,{activeEditIndex:re,allEdits:h.allEdits},g,p,f)},x=(re,le)=>{if(bi(re))return;if(this._notificationService.error(le),g)this.show(n[0],h,w)},I=new Es(this._editor,3,void 0,f),E;try{E=await r2(p(S,I.token),I.token)}catch(re){return x(re,e(991,`Error resolving edit '{0}':
|
|
5
|
+
{1}`,S.title,av(re)))}finally{I.dispose()}if(f.isCancellationRequested)return;let Z=Au(b.uri,n,E),X=n[0],J=b.deltaDecorations([],[{range:X,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let Q,te;try{Q=await this._bulkEditService.apply(Z,{editor:this._editor,token:f}),te=b.getDecorationRange(J[0])}catch(re){return x(re,e(992,`Error applying edit '{0}':
|
|
6
|
+
{1}`,S.title,av(re)))}finally{b.deltaDecorations(J,[])}if(f.isCancellationRequested)return;if(g&&Q.isApplied&&h.allEdits.length>1)this.show(te??X,h,w)}show(n,h,g){if(this.clear(),this._editor.hasModel())this._currentWidget.value=this._instantiationService.createInstance(o_,this._id,this._editor,this._visibleContext,this._showCommand,n,h,g,this._getAdditionalActions())}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};lv=IC([Ad(5,O),Ad(6,Dc),Ad(7,wt)],lv);var PD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},vr=function(u,n){return function(h,g){n(h,g,u)}},To,$I="editor.changePasteType",AD="editor.pasteAs.preferences",U1=new P("pasteWidgetVisible",!1,e(971,"Whether the paste widget is showing")),n_="application/vnd.code.copymetadata",hd=class u extends i{static{To=this}static{this.ID="editor.contrib.copyPasteActionController"}static get(n){return n.getContribution(To.ID)}constructor(n,h,g,p,f,b,S,w,x,I){super();this._logService=g,this._bulkEditService=p,this._clipboardService=f,this._commandService=b,this._configService=S,this._languageFeaturesService=w,this._quickInputService=x,this._progressService=I,this._editor=n,this._register(n.onWillCopy((E)=>this.handleCopy(E))),this._register(n.onWillCut((E)=>this.handleCopy(E))),this._register(n.onWillPaste((E)=>this.handlePaste(E))),this._pasteProgressManager=this._register(new sv("pasteIntoEditor",n,h)),this._postPasteWidgetManager=this._register(h.createInstance(lv,"pasteIntoEditor",n,U1,{id:$I,label:e(972,"Show paste options...")},()=>To._configureDefaultAction?[To._configureDefaultAction]:[]))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(n){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:n},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(n){if(this._logService.trace("CopyPasteController#handleCopy"),!this._editor.hasTextFocus())return;if(this._clipboardService.clearInternalState?.(),!this.isPasteAsEnabled())return;let h=this._editor.getModel(),g=this._editor._getViewModel(),p=this._editor.getSelections();if(!h||!g||!p?.length)return;let f={multicursorText:n.dataToCopy.multicursorText??null,pasteOnNewLine:n.dataToCopy.isFromEmptySelection,mode:null},b=this._languageFeaturesService.documentPasteEditProvider.ordered(h).filter((E)=>!!E.prepareDocumentPaste);if(!b.length){this.setCopyMetadata(n.clipboardData,{defaultPastePayload:f});return}let S=new Jf,w=b.flatMap((E)=>E.copyMimeTypes??[]),x=jl();this.setCopyMetadata(n.clipboardData,{id:x,providerCopyMimeTypes:w,defaultPastePayload:f});let I=b.map((E)=>({providerMimeTypes:E.copyMimeTypes,operation:Zt((Z)=>E.prepareDocumentPaste(h,n.dataToCopy.sourceRanges,S,Z).catch((X)=>{console.error(X);return}))}));To._currentCopyOperation?.operations.forEach((E)=>E.operation.cancel()),To._currentCopyOperation={handle:x,operations:I}}async handlePaste(n){if(this._logService.trace("CopyPasteController#handlePaste for id : ",n.metadata?.id),!this._editor.hasTextFocus())return;let h=n.toExternalVSDataTransfer();if(!h)return;h.delete(n_),ti.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;let g=this._editor.getModel(),p=this._editor.getSelections();if(!p?.length||!g)return;if(this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;let f=this.fetchCopyMetadata(n);this._logService.trace("CopyPasteController#handlePaste with metadata : ",f?.id," and text.length : ",n.clipboardData.getData("text/plain").length);let b=Array.from(n.clipboardData.files).map((x)=>x.type),S=[...n.clipboardData.types,...b,...f?.providerCopyMimeTypes??[],kn.uriList],w=this._languageFeaturesService.documentPasteEditProvider.ordered(g).filter((x)=>{let I=this._pasteAsActionContext?.preferred;if(I){if(!this.providerMatchesPreference(x,I))return!1}return x.pasteMimeTypes?.some((E)=>zI(E,S))});if(!w.length){if(this._pasteAsActionContext?.preferred)this.showPasteAsNoEditMessage(p,this._pasteAsActionContext.preferred),n.setHandled();return}if(n.setHandled(),this._pasteAsActionContext)this.showPasteAsPick(this._pasteAsActionContext.preferred,w,p,h,f);else this.doPasteInline(w,p,h,f,n.browserEvent)}showPasteAsNoEditMessage(n,h){let g="only"in h?h.only.value:("preferences"in h)?h.preferences.length?h.preferences.map((p)=>p.value).join(", "):e(973,"empty"):h.providerId;ti.get(this._editor)?.showMessage(e(974,"No paste edits for '{0}' found",g),n[0].getStartPosition())}doPasteInline(n,h,g,p,f){this._logService.trace("CopyPasteController#doPasteInline");let b=this._editor;if(!b.hasModel())return;let S=new Es(b,3,void 0),w=Zt(async(x)=>{let I=this._editor;if(!I.hasModel())return;let E=I.getModel(),Z=new d,X=Z.add(new Je(x));Z.add(S.token.onCancellationRequested(()=>X.cancel()));let J=X.token;try{if(await this.mergeInDataFromCopy(n,g,p,J),J.isCancellationRequested)return;let Q=n.filter((le)=>this.isSupportedPasteProvider(le,g));if(!Q.length||Q.length===1&&Q[0]instanceof Bh)return this.applyDefaultPasteHandler(g,p,J,f);let te={triggerKind:Eg.Automatic},re=await this.getPasteEdits(Q,g,E,h,te,J);if(Z.add(re),J.isCancellationRequested)return;if(re.edits.length===1&&re.edits[0].provider instanceof Bh)return this.applyDefaultPasteHandler(g,p,J,f);if(re.edits.length){let le=I.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(h,{activeEditIndex:this.getInitialActiveEditIndex(E,re.edits),allEdits:re.edits},le,async(pe,Se)=>{if(!pe.provider.resolveDocumentPasteEdit)return pe;let we=pe.provider.resolveDocumentPasteEdit(pe,Se),ae=new ma,me=await this._pasteProgressManager.showWhile(h[0].getEndPosition(),e(975,"Resolving paste edit for '{0}'. Click to cancel",pe.title),yc(Promise.race([ae.p,we]),Se),{cancel:()=>ae.cancel()},0);if(me)pe.insertText=me.insertText,pe.additionalEdit=me.additionalEdit;return pe},J)}await this.applyDefaultPasteHandler(g,p,J,f)}finally{if(Z.dispose(),this._currentPasteOperation===w)this._currentPasteOperation=void 0}});this._pasteProgressManager.showWhile(h[0].getEndPosition(),e(976,"Running paste handlers. Click to cancel and do basic paste"),w,{cancel:async()=>{if(w.cancel(),S.token.isCancellationRequested)return;await this.applyDefaultPasteHandler(g,p,S.token,f)}}).finally(()=>{S.dispose()}),this._currentPasteOperation=w}showPasteAsPick(n,h,g,p,f){this._logService.trace("CopyPasteController#showPasteAsPick");let b=Zt(async(S)=>{let w=this._editor;if(!w.hasModel())return;let x=w.getModel(),I=new d,E=I.add(new Es(w,3,void 0,S));try{if(await this.mergeInDataFromCopy(h,p,f,E.token),E.token.isCancellationRequested)return;let Z=h.filter((re)=>this.isSupportedPasteProvider(re,p,n));if(n)Z=Z.filter((re)=>this.providerMatchesPreference(re,n));let X={triggerKind:Eg.PasteAs,only:n&&"only"in n?n.only:void 0},J=I.add(await this.getPasteEdits(Z,p,x,g,X,E.token));if(E.token.isCancellationRequested)return;if(n)J={edits:J.edits.filter((re)=>{if("only"in n)return n.only.contains(re.kind);else if("preferences"in n)return n.preferences.some((le)=>le.contains(re.kind));else return n.providerId===re.provider.id}),dispose:J.dispose};if(!J.edits.length){if(n)this.showPasteAsNoEditMessage(g,n);return}let Q;if(n)Q=J.edits.at(0);else{let re={id:"editor.pasteAs.default",label:e(977,"Configure default paste action"),edit:void 0},le=await this._quickInputService.pick([...J.edits.map((pe)=>({label:pe.title,description:pe.kind?.value,edit:pe})),...To._configureDefaultAction?[XM({type:"separator"}),{label:To._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:e(978,"Select Paste Action")});if(le===re){To._configureDefaultAction?.run();return}Q=le?.edit}if(!Q)return;let te=Au(x.uri,g,Q);await this._bulkEditService.apply(te,{editor:this._editor})}finally{if(I.dispose(),this._currentPasteOperation===b)this._currentPasteOperation=void 0}});this._progressService.withProgress({location:10,title:e(979,"Running paste handlers")},()=>b)}setCopyMetadata(n,h){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",h.id),n.setData(n_,JSON.stringify(h))}fetchCopyMetadata(n){this._logService.trace("CopyPasteController#fetchCopyMetadata");let h=n.clipboardData.getData(n_);if(h)try{return JSON.parse(h)}catch{return}if(n.metadata)return{defaultPastePayload:{mode:n.metadata.mode,multicursorText:n.metadata.multicursorText??null,pasteOnNewLine:!!n.metadata.isFromEmptySelection}};return}async mergeInDataFromCopy(n,h,g,p){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",g?.id),g?.id&&To._currentCopyOperation?.handle===g.id){let f=To._currentCopyOperation.operations.filter((S)=>n.some((w)=>w.pasteMimeTypes.some((x)=>zI(x,S.providerMimeTypes)))).map((S)=>S.operation),b=await Promise.all(f);if(p.isCancellationRequested)return;for(let S of b.reverse())if(S)for(let[w,x]of S)h.replace(w,x)}if(!h.has(kn.uriList)){let f=await this._clipboardService.readResources();if(p.isCancellationRequested)return;if(f.length)h.append(kn.uriList,f0(zg.create(f)))}}async getPasteEdits(n,h,g,p,f,b){let S=new d,w=await yc(Promise.all(n.map(async(I)=>{try{let E=await I.provideDocumentPasteEdits?.(g,p,h,f,b);if(E)S.add(E);return E?.edits?.map((Z)=>({...Z,provider:I}))}catch(E){if(!bi(E))console.error(E);return}})),b),x=wr(w??[]).flat().filter((I)=>!f.only||f.only.contains(I.kind));return{edits:z1(x),dispose:()=>S.dispose()}}async applyDefaultPasteHandler(n,h,g,p){let b=await(n.get(kn.text)??n.get("text"))?.asString()??"";if(g.isCancellationRequested)return;let S={clipboardEvent:p,text:b,pasteOnNewLine:h?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:h?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",h?.id),this._editor.trigger("keyboard","paste",S)}isSupportedPasteProvider(n,h,g){if(!n.pasteMimeTypes?.some((p)=>h.matches(p)))return!1;return!g||this.providerMatchesPreference(n,g)}providerMatchesPreference(n,h){if("only"in h)return n.providedPasteEditKinds.some((g)=>h.only.contains(g));else if("preferences"in h)return n.providedPasteEditKinds.some((g)=>h.preferences.some((p)=>p.contains(g)));else return n.id===h.providerId}getInitialActiveEditIndex(n,h){let g=this._configService.getValue(AD,{resource:n.uri});for(let p of Array.isArray(g)?g:[]){let f=new Ht(p),b=h.findIndex((S)=>f.contains(S.kind));if(b>=0)return b}return 0}};hd=To=PD([vr(1,O),vr(2,Ze),vr(3,Dc),vr(4,xi),vr(5,Ue),vr(6,oe),vr(7,V),vr(8,En),vr(9,zk)],hd);var Ea="9_cutcopypaste",FD=Zo||document.queryCommandSupported&&document.queryCommandSupported("cut"),EC=Zo||document.queryCommandSupported&&document.queryCommandSupported("copy"),HD=typeof navigator.clipboard>"u"||li?document.queryCommandSupported&&document.queryCommandSupported("paste"):!0;function a_(u){return u.register(),u}var WD=FD?a_(new Pf({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:Zo?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:l.MenubarEditMenu,group:"2_ccp",title:e(864,"Cu&&t"),order:1},{menuId:l.EditorContext,group:Ea,title:e(865,"Cut"),when:o.writable,order:1},{menuId:l.CommandPalette,group:"",title:e(866,"Cut"),order:1},{menuId:l.SimpleEditorContext,group:Ea,title:e(867,"Cut"),when:o.writable,order:1}]})):void 0,BD=EC?a_(new Pf({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:Zo?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:l.MenubarEditMenu,group:"2_ccp",title:e(868,"&&Copy"),order:2},{menuId:l.EditorContext,group:Ea,title:e(869,"Copy"),order:2},{menuId:l.CommandPalette,group:"",title:e(870,"Copy"),order:1},{menuId:l.SimpleEditorContext,group:Ea,title:e(871,"Copy"),order:2}]})):void 0;Zn.appendMenuItem(l.MenubarEditMenu,{submenu:l.MenubarCopy,title:y(876,"Copy As"),group:"2_ccp",order:3});Zn.appendMenuItem(l.EditorContext,{submenu:l.EditorContextCopy,title:y(877,"Copy As"),group:Ea,order:3});Zn.appendMenuItem(l.EditorContext,{submenu:l.EditorContextShare,title:y(878,"Share"),group:"11_share",order:-1,when:L.and(L.notEquals("resourceScheme","output"),o.editorTextFocus)});Zn.appendMenuItem(l.ExplorerContext,{submenu:l.ExplorerContextShare,title:y(879,"Share"),group:"11_share",order:-1});var r_=HD?a_(new Pf({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:Zo?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:l.MenubarEditMenu,group:"2_ccp",title:e(872,"&&Paste"),order:4},{menuId:l.EditorContext,group:Ea,title:e(873,"Paste"),when:o.writable,order:4},{menuId:l.CommandPalette,group:"",title:e(874,"Paste"),order:1},{menuId:l.SimpleEditorContext,group:Ea,title:e(875,"Paste"),when:o.writable,order:4}]})):void 0;class DC extends U{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:y(880,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:0,weight:100}})}run(u,n){let h=u.get(Ze),g=u.get(xi);if(h.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!n.hasModel())return;if(!n.getOption(45)&&n.getSelection().isEmpty())return;xu.forceCopyWithSyntaxHighlighting=!0,n.focus(),h.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),s_(n,g),h.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),xu.forceCopyWithSyntaxHighlighting=!1}}function s_(u,n){if(xu.electronBugWorkaroundCopyEventHasFired=!1,u.getContainerDomNode().ownerDocument.execCommand("copy"),Zo&&xu.electronBugWorkaroundCopyEventHasFired===!1){let{dataToCopy:h}=I2(u._getViewModel(),void 0,li);n.writeText(h.text)}}function RC(u,n){if(!u)return;u.addImplementation(1e4,"code-editor",(h,g)=>{let p=h.get(Ze),f=h.get(xi);p.trace("registerExecCommandImpl (addImplementation code-editor for : ",n,")");let b=h.get(Te).getFocusedCodeEditor();if(b&&b.hasTextFocus()&&b.hasModel()){let S=b.getOption(45),w=b.getSelection();if(w&&w.isEmpty()&&!S)return!0;if(b.getOption(171)&&n==="cut")LC(b),p.trace("registerExecCommandImpl (before execCommand copy)"),s_(b,f),b.trigger(void 0,"cut",void 0),p.trace("registerExecCommandImpl (after execCommand copy)");else{if(LC(b),p.trace("registerExecCommandImpl (before execCommand "+n+")"),n==="copy")s_(b,f);else b.getContainerDomNode().ownerDocument.execCommand(n);p.trace("registerExecCommandImpl (after execCommand "+n+")")}return!0}return!1}),u.addImplementation(0,"generic-dom",(h,g)=>{let p=h.get(Ze);return p.trace("registerExecCommandImpl (addImplementation generic-dom for : ",n,")"),p.trace("registerExecCommandImpl (before execCommand "+n+")"),If().execCommand(n),p.trace("registerExecCommandImpl (after execCommand "+n+")"),!0})}function LC(u){if(u.getOption(171)){let h=b0.get(u.getId());if(h)h.handleWillCopy()}}RC(WD,"cut");RC(BD,"copy");if(r_)r_.addImplementation(1e4,"code-editor",(u,n)=>{let h=u.get(Ze);h.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");let g=u.get(Te),p=u.get(xi),f=g.getFocusedCodeEditor();if(f&&f.hasModel()&&f.hasTextFocus()){if(f.getOption(171)){let w=b0.get(f.getId());if(w)w.handleWillPaste()}h.trace("registerExecCommandImpl (before triggerPaste)");let S=p.triggerPaste(Ke().vscodeWindowId);if(S)return h.trace("registerExecCommandImpl (triggerPaste defined)"),S.then(async()=>(h.trace("registerExecCommandImpl (after triggerPaste)"),hd.get(f)?.finishedPaste()??Promise.resolve()));else h.trace("registerExecCommandImpl (triggerPaste undefined)");if(Fs)return h.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{let w=await p.readText();if(w!==""){let x=Kf.INSTANCE.get(w),I=!1,E=null,Z=null;if(x)I=f.getOption(45)&&!!x.isFromEmptySelection,E=typeof x.multicursorText<"u"?x.multicursorText:null,Z=x.mode;h.trace("registerExecCommandImpl (clipboardText.length : ",w.length," id : ",x?.id,")"),f.trigger("keyboard","paste",{text:w,pasteOnNewLine:I,multicursorText:E,mode:Z})}})();return!0}return!1}),r_.addImplementation(0,"generic-dom",(u,n)=>(u.get(Ze).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),u.get(xi).triggerPaste(Ke().vscodeWindowId)??!1));if(EC)A(DC);class Fn{constructor(u,n,h){this.languageConfigurationService=h,this._selection=u,this._insertSpace=n,this._usedEndToken=null}static _haystackHasNeedleAtOffset(u,n,h){if(h<0)return!1;let g=n.length,p=u.length;if(h+g>p)return!1;for(let f=0;f<g;f++){let b=u.charCodeAt(h+f),S=n.charCodeAt(f);if(b===S)continue;if(b>=65&&b<=90&&b+32===S)continue;if(S>=65&&S<=90&&S+32===b)continue;return!1}return!0}_createOperationsForBlockComment(u,n,h,g,p,f){let{startLineNumber:b,startColumn:S,endLineNumber:w,endColumn:x}=u,I=p.getLineContent(b),E=p.getLineContent(w),Z=I.lastIndexOf(n,S-1+n.length),X=E.indexOf(h,x-1-h.length);if(Z!==-1&&X!==-1)if(b===w){if(I.substring(Z+n.length,X).indexOf(h)>=0)Z=-1,X=-1}else{let Q=I.substring(Z+n.length),te=E.substring(0,X);if(Q.indexOf(h)>=0||te.indexOf(h)>=0)Z=-1,X=-1}let J;if(Z!==-1&&X!==-1){if(g&&Z+n.length<I.length&&I.charCodeAt(Z+n.length)===32)n=n+" ";if(g&&X>0&&E.charCodeAt(X-1)===32)h=" "+h,X-=1;J=Fn._createRemoveBlockCommentOperations(new t(b,Z+n.length+1,w,X+1),n,h)}else J=Fn._createAddBlockCommentOperations(u,n,h,this._insertSpace),this._usedEndToken=J.length===1?h:null;for(let Q of J)f.addTrackedEditOperation(Q.range,Q.text)}static _createRemoveBlockCommentOperations(u,n,h){let g=[];if(!t.isEmpty(u))g.push(Yt.delete(new t(u.startLineNumber,u.startColumn-n.length,u.startLineNumber,u.startColumn))),g.push(Yt.delete(new t(u.endLineNumber,u.endColumn,u.endLineNumber,u.endColumn+h.length)));else g.push(Yt.delete(new t(u.startLineNumber,u.startColumn-n.length,u.endLineNumber,u.endColumn+h.length)));return g}static _createAddBlockCommentOperations(u,n,h,g){let p=[];if(!t.isEmpty(u))p.push(Yt.insert(new s(u.startLineNumber,u.startColumn),n+(g?" ":""))),p.push(Yt.insert(new s(u.endLineNumber,u.endColumn),(g?" ":"")+h));else p.push(Yt.replace(new t(u.startLineNumber,u.startColumn,u.endLineNumber,u.endColumn),n+" "+h));return p}getEditOperations(u,n){let h=this._selection.startLineNumber,g=this._selection.startColumn;u.tokenization.tokenizeIfCheap(h);let p=u.getLanguageIdAtPosition(h,g),f=this.languageConfigurationService.getLanguageConfiguration(p).comments;if(!f||!f.blockCommentStartToken||!f.blockCommentEndToken)return;this._createOperationsForBlockComment(this._selection,f.blockCommentStartToken,f.blockCommentEndToken,this._insertSpace,u,n)}computeCursorState(u,n){let h=n.getInverseEditOperations();if(h.length===2){let g=h[0],p=h[1];return new F(g.range.endLineNumber,g.range.endColumn,p.range.startLineNumber,p.range.startColumn)}else{let g=h[0].range,p=this._usedEndToken?-this._usedEndToken.length-1:0;return new F(g.endLineNumber,g.endColumn+p,g.endLineNumber,g.endColumn+p)}}}class Hn{constructor(u,n,h,g,p,f,b){this.languageConfigurationService=u,this._selection=n,this._indentSize=h,this._type=g,this._insertSpace=p,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=f,this._ignoreFirstLine=b||!1}static _gatherPreflightCommentStrings(u,n,h,g){u.tokenization.tokenizeIfCheap(n);let p=u.getLanguageIdAtPosition(n,1),f=g.getLanguageConfiguration(p).comments,b=f?f.lineCommentToken:null;if(!b)return null;let S=[];for(let w=0,x=h-n+1;w<x;w++)S[w]={ignore:!1,commentStr:b,commentStrOffset:0,commentStrLength:b.length};return S}static _analyzeLines(u,n,h,g,p,f,b,S,w){let x=!0,E=S.getLanguageConfiguration(w).comments?.lineCommentNoIndent??!1,Z;if(u===0)Z=!0;else if(u===1)Z=!1;else Z=!0;for(let X=0,J=g.length;X<J;X++){let Q=g[X],te=p+X;if(te===p&&b){Q.ignore=!0;continue}let re=h.getLineContent(te),le=Yn(re);if(le===-1){Q.ignore=f,Q.commentStrOffset=E?0:re.length;continue}x=!1;let pe=E?0:le;if(Q.ignore=!1,Q.commentStrOffset=pe,Z&&!Fn._haystackHasNeedleAtOffset(re,Q.commentStr,pe))if(u===0)Z=!1;else if(u===1);else Q.ignore=!0;if(Z&&n){let Se=le+Q.commentStrLength;if(Se<re.length&&re.charCodeAt(Se)===32)Q.commentStrLength+=1}}if(u===0&&x){Z=!1;for(let X=0,J=g.length;X<J;X++)g[X].ignore=!1}return{supported:!0,shouldRemoveComments:Z,lines:g}}static _gatherPreflightData(u,n,h,g,p,f,b,S){let w=Hn._gatherPreflightCommentStrings(h,g,p,S),x=h.getLanguageIdAtPosition(g,1);if(w===null)return{supported:!1};return Hn._analyzeLines(u,n,h,w,g,f,b,S,x)}_executeLineComments(u,n,h,g){let p;if(h.shouldRemoveComments)p=Hn._createRemoveLineCommentsOperations(h.lines,g.startLineNumber);else Hn._normalizeInsertionPoint(u,h.lines,g.startLineNumber,this._indentSize),p=this._createAddLineCommentsOperations(h.lines,g.startLineNumber);let f=new s(g.positionLineNumber,g.positionColumn);for(let b=0,S=p.length;b<S;b++)if(n.addEditOperation(p[b].range,p[b].text),t.isEmpty(p[b].range)&&t.getStartPosition(p[b].range).equals(f)){if(u.getLineContent(f.lineNumber).length+1===f.column)this._deltaColumn=(p[b].text||"").length}this._selectionId=n.trackSelection(g)}_attemptRemoveBlockComment(u,n,h,g){let{startLineNumber:p,endLineNumber:f}=n,b=g.length+Math.max(u.getLineFirstNonWhitespaceColumn(n.startLineNumber),n.startColumn),S=u.getLineContent(p).lastIndexOf(h,b-1),w=u.getLineContent(f).indexOf(g,n.endColumn-1-h.length);if(S!==-1&&w===-1)w=u.getLineContent(p).indexOf(g,S+h.length),f=p;if(S===-1&&w!==-1)S=u.getLineContent(f).lastIndexOf(h,w),p=f;if(n.isEmpty()&&(S===-1||w===-1)){if(S=u.getLineContent(p).indexOf(h),S!==-1)w=u.getLineContent(p).indexOf(g,S+h.length)}if(S!==-1&&u.getLineContent(p).charCodeAt(S+h.length)===32)h+=" ";if(w!==-1&&u.getLineContent(f).charCodeAt(w-1)===32)g=" "+g,w-=1;if(S!==-1&&w!==-1)return Fn._createRemoveBlockCommentOperations(new t(p,S+h.length+1,f,w+1),h,g);return null}_executeBlockComment(u,n,h){u.tokenization.tokenizeIfCheap(h.startLineNumber);let g=u.getLanguageIdAtPosition(h.startLineNumber,1),p=this.languageConfigurationService.getLanguageConfiguration(g).comments;if(!p||!p.blockCommentStartToken||!p.blockCommentEndToken)return;let{blockCommentStartToken:f,blockCommentEndToken:b}=p,S=this._attemptRemoveBlockComment(u,h,f,b);if(!S){if(h.isEmpty()){let w=u.getLineContent(h.startLineNumber),x=Yn(w);if(x===-1)x=w.length;S=Fn._createAddBlockCommentOperations(new t(h.startLineNumber,x+1,h.startLineNumber,w.length+1),f,b,this._insertSpace)}else S=Fn._createAddBlockCommentOperations(new t(h.startLineNumber,u.getLineFirstNonWhitespaceColumn(h.startLineNumber),h.endLineNumber,u.getLineMaxColumn(h.endLineNumber)),f,b,this._insertSpace);if(S.length===1)this._deltaColumn=f.length+1}this._selectionId=n.trackSelection(h);for(let w of S)n.addEditOperation(w.range,w.text)}getEditOperations(u,n){let h=this._selection;if(this._moveEndPositionDown=!1,h.startLineNumber===h.endLineNumber&&this._ignoreFirstLine){n.addEditOperation(new t(h.startLineNumber,u.getLineMaxColumn(h.startLineNumber),h.startLineNumber+1,1),h.startLineNumber===u.getLineCount()?"":`
|
|
7
|
+
`),this._selectionId=n.trackSelection(h);return}if(h.startLineNumber<h.endLineNumber&&h.endColumn===1)this._moveEndPositionDown=!0,h=h.setEndPosition(h.endLineNumber-1,u.getLineMaxColumn(h.endLineNumber-1));let g=Hn._gatherPreflightData(this._type,this._insertSpace,u,h.startLineNumber,h.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);if(g.supported)return this._executeLineComments(u,n,g,h);return this._executeBlockComment(u,n,h)}computeCursorState(u,n){let h=n.getTrackedSelection(this._selectionId);if(this._moveEndPositionDown)h=h.setEndPosition(h.endLineNumber+1,1);return new F(h.selectionStartLineNumber,h.selectionStartColumn+this._deltaColumn,h.positionLineNumber,h.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(u,n){let h=[];for(let g=0,p=u.length;g<p;g++){let f=u[g];if(f.ignore)continue;h.push(Yt.delete(new t(n+g,f.commentStrOffset+1,n+g,f.commentStrOffset+f.commentStrLength+1)))}return h}_createAddLineCommentsOperations(u,n){let h=[],g=this._insertSpace?" ":"";for(let p=0,f=u.length;p<f;p++){let b=u[p];if(b.ignore)continue;h.push(Yt.insert(new s(n+p,b.commentStrOffset+1),b.commentStr+g))}return h}static nextVisibleColumn(u,n,h,g){if(h)return u+(n-u%n);return u+g}static _normalizeInsertionPoint(u,n,h,g){let p=1073741824,f,b;for(let S=0,w=n.length;S<w;S++){if(n[S].ignore)continue;let x=u.getLineContent(h+S),I=0;for(let E=0,Z=n[S].commentStrOffset;I<p&&E<Z;E++)I=Hn.nextVisibleColumn(I,g,x.charCodeAt(E)===9,1);if(I<p)p=I}p=Math.floor(p/g)*g;for(let S=0,w=n.length;S<w;S++){if(n[S].ignore)continue;let x=u.getLineContent(h+S),I=0;for(f=0,b=n[S].commentStrOffset;I<p&&f<b;f++)I=Hn.nextVisibleColumn(I,g,x.charCodeAt(f)===9,1);if(I>p)n[S].commentStrOffset=f-1;else n[S].commentStrOffset=f}}}class Bu extends U{constructor(u,n){super(n);this._type=u}run(u,n){let h=u.get(ht);if(!n.hasModel())return;let g=n.getModel(),p=[],f=g.getOptions(),b=n.getOption(29),S=n.getSelections().map((x,I)=>({selection:x,index:I,ignoreFirstLine:!1}));S.sort((x,I)=>t.compareRangesUsingStarts(x.selection,I.selection));let w=S[0];for(let x=1;x<S.length;x++){let I=S[x];if(w.selection.endLineNumber===I.selection.startLineNumber)if(w.index<I.index)I.ignoreFirstLine=!0;else w.ignoreFirstLine=!0,w=I}for(let x of S)p.push(new Hn(h,x.selection,f.indentSize,this._type,b.insertSpace,b.ignoreEmptyLines,x.ignoreFirstLine));n.pushUndoStop(),n.executeCommands(this.id,p),n.pushUndoStop()}}class kC extends Bu{constructor(){super(0,{id:"editor.action.commentLine",label:y(948,"Toggle Line Comment"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:l.MenubarEditMenu,group:"5_insert",title:e(946,"&&Toggle Line Comment"),order:1},canTriggerInlineEdits:!0})}}class TC extends Bu{constructor(){super(1,{id:"editor.action.addCommentLine",label:y(949,"Add Line Comment"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2081),weight:100},canTriggerInlineEdits:!0})}}class NC extends Bu{constructor(){super(2,{id:"editor.action.removeCommentLine",label:y(950,"Remove Line Comment"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2099),weight:100},canTriggerInlineEdits:!0})}}class OC extends U{constructor(){super({id:"editor.action.blockComment",label:y(951,"Toggle Block Comment"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:l.MenubarEditMenu,group:"5_insert",title:e(947,"Toggle &&Block Comment"),order:2},canTriggerInlineEdits:!0})}run(u,n){let h=u.get(ht);if(!n.hasModel())return;let g=n.getOption(29),p=[],f=n.getSelections();for(let b of f)p.push(new Fn(b,g.insertSpace,h));n.pushUndoStop(),n.executeCommands(this.id,p),n.pushUndoStop()}}A(kC);A(TC);A(NC);A(OC);class Vu{constructor(u){this.selections=u}equals(u){let n=this.selections.length,h=u.selections.length;if(n!==h)return!1;for(let g=0;g<n;g++)if(!this.selections[g].equalsSelection(u.selections[g]))return!1;return!0}}class Ku{constructor(u,n,h){this.cursorState=u,this.scrollTop=n,this.scrollLeft=h}}class Fd extends i{static{this.ID="editor.contrib.cursorUndoRedoController"}static get(u){return u.getContribution(Fd.ID)}constructor(u){super();this._editor=u,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(u.onDidChangeModel((n)=>{this._undoStack=[],this._redoStack=[]})),this._register(u.onDidChangeModelContent((n)=>{this._undoStack=[],this._redoStack=[]})),this._register(u.onDidChangeCursorSelection((n)=>{if(this._isCursorUndoRedo)return;if(!n.oldSelections)return;if(n.oldModelVersionId!==n.modelVersionId)return;let h=new Vu(n.oldSelections);if(!(this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(h))){if(this._undoStack.push(new Ku(h,u.getScrollTop(),u.getScrollLeft())),this._redoStack=[],this._undoStack.length>50)this._undoStack.shift()}}))}cursorUndo(){if(!this._editor.hasModel()||this._undoStack.length===0)return;this._redoStack.push(new Ku(new Vu(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop())}cursorRedo(){if(!this._editor.hasModel()||this._redoStack.length===0)return;this._undoStack.push(new Ku(new Vu(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop())}_applyState(u){this._isCursorUndoRedo=!0,this._editor.setSelections(u.cursorState.selections),this._editor.setScrollPosition({scrollTop:u.scrollTop,scrollLeft:u.scrollLeft}),this._isCursorUndoRedo=!1}}class MC extends U{constructor(){super({id:"cursorUndo",label:y(965,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:2099,weight:100}})}run(u,n,h){Fd.get(n)?.cursorUndo()}}class PC extends U{constructor(){super({id:"cursorRedo",label:y(966,"Cursor Redo"),precondition:void 0})}run(u,n,h){Fd.get(n)?.cursorRedo()}}fe(Fd.ID,Fd,0);A(MC);A(PC);class d_{constructor(u,n,h){this.selection=u,this.targetPosition=n,this.copy=h,this.targetSelection=null}getEditOperations(u,n){let h=u.getValueInRange(this.selection);if(!this.copy)n.addEditOperation(this.selection,null);if(n.addEditOperation(new t(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),h),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 F(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 F(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 F(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}if(this.selection.endColumn<=this.targetPosition.column)this.targetSelection=new F(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn);else this.targetSelection=new F(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(u,n){return this.targetSelection}}function Hd(u){if(ye)return u.altKey;else return u.ctrlKey}class Wd extends i{static{this.ID="editor.contrib.dragAndDrop"}static{this.TRIGGER_KEY_VALUE=ye?6:5}constructor(u){super();this._editor=u,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown((n)=>this._onEditorMouseDown(n))),this._register(this._editor.onMouseUp((n)=>this._onEditorMouseUp(n))),this._register(this._editor.onMouseDrag((n)=>this._onEditorMouseDrag(n))),this._register(this._editor.onMouseDrop((n)=>this._onEditorMouseDrop(n))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown((n)=>this.onEditorKeyDown(n))),this._register(this._editor.onKeyUp((n)=>this.onEditorKeyUp(n))),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(u){if(!this._editor.getOption(42)||this._editor.getOption(28))return;if(Hd(u))this._modifierPressed=!0;if(this._mouseDown&&Hd(u))this._editor.updateOptions({mouseStyle:"copy"})}onEditorKeyUp(u){if(!this._editor.getOption(42)||this._editor.getOption(28))return;if(Hd(u))this._modifierPressed=!1;if(this._mouseDown&&u.keyCode===Wd.TRIGGER_KEY_VALUE)this._editor.updateOptions({mouseStyle:"default"})}_onEditorMouseDown(u){this._mouseDown=!0}_onEditorMouseUp(u){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(u){let n=u.target;if(this._dragSelection===null){let g=(this._editor.getSelections()||[]).filter((p)=>n.position&&p.containsPosition(n.position));if(g.length===1)this._dragSelection=g[0];else return}if(Hd(u.event))this._editor.updateOptions({mouseStyle:"copy"});else this._editor.updateOptions({mouseStyle:"default"});if(n.position)if(this._dragSelection.containsPosition(n.position))this._removeDecoration();else this.showAt(n.position)}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(u){if(u.target&&(this._hitContent(u.target)||this._hitMargin(u.target))&&u.target.position){let n=new s(u.target.position.lineNumber,u.target.position.column);if(this._dragSelection===null){let h=null;if(u.event.shiftKey){let g=this._editor.getSelection();if(g){let{selectionStartLineNumber:p,selectionStartColumn:f}=g;h=[new F(p,f,n.lineNumber,n.column)]}}else h=(this._editor.getSelections()||[]).map((g)=>{if(g.containsPosition(n))return new F(n.lineNumber,n.column,n.lineNumber,n.column);else return g});this._editor.setSelections(h||[],"mouse",3)}else if(!this._dragSelection.containsPosition(n)||(Hd(u.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(n)||this._dragSelection.getStartPosition().equals(n)))this._editor.pushUndoStop(),this._editor.executeCommand(Wd.ID,new d_(this._dragSelection,n,Hd(u.event)||this._modifierPressed)),this._editor.pushUndoStop()}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}static{this._DECORATION_OPTIONS=ue.register({description:"dnd-target",className:"dnd-target"})}showAt(u){this._dndDecorationIds.set([{range:new t(u.lineNumber,u.column,u.lineNumber,u.column),options:Wd._DECORATION_OPTIONS}]),this._editor.revealPosition(u,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(u){return u.type===6||u.type===7}_hitMargin(u){return u.type===2||u.type===3||u.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}}fe(Wd.ID,Wd,2);function l_(u,n,h,g){if(u.getLineCount()===1&&u.getLineMaxColumn(1)===1)return[];let p=n.getLanguageConfiguration(u.getLanguageId()).indentRulesSupport;if(!p)return[];let f=new Mv(u,p,n);g=Math.min(g,u.getLineCount());while(h<=g){if(!f.shouldIgnore(h))break;h++}if(h>g-1)return[];let{tabSize:b,indentSize:S,insertSpaces:w}=u.getOptions(),x=(Q,te)=>(te=te||1,ns.shiftIndent(Q,Q.length+te,b,S,w)),I=(Q,te)=>(te=te||1,ns.unshiftIndent(Q,Q.length+te,b,S,w)),E=[],Z=u.getLineContent(h),X=It(Z),J=X;if(f.shouldIncrease(h))J=x(J),X=x(X);else if(f.shouldIndentNextLine(h))J=x(J);h++;for(let Q=h;Q<=g;Q++){if(VD(u,Q))continue;let te=u.getLineContent(Q),re=It(te),le=J;if(f.shouldDecrease(Q,le))J=I(J),X=I(X);if(re!==J)E.push(Yt.replaceMove(new F(Q,1,Q,re.length+1),Av(J,S,w)));if(f.shouldIgnore(Q))continue;else if(f.shouldIncrease(Q,le))X=x(X),J=X;else if(f.shouldIndentNextLine(Q,le))J=x(J);else J=X}return E}function VD(u,n){if(!u.tokenization.isCheapToTokenize(n))return!1;return u.tokenization.getLineTokens(n).getStandardTokenType(0)===2}function Di(u,n){let h=0;for(let g=0;g<u.length;g++)if(u.charAt(g)==="\t")h+=n;else h++;return h}function Da(u,n,h){u=u<0?0:u;let g="";if(!h){let p=Math.floor(u/n);u=u%n;for(let f=0;f<p;f++)g+="\t"}for(let p=0;p<u;p++)g+=" ";return g}var KD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},zD=function(u,n){return function(h,g){n(h,g,u)}};class c_ extends U{static{this.ID="editor.action.indentationToSpaces"}constructor(){super({id:c_.ID,label:y(1204,"Convert Indentation to Spaces"),precondition:o.writable,metadata:{description:y(1205,"Convert the tab indentation to spaces.")}})}run(u,n){let h=n.getModel();if(!h)return;let g=h.getOptions(),p=n.getSelection();if(!p)return;let f=new BC(p,g.tabSize);n.pushUndoStop(),n.executeCommands(this.id,[f]),n.pushUndoStop(),h.updateOptions({insertSpaces:!0})}}class h_ extends U{static{this.ID="editor.action.indentationToTabs"}constructor(){super({id:h_.ID,label:y(1206,"Convert Indentation to Tabs"),precondition:o.writable,metadata:{description:y(1207,"Convert the spaces indentation to tabs.")}})}run(u,n){let h=n.getModel();if(!h)return;let g=h.getOptions(),p=n.getSelection();if(!p)return;let f=new VC(p,g.tabSize);n.pushUndoStop(),n.executeCommands(this.id,[f]),n.pushUndoStop(),h.updateOptions({insertSpaces:!1})}}class Uu extends U{constructor(u,n,h){super(h);this.insertSpaces=u,this.displaySizeOnly=n}run(u,n){let h=u.get(En),g=u.get(Et),p=n.getModel();if(!p)return;let f=g.getCreationOptions(p.getLanguageId(),p.uri,p.isForSimpleWidget),b=p.getOptions(),S=[1,2,3,4,5,6,7,8].map((x)=>({id:x.toString(),label:x.toString(),description:x===f.tabSize&&x===b.tabSize?e(1200,"Configured Tab Size"):x===f.tabSize?e(1201,"Default Tab Size"):x===b.tabSize?e(1202,"Current Tab Size"):void 0})),w=Math.min(p.getOptions().tabSize-1,7);setTimeout(()=>{h.pick(S,{placeHolder:e(1203,"Select Tab Size for Current File"),activeItem:S[w]}).then((x)=>{if(x){if(p&&!p.isDisposed()){let I=parseInt(x.label,10);if(this.displaySizeOnly)p.updateOptions({tabSize:I});else p.updateOptions({tabSize:I,indentSize:I,insertSpaces:this.insertSpaces})}}})},50)}}class u_ extends Uu{static{this.ID="editor.action.indentUsingTabs"}constructor(){super(!1,!1,{id:u_.ID,label:y(1208,"Indent Using Tabs"),precondition:void 0,metadata:{description:y(1209,"Use indentation with tabs.")}})}}class g_ extends Uu{static{this.ID="editor.action.indentUsingSpaces"}constructor(){super(!0,!1,{id:g_.ID,label:y(1210,"Indent Using Spaces"),precondition:void 0,metadata:{description:y(1211,"Use indentation with spaces.")}})}}class p_ extends Uu{static{this.ID="editor.action.changeTabDisplaySize"}constructor(){super(!0,!0,{id:p_.ID,label:y(1212,"Change Tab Display Size"),precondition:void 0,metadata:{description:y(1213,"Change the space size equivalent of the tab.")}})}}class m_ extends U{static{this.ID="editor.action.detectIndentation"}constructor(){super({id:m_.ID,label:y(1214,"Detect Indentation from Content"),precondition:void 0,metadata:{description:y(1215,"Detect the indentation from content.")}})}run(u,n){let h=u.get(Et),g=n.getModel();if(!g)return;let p=h.getCreationOptions(g.getLanguageId(),g.uri,g.isForSimpleWidget);g.detectIndentation(p.insertSpaces,p.tabSize)}}class AC extends U{constructor(){super({id:"editor.action.reindentlines",label:y(1216,"Reindent Lines"),precondition:o.writable,metadata:{description:y(1217,"Reindent the lines of the editor.")},canTriggerInlineEdits:!0})}run(u,n){let h=u.get(ht),g=n.getModel();if(!g)return;let p=l_(g,h,1,g.getLineCount());if(p.length>0)n.pushUndoStop(),n.executeEdits(this.id,p),n.pushUndoStop()}}class FC extends U{constructor(){super({id:"editor.action.reindentselectedlines",label:y(1218,"Reindent Selected Lines"),precondition:o.writable,metadata:{description:y(1219,"Reindent the selected lines of the editor.")},canTriggerInlineEdits:!0})}run(u,n){let h=u.get(ht),g=n.getModel();if(!g)return;let p=n.getSelections();if(p===null)return;let f=[];for(let b of p){let{startLineNumber:S,endLineNumber:w}=b;if(S!==w&&b.endColumn===1)w--;if(S===1){if(S===w)continue}else S--;let x=l_(g,h,S,w);f.push(...x)}if(f.length>0)n.pushUndoStop(),n.executeEdits(this.id,f),n.pushUndoStop()}}class HC{constructor(u,n){this._initialSelection=n,this._edits=[],this._selectionId=null;for(let h of u)if(h.range&&typeof h.text==="string")this._edits.push(h)}getEditOperations(u,n){for(let g of this._edits)n.addEditOperation(t.lift(g.range),g.text);let h=!1;if(Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()){if(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber)h=!0,this._selectionId=n.trackSelection(this._initialSelection,!0);else if(this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber)h=!0,this._selectionId=n.trackSelection(this._initialSelection,!1)}if(!h)this._selectionId=n.trackSelection(this._initialSelection)}computeCursorState(u,n){return n.getTrackedSelection(this._selectionId)}}var zu=class u{static{this.ID="editor.contrib.autoIndentOnPaste"}constructor(n,h){this.editor=n,this._languageConfigurationService=h,this.callOnDispose=new d,this.callOnModel=new d,this.callOnDispose.add(n.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(n.onDidChangeModel(()=>this.update())),this.callOnDispose.add(n.onDidChangeModelLanguage(()=>this.update()))}update(){if(this.callOnModel.clear(),!this.editor.getOption(17)||this.editor.getOption(16)<4)return;if(!this.editor.hasModel())return;this.callOnModel.add(this.editor.onDidPaste(({range:n})=>{this.trigger(n)}))}trigger(n){let h=this.editor.getSelections();if(h===null||h.length>1)return;let g=this.editor.getModel();if(!g)return;if(this.rangeContainsOnlyWhitespaceCharacters(g,n))return;if(!this.editor.getOption(18)&&UD(g,n))return;if(!g.tokenization.isCheapToTokenize(n.getStartPosition().lineNumber))return;let f=this.editor.getOption(16),{tabSize:b,indentSize:S,insertSpaces:w}=g.getOptions(),x=[],I={shiftIndent:(J)=>ns.shiftIndent(J,J.length+1,b,S,w),unshiftIndent:(J)=>ns.unshiftIndent(J,J.length+1,b,S,w)},E=n.startLineNumber,Z=g.getLineContent(E);if(!/\S/.test(Z.substring(0,n.startColumn-1))){let J=qg(f,g,g.getLanguageId(),E,I,this._languageConfigurationService);if(J!==null){let Q=It(Z),te=Di(J,b),re=Di(Q,b);if(te!==re){let le=Da(te,b,w);x.push({range:new t(E,1,E,Q.length+1),text:le}),Z=le+Z.substring(Q.length)}else{let le=Sk(g,E,this._languageConfigurationService);if(le===0||le===8)return}}}let X=E;while(E<n.endLineNumber){if(!/\S/.test(g.getLineContent(E+1))){E++;continue}break}if(E!==n.endLineNumber){let Q=qg(f,{tokenization:{getLineTokens:(te)=>g.tokenization.getLineTokens(te),getLanguageId:()=>g.getLanguageId(),getLanguageIdAtPosition:(te,re)=>g.getLanguageIdAtPosition(te,re)},getLineContent:(te)=>{if(te===X)return Z;else return g.getLineContent(te)}},g.getLanguageId(),E+1,I,this._languageConfigurationService);if(Q!==null){let te=Di(Q,b),re=Di(It(g.getLineContent(E+1)),b);if(te!==re){let le=te-re;for(let pe=E+1;pe<=n.endLineNumber;pe++){let Se=g.getLineContent(pe),we=It(Se),me=Di(we,b)+le,De=Da(me,b,w);if(De!==we)x.push({range:new t(pe,1,pe,we.length+1),text:De})}}}}if(x.length>0){this.editor.pushUndoStop();let J=new HC(x,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",J),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(n,h){let g=(f)=>f.trim().length===0,p=!0;if(h.startLineNumber===h.endLineNumber){let b=n.getLineContent(h.startLineNumber).substring(h.startColumn-1,h.endColumn-1);p=g(b)}else for(let f=h.startLineNumber;f<=h.endLineNumber;f++){let b=n.getLineContent(f);if(f===h.startLineNumber){let S=b.substring(h.startColumn-1);p=g(S)}else if(f===h.endLineNumber){let S=b.substring(0,h.endColumn-1);p=g(S)}else p=n.getLineFirstNonWhitespaceColumn(f)===0;if(!p)break}return p}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}};zu=KD([zD(1,ht)],zu);function UD(u,n){let h=(g)=>v2(u,g)===2;return h(n.getStartPosition())||h(n.getEndPosition())}function WC(u,n,h,g){if(u.getLineCount()===1&&u.getLineMaxColumn(1)===1)return;let p="";for(let b=0;b<h;b++)p+=" ";let f=new RegExp(p,"gi");for(let b=1,S=u.getLineCount();b<=S;b++){let w=u.getLineFirstNonWhitespaceColumn(b);if(w===0)w=u.getLineMaxColumn(b);if(w===1)continue;let x=new t(b,1,b,w),I=u.getValueInRange(x),E=g?I.replace(/\t/ig,p):I.replace(f,"\t");n.addEditOperation(x,E)}}class BC{constructor(u,n){this.selection=u,this.tabSize=n,this.selectionId=null}getEditOperations(u,n){this.selectionId=n.trackSelection(this.selection),WC(u,n,this.tabSize,!0)}computeCursorState(u,n){return n.getTrackedSelection(this.selectionId)}}class VC{constructor(u,n){this.selection=u,this.tabSize=n,this.selectionId=null}getEditOperations(u,n){this.selectionId=n.trackSelection(this.selection),WC(u,n,this.tabSize,!1)}computeCursorState(u,n){return n.getTrackedSelection(this.selectionId)}}fe(zu.ID,zu,2);A(c_);A(h_);A(u_);A(g_);A(p_);A(m_);A(AC);A(FC);class KC extends U{constructor(){super({id:"expandLineSelection",label:y(1309,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:o.textInputFocus,primary:2090}})}run(u,n,h){if(h=h||{},!n.hasModel())return;let g=n._getViewModel();g.model.pushStackElement(),g.setCursorStates(h.source,3,Fi.expandLineSelection(g,g.getCursorStates())),g.revealAllCursors(h.source,!0)}}A(KC);class f_{constructor(u,n,h){this._selection=u,this._cursors=n,this._selectionId=null,this._trimInRegexesAndStrings=h}getEditOperations(u,n){let h=$D(u,this._cursors,this._trimInRegexesAndStrings);for(let g=0,p=h.length;g<p;g++){let f=h[g];n.addEditOperation(f.range,f.text)}this._selectionId=n.trackSelection(this._selection)}computeCursorState(u,n){return n.getTrackedSelection(this._selectionId)}}function $D(u,n,h){n.sort((S,w)=>{if(S.lineNumber===w.lineNumber)return S.column-w.column;return S.lineNumber-w.lineNumber});for(let S=n.length-2;S>=0;S--)if(n[S].lineNumber===n[S+1].lineNumber)n.splice(S,1);let g=[],p=0,f=0,b=n.length;for(let S=1,w=u.getLineCount();S<=w;S++){let x=u.getLineContent(S),I=x.length+1,E=0;if(f<b&&n[f].lineNumber===S){if(E=n[f].column,f++,E===I)continue}if(x.length===0)continue;let Z=ho(x),X=0;if(Z===-1)X=1;else if(Z!==x.length-1)X=Z+2;else continue;if(!h){if(!u.tokenization.hasAccurateTokensForLine(S))continue;let J=u.tokenization.getLineTokens(S),Q=J.getStandardTokenType(J.findTokenIndexAtOffset(X));if(Q===2||Q===3)continue}X=Math.max(E,X),g[p++]=Yt.delete(new t(S,X,S,I))}return g}class ju{constructor(u,n,h){this._selection=u,this._isCopyingDown=n,this._noop=h||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(u,n){let h=this._selection;if(this._startLineNumberDelta=0,this._endLineNumberDelta=0,h.startLineNumber<h.endLineNumber&&h.endColumn===1)this._endLineNumberDelta=1,h=h.setEndPosition(h.endLineNumber-1,u.getLineMaxColumn(h.endLineNumber-1));let g=[];for(let f=h.startLineNumber;f<=h.endLineNumber;f++)g.push(u.getLineContent(f));let p=g.join(`
|
|
8
|
+
`);if(p===""){if(this._isCopyingDown)this._startLineNumberDelta++,this._endLineNumberDelta++}if(this._noop)n.addEditOperation(new t(h.endLineNumber,u.getLineMaxColumn(h.endLineNumber),h.endLineNumber+1,1),h.endLineNumber===u.getLineCount()?"":`
|
|
9
|
+
`);else if(!this._isCopyingDown)n.addEditOperation(new t(h.endLineNumber,u.getLineMaxColumn(h.endLineNumber),h.endLineNumber,u.getLineMaxColumn(h.endLineNumber)),`
|
|
10
|
+
`+p);else n.addEditOperation(new t(h.startLineNumber,1,h.startLineNumber,1),p+`
|
|
11
|
+
`);this._selectionId=n.trackSelection(h),this._selectionDirection=this._selection.getDirection()}computeCursorState(u,n){let h=n.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let g=h.startLineNumber,p=h.startColumn,f=h.endLineNumber,b=h.endColumn;if(this._startLineNumberDelta!==0)g=g+this._startLineNumberDelta,p=1;if(this._endLineNumberDelta!==0)f=f+this._endLineNumberDelta,b=1;h=F.createWithDirection(g,p,f,b,this._selectionDirection)}return h}}var jD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},GD=function(u,n){return function(h,g){n(h,g,u)}},Gu=class u{constructor(n,h,g,p){this._languageConfigurationService=p,this._selection=n,this._isMovingDown=h,this._autoIndent=g,this._selectionId=null,this._moveEndLineSelectionShrink=!1}createVirtualModel(n,h,g){return{tokenization:{getLineTokens:(p)=>n.tokenization.getLineTokens(h(p)),getLanguageId:()=>n.getLanguageId(),getLanguageIdAtPosition:(p,f)=>n.getLanguageIdAtPosition(p,f)},getLineContent:(p)=>{let f=g?.(p);if(f!==void 0)return f;return n.getLineContent(h(p))}}}getEditOperations(n,h){let g=n.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===g){this._selectionId=h.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=h.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let p=this._selection;if(p.startLineNumber<p.endLineNumber&&p.endColumn===1)this._moveEndPositionDown=!0,p=p.setEndPosition(p.endLineNumber-1,n.getLineMaxColumn(p.endLineNumber-1));let{tabSize:f,indentSize:b,insertSpaces:S}=n.getOptions(),w=this.buildIndentConverter(f,b,S);if(p.startLineNumber===p.endLineNumber&&n.getLineMaxColumn(p.startLineNumber)===1){let x=p.startLineNumber,I=this._isMovingDown?x+1:x-1;if(n.getLineMaxColumn(I)===1)h.addEditOperation(new t(1,1,1,1),null);else h.addEditOperation(new t(x,1,x,1),n.getLineContent(I)),h.addEditOperation(new t(I,1,I,n.getLineMaxColumn(I)),null);p=new F(I,1,I,1)}else{let x,I;if(this._isMovingDown){x=p.endLineNumber+1,I=n.getLineContent(x),h.addEditOperation(new t(x-1,n.getLineMaxColumn(x-1),x,n.getLineMaxColumn(x)),null);let E=I;if(this.shouldAutoIndent(n,p)){let Z=this.matchEnterRule(n,w,f,x,p.startLineNumber-1);if(Z!==null){let J=It(n.getLineContent(x)),Q=Z+Di(J,f);E=Da(Q,f,S)+this.trimStart(I)}else{let J=this.createVirtualModel(n,(te)=>te===p.startLineNumber?x:te),Q=qg(this._autoIndent,J,n.getLanguageIdAtPosition(x,1),p.startLineNumber,w,this._languageConfigurationService);if(Q!==null){let te=It(n.getLineContent(x)),re=Di(Q,f),le=Di(te,f);if(re!==le)E=Da(re,f,S)+this.trimStart(I)}}h.addEditOperation(new t(p.startLineNumber,1,p.startLineNumber,1),E+`
|
|
12
|
+
`);let X=this.matchEnterRuleMovingDown(n,w,f,p.startLineNumber,x,E);if(X!==null){if(X!==0)this.getIndentEditsOfMovingBlock(n,h,p,f,S,X)}else{let J=this.createVirtualModel(n,(te)=>{if(te===p.startLineNumber)return x;else if(te>=p.startLineNumber+1&&te<=p.endLineNumber+1)return te-1;else return te},(te)=>te===p.startLineNumber?E:void 0),Q=qg(this._autoIndent,J,n.getLanguageIdAtPosition(x,1),p.startLineNumber+1,w,this._languageConfigurationService);if(Q!==null){let te=It(n.getLineContent(p.startLineNumber)),re=Di(Q,f),le=Di(te,f);if(re!==le){let pe=re-le;this.getIndentEditsOfMovingBlock(n,h,p,f,S,pe)}}}}else h.addEditOperation(new t(p.startLineNumber,1,p.startLineNumber,1),E+`
|
|
13
|
+
`)}else if(x=p.startLineNumber-1,I=n.getLineContent(x),h.addEditOperation(new t(x,1,x+1,1),null),h.addEditOperation(new t(p.endLineNumber,n.getLineMaxColumn(p.endLineNumber),p.endLineNumber,n.getLineMaxColumn(p.endLineNumber)),`
|
|
14
|
+
`+I),this.shouldAutoIndent(n,p)){let E=this.createVirtualModel(n,(X)=>X===x?p.startLineNumber:X),Z=this.matchEnterRule(n,w,f,p.startLineNumber,p.startLineNumber-2);if(Z!==null){if(Z!==0)this.getIndentEditsOfMovingBlock(n,h,p,f,S,Z)}else{let X=qg(this._autoIndent,E,n.getLanguageIdAtPosition(p.startLineNumber,1),x,w,this._languageConfigurationService);if(X!==null){let J=It(n.getLineContent(p.startLineNumber)),Q=Di(X,f),te=Di(J,f);if(Q!==te){let re=Q-te;this.getIndentEditsOfMovingBlock(n,h,p,f,S,re)}}}}}this._selectionId=h.trackSelection(p)}buildIndentConverter(n,h,g){return{shiftIndent:(p)=>ns.shiftIndent(p,p.length+1,n,h,g),unshiftIndent:(p)=>ns.unshiftIndent(p,p.length+1,n,h,g)}}parseEnterResult(n,h,g,p,f){if(f){let b=f.indentation;if(f.indentAction===si.None)b=f.indentation+f.appendText;else if(f.indentAction===si.Indent)b=f.indentation+f.appendText;else if(f.indentAction===si.IndentOutdent)b=f.indentation;else if(f.indentAction===si.Outdent)b=h.unshiftIndent(f.indentation)+f.appendText;let S=n.getLineContent(p);if(this.trimStart(S).indexOf(this.trimStart(b))>=0){let w=It(n.getLineContent(p)),x=It(b),I=Sk(n,p,this._languageConfigurationService);if(I!==null&&I&2)x=h.unshiftIndent(x);let E=Di(x,g),Z=Di(w,g);return E-Z}}return null}matchEnterRuleMovingDown(n,h,g,p,f,b){if(ho(b)>=0){let S=n.getLineMaxColumn(f),w=op(this._autoIndent,n,new t(f,S,f,S),this._languageConfigurationService);return this.parseEnterResult(n,h,g,p,w)}else{let S=p-1;while(S>=1){let I=n.getLineContent(S);if(ho(I)>=0)break;S--}if(S<1||p>n.getLineCount())return null;let w=n.getLineMaxColumn(S),x=op(this._autoIndent,n,new t(S,w,S,w),this._languageConfigurationService);return this.parseEnterResult(n,h,g,p,x)}}matchEnterRule(n,h,g,p,f,b){let S=f;while(S>=1){let I;if(S===f&&b!==void 0)I=b;else I=n.getLineContent(S);if(ho(I)>=0)break;S--}if(S<1||p>n.getLineCount())return null;let w=n.getLineMaxColumn(S),x=op(this._autoIndent,n,new t(S,w,S,w),this._languageConfigurationService);return this.parseEnterResult(n,h,g,p,x)}trimStart(n){return n.replace(/^\s+/,"")}shouldAutoIndent(n,h){if(this._autoIndent<4)return!1;if(!n.tokenization.isCheapToTokenize(h.startLineNumber))return!1;let g=n.getLanguageIdAtPosition(h.startLineNumber,1),p=n.getLanguageIdAtPosition(h.endLineNumber,1);if(g!==p)return!1;if(this._languageConfigurationService.getLanguageConfiguration(g).indentRulesSupport===null)return!1;return!0}getIndentEditsOfMovingBlock(n,h,g,p,f,b){for(let S=g.startLineNumber;S<=g.endLineNumber;S++){let w=n.getLineContent(S),x=It(w),E=Di(x,p)+b,Z=Da(E,p,f);if(Z!==x){if(h.addEditOperation(new t(S,1,S,x.length+1),Z),S===g.endLineNumber&&g.endColumn<=x.length+1&&Z==="")this._moveEndLineSelectionShrink=!0}}}computeCursorState(n,h){let g=h.getTrackedSelection(this._selectionId);if(this._moveEndPositionDown)g=g.setEndPosition(g.endLineNumber+1,1);if(this._moveEndLineSelectionShrink&&g.startLineNumber<g.endLineNumber)g=g.setEndPosition(g.endLineNumber,2);return g}};Gu=jD([GD(3,ht)],Gu);class dc{static{this._COLLATOR=_c.Collator()}constructor(u,n){this.selection=u,this.descending=n,this.selectionId=null}getEditOperations(u,n){let h=qD(u,this.selection,this.descending);if(h)n.addEditOperation(h.range,h.text);this.selectionId=n.trackSelection(this.selection)}computeCursorState(u,n){return n.getTrackedSelection(this.selectionId)}static canRun(u,n,h){if(u===null)return!1;let g=zC(u,n,h);if(!g)return!1;for(let p=0,f=g.before.length;p<f;p++)if(g.before[p]!==g.after[p])return!0;return!1}}function zC(u,n,h){let{startLineNumber:g,endLineNumber:p}=n;if(n.endColumn===1)p--;if(g>=p)return null;let f=[];for(let S=g;S<=p;S++)f.push(u.getLineContent(S));let b=f.slice(0);if(b.sort(dc._COLLATOR.value.compare),h===!0)b=b.reverse();return{startLineNumber:g,endLineNumber:p,before:f,after:b}}function qD(u,n,h){let g=zC(u,n,h);if(!g)return null;return Yt.replace(new t(g.startLineNumber,1,g.endLineNumber,u.getLineMaxColumn(g.endLineNumber)),g.after.join(`
|
|
15
|
+
`))}class __ extends U{constructor(u,n){super(n);this.down=u}run(u,n){if(!n.hasModel())return;let h=n.getSelections().map((f,b)=>({selection:f,index:b,ignore:!1}));h.sort((f,b)=>t.compareRangesUsingStarts(f.selection,b.selection));let g=h[0];for(let f=1;f<h.length;f++){let b=h[f];if(g.selection.endLineNumber===b.selection.startLineNumber)if(g.index<b.index)b.ignore=!0;else g.ignore=!0,g=b}let p=[];for(let f of h)p.push(new ju(f.selection,this.down,f.ignore));n.pushUndoStop(),n.executeCommands(this.id,p),n.pushUndoStop()}}class UC extends __{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:y(1315,"Copy Line Up"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"2_line",title:e(1310,"&&Copy Line Up"),order:1},canTriggerInlineEdits:!0})}}class $C extends __{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:y(1316,"Copy Line Down"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"2_line",title:e(1311,"Co&&py Line Down"),order:2},canTriggerInlineEdits:!0})}}class jC extends U{constructor(){super({id:"editor.action.duplicateSelection",label:y(1317,"Duplicate Selection"),precondition:o.writable,menuOpts:{menuId:l.MenubarSelectionMenu,group:"2_line",title:e(1312,"&&Duplicate Selection"),order:5},canTriggerInlineEdits:!0})}run(u,n,h){if(!n.hasModel())return;let g=[],p=n.getSelections(),f=n.getModel();for(let b of p)if(b.isEmpty())g.push(new ju(b,!0));else{let S=new F(b.endLineNumber,b.endColumn,b.endLineNumber,b.endColumn);g.push(new UI(S,f.getValueInRange(b)))}n.pushUndoStop(),n.executeCommands(this.id,g),n.pushUndoStop()}}class b_ extends U{constructor(u,n){super(n);this.down=u}run(u,n){let h=u.get(ht),g=[],p=n.getSelections()||[],f=n.getOption(16);for(let b of p)g.push(new Gu(b,this.down,f,h));n.pushUndoStop(),n.executeCommands(this.id,g),n.pushUndoStop()}}class GC extends b_{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:y(1318,"Move Line Up"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"2_line",title:e(1313,"Mo&&ve Line Up"),order:3},canTriggerInlineEdits:!0})}}class qC extends b_{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:y(1319,"Move Line Down"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"2_line",title:e(1314,"Move &&Line Down"),order:4},canTriggerInlineEdits:!0})}}class v_ extends U{constructor(u,n){super(n);this.descending=u}run(u,n){if(!n.hasModel())return;let h=n.getModel(),g=n.getSelections();if(g.length===1&&g[0].isSingleLine())g=[new F(1,1,h.getLineCount(),h.getLineMaxColumn(h.getLineCount()))];for(let f of g)if(!dc.canRun(n.getModel(),f,this.descending))return;let p=[];for(let f=0,b=g.length;f<b;f++)p[f]=new dc(g[f],this.descending);n.pushUndoStop(),n.executeCommands(this.id,p),n.pushUndoStop()}}class ZC extends v_{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:y(1320,"Sort Lines Ascending"),precondition:o.writable,canTriggerInlineEdits:!0})}}class XC extends v_{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:y(1321,"Sort Lines Descending"),precondition:o.writable,canTriggerInlineEdits:!0})}}class YC extends U{constructor(){super({id:"editor.action.removeDuplicateLines",label:y(1322,"Delete Duplicate Lines"),precondition:o.writable,canTriggerInlineEdits:!0})}run(u,n){if(!n.hasModel())return;let h=n.getModel();if(h.getLineCount()===1&&h.getLineMaxColumn(1)===1)return;let g=[],p=[],f=0,b=!0,S=n.getSelections();if(S.length===1&&S[0].isSingleLine())S=[new F(1,1,h.getLineCount(),h.getLineMaxColumn(h.getLineCount()))],b=!1;for(let w of S){let x=new Set,I=[];for(let J=w.startLineNumber;J<=w.endLineNumber;J++){let Q=h.getLineContent(J);if(x.has(Q))continue;I.push(Q),x.add(Q)}let E=new F(w.startLineNumber,1,w.endLineNumber,h.getLineMaxColumn(w.endLineNumber)),Z=w.startLineNumber-f,X=new F(Z,1,Z+I.length-1,I[I.length-1].length+1);g.push(Yt.replace(E,I.join(`
|
|
16
|
+
`))),p.push(X),f+=w.endLineNumber-w.startLineNumber+1-I.length}n.pushUndoStop(),n.executeEdits(this.id,g,b?p:void 0),n.pushUndoStop()}}class JC extends U{constructor(){super({id:"editor.action.reverseLines",label:y(1323,"Reverse lines"),precondition:o.writable,canTriggerInlineEdits:!0})}run(u,n){if(!n.hasModel())return;let h=n.getModel(),g=n.getSelections(),p=g;if(p.length===1&&p[0].isSingleLine())p=[new F(1,1,h.getLineCount(),h.getLineMaxColumn(h.getLineCount()))];let f=[],b=[];for(let S=0;S<p.length;S++){let w=p[S],x=g[S],I=w.endLineNumber;if(w.startLineNumber<w.endLineNumber&&w.endColumn===1)I--;let E=new t(w.startLineNumber,1,I,h.getLineMaxColumn(I));if(I===h.getLineCount()&&h.getLineContent(E.endLineNumber)==="")E=E.setEndPosition(E.endLineNumber-1,h.getLineMaxColumn(E.endLineNumber-1));let Z=[];for(let te=E.endLineNumber;te>=E.startLineNumber;te--)Z.push(h.getLineContent(te));let X=Yt.replace(E,Z.join(`
|
|
17
|
+
`));f.push(X);let J=function(te){return te<=E.endLineNumber?E.endLineNumber-te+E.startLineNumber:te},Q=function(te){if(te.isEmpty())return new F(J(te.positionLineNumber),te.positionColumn,J(te.positionLineNumber),te.positionColumn);else{let re=J(te.selectionStartLineNumber),le=J(te.positionLineNumber),{selectionStartColumn:pe,positionColumn:Se}=te;return new F(re,pe,le,Se)}};b.push(Q(x))}n.pushUndoStop(),n.executeEdits(this.id,f,b),n.pushUndoStop()}}class S_ extends U{static{this.ID="editor.action.trimTrailingWhitespace"}constructor(){super({id:S_.ID,label:y(1324,"Trim Trailing Whitespace"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2102),weight:100}})}run(u,n,h){let g=[];if(h.reason==="auto-save")g=(n.getSelections()||[]).map((x)=>new s(x.positionLineNumber,x.positionColumn));let p=n.getSelection();if(p===null)return;let f=u.get(oe),b=n.getModel(),S=f.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:b?.getLanguageId(),resource:b?.uri}),w=new f_(p,g,S);n.pushUndoStop(),n.executeCommands(this.id,[w]),n.pushUndoStop()}}class QC extends U{constructor(){super({id:"editor.action.deleteLines",label:y(1325,"Delete Line"),precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:3113,weight:100},canTriggerInlineEdits:!0})}run(u,n){if(!n.hasModel())return;let h=this._getLinesToRemove(n),g=n.getModel();if(g.getLineCount()===1&&g.getLineMaxColumn(1)===1)return;let p=0,f=[],b=[];for(let S=0,w=h.length;S<w;S++){let x=h[S],{startLineNumber:I,endLineNumber:E}=x,Z=1,X=g.getLineMaxColumn(E);if(E<g.getLineCount())E+=1,X=1;else if(I>1)I-=1,Z=g.getLineMaxColumn(I);f.push(Yt.replace(new F(I,Z,E,X),"")),b.push(new F(I-p,x.positionColumn,I-p,x.positionColumn)),p+=x.endLineNumber-x.startLineNumber+1}n.pushUndoStop(),n.executeEdits(this.id,f,b),n.revealAllCursors(!0),n.pushUndoStop()}_getLinesToRemove(u){let n=u.getSelections().map((p)=>{let f=p.endLineNumber;if(p.startLineNumber<p.endLineNumber&&p.endColumn===1)f-=1;return{startLineNumber:p.startLineNumber,selectionStartColumn:p.selectionStartColumn,endLineNumber:f,positionColumn:p.positionColumn}});n.sort((p,f)=>{if(p.startLineNumber===f.startLineNumber)return p.endLineNumber-f.endLineNumber;return p.startLineNumber-f.startLineNumber});let h=[],g=n[0];for(let p=1;p<n.length;p++)if(g.endLineNumber+1>=n[p].startLineNumber)g.endLineNumber=n[p].endLineNumber;else h.push(g),g=n[p];return h.push(g),h}}class ey extends U{constructor(){super({id:"editor.action.indentLines",label:y(1326,"Indent Line"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:2142,weight:100},canTriggerInlineEdits:!0})}run(u,n){let h=n._getViewModel();if(!h)return;n.pushUndoStop(),n.executeCommands(this.id,kc.indent(h.cursorConfig,n.getModel(),n.getSelections())),n.pushUndoStop()}}class ty extends U{constructor(){super({id:"editor.action.outdentLines",label:y(1327,"Outdent Line"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:2140,weight:100},canTriggerInlineEdits:!0})}run(u,n){Yf.Outdent.runEditorCommand(u,n,null)}}class lc extends U{static{this.ID="editor.action.insertLineBefore"}constructor(){super({id:lc.ID,label:y(1328,"Insert Line Above"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:3075,weight:100},canTriggerInlineEdits:!0})}run(u,n){let h=n._getViewModel();if(!h)return;n.pushUndoStop(),n.executeCommands(this.id,Gf.lineInsertBefore(h.cursorConfig,n.getModel(),n.getSelections()))}}class cc extends U{static{this.ID="editor.action.insertLineAfter"}constructor(){super({id:cc.ID,label:y(1329,"Insert Line Below"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:2051,weight:100},canTriggerInlineEdits:!0})}run(u,n){let h=n._getViewModel();if(!h)return;n.pushUndoStop(),n.executeCommands(this.id,Gf.lineInsertAfter(h.cursorConfig,n.getModel(),n.getSelections()))}}class w_ extends U{run(u,n){if(!n.hasModel())return;let h=n.getSelection(),g=this._getRangesToDelete(n),p=[];for(let S=0,w=g.length-1;S<w;S++){let x=g[S],I=g[S+1];if(t.intersectRanges(x,I)===null)p.push(x);else g[S+1]=t.plusRange(x,I)}p.push(g[g.length-1]);let f=this._getEndCursorState(h,p),b=p.map((S)=>Yt.replace(S,""));n.pushUndoStop(),n.executeEdits(this.id,b,f),n.pushUndoStop()}}class iy extends w_{constructor(){super({id:"deleteAllLeft",label:y(1330,"Delete All Left"),precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:2049},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(u,n){let h=null,g=[],p=0;if(n.forEach((f)=>{let b;if(f.endColumn===1&&p>0){let S=f.startLineNumber-p;b=new F(S,f.startColumn,S,f.startColumn)}else b=new F(f.startLineNumber,f.startColumn,f.startLineNumber,f.startColumn);if(p+=f.endLineNumber-f.startLineNumber,f.intersectRanges(u))h=b;else g.push(b)}),h)g.unshift(h);return g}_getRangesToDelete(u){let n=u.getSelections();if(n===null)return[];let h=n,g=u.getModel();if(g===null)return[];return h.sort(t.compareRangesUsingStarts),h=h.map((p)=>{if(p.isEmpty())if(p.startColumn===1){let f=Math.max(1,p.startLineNumber-1),b=p.startLineNumber===1?1:g.getLineLength(f)+1;return new t(f,b,p.startLineNumber,1)}else return new t(p.startLineNumber,1,p.startLineNumber,p.startColumn);else return new t(p.startLineNumber,1,p.endLineNumber,p.endColumn)}),h}}class oy extends w_{constructor(){super({id:"deleteAllRight",label:y(1331,"Delete All Right"),precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100},canTriggerInlineEdits:!0})}_getEndCursorState(u,n){let h=null,g=[];for(let p=0,f=n.length,b=0;p<f;p++){let S=n[p],w=new F(S.startLineNumber-b,S.startColumn,S.startLineNumber-b,S.startColumn);if(S.intersectRanges(u))h=w;else g.push(w)}if(h)g.unshift(h);return g}_getRangesToDelete(u){let n=u.getModel();if(n===null)return[];let h=u.getSelections();if(h===null)return[];let g=h.map((p)=>{if(p.isEmpty()){let f=n.getLineMaxColumn(p.startLineNumber);if(p.startColumn===f)return new t(p.startLineNumber,p.startColumn,p.startLineNumber+1,1);else return new t(p.startLineNumber,p.startColumn,p.startLineNumber,f)}return p});return g.sort(t.compareRangesUsingStarts),g}}class ny extends U{constructor(){super({id:"editor.action.joinLines",label:y(1332,"Join Lines"),precondition:o.writable,kbOpts:{kbExpr:o.editorTextFocus,primary:0,mac:{primary:296},weight:100},canTriggerInlineEdits:!0})}run(u,n){let h=n.getSelections();if(h===null)return;let g=n.getSelection();if(g===null)return;h.sort(t.compareRangesUsingStarts);let p=[],f=h.reduce((E,Z)=>{if(E.isEmpty()){if(E.endLineNumber===Z.startLineNumber){if(g.equalsSelection(E))g=Z;return Z}if(Z.startLineNumber>E.endLineNumber+1)return p.push(E),Z;else return new F(E.startLineNumber,E.startColumn,Z.endLineNumber,Z.endColumn)}else if(Z.startLineNumber>E.endLineNumber)return p.push(E),Z;else return new F(E.startLineNumber,E.startColumn,Z.endLineNumber,Z.endColumn)});p.push(f);let b=n.getModel();if(b===null)return;let S=[],w=[],x=g,I=0;for(let E=0,Z=p.length;E<Z;E++){let X=p[E],J=X.startLineNumber,Q=1,te=0,re,le,pe=b.getLineLength(X.endLineNumber)-X.endColumn;if(X.isEmpty()||X.startLineNumber===X.endLineNumber){let ae=X.getStartPosition();if(ae.lineNumber<b.getLineCount())re=J+1,le=b.getLineMaxColumn(re);else re=ae.lineNumber,le=b.getLineMaxColumn(ae.lineNumber)}else re=X.endLineNumber,le=b.getLineMaxColumn(re);let Se=b.getLineContent(J);for(let ae=J+1;ae<=re;ae++){let me=b.getLineContent(ae),De=b.getLineFirstNonWhitespaceColumn(ae);if(De>=1){let Oe=!0;if(Se==="")Oe=!1;if(Oe&&(Se.charAt(Se.length-1)===" "||Se.charAt(Se.length-1)==="\t"))Oe=!1,Se=Se.replace(/[\s\uFEFF\xA0]+$/g," ");let Me=me.substr(De-1);if(Se+=(Oe?" ":"")+Me,Oe)te=Me.length+1;else te=Me.length}else te=0}let we=new t(J,1,re,le);if(!we.isEmpty()){let ae;if(X.isEmpty())S.push(Yt.replace(we,Se)),ae=new F(we.startLineNumber-I,Se.length-te+1,J-I,Se.length-te+1);else if(X.startLineNumber===X.endLineNumber)S.push(Yt.replace(we,Se)),ae=new F(X.startLineNumber-I,X.startColumn,X.endLineNumber-I,X.endColumn);else S.push(Yt.replace(we,Se)),ae=new F(X.startLineNumber-I,X.startColumn,X.startLineNumber-I,Se.length-pe);if(t.intersectRanges(we,g)!==null)x=ae;else w.push(ae)}I+=we.endLineNumber-we.startLineNumber}w.unshift(x),n.pushUndoStop(),n.executeEdits(this.id,S,w),n.pushUndoStop()}}class ry extends U{constructor(){super({id:"editor.action.transpose",label:y(1333,"Transpose Characters around the Cursor"),precondition:o.writable,canTriggerInlineEdits:!0})}run(u,n){let h=n.getSelections();if(h===null)return;let g=n.getModel();if(g===null)return;let p=[];for(let f=0,b=h.length;f<b;f++){let S=h[f];if(!S.isEmpty())continue;let w=S.getStartPosition(),x=g.getLineMaxColumn(w.lineNumber);if(w.column>=x){if(w.lineNumber===g.getLineCount())continue;let I=new t(w.lineNumber,Math.max(1,w.column-1),w.lineNumber+1,1),E=g.getValueInRange(I).split("").reverse().join("");p.push(new Ti(new F(w.lineNumber,Math.max(1,w.column-1),w.lineNumber+1,1),E))}else{let I=new t(w.lineNumber,Math.max(1,w.column-1),w.lineNumber,w.column+1),E=g.getValueInRange(I).split("").reverse().join("");p.push(new Ug(I,E,new F(w.lineNumber,w.column+1,w.lineNumber,w.column+1)))}}n.pushUndoStop(),n.executeCommands(this.id,p),n.pushUndoStop()}}class us extends U{run(u,n){let h=n.getSelections();if(h===null)return;let g=n.getModel();if(g===null)return;let p=n.getOption(148),f=[];for(let b of h)if(b.isEmpty()){let S=b.getStartPosition(),w=n.getConfiguredWordAtPosition(S);if(!w)continue;let x=new t(S.lineNumber,w.startColumn,S.lineNumber,w.endColumn),I=g.getValueInRange(x);f.push(Yt.replace(x,this._modifyText(I,p)))}else{let S=g.getValueInRange(b);f.push(Yt.replace(b,this._modifyText(S,p)))}n.pushUndoStop(),n.executeEdits(this.id,f),n.pushUndoStop()}}class sy extends us{constructor(){super({id:"editor.action.transformToUppercase",label:y(1334,"Transform to Uppercase"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){return u.toLocaleUpperCase()}}class ay extends us{constructor(){super({id:"editor.action.transformToLowercase",label:y(1335,"Transform to Lowercase"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){return u.toLocaleLowerCase()}}class Co{constructor(u,n){this._pattern=u,this._flags=n,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch(u){}}return this._actual}isSupported(){return this.get()!==null}}class qu extends us{static{this.titleBoundary=new Co("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu")}constructor(){super({id:"editor.action.transformToTitlecase",label:y(1336,"Transform to Title Case"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){let h=qu.titleBoundary.get();if(!h)return u;return u.toLocaleLowerCase().replace(h,(g)=>g.toLocaleUpperCase())}}class Bd extends us{static{this.caseBoundary=new Co("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new Co("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu")}constructor(){super({id:"editor.action.transformToSnakecase",label:y(1337,"Transform to Snake Case"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){let h=Bd.caseBoundary.get(),g=Bd.singleLetters.get();if(!h||!g)return u;return u.replace(h,"$1_$2").replace(g,"$1_$2$3").toLocaleLowerCase()}}class Ra extends us{static{this.singleLineWordBoundary=new Co("[_\\s-]+","gm")}static{this.multiLineWordBoundary=new Co("[_-]+","gm")}static{this.validWordStart=new Co("^(\\p{Lu}[^\\p{Lu}])","gmu")}constructor(){super({id:"editor.action.transformToCamelcase",label:y(1338,"Transform to Camel Case"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){let h=/\r\n|\r|\n/.test(u)?Ra.multiLineWordBoundary.get():Ra.singleLineWordBoundary.get(),g=Ra.validWordStart.get();if(!h||!g)return u;let p=u.split(h);return p.shift()?.replace(g,(b)=>b.toLocaleLowerCase())+p.map((b)=>b.substring(0,1).toLocaleUpperCase()+b.substring(1)).join("")}}class Vd extends us{static{this.wordBoundary=new Co("[_ \\t-]","gm")}static{this.wordBoundaryToMaintain=new Co("(?<=\\.)","gm")}static{this.upperCaseWordMatcher=new Co("^\\p{Lu}+$","mu")}constructor(){super({id:"editor.action.transformToPascalcase",label:y(1339,"Transform to Pascal Case"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){let h=Vd.wordBoundary.get(),g=Vd.wordBoundaryToMaintain.get(),p=Vd.upperCaseWordMatcher.get();if(!h||!g||!p)return u;return u.split(g).map((S)=>S.split(h)).flat().map((S)=>{let w=S.charAt(0).toLocaleUpperCase()+S.slice(1);if(w.length>1&&p.test(w))return w.charAt(0)+w.slice(1).toLocaleLowerCase();return w}).join("")}}class Kd extends us{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every((n)=>n.isSupported())}static{this.caseBoundary=new Co("(\\p{Ll})(\\p{Lu})","gmu")}static{this.singleLetters=new Co("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu")}static{this.underscoreBoundary=new Co("(\\S)(_)(\\S)","gm")}constructor(){super({id:"editor.action.transformToKebabcase",label:y(1340,"Transform to Kebab Case"),precondition:o.writable,canTriggerInlineEdits:!0})}_modifyText(u,n){let h=Kd.caseBoundary.get(),g=Kd.singleLetters.get(),p=Kd.underscoreBoundary.get();if(!h||!g||!p)return u;return u.replace(p,"$1-$3").replace(h,"$1-$2").replace(g,"$1-$2").toLocaleLowerCase()}}A(UC);A($C);A(jC);A(GC);A(qC);A(ZC);A(XC);A(YC);A(S_);A(QC);A(ey);A(ty);A(lc);A(cc);A(iy);A(oy);A(ny);A(ry);A(sy);A(ay);A(JC);if(Bd.caseBoundary.isSupported()&&Bd.singleLetters.isSupported())A(Bd);if(Ra.singleLineWordBoundary.isSupported()&&Ra.multiLineWordBoundary.isSupported())A(Ra);if(Vd.wordBoundary.isSupported())A(Vd);if(qu.titleBoundary.isSupported())A(qu);if(Kd.isSupported())A(Kd);class so{constructor(u){this._editor=u,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(){if(this._findScopeDecorationIds[0])return this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]);return null}getFindScopes(){if(this._findScopeDecorationIds.length){let u=this._findScopeDecorationIds.map((n)=>this._editor.getModel().getDecorationRange(n)).filter((n)=>!!n);if(u.length)return u}return null}getStartPosition(){return this._startPosition}setStartPosition(u){this._startPosition=u,this.setCurrentFindMatch(null)}_getDecorationIndex(u){let n=this._decorations.indexOf(u);if(n>=0)return n+1;return 1}getDecorationRangeAt(u){let n=u<this._decorations.length?this._decorations[u]:null;if(n)return this._editor.getModel().getDecorationRange(n);return null}getCurrentMatchesPosition(u){let n=this._editor.getModel().getDecorationsInRange(u);for(let h of n){let g=h.options;if(g===so._FIND_MATCH_DECORATION||g===so._FIND_MATCH_NO_OVERVIEW_DECORATION||g===so._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(h.id)}return 0}setCurrentFindMatch(u){let n=null,h=0;if(u)for(let g=0,p=this._decorations.length;g<p;g++){let f=this._editor.getModel().getDecorationRange(this._decorations[g]);if(u.equalsRange(f)){n=this._decorations[g],h=g+1;break}}if(this._highlightedDecorationId!==null||n!==null)this._editor.changeDecorations((g)=>{if(this._highlightedDecorationId!==null)g.changeDecorationOptions(this._highlightedDecorationId,so._FIND_MATCH_DECORATION),this._highlightedDecorationId=null;if(n!==null)this._highlightedDecorationId=n,g.changeDecorationOptions(this._highlightedDecorationId,so._CURRENT_FIND_MATCH_DECORATION);if(this._rangeHighlightDecorationId!==null)g.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null;if(n!==null){let p=this._editor.getModel().getDecorationRange(n);if(p.startLineNumber!==p.endLineNumber&&p.endColumn===1){let f=p.endLineNumber-1,b=this._editor.getModel().getLineMaxColumn(f);p=new t(p.startLineNumber,p.startColumn,f,b)}this._rangeHighlightDecorationId=g.addDecoration(p,so._RANGE_HIGHLIGHT_DECORATION)}});return h}set(u,n){this._editor.changeDecorations((h)=>{let g=so._FIND_MATCH_DECORATION,p=[];if(u.length>1000){g=so._FIND_MATCH_NO_OVERVIEW_DECORATION;let b=this._editor.getModel().getLineCount(),w=this._editor.getLayoutInfo().height/b,x=Math.max(2,Math.ceil(3/w)),I=u[0].range.startLineNumber,E=u[0].range.endLineNumber;for(let Z=1,X=u.length;Z<X;Z++){let J=u[Z].range;if(E+x>=J.startLineNumber){if(J.endLineNumber>E)E=J.endLineNumber}else p.push({range:new t(I,1,E,1),options:so._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),I=J.startLineNumber,E=J.endLineNumber}p.push({range:new t(I,1,E,1),options:so._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}let f=Array(u.length);for(let b=0,S=u.length;b<S;b++)f[b]={range:u[b].range,options:g};if(this._decorations=h.deltaDecorations(this._decorations,f),this._overviewRulerApproximateDecorations=h.deltaDecorations(this._overviewRulerApproximateDecorations,p),this._rangeHighlightDecorationId)h.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null;if(this._findScopeDecorationIds.length)this._findScopeDecorationIds.forEach((b)=>h.removeDecoration(b)),this._findScopeDecorationIds=[];if(n?.length)this._findScopeDecorationIds=n.map((b)=>h.addDecoration(b,so._FIND_SCOPE_DECORATION))})}matchBeforePosition(u){if(this._decorations.length===0)return null;for(let n=this._decorations.length-1;n>=0;n--){let h=this._decorations[n],g=this._editor.getModel().getDecorationRange(h);if(!g||g.endLineNumber>u.lineNumber)continue;if(g.endLineNumber<u.lineNumber)return g;if(g.endColumn>u.column)continue;return g}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(u){if(this._decorations.length===0)return null;for(let n=0,h=this._decorations.length;n<h;n++){let g=this._decorations[n],p=this._editor.getModel().getDecorationRange(g);if(!p||p.startLineNumber<u.lineNumber)continue;if(p.startLineNumber>u.lineNumber)return p;if(p.startColumn<u.column)continue;return p}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let u=[];if(u=u.concat(this._decorations),u=u.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length)u.push(...this._findScopeDecorationIds);if(this._rangeHighlightDecorationId)u.push(this._rangeHighlightDecorationId);return u}static{this._CURRENT_FIND_MATCH_DECORATION=ue.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:bn(yk),position:Yr.Center},minimap:{color:bn(c0),position:1}})}static{this._FIND_MATCH_DECORATION=ue.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:bn(yk),position:Yr.Center},minimap:{color:bn(c0),position:1}})}static{this._FIND_MATCH_NO_OVERVIEW_DECORATION=ue.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0})}static{this._FIND_MATCH_ONLY_OVERVIEW_DECORATION=ue.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:bn(yk),position:Yr.Center}})}static{this._RANGE_HIGHLIGHT_DECORATION=ue.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0})}static{this._FIND_SCOPE_DECORATION=ue.register({description:"find-scope",className:"findScope",isWholeLine:!0})}}class C_{constructor(u,n,h){this._editorSelection=u,this._ranges=n,this._replaceStrings=h,this._trackedEditorSelectionId=null}getEditOperations(u,n){if(this._ranges.length>0){let h=[];for(let f=0;f<this._ranges.length;f++)h.push({range:this._ranges[f],text:this._replaceStrings[f]});h.sort((f,b)=>t.compareRangesUsingStarts(f.range,b.range));let g=[],p=h[0];for(let f=1;f<h.length;f++)if(p.range.endLineNumber===h[f].range.startLineNumber&&p.range.endColumn===h[f].range.startColumn)p.range=p.range.plusRange(h[f].range),p.text=p.text+h[f].text;else g.push(p),p=h[f];g.push(p);for(let f of g)n.addEditOperation(f.range,f.text)}this._trackedEditorSelectionId=n.trackSelection(this._editorSelection)}computeCursorState(u,n){return n.getTrackedSelection(this._trackedEditorSelectionId)}}function y_(u,n){if(u&&u[0]!==""){let h=dy(u,n,"-"),g=dy(u,n,"_");if(h&&!g)return ly(u,n,"-");else if(!h&&g)return ly(u,n,"_");if(u[0].toUpperCase()===u[0])return n.toUpperCase();else if(u[0].toLowerCase()===u[0])return n.toLowerCase();else if(i2(u[0][0])&&n.length>0)return n[0].toUpperCase()+n.substr(1);else if(u[0][0].toUpperCase()!==u[0][0]&&n.length>0)return n[0].toLowerCase()+n.substr(1);else return n}else return n}function dy(u,n,h){return u[0].indexOf(h)!==-1&&n.indexOf(h)!==-1&&u[0].split(h).length===n.split(h).length}function ly(u,n,h){let g=n.split(h),p=u[0].split(h),f="";return g.forEach((b,S)=>{f+=y_([p[S]],b)+h}),f.slice(0,-1)}class x_{constructor(u){this.staticValue=u,this.kind=0}}class cy{constructor(u){this.pieces=u,this.kind=1}}class Ta{static fromStaticValue(u){return new Ta([ka.staticValue(u)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(u){if(!u||u.length===0)this._state=new x_("");else if(u.length===1&&u[0].staticValue!==null)this._state=new x_(u[0].staticValue);else this._state=new cy(u)}buildReplaceString(u,n){if(this._state.kind===0)if(n)return y_(u,this._state.staticValue);else return this._state.staticValue;let h="";for(let g=0,p=this._state.pieces.length;g<p;g++){let f=this._state.pieces[g];if(f.staticValue!==null){h+=f.staticValue;continue}let b=Ta._substitute(f.matchIndex,u);if(f.caseOps!==null&&f.caseOps.length>0){let S=[],w=f.caseOps.length,x=0;for(let I=0,E=b.length;I<E;I++){if(x>=w){S.push(b.slice(I));break}switch(f.caseOps[x]){case"U":S.push(b[I].toUpperCase());break;case"u":S.push(b[I].toUpperCase()),x++;break;case"L":S.push(b[I].toLowerCase());break;case"l":S.push(b[I].toLowerCase()),x++;break;default:S.push(b[I])}}b=S.join("")}h+=b}return h}static _substitute(u,n){if(n===null)return"";if(u===0)return n[0];let h="";while(u>0){if(u<n.length)return(n[u]||"")+h;h=String(u%10)+h,u=Math.floor(u/10)}return"$"+h}}class ka{static staticValue(u){return new ka(u,-1,null)}static caseOps(u,n){return new ka(null,u,n)}constructor(u,n,h){if(this.staticValue=u,this.matchIndex=n,!h||h.length===0)this.caseOps=null;else this.caseOps=h.slice(0)}}class hy{constructor(u){this._source=u,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(u){this._emitStatic(this._source.substring(this._lastCharIndex,u)),this._lastCharIndex=u}emitStatic(u,n){this._emitStatic(u),this._lastCharIndex=n}_emitStatic(u){if(u.length===0)return;this._currentStaticPiece+=u}emitMatchIndex(u,n,h){if(this._currentStaticPiece.length!==0)this._result[this._resultLen++]=ka.staticValue(this._currentStaticPiece),this._currentStaticPiece="";this._result[this._resultLen++]=ka.caseOps(u,h),this._lastCharIndex=n}finalize(){if(this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0)this._result[this._resultLen++]=ka.staticValue(this._currentStaticPiece),this._currentStaticPiece="";return new Ta(this._result)}}function uy(u){if(!u||u.length===0)return new Ta(null);let n=[],h=new hy(u);for(let g=0,p=u.length;g<p;g++){let f=u.charCodeAt(g);if(f===92){if(g++,g>=p)break;let b=u.charCodeAt(g);switch(b){case 92:h.emitUnchanged(g-1),h.emitStatic("\\",g+1);break;case 110:h.emitUnchanged(g-1),h.emitStatic(`
|
|
18
|
+
`,g+1);break;case 116:h.emitUnchanged(g-1),h.emitStatic("\t",g+1);break;case 117:case 85:case 108:case 76:h.emitUnchanged(g-1),h.emitStatic("",g+1),n.push(String.fromCharCode(b));break}continue}if(f===36){if(g++,g>=p)break;let b=u.charCodeAt(g);if(b===36){h.emitUnchanged(g-1),h.emitStatic("$",g+1);continue}if(b===48||b===38){h.emitUnchanged(g-1),h.emitMatchIndex(0,g+1,n),n.length=0;continue}if(49<=b&&b<=57){let S=b-48;if(g+1<p){let w=u.charCodeAt(g+1);if(48<=w&&w<=57){g++,S=S*10+(w-48),h.emitUnchanged(g-2),h.emitMatchIndex(S,g+1,n),n.length=0;continue}}h.emitUnchanged(g-1),h.emitMatchIndex(S,g+1,n),n.length=0;continue}}}return h.finalize()}var $n=new P("findWidgetVisible",!1);$n.toNegated();var Ud=new P("findInputFocussed",!1),hc=new P("replaceInputFocussed",!1),gy=new P("findWidgetFocused",!1),uc={primary:545,mac:{primary:2593}},mc={primary:565,mac:{primary:2613}},vc={primary:560,mac:{primary:2608}},Ec={primary:554,mac:{primary:2602}},Mc={primary:558,mac:{primary:2606}},bt={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"},Un=19999,ZD=240;class zd{constructor(u,n){this._toDispose=new d,this._editor=u,this._state=n,this._isDisposed=!1,this._startSearchingTimer=new di,this._decorations=new so(u),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new ke(()=>{if(!this._editor.hasModel())return;return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition((h)=>{if(h.reason===3||h.reason===5||h.reason===6)this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent((h)=>{if(this._ignoreModelContentChanged)return;if(h.isFlush)this._decorations.reset();this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule()})),this._toDispose.add(this._state.onFindReplaceStateChange((h)=>this._onStateChanged(h))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,Ve(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(u){if(this._isDisposed)return;if(!this._editor.hasModel())return;if(u.searchString||u.isReplaceRevealed||u.isRegex||u.wholeWord||u.matchCase||u.searchScope)if(this._editor.getModel().isTooLargeForSyncing())this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{if(u.searchScope)this.research(u.moveCursor,this._state.searchScope);else this.research(u.moveCursor)},ZD);else if(u.searchScope)this.research(u.moveCursor,this._state.searchScope);else this.research(u.moveCursor)}static _getSearchRange(u,n){if(n)return n;return u.getFullModelRange()}research(u,n){let h=null;if(typeof n<"u"){if(n!==null)if(!Array.isArray(n))h=[n];else h=n}else h=this._decorations.getFindScopes();if(h!==null)h=h.map((b)=>{if(b.startLineNumber!==b.endLineNumber){let S=b.endLineNumber;if(b.endColumn===1)S=S-1;return new t(b.startLineNumber,1,S,this._editor.getModel().getLineMaxColumn(S))}return b});let g=this._findMatches(h,!1,Un);this._decorations.set(g,h);let p=this._editor.getSelection(),f=this._decorations.getCurrentMatchesPosition(p);if(f===0&&g.length>0){let b=jf(g.map((S)=>S.range),(S)=>t.compareRangesUsingStarts(S,p)>=0);f=b>0?b-1+1:f}if(this._state.changeMatchInfo(f,this._decorations.getCount(),void 0),u&&this._editor.getOption(50).cursorMoveOnType)this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){let u=this._decorations.getFindScope();if(u)this._editor.revealRangeInCenterIfOutsideViewport(u,0);return!0}return!1}_setCurrentFindMatch(u){let n=this._decorations.setCurrentFindMatch(u);this._state.changeMatchInfo(n,this._decorations.getCount(),u),this._editor.setSelection(u),this._editor.revealRangeInCenterIfOutsideViewport(u,0)}_prevSearchPosition(u){let n=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:h,column:g}=u,p=this._editor.getModel();if(n||g===1){if(h===1)h=p.getLineCount();else h--;g=p.getLineMaxColumn(h)}else g--;return new s(h,g)}_moveToPrevMatch(u,n=!1){if(!this._state.canNavigateBack()){let x=this._decorations.matchAfterPosition(u);if(x)this._setCurrentFindMatch(x);return}if(this._decorations.getCount()<Un){let x=this._decorations.matchBeforePosition(u);if(x&&x.isEmpty()&&x.getStartPosition().equals(u))u=this._prevSearchPosition(u),x=this._decorations.matchBeforePosition(u);if(x)this._setCurrentFindMatch(x);return}if(this._cannotFind())return;let h=this._decorations.getFindScope(),g=zd._getSearchRange(this._editor.getModel(),h);if(g.getEndPosition().isBefore(u))u=g.getEndPosition();if(u.isBefore(g.getStartPosition()))u=g.getEndPosition();let{lineNumber:p,column:f}=u,b=this._editor.getModel(),S=new s(p,f),w=b.findPreviousMatch(this._state.searchString,S,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(w&&w.range.isEmpty()&&w.range.getStartPosition().equals(S))S=this._prevSearchPosition(S),w=b.findPreviousMatch(this._state.searchString,S,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(!w)return;if(!n&&!g.containsRange(w.range))return this._moveToPrevMatch(w.range.getStartPosition(),!0);this._setCurrentFindMatch(w.range)}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(u){let n=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0),{lineNumber:h,column:g}=u,p=this._editor.getModel();if(n||g===p.getLineMaxColumn(h)){if(h===p.getLineCount())h=1;else h++;g=1}else g++;return new s(h,g)}_moveToNextMatch(u){if(!this._state.canNavigateForward()){let h=this._decorations.matchBeforePosition(u);if(h)this._setCurrentFindMatch(h);return}if(this._decorations.getCount()<Un){let h=this._decorations.matchAfterPosition(u);if(h&&h.isEmpty()&&h.getStartPosition().equals(u))u=this._nextSearchPosition(u),h=this._decorations.matchAfterPosition(u);if(h)this._setCurrentFindMatch(h);return}let n=this._getNextMatch(u,!1,!0);if(n)this._setCurrentFindMatch(n.range)}_getNextMatch(u,n,h,g=!1){if(this._cannotFind())return null;let p=this._decorations.getFindScope(),f=zd._getSearchRange(this._editor.getModel(),p);if(f.getEndPosition().isBefore(u))u=f.getStartPosition();if(u.isBefore(f.getStartPosition()))u=f.getStartPosition();let{lineNumber:b,column:S}=u,w=this._editor.getModel(),x=new s(b,S),I=w.findNextMatch(this._state.searchString,x,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n);if(h&&I&&I.range.isEmpty()&&I.range.getStartPosition().equals(x))x=this._nextSearchPosition(x),I=w.findNextMatch(this._state.searchString,x,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n);if(!I)return null;if(!g&&!f.containsRange(I.range))return this._getNextMatch(I.range.getEndPosition(),n,h,!0);return I}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(u){let n=this._decorations.getDecorationRangeAt(u);if(n)this._setCurrentFindMatch(n)}moveToMatch(u){this._moveToMatch(u)}_getReplacePattern(){if(this._state.isRegex)return uy(this._state.replaceString);return Ta.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;let u=this._getReplacePattern(),n=this._editor.getSelection(),h=this._getNextMatch(n.getStartPosition(),!0,!1);if(h)if(n.equalsRange(h.range)){let g=u.buildReplaceString(h.matches,this._state.preserveCase),p=new Ti(n,g);this._executeEditorCommand("replace",p),this._decorations.setStartPosition(new s(n.startLineNumber,n.startColumn+g.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(h.range)}_findMatches(u,n,h){let g=(u||[null]).map((p)=>zd._getSearchRange(this._editor.getModel(),p));return this._editor.getModel().findMatches(this._state.searchString,g,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,n,h)}replaceAll(){if(!this._hasMatches())return;let u=this._decorations.getFindScopes();if(u===null&&this._state.matchesCount>=Un)this._largeReplaceAll();else this._regularReplaceAll(u);this.research(!1)}_largeReplaceAll(){let n=new bu(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!n)return;let h=n.regex;if(!h.multiline){let I="mu";if(h.ignoreCase)I+="i";if(h.global)I+="g";h=new RegExp(h.source,I)}let g=this._editor.getModel(),p=g.getValue(1),f=g.getFullModelRange(),b=this._getReplacePattern(),S,w=this._state.preserveCase;if(b.hasReplacementPatterns||w)S=p.replace(h,function(){return b.buildReplaceString(arguments,w)});else S=p.replace(h,b.buildReplaceString(null,w));let x=new Ug(f,S,this._editor.getSelection());this._executeEditorCommand("replaceAll",x)}_regularReplaceAll(u){let n=this._getReplacePattern(),h=this._findMatches(u,n.hasReplacementPatterns||this._state.preserveCase,1073741824),g=[];for(let f=0,b=h.length;f<b;f++)g[f]=n.buildReplaceString(h[f].matches,this._state.preserveCase);let p=new C_(this._editor.getSelection(),h.map((f)=>f.range),g);this._executeEditorCommand("replaceAll",p)}selectAllMatches(){if(!this._hasMatches())return;let u=this._decorations.getFindScopes(),h=this._findMatches(u,!1,1073741824).map((p)=>new F(p.range.startLineNumber,p.range.startColumn,p.range.endLineNumber,p.range.endColumn)),g=this._editor.getSelection();for(let p=0,f=h.length;p<f;p++)if(h[p].equalsRange(g)){h=[g].concat(h.slice(0,p)).concat(h.slice(p+1));break}this._editor.setSelections(h)}_executeEditorCommand(u,n){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(u,n),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}class Zu extends Ei{static{this.ID="editor.contrib.findOptionsWidget"}constructor(u,n,h){super();this._hideSoon=this._register(new ke(()=>this._hide(),2000)),this._isVisible=!1,this._editor=u,this._state=n,this._keybindingService=h,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 g={inputActiveOptionBorder:M(Bg),inputActiveOptionForeground:M(Vg),inputActiveOptionBackground:M(np)},p={groupId:"find-options-widget"};this.caseSensitive=this._register(new L0({appendTitle:this._keybindingLabelFor(bt.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverLifecycleOptions:p,...g})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new R0({appendTitle:this._keybindingLabelFor(bt.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverLifecycleOptions:p,...g})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new I0({appendTitle:this._keybindingLabelFor(bt.ToggleRegexCommand),isChecked:this._state.isRegex,hoverLifecycleOptions:p,...g})),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((f)=>{let b=!1;if(f.isRegex)this.regex.checked=this._state.isRegex,b=!0;if(f.wholeWord)this.wholeWords.checked=this._state.wholeWord,b=!0;if(f.matchCase)this.caseSensitive.checked=this._state.matchCase,b=!0;if(!this._state.isRevealed&&b)this._revealTemporarily()})),this._register(c(this._domNode,T.MOUSE_LEAVE,(f)=>this._onMouseLeave())),this._register(c(this._domNode,"mouseover",(f)=>this._onMouseOver()))}_keybindingLabelFor(u){return this._keybindingService.appendKeybinding("",u)}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return Zu.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(){if(this._isVisible)return;this._isVisible=!0,this._domNode.style.display="block"}_hide(){if(!this._isVisible)return;this._isVisible=!1,this._domNode.style.display="none"}}function Xu(u,n){if(u===1)return!0;if(u===2)return!1;return n}class I_ extends i{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return Xu(this._isRegexOverride,this._isRegex)}get wholeWord(){return Xu(this._wholeWordOverride,this._wholeWord)}get matchCase(){return Xu(this._matchCaseOverride,this._matchCase)}get preserveCase(){return Xu(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 r),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(u,n,h){let g={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},p=!1;if(n===0)u=0;if(u>n)u=n;if(this._matchesPosition!==u)this._matchesPosition=u,g.matchesPosition=!0,p=!0;if(this._matchesCount!==n)this._matchesCount=n,g.matchesCount=!0,p=!0;if(typeof h<"u"){if(!t.equalsRange(this._currentMatch,h))this._currentMatch=h,g.currentMatch=!0,p=!0}if(p)this._onFindReplaceStateChange.fire(g)}change(u,n,h=!0){let g={moveCursor:n,updateHistory:h,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},p=!1,f=this.isRegex,b=this.wholeWord,S=this.matchCase,w=this.preserveCase;if(typeof u.searchString<"u"){if(this._searchString!==u.searchString)this._searchString=u.searchString,g.searchString=!0,p=!0}if(typeof u.replaceString<"u"){if(this._replaceString!==u.replaceString)this._replaceString=u.replaceString,g.replaceString=!0,p=!0}if(typeof u.isRevealed<"u"){if(this._isRevealed!==u.isRevealed)this._isRevealed=u.isRevealed,g.isRevealed=!0,p=!0}if(typeof u.isReplaceRevealed<"u"){if(this._isReplaceRevealed!==u.isReplaceRevealed)this._isReplaceRevealed=u.isReplaceRevealed,g.isReplaceRevealed=!0,p=!0}if(typeof u.isRegex<"u")this._isRegex=u.isRegex;if(typeof u.wholeWord<"u")this._wholeWord=u.wholeWord;if(typeof u.matchCase<"u")this._matchCase=u.matchCase;if(typeof u.preserveCase<"u")this._preserveCase=u.preserveCase;if(typeof u.searchScope<"u"){if(!u.searchScope?.every((x)=>this._searchScope?.some((I)=>!t.equalsRange(I,x))))this._searchScope=u.searchScope,g.searchScope=!0,p=!0}if(typeof u.loop<"u"){if(this._loop!==u.loop)this._loop=u.loop,g.loop=!0,p=!0}if(typeof u.isSearching<"u"){if(this._isSearching!==u.isSearching)this._isSearching=u.isSearching,g.isSearching=!0,p=!0}if(typeof u.filters<"u"){if(this._filters)this._filters.update(u.filters);else this._filters=u.filters;g.filters=!0,p=!0}if(this._isRegexOverride=typeof u.isRegexOverride<"u"?u.isRegexOverride:0,this._wholeWordOverride=typeof u.wholeWordOverride<"u"?u.wholeWordOverride:0,this._matchCaseOverride=typeof u.matchCaseOverride<"u"?u.matchCaseOverride:0,this._preserveCaseOverride=typeof u.preserveCaseOverride<"u"?u.preserveCaseOverride:0,f!==this.isRegex)p=!0,g.isRegex=!0;if(b!==this.wholeWord)p=!0,g.wholeWord=!0;if(S!==this.matchCase)p=!0,g.matchCase=!0;if(w!==this.preserveCase)p=!0,g.preserveCase=!0;if(p)this._onFindReplaceStateChange.fire(g)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=Un}}var XD=e(5,"input"),YD=e(6,"Preserve Case");class py extends Nc{constructor(u){super({icon:C.preserveCase,title:YD+u.appendTitle,isChecked:u.isChecked,hoverLifecycleOptions:u.hoverLifecycleOptions,inputActiveOptionBorder:u.inputActiveOptionBorder,inputActiveOptionForeground:u.inputActiveOptionForeground,inputActiveOptionBackground:u.inputActiveOptionBackground})}}class L_ extends Ei{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}constructor(u,n,h,g){super();this._showOptionButtons=h,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new r),this._onKeyDown=this._register(new r),this._onMouseDown=this._register(new r),this._onInput=this._register(new r),this._onKeyUp=this._register(new r),this._onPreserveCaseKeyDown=this._register(new r),this.contextViewProvider=n,this.placeholder=g.placeholder||"",this.validation=g.validation,this.label=g.label||XD;let p=g.appendPreserveCaseLabel||"",f=g.history||new Set([]),b=!!g.flexibleHeight,S=!!g.flexibleWidth,w=g.flexibleMaxHeight;if(this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new N0(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:f,showHistoryHint:g.showHistoryHint,flexibleHeight:b,flexibleWidth:S,flexibleMaxHeight:w,inputBoxStyles:g.inputBoxStyles})),this.preserveCase=this._register(new py({appendTitle:p,isChecked:!1,hoverLifecycleOptions:g.hoverLifecycleOptions,...g.toggleStyles})),this._register(this.preserveCase.onChange((E)=>{if(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();else this.cachedOptionsWidth=0;let x=[this.preserveCase.domNode];this.onkeydown(this.domNode,(E)=>{Hk(E,this.domNode,()=>x,()=>this.inputBox.focus())});let I=document.createElement("div");I.className="controls",I.style.display=this._showOptionButtons?"block":"none",I.appendChild(this.preserveCase.domNode),this.domNode.appendChild(I),u?.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(u){if(u)this.enable();else this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(u){this.preserveCase.checked=u}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(u){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=u+"px"}}var my=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},fy=function(u,n){return function(h,g){n(h,g,u)}},eg=new P("suggestWidgetVisible",!1,e(1793,"Whether suggestion are visible")),E_="historyNavigationWidgetFocus",_y="historyNavigationForwardsEnabled",by="historyNavigationBackwardsEnabled",Pc=void 0,Yu=[];function vy(u,n){if(Yu.includes(n))throw Error("Cannot register the same widget multiple times");Yu.push(n);let h=new d,g=new P(E_,!1).bindTo(u),p=new P(_y,!0).bindTo(u),f=new P(by,!0).bindTo(u),b=()=>{g.set(!0),Pc=n},S=()=>{if(g.set(!1),Pc===n)Pc=void 0};if(Ws(n.element))b();return h.add(n.onDidFocus(()=>b())),h.add(n.onDidBlur(()=>S())),h.add(D(()=>{Yu.splice(Yu.indexOf(n),1),S()})),{historyNavigationForwardsEnablement:p,historyNavigationBackwardsEnablement:f,dispose(){h.dispose()}}}var Ju=class u extends D0{constructor(n,h,g,p){super(n,h,g);let f=this._register(p.createScoped(this.inputBox.element));this._register(vy(f,this.inputBox))}};Ju=my([fy(3,K)],Ju);var Qu=class u extends L_{constructor(n,h,g,p,f=!1){super(n,h,f,g);let b=this._register(p.createScoped(this.inputBox.element));this._register(vy(b,this.inputBox))}};Qu=my([fy(3,K)],Qu);Dn.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:L.and(L.has(E_),L.equals(by,!0),eg.isEqualTo(!1)),primary:16,secondary:[528],handler:(u)=>{Pc?.showPreviousValue()}});Dn.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:L.and(L.has(E_),L.equals(_y,!0),eg.isEqualTo(!1)),primary:18,secondary:[530],handler:(u)=>{Pc?.showNextValue()}});function D_(u){return u.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&u.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}var Sy=Mt("find-collapsed",C.chevronRight,e(1011,"Icon to indicate that the editor find widget is collapsed.")),wy=Mt("find-expanded",C.chevronDown,e(1012,"Icon to indicate that the editor find widget is expanded.")),JD=Mt("find-selection",C.selection,e(1013,"Icon for 'Find in Selection' in the editor find widget.")),QD=Mt("find-replace",C.replace,e(1014,"Icon for 'Replace' in the editor find widget.")),t2=Mt("find-replace-all",C.replaceAll,e(1015,"Icon for 'Replace All' in the editor find widget.")),n2=Mt("find-previous-match",C.arrowUp,e(1016,"Icon for 'Find Previous' in the editor find widget.")),D2=Mt("find-next-match",C.arrowDown,e(1017,"Icon for 'Find Next' in the editor find widget.")),F2=e(1018,"Find / Replace"),R_=e(1019,"Find"),W2=e(1020,"Find"),z2=e(1021,"Previous Match"),j2=e(1022,"Next Match"),Z2=e(1023,"Find in Selection"),X2=e(1024,"Close"),k_=e(1025,"Replace"),Y2=e(1026,"Replace"),Q2=e(1027,"Replace"),eR=e(1028,"Replace All"),tR=e(1029,"Toggle Replace"),iR=e(1030,"Only the first {0} results are highlighted, but all find operations work on the entire text.",Un),oR=e(1031,"{0} of {1}"),ig=e(1032,"No results"),jn=419,nR=275,rR=nR-54,Ac=69,sR=33,Cy=ye?256:2048;class tg{constructor(u){this.afterLineNumber=u,this.heightInPx=sR,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function yy(u,n,h){let g=!!n.match(/\n/);if(h&&g&&h.selectionStart>0){u.stopPropagation();return}}function xy(u,n,h){let g=!!n.match(/\n/);if(h&&g&&h.selectionEnd<h.value.length){u.stopPropagation();return}}class pd extends Ei{static{this.ID="editor.contrib.findWidget"}constructor(u,n,h,g,p,f,b,S,w,x,I){super();if(this._hoverService=b,this._findWidgetSearchHistory=S,this._replaceWidgetHistory=w,this._configurationService=x,this._accessibilityService=I,this._cachedHeight=null,this._lastFocusedInputWasReplace=!1,this._lastFocusedElement=null,this._revealTimeouts=[],this._codeEditor=u,this._controller=n,this._state=h,this._contextViewProvider=g,this._keybindingService=p,this._contextKeyService=f,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._accessibilityHelpHintAnnounced=!1,this._updateHistoryDelayer=new Ji(500),this._register(D(()=>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)){if(this._codeEditor.getOption(104))this._state.change({isReplaceRevealed:!1},!1);this._updateButtons()}if(E.hasChanged(166))this._tryUpdateWidgetWidth();if(E.hasChanged(2))this.updateAccessibilitySupport();if(E.hasChanged(50)){let Z=this._codeEditor.getOption(50).loop;this._state.change({loop:Z},!1);let X=this._codeEditor.getOption(50).addExtraSpaceOnTop;if(X&&!this._viewZone)this._viewZone=new tg(0),this._showViewZone();if(!X&&this._viewZone)this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{if(this._isVisible)this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){let E=await this._controller.getGlobalBufferTerm();if(E&&E!==this._state.searchString)this._state.change({searchString:E},!1),this._findInput.select()}})),this._findInputFocused=Ud.bindTo(f),this._findFocusTracker=this._register(wi(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=hc.bindTo(f),this._replaceFocusTracker=this._register(wi(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=gy.bindTo(f),this._widgetFocusTracker=this._register(wi(this._domNode)),this._register(this._widgetFocusTracker.onDidFocus(()=>{this._findWidgetFocused.set(!0)})),this._register(this._widgetFocusTracker.onDidBlur(()=>{this._findWidgetFocused.set(!1)})),this._register(c(this._domNode,"focusin",(E)=>{if(Le(E.target))this._lastFocusedElement=E.target})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop)this._viewZone=new tg(0);this._register(this._codeEditor.onDidChangeModel(()=>{if(!this._isVisible)return;this._viewZoneId=void 0})),this._register(this._codeEditor.onDidScrollChange((E)=>{if(E.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return pd.ID}getDomNode(){return this._domNode}getPosition(){if(this._isVisible)return{preference:0};return null}_onStateChanged(u){if(u.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(u.replaceString)this._replaceInput.inputBox.value=this._state.replaceString;if(u.isRevealed)if(this._state.isRevealed)this._reveal();else this._hide(!0);if(u.isReplaceRevealed){if(this._state.isReplaceRevealed){if(!this._codeEditor.getOption(104)&&!this._isReplaceVisible)this._isReplaceVisible=!0,this._replaceInput.width=Pr(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()}else if(this._isReplaceVisible)this._isReplaceVisible=!1,this._updateButtons()}if((u.isRevealed||u.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)){if(this._tryUpdateHeight())this._showViewZone()}if(u.isRegex)this._findInput.setRegex(this._state.isRegex);if(u.wholeWord)this._findInput.setWholeWords(this._state.wholeWord);if(u.matchCase)this._findInput.setCaseSensitive(this._state.matchCase);if(u.preserveCase)this._replaceInput.setPreserveCase(this._state.preserveCase);if(u.searchScope){if(this._state.searchScope)this._toggleSelectionFind.checked=!0;else this._toggleSelectionFind.checked=!1;this._updateToggleSelectionFindButton()}if(u.searchString||u.matchesCount||u.matchesPosition){let n=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",n),this._updateMatchesCount(),this._updateButtons()}if(u.searchString||u.currentMatch)this._layoutViewZone();if(u.updateHistory)this._delayedUpdateHistory();if(u.loop)this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,ee)}_updateHistory(){if(this._state.searchString)this._findInput.inputBox.addToHistory();if(this._state.replaceString)this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){if(this._matchesCount.style.minWidth=Ac+"px",this._state.matchesCount>=Un)this._matchesCount.title=iR;else this._matchesCount.title="";this._matchesCount.firstChild?.remove();let u;if(this._state.matchesCount>0){let n=String(this._state.matchesCount);if(this._state.matchesCount>=Un)n+="+";let h=String(this._state.matchesPosition);if(h==="0")h="?";u=qa(oR,h,n)}else u=ig;this._matchesCount.appendChild(document.createTextNode(u)),zn(this._getAriaLabel(u,this._state.currentMatch,this._state.searchString)),Ac=Math.max(Ac,this._matchesCount.clientWidth)}_getAriaLabel(u,n,h){let g;if(u===ig)g=h===""?e(1033,"{0} found",u):e(1034,"{0} found for '{1}'",u,h);else if(n){let p=e(1035,"{0} found for '{1}', at {2}",u,h,n.startLineNumber+":"+n.startColumn),f=this._codeEditor.getModel();if(f&&n.startLineNumber<=f.getLineCount()&&n.startLineNumber>=1)g=`${f.getLineContent(n.startLineNumber)}, ${p}`;else g=p}else g=e(1036,"{0} found for '{1}'",u,h);return g}_updateToggleSelectionFindButton(){let u=this._codeEditor.getSelection(),n=u?u.startLineNumber!==u.endLineNumber||u.startColumn!==u.endColumn:!1,h=this._toggleSelectionFind.checked;if(this._isVisible&&(h||n))this._toggleSelectionFind.enable();else this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);let u=this._state.searchString.length>0,n=this._state.matchesCount?!0:!1;this._prevBtn.setEnabled(this._isVisible&&u&&n&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&u&&n&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&u),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&u),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);let h=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&h)}_reveal(){if(this._revealTimeouts.forEach((u)=>{clearTimeout(u)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;let u=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 h=!!u&&u.startLineNumber!==u.endLineNumber;this._toggleSelectionFind.checked=h;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 n=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&u){let h=this._codeEditor.getDomNode();if(h){let g=kt(h),p=this._codeEditor.getScrolledVisiblePosition(u.getStartPosition()),f=g.left+(p?p.left:0),b=p?p.top:0;if(this._viewZone&&b<this._viewZone.heightInPx){if(u.endLineNumber>u.startLineNumber)n=!1;let S=ck(this._domNode).left;if(f>S)n=!1;let w=this._codeEditor.getScrolledVisiblePosition(u.getEndPosition());if(g.left+(w?w.left:0)>S)n=!1}}}this._showViewZone(n)}}_hide(u){if(this._revealTimeouts.forEach((n)=>{clearTimeout(n)}),this._revealTimeouts=[],this._isVisible){if(this._isVisible=!1,this._accessibilityHelpHintAnnounced=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),u)this._codeEditor.focus();this._codeEditor.layoutOverlayWidget(this),this._removeViewZone()}}_layoutViewZone(u){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;let h=this._viewZone;if(this._viewZoneId!==void 0||!h)return;this._codeEditor.changeViewZones((g)=>{h.heightInPx=this._getHeight(),this._viewZoneId=g.addZone(h),this._codeEditor.setScrollTop(u||this._codeEditor.getScrollTop()+h.heightInPx)})}_showViewZone(u=!0){if(!this._isVisible)return;if(!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;if(this._viewZone===void 0)this._viewZone=new tg(0);let h=this._viewZone;this._codeEditor.changeViewZones((g)=>{if(this._viewZoneId!==void 0){let p=this._getHeight();if(p===h.heightInPx)return;let f=p-h.heightInPx;if(h.heightInPx=p,g.layoutZone(this._viewZoneId),u)this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+f);return}else{let p=this._getHeight();if(p-=this._codeEditor.getOption(96).top,p<=0)return;if(h.heightInPx=p,this._viewZoneId=g.addZone(h),u)this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+p)}})}_removeViewZone(){this._codeEditor.changeViewZones((u)=>{if(this._viewZoneId!==void 0){if(u.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone)this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0}})}_tryUpdateWidgetWidth(){if(!this._isVisible)return;if(!this._domNode.isConnected)return;let u=this._codeEditor.getLayoutInfo();if(u.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else if(this._domNode.classList.contains("hiddenEditor"))this._domNode.classList.remove("hiddenEditor");let h=u.width,g=u.minimap.minimapWidth,p=!1,f=!1,b=!1;if(this._resized){if(Pr(this._domNode)>jn){this._domNode.style.maxWidth=`${h-28-g-15}px`,this._replaceInput.width=Pr(this._findInput.domNode);return}}if(jn+28+g>=h)f=!0;if(jn+28+g-Ac>=h)b=!0;if(jn+28+g-Ac>=h+50)p=!0;if(this._domNode.classList.toggle("collapsed-find-widget",p),this._domNode.classList.toggle("narrow-find-widget",b),this._domNode.classList.toggle("reduced-find-widget",f),!b&&!p)this._domNode.style.maxWidth=`${h-28-g-15}px`;if(this._findInput.layout({collapsedFindWidget:p,narrowFindWidget:b,reducedFindWidget:f}),this._resized){let S=this._findInput.inputBox.element.clientWidth;if(S>0)this._replaceInput.width=S}else if(this._isReplaceVisible)this._replaceInput.width=Pr(this._findInput.domNode)}_getHeight(){let u=0;if(u+=4,u+=this._findInput.inputBox.height+2,this._isReplaceVisible)u+=4,u+=this._replaceInput.inputBox.height+2;return u+=4,u}_tryUpdateHeight(){let u=this._getHeight();if(this._cachedHeight!==null&&this._cachedHeight===u)return!1;return this._cachedHeight=u,this._domNode.style.height=`${u}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())return;if(this._toggleSelectionFind.checked){let u=this._codeEditor.getSelections();if(u.map((n)=>{if(n.endColumn===1&&n.endLineNumber>n.startLineNumber)n=n.setEndPosition(n.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(n.endLineNumber-1));let h=this._state.currentMatch;if(n.startLineNumber!==n.endLineNumber){if(!t.equalsRange(n,h))return n}return null}).filter((n)=>!!n),u.length)this._state.change({searchScope:u},!0)}}_onFindInputMouseDown(u){if(u.middleButton)u.stopPropagation()}_onFindInputKeyDown(u){if(u.equals(Cy|3))if(this._keybindingService.dispatchEvent(u,u.target)){u.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
|
|
19
|
+
`),u.preventDefault();return}if(u.equals(2)){if(this._isReplaceVisible)this._replaceInput.focus();else this._findInput.focusOnCaseSensitive();u.preventDefault();return}if(u.equals(2066)){this._codeEditor.focus(),u.preventDefault();return}if(u.equals(16))return yy(u,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(u.equals(18))return xy(u,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(u){if(u.equals(Cy|3))if(this._keybindingService.dispatchEvent(u,u.target)){u.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
|
|
20
|
+
`),u.preventDefault();return}if(u.equals(2)){this._findInput.focusOnCaseSensitive(),u.preventDefault();return}if(u.equals(1026)){this._findInput.focus(),u.preventDefault();return}if(u.equals(2066)){this._codeEditor.focus(),u.preventDefault();return}if(u.equals(16))return yy(u,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(u.equals(18))return xy(u,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(u){return 0}_keybindingLabelFor(u){return this._keybindingService.appendKeybinding("",u)}_buildDomNode(){let h=this._codeEditor.getOption(50).history,g=this._codeEditor.getOption(50).replaceHistory;if(this._findInput=this._register(new Ju(null,this._contextViewProvider,{width:rR,label:R_,placeholder:W2,appendCaseSensitiveLabel:this._keybindingLabelFor(bt.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(bt.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(bt.ToggleRegexCommand),validation:(I)=>{if(I.length===0||!this._findInput.getRegex())return null;try{return new RegExp(I,"gu"),null}catch(E){return{content:E.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>D_(this._keybindingService),inputBoxStyles:zv,toggleStyles:Wv,history:h==="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((I)=>{if(I.equals(3)&&!this._codeEditor.getOption(50).findOnType)this._state.change({searchString:this._findInput.getValue()},!0);this._onFindInputKeyDown(I)})),this._register(this._findInput.inputBox.onDidChange(()=>{if(this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType)return;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((I)=>{if(I.equals(1026)){if(this._isReplaceVisible)this._replaceInput.focus(),I.preventDefault()}})),this._register(this._findInput.onRegexKeyDown((I)=>{if(I.equals(2)){if(this._isReplaceVisible)this._replaceInput.focusOnPreserve(),I.preventDefault()}})),this._register(this._findInput.inputBox.onDidHeightChange((I)=>{if(this._tryUpdateHeight())this._showViewZone()})),ai)this._register(this._findInput.onMouseDown((I)=>this._onFindInputMouseDown(I)));this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();let p={groupId:"find-widget"};this._prevBtn=this._register(new yr({label:z2+this._keybindingLabelFor(bt.PreviousMatchFindAction),icon:n2,hoverLifecycleOptions:p,onTrigger:()=>{fc(this._codeEditor.getAction(bt.PreviousMatchFindAction)).run().then(void 0,ee)}},this._hoverService)),this._nextBtn=this._register(new yr({label:j2+this._keybindingLabelFor(bt.NextMatchFindAction),icon:D2,hoverLifecycleOptions:p,onTrigger:()=>{fc(this._codeEditor.getAction(bt.NextMatchFindAction)).run().then(void 0,ee)}},this._hoverService));let f=document.createElement("div");f.className="find-part",f.appendChild(this._findInput.domNode);let b=document.createElement("div");b.className="find-actions",f.appendChild(b),b.appendChild(this._matchesCount),b.appendChild(this._prevBtn.domNode),b.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new Nc({icon:JD,title:Z2+this._keybindingLabelFor(bt.ToggleSearchScopeCommand),isChecked:!1,hoverLifecycleOptions:p,inputActiveOptionBackground:M(np),inputActiveOptionBorder:M(Bg),inputActiveOptionForeground:M(Vg)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let I=this._codeEditor.getSelections();if(I=I.map((E)=>{if(E.endColumn===1&&E.endLineNumber>E.startLineNumber)E=E.setEndPosition(E.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(E.endLineNumber-1));if(!E.isEmpty())return E;return null}).filter((E)=>!!E),I.length)this._state.change({searchScope:I},!0)}}else this._state.change({searchScope:null},!0)})),b.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new yr({label:X2+this._keybindingLabelFor(bt.CloseFindWidgetCommand),icon:Qk,hoverLifecycleOptions:p,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:(I)=>{if(I.equals(2)){if(this._isReplaceVisible){if(this._replaceBtn.isEnabled())this._replaceBtn.focus();else this._codeEditor.focus();I.preventDefault()}}}},this._hoverService)),this._replaceInput=this._register(new Qu(null,void 0,{label:k_,placeholder:Y2,appendPreserveCaseLabel:this._keybindingLabelFor(bt.TogglePreserveCaseCommand),history:g==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>D_(this._keybindingService),inputBoxStyles:zv,toggleStyles:Wv,hoverLifecycleOptions:p},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown((I)=>this._onReplaceInputKeyDown(I))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange((I)=>{if(this._isReplaceVisible&&this._tryUpdateHeight())this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown((I)=>{if(I.equals(2)){if(this._prevBtn.isEnabled())this._prevBtn.focus();else if(this._nextBtn.isEnabled())this._nextBtn.focus();else if(this._toggleSelectionFind.enabled)this._toggleSelectionFind.focus();else if(this._closeBtn.isEnabled())this._closeBtn.focus();I.preventDefault()}})),this._replaceBtn=this._register(new yr({label:Q2+this._keybindingLabelFor(bt.ReplaceOneAction),icon:QD,hoverLifecycleOptions:p,onTrigger:()=>{this._controller.replace()},onKeyDown:(I)=>{if(I.equals(1026))this._closeBtn.focus(),I.preventDefault()}},this._hoverService)),this._replaceAllBtn=this._register(new yr({label:eR+this._keybindingLabelFor(bt.ReplaceAllAction),icon:t2,hoverLifecycleOptions:p,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));let S=document.createElement("div");S.className="replace-part",S.appendChild(this._replaceInput.domNode);let w=document.createElement("div");w.className="replace-actions",S.appendChild(w),w.appendChild(this._replaceBtn.domNode),w.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new yr({label:tR,className:"codicon toggle left",onTrigger:()=>{if(this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible)this._replaceInput.width=Pr(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=F2,this._domNode.role="dialog",this._domNode.style.width=`${jn}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(f),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(S),this._resizeSash=this._register(new gr(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let x=jn;this._register(this._resizeSash.onDidStart(()=>{x=Pr(this._domNode)})),this._register(this._resizeSash.onDidChange((I)=>{this._resized=!0;let E=x+I.startX-I.currentX;if(E<jn)return;let Z=parseFloat(n0(this._domNode).maxWidth)||0;if(E>Z)return;if(this._domNode.style.width=`${E}px`,this._isReplaceVisible)this._replaceInput.width=Pr(this._findInput.domNode);this._findInput.inputBox.layout(),this._tryUpdateHeight()})),this._register(this._resizeSash.onDidReset(()=>{let I=Pr(this._domNode);if(I<jn)return;let E=jn;if(!this._resized||I===jn){let Z=this._codeEditor.getLayoutInfo();E=Z.width-28-Z.minimap.minimapWidth-15,this._resized=!0}if(this._domNode.style.width=`${E}px`,this._isReplaceVisible)this._replaceInput.width=Pr(this._findInput.domNode);this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){let u=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(u!==2),this._updateFindInputAriaLabel()}_updateFindInputAriaLabel(){let u=R_,n=k_;if(!this._accessibilityHelpHintAnnounced&&this._configurationService.getValue("accessibility.verbosity.find")&&this._accessibilityService.isScreenReaderOptimized()){let h=this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel();if(h){let g=e(1037,"Press {0} for accessibility help",h);u=e(1038,"{0}, {1}",u,g),n=e(1039,"{0}, {1}",n,g)}this._accessibilityHelpHintAnnounced=!0,this._labelResetTimeout?.dispose(),this._labelResetTimeout=yi(()=>{if(this._isVisible)this._findInput.inputBox.setAriaLabel(R_),this._replaceInput.inputBox.setAriaLabel(k_)},1000)}this._findInput.inputBox.setAriaLabel(u),this._replaceInput.inputBox.setAriaLabel(n)}getViewState(){let u=!1;if(this._viewZone&&this._viewZoneId)u=this._viewZone.heightInPx>this._codeEditor.getScrollTop();return{widgetViewZoneVisible:u,scrollTop:this._codeEditor.getScrollTop()}}setViewState(u){if(!u)return;if(u.widgetViewZoneVisible)this._layoutViewZone(u.scrollTop)}}class yr extends Ei{constructor(u,n){super();this._opts=u;let h="button";if(this._opts.className)h=h+" "+this._opts.className;if(this._opts.icon)h=h+" "+Y.asClassName(this._opts.icon);this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=h,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(n.setupDelayedHover(this._domNode,{content:this._opts.label,style:1},u.hoverLifecycleOptions)),this.onclick(this._domNode,(g)=>{this._opts.onTrigger(),g.preventDefault()}),this.onkeydown(this._domNode,(g)=>{if(g.equals(10)||g.equals(3)){this._opts.onTrigger(),g.preventDefault();return}this._opts.onKeyDown?.(g)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(u){this._domNode.classList.toggle("disabled",!u),this._domNode.setAttribute("aria-disabled",String(!u)),this._domNode.tabIndex=u?0:-1}setExpanded(u){if(this._domNode.setAttribute("aria-expanded",String(!!u)),u)this._domNode.classList.remove(...Y.asClassNameArray(Sy)),this._domNode.classList.add(...Y.asClassNameArray(wy));else this._domNode.classList.remove(...Y.asClassNameArray(wy)),this._domNode.classList.add(...Y.asClassNameArray(Sy))}}$i((u,n)=>{let h=u.getColor(Cc);if(h)n.addRule(`.monaco-editor .findMatch { border: 1px ${go(u.type)?"dotted":"solid"} ${h}; box-sizing: border-box; }`);let g=u.getColor(k2);if(g)n.addRule(`.monaco-editor .findScope { border: 1px ${go(u.type)?"dashed":"solid"} ${g}; }`);let p=u.getColor(Be);if(p)n.addRule(`.monaco-editor .find-widget { border: 1px solid ${p}; }`);let f=u.getColor(S2);if(f)n.addRule(`.monaco-editor .findMatchInline { color: ${f}; }`);let b=u.getColor(C2);if(b)n.addRule(`.monaco-editor .currentFindMatchInline { color: ${b}; }`)});var aR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},dR=function(u,n){return function(h,g){n(h,g,u)}},ps,og=class u{static{ps=this}static{this.FIND_HISTORY_KEY="workbench.find.history"}static{this._instance=null}static getOrCreate(n){if(!ps._instance)ps._instance=new ps(n);return ps._instance}constructor(n){this.storageService=n,this.inMemoryValues=new Set,this._onDidChangeEmitter=new r,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(n){let h=this.inMemoryValues.delete(n);return this.save(),h}add(n){return this.inMemoryValues.add(n),this.save(),this}has(n){return this.inMemoryValues.has(n)}forEach(n,h){return this.load(),this.inMemoryValues.forEach(n)}replace(n){this.inMemoryValues=new Set(n),this.save()}load(){let n,h=this.storageService.get(ps.FIND_HISTORY_KEY,1);if(h)try{n=JSON.parse(h)}catch(g){}this.inMemoryValues=new Set(n||[])}save(){let n=[];return this.inMemoryValues.forEach((h)=>n.push(h)),new Promise((h)=>{this.storageService.store(ps.FIND_HISTORY_KEY,JSON.stringify(n),1,0),this._onDidChangeEmitter.fire(n),h()})}};og=ps=aR([dR(0,Mn)],og);var lR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},cR=function(u,n){return function(h,g){n(h,g,u)}},fs,ng=class u{static{fs=this}static{this.FIND_HISTORY_KEY="workbench.replace.history"}static{this._instance=null}static getOrCreate(n){if(!fs._instance)fs._instance=new fs(n);return fs._instance}constructor(n){this.storageService=n,this.inMemoryValues=new Set,this._onDidChangeEmitter=new r,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(n){let h=this.inMemoryValues.delete(n);return this.save(),h}add(n){return this.inMemoryValues.add(n),this.save(),this}has(n){return this.inMemoryValues.has(n)}forEach(n,h){return this.load(),this.inMemoryValues.forEach(n)}replace(n){this.inMemoryValues=new Set(n),this.save()}load(){let n,h=this.storageService.get(fs.FIND_HISTORY_KEY,1);if(h)try{n=JSON.parse(h)}catch(g){}this.inMemoryValues=new Set(n||[])}save(){let n=[];return this.inMemoryValues.forEach((h)=>n.push(h)),new Promise((h)=>{this.storageService.store(fs.FIND_HISTORY_KEY,JSON.stringify(n),1,0),this._onDidChangeEmitter.fire(n),h()})}};ng=fs=lR([cR(0,Mn)],ng);var Iy=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ao=function(u,n){return function(h,g){n(h,g,u)}},T_,hR=524288;function N_(u,n="single",h=!1){if(!u.hasModel())return null;let g=u.getSelection();if(n==="single"&&g.startLineNumber===g.endLineNumber||n==="multiple"){if(g.isEmpty()){let p=u.getConfiguredWordAtPosition(g.getStartPosition());if(p&&h===!1)return p.word}else if(u.getModel().getValueLengthInRange(g)<hR)return u.getModel().getValueInRange(g)}return null}var Ni=class u extends i{static{T_=this}static{this.ID="editor.contrib.findController"}get editor(){return this._editor}static get(n){return n.getContribution(T_.ID)}constructor(n,h,g,p,f,b){super();this._editor=n,this._findWidgetVisible=$n.bindTo(h),this._contextKeyService=h,this._storageService=g,this._clipboardService=p,this._notificationService=f,this._hoverService=b,this._updateHistoryDelayer=this._register(new Ji(500)),this._state=this._register(new I_),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange((S)=>this._onStateChanged(S))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{let S=this._editor.getModel()&&this._state.isRevealed;if(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),S)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(){if(this._model)this._model.dispose(),this._model=null}_onStateChanged(n){if(this.saveQueryState(n),n.isRevealed)if(this._state.isRevealed)this._findWidgetVisible.set(!0);else this._findWidgetVisible.reset(),this.disposeModel();if(n.searchString)this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(n){if(n.isRegex)this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1);if(n.wholeWord)this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1);if(n.matchCase)this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1);if(n.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!!Ud.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){if(this._state.change({matchCase:!this._state.matchCase},!1),!this._state.isRevealed)this.highlightFindOptions()}toggleWholeWords(){if(this._state.change({wholeWord:!this._state.wholeWord},!1),!this._state.isRevealed)this.highlightFindOptions()}toggleRegex(){if(this._state.change({isRegex:!this._state.isRegex},!1),!this._state.isRevealed)this.highlightFindOptions()}togglePreserveCase(){if(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 n=this._editor.getSelections();if(n=n.map((h)=>{if(h.endColumn===1&&h.endLineNumber>h.startLineNumber)h=h.setEndPosition(h.endLineNumber-1,this._editor.getModel().getLineMaxColumn(h.endLineNumber-1));if(!h.isEmpty())return h;return null}).filter((h)=>!!h),n.length)this._state.change({searchScope:n},!0)}}setSearchString(n){if(this._state.isRegex)n=qi(n);this._state.change({searchString:n},!1)}highlightFindOptions(n=!1){}async _start(n,h){if(this.disposeModel(),!this._editor.hasModel())return;let g={...h,isRevealed:!0};if(n.seedSearchStringFromSelection==="single"){let p=N_(this._editor,n.seedSearchStringFromSelection,n.seedSearchStringFromNonEmptySelection);if(p)if(this._state.isRegex)g.searchString=qi(p);else g.searchString=p}else if(n.seedSearchStringFromSelection==="multiple"&&!n.updateSearchScope){let p=N_(this._editor,n.seedSearchStringFromSelection);if(p)g.searchString=p}if(!g.searchString&&n.seedSearchStringFromGlobalClipboard){let p=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;if(p)g.searchString=p}if(n.forceRevealReplace||g.isReplaceRevealed)g.isReplaceRevealed=!0;else if(!this._findWidgetVisible.get())g.isReplaceRevealed=!1;if(n.updateSearchScope){let p=this._editor.getSelections();if(p.some((f)=>!f.isEmpty()))g.searchScope=p}if(g.loop=n.loop,this._state.change(g,!1),!this._model)this._model=new zd(this._editor,this._state)}start(n,h){return this._start(n,h)}moveToNextMatch(){if(this._model)return this._model.moveToNextMatch(),!0;return!1}moveToPrevMatch(){if(this._model)return this._model.moveToPrevMatch(),!0;return!1}goToMatch(n){if(this._model)return this._model.moveToMatch(n),!0;return!1}replace(){if(this._model)return this._model.replace(),!0;return!1}replaceAll(){if(this._model){if(this._editor.getModel()?.isTooLargeForHeapOperation())return this._notificationService.warn(e(994,"The file is too large to perform a replace all operation.")),!1;return this._model.replaceAll(),!0}return!1}selectAllMatches(){if(this._model)return this._model.selectAllMatches(),this._editor.focus(),!0;return!1}async getGlobalBufferTerm(){if(this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing())return this._clipboardService.readFindText();return""}setGlobalBufferTerm(n){if(this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing())this._clipboardService.writeFindText(n)}};Ni=T_=Iy([ao(1,K),ao(2,Mn),ao(3,xi),ao(4,wt),ao(5,An)],Ni);var O_=class u extends Ni{constructor(n,h,g,p,f,b,S,w,x,I){super(n,g,b,S,f,w);this._contextViewService=h,this._keybindingService=p,this._configurationService=x,this._accessibilityService=I,this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=og.getOrCreate(b),this._replaceWidgetHistory=ng.getOrCreate(b)}async _start(n,h){if(!this._widget)this._createFindWidget();let g=this._editor.getSelection(),p=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":p=!0;break;case"never":p=!1;break;case"multiline":{p=!!g&&g.startLineNumber!==g.endLineNumber;break}}if(n.updateSearchScope=n.updateSearchScope||p,await super._start(n,h),this._widget){if(n.shouldFocus===2)this._widget.focusReplaceInput();else if(n.shouldFocus===1)this._widget.focusFindInput()}}highlightFindOptions(n=!1){if(!this._widget)this._createFindWidget();if(this._state.isRevealed&&!n)this._widget.highlightFindOptions();else this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new pd(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 Zu(this._editor,this._state,this._keybindingService))}saveViewState(){return this._widget?.getViewState()}restoreViewState(n){this._widget?.setViewState(n)}};O_=Iy([ao(1,Ss),ao(2,K),ao(3,ge),ao(4,wt),ao(5,Mn),ao(6,xi),ao(7,An),ao(8,oe),ao(9,on)],O_);var uR=r0(new Cv({id:bt.StartFindAction,label:y(1002,"Find"),precondition:L.or(o.focus,L.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:l.MenubarEditMenu,group:"3_find",title:e(995,"&&Find"),order:1}}));uR.addImplementation(0,(u,n,h)=>{let g=Ni.get(n);if(!g)return!1;return g.start({forceRevealReplace:!1,seedSearchStringFromSelection:n.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:n.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:n.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:n.getOption(50).loop})});var gR={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"}}}}]};class Ly extends U{constructor(){super({id:bt.StartFindWithArgs,label:y(1003,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:gR})}async run(u,n,h){let g=Ni.get(n);if(g){let p=h?{searchString:h.searchString,replaceString:h.replaceString,isReplaceRevealed:h.replaceString!==void 0,isRegex:h.isRegex,wholeWord:h.matchWholeWord,matchCase:h.isCaseSensitive,preserveCase:h.preserveCase}:{};await g.start({forceRevealReplace:!1,seedSearchStringFromSelection:g.getState().searchString.length===0&&n.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:n.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:h?.findInSelection||!1,loop:n.getOption(50).loop},p),g.setGlobalBufferTerm(g.getState().searchString)}}}class Ey extends U{constructor(){super({id:bt.StartFindWithSelection,label:y(1004,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(u,n){let h=Ni.get(n);if(h)await h.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:n.getOption(50).loop}),h.setGlobalBufferTerm(h.getState().searchString)}}async function Dy(u,n){let h=Ni.get(u);if(!h)return;let g=u.getOption(50).closeOnResult,p=h.getState().isRevealed,f=()=>{let b=h.editor.getSelection(),S=n?h.moveToNextMatch():h.moveToPrevMatch(),w=!1;if(S){let x=h.editor.getSelection();if(!b&&x)w=!0;else if(b&&x&&!b.equalsSelection(x))w=!0}if(w){if(h.editor.pushUndoStop(),g&&p&&h.isFindInputFocused())h.closeFindWidget();return!0}return!1};if(!f()){if(await h.start({forceRevealReplace:!1,seedSearchStringFromSelection:h.getState().searchString.length===0&&u.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:u.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:u.getOption(50).loop}),!f()){let b=h.getState();if(p&&b.matchesCount===0&&b.searchString)zn(e(996,"{0} found for '{1}'",ig,b.searchString))}}}var pR=r0(new Cv({id:bt.NextMatchFindAction,label:y(1005,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:o.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:L.and(o.focus,Ud),primary:3,weight:100}]}));pR.addImplementation(0,async(u,n,h)=>Dy(n,!0));var mR=r0(new Cv({id:bt.PreviousMatchFindAction,label:y(1006,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:o.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:L.and(o.focus,Ud),primary:1027,weight:100}]}));mR.addImplementation(0,async(u,n,h)=>Dy(n,!1));class Ry extends U{constructor(){super({id:bt.GoToMatchFindAction,label:y(1007,"Go to Match..."),precondition:$n});this._highlightDecorations=[]}run(u,n){let h=Ni.get(n);if(!h)return;let g=h.getState().matchesCount;if(g<1){u.get(wt).notify({severity:Tc.Warning,message:e(997,"No matches. Try searching for something else.")});return}let p=u.get(En),f=new d,b=f.add(p.createInputBox());b.placeholder=e(998,"Type a number to go to a specific match (between 1 and {0})",g);let S=(x)=>{let I=parseInt(x);if(isNaN(I))return;let E=h.getState().matchesCount;if(I>0&&I<=E)return I-1;else if(I<0&&I>=-E)return E+I;return},w=(x)=>{let I=S(x);if(typeof I==="number"){b.validationMessage=void 0,h.goToMatch(I);let E=h.getState().currentMatch;if(E)this.addDecorations(n,E)}else b.validationMessage=e(999,"Please type a number between 1 and {0}",h.getState().matchesCount),this.clearDecorations(n)};f.add(b.onDidChangeValue((x)=>{w(x)})),f.add(b.onDidAccept(()=>{let x=S(b.value);if(typeof x==="number")h.goToMatch(x),b.hide();else b.validationMessage=e(1000,"Please type a number between 1 and {0}",h.getState().matchesCount)})),f.add(b.onDidHide(()=>{this.clearDecorations(n),f.dispose()})),b.show()}clearDecorations(u){u.changeDecorations((n)=>{this._highlightDecorations=n.deltaDecorations(this._highlightDecorations,[])})}addDecorations(u,n){u.changeDecorations((h)=>{this._highlightDecorations=h.deltaDecorations(this._highlightDecorations,[{range:n,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:n,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:bn(Ck),position:Yr.Full}}}])})}}class M_ extends U{async run(u,n){let h=Ni.get(n);if(!h)return;let g=N_(n,"single",!1);if(g)h.setSearchString(g);if(!this._run(h))await h.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:n.getOption(50).loop}),this._run(h)}}class ky extends M_{constructor(){super({id:bt.NextSelectionMatchFindAction,label:y(1008,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:2109,weight:100}})}_run(u){return u.moveToNextMatch()}}class Ty extends M_{constructor(){super({id:bt.PreviousSelectionMatchFindAction,label:y(1009,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:3133,weight:100}})}_run(u){return u.moveToPrevMatch()}}var fR=r0(new Cv({id:bt.StartFindReplaceAction,label:y(1010,"Replace"),precondition:L.or(o.focus,L.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:l.MenubarEditMenu,group:"3_find",title:e(1001,"&&Replace"),order:2}}));fR.addImplementation(0,(u,n,h)=>{if(!n.hasModel()||n.getOption(104))return!1;let g=Ni.get(n);if(!g)return!1;let p=n.getSelection(),f=g.isFindInputFocused(),b=!p.isEmpty()&&p.startLineNumber===p.endLineNumber&&n.getOption(50).seedSearchStringFromSelection!=="never"&&!f,S=f||b?2:1;return g.start({forceRevealReplace:!0,seedSearchStringFromSelection:b?"single":"none",seedSearchStringFromNonEmptySelection:n.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:n.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:S,shouldAnimate:!0,updateSearchScope:!1,loop:n.getOption(50).loop})});fe(Ni.ID,O_,0);A(Ly);A(Ey);A(Ry);A(ky);A(Ty);var an=nn.bindToContribution(Ni.get);G(new an({id:bt.CloseFindWidgetCommand,precondition:$n,handler:(u)=>u.closeFindWidget(),kbOpts:{weight:105,kbExpr:o.focus,primary:9,secondary:[1033]}}));G(new an({id:bt.ToggleCaseSensitiveCommand,precondition:void 0,handler:(u)=>u.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:o.focus,primary:uc.primary,mac:uc.mac,win:uc.win,linux:uc.linux}}));G(new an({id:bt.ToggleWholeWordCommand,precondition:void 0,handler:(u)=>u.toggleWholeWords(),kbOpts:{weight:105,kbExpr:o.focus,primary:mc.primary,mac:mc.mac,win:mc.win,linux:mc.linux}}));G(new an({id:bt.ToggleRegexCommand,precondition:void 0,handler:(u)=>u.toggleRegex(),kbOpts:{weight:105,kbExpr:o.focus,primary:vc.primary,mac:vc.mac,win:vc.win,linux:vc.linux}}));G(new an({id:bt.ToggleSearchScopeCommand,precondition:void 0,handler:(u)=>u.toggleSearchScope(),kbOpts:{weight:105,kbExpr:o.focus,primary:Ec.primary,mac:Ec.mac,win:Ec.win,linux:Ec.linux}}));G(new an({id:bt.TogglePreserveCaseCommand,precondition:void 0,handler:(u)=>u.togglePreserveCase(),kbOpts:{weight:105,kbExpr:o.focus,primary:Mc.primary,mac:Mc.mac,win:Mc.win,linux:Mc.linux}}));G(new an({id:bt.ReplaceOneAction,precondition:$n,handler:(u)=>u.replace(),kbOpts:{weight:105,kbExpr:o.focus,primary:3094}}));G(new an({id:bt.ReplaceOneAction,precondition:$n,handler:(u)=>u.replace(),kbOpts:{weight:105,kbExpr:L.and(o.focus,hc),primary:3}}));G(new an({id:bt.ReplaceAllAction,precondition:$n,handler:(u)=>u.replaceAll(),kbOpts:{weight:105,kbExpr:o.focus,primary:2563}}));G(new an({id:bt.ReplaceAllAction,precondition:$n,handler:(u)=>u.replaceAll(),kbOpts:{weight:105,kbExpr:L.and(o.focus,hc),primary:void 0,mac:{primary:2051}}}));G(new an({id:bt.SelectAllMatchesAction,precondition:$n,handler:(u)=>u.selectAllMatches(),kbOpts:{weight:105,kbExpr:o.focus,primary:515}}));var _R=a("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},e(1637,"Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);a("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},e(1638,"Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0);a("editor.wordHighlightTextBackground",_R,e(1639,"Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);var bR=a("editor.wordHighlightBorder",{light:null,dark:null,hcDark:Xt,hcLight:Xt},e(1640,"Border color of a symbol during read-access, like reading a variable."));a("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:Xt,hcLight:Xt},e(1641,"Border color of a symbol during write-access, like writing to a variable."));a("editor.wordHighlightTextBorder",bR,e(1642,"Border color of a textual occurrence for a symbol."));var vR=a("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",e(1643,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),SR=a("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",e(1644,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),wR=a("editorOverviewRuler.wordHighlightTextForeground",WI,e(1645,"Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),CR=ue.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:bn(SR),position:Yr.Center},minimap:{color:bn(d0),position:1}}),yR=ue.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:bn(wR),position:Yr.Center},minimap:{color:bn(d0),position:1}}),xR=ue.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:bn(WI),position:Yr.Center},minimap:{color:bn(d0),position:1}}),IR=ue.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),LR=ue.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:bn(vR),position:Yr.Center},minimap:{color:bn(d0),position:1}});function KM(u){if(u===Kh.Write)return CR;else if(u===Kh.Text)return yR;else return LR}function Ny(u){return u?IR:xR}$i((u,n)=>{let h=u.getColor(jg);if(h)n.addRule(`.monaco-editor .selectionHighlight { background-color: ${h.transparent(0.5)}; }`)});var ER=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},DR=function(u,n){return function(h,g){n(h,g,u)}},P_;function Is(u,n){let h=n.filter((g)=>!u.find((p)=>p.equals(g)));if(h.length>=1){let g=h.map((f)=>`line ${f.viewState.position.lineNumber} column ${f.viewState.position.column}`).join(", "),p=h.length===1?e(1354,"Cursor added: {0}",g):e(1355,"Cursors added: {0}",g);Br(p)}}class My extends U{constructor(){super({id:"editor.action.insertCursorAbove",label:y(1364,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1356,"&&Add Cursor Above"),order:2}})}run(u,n,h){if(!n.hasModel())return;let g=!0;if(h&&h.logicalLine===!1)g=!1;let p=n._getViewModel();if(p.cursorConfig.readOnly)return;p.model.pushStackElement();let f=p.getCursorStates();p.setCursorStates(h.source,3,Fi.addCursorUp(p,f,g)),p.revealTopMostCursor(h.source),Is(f,p.getCursorStates())}}class Py extends U{constructor(){super({id:"editor.action.insertCursorBelow",label:y(1365,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1357,"A&&dd Cursor Below"),order:3}})}run(u,n,h){if(!n.hasModel())return;let g=!0;if(h&&h.logicalLine===!1)g=!1;let p=n._getViewModel();if(p.cursorConfig.readOnly)return;p.model.pushStackElement();let f=p.getCursorStates();p.setCursorStates(h.source,3,Fi.addCursorDown(p,f,g)),p.revealBottomMostCursor(h.source),Is(f,p.getCursorStates())}}class Ay extends U{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:y(1366,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1358,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(u,n,h){if(u.isEmpty())return;for(let g=u.startLineNumber;g<u.endLineNumber;g++){let p=n.getLineMaxColumn(g);h.push(new F(g,p,g,p))}if(u.endColumn>1)h.push(new F(u.endLineNumber,u.endColumn,u.endLineNumber,u.endColumn))}run(u,n){if(!n.hasModel())return;let h=n.getModel(),g=n.getSelections(),p=n._getViewModel(),f=p.getCursorStates(),b=[];if(g.forEach((S)=>this.getCursorsForSelection(S,h,b)),b.length>0)n.setSelections(b);Is(f,p.getCursorStates())}}class Fy extends U{constructor(){super({id:"editor.action.addCursorsToBottom",label:y(1367,"Add Cursors to Bottom"),precondition:void 0})}run(u,n){if(!n.hasModel())return;let h=n.getSelections(),g=n.getModel().getLineCount(),p=[];for(let S=h[0].startLineNumber;S<=g;S++)p.push(new F(S,h[0].startColumn,S,h[0].endColumn));let f=n._getViewModel(),b=f.getCursorStates();if(p.length>0)n.setSelections(p);Is(b,f.getCursorStates())}}class Hy extends U{constructor(){super({id:"editor.action.addCursorsToTop",label:y(1368,"Add Cursors to Top"),precondition:void 0})}run(u,n){if(!n.hasModel())return;let h=n.getSelections(),g=[];for(let b=h[0].startLineNumber;b>=1;b--)g.push(new F(b,h[0].startColumn,b,h[0].endColumn));let p=n._getViewModel(),f=p.getCursorStates();if(g.length>0)n.setSelections(g);Is(f,p.getCursorStates())}}class Fc{constructor(u,n,h){this.selections=u,this.revealRange=n,this.revealScrollType=h}}class Hc{static create(u,n){if(!u.hasModel())return null;let h=n.getState();if(!u.hasTextFocus()&&h.isRevealed&&h.searchString.length>0)return new Hc(u,n,!1,h.searchString,h.wholeWord,h.matchCase,null);let g=!1,p,f,b=u.getSelections();if(b.length===1&&b[0].isEmpty())g=!0,p=!0,f=!0;else p=h.wholeWord,f=h.matchCase;let S=u.getSelection(),w,x=null;if(S.isEmpty()){let I=u.getConfiguredWordAtPosition(S.getStartPosition());if(!I)return null;w=I.word,x=new F(S.startLineNumber,I.startColumn,S.startLineNumber,I.endColumn)}else w=u.getModel().getValueInRange(S).replace(/\r\n/g,`
|
|
21
|
+
`);return new Hc(u,n,g,w,p,f,x)}constructor(u,n,h,g,p,f,b){this._editor=u,this.findController=n,this.isDisconnectedFromFindController=h,this.searchText=g,this.wholeWord=p,this.matchCase=f,this.currentMatch=b}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let u=this._getNextMatch();if(!u)return null;let n=this._editor.getSelections();return new Fc(n.concat(u),u,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;let u=this._getNextMatch();if(!u)return null;let n=this._editor.getSelections();return new Fc(n.slice(0,n.length-1).concat(u),u,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let g=this.currentMatch;return this.currentMatch=null,g}this.findController.highlightFindOptions();let u=this._editor.getSelections(),n=u[u.length-1],h=this._editor.getModel().findNextMatch(this.searchText,n.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);if(!h)return null;return new F(h.range.startLineNumber,h.range.startColumn,h.range.endLineNumber,h.range.endColumn)}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let u=this._getPreviousMatch();if(!u)return null;let n=this._editor.getSelections();return new Fc(n.concat(u),u,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;let u=this._getPreviousMatch();if(!u)return null;let n=this._editor.getSelections();return new Fc(n.slice(0,n.length-1).concat(u),u,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){let g=this.currentMatch;return this.currentMatch=null,g}this.findController.highlightFindOptions();let u=this._editor.getSelections(),n=u[u.length-1],h=this._editor.getModel().findPreviousMatch(this.searchText,n.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);if(!h)return null;return new F(h.range.startLineNumber,h.range.startColumn,h.range.endLineNumber,h.range.endColumn)}selectAll(u){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();let n=this._editor.getModel();if(u)return n.findMatches(this.searchText,u,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824);return n.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}}class $d extends i{static{this.ID="editor.contrib.multiCursorController"}static get(u){return u.getContribution($d.ID)}constructor(u){super();this._sessionDispose=this._register(new d),this._editor=u,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(u){if(!this._session){let n=Hc.create(this._editor,u);if(!n)return;this._session=n;let h={searchString:this._session.searchText};if(this._session.isDisconnectedFromFindController)h.wholeWordOverride=1,h.matchCaseOverride=1,h.isRegexOverride=2;u.getState().change(h,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection((g)=>{if(this._ignoreSelectionChange)return;this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(u.getState().onFindReplaceStateChange((g)=>{if(g.matchCase||g.wholeWord)this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){let u={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(u,!1)}this._session=null}_setSelections(u){this._ignoreSelectionChange=!0,this._editor.setSelections(u),this._ignoreSelectionChange=!1}_expandEmptyToWord(u,n){if(!n.isEmpty())return n;let h=this._editor.getConfiguredWordAtPosition(n.getStartPosition());if(!h)return n;return new F(n.startLineNumber,h.startColumn,n.startLineNumber,h.endColumn)}_applySessionResult(u){if(!u)return;if(this._setSelections(u.selections),u.revealRange)this._editor.revealRangeInCenterIfOutsideViewport(u.revealRange,u.revealScrollType)}getSession(u){return this._session}addSelectionToNextFindMatch(u){if(!this._editor.hasModel())return;if(!this._session){let n=this._editor.getSelections();if(n.length>1){let g=u.getState().matchCase;if(!jy(this._editor.getModel(),n,g)){let f=this._editor.getModel(),b=[];for(let S=0,w=n.length;S<w;S++)b[S]=this._expandEmptyToWord(f,n[S]);this._editor.setSelections(b);return}}}if(this._beginSessionIfNeeded(u),this._session)this._applySessionResult(this._session.addSelectionToNextFindMatch())}addSelectionToPreviousFindMatch(u){if(this._beginSessionIfNeeded(u),this._session)this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(u){if(this._beginSessionIfNeeded(u),this._session)this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(u){if(this._beginSessionIfNeeded(u),this._session)this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(u){if(!this._editor.hasModel())return;let n=null,h=u.getState();if(h.isRevealed&&h.searchString.length>0&&h.isRegex){let g=this._editor.getModel();if(h.searchScope)n=g.findMatches(h.searchString,h.searchScope,h.isRegex,h.matchCase,h.wholeWord?this._editor.getOption(148):null,!1,1073741824);else n=g.findMatches(h.searchString,!0,h.isRegex,h.matchCase,h.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(u),!this._session)return;n=this._session.selectAll(h.searchScope)}if(n.length>0){let g=this._editor.getSelection();for(let p=0,f=n.length;p<f;p++){let b=n[p];if(b.range.intersectRanges(g)){n[p]=n[0],n[0]=b;break}}this._setSelections(n.map((p)=>new F(p.range.startLineNumber,p.range.startColumn,p.range.endLineNumber,p.range.endColumn)))}}}class Na extends U{run(u,n){let h=$d.get(n);if(!h)return;let g=n._getViewModel();if(g){let p=g.getCursorStates(),f=Ni.get(n);if(f)this._run(h,f);else{let b=u.get(O).createInstance(Ni,n);this._run(h,b),b.dispose()}Is(p,g.getCursorStates())}}}class Wy extends Na{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:y(1369,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:2082,weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1359,"Add &&Next Occurrence"),order:5}})}_run(u,n){u.addSelectionToNextFindMatch(n)}}class By extends Na{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:y(1370,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1360,"Add P&&revious Occurrence"),order:6}})}_run(u,n){u.addSelectionToPreviousFindMatch(n)}}class Vy extends Na{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:y(1371,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:un(2089,2082),weight:100}})}_run(u,n){u.moveSelectionToNextFindMatch(n)}}class Ky extends Na{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:y(1372,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(u,n){u.moveSelectionToPreviousFindMatch(n)}}class zy extends Na{constructor(){super({id:"editor.action.selectHighlights",label:y(1373,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:3114,weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"3_multi",title:e(1361,"Select All &&Occurrences"),order:7}})}_run(u,n){u.selectAll(n)}}class Uy extends Na{constructor(){super({id:"editor.action.changeAll",label:y(1374,"Change All Occurrences"),precondition:L.and(o.writable,o.editorTextFocus),kbOpts:{kbExpr:o.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(u,n){u.selectAll(n)}}class $y{constructor(u,n,h,g,p){if(this._model=u,this._searchText=n,this._matchCase=h,this._wordSeparators=g,this._cachedFindMatches=null,this._modelVersionId=this._model.getVersionId(),p&&this._model===p._model&&this._searchText===p._searchText&&this._matchCase===p._matchCase&&this._wordSeparators===p._wordSeparators&&this._modelVersionId===p._modelVersionId)this._cachedFindMatches=p._cachedFindMatches}findMatches(){if(this._cachedFindMatches===null)this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map((u)=>u.range),this._cachedFindMatches.sort(t.compareRangesUsingStarts);return this._cachedFindMatches}}var rg=class u extends i{static{P_=this}static{this.ID="editor.contrib.selectionHighlighter"}constructor(n,h){super();this._languageFeaturesService=h,this.editor=n,this._isEnabled=n.getOption(122),this._isEnabledMultiline=n.getOption(124),this._maxLength=n.getOption(123),this._decorations=n.createDecorationsCollection(),this.updateSoon=this._register(new ke(()=>this._update(),300)),this.state=null,this._register(n.onDidChangeConfiguration((p)=>{this._isEnabled=n.getOption(122),this._isEnabledMultiline=n.getOption(124),this._maxLength=n.getOption(123)})),this._register(n.onDidChangeCursorSelection((p)=>{if(!this._isEnabled)return;if(p.selection.isEmpty())if(p.reason===3){if(this.state)this._setState(null);this.updateSoon.schedule()}else this._setState(null);else this._update()})),this._register(n.onDidChangeModel((p)=>{this._setState(null)})),this._register(n.onDidChangeModelContent((p)=>{if(this._isEnabled)this.updateSoon.schedule()}));let g=Ni.get(n);if(g)this._register(g.getState().onFindReplaceStateChange((p)=>{this._update()}));this.updateSoon.schedule()}_update(){this._setState(P_._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(n,h,g,p,f){if(!h)return null;if(!f.hasModel())return null;if(!g){let E=f.getSelection();if(E.startLineNumber!==E.endLineNumber)return null}let b=$d.get(f);if(!b)return null;let S=Ni.get(f);if(!S)return null;let w=b.getSession(S);if(!w){let E=f.getSelections();if(E.length>1){let X=S.getState().matchCase;if(!jy(f.getModel(),E,X))return null}w=Hc.create(f,S)}if(!w)return null;if(w.currentMatch)return null;if(/^[ \t]+$/.test(w.searchText))return null;if(p>0&&w.searchText.length>p)return null;let x=S.getState(),I=x.matchCase;if(x.isRevealed){let E=x.searchString;if(!I)E=E.toLowerCase();let Z=w.searchText;if(!I)Z=Z.toLowerCase();if(E===Z&&w.matchCase===x.matchCase&&w.wholeWord===x.wholeWord&&!x.isRegex)return null}return new $y(f.getModel(),w.searchText,w.matchCase,w.wholeWord?f.getOption(148):null,n)}_setState(n){if(this.state=n,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;let h=this.editor.getModel();if(h.isTooLargeForTokenization())return;let g=this.state.findMatches(),p=this.editor.getSelections();p.sort(t.compareRangesUsingStarts);let f=[];for(let x=0,I=0,E=g.length,Z=p.length;x<E;){let X=g[x];if(I>=Z)f.push(X),x++;else{let J=t.compareRangesUsingStarts(X,p[I]);if(J<0){if(p[I].isEmpty()||!t.areIntersecting(X,p[I]))f.push(X);x++}else if(J>0)I++;else x++,I++}}let b=this.editor.getOption(90)!=="off",S=this._languageFeaturesService.documentHighlightProvider.has(h)&&b,w=f.map((x)=>({range:x,options:Ny(S)}));this._decorations.set(w)}dispose(){this._setState(null),super.dispose()}};rg=P_=ER([DR(1,V)],rg);function jy(u,n,h){let g=Oy(u,n[0],!h);for(let p=1,f=n.length;p<f;p++){let b=n[p];if(b.isEmpty())return!1;let S=Oy(u,b,!h);if(g!==S)return!1}return!0}function Oy(u,n,h){let g=u.getValueInRange(n);return h?g.toLowerCase():g}class Gy extends U{constructor(){super({id:"editor.action.focusNextCursor",label:y(1375,"Focus Next Cursor"),metadata:{description:e(1362,"Focuses the next cursor"),args:[]},precondition:void 0})}run(u,n,h){if(!n.hasModel())return;let g=n._getViewModel();if(g.cursorConfig.readOnly)return;g.model.pushStackElement();let p=Array.from(g.getCursorStates()),f=p.shift();if(!f)return;p.push(f),g.setCursorStates(h.source,3,p),g.revealPrimaryCursor(h.source,!0),Is(p,g.getCursorStates())}}class qy extends U{constructor(){super({id:"editor.action.focusPreviousCursor",label:y(1376,"Focus Previous Cursor"),metadata:{description:e(1363,"Focuses the previous cursor"),args:[]},precondition:void 0})}run(u,n,h){if(!n.hasModel())return;let g=n._getViewModel();if(g.cursorConfig.readOnly)return;g.model.pushStackElement();let p=Array.from(g.getCursorStates()),f=p.pop();if(!f)return;p.unshift(f),g.setCursorStates(h.source,3,p),g.revealPrimaryCursor(h.source,!0),Is(p,g.getCursorStates())}}fe($d.ID,$d,4);fe(rg.ID,rg,1);A(My);A(Py);A(Ay);A(Wy);A(By);A(Vy);A(Ky);A(zy);A(Uy);A(Fy);A(Hy);A(Gy);A(qy);class lo{async provideSelectionRanges(u,n){let h=[];for(let g of n){let p=[];h.push(p);let f=new Map;await new Promise((b)=>lo._bracketsRightYield(b,0,u,g,f)),await new Promise((b)=>lo._bracketsLeftYield(b,0,u,g,f,p))}return h}static{this._maxDuration=30}static{this._maxRounds=2}static _bracketsRightYield(u,n,h,g,p){let f=new Map,b=Date.now();while(!0){if(n>=lo._maxRounds){u();break}if(!g){u();break}let S=h.bracketPairs.findNextBracket(g);if(!S){u();break}if(Date.now()-b>lo._maxDuration){setTimeout(()=>lo._bracketsRightYield(u,n+1,h,g,p));break}if(S.bracketInfo.isOpeningBracket){let x=S.bracketInfo.bracketText,I=f.has(x)?f.get(x):0;f.set(x,I+1)}else{let x=S.bracketInfo.getOpeningBrackets()[0].bracketText,I=f.has(x)?f.get(x):0;if(I-=1,f.set(x,Math.max(0,I)),I<0){let E=p.get(x);if(!E)E=new Vn,p.set(x,E);E.push(S.range)}}g=S.range.getEndPosition()}}static _bracketsLeftYield(u,n,h,g,p,f){let b=new Map,S=Date.now();while(!0){if(n>=lo._maxRounds&&p.size===0){u();break}if(!g){u();break}let w=h.bracketPairs.findPrevBracket(g);if(!w){u();break}if(Date.now()-S>lo._maxDuration){setTimeout(()=>lo._bracketsLeftYield(u,n+1,h,g,p,f));break}if(!w.bracketInfo.isOpeningBracket){let I=w.bracketInfo.getOpeningBrackets()[0].bracketText,E=b.has(I)?b.get(I):0;b.set(I,E+1)}else{let I=w.bracketInfo.bracketText,E=b.has(I)?b.get(I):0;if(E-=1,b.set(I,Math.max(0,E)),E<0){let Z=p.get(I);if(Z){let X=Z.shift();if(Z.size===0)p.delete(I);let J=t.fromPositions(w.range.getEndPosition(),X.getStartPosition()),Q=t.fromPositions(w.range.getStartPosition(),X.getEndPosition());f.push({range:J}),f.push({range:Q}),lo._addBracketLeading(h,Q,f)}}}g=w.range.getStartPosition()}}static _addBracketLeading(u,n,h){if(n.startLineNumber===n.endLineNumber)return;let g=n.startLineNumber,p=u.getLineFirstNonWhitespaceColumn(g);if(p!==0&&p!==n.startColumn)h.push({range:t.fromPositions(new s(g,p),n.getEndPosition())}),h.push({range:t.fromPositions(new s(g,1),n.getEndPosition())});let f=g-1;if(f>0){let b=u.getLineFirstNonWhitespaceColumn(f);if(b===n.startColumn&&b!==u.getLineLastNonWhitespaceColumn(f))h.push({range:t.fromPositions(new s(f,b),n.getEndPosition())}),h.push({range:t.fromPositions(new s(f,1),n.getEndPosition())})}}}class A_{constructor(u=!0){this.selectSubwords=u}provideSelectionRanges(u,n){let h=[];for(let g of n){let p=[];if(h.push(p),this.selectSubwords)this._addInWordRanges(p,u,g);this._addWordRanges(p,u,g),this._addWhitespaceLine(p,u,g),p.push({range:u.getFullModelRange()})}return h}_addInWordRanges(u,n,h){let g=n.getWordAtPosition(h);if(!g)return;let{word:p,startColumn:f}=g,b=h.column-f,S=b,w=b,x=0;for(;S>=0;S--){let I=p.charCodeAt(S);if(S!==b&&(I===95||I===45))break;else if(du(I)&&Rl(x))break;x=I}S+=1;for(;w<p.length;w++){let I=p.charCodeAt(w);if(Rl(I)&&du(x))break;else if(I===95||I===45)break;x=I}if(S<w)u.push({range:new t(h.lineNumber,f+S,h.lineNumber,f+w)})}_addWordRanges(u,n,h){let g=n.getWordAtPosition(h);if(g)u.push({range:new t(h.lineNumber,g.startColumn,h.lineNumber,g.endColumn)})}_addWhitespaceLine(u,n,h){if(n.getLineLength(h.lineNumber)>0&&n.getLineFirstNonWhitespaceColumn(h.lineNumber)===0&&n.getLineLastNonWhitespaceColumn(h.lineNumber)===0)u.push({range:new t(h.lineNumber,1,h.lineNumber,n.getLineMaxColumn(h.lineNumber))})}}var RR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},kR=function(u,n){return function(h,g){n(h,g,u)}},F_;class H_{constructor(u,n){this.index=u,this.ranges=n}mov(u){let n=this.index+(u?1:-1);if(n<0||n>=this.ranges.length)return this;let h=new H_(n,this.ranges);if(h.ranges[n].equalsRange(this.ranges[this.index]))return h.mov(u);return h}}var Wc=class u{static{F_=this}static{this.ID="editor.contrib.smartSelectController"}static get(n){return n.getContribution(F_.ID)}constructor(n,h){this._editor=n,this._languageFeaturesService=h,this._ignoreSelection=!1}dispose(){this._selectionListener?.dispose()}async run(n){if(!this._editor.hasModel())return;let h=this._editor.getSelections(),g=this._editor.getModel();if(!this._state)await Yy(this._languageFeaturesService.selectionRangeProvider,g,h.map((f)=>f.getPosition()),this._editor.getOption(129),xe.None).then((f)=>{if(!Kn(f)||f.length!==h.length)return;if(!this._editor.hasModel()||!ot(this._editor.getSelections(),h,(b,S)=>b.equalsSelection(S)))return;for(let b=0;b<f.length;b++)f[b]=f[b].filter((S)=>S.containsPosition(h[b].getStartPosition())&&S.containsPosition(h[b].getEndPosition())),f[b].unshift(h[b]);this._state=f.map((b)=>new H_(0,b)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{if(!this._ignoreSelection)this._selectionListener?.dispose(),this._state=void 0})});if(!this._state)return;this._state=this._state.map((f)=>f.mov(n));let p=this._state.map((f)=>F.fromPositions(f.ranges[f.index].getStartPosition(),f.ranges[f.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(p)}finally{this._ignoreSelection=!1}}};Wc=F_=RR([kR(1,V)],Wc);class B_ extends U{constructor(u,n){super(n);this._forward=u}async run(u,n){let h=Wc.get(n);if(h)await h.run(this._forward)}}class Zy extends B_{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:y(1469,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"1_basic",title:e(1467,"&&Expand Selection"),order:2}})}}$e.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class Xy extends B_{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:y(1470,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:l.MenubarSelectionMenu,group:"1_basic",title:e(1468,"&&Shrink Selection"),order:3}})}}fe(Wc.ID,Wc,4);A(Zy);A(Xy);async function Yy(u,n,h,g,p){let f=u.all(n).concat(new A_(g.selectSubwords));if(f.length===1)f.unshift(new lo);let b=[],S=[];for(let w of f)b.push(Promise.resolve(w.provideSelectionRanges(n,h,p)).then((x)=>{if(Kn(x)&&x.length===h.length)for(let I=0;I<h.length;I++){if(!S[I])S[I]=[];for(let E of x[I])if(t.isIRange(E.range)&&t.containsPosition(E.range,h[I]))S[I].push(t.lift(E.range))}},vt));return await Promise.all(b),S.map((w)=>{if(w.length===0)return[];w.sort((Z,X)=>{if(s.isBefore(Z.getStartPosition(),X.getStartPosition()))return 1;else if(s.isBefore(X.getStartPosition(),Z.getStartPosition()))return-1;else if(s.isBefore(Z.getEndPosition(),X.getEndPosition()))return-1;else if(s.isBefore(X.getEndPosition(),Z.getEndPosition()))return 1;else return 0});let x=[],I;for(let Z of w)if(!I||t.containsRange(Z,I)&&!t.equalsRange(Z,I))x.push(Z),I=Z;if(!g.selectLeadingAndTrailingWhitespace)return x;let E=[x[0]];for(let Z=1;Z<x.length;Z++){let X=x[Z-1],J=x[Z];if(J.startLineNumber!==X.startLineNumber||J.endLineNumber!==X.endLineNumber){let Q=new t(X.startLineNumber,n.getLineFirstNonWhitespaceColumn(X.startLineNumber),X.endLineNumber,n.getLineLastNonWhitespaceColumn(X.endLineNumber));if(Q.containsRange(X)&&!Q.equalsRange(X)&&J.containsRange(Q)&&!J.equalsRange(Q))E.push(Q);let te=new t(X.startLineNumber,1,X.endLineNumber,n.getLineMaxColumn(X.endLineNumber));if(te.containsRange(X)&&!te.equalsRange(Q)&&J.containsRange(te)&&!J.equalsRange(te))E.push(te)}E.push(J)}return E})}$e.registerCommand("_executeSelectionRangeProvider",async function(u,...n){let[h,g]=n;He(q.isUri(h)),He(ZM(g,(b)=>s.isIPosition(b)));let p=u.get(V).selectionRangeProvider,f=await u.get(Nn).createModelReference(h);try{return Yy(p,f.object.textEditorModel,g.map(s.lift),{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},xe.None)}finally{f.dispose()}});class jd extends nn{constructor(u){super(u);this._inSelectionMode=u.inSelectionMode,this._wordNavigationType=u.wordNavigationType}runEditorCommand(u,n,h){if(!n.hasModel())return;let g=es(n.getOption(148),n.getOption(147)),p=n.getModel(),f=n.getSelections(),b=f.length>1,S=f.map((w)=>{let x=new s(w.positionLineNumber,w.positionColumn),I=this._move(g,p,x,this._wordNavigationType,b);return this._moveTo(w,I,this._inSelectionMode)});if(p.pushStackElement(),n._getViewModel().setCursorStates("moveWordCommand",3,S.map((w)=>et.fromModelSelection(w))),S.length===1){let w=new s(S[0].positionLineNumber,S[0].positionColumn);n.revealPosition(w,0)}}_moveTo(u,n,h){if(h)return new F(u.selectionStartLineNumber,u.selectionStartColumn,n.lineNumber,n.column);else return new F(n.lineNumber,n.column,n.lineNumber,n.column)}}class Ir extends jd{_move(u,n,h,g,p){return Dt.moveWordLeft(u,n,h,g,p)}}class Lr extends jd{_move(u,n,h,g,p){return Dt.moveWordRight(u,n,h,g)}}class Jy extends Ir{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class Qy extends Ir{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class ex extends Ir{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:L.and(o.textInputFocus,L.and(ep,k0)?.negate()),primary:2063,mac:{primary:527},weight:100}})}}class tx extends Ir{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class ix extends Ir{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class ox extends Ir{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:L.and(o.textInputFocus,L.and(ep,k0)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class nx extends Ir{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(u,n,h,g,p){return super._move(es(pr.wordSeparators.defaultValue,u.intlSegmenterLocales),n,h,g,p)}}class rx extends Ir{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(u,n,h,g,p){return super._move(es(pr.wordSeparators.defaultValue,u.intlSegmenterLocales),n,h,g,p)}}class sx extends Lr{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class ax extends Lr{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:L.and(o.textInputFocus,L.and(ep,k0)?.negate()),primary:2065,mac:{primary:529},weight:100}})}}class dx extends Lr{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class lx extends Lr{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class cx extends Lr{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:L.and(o.textInputFocus,L.and(ep,k0)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class hx extends Lr{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class ux extends Lr{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(u,n,h,g,p){return super._move(es(pr.wordSeparators.defaultValue,u.intlSegmenterLocales),n,h,g,p)}}class gx extends Lr{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(u,n,h,g,p){return super._move(es(pr.wordSeparators.defaultValue,u.intlSegmenterLocales),n,h,g,p)}}class Gd extends nn{constructor(u){super({canTriggerInlineEdits:!0,...u});this._whitespaceHeuristics=u.whitespaceHeuristics,this._wordNavigationType=u.wordNavigationType}runEditorCommand(u,n,h){let g=u?.get(ht);if(!n.hasModel()||!g)return;let p=es(n.getOption(148),n.getOption(147)),f=n.getModel(),b=n.getSelections(),S=n.getOption(10),w=n.getOption(15),x=g.getLanguageConfiguration(f.getLanguageId()).getAutoClosingPairs(),I=n._getViewModel(),E=b.map((Z)=>{let X=this._delete({wordSeparators:p,model:f,selection:Z,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:n.getOption(13),autoClosingBrackets:S,autoClosingQuotes:w,autoClosingPairs:x,autoClosedCharacters:I.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Ti(X,"")});n.pushUndoStop(),n.executeCommands(this.id,E),n.pushUndoStop()}}class sg extends Gd{_delete(u,n){let h=Dt.deleteWordLeft(u,n);if(h)return h;return new t(1,1,1,1)}}class ag extends Gd{_delete(u,n){let h=Dt.deleteWordRight(u,n);if(h)return h;let g=u.model.getLineCount(),p=u.model.getLineMaxColumn(g);return new t(g,p,g,p)}}class px extends sg{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:o.writable})}}class mx extends sg{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:o.writable})}}class fx extends sg{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class _x extends ag{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:o.writable})}}class bx extends ag{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:o.writable})}}class vx extends ag{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class Sx extends U{constructor(){super({id:"deleteInsideWord",precondition:o.writable,label:y(1650,"Delete Word"),metadata:{description:y(1651,"Delete the word at the cursor"),args:[{name:"args",schema:{type:"object",properties:{onlyWord:{type:"boolean",default:!1,description:e(1649,"Delete only the word and leave surrounding whitespace")}}}}]}})}run(u,n,h){if(!n.hasModel())return;let g=!!(h&&typeof h==="object"&&h.onlyWord),p=es(n.getOption(148),n.getOption(147)),f=n.getModel(),S=n.getSelections().map((w)=>{let x=Dt.deleteInsideWord(p,f,w,g);return new Ti(x,"")});n.pushUndoStop(),n.executeCommands(this.id,S),n.pushUndoStop()}}G(new Jy);G(new Qy);G(new ex);G(new tx);G(new ix);G(new ox);G(new sx);G(new ax);G(new dx);G(new lx);G(new cx);G(new hx);G(new nx);G(new rx);G(new ux);G(new gx);G(new px);G(new mx);G(new fx);G(new _x);G(new bx);G(new vx);A(Sx);class wx extends Gd{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(u,n){let h=Pv.deleteWordPartLeft(u);if(h)return h;return new t(1,1,1,1)}}class Cx extends Gd{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:o.writable,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(u,n){let h=Pv.deleteWordPartRight(u);if(h)return h;let g=u.model.getLineCount(),p=u.model.getLineMaxColumn(g);return new t(g,p,g,p)}}class V_ extends jd{_move(u,n,h,g,p){return Pv.moveWordPartLeft(u,n,h,p)}}class yx extends V_{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}$e.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class xx extends V_{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}$e.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class U_ extends jd{_move(u,n,h,g,p){return Pv.moveWordPartRight(u,n,h)}}class Ix extends U_{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class Lx extends U_{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}G(new wx);G(new Cx);G(new yx);G(new xx);G(new Ix);G(new Lx);var TR={[0]:" ",[1]:"u",[2]:"r"};var qd=16777215;class dg{constructor(u){let n=Math.ceil(u/32);this._states=new Uint32Array(n)}get(u){let n=u/32|0,h=u%32;return(this._states[n]&1<<h)!==0}set(u,n){let h=u/32|0,g=u%32,p=this._states[h];if(n)this._states[h]=p|1<<g;else this._states[h]=p&~(1<<g)}}class Si{constructor(u,n,h){if(u.length!==n.length||u.length>65535)throw Error("invalid startIndexes or endIndexes size");this._startIndexes=u,this._endIndexes=n,this._collapseStates=new dg(u.length),this._userDefinedStates=new dg(u.length),this._recoveredStates=new dg(u.length),this._types=h,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;let u=[],n=(h,g)=>{let p=u[u.length-1];return this.getStartLineNumber(p)<=h&&this.getEndLineNumber(p)>=g};for(let h=0,g=this._startIndexes.length;h<g;h++){let p=this._startIndexes[h],f=this._endIndexes[h];if(p>16777215||f>16777215)throw Error("startLineNumber or endLineNumber must not exceed 16777215");while(u.length>0&&!n(p,f))u.pop();let b=u.length>0?u[u.length-1]:-1;u.push(h),this._startIndexes[h]=p+((b&255)<<24),this._endIndexes[h]=f+((b&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(u){return this._startIndexes[u]&16777215}getEndLineNumber(u){return this._endIndexes[u]&16777215}getType(u){return this._types?this._types[u]:void 0}hasTypes(){return!!this._types}isCollapsed(u){return this._collapseStates.get(u)}setCollapsed(u,n){this._collapseStates.set(u,n)}isUserDefined(u){return this._userDefinedStates.get(u)}setUserDefined(u,n){return this._userDefinedStates.set(u,n)}isRecovered(u){return this._recoveredStates.get(u)}setRecovered(u,n){return this._recoveredStates.set(u,n)}getSource(u){if(this.isUserDefined(u))return 1;else if(this.isRecovered(u))return 2;return 0}setSource(u,n){if(n===1)this.setUserDefined(u,!0),this.setRecovered(u,!1);else if(n===2)this.setUserDefined(u,!1),this.setRecovered(u,!0);else this.setUserDefined(u,!1),this.setRecovered(u,!1)}setCollapsedAllOfType(u,n){let h=!1;if(this._types){for(let g=0;g<this._types.length;g++)if(this._types[g]===u)this.setCollapsed(g,n),h=!0}return h}toRegion(u){return new Ex(this,u)}getParentIndex(u){this.ensureParentIndices();let n=((this._startIndexes[u]&4278190080)>>>24)+((this._endIndexes[u]&4278190080)>>>16);if(n===65535)return-1;return n}contains(u,n){return this.getStartLineNumber(u)<=n&&this.getEndLineNumber(u)>=n}findIndex(u){let n=0,h=this._startIndexes.length;if(h===0)return-1;while(n<h){let g=Math.floor((n+h)/2);if(u<this.getStartLineNumber(g))h=g;else n=g+1}return n-1}findRange(u){let n=this.findIndex(u);if(n>=0){if(this.getEndLineNumber(n)>=u)return n;n=this.getParentIndex(n);while(n!==-1){if(this.contains(n,u))return n;n=this.getParentIndex(n)}}return-1}toString(){let u=[];for(let n=0;n<this.length;n++)u[n]=`[${TR[this.getSource(n)]}${this.isCollapsed(n)?"+":"-"}] ${this.getStartLineNumber(n)}/${this.getEndLineNumber(n)}`;return u.join(", ")}toFoldRange(u){return{startLineNumber:this._startIndexes[u]&16777215,endLineNumber:this._endIndexes[u]&16777215,type:this._types?this._types[u]:void 0,isCollapsed:this.isCollapsed(u),source:this.getSource(u)}}static fromFoldRanges(u){let n=u.length,h=new Uint32Array(n),g=new Uint32Array(n),p=[],f=!1;for(let S=0;S<n;S++){let w=u[S];if(h[S]=w.startLineNumber,g[S]=w.endLineNumber,p.push(w.type),w.type)f=!0}if(!f)p=void 0;let b=new Si(h,g,p);for(let S=0;S<n;S++){if(u[S].isCollapsed)b.setCollapsed(S,!0);b.setSource(S,u[S].source)}return b}static sanitizeAndMerge(u,n,h,g){h=h??Number.MAX_VALUE;let p=(Q,te)=>Array.isArray(Q)?(re)=>re<te?Q[re]:void 0:(re)=>re<te?Q.toFoldRange(re):void 0,f=p(u,u.length),b=p(n,n.length),S=0,w=0,x=f(0),I=b(0),E=[],Z,X=0,J=[];while(x||I){let Q=void 0;if(I&&(!x||x.startLineNumber>=I.startLineNumber)){if(x&&x.startLineNumber===I.startLineNumber){if(I.source===1)Q=I;else Q=x,Q.isCollapsed=I.isCollapsed&&(x.endLineNumber===I.endLineNumber||!g?.startsInside(x.startLineNumber+1,x.endLineNumber+1)),Q.source=0;x=f(++S)}else if(Q=I,I.isCollapsed&&I.source===0)Q.source=2;I=b(++w)}else{let te=w,re=I;while(!0){if(!re||re.startLineNumber>x.endLineNumber){Q=x;break}if(re.source===1&&re.endLineNumber>x.endLineNumber)break;re=b(++te)}x=f(++S)}if(Q){while(Z&&Z.endLineNumber<Q.startLineNumber)Z=E.pop();if(Q.endLineNumber>Q.startLineNumber&&Q.startLineNumber>X&&Q.endLineNumber<=h&&(!Z||Z.endLineNumber>=Q.endLineNumber)){if(J.push(Q),X=Q.startLineNumber,Z)E.push(Z);Z=Q}}}return J}}class Ex{constructor(u,n){this.ranges=u,this.index=n}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(u){return u.startLineNumber<=this.startLineNumber&&u.endLineNumber>=this.endLineNumber}containsLine(u){return this.startLineNumber<=u&&u<=this.endLineNumber}}class $_{get regions(){return this._regions}get textModel(){return this._textModel}constructor(u,n){this._updateEventEmitter=new r,this.onDidChange=this._updateEventEmitter.event,this._textModel=u,this._decorationProvider=n,this._regions=new Si(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(u){if(!u.length)return;u=u.sort((h,g)=>h.regionIndex-g.regionIndex);let n={};this._decorationProvider.changeDecorations((h)=>{let g=0,p=-1,f=-1,b=(S)=>{while(g<S){let w=this._regions.getEndLineNumber(g),x=this._regions.isCollapsed(g);if(w<=p){let I=this.regions.getSource(g)!==0;h.changeDecorationOptions(this._editorDecorationIds[g],this._decorationProvider.getDecorationOption(x,w<=f,I))}if(x&&w>f)f=w;g++}};for(let S of u){let w=S.regionIndex,x=this._editorDecorationIds[w];if(x&&!n[x]){n[x]=!0,b(w);let I=!this._regions.isCollapsed(w);this._regions.setCollapsed(w,I),p=Math.max(p,this._regions.getEndLineNumber(w))}}b(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:u})}removeManualRanges(u){let n=new Set,h=!1;for(let f of u)if(t.isEmpty(f)){let b=this._regions.findRange(f.startLineNumber);while(b!==-1&&this._regions.getSource(b)===0)b=this._regions.getParentIndex(b);if(b===-1)h=!0;else n.add(b)}let g=[],p=(f)=>{for(let b of u)if(!t.isEmpty(b)&&!(b.startLineNumber>f.endLineNumber||f.startLineNumber>b.endLineNumber))return!0;return!1};for(let f=0;f<this._regions.length;f++){let b=this._regions.toFoldRange(f);if(b.source===0||!h&&!n.has(f)&&!p(b))g.push(b)}this.updatePost(Si.fromFoldRanges(g))}update(u,n){let h=this._currentFoldedOrManualRanges(n),g=Si.sanitizeAndMerge(u,h,this._textModel.getLineCount(),n);this.updatePost(Si.fromFoldRanges(g))}updatePost(u){let n=[],h=-1;for(let g=0,p=u.length;g<p;g++){let f=u.getStartLineNumber(g),b=u.getEndLineNumber(g),S=u.isCollapsed(g),w=u.getSource(g)!==0,x={startLineNumber:f,startColumn:this._textModel.getLineMaxColumn(f),endLineNumber:b,endColumn:this._textModel.getLineMaxColumn(b)+1};if(n.push({range:x,options:this._decorationProvider.getDecorationOption(S,b<=h,w)}),S&&b>h)h=b}this._decorationProvider.changeDecorations((g)=>this._editorDecorationIds=g.deltaDecorations(this._editorDecorationIds,n)),this._regions=u,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(u){let n=[];for(let h=0,g=this._regions.length;h<g;h++){let p=this.regions.isCollapsed(h),f=this.regions.getSource(h);if(p||f!==0){let b=this._regions.toFoldRange(h),S=this._textModel.getDecorationRange(this._editorDecorationIds[h]);if(S){if(p&&u?.startsInside(S.startLineNumber+1,S.endLineNumber))p=!1;n.push({startLineNumber:S.startLineNumber,endLineNumber:S.endLineNumber,type:b.type,isCollapsed:p,source:f})}}}return n}getMemento(){let u=this._currentFoldedOrManualRanges(),n=[],h=this._textModel.getLineCount();for(let g=0,p=u.length;g<p;g++){let f=u[g];if(f.startLineNumber>=f.endLineNumber||f.startLineNumber<1||f.endLineNumber>h)continue;let b=this._getLinesChecksum(f.startLineNumber+1,f.endLineNumber);n.push({startLineNumber:f.startLineNumber,endLineNumber:f.endLineNumber,isCollapsed:f.isCollapsed,source:f.source,checksum:b})}return n.length>0?n:void 0}applyMemento(u){if(!Array.isArray(u))return;let n=[],h=this._textModel.getLineCount();for(let p of u){if(p.startLineNumber>=p.endLineNumber||p.startLineNumber<1||p.endLineNumber>h)continue;let f=this._getLinesChecksum(p.startLineNumber+1,p.endLineNumber);if(!p.checksum||f===p.checksum)n.push({startLineNumber:p.startLineNumber,endLineNumber:p.endLineNumber,type:void 0,isCollapsed:p.isCollapsed??!0,source:p.source??0})}let g=Si.sanitizeAndMerge(this._regions,n,h);this.updatePost(Si.fromFoldRanges(g))}_getLinesChecksum(u,n){return hu(this._textModel.getLineContent(u)+this._textModel.getLineContent(n))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds),this._updateEventEmitter.dispose()}getAllRegionsAtLine(u,n){let h=[];if(this._regions){let g=this._regions.findRange(u),p=1;while(g>=0){let f=this._regions.toRegion(g);if(!n||n(f,p))h.push(f);p++,g=f.parentIndex}}return h}getRegionAtLine(u){if(this._regions){let n=this._regions.findRange(u);if(n>=0)return this._regions.toRegion(n)}return null}getRegionsInside(u,n){let h=[],g=u?u.regionIndex+1:0,p=u?u.endLineNumber:Number.MAX_VALUE;if(n&&n.length===2){let f=[];for(let b=g,S=this._regions.length;b<S;b++){let w=this._regions.toRegion(b);if(this._regions.getStartLineNumber(b)<p){while(f.length>0&&!w.containedBy(f[f.length-1]))f.pop();if(f.push(w),n(w,f.length))h.push(w)}else break}}else for(let f=g,b=this._regions.length;f<b;f++){let S=this._regions.toRegion(f);if(this._regions.getStartLineNumber(f)<p){if(!n||n(S))h.push(S)}else break}return h}}function Bc(u,n,h){let g=[];for(let p of h){let f=u.getRegionAtLine(p);if(f){let b=!f.isCollapsed;if(g.push(f),n>1){let S=u.getRegionsInside(f,(w,x)=>w.isCollapsed!==b&&x<n);g.push(...S)}}}u.toggleCollapseState(g)}function Oa(u,n,h=Number.MAX_VALUE,g){let p=[];if(g&&g.length>0)for(let f of g){let b=u.getRegionAtLine(f);if(b){if(b.isCollapsed!==n)p.push(b);if(h>1){let S=u.getRegionsInside(b,(w,x)=>w.isCollapsed!==n&&x<h);p.push(...S)}}}else{let f=u.getRegionsInside(null,(b,S)=>b.isCollapsed!==n&&S<h);p.push(...f)}u.toggleCollapseState(p)}function j_(u,n,h,g){let p=[];for(let f of g){let b=u.getAllRegionsAtLine(f,(S,w)=>S.isCollapsed!==n&&w<=h);p.push(...b)}u.toggleCollapseState(p)}function Dx(u,n,h){let g=[];for(let p of h){let f=u.getAllRegionsAtLine(p,(b)=>b.isCollapsed!==n);if(f.length>0)g.push(f[0])}u.toggleCollapseState(g)}function Rx(u,n,h,g){let p=(b,S)=>S===n&&b.isCollapsed!==h&&!g.some((w)=>b.containsLine(w)),f=u.getRegionsInside(null,p);u.toggleCollapseState(f)}function Z_(u,n,h){let g=[];for(let b of h){let S=u.getAllRegionsAtLine(b,void 0);if(S.length>0)g.push(S[0])}let p=(b)=>g.every((S)=>!S.containedBy(b)&&!b.containedBy(S))&&b.isCollapsed!==n,f=u.getRegionsInside(null,p);u.toggleCollapseState(f)}function lg(u,n,h){let{textModel:g,regions:p}=u,f=[];for(let b=p.length-1;b>=0;b--)if(h!==p.isCollapsed(b)){let S=p.getStartLineNumber(b);if(n.test(g.getLineContent(S)))f.push(p.toRegion(b))}u.toggleCollapseState(f)}function cg(u,n,h){let g=u.regions,p=[];for(let f=g.length-1;f>=0;f--)if(h!==g.isCollapsed(f)&&n===g.getType(f))p.push(g.toRegion(f));u.toggleCollapseState(p)}function kx(u,n){let h=null,g=n.getRegionAtLine(u);if(g!==null){if(h=g.startLineNumber,u===h){let p=g.parentIndex;if(p!==-1)h=n.regions.getStartLineNumber(p);else h=null}}return h}function Tx(u,n){let h=n.getRegionAtLine(u);if(h!==null&&h.startLineNumber===u)if(u!==h.startLineNumber)return h.startLineNumber;else{let g=h.parentIndex,p=0;if(g!==-1)p=n.regions.getStartLineNumber(h.parentIndex);while(h!==null)if(h.regionIndex>0){if(h=n.regions.toRegion(h.regionIndex-1),h.startLineNumber<=p)return null;else if(h.parentIndex===g)return h.startLineNumber}else return null}else if(n.regions.length>0){h=n.regions.toRegion(n.regions.length-1);while(h!==null){if(h.startLineNumber<u)return h.startLineNumber;if(h.regionIndex>0)h=n.regions.toRegion(h.regionIndex-1);else h=null}}return null}function Nx(u,n){let h=n.getRegionAtLine(u);if(h!==null&&h.startLineNumber===u){let g=h.parentIndex,p=0;if(g!==-1)p=n.regions.getEndLineNumber(h.parentIndex);else if(n.regions.length===0)return null;else p=n.regions.getEndLineNumber(n.regions.length-1);while(h!==null)if(h.regionIndex<n.regions.length){if(h=n.regions.toRegion(h.regionIndex+1),h.startLineNumber>=p)return null;else if(h.parentIndex===g)return h.startLineNumber}else return null}else if(n.regions.length>0){h=n.regions.toRegion(0);while(h!==null){if(h.startLineNumber>u)return h.startLineNumber;if(h.regionIndex<n.regions.length)h=n.regions.toRegion(h.regionIndex+1);else h=null}}return null}class ib{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(u){if(this._updateEventEmitter=new r,this._hasLineChanges=!1,this._foldingModel=u,this._foldingModelListener=u.onDidChange((n)=>this.updateHiddenRanges()),this._hiddenRanges=[],u.regions.length)this.updateHiddenRanges()}notifyChangeModelContent(u){if(this._hiddenRanges.length&&!this._hasLineChanges)this._hasLineChanges=u.changes.some((n)=>n.range.endLineNumber!==n.range.startLineNumber||wa(n.text)[0]!==0)}updateHiddenRanges(){let u=!1,n=[],h=0,g=0,p=Number.MAX_VALUE,f=-1,b=this._foldingModel.regions;for(;h<b.length;h++){if(!b.isCollapsed(h))continue;let S=b.getStartLineNumber(h)+1,w=b.getEndLineNumber(h);if(p<=S&&w<=f)continue;if(!u&&g<this._hiddenRanges.length&&this._hiddenRanges[g].startLineNumber===S&&this._hiddenRanges[g].endLineNumber===w)n.push(this._hiddenRanges[g]),g++;else u=!0,n.push(new t(S,1,w,1));p=S,f=w}if(this._hasLineChanges||u||g<this._hiddenRanges.length)this.applyHiddenRanges(n)}applyHiddenRanges(u){this._hiddenRanges=u,this._hasLineChanges=!1,this._updateEventEmitter.fire(u)}hasRanges(){return this._hiddenRanges.length>0}isHidden(u){return Ox(this._hiddenRanges,u)!==null}adjustSelections(u){let n=!1,h=this._foldingModel.textModel,g=null,p=(f)=>{if(!g||!NR(f,g))g=Ox(this._hiddenRanges,f);if(g)return g.startLineNumber-1;return null};for(let f=0,b=u.length;f<b;f++){let S=u[f],w=p(S.startLineNumber);if(w)S=S.setStartPosition(w,h.getLineMaxColumn(w)),n=!0;let x=p(S.endLineNumber);if(x)S=S.setEndPosition(x,h.getLineMaxColumn(x)),n=!0;u[f]=S}return n}dispose(){if(this.hiddenRanges.length>0)this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges);if(this._foldingModelListener)this._foldingModelListener.dispose(),this._foldingModelListener=null;this._updateEventEmitter.dispose()}}function NR(u,n){return u>=n.startLineNumber&&u<=n.endLineNumber}function Ox(u,n){let h=jf(u,(g)=>n<g.startLineNumber)-1;if(h>=0&&u[h].endLineNumber>=n)return u[h];return null}var OR=5000,MR="indent";class Zd{constructor(u,n,h){this.editorModel=u,this.languageConfigurationService=n,this.foldingRangesLimit=h,this.id=MR}dispose(){}compute(u){let n=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,h=n&&!!n.offSide,g=n&&n.markers;return Promise.resolve(AR(this.editorModel,h,g,this.foldingRangesLimit))}}class Mx{constructor(u){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=u}insertFirst(u,n,h){if(u>qd||n>qd)return;let g=this._length;if(this._startIndexes[g]=u,this._endIndexes[g]=n,this._length++,h<1000)this._indentOccurrences[h]=(this._indentOccurrences[h]||0)+1}toIndentRanges(u){let n=this._foldingRangesLimit.limit;if(this._length<=n){this._foldingRangesLimit.update(this._length,!1);let h=new Uint32Array(this._length),g=new Uint32Array(this._length);for(let p=this._length-1,f=0;p>=0;p--,f++)h[f]=this._startIndexes[p],g[f]=this._endIndexes[p];return new Si(h,g)}else{this._foldingRangesLimit.update(this._length,n);let h=0,g=this._indentOccurrences.length;for(let S=0;S<this._indentOccurrences.length;S++){let w=this._indentOccurrences[S];if(w){if(w+h>n){g=S;break}h+=w}}let p=u.getOptions().tabSize,f=new Uint32Array(n),b=new Uint32Array(n);for(let S=this._length-1,w=0;S>=0;S--){let x=this._startIndexes[S],I=u.getLineContent(x),E=Jg(I,p);if(E<g||E===g&&h++<n)f[w]=x,b[w]=this._endIndexes[S],w++}return new Si(f,b)}}}var PR={limit:OR,update:()=>{}};function AR(u,n,h,g=PR){let p=u.getOptions().tabSize,f=new Mx(g),b=void 0,S=void 0,w=void 0;if(h)if(h.start.flags===h.end.flags)b=new RegExp(`(${h.start.source})|(?:${h.end.source})`,h.start.flags);else S=h.start,w=h.end;let x=[],I=u.getLineCount()+1;x.push({indent:-1,endAbove:I,line:I});for(let E=u.getLineCount();E>0;E--){let Z=u.getLineContent(E),X=Jg(Z,p),J=x[x.length-1];if(X===-1){if(n)J.endAbove=E;continue}let Q=!1,te=!1,re;if(b){if(b.lastIndex=0,re=b.exec(Z))Q=!!re[1],te=!Q}else{if(S)S.lastIndex=0,Q=S.test(Z);if(!Q&&w)w.lastIndex=0,te=w.test(Z)}if(Q||te)if(Q){let le=x.length-1;while(le>0&&x[le].indent!==-2)le--;if(le>0){x.length=le+1,J=x[le],f.insertFirst(E,J.line,X),J.line=E,J.indent=X,J.endAbove=E;continue}}else{x.push({indent:-2,endAbove:E,line:E});continue}if(J.indent>X){do x.pop(),J=x[x.length-1];while(J.indent>X);let le=J.endAbove-1;if(le-E>=1)f.insertFirst(E,le,X)}if(J.indent===X)J.endAbove=E;else x.push({indent:X,endAbove:E,line:E})}return f.toIndentRanges(u)}var FR=a("editor.foldBackground",{light:be(vd,0.3),dark:be(vd,0.3),hcDark:null,hcLight:null},e(1060,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);a("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},e(1061,"Color of the collapsed text after the first line of a folded range."));a("editorGutter.foldingControlForeground",Pg,e(1062,"Color of the folding control in the editor gutter."));var Vc=Mt("folding-expanded",C.chevronDown,e(1063,"Icon for expanded ranges in the editor glyph margin.")),Kc=Mt("folding-collapsed",C.chevronRight,e(1064,"Icon for collapsed ranges in the editor glyph margin.")),Px=Mt("folding-manual-collapsed",Kc,e(1065,"Icon for manually collapsed ranges in the editor glyph margin.")),Ax=Mt("folding-manual-expanded",Vc,e(1066,"Icon for manually expanded ranges in the editor glyph margin.")),ob={color:bn(FR),position:1},Xd=e(1067,"Click to expand the range."),hg=e(1068,"Click to collapse the range.");class Xi{static{this.COLLAPSED_VISUAL_DECORATION=ue.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Xd,firstLineDecorationClassName:Y.asClassName(Kc)})}static{this.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=ue.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ob,isWholeLine:!0,linesDecorationsTooltip:Xd,firstLineDecorationClassName:Y.asClassName(Kc)})}static{this.MANUALLY_COLLAPSED_VISUAL_DECORATION=ue.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Xd,firstLineDecorationClassName:Y.asClassName(Px)})}static{this.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=ue.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ob,isWholeLine:!0,linesDecorationsTooltip:Xd,firstLineDecorationClassName:Y.asClassName(Px)})}static{this.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=ue.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:Xd})}static{this.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=ue.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:ob,isWholeLine:!0,linesDecorationsTooltip:Xd})}static{this.EXPANDED_VISUAL_DECORATION=ue.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Y.asClassName(Vc),linesDecorationsTooltip:hg})}static{this.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=ue.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:Y.asClassName(Vc),linesDecorationsTooltip:hg})}static{this.MANUALLY_EXPANDED_VISUAL_DECORATION=ue.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+Y.asClassName(Ax),linesDecorationsTooltip:hg})}static{this.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=ue.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:Y.asClassName(Ax),linesDecorationsTooltip:hg})}static{this.NO_CONTROLS_EXPANDED_RANGE_DECORATION=ue.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0})}static{this.HIDDEN_RANGE_DECORATION=ue.register({description:"folding-hidden-range-decoration",stickiness:1})}constructor(u){this.editor=u,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(u,n,h){if(n)return Xi.HIDDEN_RANGE_DECORATION;if(this.showFoldingControls==="never"){if(u)return this.showFoldingHighlights?Xi.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Xi.NO_CONTROLS_COLLAPSED_RANGE_DECORATION;return Xi.NO_CONTROLS_EXPANDED_RANGE_DECORATION}if(u)return h?this.showFoldingHighlights?Xi.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Xi.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Xi.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Xi.COLLAPSED_VISUAL_DECORATION;else if(this.showFoldingControls==="mouseover")return h?Xi.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Xi.EXPANDED_AUTO_HIDE_VISUAL_DECORATION;else return h?Xi.MANUALLY_EXPANDED_VISUAL_DECORATION:Xi.EXPANDED_VISUAL_DECORATION}changeDecorations(u){return this.editor.changeDecorations(u)}removeDecorations(u){this.editor.removeDecorations(u)}}var HR={},WR="syntax";class Yd{constructor(u,n,h,g,p){if(this.editorModel=u,this.providers=n,this.handleFoldingRangesChange=h,this.foldingRangesLimit=g,this.fallbackRangeProvider=p,this.id=WR,this.disposables=new d,p)this.disposables.add(p);for(let f of n)if(typeof f.onDidChange==="function")this.disposables.add(f.onDidChange(h))}compute(u){return BR(this.providers,this.editorModel,u).then((n)=>{if(this.editorModel.isDisposed())return null;if(n)return VR(n,this.foldingRangesLimit);return this.fallbackRangeProvider?.compute(u)??null})}dispose(){this.disposables.dispose()}}function BR(u,n,h){let g=null,p=u.map((f,b)=>Promise.resolve(f.provideFoldingRanges(n,HR,h)).then((S)=>{if(h.isCancellationRequested)return;if(Array.isArray(S)){if(!Array.isArray(g))g=[];let w=n.getLineCount();for(let x of S)if(x.start>0&&x.end>x.start&&x.end<=w)g.push({start:x.start,end:x.end,rank:b,kind:x.kind})}},vt));return Promise.all(p).then((f)=>g)}class Fx{constructor(u){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=u}add(u,n,h,g){if(u>qd||n>qd)return;let p=this._length;if(this._startIndexes[p]=u,this._endIndexes[p]=n,this._nestingLevels[p]=g,this._types[p]=h,this._length++,g<30)this._nestingLevelCounts[g]=(this._nestingLevelCounts[g]||0)+1}toIndentRanges(){let u=this._foldingRangesLimit.limit;if(this._length<=u){this._foldingRangesLimit.update(this._length,!1);let n=new Uint32Array(this._length),h=new Uint32Array(this._length);for(let g=0;g<this._length;g++)n[g]=this._startIndexes[g],h[g]=this._endIndexes[g];return new Si(n,h,this._types)}else{this._foldingRangesLimit.update(this._length,u);let n=0,h=this._nestingLevelCounts.length;for(let b=0;b<this._nestingLevelCounts.length;b++){let S=this._nestingLevelCounts[b];if(S){if(S+n>u){h=b;break}n+=S}}let g=new Uint32Array(u),p=new Uint32Array(u),f=[];for(let b=0,S=0;b<this._length;b++){let w=this._nestingLevels[b];if(w<h||w===h&&n++<u)g[S]=this._startIndexes[b],p[S]=this._endIndexes[b],f[S]=this._types[b],S++}return new Si(g,p,f)}}}function VR(u,n){let h=u.sort((b,S)=>{let w=b.start-S.start;if(w===0)w=b.rank-S.rank;return w}),g=new Fx(n),p=void 0,f=[];for(let b of h)if(!p)p=b,g.add(b.start,b.end,b.kind&&b.kind.value,f.length);else if(b.start>p.start)if(b.end<=p.end)f.push(p),p=b,g.add(b.start,b.end,b.kind&&b.kind.value,f.length);else{if(b.start>p.end){do p=f.pop();while(p&&b.start>p.end);if(p)f.push(p);p=b}g.add(b.start,b.end,b.kind&&b.kind.value,f.length)}return g.toIndentRanges()}var KR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},zc=function(u,n){return function(h,g){n(h,g,u)}},Uc,Qt=new P("foldingEnabled",!1),Gn=class u extends i{static{Uc=this}static{this.ID="editor.contrib.folding"}static get(n){return n.getContribution(Uc.ID)}static getFoldingRangeProviders(n,h){let g=n.foldingRangeProvider.ordered(h);return Uc._foldingRangeSelector?.(g,h)??g}constructor(n,h,g,p,f,b){super();this.contextKeyService=h,this.languageConfigurationService=g,this.languageFeaturesService=b,this.localToDispose=this._register(new d),this.editor=n,this._foldingLimitReporter=this._register(new ug(n));let S=this.editor.getOptions();this._isEnabled=S.get(52),this._useFoldingProviders=S.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=S.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=S.get(55),this.updateDebounceInfo=f.for(b.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 Xi(n),this.foldingDecorationProvider.showFoldingControls=S.get(126),this.foldingDecorationProvider.showFoldingHighlights=S.get(54),this.foldingEnabled=Qt.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration((w)=>{if(w.hasChanged(52))this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged();if(w.hasChanged(56))this.onModelChanged();if(w.hasChanged(126)||w.hasChanged(54)){let x=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=x.get(126),this.foldingDecorationProvider.showFoldingHighlights=x.get(54),this.triggerFoldingModelChanged()}if(w.hasChanged(53))this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged();if(w.hasChanged(57))this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57);if(w.hasChanged(55))this._foldingImportsByDefault=this.editor.getOptions().get(55)})),this.onModelChanged()}saveViewState(){let n=this.editor.getModel();if(!n||!this._isEnabled||n.isTooLargeForTokenization())return{};if(this.foldingModel){let h=this.foldingModel.getMemento(),g=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:h,lineCount:n.getLineCount(),provider:g,foldedImports:this._currentModelHasFoldedImports}}return}restoreViewState(n){let h=this.editor.getModel();if(!h||!this._isEnabled||h.isTooLargeForTokenization()||!this.hiddenRangeModel)return;if(!n)return;if(this._currentModelHasFoldedImports=!!n.foldedImports,n.collapsedRegions&&n.collapsedRegions.length>0&&this.foldingModel){this._restoringViewState=!0;try{this.foldingModel.applyMemento(n.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();let n=this.editor.getModel();if(!this._isEnabled||!n||n.isTooLargeForTokenization())return;this._currentModelHasFoldedImports=!1,this.foldingModel=new $_(n,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new ib(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange((h)=>this.onHiddenRangesChanges(h))),this.updateScheduler=new Ji(this.updateDebounceInfo.get(n)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new ke(()=>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((h)=>this.onDidChangeModelContent(h))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown((h)=>this.onEditorMouseDown(h))),this.localToDispose.add(this.editor.onMouseUp((h)=>this.onEditorMouseUp(h))),this.localToDispose.add({dispose:()=>{if(this.foldingRegionPromise)this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null;this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged()}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(n){if(this.rangeProvider)return this.rangeProvider;let h=new Zd(n,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=h,this._useFoldingProviders&&this.foldingModel){let g=Uc.getFoldingRangeProviders(this.languageFeaturesService,n);if(g.length>0)this.rangeProvider=new Yd(n,g,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,h)}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(n){this.hiddenRangeModel?.notifyChangeModelContent(n),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){if(this.updateScheduler){if(this.foldingRegionPromise)this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null;this.foldingModelPromise=this.updateScheduler.trigger(()=>{let n=this.foldingModel;if(!n)return null;let h=new dn,g=this.getRangeProvider(n.textModel),p=this.foldingRegionPromise=Zt((f)=>g.compute(f));return p.then((f)=>{if(f&&p===this.foldingRegionPromise){let b;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){let x=f.setCollapsedAllOfType(bs.Imports.value,!0);if(x)b=rs.capture(this.editor),this._currentModelHasFoldedImports=x}let S=this.editor.getSelections();n.update(f,zR(S)),b?.restore(this.editor);let w=this.updateDebounceInfo.update(n.textModel,h.elapsed());if(this.updateScheduler)this.updateScheduler.defaultDelay=w}return n})}).then(void 0,(n)=>(ee(n),null))}}onHiddenRangesChanges(n){if(this.hiddenRangeModel&&n.length&&!this._restoringViewState){let h=this.editor.getSelections();if(h){if(this.hiddenRangeModel.adjustSelections(h))this.editor.setSelections(h)}}this.editor.setHiddenAreas(n,this)}onCursorPositionChanged(){if(this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges())this.cursorChangedScheduler.schedule()}revealCursor(){let n=this.getFoldingModel();if(!n)return;n.then((h)=>{if(h){let g=this.editor.getSelections();if(g&&g.length>0){let p=[];for(let f of g){let b=f.selectionStartLineNumber;if(this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(b))p.push(...h.getAllRegionsAtLine(b,(S)=>S.isCollapsed&&b>S.startLineNumber))}if(p.length)h.toggleCollapseState(p),this.reveal(g[0].getPosition())}}}).then(void 0,ee)}onEditorMouseDown(n){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!n.target||!n.target.range)return;if(!n.event.leftButton&&!n.event.middleButton)return;let h=n.target.range,g=!1;switch(n.target.type){case 4:{let p=n.target.detail,f=n.target.element.offsetLeft;if(p.offsetX-f<4)return;g=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()){if(!n.target.detail.isAfterLines)break}return}case 6:{if(this.hiddenRangeModel.hasRanges()){let p=this.editor.getModel();if(p&&h.startColumn===p.getLineMaxColumn(h.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:h.startLineNumber,iconClicked:g}}onEditorMouseUp(n){let h=this.foldingModel;if(!h||!this.mouseDownInfo||!n.target)return;let g=this.mouseDownInfo.lineNumber,p=this.mouseDownInfo.iconClicked,f=n.target.range;if(!f||f.startLineNumber!==g)return;if(p){if(n.target.type!==4)return}else{let S=this.editor.getModel();if(!S||f.startColumn!==S.getLineMaxColumn(g))return}let b=h.getRegionAtLine(g);if(b&&b.startLineNumber===g){let S=b.isCollapsed;if(p||S){let w=n.event.altKey,x=[];if(w){let I=(Z)=>!Z.containedBy(b)&&!b.containedBy(Z),E=h.getRegionsInside(null,I);for(let Z of E)if(Z.isCollapsed)x.push(Z);if(x.length===0)x=E}else{let I=n.event.middleButton||n.event.shiftKey;if(I){for(let E of h.getRegionsInside(b))if(E.isCollapsed===S)x.push(E)}if(S||!I||x.length===0)x.push(b)}h.toggleCollapseState(x),this.reveal({lineNumber:g,column:1})}}}reveal(n){this.editor.revealPositionInCenterIfOutsideViewport(n,0)}};Gn=Uc=KR([zc(1,K),zc(2,ht),zc(3,wt),zc(4,ur),zc(5,V)],Gn);class ug extends i{constructor(u){super();this.editor=u,this._onDidChange=this._register(new r),this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(56)}update(u,n){if(u!==this._computed||n!==this._limited)this._computed=u,this._limited=n,this._onDidChange.fire()}}class ei extends U{runEditorCommand(u,n,h){let g=u.get(ht),p=Gn.get(n);if(!p)return;let f=p.getFoldingModel();if(f)return this.reportTelemetry(u,n),f.then((b)=>{if(b){this.invoke(p,b,n,h,g);let S=n.getSelection();if(S)p.reveal(S.getStartPosition())}})}getSelectedLines(u){let n=u.getSelections();return n?n.map((h)=>h.startLineNumber):[]}getLineNumbers(u,n){if(u&&u.selectionLines)return u.selectionLines.map((h)=>h+1);return this.getSelectedLines(n)}run(u,n){}}function zR(u){if(!u||u.length===0)return{startsInside:()=>!1};return{startsInside(n,h){for(let g of u){let p=g.startLineNumber;if(p>=n&&p<=h)return!0}return!1}}}function Hx(u){if(!sr(u)){if(!cn(u))return!1;let n=u;if(!sr(n.levels)&&!Ms(n.levels))return!1;if(!sr(n.direction)&&!Ln(n.direction))return!1;if(!sr(n.selectionLines)&&(!Array.isArray(n.selectionLines)||!n.selectionLines.every(Ms)))return!1}return!0}class Wx extends ei{constructor(){super({id:"editor.unfold",label:y(1040,"Unfold"),precondition:Qt,kbOpts:{kbExpr:o.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:
|
|
22
|
+
* 'levels': Number of levels to unfold. If not set, defaults to 1.
|
|
23
|
+
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
|
|
24
|
+
* '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.
|
|
25
|
+
`,constraint:Hx,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(u,n,h,g){let p=g&&g.levels||1,f=this.getLineNumbers(g,h);if(g&&g.direction==="up")j_(n,!1,p,f);else Oa(n,!1,p,f)}}class Bx extends ei{constructor(){super({id:"editor.unfoldRecursively",label:y(1041,"Unfold Recursively"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2142),weight:100}})}invoke(u,n,h,g){Oa(n,!1,Number.MAX_VALUE,this.getSelectedLines(h))}}class Vx extends ei{constructor(){super({id:"editor.fold",label:y(1042,"Fold"),precondition:Qt,kbOpts:{kbExpr:o.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:
|
|
26
|
+
* 'levels': Number of levels to fold.
|
|
27
|
+
* 'direction': If 'up', folds given number of levels up otherwise folds down.
|
|
28
|
+
* '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.
|
|
29
|
+
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
|
|
30
|
+
`,constraint:Hx,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(u,n,h,g){let p=this.getLineNumbers(g,h),f=g&&g.levels,b=g&&g.direction;if(typeof f!=="number"&&typeof b!=="string")Dx(n,!0,p);else if(b==="up")j_(n,!0,f||1,p);else Oa(n,!0,f||1,p)}}class Kx extends ei{constructor(){super({id:"editor.toggleFold",label:y(1043,"Toggle Fold"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2090),weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);Bc(n,1,g)}}class zx extends ei{constructor(){super({id:"editor.foldRecursively",label:y(1044,"Fold Recursively"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2140),weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);Oa(n,!0,Number.MAX_VALUE,g)}}class Ux extends ei{constructor(){super({id:"editor.toggleFoldRecursively",label:y(1045,"Toggle Fold Recursively"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,3114),weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);Bc(n,Number.MAX_VALUE,g)}}class $x extends ei{constructor(){super({id:"editor.foldAllBlockComments",label:y(1046,"Fold All Block Comments"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2138),weight:100}})}invoke(u,n,h,g,p){if(n.regions.hasTypes())cg(n,bs.Comment.value,!0);else{let f=h.getModel();if(!f)return;let b=p.getLanguageConfiguration(f.getLanguageId()).comments;if(b&&b.blockCommentStartToken){let S=new RegExp("^\\s*"+qi(b.blockCommentStartToken));lg(n,S,!0)}}}}class jx extends ei{constructor(){super({id:"editor.foldAllMarkerRegions",label:y(1047,"Fold All Regions"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2077),weight:100}})}invoke(u,n,h,g,p){if(n.regions.hasTypes())cg(n,bs.Region.value,!0);else{let f=h.getModel();if(!f)return;let b=p.getLanguageConfiguration(f.getLanguageId()).foldingRules;if(b&&b.markers&&b.markers.start){let S=new RegExp(b.markers.start);lg(n,S,!0)}}}}class Gx extends ei{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:y(1048,"Unfold All Regions"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2078),weight:100}})}invoke(u,n,h,g,p){if(n.regions.hasTypes())cg(n,bs.Region.value,!1);else{let f=h.getModel();if(!f)return;let b=p.getLanguageConfiguration(f.getLanguageId()).foldingRules;if(b&&b.markers&&b.markers.start){let S=new RegExp(b.markers.start);lg(n,S,!1)}}}}class qx extends ei{constructor(){super({id:"editor.foldAllExcept",label:y(1049,"Fold All Except Selected"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2136),weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);Z_(n,!0,g)}}class Zx extends ei{constructor(){super({id:"editor.unfoldAllExcept",label:y(1050,"Unfold All Except Selected"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2134),weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);Z_(n,!1,g)}}class Xx extends ei{constructor(){super({id:"editor.foldAll",label:y(1051,"Fold All"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2069),weight:100}})}invoke(u,n,h){Oa(n,!0)}}class Yx extends ei{constructor(){super({id:"editor.unfoldAll",label:y(1052,"Unfold All"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2088),weight:100}})}invoke(u,n,h){Oa(n,!1)}}class jc extends ei{static{this.ID_PREFIX="editor.foldLevel"}static{this.ID=(u)=>jc.ID_PREFIX+u}getFoldingLevel(){return parseInt(this.id.substr(jc.ID_PREFIX.length))}invoke(u,n,h){Rx(n,this.getFoldingLevel(),!0,this.getSelectedLines(h))}}class Jx extends ei{constructor(){super({id:"editor.gotoParentFold",label:y(1053,"Go to Parent Fold"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);if(g.length>0){let p=kx(g[0],n);if(p!==null)h.setSelection({startLineNumber:p,startColumn:1,endLineNumber:p,endColumn:1})}}}class Qx extends ei{constructor(){super({id:"editor.gotoPreviousFold",label:y(1054,"Go to Previous Folding Range"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);if(g.length>0){let p=Tx(g[0],n);if(p!==null)h.setSelection({startLineNumber:p,startColumn:1,endLineNumber:p,endColumn:1})}}}class eI extends ei{constructor(){super({id:"editor.gotoNextFold",label:y(1055,"Go to Next Folding Range"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,weight:100}})}invoke(u,n,h){let g=this.getSelectedLines(h);if(g.length>0){let p=Nx(g[0],n);if(p!==null)h.setSelection({startLineNumber:p,startColumn:1,endLineNumber:p,endColumn:1})}}}class tI extends ei{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:y(1056,"Create Folding Range from Selection"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2135),weight:100}})}invoke(u,n,h){let g=[],p=h.getSelections();if(p){for(let f of p){let b=f.endLineNumber;if(f.endColumn===1)--b;if(b>f.startLineNumber)g.push({startLineNumber:f.startLineNumber,endLineNumber:b,type:void 0,isCollapsed:!0,source:1}),h.setSelection({startLineNumber:f.startLineNumber,startColumn:1,endLineNumber:f.startLineNumber,endColumn:1})}if(g.length>0){g.sort((b,S)=>b.startLineNumber-S.startLineNumber);let f=Si.sanitizeAndMerge(n.regions,g,h.getModel()?.getLineCount());n.updatePost(Si.fromFoldRanges(f))}}}}class iI extends ei{constructor(){super({id:"editor.removeManualFoldingRanges",label:y(1057,"Remove Manual Folding Ranges"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2137),weight:100}})}invoke(u,n,h){let g=h.getSelections();if(g)n.removeManualRanges(g),u.triggerFoldingModelChanged()}}class oI extends ei{constructor(){super({id:"editor.toggleImportFold",label:y(1058,"Toggle Import Fold"),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,weight:100}})}async invoke(u,n){let h=[],g=n.regions;for(let p=g.length-1;p>=0;p--)if(g.getType(p)===bs.Imports.value)h.push(g.toRegion(p));n.toggleCollapseState(h),u.triggerFoldingModelChanged()}}fe(Gn.ID,Gn,0);A(Wx);A(Bx);A(Vx);A(zx);A(Ux);A(Xx);A(Yx);A($x);A(jx);A(Gx);A(qx);A(Zx);A(Kx);A(Jx);A(Qx);A(eI);A(tI);A(iI);A(oI);for(let u=1;u<=7;u++)b2(new jc({id:jc.ID(u),label:y(1059,"Fold Level {0}",u),precondition:Qt,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2048|21+u),weight:100}}));$e.registerCommand("_executeFoldingRangeProvider",async function(u,...n){let[h]=n;if(!(h instanceof q))throw xr();let g=u.get(V),p=u.get(Et).getModel(h);if(!p)throw xr();let f=u.get(oe);if(!f.getValue("editor.folding",{resource:h}))return[];let b=u.get(ht),S=f.getValue("editor.foldingStrategy",{resource:h}),w={get limit(){return f.getValue("editor.foldingMaximumRegions",{resource:h})},update:(X,J)=>{}},x=new Zd(p,b,w),I=x;if(S!=="indentation"){let X=Gn.getFoldingRangeProviders(g,p);if(X.length)I=new Yd(p,X,()=>{},w,x)}let E=await I.compute(xe.None),Z=[];try{if(E)for(let X=0;X<E.length;X++){let J=E.getType(X);Z.push({start:E.getStartLineNumber(X),end:E.getEndLineNumber(X),kind:J?bs.fromValue(J):void 0})}return Z}finally{I.dispose()}});var nI=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},gg=function(u,n){return function(h,g){n(h,g,u)}};class nb{constructor(u,n,h){this.marker=u,this.index=n,this.total=h}}var rb=class u{constructor(n,h,g){if(this._markerService=h,this._configService=g,this._onDidChange=new r,this.onDidChange=this._onDidChange.event,this._dispoables=new d,this._markers=[],this._nextIdx=-1,q.isUri(n))this._resourceFilter=(S)=>S.toString()===n.toString();else if(n)this._resourceFilter=n;let p=this._configService.getValue("problems.sortOrder"),f=(S,w)=>{let x=$f(S.resource.toString(),w.resource.toString());if(x===0)if(p==="position")x=t.compareRangesUsingStarts(S,w)||sn.compare(S.severity,w.severity);else x=sn.compare(S.severity,w.severity)||t.compareRangesUsingStarts(S,w);return x},b=()=>{let S=this._markerService.read({resource:q.isUri(n)?n:void 0,severities:sn.Error|sn.Warning|sn.Info});if(typeof n==="function")S=S.filter((w)=>this._resourceFilter(w.resource));if(S.sort(f),ot(S,this._markers,(w,x)=>w.resource.toString()===x.resource.toString()&&w.startLineNumber===x.startLineNumber&&w.startColumn===x.startColumn&&w.endLineNumber===x.endLineNumber&&w.endColumn===x.endColumn&&w.severity===x.severity&&w.message===x.message))return!1;return this._markers=S,!0};b(),this._dispoables.add(h.onMarkerChanged((S)=>{if(!this._resourceFilter||S.some((w)=>this._resourceFilter(w))){if(b())this._nextIdx=-1,this._onDidChange.fire()}}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(n){if(!this._resourceFilter&&!n)return!0;if(!this._resourceFilter||!n)return!1;return this._resourceFilter(n)}get selected(){let n=this._markers[this._nextIdx];return n&&new nb(n,this._nextIdx+1,this._markers.length)}_initIdx(n,h,g){let p=this._markers.findIndex((f)=>vs(f.resource,n.uri));if(p<0){if(p=Tf(this._markers.length,(f)=>$f(this._markers[f].resource.toString(),n.uri.toString())),p<0)p=~p;if(g)this._nextIdx=p;else this._nextIdx=(this._markers.length+p-1)%this._markers.length}else{let f=!1,b=!1;for(let S=p;S<this._markers.length;S++){let w=t.lift(this._markers[S]);if(w.isEmpty()){let x=n.getWordAtPosition(w.getStartPosition());if(x)w=new t(w.startLineNumber,x.startColumn,w.startLineNumber,x.endColumn)}if(h&&(w.containsPosition(h)||h.isBeforeOrEqual(w.getStartPosition()))){this._nextIdx=S,f=!0,b=!w.containsPosition(h);break}if(this._markers[S].resource.toString()!==n.uri.toString())break}if(!f)this._nextIdx=g?0:this._markers.length-1;else if(b&&!g)this._nextIdx-=1}if(this._nextIdx<0)this._nextIdx=this._markers.length-1}resetIndex(){this._nextIdx=-1}move(n,h,g){if(this._markers.length===0)return!1;let p=this._nextIdx;if(this._nextIdx===-1)this._initIdx(h,g,n);else if(n)this._nextIdx=(this._nextIdx+1)%this._markers.length;else if(!n)this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length;if(p!==this._nextIdx)return!0;return!1}find(n,h){let g=this._markers.findIndex((p)=>p.resource.toString()===n.toString());if(g<0)return;for(;g<this._markers.length;g++)if(t.containsPosition(this._markers[g],h))return new nb(this._markers[g],g+1,this._markers.length);return}};rb=nI([gg(1,Bo),gg(2,oe)],rb);var ab=ie("IMarkerNavigationService"),sb=class u{constructor(n,h){this._markerService=n,this._configService=h,this._provider=new Vn}getMarkerList(n){for(let h of this._provider){let g=h.getMarkerList(n);if(g)return g}return new rb(n,this._markerService,this._configService)}};sb=nI([gg(0,Bo),gg(1,oe)],sb);_e(ab,sb,1);var UR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},qn=function(u,n){return function(h,g){n(h,g,u)}},Hi=class u extends $c{constructor(n,h,g,p,f,b,S,w,x,I,E,Z,X,J){super(n,{...p.getRawOptions(),overflowWidgetsDomNode:p.getOverflowWidgetsDomNode()},g,f,b,S,w,x,I,E,Z,X,J);this._parentEditor=p,this._overwriteOptions=h,super.updateOptions(this._overwriteOptions),this._register(p.onDidChangeConfiguration((Q)=>this._onParentConfigurationChanged(Q)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(n){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(n){kg(this._overwriteOptions,n,!0),super.updateOptions(this._overwriteOptions)}};Hi=UR([qn(4,O),qn(5,Te),qn(6,Ue),qn(7,K),qn(8,We),qn(9,wt),qn(10,on),qn(11,ht),qn(12,V),qn(13,Fo)],Hi);function pg(u){let n=u.get(Te).getFocusedCodeEditor();if(n instanceof Hi)return n.getParentEditor();return n}var rI=new v(new N(0,122,204)),$R={showArrow:!0,showFrame:!0,className:"",frameColor:rI,arrowColor:rI,keepEditorSelection:!1},jR="vs.editor.contrib.zoneWidget";class sI{constructor(u,n,h,g,p,f,b,S){this.id="",this.domNode=u,this.afterLineNumber=n,this.afterColumn=h,this.heightInLines=g,this.showInHiddenAreas=b,this.ordinal=S,this._onDomNodeTop=p,this._onComputedHeight=f}onDomNodeTop(u){this._onDomNodeTop(u)}onComputedHeight(u){this._onComputedHeight(u)}}class aI{constructor(u,n){this._id=u,this._domNode=n}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}class db{static{this._IdGenerator=new Hv(".arrow-decoration-")}constructor(u){this._editor=u,this._ruleName=db._IdGenerator.nextId(),this._color=null,this._height=-1,this._decorations=this._editor.createDecorationsCollection()}dispose(){this.hide(),mk(this._ruleName)}set color(u){if(this._color!==u)this._color=u,this._updateStyle()}set height(u){if(this._height!==u)this._height=u,this._updateStyle()}_updateStyle(){mk(this._ruleName),Rv(`.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(u){if(u.column===1)u={lineNumber:u.lineNumber,column:2};this._decorations.set([{range:t.fromPositions(u),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}}class lb{constructor(u,n={}){if(this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._isSashResizeHeight=!1,this._viewZone=null,this._disposables=new d,this.container=null,this._isShowing=!1,this.editor=u,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=za(n),kg(this.options,$R,!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((h)=>{let g=this._getWidth(h);this.domNode.style.width=g+"px",this.domNode.style.left=this._getLeft(h)+"px",this._onWidth(g)}))}dispose(){if(this._overlayWidget)this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null;if(this._viewZone)this.editor.changeViewZones((u)=>{if(this._viewZone)u.removeZone(this._viewZone.id);this._viewZone=null});this._positionMarkerId.clear(),this._disposables.dispose()}create(){if(this.domNode.classList.add("zone-widget"),this.options.className)this.domNode.classList.add(this.options.className);if(this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow)this._arrow=new db(this.editor),this._disposables.add(this._arrow);this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(u){if(u.frameColor)this.options.frameColor=u.frameColor;if(u.arrowColor)this.options.arrowColor=u.arrowColor;this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){let u=this.options.frameColor.toString();this.container.style.borderTopColor=u,this.container.style.borderBottomColor=u}if(this._arrow&&this.options.arrowColor){let u=this.options.arrowColor.toString();this._arrow.color=u}}_getWidth(u){return u.width-u.minimap.minimapWidth-u.verticalScrollbarWidth}_getLeft(u){if(u.minimap.minimapWidth>0&&u.minimap.minimapLeft===0)return u.minimap.minimapWidth;return 0}_onViewZoneTop(u){this.domNode.style.top=u+"px"}_onViewZoneHeight(u){if(this.domNode.style.height=`${u}px`,this.container){let n=u-this._decoratingElementsHeight();this.container.style.height=`${n}px`;let h=this.editor.getLayoutInfo();this._doLayout(n,this._getWidth(h))}this._resizeSash?.layout()}get position(){let u=this._positionMarkerId.getRange(0);if(!u)return;return u.getStartPosition()}show(u,n){let h=t.isIRange(u)?t.lift(u):t.fromPositions(u);this._isShowing=!0,this._showImpl(h,n),this._isShowing=!1,this._positionMarkerId.set([{range:h,options:ue.EMPTY}])}hide(){if(this._viewZone)this.editor.changeViewZones((u)=>{if(this._viewZone)u.removeZone(this._viewZone.id)}),this._viewZone=null;if(this._overlayWidget)this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null;this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){let u=this.editor.getOption(75),n=0;if(this.options.showArrow){let h=Math.round(u/3);n+=2*h}if(this.options.showFrame){let h=this.options.frameWidth??Math.round(u/9);n+=2*h}return n}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*0.8)}_showImpl(u,n){let h=u.getStartPosition(),g=this.editor.getLayoutInfo(),p=this._getWidth(g);this.domNode.style.width=`${p}px`,this.domNode.style.left=this._getLeft(g)+"px";let f=document.createElement("div");f.style.overflow="hidden";let b=this.editor.getOption(75),S=this._getMaximumHeightInLines();if(S!==void 0)n=Math.min(n,S);let w=0,x=0;if(this._arrow&&this.options.showArrow)w=Math.round(b/3),this._arrow.height=w,this._arrow.show(h);if(this.options.showFrame)x=Math.round(b/9);if(this.editor.changeViewZones((Z)=>{if(this._viewZone)Z.removeZone(this._viewZone.id);if(this._overlayWidget)this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null;this.domNode.style.top="-1000px",this._viewZone=new sI(f,h.lineNumber,h.column,n,(X)=>this._onViewZoneTop(X),(X)=>this._onViewZoneHeight(X),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=Z.addZone(this._viewZone),this._overlayWidget=new aI(jR+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){let Z=this.options.frameWidth?this.options.frameWidth:x;this.container.style.borderTopWidth=Z+"px",this.container.style.borderBottomWidth=Z+"px"}let I=n*b-this._decoratingElementsHeight();if(this.container)this.container.style.top=w+"px",this.container.style.height=I+"px",this.container.style.overflow="hidden";if(this._doLayout(I,p),!this.options.keepEditorSelection)this.editor.setSelection(u);let E=this.editor.getModel();if(E){let Z=E.validateRange(new t(u.startLineNumber,1,u.endLineNumber+1,1));this.revealRange(Z,Z.startLineNumber===E.getLineCount())}}revealRange(u,n){if(n)this.editor.revealLineNearTop(u.endLineNumber,0);else this.editor.revealRange(u,0)}setCssClass(u,n){if(!this.container)return;if(n)this.container.classList.remove(n);this.container.classList.add(u)}_onWidth(u){}_doLayout(u,n){}_relayout(u,n){let h=this._getMaximumHeightInLines(),g=n&&h!==void 0?Math.min(h,u):u;if(this._viewZone&&this._viewZone.heightInLines!==g)this.editor.changeViewZones((p)=>{if(this._viewZone)this._viewZone.heightInLines=g,p.layoutZone(this._viewZone.id)}),this._updateSashEnablement()}_initSash(){if(this._resizeSash)return;if(this._resizeSash=this._disposables.add(new gr(this.domNode,this,{orientation:1})),!this.options.isResizeable)this._resizeSash.state=0;let u;this._disposables.add(this._resizeSash.onDidStart((n)=>{if(this._viewZone)u={startY:n.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()}})),this._disposables.add(this._resizeSash.onDidEnd(()=>{u=void 0})),this._disposables.add(this._resizeSash.onDidChange((n)=>{if(u){let h=(n.currentY-u.startY)/this.editor.getOption(75),g=h<0?Math.ceil(h):Math.floor(h),p=u.heightInLines+g;if(p>u.minLines&&p<u.maxLines)this._isSashResizeHeight=!0,this._relayout(p)}}))}_updateSashEnablement(){if(this._resizeSash){let{minLines:u,maxLines:n}=this._getResizeBounds();this._resizeSash.state=u===n?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 u=this.editor.getLayoutInfo();return u.width-u.minimap.minimapWidth}}var dI=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},lI=function(u,n){return function(h,g){n(h,g,u)}},cb=ie("IPeekViewService");_e(cb,class{constructor(){this._widgets=new Map}addExclusiveWidget(u,n){let h=this._widgets.get(u);if(h)h.listener.dispose(),h.widget.dispose();let g=()=>{let p=this._widgets.get(u);if(p&&p.widget===n)p.listener.dispose(),this._widgets.delete(u)};this._widgets.set(u,{widget:n,listener:n.onDidClose(g)})}},1);var gi;(function(u){u.inPeekEditor=new P("inReferenceSearchEditor",!0,e(1382,"Whether the current code editor is embedded inside peek")),u.notInPeekEditor=u.inPeekEditor.toNegated()})(gi||(gi={}));var mg=class u{static{this.ID="editor.contrib.referenceController"}constructor(n,h){if(n instanceof Hi)gi.inPeekEditor.bindTo(h)}dispose(){}};mg=dI([lI(1,K)],mg);fe(mg.ID,mg,0);var GR={headerBackgroundColor:v.white,primaryHeadingColor:v.fromHex("#333333"),secondaryHeadingColor:v.fromHex("#6c6c6cb3")},Jd=class u extends lb{constructor(n,h,g){super(n,h);this.instantiationService=g,this._onDidClose=new r,this.onDidClose=this._onDidClose.event,kg(this.options,GR,!1);let p=ct(this.editor);p.openedPeekWidgets.set(p.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this),this._onDidClose.dispose();let n=ct(this.editor);n.openedPeekWidgets.set(n.openedPeekWidgets.get()-1,void 0)}}style(n){let h=this.options;if(n.headerBackgroundColor)h.headerBackgroundColor=n.headerBackgroundColor;if(n.primaryHeadingColor)h.primaryHeadingColor=n.primaryHeadingColor;if(n.secondaryHeadingColor)h.secondaryHeadingColor=n.secondaryHeadingColor;super.style(n)}_applyStyles(){super._applyStyles();let n=this.options;if(this._headElement&&n.headerBackgroundColor)this._headElement.style.backgroundColor=n.headerBackgroundColor.toString();if(this._primaryHeading&&n.primaryHeadingColor)this._primaryHeading.style.color=n.primaryHeadingColor.toString();if(this._secondaryHeading&&n.secondaryHeadingColor)this._secondaryHeading.style.color=n.secondaryHeadingColor.toString();if(this._bodyElement&&n.frameColor)this._bodyElement.style.borderColor=n.frameColor.toString()}_fillContainer(n){this.setCssClass("peekview-widget"),this._headElement=_(".head"),this._bodyElement=_(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),n.appendChild(this._headElement),n.appendChild(this._bodyElement)}_fillHead(n,h){if(this._titleElement=_(".peekview-title"),this.options.supportOnTitleClick)this._titleElement.classList.add("clickable"),Ct(this._titleElement,"click",(f)=>this._onTitleClick(f));k(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=_("span.filename"),this._secondaryHeading=_("span.dirname"),this._metaHeading=_("span.meta"),k(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);let g=_(".peekview-actions");k(this._headElement,g);let p=this._getActionBarOptions();if(this._actionbarWidget=new er(g,p),this._disposables.add(this._actionbarWidget),!h)this._actionbarWidget.push(this._disposables.add(new _r("peekview.close",e(1383,"Close"),Y.asClassName(C.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(n){}_getActionBarOptions(){return{actionViewItemProvider:Uv.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(n){}setTitle(n,h){if(this._primaryHeading&&this._secondaryHeading)if(this._primaryHeading.innerText=n,this._primaryHeading.setAttribute("title",n),h)this._secondaryHeading.innerText=h;else mn(this._secondaryHeading)}setMetaTitle(n){if(this._metaHeading)if(n)this._metaHeading.innerText=n,Mr(this._metaHeading);else fr(this._metaHeading)}_doLayout(n,h){if(!this._isShowing&&n<0){this.dispose();return}let g=Math.ceil(this.editor.getOption(75)*1.2),p=Math.round(n-(g+1));this._doLayoutHead(g,h),this._doLayoutBody(p,h)}_doLayoutHead(n,h){if(this._headElement)this._headElement.style.height=`${n}px`,this._headElement.style.lineHeight=this._headElement.style.height}_doLayoutBody(n,h){if(this._bodyElement)this._bodyElement.style.height=`${n}px`}};Jd=dI([lI(2,O)],Jd);var cI=a("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:v.black,hcLight:v.white},e(1384,"Background color of the peek view title area.")),fg=a("peekViewTitleLabel.foreground",{dark:v.white,light:v.black,hcDark:v.white,hcLight:Ka},e(1385,"Color of the peek view title.")),bg=a("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},e(1386,"Color of the peek view title info.")),hI=a("peekView.border",{dark:zs,light:zs,hcDark:Be,hcLight:Be},e(1387,"Color of the peek view borders and arrow.")),uI=a("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:v.black,hcLight:v.white},e(1388,"Background color of the peek view result list."));a("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:v.white,hcLight:Ka},e(1389,"Foreground color for line nodes in the peek view result list."));a("peekViewResult.fileForeground",{dark:v.white,light:"#1E1E1E",hcDark:v.white,hcLight:Ka},e(1390,"Foreground color for file nodes in the peek view result list."));a("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},e(1391,"Background color of the selected entry in the peek view result list."));a("peekViewResult.selectionForeground",{dark:v.white,light:"#6C6C6C",hcDark:v.white,hcLight:Ka},e(1392,"Foreground color of the selected entry in the peek view result list."));var hb=a("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:v.black,hcLight:v.white},e(1393,"Background color of the peek view editor."));a("peekViewEditorGutter.background",hb,e(1394,"Background color of the gutter in the peek view editor."));a("peekViewEditorStickyScroll.background",hb,e(1395,"Background color of sticky scroll in the peek view editor."));a("peekViewEditorStickyScrollGutter.background",hb,e(1396,"Background color of the gutter part of sticky scroll in the peek view editor."));a("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},e(1397,"Match highlight color in the peek view result list."));a("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},e(1398,"Match highlight color in the peek view editor."));a("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:Xt,hcLight:Xt},e(1399,"Match highlight border in the peek view editor."));var vg;(function(u){function n(h){switch(h){case hn.Ignore:return"severity-ignore "+Y.asClassName(C.info);case hn.Info:return Y.asClassName(C.info);case hn.Warning:return Y.asClassName(C.warning);case hn.Error:return Y.asClassName(C.error);default:return""}}u.className=n})(vg||(vg={}));var qR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Qd=function(u,n){return function(h,g){n(h,g,u)}},ub;class fI{constructor(u,n,h,g,p){this._openerService=g,this._labelService=p,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new d,this._editor=n;let f=document.createElement("div");f.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),f.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),f.appendChild(this._relatedBlock),this._disposables.add(Ct(this._relatedBlock,"click",(b)=>{b.preventDefault();let S=this._relatedDiagnostics.get(b.target);if(S)h(S)})),this._scrollable=new p0(f,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),u.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll((b)=>{f.style.left=`-${b.scrollLeft}px`,f.style.top=`-${b.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){Ve(this._disposables)}update(u){let{source:n,message:h,relatedInformation:g,code:p}=u,f=(n?.length||0)+2;if(p)if(typeof p==="string")f+=p.length;else f+=p.value.length;let b=Ci(h);this._lines=b.length,this._longestLineLength=0;for(let E of b)this._longestLineLength=Math.max(E.length+f,this._longestLineLength);mn(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(u)),Br(this.getAriaLabel(u)),this._editor.applyFontInfo(this._messageBlock);let S=this._messageBlock;for(let E of b){if(S=document.createElement("div"),S.innerText=E,E==="")S.style.height=this._messageBlock.style.lineHeight;this._messageBlock.appendChild(S)}if(n||p){let E=document.createElement("span");if(E.classList.add("details"),S.appendChild(E),n){let Z=document.createElement("span");Z.innerText=n,Z.classList.add("source"),E.appendChild(Z)}if(p)if(typeof p==="string"){let Z=document.createElement("span");Z.innerText=`(${p})`,Z.classList.add("code"),E.appendChild(Z)}else{this._codeLink=_("a.code-link"),this._codeLink.setAttribute("href",`${p.target.toString()}`),this._codeLink.onclick=(X)=>{this._openerService.open(p.target),X.preventDefault(),X.stopPropagation()};let Z=k(this._codeLink,_("span"));Z.innerText=p.value,E.appendChild(this._codeLink)}}if(mn(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),Kn(g)){let E=this._relatedBlock.appendChild(document.createElement("div"));E.style.paddingTop=`${Math.floor(this._editor.getOption(75)*0.66)}px`,this._lines+=1;for(let Z of g){let X=document.createElement("div"),J=document.createElement("a");J.classList.add("filename"),J.innerText=`${this._labelService.getUriBasenameLabel(Z.resource)}(${Z.startLineNumber}, ${Z.startColumn}): `,J.title=this._labelService.getUriLabel(Z.resource),this._relatedDiagnostics.set(J,Z);let Q=document.createElement("span");Q.innerText=Z.message,X.appendChild(J),X.appendChild(Q),this._lines+=1,E.appendChild(X)}}let w=this._editor.getOption(59),x=Math.ceil(w.typicalFullwidthCharacterWidth*this._longestLineLength*0.75),I=w.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:x,scrollHeight:I})}layout(u,n){this._scrollable.getDomNode().style.height=`${u}px`,this._scrollable.getDomNode().style.width=`${n}px`,this._scrollable.setScrollDimensions({width:n,height:u})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(u){let n="";switch(u.severity){case sn.Error:n=e(1082,"Error");break;case sn.Warning:n=e(1083,"Warning");break;case sn.Info:n=e(1084,"Info");break;case sn.Hint:n=e(1085,"Hint");break}let h=e(1086,"{0}: {1} at {2}. ",n,u.message,u.startLineNumber+":"+u.startColumn),g=this._editor.getModel();if(g&&u.startLineNumber<=g.getLineCount()&&u.startLineNumber>=1)h=`${g.getLineContent(u.startLineNumber)}, ${h}`;return h}}var tl=class u extends Jd{static{ub=this}static{this.TitleMenu=new l("gotoErrorTitleMenu")}constructor(n,h,g,p,f,b,S){super(n,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},f);this._themeService=h,this._openerService=g,this._menuService=p,this._contextKeyService=b,this._labelService=S,this._callOnDispose=new d,this._onDidSelectRelatedInformation=new r,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=sn.Warning,this._backgroundColor=v.white,this._applyTheme(h.getColorTheme()),this._callOnDispose.add(h.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(n){this._backgroundColor=n.getColor(JR);let h=gb,g=ZR;if(this._severity===sn.Warning)h=wg,g=XR;else if(this._severity===sn.Info)h=pb,g=YR;let p=n.getColor(h),f=n.getColor(g);this.style({arrowColor:p,frameColor:p,headerBackgroundColor:f,primaryHeadingColor:n.getColor(fg),secondaryHeadingColor:n.getColor(bg)})}_applyStyles(){if(this._parentContainer)this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():"";super._applyStyles()}dispose(){this._callOnDispose.dispose(),this._onDidSelectRelatedInformation.dispose(),super.dispose()}_fillHead(n){super._fillHead(n),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun((p)=>this.editor.focus()));let h=this._menuService.getMenuActions(ub.TitleMenu,this._contextKeyService),g=U2(h);this._actionbarWidget.push(g,{label:!1,icon:!0,index:0})}_fillTitleIcon(n){this._icon=k(n,_(""))}_fillBody(n){this._parentContainer=n,n.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),n.appendChild(this._container),this._message=new fI(this._container,this.editor,(h)=>this._onDidSelectRelatedInformation.fire(h),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw Error("call showAtMarker")}showAtMarker(n,h,g){this._container.classList.remove("stale"),this._message.update(n),this._severity=n.severity,this._applyTheme(this._themeService.getColorTheme());let p=t.lift(n),f=this.editor.getPosition(),b=f&&p.containsPosition(f)?f:p.getStartPosition();super.show(b,this.computeRequiredHeight());let S=this.editor.getModel();if(S){let w=g>1?e(1087,"{0} of {1} problems",h,g):e(1088,"{0} of {1} problem",h,g);this.setTitle(Pi(S.uri),w)}this._icon.className=`codicon ${vg.className(sn.toSeverity(this._severity))}`,this.editor.revealPositionInCenterIfOutsideViewport(b,0),this.editor.focus()}updateMarker(n){this._container.classList.remove("stale"),this._message.update(n)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(n,h){super._doLayoutBody(n,h),this._heightInPixel=n,this._message.layout(n,h),this._container.style.height=`${n}px`}_onWidth(n){this._message.layout(this._heightInPixel,n)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}};tl=ub=qR([Qd(1,We),Qd(2,Xr),Qd(3,Ai),Qd(4,O),Qd(5,K),Qd(6,Ic)],tl);var gI=Ag(Fg,x2),pI=Ag(Ga,Wf),mI=Ag(zs,zf),gb=a("editorMarkerNavigationError.background",{dark:gI,light:gI,hcDark:Be,hcLight:Be},e(1089,"Editor marker navigation widget error color.")),ZR=a("editorMarkerNavigationError.headerBackground",{dark:be(gb,0.1),light:be(gb,0.1),hcDark:null,hcLight:null},e(1090,"Editor marker navigation widget error heading background.")),wg=a("editorMarkerNavigationWarning.background",{dark:pI,light:pI,hcDark:Be,hcLight:Be},e(1091,"Editor marker navigation widget warning color.")),XR=a("editorMarkerNavigationWarning.headerBackground",{dark:be(wg,0.1),light:be(wg,0.1),hcDark:"#0C141F",hcLight:be(wg,0.2)},e(1092,"Editor marker navigation widget warning heading background.")),pb=a("editorMarkerNavigationInfo.background",{dark:mI,light:mI,hcDark:Be,hcLight:Be},e(1093,"Editor marker navigation widget info color.")),YR=a("editorMarkerNavigationInfo.headerBackground",{dark:be(pb,0.1),light:be(pb,0.1),hcDark:null,hcLight:null},e(1094,"Editor marker navigation widget info heading background.")),JR=a("editorMarkerNavigation.background",Zr,e(1095,"Editor marker navigation widget background."));var QR=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},yg=function(u,n){return function(h,g){n(h,g,u)}},Gc,Ls=class u{static{Gc=this}static{this.ID="editor.contrib.markerController"}static get(n){return n.getContribution(Gc.ID)}constructor(n,h,g,p,f){this._markerNavigationService=h,this._contextKeyService=g,this._editorService=p,this._instantiationService=f,this._sessionDispoables=new d,this._editor=n,this._widgetVisible=_I.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(n){if(this._model&&this._model.matches(n))return this._model;let h=!1;if(this._model)h=!0,this._cleanUp();if(this._model=this._markerNavigationService.getMarkerList(n),h)this._model.move(!0,this._editor.getModel(),this._editor.getPosition());return this._widget=this._instantiationService.createInstance(tl,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((g)=>{if(!this._model?.selected||!t.containsPosition(this._model?.selected.marker,g.position))this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;let g=this._model.find(this._editor.getModel().uri,this._widget.position);if(g)this._widget.updateMarker(g.marker);else this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation((g)=>{this._editorService.openCodeEditor({resource:g.resource,options:{pinned:!0,revealIfOpened:!0,selection:t.lift(g).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(n=!0){if(this._cleanUp(),n)this._editor.focus()}showAtMarker(n){if(!this._editor.hasModel())return;let h=this._editor.getModel(),g=this._getOrCreateModel(h.uri);if(g.resetIndex(),g.move(!0,h,new s(n.startLineNumber,n.startColumn)),g.selected)this._widget.showAtMarker(g.selected.marker,g.selected.index,g.selected.total)}async navigate(n,h){if(!this._editor.hasModel())return;let g=this._editor.getModel(),p=this._getOrCreateModel(h?void 0:g.uri);if(p.move(n,g,this._editor.getPosition()),!p.selected)return;if(p.selected.marker.resource.toString()!==g.uri.toString()){this._cleanUp();let f=await this._editorService.openCodeEditor({resource:p.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:p.selected.marker}},this._editor);if(f)Gc.get(f)?.close(),Gc.get(f)?.navigate(n,h)}else this._widget.showAtMarker(p.selected.marker,p.selected.index,p.selected.total)}};Ls=Gc=QR([yg(1,ab),yg(2,K),yg(3,Te),yg(4,O)],Ls);class qc extends U{constructor(u,n,h){super(h);this._next=u,this._multiFile=n}async run(u,n){if(n.hasModel())await Ls.get(n)?.navigate(this._next,this._multiFile)}}class Er extends qc{static{this.ID="editor.action.marker.next"}static{this.LABEL=y(1078,"Go to Next Problem (Error, Warning, Info)")}constructor(){super(!0,!1,{id:Er.ID,label:Er.LABEL,precondition:void 0,kbOpts:{kbExpr:o.focus,primary:578,weight:100},menuOpts:{menuId:tl.TitleMenu,title:Er.LABEL.value,icon:Mt("marker-navigation-next",C.arrowDown,e(1074,"Icon for goto next marker.")),group:"navigation",order:1}})}}class Ma extends qc{static{this.ID="editor.action.marker.prev"}static{this.LABEL=y(1079,"Go to Previous Problem (Error, Warning, Info)")}constructor(){super(!1,!1,{id:Ma.ID,label:Ma.LABEL,precondition:void 0,kbOpts:{kbExpr:o.focus,primary:1602,weight:100},menuOpts:{menuId:tl.TitleMenu,title:Ma.LABEL.value,icon:Mt("marker-navigation-previous",C.arrowUp,e(1075,"Icon for goto previous marker.")),group:"navigation",order:2}})}}class Zc extends qc{static{this.ID="editor.action.marker.nextInFiles"}constructor(){super(!0,!0,{id:Zc.ID,label:y(1080,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:66,weight:100},menuOpts:{menuId:l.MenubarGoMenu,title:e(1076,"Next &&Problem"),group:"6_problem_nav",order:1}})}}class Xc extends qc{static{this.ID="editor.action.marker.prevInFiles"}constructor(){super(!1,!0,{id:Xc.ID,label:y(1081,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:o.focus,primary:1090,weight:100},menuOpts:{menuId:l.MenubarGoMenu,title:e(1077,"Previous &&Problem"),group:"6_problem_nav",order:2}})}}fe(Ls.ID,Ls,4);A(Er);A(Ma);A(Zc);A(Xc);var _I=new P("markersNavigationVisible",!1),tk=nn.bindToContribution(Ls.get);G(new tk({id:"closeMarkersNavigation",precondition:_I,handler:(u)=>u.close(),kbOpts:{weight:150,kbExpr:o.focus,primary:9,secondary:[1033]}}));class W_{constructor(u){this.options=u,this.rangeHighlightDecorationId=void 0}provide(u,n,h){let g=new d;u.canAcceptInBackground=!!this.options?.canAcceptInBackground,u.matchOnLabel=u.matchOnDescription=u.matchOnDetail=u.sortByLabel=!1;let p=g.add(new de);return p.value=this.doProvide(u,n,h),g.add(this.onDidActiveTextEditorControlChange(()=>{p.value=void 0,p.value=this.doProvide(u,n)})),g}doProvide(u,n,h){let g=new d,p=this.activeTextEditorControl;if(p&&this.canProvideWithTextEditor(p)){let f={editor:p},b=tE(p);if(b){let S=p.saveViewState()??void 0;g.add(b.onDidChangeCursorPosition(()=>{S=p.saveViewState()??void 0})),f.restoreViewState=()=>{if(S&&p===this.activeTextEditorControl)p.restoreViewState(S)},g.add(js(n.onCancellationRequested)(()=>f.restoreViewState?.()))}g.add(D(()=>this.clearDecorations(p))),g.add(this.provideWithTextEditor(f,u,n,h))}else g.add(this.provideWithoutTextEditor(u,n));return g}canProvideWithTextEditor(u){return!0}gotoLocation({editor:u},n){if(u.setSelection(n.range,"code.jump"),u.revealRangeInCenter(n.range,0),!n.preserveFocus)u.focus();let h=this.getModel(u);if(h){let g=h.getLineContent(n.range.startLineNumber);Br(e(1401,"Line {0}, column {1}: {2}",n.range.startLineNumber,n.range.startColumn,g))}}getModel(u){return Yv(u)?u.getModel()?.modified:u.getModel()}addDecorations(u,n){u.changeDecorations((h)=>{let g=[];if(this.rangeHighlightDecorationId)g.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),g.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0;let p=[{range:n,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:n,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:bn(Ck),position:Yr.Full}}}],[f,b]=h.deltaDecorations(g,p);this.rangeHighlightDecorationId={rangeHighlightId:f,overviewRulerDecorationId:b}})}clearDecorations(u){let n=this.rangeHighlightDecorationId;if(n)u.changeDecorations((h)=>{h.deltaDecorations([n.overviewRulerDecorationId,n.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0}}class il extends W_{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(il.ZERO_BASED_OFFSET_STORAGE_KEY,-1,!1)}set useZeroBasedOffset(u){this.storageService.store(il.ZERO_BASED_OFFSET_STORAGE_KEY,u,-1,0)}provideWithoutTextEditor(u){let n=e(1402,"Open a text editor first to go to a line or an offset.");return u.items=[{label:n}],u.ariaLabel=n,i.None}provideWithTextEditor(u,n,h){let g=u.editor,p=new d;n.ariaLabel=e(1403,"Go to line. Type a line number, optionally followed by colon and column number."),p.add(n.onDidAccept((w)=>{let[x]=n.selectedItems;if(x){if(!x.lineNumber)return;if(this.gotoLocation(u,{range:this.toRange(x.lineNumber,x.column),keyMods:n.keyMods,preserveFocus:w.inBackground}),!w.inBackground)n.hide()}}));let f={iconClass:Y.asClassName(C.indexZero),tooltip:e(1404,"Toggle Zero-Based Offset"),location:Yg.Input,toggle:{checked:this.useZeroBasedOffset}},b=()=>{let w=n.value.trim().substring(il.GO_TO_LINE_PREFIX.length),{inOffsetMode:x,lineNumber:I,column:E,label:Z}=this.parsePosition(g,w);if(n.buttons=x?[f]:[],n.items=[{lineNumber:I,column:E,label:Z,ariaLabel:I?e(1405,"Go to line {0}, column {1}. Press Enter to navigate.",I,E||1):Z}],!I){this.clearDecorations(g);return}let X=this.toRange(I,E);g.revealRangeInCenter(X,0),this.addDecorations(g,X)};p.add(n.onDidTriggerButton((w)=>{if(w===f)this.useZeroBasedOffset=w.toggle?.checked??!this.useZeroBasedOffset,b()})),b(),p.add(n.onDidChangeValue(()=>b()));let S=tE(g);if(S){if(S.getOptions().get(76).renderType===2)S.updateOptions({lineNumbers:"on"}),p.add(D(()=>S.updateOptions({lineNumbers:"relative"})))}return p}toRange(u=1,n=1){return{startLineNumber:u,startColumn:n,endLineNumber:u,endColumn:n}}parsePosition(u,n){let h=this.getModel(u);if(!h)return{label:e(1406,"Open a text editor first to go to a line or an offset.")};if(n.startsWith(":")){let g=parseInt(n.substring(1),10),p=h.getValueLength();if(isNaN(g))return{inOffsetMode:!0,label:this.useZeroBasedOffset?e(1407,"Type a character position to go to (from 0 to {0}).",p-1):e(1408,"Type a character position to go to (from 1 to {0}).",p)};else{let f=g<0;if(!this.useZeroBasedOffset)g-=Math.sign(g);if(f)g+=p;let b=h.getPositionAt(g),S=$t.visibleColumnFromColumn(h.getLineContent(b.lineNumber),b.column,h.getOptions().tabSize)+1;return{...b,inOffsetMode:!0,label:e(1409,"Press 'Enter' to go to line {0} at column {1}.",b.lineNumber,S)}}}else{let g=n.split(/,|:|#/),p=h.getLineCount(),f=parseInt(g[0]?.trim(),10);if(g.length<1||isNaN(f))return{label:e(1410,"Type a line number to go to (from 1 to {0}).",p)};f=f>=0?f:p+1+f,f=Math.min(Math.max(1,f),p);let b=h.getOptions().tabSize,S=h.getLineContent(f),w=$t.visibleColumnFromColumn(S,h.getLineMaxColumn(f),b)+1,x=parseInt(g[1]?.trim(),10);if(g.length<2||isNaN(x))return{lineNumber:f,column:1,label:g.length<2?e(1411,"Press 'Enter' to go to line {0} or enter colon : to add a column number.",f):e(1412,"Press 'Enter' to go to line {0} or enter a column number (from 1 to {1}).",f,w)};x=x>=0?x:w+x,x=Math.min(Math.max(1,x),w);let I=$t.columnFromVisibleColumn(S,x-1,b);return{lineNumber:f,column:I,label:e(1413,"Press 'Enter' to go to line {0} at column {1}.",f,x)}}}}var ak=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},bI=function(u,n){return function(h,g){n(h,g,u)}},Ds=class u extends il{constructor(n,h){super();this.editorService=n,this.storageService=h,this.onDidActiveTextEditorControlChange=R.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};Ds=ak([bI(0,Te),bI(1,Mn)],Ds);class Ig extends U{static{this.ID="editor.action.gotoLine"}constructor(){super({id:Ig.ID,label:tb.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:o.focus,primary:2085,mac:{primary:293},weight:100}})}run(u){u.get(En).quickAccess.show(Ds.GO_TO_LINE_PREFIX)}}A(Ig);pt.as(Ca.Quickaccess).registerQuickAccessProvider({ctor:Ds,prefix:Ds.GO_TO_LINE_PREFIX,helpEntries:[{description:tb.gotoLineActionLabel,commandId:Ig.ID}]});class Rg extends U{static{this.ID="editor.action.gotoOffset"}constructor(){super({id:Rg.ID,label:tb.gotoOffsetActionLabel,alias:"Go to Offset...",precondition:void 0})}run(u){u.get(En).quickAccess.show(Ds.GO_TO_OFFSET_PREFIX)}}A(Rg);pt.as(Ca.Quickaccess).registerQuickAccessProvider({ctor:Ds,prefix:Ds.GO_TO_OFFSET_PREFIX,helpEntries:[{description:tb.gotoOffsetActionLabel,commandId:Rg.ID}]});var hk=a("editorOverviewRuler.bracketMatchForeground","#A0A0A0",e(855,"Overview ruler marker color for matching brackets."));class vI extends U{constructor(){super({id:"editor.action.jumpToBracket",label:y(857,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:3165,weight:100}})}run(u,n){Rr.get(n)?.jumpToBracket()}}class SI extends U{constructor(){super({id:"editor.action.selectToBracket",label:y(858,"Select to Bracket"),precondition:void 0,metadata:{description:y(859,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(u,n,h){let g=!0;if(h&&h.selectBrackets===!1)g=!1;Rr.get(n)?.selectToBracket(g)}}class wI extends U{constructor(){super({id:"editor.action.removeBrackets",label:y(860,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:2561,weight:100},canTriggerInlineEdits:!0})}run(u,n){Rr.get(n)?.removeBrackets(this.id)}}class CI{constructor(u,n,h){this.position=u,this.brackets=n,this.options=h}}class Rr extends i{static{this.ID="editor.contrib.bracketMatchingController"}static get(u){return u.getContribution(Rr.ID)}constructor(u){super();this._editor=u,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new ke(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(u.onDidChangeCursorPosition((n)=>{if(this._matchBrackets==="never")return;this._updateBracketsSoon.schedule()})),this._register(u.onDidChangeModelContent((n)=>{this._updateBracketsSoon.schedule()})),this._register(u.onDidChangeModel((n)=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(u.onDidChangeModelLanguageConfiguration((n)=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(u.onDidChangeConfiguration((n)=>{if(n.hasChanged(80))this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule()})),this._register(u.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(u.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;let u=this._editor.getModel(),n=this._editor.getSelections().map((h)=>{let g=h.getStartPosition(),p=u.bracketPairs.matchBracket(g),f=null;if(p){if(p[0].containsPosition(g)&&!p[1].containsPosition(g))f=p[1].getStartPosition();else if(p[1].containsPosition(g))f=p[0].getStartPosition()}else{let b=u.bracketPairs.findEnclosingBrackets(g);if(b)f=b[1].getStartPosition();else{let S=u.bracketPairs.findNextBracket(g);if(S&&S.range)f=S.range.getStartPosition()}}if(f)return new F(f.lineNumber,f.column,f.lineNumber,f.column);return new F(g.lineNumber,g.column,g.lineNumber,g.column)});this._editor.setSelections(n),this._editor.revealRange(n[0])}selectToBracket(u){if(!this._editor.hasModel())return;let n=this._editor.getModel(),h=[];if(this._editor.getSelections().forEach((g)=>{let p=g.getStartPosition(),f=n.bracketPairs.matchBracket(p);if(!f){if(f=n.bracketPairs.findEnclosingBrackets(p),!f){let w=n.bracketPairs.findNextBracket(p);if(w&&w.range)f=n.bracketPairs.matchBracket(w.range.getStartPosition())}}let b=null,S=null;if(f){f.sort(t.compareRangesUsingStarts);let[w,x]=f;if(b=u?w.getStartPosition():w.getEndPosition(),S=u?x.getEndPosition():x.getStartPosition(),x.containsPosition(p)){let I=b;b=S,S=I}}if(b&&S)h.push(new F(b.lineNumber,b.column,S.lineNumber,S.column))}),h.length>0)this._editor.setSelections(h),this._editor.revealRange(h[0])}removeBrackets(u){if(!this._editor.hasModel())return;let n=this._editor.getModel();this._editor.getSelections().forEach((h)=>{let g=h.getPosition(),p=n.bracketPairs.matchBracket(g);if(!p)p=n.bracketPairs.findEnclosingBrackets(g);if(p)this._editor.pushUndoStop(),this._editor.executeEdits(u,[{range:p[0],text:""},{range:p[1],text:""}]),this._editor.pushUndoStop()})}static{this._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=ue.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline",overviewRuler:{color:bn(hk),position:Yr.Center}})}static{this._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=ue.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match",inlineClassName:"bracket-match-inline"})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();let u=[],n=0;for(let h of this._lastBracketsData){let g=h.brackets;if(g)u[n++]={range:g[0],options:h.options},u[n++]={range:g[1],options:h.options}}this._decorations.set(u)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}let u=this._editor.getSelections();if(u.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}let n=this._editor.getModel(),h=n.getVersionId(),g=[];if(this._lastVersionId===h)g=this._lastBracketsData;let p=[],f=0;for(let I=0,E=u.length;I<E;I++){let Z=u[I];if(Z.isEmpty())p[f++]=Z.getStartPosition()}if(p.length>1)p.sort(s.compare);let b=[],S=0,w=0,x=g.length;for(let I=0,E=p.length;I<E;I++){let Z=p[I];while(w<x&&g[w].position.isBefore(Z))w++;if(w<x&&g[w].position.equals(Z))b[S++]=g[w];else{let X=n.bracketPairs.matchBracket(Z,20),J=Rr._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;if(!X&&this._matchBrackets==="always")X=n.bracketPairs.findEnclosingBrackets(Z,20),J=Rr._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER;b[S++]=new CI(Z,X,J)}}this._lastBracketsData=b,this._lastVersionId=h}}fe(Rr.ID,Rr,1);A(SI);A(vI);A(wI);Zn.appendMenuItem(l.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:e(856,"Go to &&Bracket")},order:2});$i((u,n)=>{let h=u.getColor(N2);if(h)n.addRule(`.monaco-editor .bracket-match-inline { color: ${h} !important; }`)});var _t=new class{constructor(){this.QuickFix=new Ht("quickfix"),this.Refactor=new Ht("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 Ht("notebook"),this.Source=new Ht("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}},pi;(function(u){u.Refactor="refactor",u.RefactorPreview="refactor preview",u.Lightbulb="lightbulb",u.Default="other (default)",u.SourceAction="source action",u.QuickFix="quick fix action",u.FixAll="fix all",u.OrganizeImports="organize imports",u.AutoFix="auto fix",u.QuickFixHover="quick fix hover window",u.OnSave="save participants",u.ProblemsView="problems view"})(pi||(pi={}));function yI(u,n){if(u.include&&!u.include.intersects(n))return!1;if(u.excludes){if(u.excludes.some((h)=>EI(n,h,u.include)))return!1}if(!u.includeSourceActions&&_t.Source.contains(n))return!1;return!0}function xI(u,n){let h=n.kind?new Ht(n.kind):void 0;if(u.include){if(!h||!u.include.contains(h))return!1}if(u.excludes){if(h&&u.excludes.some((g)=>EI(h,g,u.include)))return!1}if(!u.includeSourceActions){if(h&&_t.Source.contains(h))return!1}if(u.onlyIncludePreferredActions){if(!n.isPreferred)return!1}return!0}function EI(u,n,h){if(!n.contains(u))return!1;if(h&&n.contains(h))return!1;return!0}class Wo{static fromUser(u,n){if(!u||typeof u!=="object")return new Wo(n.kind,n.apply,!1);return new Wo(Wo.getKindFromUser(u,n.kind),Wo.getApplyFromUser(u,n.apply),Wo.getPreferredUser(u))}static getApplyFromUser(u,n){switch(typeof u.apply==="string"?u.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return n}}static getKindFromUser(u,n){return typeof u.kind==="string"?new Ht(u.kind):n}static getPreferredUser(u){return typeof u.preferred==="boolean"?u.preferred:!1}constructor(u,n,h){this.kind=u,this.apply=n,this.preferred=h}}class mb{constructor(u,n,h){this.action=u,this.provider=n,this.highlightRange=h}async resolve(u){if(this.provider?.resolveCodeAction&&!this.action.edit){let n;try{n=await this.provider.resolveCodeAction(this.action,u)}catch(h){vt(h)}if(n)this.action.edit=n.edit}return this}}var $g="editor.action.codeAction",Rs="editor.action.quickFix",ol="editor.action.autoFix",Zg="editor.action.refactor",Xg="editor.action.sourceAction",Jc="editor.action.organizeImports",Qc="editor.action.fixAll",_k=1000;class Yc extends i{static codeActionsPreferredComparator(u,n){if(u.isPreferred&&!n.isPreferred)return-1;else if(!u.isPreferred&&n.isPreferred)return 1;else return 0}static codeActionsComparator({action:u},{action:n}){if(u.isAI&&!n.isAI)return 1;else if(!u.isAI&&n.isAI)return-1;if(Kn(u.diagnostics))return Kn(n.diagnostics)?Yc.codeActionsPreferredComparator(u,n):-1;else if(Kn(n.diagnostics))return 1;else return Yc.codeActionsPreferredComparator(u,n)}constructor(u,n,h){super();this.documentation=n,this._register(h),this.allActions=[...u].sort(Yc.codeActionsComparator),this.validActions=this.allActions.filter(({action:g})=>!g.disabled)}get hasAutoFix(){return this.validActions.some(({action:u})=>!!u.kind&&_t.QuickFix.contains(new Ht(u.kind))&&!!u.isPreferred)}get hasAIFix(){return this.validActions.some(({action:u})=>!!u.isAI)}get allAIFixes(){return this.validActions.every(({action:u})=>!!u.isAI)}}var kI={actions:[],documentation:void 0};async function Ts(u,n,h,g,p,f){let b=g.filter||{},S={...b,excludes:[...b.excludes||[],_t.Notebook]},w={only:b.include?.value,trigger:g.type},x=new Zv(n,f),I=g.type===2,E=Nk(u,n,I?S:b),Z=new d,X=E.map(async(Q)=>{let te=setTimeout(()=>p.report(Q),1250);try{let re=await Q.provideCodeActions(n,h,w,x.token);if(x.token.isCancellationRequested)return re?.dispose(),kI;if(re)Z.add(re);let le=(re?.actions||[]).filter((Se)=>Se&&xI(b,Se)),pe=Gk(Q,le,b.include);return{actions:le.map((Se)=>new mb(Se,Q)),documentation:pe}}catch(re){if(bi(re))throw re;return vt(re),kI}finally{clearTimeout(te)}}),J=u.onDidChange(()=>{let Q=u.all(n);if(!ot(Q,E))x.cancel()});try{let Q=await Promise.all(X),te=Q.map((pe)=>pe.actions).flat(),re=[...wr(Q.map((pe)=>pe.documentation)),...Pk(u,n,g,te)],le=new Yc(te,re,Z);return Z.add(le),le}catch(Q){throw Z.dispose(),Q}finally{J.dispose(),x.dispose()}}function Nk(u,n,h){return u.all(n).filter((g)=>{if(!g.providedCodeActionKinds)return!0;return g.providedCodeActionKinds.some((p)=>yI(h,new Ht(p)))})}function*Pk(u,n,h,g){if(n&&g.length){for(let p of u.all(n))if(p._getAdditionalMenuItems)yield*p._getAdditionalMenuItems?.({trigger:h.type,only:h.filter?.include?.value},g.map((f)=>f.action))}}function Gk(u,n,h){if(!u.documentation)return;let g=u.documentation.map((p)=>({kind:new Ht(p.kind),command:p.command}));if(h){let p;for(let f of g)if(f.kind.contains(h)){if(!p)p=f;else if(p.kind.contains(f.kind))p=f}if(p)return p?.command}for(let p of n){if(!p.kind)continue;for(let f of g)if(f.kind.contains(new Ht(p.kind)))return f.command}return}var Jn;(function(u){u.OnSave="onSave",u.FromProblemsView="fromProblemsView",u.FromCodeActions="fromCodeActions",u.FromAILightbulb="fromAILightbulb",u.FromProblemsHover="fromProblemsHover"})(Jn||(Jn={}));async function TI(u,n,h,g,p=xe.None){let f=u.get(Dc),b=u.get(Ue),S=u.get(Wn),w=u.get(wt),x=u.get(Cs);if(S.publicLog2("codeAction.applyCodeAction",{codeActionTitle:n.action.title,codeActionKind:n.action.kind,codeActionIsPreferred:!!n.action.isPreferred,reason:h}),x.playSignal(nt.codeActionTriggered),await n.resolve(p),p.isCancellationRequested)return;if(n.action.edit?.edits.length){if(!(await f.apply(n.action.edit,{editor:g?.editor,label:n.action.title,quotableLabel:n.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:h!==Jn.OnSave,showPreview:g?.preview,reason:Xn.codeAction({kind:n.action.kind,providerId:yv.fromExtensionId(n.provider?.extensionId)})})).isApplied)return}if(n.action.command)try{await b.executeCommand(n.action.command.id,...n.action.command.arguments||[])}catch(I){let E=Zk(I);w.error(typeof E==="string"?E:e(881,"An unknown error occurred while applying the code action"))}setTimeout(()=>x.playSignal(nt.codeActionApplied),_k)}function Zk(u){if(typeof u==="string")return u;else if(u instanceof Error&&typeof u.message==="string")return u.message;else return}$e.registerCommand("_executeCodeActionProvider",async function(u,n,h,g,p){if(!(n instanceof q))throw xr();let{codeActionProvider:f}=u.get(V),b=u.get(Et).getModel(n);if(!b)throw xr();let S=F.isISelection(h)?F.liftSelection(h):t.isIRange(h)?b.validateRange(h):void 0;if(!S)throw xr();let w=typeof g==="string"?new Ht(g):void 0,x=await Ts(f,b,S,{type:1,triggerAction:pi.Default,filter:{includeSourceActions:!0,include:w}},Za.None,xe.None),I=[],E=Math.min(x.validActions.length,typeof p==="number"?p:0);for(let Z=0;Z<E;Z++)I.push(x.validActions[Z].resolve(xe.None));try{return await Promise.all(I),x.validActions.map((Z)=>Z.action)}finally{setTimeout(()=>x.dispose(),100)}});var Yk=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},eT=function(u,n){return function(h,g){n(h,g,u)}},fb,sp=class u{static{fb=this}static{this.codeActionCommands=[Zg,$g,Xg,Jc,Qc]}constructor(n){this.keybindingService=n}getResolver(){let n=new ii(()=>this.keybindingService.getKeybindings().filter((h)=>fb.codeActionCommands.indexOf(h.command)>=0).filter((h)=>h.resolvedKeybinding).map((h)=>{let g=h.commandArgs;if(h.command===Jc)g={kind:_t.SourceOrganizeImports.value};else if(h.command===Qc)g={kind:_t.SourceFixAll.value};return{resolvedKeybinding:h.resolvedKeybinding,...Wo.fromUser(g,{kind:Ht.None,apply:"never"})}}));return(h)=>{if(h.kind)return this.bestKeybindingForCodeAction(h,n.value)?.resolvedKeybinding;return}}bestKeybindingForCodeAction(n,h){if(!n.kind)return;let g=new Ht(n.kind);return h.filter((p)=>p.kind.contains(g)).filter((p)=>{if(p.preferred)return n.isPreferred;return!0}).reduceRight((p,f)=>{if(!p)return f;return p.kind.contains(f.kind)?f:p},void 0)}};sp=fb=Yk([eT(0,ge)],sp);a("symbolIcon.arrayForeground",Ae,e(1569,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.booleanForeground",Ae,e(1570,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(1571,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.colorForeground",Ae,e(1572,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.constantForeground",Ae,e(1573,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(1574,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(1575,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(1576,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},e(1577,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(1578,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.fileForeground",Ae,e(1579,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.folderForeground",Ae,e(1580,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(1581,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(1582,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.keyForeground",Ae,e(1583,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.keywordForeground",Ae,e(1584,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},e(1585,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.moduleForeground",Ae,e(1586,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.namespaceForeground",Ae,e(1587,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.nullForeground",Ae,e(1588,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.numberForeground",Ae,e(1589,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.objectForeground",Ae,e(1590,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.operatorForeground",Ae,e(1591,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.packageForeground",Ae,e(1592,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.propertyForeground",Ae,e(1593,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.referenceForeground",Ae,e(1594,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.snippetForeground",Ae,e(1595,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.stringForeground",Ae,e(1596,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.structForeground",Ae,e(1597,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.textForeground",Ae,e(1598,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.typeParameterForeground",Ae,e(1599,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.unitForeground",Ae,e(1600,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));a("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},e(1601,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));var XI=Object.freeze({kind:Ht.Empty,title:e(917,"More Actions...")}),tT=Object.freeze([{kind:_t.QuickFix,title:e(918,"Quick Fix")},{kind:_t.RefactorExtract,title:e(919,"Extract"),icon:C.wrench},{kind:_t.RefactorInline,title:e(920,"Inline"),icon:C.wrench},{kind:_t.RefactorRewrite,title:e(921,"Rewrite"),icon:C.wrench},{kind:_t.RefactorMove,title:e(922,"Move"),icon:C.wrench},{kind:_t.SurroundWith,title:e(923,"Surround With"),icon:C.surroundWith},{kind:_t.Source,title:e(924,"Source Action"),icon:C.symbolFile},XI]);function eL(u,n,h){if(!n)return u.map((f)=>({kind:"action",item:f,group:XI,disabled:!!f.action.disabled,label:f.action.disabled||f.action.title,canPreview:!!f.action.edit?.edits.length}));let g=tT.map((f)=>({group:f,actions:[]}));for(let f of u){let b=f.action.kind?new Ht(f.action.kind):Ht.None;for(let S of g)if(S.group.kind.contains(b)){S.actions.push(f);break}}let p=[];for(let f of g)if(f.actions.length){p.push({kind:"header",group:f.group});for(let b of f.actions){let S=f.group;p.push({kind:"action",item:b,group:b.action.isAI?{title:S.title,kind:S.kind,icon:C.sparkle}:S,label:b.action.title,disabled:!!b.action.disabled,keybinding:h(b.action)})}}return p}var _b=new P("supportedCodeAction",""),tL="_typescript.applyFixAllCodeAction";class iL extends i{constructor(u,n,h,g=250){super();this._editor=u,this._markerService=n,this._signalChange=h,this._delay=g,this._autoTriggerTimer=this._register(new di),this.ignoreLightbulbOff=!1,this._register(this._markerService.onMarkerChanged((p)=>this._onMarkerChanges(p))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(u){let n=this._getRangeOfSelectionUnlessWhitespaceEnclosed(u);this._signalChange(n?{trigger:u,selection:n}:void 0)}_onMarkerChanges(u){let n=this._editor.getModel();if(n&&u.some((h)=>vs(h,n.uri)))this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:pi.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(u){if(!this._editor.hasModel())return;let n=this._editor.getSelection();if(u.type===1)return n;let h=this._editor.getOption(73).enabled;if(h===Hs.Off&&!this.ignoreLightbulbOff)return;else if(h===Hs.Off||h===Hs.On)return n;else if(h===Hs.OnCode){if(!n.isEmpty())return n;let p=this._editor.getModel(),{lineNumber:f,column:b}=n.getPosition(),S=p.getLineContent(f);if(S.length===0)return;else if(b===1){if(/\s/.test(S[0]))return}else if(b===p.getLineMaxColumn(f)){if(/\s/.test(S[S.length-1]))return}else if(/\s/.test(S[b-2])&&/\s/.test(S[b-1]))return}return n}}var Pa;(function(u){u.Empty={type:0};class n{constructor(h,g,p){this.trigger=h,this.position=g,this._cancellablePromise=p,this.type=1,this.actions=p.catch((f)=>{if(bi(f))return eh;throw f})}cancel(){this._cancellablePromise.cancel()}}u.Triggered=n})(Pa||(Pa={}));var eh=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class bb extends i{constructor(u,n,h,g,p,f){super();this._editor=u,this._registry=n,this._markerService=h,this._progressService=p,this._configurationService=f,this._codeActionOracle=this._register(new de),this._state=Pa.Empty,this._onDidChangeState=this._register(new r),this.onDidChangeState=this._onDidChangeState.event,this.codeActionsDisposable=this._register(new de),this._disposed=!1,this._ignoreLightbulbOff=!1,this._supportedCodeActions=_b.bindTo(g),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((b)=>{if(b.hasChanged(73))this._update()})),this._update()}dispose(){if(this._disposed)return;this._disposed=!0,super.dispose(),this.setState(Pa.Empty,!0)}_settingEnabledNearbyQuickfixes(){let u=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:u?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Pa.Empty),this.codeActionsDisposable.clear();let u=this._editor.getModel();if(u&&this._registry.has(u)&&!this._editor.getOption(104)){let n=this._registry.all(u).flatMap((g)=>g.providedCodeActionKinds??[]);this._supportedCodeActions.set(n.join(" "));let h=new iL(this._editor,this._markerService,(g)=>{if(!g){this.setState(Pa.Empty);return}let p=g.selection.getStartPosition(),f=Zt(async(w)=>{if(this._settingEnabledNearbyQuickfixes()&&g.trigger.type===1&&(g.trigger.triggerAction===pi.QuickFix||g.trigger.filter?.include?.contains(_t.QuickFix))){let I=new d,E=!1;try{let Z=I.add(await Ts(this._registry,u,g.selection,g.trigger,Za.None,w)),X=[...Z.allActions];if(w.isCancellationRequested)return eh;let J=Z.validActions?.some((te)=>te.action.kind&&_t.QuickFix.contains(new Ht(te.action.kind))&&!te.action.isAI),Q=this._markerService.read({resource:u.uri});if(J){for(let re of Z.validActions)if(re.action.command?.arguments?.some((le)=>typeof le==="string"&&le.includes(tL)))re.action.diagnostics=[...Q.filter((le)=>le.relatedInformation)];let te=this._setCodeActions({validActions:Z.validActions,allActions:X,documentation:Z.documentation,hasAutoFix:Z.hasAutoFix,hasAIFix:Z.hasAIFix,allAIFixes:Z.allAIFixes,dispose:()=>I.dispose()});return E=!0,te}else if(!J){if(Q.length>0){let te=g.selection.getPosition(),re=te,le=Number.MAX_VALUE,pe=[...Z.validActions];for(let ae of Q){let{endColumn:me,endLineNumber:De,startLineNumber:Oe}=ae;if(De===te.lineNumber||Oe===te.lineNumber){re=new s(De,me);let Me={type:g.trigger.type,triggerAction:g.trigger.triggerAction,filter:{include:g.trigger.filter?.include?g.trigger.filter?.include:_t.QuickFix},autoApply:g.trigger.autoApply,context:{notAvailableMessage:g.trigger.context?.notAvailableMessage||"",position:re}},Ce=new F(re.lineNumber,re.column,re.lineNumber,re.column),Pe=I.add(await Ts(this._registry,u,Ce,Me,Za.None,w));if(w.isCancellationRequested)return eh;if(Pe.validActions.length!==0){for(let tt of Pe.validActions)if(tt.action.command?.arguments?.some((ze)=>typeof ze==="string"&&ze.includes(tL)))tt.action.diagnostics=[...Q.filter((ze)=>ze.relatedInformation)];if(Z.allActions.length===0)X.push(...Pe.allActions);if(Math.abs(te.column-me)<le)pe.unshift(...Pe.validActions);else pe.push(...Pe.validActions)}le=Math.abs(te.column-me)}}let Se=pe.filter((ae,me,De)=>De.findIndex((Oe)=>Oe.action.title===ae.action.title)===me);Se.sort((ae,me)=>{if(ae.action.isPreferred&&!me.action.isPreferred)return-1;else if(!ae.action.isPreferred&&me.action.isPreferred)return 1;else if(ae.action.isAI&&!me.action.isAI)return 1;else if(!ae.action.isAI&&me.action.isAI)return-1;else return 0});let we=this._setCodeActions({validActions:Se,allActions:X,documentation:Z.documentation,hasAutoFix:Z.hasAutoFix,hasAIFix:Z.hasAIFix,allAIFixes:Z.allAIFixes,dispose:()=>I.dispose()});return E=!0,we}}}finally{if(!E)I.dispose()}}if(g.trigger.type===1){let I=await Ts(this._registry,u,g.selection,g.trigger,Za.None,w);if(w.isCancellationRequested)return I.dispose(),eh;return this._setCodeActions(I)}let x=await Ts(this._registry,u,g.selection,g.trigger,Za.None,w);if(w.isCancellationRequested)return x.dispose(),eh;return this._setCodeActions(x)});if(g.trigger.type===1)this._progressService?.showWhile(f,250);let b=new Pa.Triggered(g.trigger,p,f),S=!1;if(this._state.type===1)S=this._state.trigger.type===1&&b.type===1&&b.trigger.type===2&&this._state.position!==b.position;if(!S)this.setState(b);else setTimeout(()=>{this.setState(b)},500)},void 0);h.ignoreLightbulbOff=this._ignoreLightbulbOff,this._codeActionOracle.value=h,this._codeActionOracle.value.trigger({type:2,triggerAction:pi.Default})}else this._supportedCodeActions.reset()}_setCodeActions(u){return this.codeActionsDisposable.value=u,u}takeCodeActions(u){if(this.codeActionsDisposable.value!==u)return;return this.codeActionsDisposable.clearAndLeak(),u}trigger(u){this._codeActionOracle.value?.trigger(u),this.codeActionsDisposable.clear()}setState(u,n){if(u===this._state)return;if(this._state.type===1)this._state.cancel();if(this._state=u,!n&&!this._disposed)this._onDidChangeState.fire(u)}}var iT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},oT=function(u,n){return function(h,g){n(h,g,u)}},Ns,oL=Mt("gutter-lightbulb",C.lightBulb,e(925,"Icon which spawns code actions menu from the gutter when there is no space in the editor.")),nL=Mt("gutter-lightbulb-auto-fix",C.lightbulbAutofix,e(926,"Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),rL=Mt("gutter-lightbulb-sparkle",C.lightbulbSparkle,e(927,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),sL=Mt("gutter-lightbulb-aifix-auto-fix",C.lightbulbSparkleAutofix,e(928,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),aL=Mt("gutter-lightbulb-sparkle-filled",C.sparkleFilled,e(929,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),ln;(function(u){u.Hidden={type:0};class n{constructor(h,g,p,f){this.actions=h,this.trigger=g,this.editorPosition=p,this.widgetPosition=f,this.type=1}}u.Showing=n})(ln||(ln={}));function vb(u,n,h,g,p=!1){if(u.validActions.length<=0)return;let f,b=!1;if(u.allAIFixes){if(f=p?aL:C.sparkleFilled,u.validActions.length===1)b=!0}else if(u.hasAutoFix)if(u.hasAIFix)f=p?sL:C.lightbulbSparkleAutofix;else f=p?nL:C.lightbulbAutofix;else if(u.hasAIFix)f=p?rL:C.lightbulbSparkle;else f=p?oL:C.lightBulb;let S;if(b)S=e(930,"Run: {0}",u.validActions[0].action.title);else if(u.hasAutoFix&&h)S=e(931,"Show Code Actions. Preferred Quick Fix Available ({0})",h);else if(!u.hasAutoFix&&g)S=e(932,"Show Code Actions ({0})",g);else S=e(933,"Show Code Actions");return{actions:u,trigger:n,icon:f,autoRun:b,title:S,isGutter:p}}var Aa=class u extends i{static{Ns=this}static{this.GUTTER_DECORATION=ue.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Y.asClassName(C.lightBulb),glyphMargin:{position:ts.Left},stickiness:1})}static{this.ID="editor.contrib.lightbulbWidget"}static{this._posPref=[0]}static _computeLightBulbInfo(n,h,g,p){if(n.type!==1)return;return vb(n.actions,n.trigger,g,p,h)}constructor(n,h){super();this._editor=n,this._keybindingService=h,this.onlyWithEmptySelection=!1,this._onClick=this._register(new r),this.onClick=this._onClick.event,this._state=j(this,ln.Hidden),this._gutterState=j(this,ln.Hidden),this._combinedInfo=m(this,(g)=>{let p=this._gutterState.read(g);if(p.type===1)return Ns._computeLightBulbInfo(p,!0,this._preferredKbLabel.read(g),this._quickFixKbLabel.read(g));let f=this._state.read(g);if(f.type===1)return Ns._computeLightBulbInfo(f,!1,this._preferredKbLabel.read(g),this._quickFixKbLabel.read(g));return}),this._iconClasses=[],this.lightbulbClasses=["codicon-"+oL.id,"codicon-"+sL.id,"codicon-"+nL.id,"codicon-"+rL.id,"codicon-"+aL.id],this._preferredKbLabel=j(this,void 0),this._quickFixKbLabel=j(this,void 0),this.gutterDecoration=Ns.GUTTER_DECORATION,this._domNode=_("div.lightBulbWidget"),this._domNode.role="listbox",this._register(Pt.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent((g)=>{let p=this._editor.getModel(),f=this._state.get();if(f.type!==1||!p||f.editorPosition.lineNumber>=p.getLineCount())this.hide();let b=this._gutterState.get();if(b.type!==1||!p||b.editorPosition.lineNumber>=p.getLineCount())this.gutterHide()})),this._register(d2(this._domNode,(g)=>{let p=this._state.get();if(p.type!==1)return;this._editor.focus(),g.preventDefault();let{top:f,height:b}=kt(this._domNode),S=this._editor.getOption(75),w=Math.floor(S/3);if(p.widgetPosition.position!==null&&p.widgetPosition.position.lineNumber<p.editorPosition.lineNumber)w+=S;this._onClick.fire({x:g.posx,y:f+b+w,actions:p.actions,trigger:p.trigger})})),this._register(c(this._domNode,"mouseenter",(g)=>{if((g.buttons&1)!==1)return;this.hide()})),this._register(R.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(ol)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(Rs)?.getLabel()??void 0,void 0)})),this._register(W((g)=>{let p=this._combinedInfo.read(g);this._updateLightBulbTitleAndIcon(p),this._updateGutterDecorationOptions(p)})),this._register(this._editor.onMouseDown(async(g)=>{if(!g.target.element||!this.lightbulbClasses.some((x)=>g.target.element&&g.target.element.classList.contains(x)))return;let p=this._gutterState.get();if(p.type!==1)return;this._editor.focus();let{top:f,height:b}=kt(g.target.element),S=this._editor.getOption(75),w=Math.floor(S/3);if(p.widgetPosition.position!==null&&p.widgetPosition.position.lineNumber<p.editorPosition.lineNumber)w+=S;this._onClick.fire({x:g.event.posx,y:f+b+w,actions:p.actions,trigger:p.trigger})}))}dispose(){if(super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID)this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){let n=this._state.get();return n.type===1?n.widgetPosition:null}update(n,h,g){if(n.validActions.length<=0)return this.gutterHide(),this.hide();if(this.onlyWithEmptySelection&&!this._editor.getSelection()?.isEmpty())return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(this._editor.getOptions().get(73).enabled===Hs.Off)return this.gutterHide(),this.hide();let b=this._editor.getModel();if(!b)return this.gutterHide(),this.hide();let{lineNumber:S,column:w}=b.validatePosition(g),x=b.getOptions().tabSize,I=this._editor.getOptions().get(59),E=b.getLineContent(S),Z=Jg(E,x),X=I.spaceWidth*Z>22,J=(we)=>we>2&&this._editor.getTopForLineNumber(we)===this._editor.getTopForLineNumber(we-1),Q=this._editor.getLineDecorations(S),te=!1;if(Q)for(let we of Q){let ae=we.options.glyphMarginClassName;if(ae&&!this.lightbulbClasses.some((me)=>ae.includes(me))){te=!0;break}}let re=S,le=1;if(!X){let we=(ae)=>{let me=b.getLineContent(ae);return/^\s*$|^\s+/.test(me)||me.length<=le};if(S>1&&!J(S-1)){let ae=b.getLineCount(),me=S===ae,De=S>1&&we(S-1),Oe=!me&&we(S+1),Me=we(S),Ce=!Oe&&!De;if(!Oe&&!De&&!te)return this._gutterState.set(new ln.Showing(n,h,g,{position:{lineNumber:re,column:le},preference:Ns._posPref}),void 0),this.renderGutterLightbub(),this.hide();else if(De||me||De&&!Me)re-=1;else if(Oe||Ce&&Me)re+=1}else if(S===1&&(S===b.getLineCount()||!we(S+1)&&!we(S)))if(this._gutterState.set(new ln.Showing(n,h,g,{position:{lineNumber:re,column:le},preference:Ns._posPref}),void 0),te)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(S<b.getLineCount()&&!J(S+1))re+=1;else if(w*I.spaceWidth<22)return this.hide();le=/^\S\s*$/.test(b.getLineContent(re))?2:1}if(this._state.set(new ln.Showing(n,h,g,{position:{lineNumber:re,column:le},preference:Ns._posPref}),void 0),this._gutterDecorationID)this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide();let pe=n.validActions,Se=n.validActions[0].action.kind;if(pe.length!==1||!Se){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){if(this._state.get()===ln.Hidden)return;this._state.set(ln.Hidden,void 0),this._editor.layoutContentWidget(this)}gutterHide(){if(this._gutterState.get()===ln.Hidden)return;if(this._gutterDecorationID)this._removeGutterDecoration(this._gutterDecorationID);this._gutterState.set(ln.Hidden,void 0)}_updateLightBulbTitleAndIcon(n){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],!n||n.isGutter)return;this._domNode.title=n.title,this._iconClasses=Y.asClassNameArray(n.icon),this._domNode.classList.add(...this._iconClasses)}_updateGutterDecorationOptions(n){if(!n||!n.isGutter)return;this.gutterDecoration=ue.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:Y.asClassName(n.icon),glyphMargin:{position:ts.Left},stickiness:1})}renderGutterLightbub(){let n=this._editor.getSelection();if(!n)return;if(this._gutterDecorationID===void 0)this._addGutterDecoration(n.startLineNumber);else this._updateGutterDecoration(this._gutterDecorationID,n.startLineNumber)}_addGutterDecoration(n){this._editor.changeDecorations((h)=>{this._gutterDecorationID=h.addDecoration(new t(n,0,n,0),this.gutterDecoration)})}_removeGutterDecoration(n){this._editor.changeDecorations((h)=>{h.removeDecoration(n),this._gutterDecorationID=void 0})}_updateGutterDecoration(n,h){this._editor.changeDecorations((g)=>{g.changeDecoration(n,new t(h,0,h,0)),g.changeDecorationOptions(n,this.gutterDecoration)})}};Aa=Ns=iT([oT(1,ge)],Aa);var nT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},pn=function(u,n){return function(h,g){n(h,g,u)}},nl,rT="quickfix-edit-highlight",tr=class u extends i{static{nl=this}static{this.ID="editor.contrib.codeActionController"}static get(n){return n.getContribution(nl.ID)}constructor(n,h,g,p,f,b,S,w,x,I,E,Z){super();this._commandService=S,this._configurationService=w,this._actionWidgetService=x,this._instantiationService=I,this._progressService=E,this._keybindingService=Z,this._activeCodeActions=this._register(new de),this._showDisabled=!1,this._disposed=!1,this._onlyLightBulbWithEmptySelection=!1,this._lightBulbInfoObs=j(this,void 0),this._preferredKbLabel=j(this,void 0),this._quickFixKbLabel=j(this,void 0),this._editor=n,this._model=this._register(new bb(this._editor,f.codeActionProvider,h,g,b,w)),this._register(this._model.onDidChangeState((X)=>this.update(X))),this._register(R.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel.set(this._keybindingService.lookupKeybinding(ol)?.getLabel()??void 0,void 0),this._quickFixKbLabel.set(this._keybindingService.lookupKeybinding(Rs)?.getLabel()??void 0,void 0)})),this._lightBulbWidget=new ii(()=>{let X=this._editor.getContribution(Aa.ID);if(X)this._register(X.onClick((J)=>this.showCodeActionsFromLightbulb(J.actions,J))),X.onlyWithEmptySelection=this._onlyLightBulbWithEmptySelection;return X}),this._resolver=p.createInstance(sp),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(n,h){if(n.allAIFixes&&n.validActions.length===1){let g=n.validActions[0],p=g.action.command;if(p&&p.id==="inlineChat.start"){if(p.arguments&&p.arguments.length>=1&&p.arguments[0])p.arguments[0]={...p.arguments[0],autoSend:!1}}await this.applyCodeAction(g,!1,!1,Jn.FromAILightbulb);return}await this.showCodeActionList(n,h,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(n,h,g){return this.showCodeActionList(h,g,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(n,h,g,p){if(!this._editor.hasModel())return;ti.get(this._editor)?.closeMessage();let f=this._editor.getPosition();this._trigger({type:1,triggerAction:h,filter:g,autoApply:p,context:{notAvailableMessage:n,position:f}})}_trigger(n){return this._model.trigger(n)}async applyCodeAction(n,h,g,p){let f=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(TI,n,p,{preview:g,editor:this._editor})}finally{if(h)this._trigger({type:2,triggerAction:pi.QuickFix,filter:{}});f.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(n){if(n.type!==1){this.hideLightBulbWidget(),this._lightBulbInfoObs.set(void 0,void 0);return}let h;try{h=this._model.takeCodeActions(await n.actions)}catch(p){ee(p);return}if(!h)return;if(this._disposed){h.dispose();return}if(this._editor.getSelection()?.startLineNumber!==n.position.lineNumber){h.dispose();return}if(this._lightBulbWidget.value?.update(h,n.trigger,n.position),this._lightBulbInfoObs.set(vb(h,n.trigger,this._preferredKbLabel.get(),this._quickFixKbLabel.get()),void 0),n.trigger.type===1){if(n.trigger.filter?.include){let f=this.tryGetValidActionToApply(n.trigger,h);if(f){try{this.hideLightBulbWidget(),await this.applyCodeAction(f,!1,!1,Jn.FromCodeActions)}finally{h.dispose()}return}if(n.trigger.context){let b=this.getInvalidActionThatWouldHaveBeenApplied(n.trigger,h);if(b&&b.action.disabled){ti.get(this._editor)?.showMessage(b.action.disabled,n.trigger.context.position),h.dispose();return}}}let p=!!n.trigger.filter?.include;if(n.trigger.context){if(!h.allActions.length||!p&&!h.validActions.length){ti.get(this._editor)?.showMessage(n.trigger.context.notAvailableMessage,n.trigger.context.position),this._activeCodeActions.value=h,h.dispose();return}}this._activeCodeActions.value=h,this.showCodeActionList(h,this.toCoords(n.position),{includeDisabledActions:p,fromLightbulb:!1})}else if(this._actionWidgetService.isVisible)h.dispose();else this._activeCodeActions.value=h}getInvalidActionThatWouldHaveBeenApplied(n,h){if(!h.allActions.length)return;if(n.autoApply==="first"&&h.validActions.length===0||n.autoApply==="ifSingle"&&h.allActions.length===1)return h.allActions.find(({action:g})=>g.disabled);return}tryGetValidActionToApply(n,h){if(!h.validActions.length)return;if(n.autoApply==="first"&&h.validActions.length>0||n.autoApply==="ifSingle"&&h.validActions.length===1)return h.validActions[0];return}static{this.DECORATION=ue.register({description:"quickfix-highlight",className:rT})}async showCodeActionList(n,h,g){let p=this._editor.createDecorationsCollection(),f=this._editor.getDomNode();if(!f)return;let b=g.includeDisabledActions&&(this._showDisabled||n.validActions.length===0)?n.allActions:n.validActions;if(!b.length)return;let S=s.isIPosition(h)?this.toCoords(h):h,w={onSelect:async(x,I)=>{this.applyCodeAction(x,!0,!!I,g.fromLightbulb?Jn.FromAILightbulb:Jn.FromCodeActions),this._actionWidgetService.hide(!1),p.clear()},onHide:(x)=>{this._editor?.focus(),p.clear()},onHover:async(x,I)=>{if(I.isCancellationRequested)return;let E=!1,Z=x.action.kind;if(Z){let X=new Ht(Z);E=[_t.RefactorExtract,_t.RefactorInline,_t.RefactorRewrite,_t.RefactorMove,_t.Source].some((Q)=>Q.contains(X))}return{canPreview:E||!!x.action.edit?.edits.length}},onFocus:(x)=>{if(x&&x.action){let I=x.action.ranges,E=x.action.diagnostics;if(p.clear(),I&&I.length>0){let Z=E&&E?.length>1?E.map((X)=>({range:X,options:nl.DECORATION})):I.map((X)=>({range:X,options:nl.DECORATION}));p.set(Z)}else if(E&&E.length>0){let Z=E.map((J)=>({range:J,options:nl.DECORATION}));p.set(Z);let X=E[0];if(X.startLineNumber&&X.startColumn){let J=this._editor.getModel()?.getWordAtPosition({lineNumber:X.startLineNumber,column:X.startColumn})?.word;Br(e(914,"Context: {0} at line {1} and column {2}.",J,X.startLineNumber,X.startColumn))}}}else p.clear()}};this._actionWidgetService.show("codeActionWidget",!0,eL(b,this._shouldShowHeaders(),this._resolver.getResolver()),w,S,f,this._getActionBarActions(n,h,g))}toCoords(n){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(n,1),this._editor.render();let h=this._editor.getScrolledVisiblePosition(n),g=kt(this._editor.getDomNode()),p=g.left+h.left,f=g.top+h.top+h.height;return{x:p,y:f}}_shouldShowHeaders(){let n=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:n?.uri})}_getActionBarActions(n,h,g){if(g.fromLightbulb)return[];let p=n.documentation.map((f)=>({id:f.id,label:f.title,tooltip:f.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(f.id,...f.arguments??[])}));if(g.includeDisabledActions&&n.validActions.length>0&&n.allActions.length!==n.validActions.length)p.push(this._showDisabled?{id:"hideMoreActions",label:e(915,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(n,h,g))}:{id:"showMoreActions",label:e(916,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(n,h,g))});return p}};tr=nl=nT([pn(1,Bo),pn(2,K),pn(3,O),pn(4,V),pn(5,Us),pn(6,Ue),pn(7,oe),pn(8,ro),pn(9,O),pn(10,Us),pn(11,ge)],tr);$i((u,n)=>{((p,f)=>{if(f)n.addRule(`.monaco-editor ${p} { background-color: ${f}; }`)})(".quickfix-edit-highlight",u.getColor(ya));let g=u.getColor(Cc);if(g)n.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${go(u.type)?"dotted":"solid"} ${g}; box-sizing: border-box; }`)});function th(u){return L.regex(_b.keys()[0],new RegExp("(\\s|^)"+qi(u.value)+"\\b"))}var Sb={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:e(882,"Kind of the code action to run.")},apply:{type:"string",description:e(883,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[e(884,"Always apply the first returned code action."),e(885,"Apply the first returned code action if it is the only one."),e(886,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:e(887,"Controls if only preferred code actions should be returned.")}}};function Fa(u,n,h,g,p=pi.Default){if(u.hasModel())tr.get(u)?.manualTriggerAtCurrentPosition(n,p,h,g)}class wb extends mo{constructor(){super({id:Rs,title:y(904,"Quick Fix..."),precondition:L.and(o.writable,o.hasCodeActionsProvider),icon:C.lightBulb,f1:!0,keybinding:{when:o.textInputFocus,primary:2137,weight:100},menu:{id:l.InlineChatEditorAffordance,group:"1_quickfix",order:0,when:L.and(o.writable,o.hasCodeActionsProvider)}})}runEditorCommand(u,n){return Fa(n,e(888,"No code actions available"),void 0,void 0,pi.QuickFix)}}class Cb extends nn{constructor(){super({id:$g,precondition:L.and(o.writable,o.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:Sb}]}})}runEditorCommand(u,n,h){let g=Wo.fromUser(h,{kind:Ht.Empty,apply:"ifSingle"});return Fa(n,typeof h?.kind==="string"?g.preferred?e(889,"No preferred code actions for '{0}' available",h.kind):e(890,"No code actions for '{0}' available",h.kind):g.preferred?e(891,"No preferred code actions available"):e(892,"No code actions available"),{include:g.kind,includeSourceActions:!0,onlyIncludePreferredActions:g.preferred},g.apply)}}class yb extends U{constructor(){super({id:Zg,label:y(905,"Refactor..."),precondition:L.and(o.writable,o.hasCodeActionsProvider),kbOpts:{kbExpr:o.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:L.and(o.writable,th(_t.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:Sb}]}})}run(u,n,h){let g=Wo.fromUser(h,{kind:_t.Refactor,apply:"never"});return Fa(n,typeof h?.kind==="string"?g.preferred?e(893,"No preferred refactorings for '{0}' available",h.kind):e(894,"No refactorings for '{0}' available",h.kind):g.preferred?e(895,"No preferred refactorings available"):e(896,"No refactorings available"),{include:_t.Refactor.contains(g.kind)?g.kind:Ht.None,onlyIncludePreferredActions:g.preferred},g.apply,pi.Refactor)}}class xb extends U{constructor(){super({id:Xg,label:y(906,"Source Action..."),precondition:L.and(o.writable,o.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:L.and(o.writable,th(_t.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:Sb}]}})}run(u,n,h){let g=Wo.fromUser(h,{kind:_t.Source,apply:"never"});return Fa(n,typeof h?.kind==="string"?g.preferred?e(897,"No preferred source actions for '{0}' available",h.kind):e(898,"No source actions for '{0}' available",h.kind):g.preferred?e(899,"No preferred source actions available"):e(900,"No source actions available"),{include:_t.Source.contains(g.kind)?g.kind:Ht.None,includeSourceActions:!0,onlyIncludePreferredActions:g.preferred},g.apply,pi.SourceAction)}}class Ib extends U{constructor(){super({id:Jc,label:y(907,"Organize Imports"),precondition:L.and(o.writable,th(_t.SourceOrganizeImports)),kbOpts:{kbExpr:o.textInputFocus,primary:1581,weight:100},metadata:{description:y(908,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(u,n){return Fa(n,e(901,"No organize imports action available"),{include:_t.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",pi.OrganizeImports)}}class Lb extends U{constructor(){super({id:Qc,label:y(909,"Fix All"),precondition:L.and(o.writable,th(_t.SourceFixAll))})}run(u,n){return Fa(n,e(902,"No fix all action available"),{include:_t.SourceFixAll,includeSourceActions:!0},"ifSingle",pi.FixAll)}}class Eb extends U{constructor(){super({id:ol,label:y(910,"Auto Fix..."),precondition:L.and(o.writable,th(_t.QuickFix)),kbOpts:{kbExpr:o.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(u,n){return Fa(n,e(903,"No auto fixes available"),{include:_t.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",pi.AutoFix)}}fe(tr.ID,tr,3);fe(Aa.ID,Aa,4);lt(wb);A(yb);A(xb);A(Ib);A(Eb);A(Lb);G(new Cb);pt.as(Ao.Configuration).registerConfiguration({...A0,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:e(911,"Enable/disable showing group headers in the Code Action menu."),default:!0}}});pt.as(Ao.Configuration).registerConfiguration({...A0,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:e(912,"Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}});pt.as(Ao.Configuration).registerConfiguration({...A0,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:e(913,"Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});var dL=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ih=function(u,n){return function(h,g){n(h,g,u)}},dp=class u{static{this.ID="editor.contrib.autoFormat"}constructor(n,h,g,p){this._editor=n,this._languageFeaturesService=h,this._workerService=g,this._accessibilitySignalService=p,this._disposables=new d,this._sessionDisposables=new d,this._disposables.add(h.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(n.onDidChangeModel(()=>this._update())),this._disposables.add(n.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(n.onDidChangeConfiguration((f)=>{if(f.hasChanged(65))this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65))return;if(!this._editor.hasModel())return;let n=this._editor.getModel(),[h]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(n);if(!h||!h.autoFormatTriggerCharacters)return;let g=new Ff;for(let p of h.autoFormatTriggerCharacters)g.add(p.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType((p)=>{let f=p.charCodeAt(p.length-1);if(g.has(f))this._trigger(String.fromCharCode(f))}))}_trigger(n){if(!this._editor.hasModel())return;if(this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;let h=this._editor.getModel(),g=this._editor.getPosition(),p=new Je,f=this._editor.onDidChangeModelContent((b)=>{if(b.isFlush){p.cancel(),f.dispose();return}for(let S=0,w=b.changes.length;S<w;S++)if(b.changes[S].range.endLineNumber<=g.lineNumber){p.cancel(),f.dispose();return}});eN(this._workerService,this._languageFeaturesService,h,g,n,h.getFormattingOptions(),p.token).then((b)=>{if(p.token.isCancellationRequested)return;if(Kn(b))this._accessibilitySignalService.playSignal(nt.format,{userGesture:!1}),om.execute(this._editor,b,!0)}).finally(()=>{f.dispose()})}};dp=dL([ih(1,V),ih(2,Mi),ih(3,Cs)],dp);var gp=class u{static{this.ID="editor.contrib.formatOnPaste"}constructor(n,h,g){this.editor=n,this._languageFeaturesService=h,this._instantiationService=g,this._callOnDispose=new d,this._callOnModel=new d,this._callOnDispose.add(n.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(n.onDidChangeModel(()=>this._update())),this._callOnDispose.add(n.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(h.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){if(this._callOnModel.clear(),!this.editor.getOption(64))return;if(!this.editor.hasModel())return;if(!this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel()))return;this._callOnModel.add(this.editor.onDidPaste(({range:n})=>this._trigger(n)))}_trigger(n){if(!this.editor.hasModel())return;if(this.editor.getSelections().length>1)return;this._instantiationService.invokeFunction(QI,this.editor,n,2,Za.None,xe.None,!1).catch(ee)}};gp=dL([ih(1,V),ih(2,O)],gp);class lL extends U{constructor(){super({id:"editor.action.formatDocument",label:y(1072,"Format Document"),precondition:L.and(o.notInCompositeEditor,o.writable,o.hasDocumentFormattingProvider),kbOpts:{kbExpr:o.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(u,n){if(n.hasModel()){let h=u.get(O);await u.get(Us).showWhile(h.invokeFunction(G2,n,1,Za.None,xe.None,!0),250)}}}class cL extends U{constructor(){super({id:"editor.action.formatSelection",label:y(1073,"Format Selection"),precondition:L.and(o.writable,o.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2084),weight:100},contextMenuOpts:{when:o.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(u,n){if(!n.hasModel())return;let h=u.get(O),g=n.getModel(),p=n.getSelections().map((b)=>b.isEmpty()?new t(b.startLineNumber,1,b.startLineNumber,g.getLineMaxColumn(b.startLineNumber)):b);await u.get(Us).showWhile(h.invokeFunction(QI,n,p,1,Za.None,xe.None,!0),250)}}fe(dp.ID,dp,2);fe(gp.ID,gp,2);A(lL);A(cL);$e.registerCommand("editor.action.format",async(u)=>{let n=u.get(Te).getFocusedCodeEditor();if(!n||!n.hasModel())return;let h=u.get(Ue);if(n.getSelection().isEmpty())await h.executeCommand("editor.action.formatDocument");else await h.executeCommand("editor.action.formatSelection")});var pp="editor.action.showHover",hL="editor.action.showDefinitionPreviewHover",uL="editor.action.hideHover",gL="editor.action.scrollUpHover",pL="editor.action.scrollDownHover",mL="editor.action.scrollLeftHover",fL="editor.action.scrollRightHover",_L="editor.action.pageUpHover",bL="editor.action.pageDownHover",vL="editor.action.goToTopHover",SL="editor.action.goToBottomHover",Ha="editor.action.increaseHoverVerbosityLevel",wL=e(1160,"Increase Hover Verbosity Level"),Wa="editor.action.decreaseHoverVerbosityLevel",CL=e(1161,"Decrease Hover Verbosity Level"),oh="editor.action.hideLongLineWarningHover";function Db(u,n){return!!u[n]}class mp{constructor(u,n){if(this.target=u.target,this.isLeftClick=u.event.leftButton,this.isMiddleClick=u.event.middleButton,this.isRightClick=u.event.rightButton,this.mouseMiddleClickAction=n.mouseMiddleClickAction,this.hasTriggerModifier=Db(u.event,n.triggerModifier),this.isMiddleClick&&n.mouseMiddleClickAction==="ctrlLeftClick")this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0;this.hasSideBySideModifier=Db(u.event,n.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=u.event.detail<=1}}class Rb{constructor(u,n){this.keyCodeIsTriggerKey=u.keyCode===n.triggerKey,this.keyCodeIsSideBySideKey=u.keyCode===n.triggerSideBySideKey,this.hasTriggerModifier=Db(u,n.triggerModifier)}}class nh{constructor(u,n,h,g,p){this.mouseMiddleClickAction=p,this.triggerKey=u,this.triggerModifier=n,this.triggerSideBySideKey=h,this.triggerSideBySideModifier=g}equals(u){return this.triggerKey===u.triggerKey&&this.triggerModifier===u.triggerModifier&&this.triggerSideBySideKey===u.triggerSideBySideKey&&this.triggerSideBySideModifier===u.triggerSideBySideModifier&&this.mouseMiddleClickAction===u.mouseMiddleClickAction}}function yL(u,n){if(u==="altKey"){if(ye)return new nh(57,"metaKey",6,"altKey",n);return new nh(5,"ctrlKey",6,"altKey",n)}if(ye)return new nh(6,"altKey",57,"metaKey",n);return new nh(6,"altKey",5,"ctrlKey",n)}class Tr extends i{constructor(u,n){super();this._onMouseMoveOrRelevantKeyDown=this._register(new r),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new r),this.onExecute=this._onExecute.event,this._onCancel=this._register(new r),this.onCancel=this._onCancel.event,this._editor=u,this._extractLineNumberFromMouseEvent=n?.extractLineNumberFromMouseEvent??((h)=>h.target.position?h.target.position.lineNumber:0),this._opts=yL(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration((h)=>{if(h.hasChanged(86)||h.hasChanged(87)){let g=yL(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(g))return;this._opts=g,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove((h)=>this._onEditorMouseMove(new mp(h,this._opts)))),this._register(this._editor.onMouseDown((h)=>this._onEditorMouseDown(new mp(h,this._opts)))),this._register(this._editor.onMouseUp((h)=>this._onEditorMouseUp(new mp(h,this._opts)))),this._register(this._editor.onKeyDown((h)=>this._onEditorKeyDown(new Rb(h,this._opts)))),this._register(this._editor.onKeyUp((h)=>this._onEditorKeyUp(new Rb(h,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection((h)=>this._onDidChangeCursorSelection(h))),this._register(this._editor.onDidChangeModel((h)=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange((h)=>{if(h.scrollTopChanged||h.scrollLeftChanged)this._resetHandler()}))}_onDidChangeCursorSelection(u){if(u.selection&&u.selection.startColumn!==u.selection.endColumn)this._resetHandler()}_onEditorMouseMove(u){this._lastMouseMoveEvent=u,this._onMouseMoveOrRelevantKeyDown.fire([u,null])}_onEditorMouseDown(u){this._hasTriggerKeyOnMouseDown=u.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(u)}_onEditorMouseUp(u){let n=this._extractLineNumberFromMouseEvent(u);if(!!this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===n&&(this._hasTriggerKeyOnMouseDown||u.isMiddleClick&&u.mouseMiddleClickAction==="openLink"))this._onExecute.fire(u)}_onEditorKeyDown(u){if(this._lastMouseMoveEvent&&(u.keyCodeIsTriggerKey||u.keyCodeIsSideBySideKey&&u.hasTriggerModifier))this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,u]);else if(u.hasTriggerModifier)this._onCancel.fire()}_onEditorKeyUp(u){if(u.keyCodeIsTriggerKey)this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class yo{constructor(u,n,h,g){this.isProviderFirst=u,this.parent=n,this.link=h,this._rangeCallback=g,this.id=_0.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(u){this._range=u,this._rangeCallback(this)}get ariaMessage(){let u=this.parent.getPreview(this)?.preview(this.range);if(!u)return e(1145,"in {0} on line {1} at column {2}",Pi(this.uri),this.range.startLineNumber,this.range.startColumn);else return e(1146,"{0} in {1} on line {2} at column {3}",u.value,Pi(this.uri),this.range.startLineNumber,this.range.startColumn)}}class xL{constructor(u){this._modelReference=u}dispose(){this._modelReference.dispose()}preview(u,n=8){let h=this._modelReference.object.textEditorModel;if(!h)return;let{startLineNumber:g,startColumn:p,endLineNumber:f,endColumn:b}=u,S=h.getWordUntilPosition({lineNumber:g,column:p-n}),w=new t(g,S.startColumn,g,p),x=new t(f,b,f,1073741824),I=h.getValueInRange(w).replace(/^\s+/,""),E=h.getValueInRange(u),Z=h.getValueInRange(x).replace(/\s+$/,"");return{value:I+E+Z,highlight:{start:I.length,end:I.length+E.length}}}}class Kr{constructor(u,n){this.parent=u,this.uri=n,this.children=[],this._previews=new tn}dispose(){Ve(this._previews.values()),this._previews.clear()}getPreview(u){return this._previews.get(u.uri)}get ariaMessage(){let u=this.children.length;if(u===1)return e(1147,"1 symbol in {0}, full path {1}",Pi(this.uri),this.uri.fsPath);else return e(1148,"{0} symbols in {1}, full path {2}",u,Pi(this.uri),this.uri.fsPath)}async resolve(u){if(this._previews.size!==0)return this;for(let n of this.children){if(this._previews.has(n.uri))continue;try{let h=await u.createModelReference(n.uri);this._previews.set(n.uri,new xL(h))}catch(h){ee(h)}}return this}}class Ii{constructor(u,n){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new r,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=u,this._title=n;let[h]=u;u.sort(Ii._compareReferences);let g;for(let p of u){if(!g||!On.isEqual(g.uri,p.uri,!0))g=new Kr(this,p.uri),this.groups.push(g);if(g.children.length===0||Ii._compareReferences(p,g.children[g.children.length-1])!==0){let f=new yo(h===p,g,p,(b)=>this._onDidChangeReferenceRange.fire(b));this.references.push(f),g.children.push(f)}}}dispose(){Ve(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Ii(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){if(this.isEmpty)return e(1149,"No results found");else if(this.references.length===1)return e(1150,"Found 1 symbol in {0}",this.references[0].uri.fsPath);else if(this.groups.length===1)return e(1151,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath);else return e(1152,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(u,n){let{parent:h}=u,g=h.children.indexOf(u),p=h.children.length,f=h.parent.groups.length;if(f===1||n&&g+1<p||!n&&g>0){if(n)g=(g+1)%p;else g=(g+p-1)%p;return h.children[g]}if(g=h.parent.groups.indexOf(h),n)return g=(g+1)%f,h.parent.groups[g].children[0];else return g=(g+f-1)%f,h.parent.groups[g].children[h.parent.groups[g].children.length-1]}nearestReference(u,n){let h=this.references.map((g,p)=>({idx:p,prefixLen:Ar(g.uri.toString(),u.toString()),offsetDist:Math.abs(g.range.startLineNumber-n.lineNumber)*100+Math.abs(g.range.startColumn-n.column)})).sort((g,p)=>{if(g.prefixLen>p.prefixLen)return-1;else if(g.prefixLen<p.prefixLen)return 1;else if(g.offsetDist<p.offsetDist)return-1;else if(g.offsetDist>p.offsetDist)return 1;else return 0})[0];if(h)return this.references[h.idx];return}referenceAt(u,n){for(let h of this.references)if(h.uri.toString()===u.toString()){if(t.containsPosition(h.range,n))return h}return}firstReference(){for(let u of this.references)if(u.isProviderFirst)return u;return this.references[0]}static _compareReferences(u,n){return On.compare(u.uri,n.uri)||t.compareRangesUsingStarts(u.range,n.range)}}var bp=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},vp=function(u,n){return function(h,g){n(h,g,u)}},kb,fp=class u{constructor(n){this._resolverService=n}hasChildren(n){if(n instanceof Ii)return!0;if(n instanceof Kr)return!0;return!1}getChildren(n){if(n instanceof Ii)return n.groups;if(n instanceof Kr)return n.resolve(this._resolverService).then((h)=>h.children);throw Error("bad tree")}};fp=bp([vp(0,Nn)],fp);class Nb{getHeight(){return 23}getTemplateId(u){if(u instanceof Kr)return rh.id;else return sh.id}}var _p=class u{constructor(n){this._keybindingService=n}getKeyboardNavigationLabel(n){if(n instanceof yo){let h=n.parent.getPreview(n)?.preview(n.range);if(h)return h.value}return Pi(n.uri)}};_p=bp([vp(0,ge)],_p);class Ob{getId(u){return u instanceof yo?u.id:u.uri}}var Tb=class u extends i{constructor(n,h){super();this._labelService=h;let g=document.createElement("div");g.classList.add("reference-file"),this.file=this._register(new Eu(g,{supportHighlights:!0})),this.badge=this._register(new Kv(k(g,_(".count")),{},Mk)),n.appendChild(g)}set(n,h){let g=Af(n.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(n.uri),this._labelService.getUriLabel(g,{relative:!0}),{title:this._labelService.getUriLabel(n.uri),matches:h});let p=n.children.length;if(this.badge.setCount(p),p>1)this.badge.setTitleFormat(e(1139,"{0} references",p));else this.badge.setTitleFormat(e(1140,"{0} reference",p))}};Tb=bp([vp(1,Ic)],Tb);var rh=class u{static{kb=this}static{this.id="FileReferencesRenderer"}constructor(n){this._instantiationService=n,this.templateId=kb.id}renderTemplate(n){return this._instantiationService.createInstance(Tb,n)}renderElement(n,h,g){g.set(n.element,ap(n.filterData))}disposeTemplate(n){n.dispose()}};rh=kb=bp([vp(0,O)],rh);class IL extends i{constructor(u){super();this.label=this._register(new ku(u))}set(u,n){let h=u.parent.getPreview(u)?.preview(u.range);if(!h||!h.value)this.label.set(`${Pi(u.uri)}:${u.range.startLineNumber+1}:${u.range.startColumn+1}`);else{let{value:g,highlight:p}=h;if(n&&!is.isDefault(n))this.label.element.classList.toggle("referenceMatch",!1),this.label.set(g,ap(n));else this.label.element.classList.toggle("referenceMatch",!0),this.label.set(g,[p])}}}class sh{constructor(){this.templateId=sh.id}static{this.id="OneReferenceRenderer"}renderTemplate(u){return new IL(u)}renderElement(u,n,h){h.set(u.element,u.filterData)}disposeTemplate(u){u.dispose()}}class Mb{getWidgetAriaLabel(){return e(1141,"References")}getAriaLabel(u){return u.ariaMessage}}var LL=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Ba=function(u,n){return function(h,g){n(h,g,u)}};class Ab{static{this.DecorationOptions=ue.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"})}constructor(u,n){this._editor=u,this._model=n,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new d,this._callOnModelChange=new d,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();let u=this._editor.getModel();if(!u)return;for(let n of this._model.references)if(n.uri.toString()===u.uri.toString()){this._addDecorations(n.parent);return}}_addDecorations(u){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));let n=[],h=[];for(let g=0,p=u.children.length;g<p;g++){let f=u.children[g];if(this._decorationIgnoreSet.has(f.id))continue;if(f.uri.toString()!==this._editor.getModel().uri.toString())continue;n.push({range:f.range,options:Ab.DecorationOptions}),h.push(g)}this._editor.changeDecorations((g)=>{let p=g.deltaDecorations([],n);for(let f=0;f<p.length;f++)this._decorations.set(p[f],u.children[h[f]])})}_onDecorationChanged(){let u=[],n=this._editor.getModel();if(!n)return;for(let[h,g]of this._decorations){let p=n.getDecorationRange(h);if(!p)continue;let f=!1;if(t.equalsRange(p,g.range))continue;if(t.spansMultipleLines(p))f=!0;else{let b=g.range.endColumn-g.range.startColumn,S=p.endColumn-p.startColumn;if(b!==S)f=!0}if(f)this._decorationIgnoreSet.add(g.id),u.push(h);else g.range=p}for(let h=0,g=u.length;h<g;h++)this._decorations.delete(u[h]);this._editor.removeDecorations(u)}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}}class Fb{constructor(){this.ratio=0.7,this.heightInLines=18}static fromJSON(u){let n,h;try{let g=JSON.parse(u);n=g.ratio,h=g.heightInLines}catch{}return{ratio:n||0.7,heightInLines:h||18}}}class EL extends Wk{}var Pb=class u{constructor(n){this.labelService=n,this.disposables=new d}getDragURI(n){if(n instanceof Kr)return n.uri.toString();else if(n instanceof yo)return V2(n.uri,n.range).toString();return null}getDragLabel(n){if(n.length===0)return;return n.map((g)=>this.labelService.getUriBasenameLabel(g.uri)).join(", ")}onDragStart(n,h){if(!h.dataTransfer)return;let p=n.elements.map((f)=>this.getDragURI(f)).filter(Boolean);if(p.length)h.dataTransfer.setData(_d.RESOURCES,JSON.stringify(p)),h.dataTransfer.setData(_d.TEXT,p.join(`
|
|
31
|
+
`))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};Pb=LL([Ba(0,Ic)],Pb);var Sp=class u extends Jd{constructor(n,h,g,p,f,b,S,w,x){super(n,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},b);this._defaultTreeKeyboardSupport=h,this.layoutData=g,this._textModelResolverService=f,this._instantiationService=b,this._peekViewService=S,this._uriLabel=w,this._keybindingService=x,this._disposeOnNewModel=new d,this._callOnDispose=new d,this._onDidSelectReference=this._callOnDispose.add(new r),this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new at(0,0),this._isClosing=!1,this._applyTheme(p.getColorTheme()),this._callOnDispose.add(p.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(n,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),Ve(this._preview),Ve(this._previewNotAvailableMessage),Ve(this._tree),Ve(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(n){let h=n.getColor(hI)||v.transparent;this.style({arrowColor:h,frameColor:h,headerBackgroundColor:n.getColor(cI)||v.transparent,primaryHeadingColor:n.getColor(fg),secondaryHeadingColor:n.getColor(bg)})}show(n){super.show(n,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(n){if(this._preview&&this._preview.getModel())this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:n.ctrlKey||n.metaKey||n.altKey?"side":"open",source:"title"})}_fillBody(n){this.setCssClass("reference-zone-widget"),this._messageContainer=k(n,_("div.messages")),fr(this._messageContainer),this._splitView=new $0(n,{orientation:1}),this._previewContainer=k(n,_("div.preview.inline"));let h={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(Hi,this._previewContainer,h,{},this.editor),fr(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(_u,e(1142,"no preview available"),cr,_u.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=k(n,_("div.ref-tree.inline"));let g={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new Mb,keyboardNavigationLabelProvider:this._instantiationService.createInstance(_p),identityProvider:new Ob,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:uI},dnd:this._instantiationService.createInstance(Pb)};if(this._defaultTreeKeyboardSupport)this._callOnDispose.add(Ct(this._treeContainer,"keydown",(f)=>{if(f.equals(9))this._keybindingService.dispatchEvent(f,f.target),f.stopPropagation()},!0));this._tree=this._instantiationService.createInstance(EL,"ReferencesWidget",this._treeContainer,new Nb,[this._instantiationService.createInstance(rh),this._instantiationService.createInstance(sh)],this._instantiationService.createInstance(fp),g),this._splitView.addView({onDidChange:R.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:(f)=>{this._preview.layout({height:this._dim.height,width:f})}},T0.Distribute),this._splitView.addView({onDidChange:R.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:(f)=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${f}px`,this._tree.layout(this._dim.height,f)}},T0.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{if(this._dim.width)this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width},void 0));let p=(f,b)=>{if(f instanceof yo){if(b==="show")this._revealReference(f,!1);this._onDidSelectReference.fire({element:f,kind:b,source:"tree"})}};this._disposables.add(this._tree.onDidOpen((f)=>{if(f.sideBySide)p(f.element,"side");else if(f.editorOptions.pinned)p(f.element,"goto");else p(f.element,"show")})),fr(this._treeContainer)}_onWidth(n){if(this._dim)this._doLayoutBody(this._dim.height,n)}_doLayoutBody(n,h){super._doLayoutBody(n,h),this._dim=new at(h,n),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(h),this._splitView.resizeView(0,h*this.layoutData.ratio)}setSelection(n){return this._revealReference(n,!0).then(()=>{if(!this._model)return;this._tree.setSelection([n]),this._tree.setFocus([n])})}setModel(n){if(this._disposeOnNewModel.clear(),this._model=n,this._model)return this._onNewModel();return Promise.resolve()}_onNewModel(){if(!this._model)return Promise.resolve(void 0);if(this._model.isEmpty)return this.setTitle(""),this._messageContainer.innerText=e(1143,"No results"),Mr(this._messageContainer),Promise.resolve(void 0);return fr(this._messageContainer),this._decorationsManager=new Ab(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange((n)=>this._tree.rerender(n))),this._disposeOnNewModel.add(this._preview.onMouseDown((n)=>{let{event:h,target:g}=n;if(h.detail!==2)return;let p=this._getFocusedReference();if(!p)return;this._onDidSelectReference.fire({element:{uri:p.uri,range:g.range},kind:h.ctrlKey||h.metaKey||h.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),Mr(this._treeContainer),Mr(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)}_getFocusedReference(){let[n]=this._tree.getFocus();if(n instanceof yo)return n;else if(n instanceof Kr){if(n.children.length>0)return n.children[0]}return}async revealReference(n){await this._revealReference(n,!1),this._onDidSelectReference.fire({element:n,kind:"goto",source:"tree"})}async _revealReference(n,h){if(this._revealedReference===n)return;if(this._revealedReference=n,n.uri.scheme!==se.inMemory)this.setTitle(f2(n.uri),this._uriLabel.getUriLabel(Af(n.uri)));else this.setTitle(e(1144,"References"));let g=this._textModelResolverService.createModelReference(n.uri);if(this._tree.getInput()===n.parent)this._tree.reveal(n);else{if(h)this._tree.reveal(n.parent);await this._tree.expand(n.parent),this._tree.reveal(n)}let p=await g;if(!this._model){p.dispose();return}Ve(this._previewModelReference);let f=p.object;if(f){let b=this._preview.getModel()===f.textEditorModel?0:1,S=t.lift(n.range).collapseToStart();this._previewModelReference=p,this._preview.setModel(f.textEditorModel),this._preview.setSelection(S),this._preview.revealRangeInCenter(S,b)}else this._preview.setModel(this._previewNotAvailableMessage),p.dispose()}};Sp=LL([Ba(3,We),Ba(4,Nn),Ba(5,O),Ba(6,cb),Ba(7,Ic),Ba(8,ge)],Sp);var sT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},rl=function(u,n){return function(h,g){n(h,g,u)}},wp,Va=new P("referenceSearchVisible",!1,e(1136,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'")),Vh=class u{static{wp=this}static{this.ID="editor.contrib.referencesController"}static get(n){return n.getContribution(wp.ID)}constructor(n,h,g,p,f,b,S,w){this._defaultTreeKeyboardSupport=n,this._editor=h,this._editorService=p,this._notificationService=f,this._instantiationService=b,this._storageService=S,this._configurationService=w,this._disposables=new d,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=Va.bindTo(g)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(n,h,g){let p;if(this._widget)p=this._widget.position;if(this.closeWidget(),!!p&&n.containsPosition(p))return;this._peekMode=g,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{if(!this._ignoreModelChangeEvent)this.closeWidget()}));let f="peekViewLayout",b=Fb.fromJSON(this._storageService.get(f,0,"{}"));this._widget=this._instantiationService.createInstance(Sp,this._editor,this._defaultTreeKeyboardSupport,b),this._widget.setTitle(e(1137,"Loading...")),this._widget.show(n),this._disposables.add(this._widget.onDidClose(()=>{if(h.cancel(),this._widget){if(this._storageService.store(f,JSON.stringify(this._widget.layoutData),0,1),!this._widget.isClosing)this.closeWidget();this._widget=void 0}else this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference((w)=>{let{element:x,kind:I}=w;if(!x)return;switch(I){case"open":if(w.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))this.openReference(x,!1,!1);break;case"side":this.openReference(x,!0,!1);break;case"goto":if(g)this._gotoReference(x,!0);else this.openReference(x,!1,!0);break}}));let S=++this._requestIdPool;h.then((w)=>{if(S!==this._requestIdPool||!this._widget){w.dispose();return}return this._model?.dispose(),this._model=w,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){if(!this._model.isEmpty)this._widget.setMetaTitle(e(1138,"{0} ({1})",this._model.title,this._model.references.length));else this._widget.setMetaTitle("");let x=this._editor.getModel().uri,I=new s(n.startLineNumber,n.startColumn),E=this._model.nearestReference(x,I);if(E)return this._widget.setSelection(E).then(()=>{if(this._widget&&this._editor.getOption(99)==="editor")this._widget.focusOnPreviewEditor()})}return})},(w)=>{this._notificationService.error(w)})}changeFocusBetweenPreviewAndReferences(){if(!this._widget)return;if(this._widget.isPreviewEditorFocused())this._widget.focusOnReferenceTree();else this._widget.focusOnPreviewEditor()}async goToNextOrPreviousReference(n){if(!this._editor.hasModel()||!this._model||!this._widget)return;let h=this._widget.position;if(!h)return;let g=this._model.nearestReference(this._editor.getModel().uri,h);if(!g)return;let p=this._model.nextOrPreviousReference(g,n),f=this._editor.hasTextFocus(),b=this._widget.isPreviewEditorFocused();if(await this._widget.setSelection(p),await this._gotoReference(p,!1),f)this._editor.focus();else if(this._widget&&b)this._widget.focusOnPreviewEditor()}async revealReference(n){if(!this._editor.hasModel()||!this._model||!this._widget)return;await this._widget.revealReference(n)}closeWidget(n=!0){if(this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,n)this._editor.focus();this._requestIdPool+=1}_gotoReference(n,h){this._widget?.hide(),this._ignoreModelChangeEvent=!0;let g=t.lift(n.range).collapseToStart();return this._editorService.openCodeEditor({resource:n.uri,options:{selection:g,selectionSource:"code.jump",pinned:h}},this._editor).then((p)=>{if(this._ignoreModelChangeEvent=!1,!p||!this._widget){this.closeWidget();return}if(this._editor===p)this._widget.show(g),this._widget.focusOnReferenceTree();else{let f=wp.get(p),b=this._model.clone();this.closeWidget(),p.focus(),f?.toggleWidget(g,Zt((S)=>Promise.resolve(b)),this._peekMode??!1)}},(p)=>{this._ignoreModelChangeEvent=!1,ee(p)})}openReference(n,h,g){if(!h)this.closeWidget();let{uri:p,range:f}=n;this._editorService.openCodeEditor({resource:p,options:{selection:f,selectionSource:"code.jump",pinned:g}},this._editor,h)}};Vh=wp=sT([rl(2,K),rl(3,Te),rl(4,wt),rl(5,O),rl(6,Mn),rl(7,oe)],Vh);function $a(u,n){let h=pg(u);if(!h)return;let g=Vh.get(h);if(g)n(g)}Dn.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:un(2089,60),when:L.or(Va,gi.inPeekEditor),handler(u){$a(u,(n)=>{n.changeFocusBetweenPreviewAndReferences()})}});Dn.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:L.or(Va,gi.inPeekEditor),handler(u){$a(u,(n)=>{n.goToNextOrPreviousReference(!0)})}});Dn.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:L.or(Va,gi.inPeekEditor),handler(u){$a(u,(n)=>{n.goToNextOrPreviousReference(!1)})}});$e.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference");$e.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference");$e.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch");$e.registerCommand("closeReferenceSearch",(u)=>$a(u,(n)=>n.closeWidget()));Dn.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:L.and(gi.inPeekEditor,L.not("config.editor.stablePeek"))});Dn.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:L.and(Va,L.not("config.editor.stablePeek"),L.or(o.editorTextFocus,Qg.negate()))});Dn.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:L.and(Va,YI,Bk.negate(),Vk.negate()),handler(u){let h=u.get(_a).lastFocusedList?.getFocus();if(Array.isArray(h)&&h[0]instanceof yo)$a(u,(g)=>g.revealReference(h[0]))}});Dn.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:L.and(Va,YI,Bk.negate(),Vk.negate()),handler(u){let h=u.get(_a).lastFocusedList?.getFocus();if(Array.isArray(h)&&h[0]instanceof yo)$a(u,(g)=>g.openReference(h[0],!0,!0))}});$e.registerCommand("openReference",(u)=>{let h=u.get(_a).lastFocusedList?.getFocus();if(Array.isArray(h)&&h[0]instanceof yo)$a(u,(g)=>g.openReference(h[0],!1,!0))});var DL=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ah=function(u,n){return function(h,g){n(h,g,u)}},Bb=new P("hasSymbols",!1,e(1153,"Whether there are symbol locations that can be navigated via keyboard-only.")),dh=ie("ISymbolNavigationService"),Hb=class u{constructor(n,h,g,p){this._editorService=h,this._notificationService=g,this._keybindingService=p,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=Bb.bindTo(n)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(n){let h=n.parent.parent;if(h.references.length<=1){this.reset();return}this._currentModel=h,this._currentIdx=h.references.indexOf(n),this._ctxHasSymbols.set(!0),this._showMessage();let g=new Wb(this._editorService),p=g.onDidChange((f)=>{if(this._ignoreEditorChange)return;let b=this._editorService.getActiveCodeEditor();if(!b)return;let S=b.getModel(),w=b.getPosition();if(!S||!w)return;let x=!1,I=!1;for(let E of h.references)if(vs(E.uri,S.uri))x=!0,I=I||t.containsPosition(E.range,w);else if(x)break;if(!x||!I)this.reset()});this._currentState=No(g,p)}revealNext(n){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;let h=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:h.uri,options:{selection:t.collapseToStart(h.range),selectionRevealType:3}},n).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();let n=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),h=n?e(1154,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,n.getLabel()):e(1155,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(h)}};Hb=DL([ah(0,K),ah(1,Te),ah(2,wt),ah(3,ge)],Hb);_e(dh,Hb,1);G(new class extends nn{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:Bb,kbOpts:{weight:100,primary:70}})}runEditorCommand(u,n){return u.get(dh).revealNext(n)}});Dn.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:Bb,primary:9,handler(u){u.get(dh).reset()}});var Wb=class u{constructor(n){this._listener=new Map,this._disposables=new d,this._onDidChange=new r,this.onDidChange=this._onDidChange.event,this._disposables.add(n.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(n.onCodeEditorAdd(this._onDidAddEditor,this)),n.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),Ve(this._listener.values())}_onDidAddEditor(n){this._listener.set(n,No(n.onDidChangeCursorPosition((h)=>this._onDidChange.fire({editor:n})),n.onDidChangeModelContent((h)=>this._onDidChange.fire({editor:n}))))}_onDidRemoveEditor(n){this._listener.get(n)?.dispose(),this._listener.delete(n)}};Wb=DL([ah(0,Te)],Wb);function Vb(u,n){if(n.uri.scheme===u.uri.scheme)return!0;if(Lg(n.uri,se.walkThroughSnippet,se.vscodeChatCodeBlock,se.vscodeChatCodeCompareBlock))return!1;return!0}async function lh(u,n,h,g,p){let b=h.ordered(u,g).map((w)=>Promise.resolve(p(w,u,n)).then(void 0,(x)=>{vt(x);return})),S=await Promise.all(b);return wr(S.flat()).filter((w)=>Vb(u,w))}function Os(u,n,h,g,p){return lh(n,h,u,g,(f,b,S)=>f.provideDefinition(b,S,p))}function Cp(u,n,h,g,p){return lh(n,h,u,g,(f,b,S)=>f.provideDeclaration(b,S,p))}function yp(u,n,h,g,p){return lh(n,h,u,g,(f,b,S)=>f.provideImplementation(b,S,p))}function xp(u,n,h,g,p){return lh(n,h,u,g,(f,b,S)=>f.provideTypeDefinition(b,S,p))}function sl(u,n,h,g,p,f){return lh(n,h,u,p,async(b,S,w)=>{let x=(await b.provideReferences(S,w,{includeDeclaration:!0},f))?.filter((E)=>Vb(S,E));if(!g||!x||x.length!==2)return x;let I=(await b.provideReferences(S,w,{includeDeclaration:!1},f))?.filter((E)=>Vb(S,E));if(I&&I.length===1)return I;return x})}async function ir(u){let n=await u(),h=new Ii(n,""),g=h.references.map((p)=>p.link);return h.dispose(),g}Fr("_executeDefinitionProvider",(u,n,h)=>{let g=u.get(V),p=Os(g.definitionProvider,n,h,!1,xe.None);return ir(()=>p)});Fr("_executeDefinitionProvider_recursive",(u,n,h)=>{let g=u.get(V),p=Os(g.definitionProvider,n,h,!0,xe.None);return ir(()=>p)});Fr("_executeTypeDefinitionProvider",(u,n,h)=>{let g=u.get(V),p=xp(g.typeDefinitionProvider,n,h,!1,xe.None);return ir(()=>p)});Fr("_executeTypeDefinitionProvider_recursive",(u,n,h)=>{let g=u.get(V),p=xp(g.typeDefinitionProvider,n,h,!0,xe.None);return ir(()=>p)});Fr("_executeDeclarationProvider",(u,n,h)=>{let g=u.get(V),p=Cp(g.declarationProvider,n,h,!1,xe.None);return ir(()=>p)});Fr("_executeDeclarationProvider_recursive",(u,n,h)=>{let g=u.get(V),p=Cp(g.declarationProvider,n,h,!0,xe.None);return ir(()=>p)});Fr("_executeReferenceProvider",(u,n,h)=>{let g=u.get(V),p=sl(g.referenceProvider,n,h,!1,!1,xe.None);return ir(()=>p)});Fr("_executeReferenceProvider_recursive",(u,n,h)=>{let g=u.get(V),p=sl(g.referenceProvider,n,h,!1,!0,xe.None);return ir(()=>p)});Fr("_executeImplementationProvider",(u,n,h)=>{let g=u.get(V),p=yp(g.implementationProvider,n,h,!1,xe.None);return ir(()=>p)});Fr("_executeImplementationProvider_recursive",(u,n,h)=>{let g=u.get(V),p=yp(g.implementationProvider,n,h,!0,xe.None);return ir(()=>p)});Zn.appendMenuItem(l.EditorContext,{submenu:l.EditorContextPeek,title:e(1096,"Peek"),group:"navigation",order:100});class ja{static is(u){if(!u||typeof u!=="object")return!1;if(u instanceof ja)return!0;if(s.isIPosition(u.position)&&u.model)return!0;return!1}constructor(u,n){this.model=u,this.position=n}}class Wi extends mo{static{this._allSymbolNavigationCommands=new Map}static{this._activeAlternativeCommands=new Set}static all(){return Wi._allSymbolNavigationCommands.values()}static _patchConfig(u){let n={...u,f1:!0};if(n.menu){for(let h of Ie.wrap(n.menu))if(h.id===l.EditorContext||h.id===l.EditorContextPeek)h.when=L.and(u.precondition,h.when)}return n}constructor(u,n){super(Wi._patchConfig(n));this.configuration=u,Wi._allSymbolNavigationCommands.set(n.id,this)}runEditorCommand(u,n,h,g){if(!n.hasModel())return Promise.resolve(void 0);let p=u.get(wt),f=u.get(Te),b=u.get(Us),S=u.get(dh),w=u.get(V),x=u.get(O),I=n.getModel(),E=n.getPosition(),Z=ja.is(h)?h:new ja(I,E),X=new Es(n,5),J=yc(this._getLocationModel(w,Z.model,Z.position,X.token),X.token).then(async(Q)=>{if(!Q||X.token.isCancellationRequested)return;zn(Q.ariaMessage);let te;if(Q.referenceAt(I.uri,E)){let le=this._getAlternativeCommand(n);if(le!==void 0&&!Wi._activeAlternativeCommands.has(le)&&Wi._allSymbolNavigationCommands.has(le))te=Wi._allSymbolNavigationCommands.get(le)}let re=Q.references.length;if(re===0){if(!this.configuration.muteMessage){let le=I.getWordAtPosition(E);ti.get(n)?.showMessage(this._getNoResultFoundMessage(le),E)}}else if(re===1&&te)Wi._activeAlternativeCommands.add(this.desc.id),x.invokeFunction((le)=>te.runEditorCommand(le,n,h,g).finally(()=>{Wi._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(f,S,n,Q,g)},(Q)=>{p.error(Q)}).finally(()=>{X.dispose()});return b.showWhile(J,250),J}async _onResult(u,n,h,g,p){let f=this._getGoToPreference(h);if(!(h instanceof Hi)&&(this.configuration.openInPeek||f==="peek"&&g.references.length>1))this._openInPeek(h,g,p);else{let b=g.firstReference(),S=g.references.length>1&&f==="gotoAndPeek",w=await this._openReference(h,u,b,this.configuration.openToSide,!S);if(S&&w)this._openInPeek(w,g,p);else g.dispose();if(f==="goto")n.put(b)}}async _openReference(u,n,h,g,p){let f=void 0;if(e2(h))f=h.targetSelectionRange;if(!f)f=h.range;if(!f)return;let b=await n.openCodeEditor({resource:h.uri,options:{selection:t.collapseToStart(f),selectionRevealType:3,selectionSource:"code.jump"}},u,g);if(!b)return;if(p){let S=b.getModel(),w=b.createDecorationsCollection([{range:f,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{if(b.getModel()===S)w.clear()},350)}return b}_openInPeek(u,n,h){let g=Vh.get(u);if(g&&u.hasModel())g.toggleWidget(h??u.getSelection(),Zt((p)=>Promise.resolve(n)),this.configuration.openInPeek);else n.dispose()}}class Ks extends Wi{async _getLocationModel(u,n,h,g){return new Ii(await Os(u.definitionProvider,n,h,!1,g),e(1097,"Definitions"))}_getNoResultFoundMessage(u){return u&&u.word?e(1098,"No definition found for '{0}'",u.word):e(1099,"No definition found")}_getAlternativeCommand(u){return u.getOption(67).alternativeDefinitionCommand}_getGoToPreference(u){return u.getOption(67).multipleDefinitions}}lt(class u extends Ks{static{this.id="editor.action.revealDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:u.id,title:{...y(1123,"Go to Definition"),mnemonicTitle:e(1100,"Go to &&Definition")},precondition:o.hasDefinitionProvider,keybinding:[{when:o.editorTextFocus,primary:70,weight:100},{when:L.and(o.editorTextFocus,GI),primary:2118,weight:100}],menu:[{id:l.EditorContext,group:"navigation",order:1.1},{id:l.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]});$e.registerCommandAlias("editor.action.goToDeclaration",u.id)}});lt(class u extends Ks{static{this.id="editor.action.revealDefinitionAside"}constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:u.id,title:y(1124,"Open Definition to the Side"),precondition:L.and(o.hasDefinitionProvider,o.isInEmbeddedEditor.toNegated()),keybinding:[{when:o.editorTextFocus,primary:un(2089,70),weight:100},{when:L.and(o.editorTextFocus,GI),primary:un(2089,2118),weight:100}]});$e.registerCommandAlias("editor.action.openDeclarationToTheSide",u.id)}});lt(class u extends Ks{static{this.id="editor.action.peekDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:u.id,title:y(1125,"Peek Definition"),precondition:L.and(o.hasDefinitionProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),keybinding:{when:o.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:l.EditorContextPeek,group:"peek",order:2}});$e.registerCommandAlias("editor.action.previewDeclaration",u.id)}});class Kb extends Wi{async _getLocationModel(u,n,h,g){return new Ii(await Cp(u.declarationProvider,n,h,!1,g),e(1101,"Declarations"))}_getNoResultFoundMessage(u){return u&&u.word?e(1102,"No declaration found for '{0}'",u.word):e(1103,"No declaration found")}_getAlternativeCommand(u){return u.getOption(67).alternativeDeclarationCommand}_getGoToPreference(u){return u.getOption(67).multipleDeclarations}}lt(class u extends Kb{static{this.id="editor.action.revealDeclaration"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:u.id,title:{...y(1126,"Go to Declaration"),mnemonicTitle:e(1104,"Go to &&Declaration")},precondition:L.and(o.hasDeclarationProvider,o.isInEmbeddedEditor.toNegated()),menu:[{id:l.EditorContext,group:"navigation",order:1.3},{id:l.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(n){return n&&n.word?e(1105,"No declaration found for '{0}'",n.word):e(1106,"No declaration found")}});lt(class u extends Kb{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:y(1127,"Peek Declaration"),precondition:L.and(o.hasDeclarationProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),menu:{id:l.EditorContextPeek,group:"peek",order:3}})}});class zb extends Wi{async _getLocationModel(u,n,h,g){return new Ii(await xp(u.typeDefinitionProvider,n,h,!1,g),e(1107,"Type Definitions"))}_getNoResultFoundMessage(u){return u&&u.word?e(1108,"No type definition found for '{0}'",u.word):e(1109,"No type definition found")}_getAlternativeCommand(u){return u.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(u){return u.getOption(67).multipleTypeDefinitions}}lt(class u extends zb{static{this.ID="editor.action.goToTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:u.ID,title:{...y(1128,"Go to Type Definition"),mnemonicTitle:e(1110,"Go to &&Type Definition")},precondition:o.hasTypeDefinitionProvider,keybinding:{when:o.editorTextFocus,primary:0,weight:100},menu:[{id:l.EditorContext,group:"navigation",order:1.4},{id:l.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}});lt(class u extends zb{static{this.ID="editor.action.peekTypeDefinition"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:u.ID,title:y(1129,"Peek Type Definition"),precondition:L.and(o.hasTypeDefinitionProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),menu:{id:l.EditorContextPeek,group:"peek",order:4}})}});class Ub extends Wi{async _getLocationModel(u,n,h,g){return new Ii(await yp(u.implementationProvider,n,h,!1,g),e(1111,"Implementations"))}_getNoResultFoundMessage(u){return u&&u.word?e(1112,"No implementation found for '{0}'",u.word):e(1113,"No implementation found")}_getAlternativeCommand(u){return u.getOption(67).alternativeImplementationCommand}_getGoToPreference(u){return u.getOption(67).multipleImplementations}}lt(class u extends Ub{static{this.ID="editor.action.goToImplementation"}constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:u.ID,title:{...y(1130,"Go to Implementations"),mnemonicTitle:e(1114,"Go to &&Implementations")},precondition:o.hasImplementationProvider,keybinding:{when:o.editorTextFocus,primary:2118,weight:100},menu:[{id:l.EditorContext,group:"navigation",order:1.45},{id:l.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}});lt(class u extends Ub{static{this.ID="editor.action.peekImplementation"}constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:u.ID,title:y(1131,"Peek Implementations"),precondition:L.and(o.hasImplementationProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),keybinding:{when:o.editorTextFocus,primary:3142,weight:100},menu:{id:l.EditorContextPeek,group:"peek",order:5}})}});class $b extends Wi{_getNoResultFoundMessage(u){return u?e(1115,"No references found for '{0}'",u.word):e(1116,"No references found")}_getAlternativeCommand(u){return u.getOption(67).alternativeReferenceCommand}_getGoToPreference(u){return u.getOption(67).multipleReferences}}lt(class u extends $b{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...y(1132,"Go to References"),mnemonicTitle:e(1117,"Go to &&References")},precondition:L.and(o.hasReferenceProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),keybinding:{when:o.editorTextFocus,primary:1094,weight:100},menu:[{id:l.EditorContext,group:"navigation",order:1.45},{id:l.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(n,h,g,p){return new Ii(await sl(n.referenceProvider,h,g,!0,!1,p),e(1118,"References"))}});lt(class u extends $b{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:y(1133,"Peek References"),precondition:L.and(o.hasReferenceProvider,gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated()),menu:{id:l.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(n,h,g,p){return new Ii(await sl(n.referenceProvider,h,g,!1,!1,p),e(1119,"References"))}});class RL extends Wi{constructor(u,n,h){super(u,{id:"editor.action.goToLocation",title:y(1134,"Go to Any Symbol"),precondition:L.and(gi.notInPeekEditor,o.isInEmbeddedEditor.toNegated())});this._references=n,this._gotoMultipleBehaviour=h}async _getLocationModel(u,n,h,g){return new Ii(this._references,e(1120,"Locations"))}_getNoResultFoundMessage(u){return u&&e(1121,"No results for '{0}'",u.word)||""}_getGoToPreference(u){return this._gotoMultipleBehaviour??u.getOption(67).multipleReferences}_getAlternativeCommand(){return}}$e.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:q},{name:"position",description:"The position at which to start",constraint:s.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(u,n,h,g,p,f,b)=>{He(q.isUri(n)),He(s.isIPosition(h)),He(Array.isArray(g)),He(typeof p>"u"||typeof p==="string"),He(typeof b>"u"||typeof b==="boolean");let S=u.get(Te),w=await S.openCodeEditor({resource:n},S.getFocusedCodeEditor());if(el(w))return w.setPosition(h),w.revealPositionInCenterIfOutsideViewport(h,0),w.invokeWithinContext((x)=>{let I=new class extends RL{_getNoResultFoundMessage(E){return f||super._getNoResultFoundMessage(E)}}({muteMessage:!Boolean(f),openInPeek:Boolean(b),openToSide:!1},g,p);x.get(O).invokeFunction(I.run.bind(I),w)})}});$e.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:q},{name:"position",description:"The position at which to start",constraint:s.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(u,n,h,g,p)=>{u.get(Ue).executeCommand("editor.action.goToLocations",n,h,g,p,void 0,!0)}});$e.registerCommand({id:"editor.action.findReferences",handler:(u,n,h)=>{He(q.isUri(n)),He(s.isIPosition(h));let g=u.get(V),p=u.get(Te);return p.openCodeEditor({resource:n},p.getFocusedCodeEditor()).then((f)=>{if(!el(f)||!f.hasModel())return;let b=Vh.get(f);if(!b)return;let S=Zt((x)=>sl(g.referenceProvider,f.getModel(),s.lift(h),!1,!1,x).then((I)=>new Ii(I,e(1122,"References")))),w=new t(h.lineNumber,h.column,h.lineNumber,h.column);return Promise.resolve(b.toggleWidget(w,S,!1))})}});$e.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");var aT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},jb=function(u,n){return function(h,g){n(h,g,u)}},ch,al=class u{static{ch=this}static{this.ID="editor.contrib.gotodefinitionatposition"}static{this.MAX_SOURCE_PREVIEW_LINES=8}constructor(n,h,g,p){this.textModelResolverService=h,this.languageService=g,this.languageFeaturesService=p,this.toUnhook=new d,this.toUnhookForKeyboard=new d,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=n,this.linkDecorations=this.editor.createDecorationsCollection();let f=new Tr(n);this.toUnhook.add(f),this.toUnhook.add(f.onMouseMoveOrRelevantKeyDown(([b,S])=>{this.startFindDefinitionFromMouse(b,S??void 0)})),this.toUnhook.add(f.onExecute((b)=>{if(this.isEnabled(b))this.gotoDefinition(b.target.position,b.hasSideBySideModifier).catch((S)=>{ee(S)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(f.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(n){return n.getContribution(ch.ID)}async startFindDefinitionFromCursor(n){await this.startFindDefinition(n),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown((h)=>{if(h)this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()}))}startFindDefinitionFromMouse(n,h){if(n.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(n,h)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}let g=n.target.position;this.startFindDefinition(g)}async startFindDefinition(n){this.toUnhookForKeyboard.clear();let h=n?this.editor.getModel()?.getWordAtPosition(n):null;if(!h){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===h.startColumn&&this.currentWordAtPosition.endColumn===h.endColumn&&this.currentWordAtPosition.word===h.word)return;this.currentWordAtPosition=h;let g=new rm(this.editor,15);if(this.previousPromise)this.previousPromise.cancel(),this.previousPromise=null;this.previousPromise=Zt((b)=>this.findDefinition(n,b));let p;try{p=await this.previousPromise}catch(b){ee(b);return}if(!p||!p.length||!g.validate(this.editor)){this.removeLinkDecorations();return}let f=p[0].originSelectionRange?t.lift(p[0].originSelectionRange):new t(n.lineNumber,h.startColumn,n.lineNumber,h.endColumn);if(p.length>1){let b=f;for(let{originSelectionRange:S}of p)if(S)b=t.plusRange(b,S);this.addDecoration(b,new Pn().appendText(e(1135,"Click to show {0} definitions.",p.length)))}else{let b=p[0];if(!b.uri)return;return this.textModelResolverService.createModelReference(b.uri).then((S)=>{if(!S.object||!S.object.textEditorModel){S.dispose();return}let{object:{textEditorModel:w}}=S,{startLineNumber:x}=b.range;if(x<1||x>w.getLineCount()){S.dispose();return}let I=this.getPreviewValue(w,x,b),E=this.languageService.guessLanguageIdByFilepathOrFirstLine(w.uri);this.addDecoration(f,I?new Pn().appendCodeblock(E?E:"",I):void 0),S.dispose()})}}getPreviewValue(n,h,g){let p=g.range;if(p.endLineNumber-p.startLineNumber>=ch.MAX_SOURCE_PREVIEW_LINES)p=this.getPreviewRangeBasedOnIndentation(n,h);return p=n.validateRange(p),this.stripIndentationFromPreviewRange(n,h,p)}stripIndentationFromPreviewRange(n,h,g){let f=n.getLineFirstNonWhitespaceColumn(h);for(let S=h+1;S<g.endLineNumber;S++){let w=n.getLineFirstNonWhitespaceColumn(S);f=Math.min(f,w)}return n.getValueInRange(g).replace(new RegExp(`^\\s{${f-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(n,h){let g=n.getLineFirstNonWhitespaceColumn(h),p=Math.min(n.getLineCount(),h+ch.MAX_SOURCE_PREVIEW_LINES),f=h+1;for(;f<p;f++){let b=n.getLineFirstNonWhitespaceColumn(f);if(g===b)break}return new t(h,1,f+1,1)}addDecoration(n,h){let g={range:n,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:h}};this.linkDecorations.set([g])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(n,h){return this.editor.hasModel()&&n.isLeftClick&&n.isNoneOrSingleMouseDown&&n.target.type===6&&!(n.target.detail.injectedText?.options instanceof Sd)&&(n.hasTriggerModifier||(h?h.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(n,h){let g=this.editor.getModel();if(!g)return Promise.resolve(null);return Os(this.languageFeaturesService.definitionProvider,g,n,!1,h)}async gotoDefinition(n,h){return this.editor.setPosition(n),this.editor.invokeWithinContext((g)=>{let p=!h&&this.editor.getOption(101)&&!this.isInPeekEditor(g);return new Ks({openToSide:h,openInPeek:p,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(g)})}isInPeekEditor(n){let h=n.get(K);return gi.inPeekEditor.getValue(h)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}};al=ch=aT([jb(1,Nn),jb(2,xt),jb(3,V)],al);fe(al.ID,al,2);var fn="editor.action.inlineSuggest.commit",Ya="editor.action.inlineSuggest.commitAlternativeAction",Ip="editor.action.inlineSuggest.showPrevious",Lp="editor.action.inlineSuggest.showNext",dl="editor.action.inlineSuggest.jump",Ep="editor.action.inlineSuggest.hide",hh="editor.action.inlineSuggest.toggleShowCollapsed",Gb="editor.action.inlineSuggest.renameSymbol";var Zb=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Vo=function(u,n){return function(h,g){n(h,g,u)}},Dp,Rp=class u extends i{constructor(n,h,g){super();this.editor=n,this.model=h,this.instantiationService=g,this.alwaysShowToolbar=je(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=m(this,(p)=>{let f=this.model.read(p)?.primaryGhostText.read(p);if(!this.alwaysShowToolbar.read(p)||!f||f.parts.length===0)return this.sessionPosition=void 0,null;let b=f.parts[0].column;if(this.sessionPosition&&this.sessionPosition.lineNumber!==f.lineNumber)this.sessionPosition=void 0;let S=new s(f.lineNumber,Math.min(b,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=S,S}),this._register(oi((p,f)=>{let b=this.model.read(p);if(!b||!this.alwaysShowToolbar.read(p))return;let S=m((x)=>{let I=x.store.add(this.instantiationService.createInstance(zr.hot.read(x),this.editor,!0,this.position,b.selectedInlineCompletionIndex,b.inlineCompletionsCount,b.activeCommands,b.warning,()=>{}));return n.addContentWidget(I),x.store.add(D(()=>n.removeContentWidget(I))),x.store.add(W((E)=>{if(!this.position.read(E))return;if(b.lastTriggerKind.read(E)!==uo.Explicit)b.triggerExplicitly()})),I}),w=fo(this,(x,I)=>!!this.position.read(x)||!!I);f.add(W((x)=>{if(w.read(x))S.read(x)}))}))}};Rp=Zb([Vo(2,O)],Rp);var dT=Mt("inline-suggestion-hints-next",C.chevronRight,e(1270,"Icon for show next parameter hint.")),lT=Mt("inline-suggestion-hints-previous",C.chevronLeft,e(1271,"Icon for show previous parameter hint.")),zr=class u extends i{static{Dp=this}static{this.hot=Gv(this)}static{this._dropDownVisible=!1}static get dropDownVisible(){return this._dropDownVisible}static{this.id=0}createCommandAction(n,h,g){let p=new _r(n,h,g,!0,()=>this._commandService.executeCommand(n));return p.tooltip=this.keybindingService.appendKeybinding(h,n,this._contextKeyService),p}constructor(n,h,g,p,f,b,S,w,x,I,E,Z,X){super();this.editor=n,this.withBorder=h,this._position=g,this._currentSuggestionIdx=p,this._suggestionCount=f,this._extraCommands=b,this._warning=S,this._relayout=w,this._commandService=x,this.keybindingService=E,this._contextKeyService=Z,this._menuService=X,this.id=`InlineSuggestionHintsContentWidget${Dp.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=m((J)=>{let Q=this._warning.read(J);if(!Q)return;if(typeof Q.message==="string")return Q.message;return J.store.add(Hl(Q.message)).element}),this._warningMessageNode=he.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:m((J)=>this._warning.read(J)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=Re("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,Re("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(Ip,e(1272,"Previous"),Y.asClassName(lT))),this.availableSuggestionCountAction=this._register(new _r("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(Lp,e(1273,"Next"),Y.asClassName(dT))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(l.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new ke(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new ke(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(W((J)=>{this._warningMessageContentNode.read(J),this._warningMessageNode.readEffect(J),this._relayout()})),this.toolBar=this._register(I.createInstance(qb,this.nodes.toolBar,l.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:(J)=>J.startsWith("primary")},actionViewItemProvider:(J,Q)=>{if(J instanceof Gi)return I.createInstance(TL,J,void 0);if(J===this.availableSuggestionCountAction){let te=new kL(void 0,J,{label:!0,icon:!1});return te.setClass("availableSuggestionCount"),te}return},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility((J)=>{Dp._dropDownVisible=J})),this._register(W((J)=>{this._position.read(J),this.editor.layoutContentWidget(this)})),this._register(W((J)=>{let Q=this._suggestionCount.read(J),te=this._currentSuggestionIdx.read(J);if(Q!==void 0)this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${te+1}/${Q}`;else this.clearAvailableSuggestionCountLabelDebounced.schedule();if(Q!==void 0&&Q>1)this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0;else this.disableButtonsDebounced.schedule()})),this._register(W((J)=>{let te=this._extraCommands.read(J).map((re)=>({class:void 0,id:re.command.id,enabled:!0,tooltip:re.command.tooltip||"",label:re.command.title,run:()=>this._commandService.executeCommand(re.command.id,...re.command.arguments??[])}));for(let[re,le]of this.inlineCompletionsActionsMenus.getActions())for(let pe of le)if(pe instanceof Gi)te.push(pe);if(te.length>0)te.unshift(new ut);this.toolBar.setAdditionalSecondaryActions(te)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}};zr=Dp=Zb([Vo(8,Ue),Vo(9,O),Vo(10,ge),Vo(11,K),Vo(12,Ai)],zr);class kL extends Rc{constructor(){super(...arguments);this._className=void 0}setClass(u){this._className=u}render(u){if(super.render(u),this._className)u.classList.add(this._className)}updateTooltip(){}}class TL extends Bl{updateLabel(){let u=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!u)return super.updateLabel();if(this.label){let n=Re("div.keybinding").root;this._register(new Xa(n,Oi,{disableTitle:!0,...Xk})).set(u),this.label.textContent=this._action.label,this.label.appendChild(n),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}}var qb=class u extends F0{constructor(n,h,g,p,f,b,S,w,x){super(n,{resetMenu:h,...g},p,f,b,S,w,x);this.menuId=h,this.options2=g,this.menuService=p,this.contextKeyService=f,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:n,secondary:h}=eb(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);h.push(...this.additionalActions),n.unshift(...this.prependedPrimaryActions),n.push(...this.additionalPrimaryActions),this.setActions(n,h)}setPrependedPrimaryActions(n){if(ot(this.prependedPrimaryActions,n,(h,g)=>h===g))return;this.prependedPrimaryActions=n,this.updateToolbar()}setAdditionalSecondaryActions(n){if(ot(this.additionalActions,n,(h,g)=>h===g))return;this.additionalActions=n,this.updateToolbar()}};qb=Zb([Vo(3,Ai),Vo(4,K),Vo(5,Qn),Vo(6,ge),Vo(7,Ue),Vo(8,Wn)],qb);function $s(u,n,h){let g=kt(u);if(n<g.left+3||n>g.left+g.width-3||h<g.top+3||h>g.top+g.height-3)return!1;return!0}function kp(u,n,h){if(u==="on")return!0;if(u==="off")return!1;return uh(n,h.event)}function uh(u,n){if(u==="altKey")return n.ctrlKey||n.metaKey;return n.altKey}class NL{constructor(u,n,h,g){this.value=u,this.isComplete=n,this.hasLoadingMessage=h,this.options=g}}class gh extends i{constructor(u,n){super();this._editor=u,this._computer=n,this._onResult=this._register(new r),this.onResult=this._onResult.event,this._asyncComputationScheduler=this._register(new Tp((h)=>this._triggerAsyncComputation(h),0)),this._syncComputationScheduler=this._register(new Tp((h)=>this._triggerSyncComputation(h),0)),this._loadingMessageScheduler=this._register(new Tp((h)=>this._triggerLoadingMessage(h),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){if(this._asyncIterable)this._asyncIterable.cancel(),this._asyncIterable=null;this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(u,n){this._options=n,this._state=u,this._fireResult(n)}_triggerAsyncComputation(u){if(this._setState(2,u),this._syncComputationScheduler.schedule(u,this._secondWaitTime),this._computer.computeAsync)this._asyncIterableDone=!1,this._asyncIterable=s2((n)=>this._computer.computeAsync(u,n)),(async()=>{try{for await(let n of this._asyncIterable)if(n)this._result.push(n),this._fireResult(u);if(this._asyncIterableDone=!0,this._state===3||this._state===4)this._setState(0,u)}catch(n){ee(n)}})();else this._asyncIterableDone=!0}_triggerSyncComputation(u){if(this._computer.computeSync)this._result=this._result.concat(this._computer.computeSync(u));this._setState(this._asyncIterableDone?0:3,u)}_triggerLoadingMessage(u){if(this._state===3)this._setState(4,u)}_fireResult(u){if(this._state===1||this._state===2)return;let n=this._state===0,h=this._state===4;this._onResult.fire(new NL(this._result.slice(0),n,h,u))}start(u,n){if(u===0){if(this._state===0)this._setState(1,n),this._asyncComputationScheduler.schedule(n,this._firstWaitTime),this._loadingMessageScheduler.schedule(n,this._loadingMessageTime)}else switch(this._state){case 0:this._triggerAsyncComputation(n),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(n);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(n);break}}cancel(){if(this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable)this._asyncIterable.cancel(),this._asyncIterable=null;this._result=[],this._options=void 0,this._state=0}get options(){return this._options}}class Tp extends i{constructor(u,n){super();this._scheduler=this._register(new ke(()=>u(this._options),n))}schedule(u,n){this._options=u,this._scheduler.schedule(n)}cancel(){this._scheduler.cancel()}}class ph{constructor(u,n,h,g){this.priority=u,this.range=n,this.initialMousePosX=h,this.initialMousePosY=g,this.type=1}equals(u){return u.type===1&&this.range.equalsRange(u.range)}canAdoptVisibleHover(u,n){return u.type===1&&n.lineNumber===this.range.startLineNumber}}class Gs{constructor(u,n,h,g,p,f){this.priority=u,this.owner=n,this.range=h,this.initialMousePosX=g,this.initialMousePosY=p,this.supportsMarkerHover=f,this.type=2}equals(u){return u.type===2&&this.owner===u.owner}canAdoptVisibleHover(u,n){return u.type===2&&this.owner===u.owner}}class xo{constructor(u,n){this.renderedHoverParts=u,this.disposables=n}dispose(){for(let u of this.renderedHoverParts)u.dispose();this.disposables?.dispose()}}var El=new class u{constructor(){this._participants=[]}register(n){this._participants.push(n)}getAll(){return this._participants}};class ed{get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}constructor(){this._onDidWillResize=new r,this._onDidResize=new r,this._sashListener=new d,this._size=new at(0,0),this._minSize=new at(0,0),this._maxSize=new at(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new gr(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new gr(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new gr(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:E0.North}),this._southSash=new gr(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:E0.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let u,n=0,h=0;this._sashListener.add(R.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{if(u===void 0)this._onDidWillResize.fire(),u=this._size,n=0,h=0})),this._sashListener.add(R.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{if(u!==void 0)u=void 0,n=0,h=0,this._onDidResize.fire({dimension:this._size,done:!0})})),this._sashListener.add(this._eastSash.onDidChange((g)=>{if(u)h=g.currentX-g.startX,this.layout(u.height+n,u.width+h),this._onDidResize.fire({dimension:this._size,done:!1,east:!0})})),this._sashListener.add(this._westSash.onDidChange((g)=>{if(u)h=-(g.currentX-g.startX),this.layout(u.height+n,u.width+h),this._onDidResize.fire({dimension:this._size,done:!1,west:!0})})),this._sashListener.add(this._northSash.onDidChange((g)=>{if(u)n=-(g.currentY-g.startY),this.layout(u.height+n,u.width+h),this._onDidResize.fire({dimension:this._size,done:!1,north:!0})})),this._sashListener.add(this._southSash.onDidChange((g)=>{if(u)n=g.currentY-g.startY,this.layout(u.height+n,u.width+h),this._onDidResize.fire({dimension:this._size,done:!1,south:!0})})),this._sashListener.add(R.any(this._eastSash.onDidReset,this._westSash.onDidReset)((g)=>{if(this._preferredSize)this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0})})),this._sashListener.add(R.any(this._northSash.onDidReset,this._southSash.onDidReset)((g)=>{if(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(u,n,h,g){this._northSash.state=u?3:0,this._eastSash.state=n?3:0,this._southSash.state=h?3:0,this._westSash.state=g?3:0}layout(u=this.size.height,n=this.size.width){let{height:h,width:g}=this._minSize,{height:p,width:f}=this._maxSize;u=Math.max(h,Math.min(p,u)),n=Math.max(g,Math.min(f,n));let b=new at(n,u);if(!at.equals(b,this._size))this.domNode.style.height=u+"px",this.domNode.style.width=n+"px",this._size=b,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(u){this._maxSize=u}get maxSize(){return this._maxSize}set minSize(u){this._minSize=u}get minSize(){return this._minSize}set preferredSize(u){this._preferredSize=u}get preferredSize(){return this._preferredSize}}var cT=30,hT=24;class Xb extends i{constructor(u,n=new at(10,10)){super();this._editor=u,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new ed),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=at.lift(n),this._resizableNode.layout(n.height,n.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize((h)=>{if(this._resize(new at(h.dimension.width,h.dimension.height)),h.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?s.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(u){let n=this._editor.getDomNode(),h=this._editor.getScrolledVisiblePosition(u);if(!n||!h)return;return kt(n).top+h.top-cT}_availableVerticalSpaceBelow(u){let n=this._editor.getDomNode(),h=this._editor.getScrolledVisiblePosition(u);if(!n||!h)return;let g=kt(n),p=ga(n.ownerDocument.body),f=g.top+h.top+h.height;return p.height-f-hT}_findPositionPreference(u,n){let h=Math.min(this._availableVerticalSpaceBelow(n)??1/0,u),g=Math.min(this._availableVerticalSpaceAbove(n)??1/0,u),p=Math.min(Math.max(g,h),u),f=Math.min(u,p),b;if(this._editor.getOption(69).above)b=f<=g?1:2;else b=f<=h?2:1;if(b===1)this._resizableNode.enableSashes(!0,!0,!1,!1);else this._resizableNode.enableSashes(!1,!0,!0,!1);return b}_resize(u){this._resizableNode.layout(u.height,u.width)}}var uT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Np=function(u,n){return function(h,g){n(h,g,u)}},Ko,OL=30,Op=class u extends Xb{static{Ko=this}static{this.ID="editor.contrib.resizableContentHoverWidget"}static{this._lastDimensions=new at(0,0)}get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(n,h,g,p,f){let b=n.getOption(75)+8,S=150,w=new at(150,b);super(n,w);this._configurationService=g,this._accessibilityService=p,this._keybindingService=f,this._hover=this._register(new Gg(!0)),this._onDidResize=this._register(new r),this.onDidResize=this._onDidResize.event,this._onDidScroll=this._register(new r),this.onDidScroll=this._onDidScroll.event,this._onContentsChanged=this._register(new r),this.onContentsChanged=this._onContentsChanged.event,this._minimumSize=w,this._hoverVisibleKey=o.hoverVisible.bindTo(h),this._hoverFocusedKey=o.hoverFocused.bindTo(h),k(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{if(this.isVisible)this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration((I)=>{if(I.hasChanged(59))this._updateFont()}));let x=this._register(wi(this._resizableNode.domNode));this._register(x.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(x.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll((I)=>{this._onDidScroll.fire(I)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return Ko.ID}static _applyDimensions(n,h,g){let p=typeof h==="number"?`${h}px`:h,f=typeof g==="number"?`${g}px`:g;n.style.width=p,n.style.height=f}_setContentsDomNodeDimensions(n,h){let g=this._hover.contentsDomNode;return Ko._applyDimensions(g,n,h)}_setContainerDomNodeDimensions(n,h){let g=this._hover.containerDomNode;return Ko._applyDimensions(g,n,h)}_setScrollableElementDimensions(n,h){let g=this._hover.scrollbar.getDomNode();return Ko._applyDimensions(g,n,h)}_setHoverWidgetDimensions(n,h){this._setContainerDomNodeDimensions(n,h),this._setScrollableElementDimensions(n,h),this._setContentsDomNodeDimensions(n,h),this._layoutContentWidget()}static _applyMaxDimensions(n,h,g){let p=typeof h==="number"?`${h}px`:h,f=typeof g==="number"?`${g}px`:g;n.style.maxWidth=p,n.style.maxHeight=f}_setHoverWidgetMaxDimensions(n,h){Ko._applyMaxDimensions(this._hover.contentsDomNode,n,h),Ko._applyMaxDimensions(this._hover.scrollbar.getDomNode(),n,h),Ko._applyMaxDimensions(this._hover.containerDomNode,n,h),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof n==="number"?`${n}px`:n),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(n){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(n.width,n.height)}_updateResizableNodeMaxDimensions(){let n=this._findMaximumRenderingWidth()??1/0,h=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new at(n,h),this._setHoverWidgetMaxDimensions(n,h)}_resize(n){Ko._lastDimensions=new at(n.width,n.height),this._setAdjustedHoverWidgetDimensions(n),this._resizableNode.layout(n.height,n.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){let n=this._renderedHover?.showAtPosition;if(!n)return;return this._positionPreference===1?this._availableVerticalSpaceAbove(n):this._availableVerticalSpaceBelow(n)}_findMaximumRenderingHeight(){let n=this._findAvailableSpaceVertically();if(!n)return;let g=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach((p)=>{g+=p.clientHeight}),Math.min(n,g)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");let n=Array.from(this._hover.contentsDomNode.children).some((h)=>h.scrollWidth>h.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),n}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;let n=this._isHoverTextOverflowing(),h=typeof this._contentWidth>"u"?0:this._contentWidth;if(n||this._hover.containerDomNode.clientWidth<h){let g=ga(this._hover.containerDomNode.ownerDocument.body).width,p=14;return g-14}else return this._hover.containerDomNode.clientWidth}isMouseGettingCloser(n,h){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=n,this._renderedHover.initialMousePosY=h,!1;let g=kt(this.getDomNode());if(this._renderedHover.closestMouseDistance===void 0)this._renderedHover.closestMouseDistance=ML(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,g.left,g.top,g.width,g.height);let p=ML(n,h,g.left,g.top,g.width,g.height);if(p>this._renderedHover.closestMouseDistance+4)return!1;return this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,p),!0}_setRenderedHover(n){this._renderedHover?.dispose(),this._renderedHover=n,this._hoverVisibleKey.set(!!n),this._hover.containerDomNode.classList.toggle("hidden",!n)}_updateFont(){let{fontSize:n,lineHeight:h}=this._editor.getOption(59),g=this._hover.contentsDomNode;g.style.fontSize=`${n}px`,g.style.lineHeight=`${h/n}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((f)=>this._editor.applyFontInfo(f))}_updateContent(n){let h=this._hover.contentsDomNode;h.style.paddingBottom="",h.textContent="",h.appendChild(n)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){let n=Math.max(this._editor.getLayoutInfo().height/4,250,Ko._lastDimensions.height),h=Math.max(this._editor.getLayoutInfo().width*0.66,750,Ko._lastDimensions.width);this._resizableNode.maxSize=new at(h,n),this._setHoverWidgetMaxDimensions(h,n)}_render(n){this._setRenderedHover(n),this._updateFont(),this._updateContent(n.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){if(!this._renderedHover)return null;return{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}}show(n){if(!this._editor||!this._editor.hasModel())return;this._render(n);let h=Nl(this._hover.containerDomNode),g=n.showAtPosition;if(this._positionPreference=this._findPositionPreference(h,g)??1,this.handleContentsChanged(),n.shouldFocus)this._hover.containerDomNode.focus();this._onDidResize.fire();let f=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&Lk(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");if(f)this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+f}hide(){if(!this._renderedHover)return;let n=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();if(this._setRenderedHover(void 0),this._resizableNode.maxSize=new at(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),n)this._editor.focus()}_removeConstraintsRenderNormally(){let n=this._editor.getLayoutInfo();this._resizableNode.layout(n.height,n.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(n){this._minimumSize=new at(Math.max(this._minimumSize.width,n.width),Math.max(this._minimumSize.height,n.height)),this._updateMinimumWidth()}_updateMinimumWidth(){let n=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new at(n,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();let n=this._hover.contentsDomNode,h=Nl(n),g=Pr(n)+2;if(this._resizableNode.layout(h,g),this._setHoverWidgetDimensions(g,h),h=Nl(n),g=Pr(n),this._contentWidth=g,this._updateMinimumWidth(),this._resizableNode.layout(h,g),this._renderedHover?.showAtPosition){let p=Nl(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(p,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){let n=this._hover.scrollbar.getScrollPosition().scrollTop,h=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:n-h.lineHeight})}scrollDown(){let n=this._hover.scrollbar.getScrollPosition().scrollTop,h=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:n+h.lineHeight})}scrollLeft(){let n=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:n-OL})}scrollRight(){let n=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:n+OL})}pageUp(){let n=this._hover.scrollbar.getScrollPosition().scrollTop,h=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:n-h})}pageDown(){let n=this._hover.scrollbar.getScrollPosition().scrollTop,h=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:n+h})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}};Op=Ko=uT([Np(1,K),Np(2,oe),Np(3,on),Np(4,ge)],Op);function ML(u,n,h,g,p,f){let b=h+p/2,S=g+f/2,w=Math.max(Math.abs(u-b)-p/2,0),x=Math.max(Math.abs(n-S)-f/2,0);return Math.sqrt(w*w+x*x)}class mh{constructor(u,n){this._editor=u,this._participants=n}static _getLineDecorations(u,n){if(n.type!==1&&!n.supportsMarkerHover)return[];let h=u.getModel(),g=n.range.startLineNumber;if(g>h.getLineCount())return[];let p=h.getLineMaxColumn(g);return u.getLineDecorations(g).filter((f)=>{if(f.options.isWholeLine)return!0;let b=f.range.startLineNumber===g?f.range.startColumn:1,S=f.range.endLineNumber===g?f.range.endColumn:p;if(f.options.showIfCollapsed){if(b>n.range.startColumn+1||n.range.endColumn-1>S)return!1}else if(b>n.range.startColumn||n.range.endColumn>S)return!1;return!0})}computeAsync(u,n){let h=u.anchor;if(!this._editor.hasModel()||!h)return ri.EMPTY;let g=mh._getLineDecorations(this._editor,h);return ri.merge(this._participants.map((p)=>{if(!p.computeAsync)return ri.EMPTY;return p.computeAsync(h,g,u.source,n)}))}computeSync(u){if(!this._editor.hasModel())return[];let n=u.anchor,h=mh._getLineDecorations(this._editor,n),g=[];for(let p of this._participants)g=g.concat(p.computeSync(n,h,u.source));return wr(g)}}class Mp{constructor(u,n,h){this.hoverParts=u,this.isComplete=n,this.options=h}filter(u){let n=this.hoverParts.filter((h)=>h.isValidForHoverAnchor(u));if(n.length===this.hoverParts.length)return this;return new PL(this,n,this.isComplete,this.options)}}class PL extends Mp{constructor(u,n,h,g){super(n,h,g);this.original=u}filter(u){return this.original.filter(u)}}var gT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},AL=function(u,n){return function(h,g){n(h,g,u)}},FL=_,cv=class u extends i{get hasContent(){return this._hasContent}constructor(n,h){super();this._keybindingService=n,this._hoverService=h,this.actions=[],this._hasContent=!1,this.hoverElement=FL("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=k(this.hoverElement,FL("div.actions"))}addAction(n){let h=this._keybindingService.lookupKeybinding(n.commandId),g=h?h.getLabel():null;this._hasContent=!0;let p=this._register(Zf.render(this.actionsElement,n,g));return this._register(this._hoverService.setupManagedHover(bo("element"),p.actionContainer,p.actionRenderedLabel)),this.actions.push(p),p}append(n){let h=k(this.actionsElement,n);return this._hasContent=!0,h}};cv=gT([AL(0,ge),AL(1,An)],cv);var pT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},HL=function(u,n){return function(h,g){n(h,g,u)}},Pp=class u extends i{constructor(n,h,g,p){super();this._container=n,this._getContent=h,this._clipboardService=g,this._hoverService=p,this._container.classList.add("hover-row-with-copy"),this._button=this._register(new yr({label:e(1186,"Copy"),icon:C.copy,onTrigger:()=>this._copyContent(),className:"hover-copy-button"},this._hoverService)),this._container.appendChild(this._button.domNode)}async _copyContent(){let n=this._getContent();if(n)await this._clipboardService.writeText(n),Br(e(1187,"Copied to clipboard"))}};Pp=pT([HL(2,xi),HL(3,An)],Pp);class WL{constructor(u,n,h){this.provider=u,this.hover=n,this.ordinal=h}}async function mT(u,n,h,g,p){let f=await Promise.resolve(u.provideHover(h,g,p)).catch(vt);if(!f||!fT(f))return;return new WL(u,f,n)}function fh(u,n,h,g,p=!1){let b=u.ordered(n,p).map((S,w)=>mT(S,w,n,h,g));return ri.fromPromisesResolveOrder(b).coalesce()}async function BL(u,n,h,g,p=!1){let f=[];for await(let b of fh(u,n,h,g,p))f.push(b.hover);return f}Fr("_executeHoverProvider",(u,n,h)=>{let g=u.get(V);return BL(g.hoverProvider,n,h,xe.None)});Fr("_executeHoverProvider_recursive",(u,n,h)=>{let g=u.get(V);return BL(g.hoverProvider,n,h,xe.None,!0)});function fT(u){let n=typeof u.range<"u",h=typeof u.contents<"u"&&u.contents&&u.contents.length>0;return n&&h}var _T=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ll=function(u,n){return function(h,g){n(h,g,u)}},td=_,bT=Mt("hover-increase-verbosity",C.addSmall,e(1188,"Icon for increaseing hover verbosity.")),vT=Mt("hover-decrease-verbosity",C.removeSmall,e(1189,"Icon for decreasing hover verbosity."));class eo{constructor(u,n,h,g,p,f=void 0){this.owner=u,this.range=n,this.contents=h,this.isBeforeContent=g,this.ordinal=p,this.source=f}isValidForHoverAnchor(u){return u.type===1&&this.range.startColumn<=u.range.startColumn&&this.range.endColumn>=u.range.endColumn}}class Yb{constructor(u,n,h){this.hover=u,this.hoverProvider=n,this.hoverPosition=h}supportsVerbosityAction(u){switch(u){case gs.Increase:return this.hover.canIncreaseVerbosity??!1;case gs.Decrease:return this.hover.canDecreaseVerbosity??!1}}}var qs=class u{constructor(n,h,g,p,f,b,S){this._editor=n,this._markdownRendererService=h,this._configurationService=g,this._languageFeaturesService=p,this._keybindingService=f,this._hoverService=b,this._commandService=S,this.hoverOrdinal=3}createLoadingMessage(n){return new eo(this,n.range,[new Pn().appendText(e(1190,"Loading..."))],!1,2000)}computeSync(n,h){if(!this._editor.hasModel()||n.type!==1)return[];let g=this._editor.getModel(),p=n.range.startLineNumber,f=g.getLineMaxColumn(p),b=[],S=1000,w=g.getLineLength(p),x=g.getLanguageIdAtPosition(n.range.startLineNumber,n.range.startColumn),I=this._editor.getOption(133),E=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:x}),Z=this._editor.getOption(69).showLongLineWarning,X=!1;if(I>=0&&w>I&&n.range.startColumn>=I){if(X=!0,Z)b.push(new eo(this,n.range,[{value:e(1191,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`. [Don't Show Again](command:{0})",oh),isTrusted:!0}],!1,S++))}if(!X&&typeof E==="number"&&w>=E){if(Z)b.push(new eo(this,n.range,[{value:e(1192,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`. [Don't Show Again](command:{0})",oh),isTrusted:!0}],!1,S++))}let J=!1;for(let Q of h){let te=Q.range.startLineNumber===p?Q.range.startColumn:1,re=Q.range.endLineNumber===p?Q.range.endColumn:f,le=Q.options.hoverMessage;if(!le||lp(le))continue;if(Q.options.beforeContentClassName)J=!0;let pe=new t(n.range.startLineNumber,te,n.range.startLineNumber,re);b.push(new eo(this,pe,pv(le),J,S++))}return b}computeAsync(n,h,g,p){if(!this._editor.hasModel()||n.type!==1)return ri.EMPTY;let f=this._editor.getModel(),b=this._languageFeaturesService.hoverProvider;if(!b.has(f))return ri.EMPTY;return this._getMarkdownHovers(b,f,n,p)}async*_getMarkdownHovers(n,h,g,p){let f=g.range.getStartPosition(),b=fh(n,h,f,p);for await(let S of b)if(!lp(S.hover.contents)){let w=S.hover.range?t.lift(S.hover.range):g.range,x=new Yb(S.hover,S.provider,f);yield new eo(this,w,S.hover.contents,!1,S.ordinal,x)}}renderHoverParts(n,h){return this._renderedHoverParts=new VL(h,n.fragment,this,this._editor,this._commandService,this._keybindingService,this._hoverService,this._configurationService,this._markdownRendererService,n.onContentsChanged),this._renderedHoverParts}handleScroll(n){this._renderedHoverParts?.handleScroll(n)}getAccessibleContent(n){return this._renderedHoverParts?.getAccessibleContent(n)??""}updateMarkdownHoverVerbosityLevel(n,h){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(n,h))}};qs=_T([ll(1,Wr),ll(2,oe),ll(3,V),ll(4,ge),ll(5,An),ll(6,Ue)],qs);class _h{constructor(u,n,h,g){this.hoverPart=u,this.hoverElement=n,this.disposables=h,this.actionsContainer=g}dispose(){this.disposables.dispose()}}class VL{constructor(u,n,h,g,p,f,b,S,w,x){this._hoverParticipant=h,this._editor=g,this._commandService=p,this._keybindingService=f,this._hoverService=b,this._configurationService=S,this._markdownRendererService=w,this._onFinishedRendering=x,this._ongoingHoverOperations=new Map,this._disposables=new d,this.renderedHoverParts=this._renderHoverParts(u,n,this._onFinishedRendering),this._disposables.add(D(()=>{this.renderedHoverParts.forEach((I)=>{I.dispose()}),this._ongoingHoverOperations.forEach((I)=>{I.tokenSource.dispose(!0)})}))}_renderHoverParts(u,n,h){return u.sort(Bn((g)=>g.ordinal,Ui)),u.map((g)=>{let p=this._renderHoverPart(g,h);return n.appendChild(p.hoverElement),p})}_renderHoverPart(u,n){let h=this._renderMarkdownHover(u,n),g=h.hoverElement,p=u.source,f=new d;if(f.add(h),!p)return new _h(u,g,f);let b=p.supportsVerbosityAction(gs.Increase),S=p.supportsVerbosityAction(gs.Decrease);if(!b&&!S)return new _h(u,g,f);let w=td("div.verbosity-actions");g.prepend(w);let x=td("div.verbosity-actions-inner");return w.append(x),f.add(this._renderHoverExpansionAction(x,gs.Increase,b)),f.add(this._renderHoverExpansionAction(x,gs.Decrease,S)),new _h(u,g,f,x)}_renderMarkdownHover(u,n){return zL(this._editor,u,this._markdownRendererService,n)}_renderHoverExpansionAction(u,n,h){let g=new d,p=n===gs.Increase,f=k(u,td(Y.asCSSSelector(p?bT:vT)));f.tabIndex=0;let b=g.add(new Su("mouse",void 0,{target:u,position:{hoverPosition:0}},this._configurationService,this._hoverService));if(g.add(this._hoverService.setupManagedHover(b,f,ST(this._keybindingService,n))),!h)return f.classList.add("disabled"),g;f.classList.add("enabled");let S=()=>this._commandService.executeCommand(n===gs.Increase?Ha:Wa,{focus:!0});return g.add(new Rk(f,S)),g.add(new Ik(f,S,[3,10])),g}handleScroll(u){this.renderedHoverParts.forEach((n)=>{let h=n.actionsContainer;if(!h)return;let g=n.hoverElement,f=u.scrollTop+u.height,{offsetTop:b,clientHeight:S}=g,w=b+S,x=22,I;if(w<=f||b>=f)I=S-x;else I=f-b-x;h.style.top=`${I}px`})}async updateMarkdownHoverPartVerbosityLevel(u,n){let h=this._editor.getModel();if(!h)return;let g=this._getRenderedHoverPartAtIndex(n),p=g?.hoverPart.source;if(!g||!p?.supportsVerbosityAction(u))return;let f=await this._fetchHover(p,h,u);if(!f)return;let b=new Yb(f,p.hoverProvider,p.hoverPosition),S=g.hoverPart,w=new eo(this._hoverParticipant,S.range,f.contents,S.isBeforeContent,S.ordinal,b),x=this._updateRenderedHoverPart(n,w);if(!x)return;return{hoverPart:w,hoverElement:x.hoverElement}}getAccessibleContent(u){let n=this.renderedHoverParts.findIndex((f)=>f.hoverPart===u);if(n===-1)return;let h=this._getRenderedHoverPartAtIndex(n);if(!h)return;return h.hoverElement.innerText.replace(/[^\S\n\r]+/gu," ")}async _fetchHover(u,n,h){let g=h===gs.Increase?1:-1,p=u.hoverProvider,f=this._ongoingHoverOperations.get(p);if(f)f.tokenSource.cancel(),g+=f.verbosityDelta;let b=new Je;this._ongoingHoverOperations.set(p,{verbosityDelta:g,tokenSource:b});let S={verbosityRequest:{verbosityDelta:g,previousHover:u.hover}},w;try{w=await Promise.resolve(p.provideHover(n,u.hoverPosition,b.token,S))}catch(x){vt(x)}return b.dispose(),this._ongoingHoverOperations.delete(p),w}_updateRenderedHoverPart(u,n){if(u>=this.renderedHoverParts.length||u<0)return;let h=this._renderHoverPart(n,this._onFinishedRendering),g=this.renderedHoverParts[u],p=g.hoverElement,f=h.hoverElement,b=Array.from(f.children);p.replaceChildren(...b);let S=new _h(n,p,h.disposables,h.actionsContainer);return g.dispose(),this.renderedHoverParts[u]=S,S}_getRenderedHoverPartAtIndex(u){return this.renderedHoverParts[u]}dispose(){this._disposables.dispose()}}function KL(u,n,h,g){n.sort(Bn((f)=>f.ordinal,Ui));let p=[];for(let f of n){let b=zL(h,f,g,u.onContentsChanged);u.fragment.appendChild(b.hoverElement),p.push(b)}return new xo(p)}function zL(u,n,h,g){let p=new d,f=td("div.hover-row"),b=td("div.hover-row-contents");f.appendChild(b);let S=n.contents;for(let x of S){if(lp(x))continue;let I=td("div.markdown-hover"),E=k(I,td("div.hover-contents")),Z=p.add(h.render(x,{context:u,asyncRenderCallback:()=>{E.className="hover-contents code-hover-contents",g()}}));E.appendChild(Z.element),b.appendChild(I)}return{hoverPart:n,hoverElement:f,dispose(){p.dispose()}}}function ST(u,n){switch(n){case gs.Increase:return u.appendKeybinding(e(1193,"Increase Hover Verbosity"),Ha);case gs.Decrease:return u.appendKeybinding(e(1194,"Decrease Hover Verbosity"),Wa)}}var UL=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Jb=function(u,n){return function(h,g){n(h,g,u)}},xg=class u{constructor(n){this._editorWorkerService=n}async provideDocumentColors(n,h){return this._editorWorkerService.computeDefaultDocumentColors(n.uri)}provideColorPresentations(n,h,g){let{range:p,color:f}=h,b=new v(new N(Math.round(255*f.red),Math.round(255*f.green),Math.round(255*f.blue),f.alpha)),S=v.Format.CSS.formatRGB(b),w=v.Format.CSS.formatHSL(b),x=v.Format.CSS.formatHexA(b,!0),I=[];return I.push({label:S,textEdit:{range:p,text:S}}),I.push({label:w,textEdit:{range:p,text:w}}),I.push({label:x,textEdit:{range:p,text:x}}),I}};xg=UL([Jb(0,Mi)],xg);var q1=class u extends i{constructor(n,h){super();this._register(n.colorProvider.register("*",new xg(h)))}};q1=UL([Jb(0,V),Jb(1,Mi)],q1);async function J1(u,n,h,g="auto"){return K1(new $L,u,n,h,g)}function Qb(u,n,h,g){return Promise.resolve(h.provideColorPresentations(u,n,g))}class $L{constructor(){}async compute(u,n,h,g){let p=await u.provideDocumentColors(n,h);if(Array.isArray(p))for(let f of p)g.push({colorInfo:f,provider:u});return Array.isArray(p)}}class LI{constructor(){}async compute(u,n,h,g){let p=await u.provideDocumentColors(n,h);if(Array.isArray(p))for(let f of p)g.push({range:f.range,color:[f.color.red,f.color.green,f.color.blue,f.color.alpha]});return Array.isArray(p)}}class RI{constructor(u){this.colorInfo=u}async compute(u,n,h,g){let p=await u.provideColorPresentations(n,this.colorInfo,xe.None);if(Array.isArray(p))g.push(...p);return Array.isArray(p)}}async function K1(u,n,h,g,p){let f=!1,b,S=[],w=n.ordered(h);for(let x=w.length-1;x>=0;x--){let I=w[x];if(p!=="always"&&I instanceof xg)b=I;else try{if(await u.compute(I,h,g,S))f=!0}catch(E){vt(E)}}if(f)return S;if(b&&p!=="never")return await u.compute(b,h,g,S),S;return[]}function II(u,n){let{colorProvider:h}=u.get(V),g=u.get(Et).getModel(n);if(!g)throw xr();let p=u.get(oe).getValue("editor.defaultColorDecorators",{resource:n});return{model:g,colorProviderRegistry:h,defaultColorDecoratorsEnablement:p}}var wT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ev=function(u,n){return function(h,g){n(h,g,u)}},id,tv=Object.create({}),Wh=class u extends i{static{id=this}static{this.ID="editor.contrib.colorDetector"}static{this.RECOMPUTE_TIME=1000}static{this.colorDecoratorInnerWidthInEm=0.8}static{this.colorDecoratorMarginInEm=0.2}constructor(n,h,g,p){super();this._editor=n,this._configurationService=h,this._languageFeaturesService=g,this._localToDispose=this._register(new d),this._decorationsIds=[],this._colorDatas=new Map,this._decoratorLimitReporter=this._register(new jL),this._colorDecorationClassRefs=this._register(new d),this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new Ov(this._editor));let f=this._editor.getContainerDomNode();f.style.setProperty("--vscode-colorPicker-colorDecoratorWidth",`${id.colorDecoratorInnerWidthInEm}em`),f.style.setProperty("--vscode-colorPicker-colorDecoratorMargin",`${id.colorDecoratorMarginInEm}em`),this._register(D(()=>{f.style.removeProperty("--vscode-colorPicker-colorDecoratorWidth"),f.style.removeProperty("--vscode-colorPicker-colorDecoratorMargin")})),this._debounceInformation=p.for(g.colorProvider,"Document Colors",{min:id.RECOMPUTE_TIME}),this._register(n.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(n.onDidChangeModelLanguage(()=>this.updateColors())),this._register(g.colorProvider.onDidChange(()=>this.updateColors())),this._register(n.onDidChangeConfiguration((b)=>{let S=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(168);let w=S!==this._isColorDecoratorsEnabled||b.hasChanged(27),x=b.hasChanged(168);if(w||x)if(this._isColorDecoratorsEnabled)this.updateColors();else this.removeAllDecorations()})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(168),this.updateColors()}isEnabled(){let n=this._editor.getModel();if(!n)return!1;let h=n.getLanguageId(),g=this._configurationService.getValue(h);if(g&&typeof g==="object"){let p=g.colorDecorators;if(p&&p.enable!==void 0&&!p.enable)return p.enable}return this._editor.getOption(26)}static get(n){return n.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled){this.removeAllDecorations();return}let n=this._editor.getModel();if(!n||!this._languageFeaturesService.colorProvider.has(n))return;this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{if(!this._timeoutTimer)this._timeoutTimer=new di,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(n))})),this.beginCompute()}async beginCompute(){this._computePromise=Zt(async(n)=>{let h=this._editor.getModel();if(!h)return[];let g=new dn(!1),p=await J1(this._languageFeaturesService.colorProvider,h,n,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(h,g.elapsed()),p});try{let n=await this._computePromise;this.updateDecorations(n),this.updateColorDecorators(n),this._computePromise=null}catch(n){ee(n)}}stop(){if(this._timeoutTimer)this._timeoutTimer.cancel(),this._timeoutTimer=null;if(this._computePromise)this._computePromise.cancel(),this._computePromise=null;this._localToDispose.clear()}updateDecorations(n){let h=n.map((g)=>({range:{startLineNumber:g.colorInfo.range.startLineNumber,startColumn:g.colorInfo.range.startColumn,endLineNumber:g.colorInfo.range.endLineNumber,endColumn:g.colorInfo.range.endColumn},options:ue.EMPTY}));this._editor.changeDecorations((g)=>{this._decorationsIds=g.deltaDecorations(this._decorationsIds,h),this._colorDatas=new Map,this._decorationsIds.forEach((p,f)=>this._colorDatas.set(p,n[f]))})}updateColorDecorators(n){this._colorDecorationClassRefs.clear();let h=[],g=id.colorDecoratorInnerWidthInEm+2*id.colorDecoratorMarginInEm,p=this._editor.getOption(27);for(let b=0;b<n.length&&h.length<p;b++){let{red:S,green:w,blue:x,alpha:I}=n[b].colorInfo.color,E=new N(Math.round(S*255),Math.round(w*255),Math.round(x*255),I),Z=`rgba(${E.r}, ${E.g}, ${E.b}, ${E.a})`,X=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:Z}));h.push({range:{startLineNumber:n[b].colorInfo.range.startLineNumber,startColumn:n[b].colorInfo.range.startColumn,endLineNumber:n[b].colorInfo.range.endLineNumber,endColumn:n[b].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:ok,inlineClassName:`${X.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:tv,widthInEm:g}}})}let f=p<n.length?p:!1;this._decoratorLimitReporter.update(n.length,f),this._colorDecoratorIds.set(h)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(n){let h=this._editor.getModel();if(!h)return null;let g=h.getDecorationsInRange(t.fromPositions(n,n)).filter((p)=>this._colorDatas.has(p.id));if(g.length===0)return null;return this._colorDatas.get(g[0].id)}isColorDecoration(n){return this._colorDecoratorIds.has(n)}};Wh=id=wT([ev(1,oe),ev(2,V),ev(3,ur)],Wh);class jL extends i{constructor(){super(...arguments);this._onDidChange=this._register(new r),this._computed=0,this._limited=!1}update(u,n){if(u!==this._computed||n!==this._limited)this._computed=u,this._limited=n,this._onDidChange.fire()}}var GL=_;class iv extends i{constructor(u,n,h){super();this.model=n,this.pixelRatio=h,this._onDidChange=this._register(new r),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new r),this.onColorFlushed=this._onColorFlushed.event,this._domNode=GL(".saturation-wrap"),k(u,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",k(this._domNode,this._canvas),this.selection=GL(".saturation-selection"),k(this._domNode,this.selection),this.layout(),this._register(c(this._domNode,T.POINTER_DOWN,(g)=>this.onPointerDown(g))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(u){if(!u.target||!(u.target instanceof Element))return;this.monitor=this._register(new Pl);let n=kt(this._domNode);if(u.target!==this.selection)this.onDidChangePosition(u.offsetX,u.offsetY);this.monitor.startMonitoring(u.target,u.pointerId,u.buttons,(g)=>this.onDidChangePosition(g.pageX-n.left,g.pageY-n.top),()=>null);let h=c(u.target.ownerDocument,T.POINTER_UP,()=>{if(this._onColorFlushed.fire(),h.dispose(),this.monitor)this.monitor.stopMonitoring(!0),this.monitor=null},!0)}onDidChangePosition(u,n){let h=Math.max(0,Math.min(1,u/this.width)),g=Math.max(0,Math.min(1,1-n/this.height));this.paintSelection(h,g),this._onDidChange.fire({s:h,v:g})}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 u=this.model.color.hsva;this.paintSelection(u.s,u.v)}paint(){let u=this.model.color.hsva,n=new v(new Sc(u.h,1,1,1)),h=this._canvas.getContext("2d"),g=h.createLinearGradient(0,0,this._canvas.width,0);g.addColorStop(0,"rgba(255, 255, 255, 1)"),g.addColorStop(0.5,"rgba(255, 255, 255, 0.5)"),g.addColorStop(1,"rgba(255, 255, 255, 0)");let p=h.createLinearGradient(0,0,0,this._canvas.height);p.addColorStop(0,"rgba(0, 0, 0, 0)"),p.addColorStop(1,"rgba(0, 0, 0, 1)"),h.rect(0,0,this._canvas.width,this._canvas.height),h.fillStyle=v.Format.CSS.format(n),h.fill(),h.fillStyle=g,h.fill(),h.fillStyle=p,h.fill()}paintSelection(u,n){this.selection.style.left=`${u*this.width}px`,this.selection.style.top=`${this.height-n*this.height}px`}onDidChangeColor(u){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();let n=u.hsva;this.paintSelection(n.s,n.v)}}class ov extends i{constructor(u){super();this._onClicked=this._register(new r),this.onClicked=this._onClicked.event,this._button=k(u,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(c(this._button,T.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}var bh=_;class nv extends i{constructor(u,n,h){super();if(this.model=n,this._onDidChange=this._register(new r),this.onDidChange=this._onDidChange.event,this._onColorFlushed=this._register(new r),this.onColorFlushed=this._onColorFlushed.event,h==="standalone")this.domNode=k(u,bh(".standalone-strip")),this.overlay=k(this.domNode,bh(".standalone-overlay"));else this.domNode=k(u,bh(".strip")),this.overlay=k(this.domNode,bh(".overlay"));this.slider=k(this.domNode,bh(".slider")),this.slider.style.top="0px",this._register(c(this.domNode,T.POINTER_DOWN,(g)=>this.onPointerDown(g))),this._register(n.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;let u=this.getValue(this.model.color);this.updateSliderPosition(u)}onDidChangeColor(u){let n=this.getValue(u);this.updateSliderPosition(n)}onPointerDown(u){if(!u.target||!(u.target instanceof Element))return;let n=this._register(new Pl),h=kt(this.domNode);if(this.domNode.classList.add("grabbing"),u.target!==this.slider)this.onDidChangeTop(u.offsetY);n.startMonitoring(u.target,u.pointerId,u.buttons,(p)=>this.onDidChangeTop(p.pageY-h.top),()=>null);let g=c(u.target.ownerDocument,T.POINTER_UP,()=>{this._onColorFlushed.fire(),g.dispose(),n.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(u){let n=Math.max(0,Math.min(1,1-u/this.height));this.updateSliderPosition(n),this._onDidChange.fire(n)}updateSliderPosition(u){this.slider.style.top=`${(1-u)*this.height}px`}}class rv extends nv{constructor(u,n,h){super(u,n,h);this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(u){super.onDidChangeColor(u);let{r:n,g:h,b:g}=u.rgba,p=new v(new N(n,h,g,1)),f=new v(new N(n,h,g,0));this.overlay.style.background=`linear-gradient(to bottom, ${p} 0%, ${f} 100%)`}getValue(u){return u.hsva.a}}class gv extends nv{constructor(u,n,h){super(u,n,h);this.domNode.classList.add("hue-strip")}getValue(u){return 1-u.hsva.h/360}}var CT=_;class xv extends i{constructor(u,n,h,g){super();if(this.model=n,this.pixelRatio=h,this._insertButton=null,this._domNode=CT(".colorpicker-body"),k(u,this._domNode),this._saturationBox=new iv(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 rv(this._domNode,this.model,g),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new gv(this._domNode,this.model,g),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),g==="standalone")this._insertButton=this._register(new ov(this._domNode)),this._domNode.classList.add("standalone-colorpicker")}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:u,v:n}){let h=this.model.color.hsva;this.model.color=new v(new Sc(h.h,u,n,h.a))}onDidOpacityChange(u){let n=this.model.color.hsva;this.model.color=new v(new Sc(n.h,n.s,n.v,u))}onDidHueChange(u){let n=this.model.color.hsva,h=(1-u)*360;this.model.color=new v(new Sc(h===360?0:h,n.s,n.v,n.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()}}var yT=_;class $v extends i{constructor(u){super();this._onClicked=this._register(new r),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),k(u,this._button);let n=document.createElement("div");n.classList.add("close-button-inner-div"),k(this._button,n),k(n,yT(".button"+Y.asCSSSelector(Mt("color-picker-close",C.close,e(936,"Icon to close the color picker"))))).classList.add("close-icon"),this._register(c(this._button,T.CLICK,()=>{this._onClicked.fire()}))}}var Ap=_;class Xv extends i{constructor(u,n,h,g){super();this.model=n,this.type=g,this._closeButton=null,this._domNode=Ap(".colorpicker-header"),k(u,this._domNode),this._pickedColorNode=k(this._domNode,Ap(".picked-color")),k(this._pickedColorNode,Ap("span.codicon.codicon-color-mode")),this._pickedColorPresentation=k(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");let p=e(937,"Click to toggle color options (rgb/hsl/hex)");if(this._pickedColorNode.setAttribute("title",p),this._originalColorNode=k(this._domNode,Ap(".original-color")),this._originalColorNode.style.backgroundColor=v.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=h.getColorTheme().getColor(Hg)||v.white,this._register(h.onDidColorThemeChange((f)=>{this.backgroundColor=f.getColor(Hg)||v.white})),this._register(c(this._pickedColorNode,T.CLICK,()=>this.model.selectNextColorPresentation())),this._register(c(this._originalColorNode,T.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(n.onDidChangeColor(this.onDidChangeColor,this)),this._register(n.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=v.Format.CSS.format(n.color)||"",this._pickedColorNode.classList.toggle("light",n.color.rgba.a<0.5?this.backgroundColor.isLighter():n.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone")this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new $v(this._domNode))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(u){this._pickedColorNode.style.backgroundColor=v.Format.CSS.format(u)||"",this._pickedColorNode.classList.toggle("light",u.rgba.a<0.5?this.backgroundColor.isLighter():u.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}var xT=_;class z_ extends Ei{constructor(u,n,h,g,p){super();this.model=n,this.pixelRatio=h,this._register(Df.getInstance(B(u)).onDidChange(()=>this.layout())),this._domNode=xT(".colorpicker-widget"),u.appendChild(this._domNode),this.header=this._register(new Xv(this._domNode,this.model,g,p)),this.body=this._register(new xv(this._domNode,this.model,this.pixelRatio,p))}layout(){this.body.layout()}get domNode(){return this._domNode}}class Jv extends i{get color(){return this._color}set color(u){if(this._color.equals(u))return;this._color=u,this._onDidChangeColor.fire(u)}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(u){if(this._colorPresentations=u,this.presentationIndex>u.length-1)this.presentationIndex=0;this._onDidChangePresentation.fire(this.presentation)}constructor(u,n,h){super();this.presentationIndex=h,this._onColorFlushed=this._register(new r),this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=this._register(new r),this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=this._register(new r),this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=u,this._color=u,this._colorPresentations=n}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(u,n){let h=-1;for(let g=0;g<this.colorPresentations.length;g++)if(n.toLowerCase()===this.colorPresentations[g].label){h=g;break}if(h===-1){let g=n.split("(")[0].toLowerCase();for(let p=0;p<this.colorPresentations.length;p++)if(this.colorPresentations[p].label.toLowerCase().startsWith(g)){h=p;break}}if(h!==-1&&h!==this.presentationIndex)this.presentationIndex=h,this._onDidChangePresentation.fire(this.presentation)}flushColor(){this._onColorFlushed.fire(this._color)}}async function G1(u,n,h){let g=u.getValueInRange(n.range),{red:p,green:f,blue:b,alpha:S}=n.color,w=new N(Math.round(p*255),Math.round(f*255),Math.round(b*255),S),x=new v(w),I=await Qb(u,n,h,xe.None),E=new Jv(x,[],0);return E.colorPresentations=I||[],E.guessColorPresentation(x,g),{range:t.lift(n.range),model:E,provider:h}}function Y1(u,n,h,g){let p=[],f=h.presentation.textEdit??{range:n,text:h.presentation.label,forceMoveMarkers:!1};if(h.presentation.additionalTextEdits)p.push(...h.presentation.additionalTextEdits);let b=t.lift(f.range),S=u.getModel()._setTrackedRange(null,b,3);if(g)p.push(...g.map((w)=>({range:w,text:f.text,forceMoveMarkers:!1})));else p.push(f);return u.executeEdits("colorpicker",p),u.pushUndoStop(),u.getModel()._getTrackedRange(S)??b}async function _g(u,n,h,g,p){let f=await Qb(u,{range:g,color:{red:h.rgba.r/255,green:h.rgba.g/255,blue:h.rgba.b/255,alpha:h.rgba.a}},p.provider,xe.None);n.colorPresentations=f||[]}var IT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},LT=function(u,n){return function(h,g){n(h,g,u)}};class cl{constructor(u,n,h,g){this.owner=u,this.range=n,this.model=h,this.provider=g,this.forceShowAtRange=!0}isValidForHoverAnchor(u){return u.type===1&&this.range.startColumn<=u.range.startColumn&&this.range.endColumn>=u.range.endColumn}static fromBaseColor(u,n){return new cl(u,n.range,n.model,n.provider)}}var dv=class u{constructor(n,h){this._editor=n,this._themeService=h,this.hoverOrdinal=2}computeSync(n,h,g){return[]}computeAsync(n,h,g,p){return ri.fromPromise(this._computeAsync(n,h,g))}async _computeAsync(n,h,g){if(!this._editor.hasModel())return[];if(!this._isValidRequest(g))return[];let p=Wh.get(this._editor);if(!p)return[];for(let f of h){if(!p.isColorDecoration(f))continue;let b=p.getColorData(f.range.getStartPosition());if(b)return[cl.fromBaseColor(this,await G1(this._editor.getModel(),b.colorInfo,b.provider))]}return[]}_isValidRequest(n){let h=this._editor.getOption(169);switch(n){case 0:return h==="hover"||h==="clickAndHover";case 1:return h==="click"||h==="clickAndHover";case 2:return!0}}renderHoverParts(n,h){let g=this._editor;if(h.length===0||!g.hasModel())return new xo([]);let p=g.getOption(75)+8;n.setMinimumDimensions(new at(302,p));let f=new d,b=h[0],S=g.getModel(),w=b.model;this._colorPicker=f.add(new z_(n.fragment,w,g.getOption(164),this._themeService,"hover"));let x=!1,I=new t(b.range.startLineNumber,b.range.startColumn,b.range.endLineNumber,b.range.endColumn);f.add(w.onColorFlushed(async(Z)=>{await _g(S,w,Z,I,b),x=!0,I=Y1(g,I,w)})),f.add(w.onDidChangeColor((Z)=>{_g(S,w,Z,I,b)})),f.add(g.onDidChangeModelContent((Z)=>{if(x)x=!1;else n.hide(),g.focus()}));let E={hoverPart:cl.fromBaseColor(this,b),hoverElement:this._colorPicker.domNode,dispose(){f.dispose()}};return new xo([E])}getAccessibleContent(n){return e(938,"There is a color picker here.")}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};dv=IT([LT(1,We)],dv);class Fp{constructor(u,n){this.range=u,this.direction=n}}class Qv{constructor(u,n,h){this.hint=u,this.anchor=n,this.provider=h,this._isResolved=!1}with(u){let n=new Qv(this.hint,u.anchor,this.provider);return n._isResolved=this._isResolved,n._currentResolve=this._currentResolve,n}async resolve(u){if(typeof this.provider.resolveInlayHint!=="function")return;if(this._currentResolve){if(await this._currentResolve,u.isCancellationRequested)return;return this.resolve(u)}if(!this._isResolved)this._currentResolve=this._doResolve(u).finally(()=>this._currentResolve=void 0);await this._currentResolve}async _doResolve(u){try{let n=await Promise.resolve(this.provider.resolveInlayHint(this.hint,u));this.hint.tooltip=n?.tooltip??this.hint.tooltip,this.hint.label=n?.label??this.hint.label,this.hint.textEdits=n?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(n){vt(n),this._isResolved=!1}}}class od{static{this._emptyInlayHintList=Object.freeze({dispose(){},hints:[]})}static async create(u,n,h,g){let p=[],f=u.ordered(n).reverse().map((b)=>h.map(async(S)=>{try{let w=await b.provideInlayHints(n,S,g);if(w?.hints.length||b.onDidChangeInlayHints)p.push([w??od._emptyInlayHintList,b])}catch(w){vt(w)}}));if(await Promise.all(f.flat()),g.isCancellationRequested||n.isDisposed())throw new Io;return new od(h,p,n)}constructor(u,n,h){this._disposables=new d,this.ranges=u,this.provider=new Set;let g=[];for(let[p,f]of n){this._disposables.add(p),this.provider.add(f);for(let b of p.hints){let S=h.validatePosition(b.position),w="before",x=od._getRangeAtPosition(h,S),I;if(x.getStartPosition().isBefore(S))I=t.fromPositions(x.getStartPosition(),S),w="after";else I=t.fromPositions(S,x.getEndPosition()),w="before";g.push(new Qv(b,new Fp(I,w),f))}}this.items=g.sort((p,f)=>s.compare(p.hint.position,f.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(u,n){let h=n.lineNumber,g=u.getWordAtPosition(n);if(g)return new t(h,g.startColumn,h,g.endColumn);u.tokenization.tokenizeIfCheap(h);let p=u.tokenization.getLineTokens(h),f=n.column-1,b=p.findTokenIndexAtOffset(f),S=p.getStartOffset(b),w=p.getEndOffset(b);if(w-S===1){if(S===f&&b>1)S=p.getStartOffset(b-1),w=p.getEndOffset(b-1);else if(w===f&&b<p.getCount()-1)S=p.getStartOffset(b+1),w=p.getEndOffset(b+1)}return new t(h,S+1,h,w+1)}}function qL(u){return Dk(u.id,...u.arguments??[]).toString()}async function ZL(u,n,h,g){let p=u.get(Nn),f=u.get(Qn),b=u.get(Ue),S=u.get(O),w=u.get(wt);if(await g.item.resolve(xe.None),!g.part.location)return;let x=g.part.location,I=[],E=new Set(Zn.getMenuItems(l.EditorContext).map((X)=>Of(X)?X.command.id:jl()));for(let X of Wi.all())if(E.has(X.desc.id))I.push(new _r(X.desc.id,Gi.label(X.desc,{renderShortTitle:!0}),void 0,!0,async()=>{let J=await p.createModelReference(x.uri);try{let Q=new ja(J.object.textEditorModel,t.getStartPosition(x.range)),te=g.item.anchor.range;await S.invokeFunction(X.runEditorCommand.bind(X),n,Q,te)}finally{J.dispose()}}));if(g.part.command){let{command:X}=g.part;I.push(new ut),I.push(new _r(X.id,X.title,void 0,!0,async()=>{try{await b.executeCommand(X.id,...X.arguments??[])}catch(J){w.notify({severity:Tc.Error,source:g.item.provider.displayName,message:J})}}))}let Z=n.getOption(144);f.showContextMenu({domForShadowRoot:Z?n.getDomNode()??void 0:void 0,getAnchor:()=>{let X=kt(h);return{x:X.left,y:X.top+X.height+8}},getActions:()=>I,onHide:()=>{n.focus()},autoSelectFirstItem:!0})}async function Hp(u,n,h,g){let f=await u.get(Nn).createModelReference(g.uri);await h.invokeWithinContext(async(b)=>{let S=n.hasSideBySideModifier,w=b.get(K),x=gi.inPeekEditor.getValue(w),I=!S&&h.getOption(101)&&!x;return new Ks({openToSide:S,openInPeek:I,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(b,new ja(f.object.textEditorModel,t.getStartPosition(g.range)),t.lift(g.range))}),f.dispose()}var ET=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},hl=function(u,n){return function(h,g){n(h,g,u)}},ul;class Wp{constructor(){this._entries=new Yi(50)}get(u){let n=Wp._key(u);return this._entries.get(n)}set(u,n){let h=Wp._key(u);this._entries.set(h,n)}static _key(u){return`${u.uri.toString()}/${u.getVersionId()}`}}var XL=ie("IInlayHintsCache");_e(XL,Wp,1);class vh{constructor(u,n){this.item=u,this.index=n}get part(){let u=this.item.hint.label;if(typeof u==="string")return{label:u};else return u[this.index]}}class YL{constructor(u,n){this.part=u,this.hasTriggerModifier=n}}class JL{constructor(){this._store=new de,this._tokenSource=new Je}dispose(){this._store.dispose(),this._tokenSource.dispose(!0)}reset(){return this._tokenSource.dispose(!0),this._tokenSource=new Je,this._store.value=new d,{store:this._store.value,token:this._tokenSource.token}}}var Sg=class u{static{ul=this}static{this.ID="editor.contrib.InlayHints"}static{this._MAX_DECORATORS=1500}static{this._whitespaceData={}}static get(n){return n.getContribution(ul.ID)??void 0}constructor(n,h,g,p,f,b,S){this._editor=n,this._languageFeaturesService=h,this._inlayHintsCache=p,this._commandService=f,this._notificationService=b,this._instaService=S,this._disposables=new d,this._sessionDisposables=new d,this._decorationsMetadata=new Map,this._activeRenderMode=0,this._ruleFactory=this._disposables.add(new Ov(this._editor)),this._debounceInfo=g.for(h.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(h.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(n.onDidChangeModel(()=>this._update())),this._disposables.add(n.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(n.onDidChangeConfiguration((w)=>{if(w.hasChanged(159))this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();let n=this._editor.getOption(159);if(n.enabled==="off")return;let h=this._editor.getModel();if(!h||!this._languageFeaturesService.inlayHintsProvider.has(h))return;if(n.enabled==="on")this._activeRenderMode=0;else{let x,I;if(n.enabled==="onUnlessPressed")x=0,I=1;else x=1,I=0;this._activeRenderMode=x,this._sessionDisposables.add(Ja.getInstance().event((E)=>{if(!this._editor.hasModel())return;let Z=E.altKey&&E.ctrlKey&&!(E.shiftKey||E.metaKey)?I:x;if(Z!==this._activeRenderMode){this._activeRenderMode=Z;let X=this._editor.getModel(),J=this._copyInlayHintsWithCurrentAnchor(X);this._updateHintsDecorators([X.getFullModelRange()],J),S.schedule(0)}}))}let g=this._inlayHintsCache.get(h);if(g)this._updateHintsDecorators([h.getFullModelRange()],g);this._sessionDisposables.add(D(()=>{if(!h.isDisposed())this._cacheHintsForFastRestore(h)}));let p,f=new Set;this._sessionDisposables.add(h.onWillDispose(()=>p?.cancel()));let b=this._sessionDisposables.add(new JL),S=new ke(async()=>{let x=Date.now(),{store:I,token:E}=b.reset();try{let Z=await od.create(this._languageFeaturesService.inlayHintsProvider,h,this._getHintsRanges(),E);if(S.delay=this._debounceInfo.update(h,Date.now()-x),E.isCancellationRequested){Z.dispose();return}for(let X of Z.provider)if(typeof X.onDidChangeInlayHints==="function"&&!f.has(X))f.add(X),I.add(X.onDidChangeInlayHints(()=>{if(!S.isScheduled())S.schedule()}));I.add(Z),I.add(D(()=>f.clear())),this._updateHintsDecorators(Z.ranges,Z.items),this._cacheHintsForFastRestore(h)}catch(Z){ee(Z)}},this._debounceInfo.get(h));this._sessionDisposables.add(S),S.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange((x)=>{if(x.scrollTopChanged||!S.isScheduled())S.schedule()}));let w=this._sessionDisposables.add(new de);this._sessionDisposables.add(this._editor.onDidChangeModelContent((x)=>{let I=Math.max(S.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+I},w.value=yi(()=>S.schedule(0),I),S.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration((x)=>{if(x.hasChanged(159))S.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>S.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){let n=new d,h=n.add(new Tr(this._editor)),g=new d;return n.add(g),n.add(h.onMouseMoveOrRelevantKeyDown((p)=>{let[f]=p,b=this._getInlayHintLabelPart(f),S=this._editor.getModel();if(!b||!S){g.clear();return}let w=new Je;g.add(D(()=>w.dispose(!0))),b.item.resolve(w.token),this._activeInlayHintPart=b.part.command||b.part.location?new YL(b,f.hasTriggerModifier):void 0;let x=S.validatePosition(b.item.hint.position).lineNumber,I=new t(x,1,x,S.getLineMaxColumn(x)),E=this._getInlineHintsForRange(I);this._updateHintsDecorators([I],E),g.add(D(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([I],E)}))})),n.add(h.onCancel(()=>g.clear())),n.add(h.onExecute(async(p)=>{let f=this._getInlayHintLabelPart(p);if(f){let b=f.part;if(b.location)this._instaService.invokeFunction(Hp,p,this._editor,b.location);else if(vv.is(b.command))await this._invokeCommand(b.command,f.item)}})),n}_getInlineHintsForRange(n){let h=new Set;for(let g of this._decorationsMetadata.values())if(n.containsRange(g.item.anchor.range))h.add(g.item);return Array.from(h)}_installDblClickGesture(n){return this._editor.onMouseUp(async(h)=>{if(h.event.detail!==2)return;let g=this._getInlayHintLabelPart(h);if(!g)return;if(h.event.preventDefault(),await g.item.resolve(xe.None),Kn(g.item.hint.textEdits)){let p=g.item.hint.textEdits.map((f)=>Yt.replace(t.lift(f.range),f.text));this._editor.executeEdits("inlayHint.default",p),n()}})}_installContextMenu(){return this._editor.onContextMenu(async(n)=>{if(!Le(n.event.target))return;let h=this._getInlayHintLabelPart(n);if(h)await this._instaService.invokeFunction(ZL,this._editor,n.event.target,h)})}_getInlayHintLabelPart(n){if(n.target.type!==6)return;let h=n.target.detail.injectedText?.options;if(h instanceof Sd&&h?.attachedData instanceof vh)return h.attachedData;return}async _invokeCommand(n,h){try{await this._commandService.executeCommand(n.id,...n.arguments??[])}catch(g){this._notificationService.notify({severity:Tc.Error,source:h.provider.displayName,message:g})}}_cacheHintsForFastRestore(n){let h=this._copyInlayHintsWithCurrentAnchor(n);this._inlayHintsCache.set(n,h)}_copyInlayHintsWithCurrentAnchor(n){let h=new Map;for(let[g,p]of this._decorationsMetadata){if(h.has(p.item))continue;let f=n.getDecorationRange(g);if(f){let b=new Fp(f,p.item.anchor.direction),S=p.item.with({anchor:b});h.set(p.item,S)}}return Array.from(h.values())}_getHintsRanges(){let h=this._editor.getModel(),g=this._editor.getVisibleRangesPlusViewportAboveBelow(),p=[];for(let f of g.sort(t.compareRangesUsingStarts)){let b=h.validateRange(new t(f.startLineNumber-30,f.startColumn,f.endLineNumber+30,f.endColumn));if(p.length===0||!t.areIntersectingOrTouching(p[p.length-1],b))p.push(b);else p[p.length-1]=t.plusRange(p[p.length-1],b)}return p}_updateHintsDecorators(n,h){let g=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&n.some((re)=>re.containsPosition(this._cursorInfo.position))){let{position:re}=this._cursorInfo;this._cursorInfo=void 0;let le=new Map;for(let ae of this._editor.getLineDecorations(re.lineNumber)??[]){let me=this._decorationsMetadata.get(ae.id);if(ae.range.startColumn>re.column)continue;let De=me?.decoration.options[me.item.anchor.direction];if(De&&De.attachedData!==ul._whitespaceData){let Oe=le.get(me.item)??0;le.set(me.item,Oe+De.content.length)}}let pe=h.filter((ae)=>ae.anchor.range.startLineNumber===re.lineNumber&&ae.anchor.range.endColumn<=re.column),Se=Array.from(le.values()),we;while(!0){let ae=pe.shift(),me=Se.shift();if(!me&&!ae)break;if(ae)g.set(ae,me??0),we=ae;else if(we&&me){let De=g.get(we);De+=me,De+=Se.reduce((Oe,Me)=>Oe+Me,0),Se.length=0;break}}}let{fontSize:p,fontFamily:f,padding:b,isUniform:S}=this._getLayoutInfo(),w=this._editor.getOption(61),x=[],I=(re,le,pe,Se,we,ae)=>{let me={content:pe,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:le.className,cursorStops:Se,attachedData:we,widthInEm:ae};x.push({item:re,classNameRef:le,decoration:{range:re.anchor.range,options:{description:"InlayHint",showIfCollapsed:re.anchor.range.isEmpty(),collapseOnReplaceEdit:!re.anchor.range.isEmpty(),stickiness:0,[re.anchor.direction]:this._activeRenderMode===0?me:void 0}}})},E=(re,le)=>{let pe=p/3|0,Se=pe/w,we=this._ruleFactory.createClassNameRef({width:`${pe}px`,display:"inline-block"});I(re,we,"",le?xs.Right:xs.None,ul._whitespaceData,Se)},Z=this._editor.getOption(159).maximumLength,X="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(X,f);let J={line:0,totalLen:0};for(let re=0;re<h.length;re++){let le=h[re];if(J.line!==le.anchor.range.startLineNumber)J={line:le.anchor.range.startLineNumber,totalLen:0};if(Z&&J.totalLen>Z)continue;if(le.hint.paddingLeft)E(le,!1);let pe=typeof le.hint.label==="string"?[{label:le.hint.label}]:le.hint.label,Se=g.get(le),we=0;for(let ae=0;ae<pe.length;ae++){let me=pe[ae],De=ae===0,Oe=ae===pe.length-1,Me={fontSize:`${p}px`,fontFamily:`var(${X}), ${Or.fontFamily}`,verticalAlign:S?"baseline":"middle",unicodeBidi:"isolate"};if(Kn(le.hint.textEdits))Me.cursor="default";if(this._fillInColors(Me,le.hint),(me.command||me.location)&&this._activeInlayHintPart?.part.item===le&&this._activeInlayHintPart.part.index===ae){if(Me.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier)Me.color=bn(_2),Me.cursor="pointer"}let Ce=me.label;J.totalLen+=Ce.length;let Pe=!1,tt=Z!==0?J.totalLen-Z:0;if(tt>0)Ce=Ce.slice(0,-tt)+"…",Pe=!0;if(we+=Ce.length,Se!==void 0){let ze=we-Se;if(ze>=0)we-=ze,Ce=Ce.slice(0,-(1+ze))+"…",Pe=!0}if(b)if(De&&(Oe||Pe))Me.padding=`1px ${Math.max(1,p/4)|0}px`,Me.borderRadius=`${p/4|0}px`;else if(De)Me.padding=`1px 0 1px ${Math.max(1,p/4)|0}px`,Me.borderRadius=`${p/4|0}px 0 0 ${p/4|0}px`;else if(Oe||Pe)Me.padding=`1px ${Math.max(1,p/4)|0}px 1px 0`,Me.borderRadius=`0 ${p/4|0}px ${p/4|0}px 0`;else Me.padding="1px 0 1px 0";if(I(le,this._ruleFactory.createClassNameRef(Me),DT(Ce),Oe&&!le.hint.paddingRight?xs.Right:xs.None,new vh(le,ae)),Pe)break}if(Se!==void 0&&we<Se){let ae=Se-we;I(le,this._ruleFactory.createClassNameRef({})," ".repeat(ae),xs.None)}if(le.hint.paddingRight)E(le,!0);if(x.length>ul._MAX_DECORATORS)break}let Q=[];for(let[re,le]of this._decorationsMetadata){let pe=this._editor.getModel()?.getDecorationRange(re);if(pe&&n.some((Se)=>Se.containsRange(pe)))Q.push(re),le.classNameRef.dispose(),this._decorationsMetadata.delete(re)}let te=rs.capture(this._editor);this._editor.changeDecorations((re)=>{let le=re.deltaDecorations(Q,x.map((pe)=>pe.decoration));for(let pe=0;pe<le.length;pe++){let Se=x[pe];this._decorationsMetadata.set(le[pe],Se)}}),te.restore(this._editor)}_fillInColors(n,h){if(h.kind===G_.Parameter)n.backgroundColor=bn(L2),n.color=bn($2);else if(h.kind===G_.Type)n.backgroundColor=bn(T2),n.color=bn(E2);else n.backgroundColor=bn(bk),n.color=bn(gk)}_getLayoutInfo(){let n=this._editor.getOption(159),h=n.padding,g=this._editor.getOption(61),p=this._editor.getOption(58),f=n.fontSize;if(!f||f<5||f>g)f=g;let b=n.fontFamily||p;return{fontSize:f,fontFamily:b,padding:h,isUniform:!h&&b===p&&f===g}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(let n of this._decorationsMetadata.values())n.classNameRef.dispose();this._decorationsMetadata.clear()}};Sg=ul=ET([hl(1,V),hl(2,ur),hl(3,XL),hl(4,Ue),hl(5,wt),hl(6,O)],Sg);function DT(u){return u.replace(/[ \t]/g," ")}$e.registerCommand("_executeInlayHintProvider",async(u,...n)=>{let[h,g]=n;He(q.isUri(h)),He(t.isIRange(g));let{inlayHintsProvider:p}=u.get(V),f=await u.get(Nn).createModelReference(h);try{let b=await od.create(p,f.object.textEditorModel,[t.lift(g)],xe.None),S=b.items.map((w)=>w.hint);return setTimeout(()=>b.dispose(),0),S}finally{f.dispose()}});var RT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},nd=function(u,n){return function(h,g){n(h,g,u)}};class eS extends Gs{constructor(u,n,h,g){super(10,n,u.item.anchor.range,h,g,!0);this.part=u}}var uv=class u extends qs{constructor(n,h,g,p,f,b,S,w){super(n,h,f,S,g,p,w);this._resolverService=b,this.hoverOrdinal=6}suggestHoverAnchor(n){if(!Sg.get(this._editor))return null;if(n.target.type!==6)return null;let g=n.target.detail.injectedText?.options;if(!(g instanceof Sd&&g.attachedData instanceof vh))return null;return new eS(g.attachedData,this,n.event.posx,n.event.posy)}computeSync(){return[]}computeAsync(n,h,g,p){if(!(n instanceof eS))return ri.EMPTY;return new ri(async(f)=>{let{part:b}=n;if(await b.item.resolve(p),p.isCancellationRequested)return;let S;if(typeof b.item.hint.tooltip==="string")S=new Pn().appendText(b.item.hint.tooltip);else if(b.item.hint.tooltip)S=b.item.hint.tooltip;if(S)f.emitOne(new eo(this,n.range,[S],!1,0));if(Kn(b.item.hint.textEdits))f.emitOne(new eo(this,n.range,[new Pn().appendText(e(1220,"Double-click to insert"))],!1,10001));let w;if(typeof b.part.tooltip==="string")w=new Pn().appendText(b.part.tooltip);else if(b.part.tooltip)w=b.part.tooltip;if(w)f.emitOne(new eo(this,n.range,[w],!1,1));if(b.part.location||b.part.command){let I,Z=this._editor.getOption(86)==="altKey"?ye?e(1221,"cmd + click"):e(1222,"ctrl + click"):ye?e(1223,"option + click"):e(1224,"alt + click");if(b.part.location&&b.part.command)I=new Pn().appendText(e(1225,"Go to Definition ({0}), right click for more",Z));else if(b.part.location)I=new Pn().appendText(e(1226,"Go to Definition ({0})",Z));else if(b.part.command)I=new Pn(`[${e(1227,"Execute Command")}](${qL(b.part.command)} "${b.part.command.title}") (${Z})`,{isTrusted:!0});if(I)f.emitOne(new eo(this,n.range,[I],!1,1e4))}let x=this._resolveInlayHintLabelPartHover(b,p);for await(let I of x)f.emitOne(I)})}async*_resolveInlayHintLabelPartHover(n,h){if(!n.part.location)return;let{uri:g,range:p}=n.part.location,f=await this._resolverService.createModelReference(g);try{let b=f.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(b))return;for await(let S of fh(this._languageFeaturesService.hoverProvider,b,new s(p.startLineNumber,p.startColumn),h))if(!lp(S.hover.contents))yield new eo(this,n.item.anchor.range,S.hover.contents,!1,2+S.ordinal)}finally{f.dispose()}}};uv=RT([nd(1,Wr),nd(2,ge),nd(3,An),nd(4,oe),nd(5,Nn),nd(6,V),nd(7,Ue)],uv);var QL=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},gl=function(u,n){return function(h,g){n(h,g,u)}},tS,iS,Bp=tS=class u extends i{constructor(n,h,g,p,f,b,S){super();let w=h.hoverParts;this._renderedHoverParts=this._register(new oS(n,g,w,p,f,b,S));let x=h.options,I=x.anchor,{showAtPosition:E,showAtSecondaryPosition:Z}=tS.computeHoverPositions(n,I.range,w);this.shouldAppearBeforeContent=w.some((X)=>X.isBeforeContent),this.showAtPosition=E,this.showAtSecondaryPosition=Z,this.initialMousePosX=I.initialMousePosX,this.initialMousePosY=I.initialMousePosY,this.shouldFocus=x.shouldFocus,this.source=x.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(n){this._renderedHoverParts.focusHoverPartWithIndex(n)}async updateHoverVerbosityLevel(n,h,g){this._renderedHoverParts.updateHoverVerbosityLevel(n,h,g)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(n,h,g){let p=1;if(n.hasModel()){let I=n._getViewModel(),E=I.coordinatesConverter,Z=E.convertModelRangeToViewRange(h),X=I.getLineMinColumn(Z.startLineNumber),J=new s(Z.startLineNumber,X);p=E.convertViewPositionToModelPosition(J).column}let{startLineNumber:f,startColumn:b}=h,S;for(let I of g){let E=I.range,Z=E.startLineNumber===f,X=E.endLineNumber===f;if(Z&&X){let Q=E.startColumn,te=Math.min(b,Q);b=Math.max(te,p)}if(I.forceShowAtRange)S=E}let w,x;if(S){let I=S.getStartPosition();w=I,x=I}else w=h.getStartPosition(),x=new s(f,b);return{showAtPosition:w,showAtSecondaryPosition:x}}};Bp=tS=QL([gl(4,ge),gl(5,An),gl(6,xi)],Bp);class iE{constructor(u,n){this._statusBar=n,u.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}var oS=class u extends i{static{iS=this}static{this._DECORATION_OPTIONS=ue.register({description:"content-hover-highlight",className:"hoverHighlight"})}constructor(n,h,g,p,f,b,S){super();this._hoverService=b,this._clipboardService=S,this._renderedParts=[],this._perPartDisposables=new Map,this._focusedHoverPartIndex=-1,this._context=p,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(h,g,p,f,this._hoverService)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(n,g)),this._updateMarkdownAndColorParticipantInfo(h)}_createEditorDecorations(n,h){if(h.length===0)return i.None;let g=h[0].range;for(let f of h){let b=f.range;g=t.plusRange(g,b)}let p=n.createDecorationsCollection();return p.set([{range:g,options:iS._DECORATION_OPTIONS}]),D(()=>{p.clear()})}_renderParts(n,h,g,p,f){let b=new cv(p,f),S={fragment:this._fragment,statusBar:b,...g},w=new d;w.add(b);for(let I of n){let E=this._renderHoverPartsForParticipant(h,I,S);w.add(E);for(let Z of E.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:I,hoverPart:Z.hoverPart,hoverElement:Z.hoverElement})}let x=this._renderStatusBar(this._fragment,b);if(x)w.add(x),this._renderedParts.push({type:"statusBar",hoverElement:x.hoverElement,actions:x.actions});return w}_renderHoverPartsForParticipant(n,h,g){let p=n.filter((b)=>b.owner===h);if(!(p.length>0))return new xo([]);return h.renderHoverParts(g,p)}_renderStatusBar(n,h){if(!h.hasContent)return;return new iE(n,h)}_registerListenersOnRenderedParts(){return this._renderedParts.forEach((n,h)=>{this._createListenersForPart(h,n)}),D(()=>{for(let n of this._perPartDisposables.values())n.dispose();this._perPartDisposables.clear()})}_createListenersForPart(n,h){let g=new d,p=h.hoverElement;if(p.tabIndex=0,g.add(c(p,T.FOCUS_IN,(f)=>{f.stopPropagation(),this._focusedHoverPartIndex=n})),g.add(c(p,T.FOCUS_OUT,(f)=>{f.stopPropagation(),this._focusedHoverPartIndex=-1})),h.type==="hoverPart"&&!(h.hoverPart instanceof cl)&&!h.participant.hideCopyButton)g.add(new Pp(p,()=>h.participant.getAccessibleContent(h.hoverPart),this._clipboardService,this._hoverService));this._perPartDisposables.set(n,g)}_updateMarkdownAndColorParticipantInfo(n){let h=n.find((g)=>g instanceof qs&&!(g instanceof uv));if(h)this._markdownHoverParticipant=h;this._colorHoverParticipant=n.find((g)=>g instanceof dv)}focusHoverPartWithIndex(n){if(n<0||n>=this._renderedParts.length)return;this._renderedParts[n].hoverElement.focus()}async updateHoverVerbosityLevel(n,h,g){if(!this._markdownHoverParticipant)return;let p;if(h>=0)p={start:h,endExclusive:h+1};else p=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let f=p.start;f<p.endExclusive;f++){let b=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,f);if(b===void 0)continue;let S=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(n,b);if(!S)continue;let w=this._perPartDisposables.get(f);if(w)w.dispose(),this._perPartDisposables.delete(f);this._renderedParts[f]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:S.hoverPart,hoverElement:S.hoverElement},this._createListenersForPart(f,this._renderedParts[f])}if(g)if(h>=0)this.focusHoverPartWithIndex(h);else this._context.focus();this._context.onContentsChanged()}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(n,h){let g=this._renderedParts[h];if(!g||g.type!=="hoverPart")return;if(g.participant!==n)return;let f=this._renderedParts.findIndex((b)=>b.type==="hoverPart"&&b.participant===n);if(f===-1)throw new H;return h-f}_findRangeOfMarkdownHoverParts(n){let h=this._renderedParts.slice(),g=h.findIndex((b)=>b.type==="hoverPart"&&b.participant===n),p=h.reverse().findIndex((b)=>b.type==="hoverPart"&&b.participant===n),f=p>=0?h.length-p:p;return{start:g,endExclusive:f+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}};oS=iS=QL([gl(4,ge),gl(5,An),gl(6,xi)],oS);var kT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Vp=function(u,n){return function(h,g){n(h,g,u)}},Kp=class u extends i{constructor(n,h,g,p,f){super();this._editor=n,this._instantiationService=h,this._keybindingService=g,this._hoverService=p,this._clipboardService=f,this._currentResult=null,this._renderedContentHover=this._register(new de),this._onContentsChanged=this._register(new r),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(Op,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new gh(this._editor,new mh(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){let n=[];for(let h of El.getAll()){let g=this._instantiationService.createInstance(h,this._editor);n.push(g)}return n.sort((h,g)=>h.hoverOrdinal-g.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach((h)=>h.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll((h)=>{this._participants.forEach((g)=>g.handleScroll?.(h))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach((h)=>h.handleContentsChanged?.())})),n}_registerListeners(){this._register(this._hoverOperation.onResult((h)=>{let g=h.hasLoadingMessage?this._addLoadingMessage(h):h.value;this._withResult(new Mp(g,h.isComplete,h.options))}));let n=this._contentHoverWidget.getDomNode();this._register(Ct(n,"keydown",(h)=>{if(h.equals(9))this.hide()})),this._register(Ct(n,"mouseleave",(h)=>{this._onMouseLeave(h)})),this._register(qt.onDidChange(()=>{if(this._contentHoverWidget.position&&this._currentResult)this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(n,h,g,p,f){if(!(this._contentHoverWidget.position&&this._currentResult)){if(n)return this._startHoverOperationIfNecessary(n,h,g,p,!1),!0;return!1}let S=this._editor.getOption(69).sticky,w=f&&this._contentHoverWidget.isMouseGettingCloser(f.event.posx,f.event.posy);if(S&&w){if(n)this._startHoverOperationIfNecessary(n,h,g,p,!0);return!0}if(!n)return this._setCurrentResult(null),!1;if(this._currentResult&&this._currentResult.options.anchor.equals(n))return!0;if(!(this._currentResult&&n.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)))return this._setCurrentResult(null),this._startHoverOperationIfNecessary(n,h,g,p,!1),!0;if(this._currentResult)this._setCurrentResult(this._currentResult.filter(n));return this._startHoverOperationIfNecessary(n,h,g,p,!1),!0}_startHoverOperationIfNecessary(n,h,g,p,f){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(n))return;this._hoverOperation.cancel();let S={anchor:n,source:g,shouldFocus:p,insistOnKeepingHoverVisible:f};this._hoverOperation.start(h,S)}_setCurrentResult(n){let h=n;if(this._currentResult===h)return;if(h&&h.hoverParts.length===0)h=null;if(this._currentResult=h,this._currentResult)this._showHover(this._currentResult);else this._hideHover()}_addLoadingMessage(n){for(let h of this._participants){if(!h.createLoadingMessage)continue;let g=h.createLoadingMessage(n.options.anchor);if(!g)continue;return n.value.slice(0).concat([g])}return n.value}_withResult(n){if(!(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete))this._setCurrentResult(n);if(!n.isComplete)return;let p=n.hoverParts.length===0,f=n.options.insistOnKeepingHoverVisible;if(p&&f)return;this._setCurrentResult(n)}_showHover(n){let h=this._getHoverContext();if(this._renderedContentHover.value=new Bp(this._editor,n,this._participants,h,this._keybindingService,this._hoverService,this._clipboardService),this._renderedContentHover.value.domNodeHasChildren)this._contentHoverWidget.show(this._renderedContentHover.value);else this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach((n)=>n.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:(f)=>{this._contentHoverWidget.setMinimumDimensions(f)},focus:()=>this.focus()}}showsOrWillShow(n){if(this._contentHoverWidget.isResizing)return!0;if(this._isMouseOnCodeActionWidget(n))return!0;let g=this._findHoverAnchorCandidates(n);if(!(g.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,n);let f=g[0];return this._startShowingOrUpdateHover(f,0,0,!1,n)}_findHoverAnchorCandidates(n){let h=[];for(let p of this._participants){if(!p.suggestHoverAnchor)continue;let f=p.suggestHoverAnchor(n);if(!f)continue;h.push(f)}let g=n.target;switch(g.type){case 6:{h.push(new ph(0,g.range,n.event.posx,n.event.posy));break}case 7:{let p=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!g.detail.isAfterLines&&typeof g.detail.horizontalDistanceToText==="number"&&g.detail.horizontalDistanceToText<p))break;h.push(new ph(0,g.range,n.event.posx,n.event.posy));break}}return h.sort((p,f)=>f.priority-p.priority),h}_isMouseOnCodeActionWidget(n){let h=n.event.browserEvent.target;if(h instanceof Element&&!!h.closest(".action-widget"))return!0;return!1}_onMouseLeave(n){let h=this._editor.getDomNode();if(!h||!$s(h,n.x,n.y))this.hide()}startShowingAtRange(n,h,g,p){this._startShowingOrUpdateHover(new ph(0,n,void 0,void 0),h,g,p,null)}async updateHoverVerbosityLevel(n,h,g){this._renderedContentHover.value?.updateHoverVerbosityLevel(n,h,g)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(n){return n?this._contentHoverWidget.getDomNode().contains(n):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(n){this._renderedContentHover.value?.focusHoverPartWithIndex(n)}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}};Kp=kT([Vp(1,O),Vp(2,ge),Vp(3,An),Vp(4,xi)],Kp);function Z1(u){let n=u.target;return!!n&&n.type===6&&n.detail.injectedText?.options.attachedData===tv}var TT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},nS=function(u,n){return function(h,g){n(h,g,u)}},rS,Nr=class u extends i{static{rS=this}static{this.ID="editor.contrib.contentHover"}constructor(n,h,g,p){super();this._editor=n,this._instantiationService=g,this._keybindingService=p,this._onHoverContentsChanged=this._register(new r),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new d,this._isMouseDown=!1,this._ignoreMouseEvents=!1,this._reactToEditorMouseMoveRunner=this._register(new ke(()=>{if(this._mouseMoveEvent)this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(h.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(h.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration((f)=>{if(f.hasChanged(69))this._unhookListeners(),this._hookListeners()}))}static get(n){return n.getContribution(rS.ID)}_hookListeners(){let n=this._editor.getOption(69);if(this._hoverSettings={enabled:n.enabled,sticky:n.sticky,hidingDelay:n.hidingDelay},n.enabled==="off")this._cancelSchedulerAndHide();this._listenersStore.add(this._editor.onMouseDown((h)=>this._onEditorMouseDown(h))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove((h)=>this._onEditorMouseMove(h))),this._listenersStore.add(this._editor.onKeyDown((h)=>this._onKeyDown(h))),this._listenersStore.add(this._editor.onMouseLeave((h)=>this._onEditorMouseLeave(h))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange((h)=>this._onEditorScrollChanged(h)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(n){if(this._ignoreMouseEvents)return;if(n.scrollTopChanged||n.scrollLeftChanged)this.hideContentHover()}_onEditorMouseDown(n){if(this._ignoreMouseEvents)return;if(this._isMouseDown=!0,this._shouldKeepHoverWidgetVisible(n))return;this.hideContentHover()}_shouldKeepHoverWidgetVisible(n){return this._isMouseOnContentHoverWidget(n)||this._isContentWidgetResizing()||Z1(n)}_isMouseOnContentHoverWidget(n){if(!this._contentWidget||!this._contentWidget.getDomNode().isConnected)return!1;return $s(this._contentWidget.getDomNode(),n.event.posx,n.event.posy)}_onEditorMouseUp(){if(this._ignoreMouseEvents)return;this._isMouseDown=!1}_onEditorMouseLeave(n){if(this._ignoreMouseEvents)return;if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._cancelScheduler(),this._shouldKeepHoverWidgetVisible(n))return;this.hideContentHover()}_shouldKeepCurrentHover(n){let h=this._contentWidget;if(!h)return!1;let g=this._hoverSettings.sticky,p=(I,E)=>{let Z=this._isMouseOnContentHoverWidget(I);return E&&Z},f=(I)=>{let E=h.isColorPickerVisible,Z=this._isMouseOnContentHoverWidget(I),X=E&&Z,J=E&&this._isMouseDown;return X||J},b=(I,E)=>{let Z=I.event.browserEvent.view;if(!Z)return!1;return E&&h.containsNode(Z.document.activeElement)&&!Z.getSelection()?.isCollapsed},{isFocused:S,isResizing:w}=h,x=this._hoverSettings.sticky&&h.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||S||w||x||p(n,g)||f(n)||b(n,g)}_onEditorMouseMove(n){if(this._ignoreMouseEvents)return;if(this._isMouseDown&&!this._shouldKeepHoverWidgetVisible(n)){this._cancelSchedulerAndHide();return}if(this._mouseMoveEvent=n,this._shouldKeepCurrentHover(n)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){if(!this._reactToEditorMouseMoveRunner.isScheduled())this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(n)}_shouldRescheduleHoverComputation(){let n=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&n>0}_reactToEditorMouseMove(n){if(kp(this._hoverSettings.enabled,this._editor.getOption(86),n)){if(this._getOrCreateContentWidget().showsOrWillShow(n))return}this.hideContentHover()}_onKeyDown(n){if(this._ignoreMouseEvents||!this._contentWidget)return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&uh(this._editor.getOption(86),n)&&this._mouseMoveEvent){if(!this._contentWidget.isVisible)this._contentWidget.showsOrWillShow(this._mouseMoveEvent);return}let h=this._isPotentialKeyboardShortcut(n),g=qh(n.keyCode);if(h||g)return;if(this._contentWidget.isFocused&&n.keyCode===2)return;this.hideContentHover()}_isPotentialKeyboardShortcut(n){if(!this._editor.hasModel()||!this._contentWidget)return!1;let h=this._keybindingService.softDispatch(n,this._editor.getDomNode()),g=h.kind===1,p=h.kind===2&&(h.commandId===pp||h.commandId===Ha||h.commandId===Wa)&&this._contentWidget.isVisible;return g||p}hideContentHover(){if(zr.dropDownVisible)return;this._contentWidget?.hide()}_getOrCreateContentWidget(){if(!this._contentWidget)this._contentWidget=this._instantiationService.createInstance(Kp,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()));return this._contentWidget}showContentHover(n,h,g,p){this._getOrCreateContentWidget().startShowingAtRange(n,h,g,p)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(n,h,g){this._getOrCreateContentWidget().updateHoverVerbosityLevel(n,h,g)}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()}};Nr=rS=TT([nS(1,Qn),nS(2,O),nS(3,ge)],Nr);var _n;(function(u){u.NoAutoFocus="noAutoFocus",u.FocusIfVisible="focusIfVisible",u.AutoFocusImmediately="autoFocusImmediately"})(_n||(_n={}));class sS extends U{constructor(){super({id:pp,label:y(1165,"Show or Focus Hover"),metadata:{description:y(1166,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[_n.NoAutoFocus,_n.FocusIfVisible,_n.AutoFocusImmediately],enumDescriptions:[e(1162,"The hover will not automatically take focus."),e(1163,"The hover will take focus only if it is already visible."),e(1164,"The hover will automatically take focus when it appears.")],default:_n.FocusIfVisible}}}}]},precondition:void 0,kbOpts:{kbExpr:o.editorTextFocus,primary:un(2089,2087),weight:100}})}run(u,n,h){if(!n.hasModel())return;let g=Nr.get(n);if(!g)return;let p=h?.focus,f=_n.FocusIfVisible;if(Object.values(_n).includes(p))f=p;else if(typeof p==="boolean"&&p)f=_n.AutoFocusImmediately;let b=(w)=>{let x=n.getPosition(),I=new t(x.lineNumber,x.column,x.lineNumber,x.column);g.showContentHover(I,1,2,w)},S=n.getOption(2)===2;if(g.isHoverVisible)if(f!==_n.NoAutoFocus)g.focus();else b(S);else b(S||f===_n.AutoFocusImmediately)}}class aS extends U{constructor(){super({id:hL,label:y(1167,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:y(1168,"Show the definition preview hover in the editor.")}})}run(u,n){let h=Nr.get(n);if(!h)return;let g=n.getPosition();if(!g)return;let p=new t(g.lineNumber,g.column,g.lineNumber,g.column),f=al.get(n);if(!f)return;f.startFindDefinitionFromCursor(g).then(()=>{h.showContentHover(p,1,2,!0)})}}class dS extends U{constructor(){super({id:uL,label:y(1169,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(u,n){Nr.get(n)?.hideContentHover()}}class lS extends U{constructor(){super({id:gL,label:y(1170,"Scroll Up Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:16,weight:100},metadata:{description:y(1171,"Scroll up the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.scrollUp()}}class cS extends U{constructor(){super({id:pL,label:y(1172,"Scroll Down Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:18,weight:100},metadata:{description:y(1173,"Scroll down the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.scrollDown()}}class hS extends U{constructor(){super({id:mL,label:y(1174,"Scroll Left Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:15,weight:100},metadata:{description:y(1175,"Scroll left the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.scrollLeft()}}class uS extends U{constructor(){super({id:fL,label:y(1176,"Scroll Right Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:17,weight:100},metadata:{description:y(1177,"Scroll right the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.scrollRight()}}class gS extends U{constructor(){super({id:_L,label:y(1178,"Page Up Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:y(1179,"Page up the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.pageUp()}}class pS extends U{constructor(){super({id:bL,label:y(1180,"Page Down Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:y(1181,"Page down the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.pageDown()}}class mS extends U{constructor(){super({id:vL,label:y(1182,"Go To Top Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:y(1183,"Go to the top of the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.goToTop()}}class fS extends U{constructor(){super({id:SL,label:y(1184,"Go To Bottom Hover"),precondition:o.hoverFocused,kbOpts:{kbExpr:o.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:y(1185,"Go to the bottom of the editor hover.")}})}run(u,n){let h=Nr.get(n);if(!h)return;h.goToBottom()}}class _S extends U{constructor(){super({id:Ha,label:wL,alias:"Increase Hover Verbosity Level",precondition:o.hoverVisible})}run(u,n,h){let g=Nr.get(n);if(!g)return;let p=h?.index!==void 0?h.index:g.focusedHoverPartIndex();g.updateHoverVerbosityLevel(gs.Increase,p,h?.focus)}}class bS extends U{constructor(){super({id:Wa,label:CL,alias:"Decrease Hover Verbosity Level",precondition:o.hoverVisible})}run(u,n,h){let g=Nr.get(n);if(!g)return;let p=h?.index!==void 0?h.index:g.focusedHoverPartIndex();Nr.get(n)?.updateHoverVerbosityLevel(gs.Decrease,p,h?.focus)}}var NT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Sh=function(u,n){return function(h,g){n(h,g,u)}},zo=_;class nE{constructor(u,n,h){this.owner=u,this.range=n,this.marker=h}isValidForHoverAnchor(u){return u.type===1&&this.range.startColumn<=u.range.startColumn&&this.range.endColumn>=u.range.endColumn}}var oE={type:1,filter:{include:_t.QuickFix},triggerAction:pi.QuickFixHover},zp=class u{constructor(n,h,g,p,f,b){this._editor=n,this._markerDecorationsService=h,this._openerService=g,this._languageFeaturesService=p,this._menuService=f,this._contextKeyService=b,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(n,h){if(!this._editor.hasModel()||n.type!==1&&!n.supportsMarkerHover)return[];let g=this._editor.getModel(),p=n.range;if(!g.isValidRange(n.range))return[];let f=p.startLineNumber,b=g.getLineMaxColumn(f),S=[];for(let w of h){let x=w.range.startLineNumber===f?w.range.startColumn:1,I=w.range.endLineNumber===f?w.range.endColumn:b,E=this._markerDecorationsService.getMarker(g.uri,w);if(!E)continue;let Z=new t(n.range.startLineNumber,x,n.range.startLineNumber,I);S.push(new nE(this,Z,E))}return S}renderHoverParts(n,h){if(!h.length)return new xo([]);let g=[];h.forEach((b)=>{let S=this._renderMarkerHover(b);n.fragment.appendChild(S.hoverElement),g.push(S)});let p=h.length===1?h[0]:h.sort((b,S)=>sn.compare(b.marker.severity,S.marker.severity))[0],f=this._renderMarkerStatusbar(n,p);return new xo(g,f)}getAccessibleContent(n){let{marker:h}=n,g=Kn(h.relatedInformation)?h.relatedInformation.map((p)=>`${Pi(p.resource)}(${p.startLineNumber}, ${p.startColumn}): ${p.message}`).join(`
|
|
32
|
+
`):void 0;return[h.message,g].filter((p)=>!!p).join(`
|
|
33
|
+
`)}_renderMarkerHover(n){let h=new d,g=zo("div.hover-row"),p=k(g,zo("div.marker.hover-contents")),{source:f,message:b,code:S,relatedInformation:w}=n.marker;this._editor.applyFontInfo(p);let x=k(p,zo("span"));if(x.style.whiteSpace="pre-wrap",x.innerText=b,f||S)if(S&&typeof S!=="string"){let E=zo("span");if(f){let Q=k(E,zo("span"));Q.innerText=f}let Z=k(E,zo("a.code-link"));Z.setAttribute("href",S.target.toString(!0)),h.add(c(Z,"click",(Q)=>{this._openerService.open(S.target),Q.preventDefault(),Q.stopPropagation()}));let X=k(Z,zo("span"));X.innerText=S.value;let J=k(p,E);J.style.opacity="0.6",J.style.paddingLeft="6px"}else{let E=k(p,zo("span"));E.style.opacity="0.6",E.style.paddingLeft="6px",E.innerText=f&&S?`${f}(${S})`:f?f:`(${S})`}if(Kn(w))for(let{message:E,resource:Z,startLineNumber:X,startColumn:J}of w){let Q=k(p,zo("div"));Q.style.marginTop="8px";let te=k(Q,zo("a"));te.innerText=`${Pi(Z)}(${X}, ${J}): `,te.style.cursor="pointer",h.add(c(te,"click",(le)=>{if(le.stopPropagation(),le.preventDefault(),this._openerService){let pe={selection:{startLineNumber:X,startColumn:J}};this._openerService.open(Z,{fromUserGesture:!0,editorOptions:pe}).catch(ee)}}));let re=k(Q,zo("span"));re.innerText=E,this._editor.applyFontInfo(re)}return{hoverPart:n,hoverElement:g,dispose:()=>h.dispose()}}_renderMarkerStatusbar(n,h){let g=new d;if(h.marker.severity===sn.Error||h.marker.severity===sn.Warning||h.marker.severity===sn.Info){let b=Ls.get(this._editor);if(b)n.statusBar.addAction({label:e(1195,"View Problem"),commandId:Er.ID,run:()=>{n.hide(),b.showAtMarker(h.marker),this._editor.focus()}})}let p=[];for(let[,b]of this._menuService.getMenuActions(l.MarkerHoverStatusBar,this._contextKeyService))for(let S of b)if(S instanceof Gi&&S.enabled)p.push(S);let f=()=>{for(let b of p)n.statusBar.addAction({label:b.label,commandId:b.id,iconClass:b.class,run:()=>{n.hide(),this._editor.setSelection(t.lift(h.range)),b.run()}})};if(!this._editor.getOption(104)){let b=n.statusBar.append(zo("div"));if(this.recentMarkerCodeActionsInfo)if(O0.makeKey(this.recentMarkerCodeActionsInfo.marker)===O0.makeKey(h.marker)){if(!this.recentMarkerCodeActionsInfo.hasCodeActions){if(p.length===0)b.textContent=e(1196,"No quick fixes available")}}else this.recentMarkerCodeActionsInfo=void 0;let S=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?i.None:yi(()=>b.textContent=e(1197,"Checking for quick fixes..."),200,g);if(!b.textContent)b.textContent=String.fromCharCode(160);let w=this.getCodeActions(h.marker);g.add(D(()=>w.cancel())),w.then((x)=>{if(S.dispose(),this.recentMarkerCodeActionsInfo={marker:h.marker,hasCodeActions:x.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){if(x.dispose(),p.length===0)b.textContent=e(1198,"No quick fixes available");else b.style.display="none";f();return}b.style.display="none";let I=!1;g.add(D(()=>{if(!I)x.dispose()})),n.statusBar.addAction({label:e(1199,"Quick Fix..."),commandId:Rs,run:(Z)=>{I=!0;let X=tr.get(this._editor),J=kt(Z);X?.showCodeActions(oE,x,{x:J.left,y:J.top,width:J.width,height:J.height})}});let E=x.validActions.find((Z)=>Z.action.isAI);if(E)n.statusBar.addAction({label:E.action.title,commandId:E.action.command?.id??"",iconClass:Y.asClassName(C.sparkle),run:()=>{tr.get(this._editor)?.applyCodeAction(E,!1,!1,Jn.FromProblemsHover)}});else f();n.onContentsChanged()},ee)}else f();return g}getCodeActions(n){return Zt((h)=>Ts(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new t(n.startLineNumber,n.startColumn,n.endLineNumber,n.endColumn),oE,Za.None,h))}};zp=NT([Sh(1,Lv),Sh(2,Xr),Sh(3,V),Sh(4,Ai),Sh(5,K)],zp);class vS{constructor(u){this._editor=u}computeSync(u){let n=(f)=>({value:f}),h=this._editor.getLineDecorations(u.lineNumber),g=[],p=u.laneOrLine==="lineNo";if(!h)return g;for(let f of h){let b=f.options.glyphMargin?.position??ts.Center;if(!p&&b!==u.laneOrLine)continue;let S=p?f.options.lineNumberHoverMessage:f.options.glyphMarginHoverMessage;if(!S||lp(S))continue;g.push(...pv(S).map(n))}return g}}var OT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},MT=function(u,n){return function(h,g){n(h,g,u)}},SS,rE=_,Up=class u extends i{static{SS=this}static{this.ID="editor.contrib.modesGlyphHoverWidget"}constructor(n,h){super();this._markdownRendererService=h,this.allowEditorOverflow=!0,this._renderDisposeables=this._register(new d),this._editor=n,this._isVisible=!1,this._messages=[],this._hover=this._register(new Gg(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._hoverOperation=this._register(new gh(this._editor,new vS(this._editor))),this._register(this._hoverOperation.onResult((g)=>this._withResult(g))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration((g)=>{if(g.hasChanged(59))this._updateFont()})),this._register(Ct(this._hover.containerDomNode,"mouseleave",(g)=>{this._onMouseLeave(g)})),this._editor.addOverlayWidget(this)}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return SS.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach((h)=>this._editor.applyFontInfo(h))}_onModelDecorationsChanged(){if(this._isVisible&&this._hoverComputerOptions)this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions)}showsOrWillShow(n){let h=n.target;if(h.type===2&&h.detail.glyphMarginLane)return this._startShowingAt(h.position.lineNumber,h.detail.glyphMarginLane),!0;if(h.type===3)return this._startShowingAt(h.position.lineNumber,"lineNo"),!0;return!1}_startShowingAt(n,h){if(this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===n&&this._hoverComputerOptions.laneOrLine===h)return;this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:n,laneOrLine:h},this._hoverOperation.start(0,this._hoverComputerOptions)}hide(){if(this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),!this._isVisible)return;this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible)}_withResult(n){if(this._messages=n.value,this._messages.length>0)this._renderMessages(n.options.lineNumber,n.options.laneOrLine,this._messages);else this.hide()}_renderMessages(n,h,g){this._renderDisposeables.clear();let p=document.createDocumentFragment();for(let f of g){let b=rE("div.hover-row.markdown-hover"),S=k(b,rE("div.hover-contents")),w=this._renderDisposeables.add(this._markdownRendererService.render(f.value,{context:this._editor}));S.appendChild(w.element),p.appendChild(b)}this._updateContents(p),this._showAt(n,h)}_updateContents(n){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(n),this._updateFont()}_showAt(n,h){if(!this._isVisible)this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible);let g=this._editor.getLayoutInfo(),p=this._editor.getTopForLineNumber(n),f=this._editor.getScrollTop(),b=this._editor.getOption(75),S=this._hover.containerDomNode.clientHeight,w=p-f-(S-b)/2,x=g.glyphMarginLeft+g.glyphMarginWidth+(h==="lineNo"?g.lineNumbersWidth:0),E=g.height-S,Z=Math.max(0,Math.min(Math.round(w),E));if(this._editor.getOption(51)){let J=this._editor.getDomNode();if(J){let Q=kt(J);this._hover.containerDomNode.style.position="fixed",this._hover.containerDomNode.style.left=`${Q.left+x}px`,this._hover.containerDomNode.style.top=`${Q.top+Z}px`}}else this._hover.containerDomNode.style.position="absolute",this._hover.containerDomNode.style.left=`${x}px`,this._hover.containerDomNode.style.top=`${Z}px`;this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(n){let h=this._editor.getDomNode();if(!h||!$s(h,n.x,n.y))this.hide()}};Up=SS=OT([MT(1,Wr)],Up);var PT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},AT=function(u,n){return function(h,g){n(h,g,u)}},wh=class u extends i{static{this.ID="editor.contrib.marginHover"}constructor(n,h){super();this._editor=n,this._instantiationService=h,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new d,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new ke(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration((g)=>{if(g.hasChanged(69))this._unhookListeners(),this._hookListeners()}))}_hookListeners(){let n=this._editor.getOption(69);if(this._hoverSettings={enabled:n.enabled,sticky:n.sticky,hidingDelay:n.hidingDelay},n.enabled!=="off")this._listenersStore.add(this._editor.onMouseDown((h)=>this._onEditorMouseDown(h))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove((h)=>this._onEditorMouseMove(h))),this._listenersStore.add(this._editor.onKeyDown((h)=>this._onKeyDown(h)));else this._listenersStore.add(this._editor.onMouseMove((h)=>this._onEditorMouseMove(h))),this._listenersStore.add(this._editor.onKeyDown((h)=>this._onKeyDown(h)));this._listenersStore.add(this._editor.onMouseLeave((h)=>this._onEditorMouseLeave(h))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange((h)=>this._onEditorScrollChanged(h)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(n){if(n.scrollTopChanged||n.scrollLeftChanged)this.hideGlyphHover()}_onEditorMouseDown(n){if(this._hoverState.mouseDown=!0,this._isMouseOnGlyphHoverWidget(n))return;this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(n){let h=this._glyphWidget?.getDomNode();if(h)return $s(h,n.event.posx,n.event.posy);return!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(n){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(n))return;this.hideGlyphHover()}_shouldNotRecomputeCurrentHoverWidget(n){let h=this._hoverSettings.sticky,g=this._isMouseOnGlyphHoverWidget(n);return h&&g}_onEditorMouseMove(n){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=n,this._shouldNotRecomputeCurrentHoverWidget(n)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(n)}_reactToEditorMouseMove(n){if(!n)return;if(!kp(this._hoverSettings.enabled,this._editor.getOption(86),n)){this.hideGlyphHover();return}if(this._tryShowHoverWidget(n))return;this.hideGlyphHover()}_tryShowHoverWidget(n){return this._getOrCreateGlyphWidget().showsOrWillShow(n)}_onKeyDown(n){if(!this._editor.hasModel())return;if(this._hoverSettings.enabled==="onKeyboardModifier"&&uh(this._editor.getOption(86),n)&&this._mouseMoveEvent){this._tryShowHoverWidget(this._mouseMoveEvent);return}if(qh(n.keyCode))return;this.hideGlyphHover()}hideGlyphHover(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){if(!this._glyphWidget)this._glyphWidget=this._instantiationService.createInstance(Up,this._editor);return this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}};wh=PT([AT(1,O)],wh);var pl=new class u{constructor(){this._implementations=[]}register(n){return this._implementations.push(n),{dispose:()=>{let h=this._implementations.indexOf(n);if(h!==-1)this._implementations.splice(h,1)}}}getImplementations(){return this._implementations}};class wS{}class CS{}class yS{}fe(Nr.ID,Nr,2);fe(wh.ID,wh,2);A(sS);A(aS);A(dS);A(lS);A(cS);A(hS);A(uS);A(gS);A(pS);A(mS);A(fS);A(_S);A(bS);El.register(qs);El.register(zp);$e.registerCommand(oh,(u)=>{u.get(oe).updateValue("editor.hover.showLongLineWarning",!1)});$i((u,n)=>{let h=u.getColor(Uf);if(h)n.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${h.transparent(0.5)}; }`),n.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${h.transparent(0.5)}; }`),n.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${h.transparent(0.5)}; }`)});pl.register(new wS);pl.register(new CS);pl.register(new yS);class sE{constructor(u,n){this._link=u,this._provider=n}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(u){if(this._link.url)return this._link.url;if(typeof this._provider.resolveLink==="function")return Promise.resolve(this._provider.resolveLink(this._link,u)).then((n)=>{if(this._link=n||this._link,this._link.url)return this.resolve(u);return Promise.reject(Error("missing"))});return Promise.reject(Error("missing"))}}class Ch{static{this.Empty=new Ch([])}constructor(u){this._disposables=new d;let n=[];for(let[h,g]of u){let p=h.links.map((f)=>new sE(f,g));if(n=Ch._union(n,p),ha(h))this._disposables??=new d,this._disposables.add(h)}this.links=n}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(u,n){let h=[],g,p,f,b;for(g=0,f=0,p=u.length,b=n.length;g<p&&f<b;){let S=u[g],w=n[f];if(t.areIntersectingOrTouching(S.range,w.range)){g++;continue}if(t.compareRangesUsingStarts(S.range,w.range)<0)h.push(S),g++;else h.push(w),f++}for(;g<p;g++)h.push(u[g]);for(;f<b;f++)h.push(n[f]);return h}}async function xS(u,n,h){let g=[],p=u.ordered(n).reverse().map(async(b,S)=>{try{let w=await b.provideLinks(n,h);if(w)g[S]=[w,b]}catch(w){vt(w)}});await Promise.all(p);let f=new Ch(wr(g));if(h.isCancellationRequested)f.dispose(),f=Ch.Empty;return f}$e.registerCommand("_executeLinkProvider",async(u,...n)=>{let[h,g]=n;if(He(h instanceof q),typeof g!=="number")g=0;let{linkProvider:p}=u.get(V),f=u.get(Et).getModel(h);if(!f)return[];let b=await xS(p,f,xe.None);if(!b)return[];for(let w=0;w<Math.min(g,b.links.length);w++)await b.links[w].resolve(xe.None);let S=b.links.slice(0);return b.dispose(),S});var FT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},$p=function(u,n){return function(h,g){n(h,g,u)}},IS,yh=class u extends i{static{IS=this}static{this.ID="editor.linkDetector"}static get(n){return n.getContribution(IS.ID)}constructor(n,h,g,p,f){super();this.editor=n,this.openerService=h,this.notificationService=g,this.languageFeaturesService=p,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=f.for(this.providers,"Links",{min:1000,max:4000}),this.computeLinks=this._register(new ke(()=>this.computeLinksNow(),1000)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;let b=this._register(new Tr(n));this._register(b.onMouseMoveOrRelevantKeyDown(([S,w])=>{this._onEditorMouseMove(S,w)})),this._register(b.onExecute((S)=>{this.onEditorMouseUp(S)})),this._register(b.onCancel((S)=>{this.cleanUpActiveLinkDecoration()})),this._register(n.onDidChangeConfiguration((S)=>{if(!S.hasChanged(79))return;this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0)})),this._register(n.onDidChangeModelContent((S)=>{if(!this.editor.hasModel())return;this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(n.onDidChangeModel((S)=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(n.onDidChangeModelLanguage((S)=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange((S)=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;let n=this.editor.getModel();if(n.isTooLargeForSyncing())return;if(!this.providers.has(n))return;if(this.activeLinksList)this.activeLinksList.dispose(),this.activeLinksList=null;this.computePromise=Zt((h)=>xS(this.providers,n,h));try{let h=new dn(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(n,h.elapsed()),n.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(h){ee(h)}finally{this.computePromise=null}}updateDecorations(n){let h=this.editor.getOption(86)==="altKey",g=[],p=Object.keys(this.currentOccurrences);for(let b of p){let S=this.currentOccurrences[b];g.push(S.decorationId)}let f=[];if(n)for(let b of n)f.push(ml.decoration(b,h));this.editor.changeDecorations((b)=>{let S=b.deltaDecorations(g,f);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let w=0,x=S.length;w<x;w++){let I=new ml(n[w],S[w]);this.currentOccurrences[I.decorationId]=I}})}_onEditorMouseMove(n,h){let g=this.editor.getOption(86)==="altKey";if(this.isEnabled(n,h)){this.cleanUpActiveLinkDecoration();let p=this.getLinkOccurrence(n.target.position);if(p)this.editor.changeDecorations((f)=>{p.activate(f,g),this.activeLinkDecorationId=p.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){let n=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){let h=this.currentOccurrences[this.activeLinkDecorationId];if(h)this.editor.changeDecorations((g)=>{h.deactivate(g,n)});this.activeLinkDecorationId=null}}onEditorMouseUp(n){if(!this.isEnabled(n))return;let h=this.getLinkOccurrence(n.target.position);if(!h)return;this.openLinkOccurrence(h,n.hasSideBySideModifier,!0)}openLinkOccurrence(n,h,g=!1){if(!this.openerService)return;let{link:p}=n;p.resolve(xe.None).then((f)=>{if(typeof f==="string"&&this.editor.hasModel()){let b=this.editor.getModel().uri;if(b.scheme===se.file&&f.startsWith(`${se.file}:`)){let S=q.parse(f);if(S.scheme===se.file){let w=bd(S),x=null;if(w.startsWith("/./")||w.startsWith("\\.\\"))x=`.${w.substr(1)}`;else if(w.startsWith("//./")||w.startsWith("\\\\.\\"))x=`.${w.substr(2)}`;if(x)f=dk(b,x)}}}return this.openerService.open(f,{openToSide:h,fromUserGesture:g,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},(f)=>{let b=f instanceof Error?f.message:f;if(b==="invalid")this.notificationService.warn(e(1343,"Failed to open this link because it is not well-formed: {0}",p.url.toString()));else if(b==="missing")this.notificationService.warn(e(1344,"Failed to open this link because its target is missing."));else ee(f)})}getLinkOccurrence(n){if(!this.editor.hasModel()||!n)return null;let h=this.editor.getModel().getDecorationsInRange({startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:n.lineNumber,endColumn:n.column},0,!0);for(let g of h){let p=this.currentOccurrences[g.id];if(p)return p}return null}isEnabled(n,h){return Boolean(n.target.type===6&&(n.hasTriggerModifier||h&&h.keyCodeIsTriggerKey||n.isMiddleClick&&n.mouseMiddleClickAction==="openLink"))}stop(){if(this.computeLinks.cancel(),this.activeLinksList)this.activeLinksList?.dispose(),this.activeLinksList=null;if(this.computePromise)this.computePromise.cancel(),this.computePromise=null}dispose(){super.dispose(),this.stop()}};yh=IS=FT([$p(1,Xr),$p(2,wt),$p(3,V),$p(4,ur)],yh);var aE={general:ue.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:ue.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class ml{static decoration(u,n){return{range:u.range,options:ml._getOptions(u,n,!1)}}static _getOptions(u,n,h){let g={...h?aE.active:aE.general};return g.hoverMessage=HT(u,n),g}constructor(u,n){this.link=u,this.decorationId=n}activate(u,n){u.changeDecorationOptions(this.decorationId,ml._getOptions(this.link,n,!0))}deactivate(u,n){u.changeDecorationOptions(this.decorationId,ml._getOptions(this.link,n,!1))}}function HT(u,n){let h=u.url&&/^command:/i.test(u.url.toString()),g=u.tooltip?u.tooltip:h?e(1345,"Execute command"):e(1346,"Follow link"),p=n?ye?e(1347,"cmd + click"):e(1348,"ctrl + click"):ye?e(1349,"option + click"):e(1350,"alt + click");if(u.url){let f="";if(/^command:/i.test(u.url.toString())){let S=u.url.toString().match(/^command:([^?#]+)/);if(S){let w=S[1];f=e(1351,"Execute command {0}",w)}}return new Pn("",!0).appendLink(u.url.toString(!0).replace(/ /g,"%20"),g,f).appendMarkdown(` (${p})`)}else return new Pn().appendText(`${g} (${p})`)}class dE extends U{constructor(){super({id:"editor.action.openLink",label:y(1352,"Open Link"),precondition:void 0})}run(u,n){let h=yh.get(n);if(!h)return;if(!n.hasModel())return;let g=n.getSelections();for(let p of g){let f=h.getLinkOccurrence(p.getEndPosition());if(f)h.openLinkOccurrence(f,!1)}}}fe(yh.ID,yh,1);A(dE);var Ur={Visible:new P("parameterHintsVisible",!1),MultipleSignatures:new P("parameterHintsMultipleSignatures",!1)};async function LS(u,n,h,g,p){let f=u.ordered(n);for(let b of f)try{let S=await b.provideSignatureHelp(n,h,p,g);if(S)return S}catch(S){vt(S)}return}$e.registerCommand("_executeSignatureHelpProvider",async(u,...n)=>{let[h,g,p]=n;He(q.isUri(h)),He(s.isIPosition(g)),He(typeof p==="string"||!p);let f=u.get(V),b=await u.get(Nn).createModelReference(h);try{let S=await LS(f.signatureHelpProvider,b.object.textEditorModel,s.lift(g),{triggerKind:Ll.Invoke,isRetrigger:!1,triggerCharacter:p},xe.None);if(!S)return;return setTimeout(()=>S.dispose(),0),S.value}finally{b.dispose()}});var Zs;(function(u){u.Default={type:0};class n{constructor(g,p){this.request=g,this.previouslyActiveHints=p,this.type=2}}u.Pending=n;class h{constructor(g){this.hints=g,this.type=1}}u.Active=h})(Zs||(Zs={}));class jp extends i{static{this.DEFAULT_DELAY=120}constructor(u,n,h=jp.DEFAULT_DELAY){super();this._onChangedHints=this._register(new r),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=Zs.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new de),this.triggerChars=new Ff,this.retriggerChars=new Ff,this.triggerId=0,this.editor=u,this.providers=n,this.throttledDelayer=this._register(new Ji(h)),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel((g)=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage((g)=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection((g)=>this.onCursorChange(g))),this._register(this.editor.onDidChangeModelContent((g)=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType((g)=>this.onDidType(g))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(u){if(this._state.type===2)this._state.request.cancel();this._state=u}cancel(u=!1){if(this.state=Zs.Default,this.throttledDelayer.cancel(),!u)this._onChangedHints.fire(void 0)}trigger(u,n){let h=this.editor.getModel();if(!h||!this.providers.has(h))return;let g=++this.triggerId;this._pendingTriggers.push(u),this.throttledDelayer.trigger(()=>this.doTrigger(g),n).catch(ee)}next(){if(this.state.type!==1)return;let u=this.state.hints.signatures.length,n=this.state.hints.activeSignature,h=n%u===u-1,g=this.editor.getOption(98).cycle;if((u<2||h)&&!g){this.cancel();return}this.updateActiveSignature(h&&g?0:n+1)}previous(){if(this.state.type!==1)return;let u=this.state.hints.signatures.length,n=this.state.hints.activeSignature,h=n===0,g=this.editor.getOption(98).cycle;if((u<2||h)&&!g){this.cancel();return}this.updateActiveSignature(h&&g?u-1:n-1)}updateActiveSignature(u){if(this.state.type!==1)return;this.state=new Zs.Active({...this.state.hints,activeSignature:u}),this._onChangedHints.fire(this.state.hints)}async doTrigger(u){let n=this.state.type===1||this.state.type===2,h=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;let g=this._pendingTriggers.reduce(WT);this._pendingTriggers=[];let p={triggerKind:g.triggerKind,triggerCharacter:g.triggerCharacter,isRetrigger:n,activeSignatureHelp:h};if(!this.editor.hasModel())return!1;let f=this.editor.getModel(),b=this.editor.getPosition();this.state=new Zs.Pending(Zt((S)=>LS(this.providers,f,b,p,S)),h);try{let S=await this.state.request;if(u!==this.triggerId)return S?.dispose(),!1;if(!S||!S.value.signatures||S.value.signatures.length===0)return S?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1;else return this.state=new Zs.Active(S.value),this._lastSignatureHelpResult.value=S,this._onChangedHints.fire(this.state.hints),!0}catch(S){if(u===this.triggerId)this.state=Zs.Default;return ee(S),!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 u=this.editor.getModel();if(!u)return;for(let n of this.providers.ordered(u)){for(let h of n.signatureHelpTriggerCharacters||[])if(h.length){let g=h.charCodeAt(0);this.triggerChars.add(g),this.retriggerChars.add(g)}for(let h of n.signatureHelpRetriggerCharacters||[])if(h.length)this.retriggerChars.add(h.charCodeAt(0))}}onDidType(u){if(!this.triggerOnType)return;let n=u.length-1,h=u.charCodeAt(n);if(this.triggerChars.has(h)||this.isTriggered&&this.retriggerChars.has(h))this.trigger({triggerKind:Ll.TriggerCharacter,triggerCharacter:u.charAt(n)})}onCursorChange(u){if(u.source==="mouse")this.cancel();else if(this.isTriggered)this.trigger({triggerKind:Ll.ContentChange})}onModelContentChange(){if(this.isTriggered)this.trigger({triggerKind:Ll.ContentChange})}onEditorConfigurationChange(){if(this.triggerOnType=this.editor.getOption(98).enabled,!this.triggerOnType)this.cancel()}dispose(){this.cancel(!0),super.dispose()}}function WT(u,n){switch(n.triggerKind){case Ll.Invoke:return n;case Ll.ContentChange:return u;case Ll.TriggerCharacter:default:return n}}var BT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},lE=function(u,n){return function(h,g){n(h,g,u)}},ES,co=_,VT=Mt("parameter-hints-next",C.chevronDown,e(1378,"Icon for show next parameter hint.")),KT=Mt("parameter-hints-previous",C.chevronUp,e(1379,"Icon for show previous parameter hint.")),Gp=class u extends i{static{ES=this}static{this.ID="editor.widget.parameterHintsWidget"}constructor(n,h,g,p){super();this.editor=n,this.model=h,this.markdownRendererService=p,this.renderDisposeables=this._register(new d),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.keyVisible=Ur.Visible.bindTo(g),this.keyMultipleSignatures=Ur.MultipleSignatures.bindTo(g)}createParameterHintDOMNodes(){let n=co(".editor-widget.parameter-hints-widget"),h=k(n,co(".phwrapper"));h.tabIndex=-1;let g=k(h,co(".controls")),p=k(g,co(".button"+Y.asCSSSelector(KT))),f=k(g,co(".overloads")),b=k(g,co(".button"+Y.asCSSSelector(VT)));this._register(c(p,"click",(Z)=>{Ee.stop(Z),this.previous()})),this._register(c(b,"click",(Z)=>{Ee.stop(Z),this.next()}));let S=co(".body"),w=new Fl(S,{alwaysConsumeMouseWheel:!0});this._register(w),h.appendChild(w.getDomNode());let x=k(S,co(".signature")),I=k(S,co(".docs"));n.style.userSelect="text",this.domNodes={element:n,signature:x,overloads:f,docs:I,scrollbar:w},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection((Z)=>{if(this.visible)this.editor.layoutContentWidget(this)}));let E=()=>{if(!this.domNodes)return;let Z=this.editor.getOption(59),X=this.domNodes.element;X.style.fontSize=`${Z.fontSize}px`,X.style.lineHeight=`${Z.lineHeight/Z.fontSize}`,X.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",Z.fontFamily),X.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",Or.fontFamily)};E(),this._register(R.chain(this.editor.onDidChangeConfiguration.bind(this.editor),(Z)=>Z.filter((X)=>X.hasChanged(59)))(E)),this._register(this.editor.onDidLayoutChange((Z)=>this.updateMaxHeight())),this.updateMaxHeight()}show(){if(this.visible)return;if(!this.domNodes)this.createParameterHintDOMNodes();this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this)}hide(){if(this.renderDisposeables.clear(),!this.visible)return;this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this)}getPosition(){if(this.visible)return{position:this.editor.getPosition(),preference:[1,2]};return null}render(n){if(this.renderDisposeables.clear(),!this.domNodes)return;let h=n.signatures.length>1;this.domNodes.element.classList.toggle("multiple",h),this.keyMultipleSignatures.set(h),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";let g=n.signatures[n.activeSignature];if(!g)return;let p=k(this.domNodes.signature,co(".code")),f=g.parameters.length>0,b=g.activeParameter??n.activeParameter;if(!f){let x=k(p,co("span"));x.textContent=g.label}else this.renderParameters(p,g,b);let S=g.parameters[b];if(S?.documentation){let x=co("span.documentation");if(typeof S.documentation==="string")x.textContent=S.documentation;else{let I=this.renderMarkdownDocs(S.documentation);x.appendChild(I.element)}k(this.domNodes.docs,co("p",{},x))}if(g.documentation===void 0);else if(typeof g.documentation==="string")k(this.domNodes.docs,co("p",{},g.documentation));else{let x=this.renderMarkdownDocs(g.documentation);k(this.domNodes.docs,x.element)}let w=this.hasDocs(g,S);if(this.domNodes.signature.classList.toggle("has-docs",w),this.domNodes.docs.classList.toggle("empty",!w),this.domNodes.overloads.textContent=String(n.activeSignature+1).padStart(n.signatures.length.toString().length,"0")+"/"+n.signatures.length,S){let x="",I=g.parameters[b];if(Array.isArray(I.label))x=g.label.substring(I.label[0],I.label[1]);else x=I.label;if(I.documentation)x+=typeof I.documentation==="string"?`, ${I.documentation}`:`, ${I.documentation.value}`;if(g.documentation)x+=typeof g.documentation==="string"?`, ${g.documentation}`:`, ${g.documentation.value}`;if(this.announcedLabel!==x)zn(e(1380,"{0}, hint",x)),this.announcedLabel=x}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(n){let h=this.renderDisposeables.add(this.markdownRendererService.render(n,{context:this.editor,asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return h.element.classList.add("markdown-docs"),h}hasDocs(n,h){if(h&&typeof h.documentation==="string"&&fc(h.documentation).length>0)return!0;if(h&&typeof h.documentation==="object"&&fc(h.documentation).value.length>0)return!0;if(n.documentation&&typeof n.documentation==="string"&&fc(n.documentation).length>0)return!0;if(n.documentation&&typeof n.documentation==="object"&&fc(n.documentation.value).length>0)return!0;return!1}renderParameters(n,h,g){let[p,f]=this.getParameterLabelOffsets(h,g),b=document.createElement("span");b.textContent=h.label.substring(0,p);let S=document.createElement("span");S.textContent=h.label.substring(p,f),S.className="parameter active";let w=document.createElement("span");w.textContent=h.label.substring(f),k(n,b,S,w)}getParameterLabelOffsets(n,h){let g=n.parameters[h];if(!g)return[0,0];else if(Array.isArray(g.label))return g.label;else if(!g.label.length)return[0,0];else{let p=new RegExp(`(\\W|^)${qi(g.label)}(?=\\W|$)`,"g");p.test(n.label);let f=p.lastIndex-g.label.length;return f>=0?[f,p.lastIndex]:[0,0]}}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){if(!this.domNodes)this.createParameterHintDOMNodes();return this.domNodes.element}getId(){return ES.ID}updateMaxHeight(){if(!this.domNodes)return;let h=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=h;let g=this.domNodes.element.getElementsByClassName("phwrapper");if(g.length)g[0].style.maxHeight=h}};Gp=ES=BT([lE(2,K),lE(3,Wr)],Gp);a("editorHoverWidget.highlightForeground",qf,e(1381,"Foreground color of the active item in the parameter hint."));var zT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},cE=function(u,n){return function(h,g){n(h,g,u)}},DS,fl=class u extends i{static{DS=this}static{this.ID="editor.controller.parameterHints"}static get(n){return n.getContribution(DS.ID)}constructor(n,h,g){super();this.editor=n,this.model=this._register(new jp(n,g.signatureHelpProvider)),this._register(this.model.onChangedHints((p)=>{if(p)this.widget.value.show(),this.widget.value.render(p);else this.widget.rawValue?.hide()})),this.widget=new ii(()=>this._register(h.createInstance(Gp,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(n){this.model.trigger(n,0)}};fl=DS=zT([cE(1,O),cE(2,V)],fl);class hE extends U{constructor(){super({id:"editor.action.triggerParameterHints",label:y(1377,"Trigger Parameter Hints"),precondition:o.hasSignatureHelpProvider,kbOpts:{kbExpr:o.editorTextFocus,primary:3082,weight:100}})}run(u,n){fl.get(n)?.trigger({triggerKind:Ll.Invoke})}}fe(fl.ID,fl,2);A(hE);var RS=175,kS=nn.bindToContribution(fl.get);G(new kS({id:"closeParameterHints",precondition:Ur.Visible,handler:(u)=>u.cancel(),kbOpts:{weight:RS,kbExpr:o.focus,primary:9,secondary:[1033]}}));G(new kS({id:"showPrevParameterHint",precondition:L.and(Ur.Visible,Ur.MultipleSignatures),handler:(u)=>u.previous(),kbOpts:{weight:RS,kbExpr:o.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}}));G(new kS({id:"showNextParameterHint",precondition:L.and(Ur.Visible,Ur.MultipleSignatures),handler:(u)=>u.next(),kbOpts:{weight:RS,kbExpr:o.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));var Fe={Visible:eg,HasFocusedSuggestion:new P("suggestWidgetHasFocusedSuggestion",!1,e(1525,"Whether any suggestion is focused")),DetailsVisible:new P("suggestWidgetDetailsVisible",!1,e(1526,"Whether suggestion details are visible")),DetailsFocused:new P("suggestWidgetDetailsFocused",!1,e(1527,"Whether the details pane of the suggest widget has focus")),MultipleSuggestions:new P("suggestWidgetMultipleSuggestions",!1,e(1528,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new P("suggestionMakesTextEdit",!0,e(1529,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new P("acceptSuggestionOnEnter",!0,e(1530,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new P("suggestionHasInsertAndReplaceRange",!1,e(1531,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new P("suggestionInsertMode",void 0,{type:"string",description:e(1532,"Whether the default behaviour is to insert or replace")}),CanResolve:new P("suggestionCanResolve",!1,e(1533,"Whether the current suggestion supports to resolve further details"))},vn=new l("suggestWidgetStatusBar");class uE{constructor(u,n,h,g){if(this.position=u,this.completion=n,this.container=h,this.provider=g,this.isInvalid=!1,this.score=is.Default,this.distance=0,this.textLabel=typeof n.label==="string"?n.label:n.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=n.sortText&&n.sortText.toLowerCase(),this.filterTextLow=n.filterText&&n.filterText.toLowerCase(),this.extensionId=n.extensionId,t.isIRange(n.range))this.editStart=new s(n.range.startLineNumber,n.range.startColumn),this.editInsertEnd=new s(n.range.endLineNumber,n.range.endColumn),this.editReplaceEnd=new s(n.range.endLineNumber,n.range.endColumn),this.isInvalid=this.isInvalid||t.spansMultipleLines(n.range)||n.range.startLineNumber!==u.lineNumber;else this.editStart=new s(n.range.insert.startLineNumber,n.range.insert.startColumn),this.editInsertEnd=new s(n.range.insert.endLineNumber,n.range.insert.endColumn),this.editReplaceEnd=new s(n.range.replace.endLineNumber,n.range.replace.endColumn),this.isInvalid=this.isInvalid||t.spansMultipleLines(n.range.insert)||t.spansMultipleLines(n.range.replace)||n.range.insert.startLineNumber!==u.lineNumber||n.range.replace.startLineNumber!==u.lineNumber||n.range.insert.startColumn!==n.range.replace.startColumn;if(typeof g.resolveCompletionItem!=="function")this._resolveCache=Promise.resolve(),this._resolveDuration=0}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(u){if(!this._resolveCache){let n=u.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),h=new dn(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,u)).then((g)=>{Object.assign(this.completion,g),this._resolveDuration=h.elapsed()},(g)=>{if(bi(g))this._resolveCache=void 0,this._resolveDuration=void 0}).finally(()=>{n.dispose()})}return this._resolveCache}}class rd{static{this.default=new rd}constructor(u=2,n=new Set,h=new Set,g=new Map,p=!0){this.snippetSortOrder=u,this.kindFilter=n,this.providerFilter=h,this.providerItemsToReuse=g,this.showDeprecated=p}}class gE{constructor(u,n,h,g){this.items=u,this.needsClipboard=n,this.durations=h,this.disposable=g}}async function xh(u,n,h,g=rd.default,p={triggerKind:0},f=xe.None){let b=new dn;h=h.clone();let S=n.getWordAtPosition(h),w=S?new t(h.lineNumber,S.startColumn,h.lineNumber,S.endColumn):t.fromPositions(h),x={replace:w,insert:w.setEndPosition(h.lineNumber,h.column)},I=[],E=new d,Z=[],X=!1,J=(te,re,le)=>{let pe=!1;if(!re)return pe;for(let Se of re.suggestions)if(!g.kindFilter.has(Se.kind)){if(!g.showDeprecated&&Se?.tags?.includes(1))continue;if(!Se.range)Se.range=x;if(!Se.sortText)Se.sortText=typeof Se.label==="string"?Se.label:Se.label.label;if(!X&&Se.insertTextRules&&Se.insertTextRules&4)X=no.guessNeedsClipboard(Se.insertText);I.push(new uE(h,Se,re,te)),pe=!0}if(ha(re))E.add(re);return Z.push({providerName:te._debugDisplayName??"unknown_provider",elapsedProvider:re.duration??-1,elapsedOverall:le.elapsed()}),pe},Q=(async()=>{return})();for(let te of u.orderedGroups(n)){let re=!1;if(await Promise.all(te.map(async(le)=>{if(g.providerItemsToReuse.has(le)){let pe=g.providerItemsToReuse.get(le);pe.forEach((Se)=>I.push(Se)),re=re||pe.length>0;return}if(g.providerFilter.size>0&&!g.providerFilter.has(le))return;try{let pe=new dn,Se=await le.provideCompletionItems(n,h,p,f);re=J(le,Se,pe)||re}catch(pe){vt(pe)}})),re||f.isCancellationRequested)break}if(await Q,f.isCancellationRequested)return E.dispose(),Promise.reject(new Io);return new gE(I.sort(jT(g.snippetSortOrder)),X,{entries:Z,elapsed:b.elapsed()},E)}function TS(u,n){if(u.sortTextLow&&n.sortTextLow){if(u.sortTextLow<n.sortTextLow)return-1;else if(u.sortTextLow>n.sortTextLow)return 1}if(u.textLabel<n.textLabel)return-1;else if(u.textLabel>n.textLabel)return 1;return u.completion.kind-n.completion.kind}function UT(u,n){if(u.completion.kind!==n.completion.kind){if(u.completion.kind===28)return-1;else if(n.completion.kind===28)return 1}return TS(u,n)}function $T(u,n){if(u.completion.kind!==n.completion.kind){if(u.completion.kind===28)return 1;else if(n.completion.kind===28)return-1}return TS(u,n)}var qp=new Map;qp.set(0,UT);qp.set(2,$T);qp.set(1,TS);function jT(u){return qp.get(u)}$e.registerCommand("_executeCompletionItemProvider",async(u,...n)=>{let[h,g,p,f]=n;He(q.isUri(h)),He(s.isIPosition(g)),He(typeof p==="string"||!p),He(typeof f==="number"||!f);let{completionProvider:b}=u.get(V),S=await u.get(Nn).createModelReference(h);try{let w={incomplete:!1,suggestions:[]},x=[],I=S.object.textEditorModel.validatePosition(g),E=await xh(b,S.object.textEditorModel,I,void 0,{triggerCharacter:p??void 0,triggerKind:p?1:0});for(let Z of E.items){if(x.length<(f??0))x.push(Z.resolve(xe.None));w.incomplete=w.incomplete||Z.container.incomplete,w.suggestions.push(Z.completion)}try{return await Promise.all(x),w}finally{setTimeout(()=>E.disposable.dispose(),100)}}finally{S.dispose()}});function pE(u,n){u.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(n),void 0,!0)}class $r{static isAllOff(u){return u.other==="off"&&u.comments==="off"&&u.strings==="off"}static isAllOn(u){return u.other==="on"&&u.comments==="on"&&u.strings==="on"}static valueFor(u,n){switch(n){case 1:return u.comments;case 2:return u.strings;default:return u.other}}}function NS(u,n=rn){if(p2(u,n))return u.charAt(0).toUpperCase()+u.slice(1);return u}var GT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},qT=function(u,n){return function(h,g){n(h,g,u)}};class Zp{constructor(u){this._delegates=u}resolve(u){for(let n of this._delegates){let h=n.resolve(u);if(h!==void 0)return h}return}}class Xp{constructor(u,n,h,g){this._model=u,this._selection=n,this._selectionIdx=h,this._overtypingCapturer=g}resolve(u){let{name:n}=u;if(n==="SELECTION"||n==="TM_SELECTED_TEXT"){let h=this._model.getValueInRange(this._selection)||void 0,g=this._selection.startLineNumber!==this._selection.endLineNumber;if(!h&&this._overtypingCapturer){let p=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);if(p)h=p.value,g=p.multiline}if(h&&g&&u.snippet){let p=this._model.getLineContent(this._selection.startLineNumber),f=It(p,0,this._selection.startColumn-1),b=f;u.snippet.walk((w)=>{if(w===u)return!1;if(w instanceof hi)b=It(Ci(w.value).pop());return!0});let S=Ar(b,f);h=h.replace(/(\r\n|\r|\n)(.*)/g,(w,x,I)=>`${x}${b.substr(S)}${I}`)}return h}else if(n==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);else if(n==="TM_CURRENT_WORD"){let h=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return h&&h.word||void 0}else if(n==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);else if(n==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);else if(n==="CURSOR_INDEX")return String(this._selectionIdx);else if(n==="CURSOR_NUMBER")return String(this._selectionIdx+1);return}}class Yp{constructor(u,n){this._labelService=u,this._model=n}resolve(u){let{name:n}=u;if(n==="TM_FILENAME")return Tl(this._model.uri.fsPath);else if(n==="TM_FILENAME_BASE"){let h=Tl(this._model.uri.fsPath),g=h.lastIndexOf(".");if(g<=0)return h;else return h.slice(0,g)}else if(n==="TM_DIRECTORY"){if(bv(this._model.uri.fsPath)===".")return"";return this._labelService.getUriLabel(Af(this._model.uri))}else if(n==="TM_DIRECTORY_BASE"){if(bv(this._model.uri.fsPath)===".")return"";return Tl(bv(this._model.uri.fsPath))}else if(n==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);else if(n==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0});return}}class Jp{constructor(u,n,h,g){this._readClipboardText=u,this._selectionIdx=n,this._selectionCount=h,this._spread=g}resolve(u){if(u.name!=="CLIPBOARD")return;let n=this._readClipboardText();if(!n)return;if(this._spread){let h=n.split(/\r\n|\n|\r/).filter((g)=>!rk(g));if(h.length===this._selectionCount)return h[this._selectionIdx]}return n}}var Ih=class u{constructor(n,h,g){this._model=n,this._selection=h,this._languageConfigurationService=g}resolve(n){let{name:h}=n,g=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),p=this._languageConfigurationService.getLanguageConfiguration(g).comments;if(!p)return;if(h==="LINE_COMMENT")return p.lineCommentToken||void 0;else if(h==="BLOCK_COMMENT_START")return p.blockCommentStartToken||void 0;else if(h==="BLOCK_COMMENT_END")return p.blockCommentEndToken||void 0;return}};Ih=GT([qT(2,ht)],Ih);class Xs{constructor(){this._date=new Date}static{this.dayNames=[e(1476,"Sunday"),e(1477,"Monday"),e(1478,"Tuesday"),e(1479,"Wednesday"),e(1480,"Thursday"),e(1481,"Friday"),e(1482,"Saturday")]}static{this.dayNamesShort=[e(1483,"Sun"),e(1484,"Mon"),e(1485,"Tue"),e(1486,"Wed"),e(1487,"Thu"),e(1488,"Fri"),e(1489,"Sat")]}static{this.monthNames=[e(1490,"January"),e(1491,"February"),e(1492,"March"),e(1493,"April"),e(1494,"May"),e(1495,"June"),e(1496,"July"),e(1497,"August"),e(1498,"September"),e(1499,"October"),e(1500,"November"),e(1501,"December")]}static{this.monthNamesShort=[e(1502,"Jan"),e(1503,"Feb"),e(1504,"Mar"),e(1505,"Apr"),e(1506,"May"),e(1507,"Jun"),e(1508,"Jul"),e(1509,"Aug"),e(1510,"Sep"),e(1511,"Oct"),e(1512,"Nov"),e(1513,"Dec")]}resolve(u){let{name:n}=u;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 Xs.dayNames[this._date.getDay()];case"CURRENT_DAY_NAME_SHORT":return Xs.dayNamesShort[this._date.getDay()];case"CURRENT_MONTH_NAME":return Xs.monthNames[this._date.getMonth()];case"CURRENT_MONTH_NAME_SHORT":return Xs.monthNamesShort[this._date.getMonth()];case"CURRENT_SECONDS_UNIX":return String(Math.floor(this._date.getTime()/1000));case"CURRENT_MILLISECONDS_UNIX":return String(this._date.getTime());case"CURRENT_TIMEZONE_OFFSET":{let h=this._date.getTimezoneOffset(),g=h>0?"-":"+",p=Math.trunc(Math.abs(h/60)),f=p<10?"0"+p:p,b=Math.abs(h)-p*60,S=b<10?"0"+b:b;return g+f+":"+S}case"CURRENT_TIMEZONE_NAME":return this._timezoneName??=Intl.DateTimeFormat().resolvedOptions().timeZone}return}}class Qp{constructor(u){this._workspaceService=u}resolve(u){if(!this._workspaceService)return;let n=J2(this._workspaceService.getWorkspace());if(q2(n))return;if(u.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(n);else if(u.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(n);return}_resolveWorkspaceName(u){if(Uk(u))return Tl(u.uri.path);let n=Tl(u.configPath.path);if(n.endsWith(qk))n=n.substr(0,n.length-qk.length-1);return n}_resoveWorkspacePath(u){if(Uk(u))return NS(u.uri.fsPath);let n=Tl(u.configPath.path),h=u.configPath.fsPath;if(h.endsWith(n))h=h.substr(0,h.length-n.length-1);return h?NS(h):"/"}}class tm{resolve(u){let{name:n}=u;if(n==="RANDOM")return Math.random().toString().slice(-6);else if(n==="RANDOM_HEX")return Math.random().toString(16).slice(-6);else if(n==="UUID")return jl();return}}var ZT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},XT=function(u,n){return function(h,g){n(h,g,u)}},wn;class Uo{static{this._decor={active:ue.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:ue.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:ue.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:ue.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})}}constructor(u,n,h){this._editor=u,this._snippet=n,this._snippetLineLeadingWhitespace=h,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=OI(n.placeholders,oo.compareByIndex),this._placeholderGroupsIdx=-1}initialize(u){this._offset=u.newPosition}dispose(){if(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 u=this._editor.getModel();this._editor.changeDecorations((n)=>{for(let h of this._snippet.placeholders){let g=this._snippet.offset(h),p=this._snippet.fullLen(h),f=t.fromPositions(u.getPositionAt(this._offset+g),u.getPositionAt(this._offset+g+p)),b=h.isFinalTabstop?Uo._decor.inactiveFinal:Uo._decor.inactive,S=n.addDecoration(f,b);this._placeholderDecorations.set(h,S)}})}move(u){if(!this._editor.hasModel())return[];this._initDecorations();let n=this._editor.getModel();if(this._placeholderGroupsIdx>=0){let p=[];for(let f of this._placeholderGroups[this._placeholderGroupsIdx])if(f.transform){let b=this._placeholderDecorations.get(f),S=b?n.getDecorationRange(b):null;if(S){let w=n.getValueInRange(S),x=f.transform.resolve(w).split(/\r\n|\r|\n/);for(let I=1;I<x.length;I++)x[I]=n.normalizeIndentation(this._snippetLineLeadingWhitespace+x[I]);p.push(Yt.replace(S,x.join(n.getEOL())))}}if(p.length>0)this._editor.executeEdits("snippet.placeholderTransform",p)}let h=!1;if(u===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1)this._placeholderGroupsIdx+=1,h=!0;else if(u===!1&&this._placeholderGroupsIdx>0)this._placeholderGroupsIdx-=1,h=!0;let g=n.changeDecorations((p)=>{let f=new Set,b=[];for(let S of this._placeholderGroups[this._placeholderGroupsIdx]){let w=this._placeholderDecorations.get(S),x=w?n.getDecorationRange(w):null;if(h=h&&this._hasPlaceholderBeenCollapsed(S),!w||!x)continue;b.push(new F(x.startLineNumber,x.startColumn,x.endLineNumber,x.endColumn)),p.changeDecorationOptions(w,S.isFinalTabstop?Uo._decor.activeFinal:Uo._decor.active),f.add(S);for(let I of this._snippet.enclosingPlaceholders(S)){let E=this._placeholderDecorations.get(I);if(E)p.changeDecorationOptions(E,I.isFinalTabstop?Uo._decor.activeFinal:Uo._decor.active),f.add(I)}}for(let[S,w]of this._placeholderDecorations)if(!f.has(S))p.changeDecorationOptions(w,S.isFinalTabstop?Uo._decor.inactiveFinal:Uo._decor.inactive);return b});return!h?g??[]:this.move(u)}_hasPlaceholderBeenCollapsed(u){let n=this._editor.getModel(),h=u;while(h){if(h instanceof oo){let g=this._placeholderDecorations.get(h),p=g?n.getDecorationRange(g):null;if((!p||p.isEmpty())&&h.toString().length>0)return!0}h=h.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[u]=this._snippet.placeholders;if(u.isFinalTabstop){if(this._snippet.rightMostDescendant===u)return!0}}return!1}computePossibleSelections(){let u=new Map;for(let n of this._placeholderGroups){let h;for(let g of n){if(g.isFinalTabstop)break;if(!h)h=[],u.set(g.index,h);let p=this._placeholderDecorations.get(g),f=this._editor.getModel().getDecorationRange(p);if(!f){u.delete(g.index);break}h.push(f)}}return u}get activeChoice(){if(!this._placeholderDecorations)return;let u=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!u?.choice)return;let n=this._placeholderDecorations.get(u);if(!n)return;let h=this._editor.getModel().getDecorationRange(n);if(!h)return;return{range:h,choice:u.choice}}get hasChoice(){let u=!1;return this._snippet.walk((n)=>(u=n instanceof La,!u)),u}get activePlaceholderCount(){return this._placeholderGroupsIdx<0?0:this._placeholderGroups[this._placeholderGroupsIdx].length}merge(u){let n=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations((h)=>{for(let g of this._placeholderGroups[this._placeholderGroupsIdx]){let p=u.shift();console.assert(p._offset!==-1),console.assert(!p._placeholderDecorations);let f=p._snippet.placeholderInfo.last.index;for(let S of p._snippet.placeholderInfo.all)if(S.isFinalTabstop)S.index=g.index+(f+1)/this._nestingLevel;else S.index=g.index+S.index/this._nestingLevel;this._snippet.replace(g,p._snippet.children);let b=this._placeholderDecorations.get(g);h.removeDecoration(b),this._placeholderDecorations.delete(g);for(let S of p._snippet.placeholders){let w=p._snippet.offset(S),x=p._snippet.fullLen(S),I=t.fromPositions(n.getPositionAt(p._offset+w),n.getPositionAt(p._offset+w+x)),E=h.addDecoration(I,Uo._decor.inactive);this._placeholderDecorations.set(S,E)}}this._renormalizePlaceholderIndices(),this._placeholderGroups=OI(this._snippet.placeholders,oo.compareByIndex)})}_renormalizePlaceholderIndices(){let u=this._snippet.placeholders,n=new Set;for(let p of u)if(!p.isFinalTabstop)n.add(p.index);let h=[...n].sort((p,f)=>p-f),g=new Map;for(let p=0;p<h.length;p++)g.set(h[p],p+1);for(let p of u)if(!p.isFinalTabstop)p.index=g.get(p.index);this._nestingLevel=1}}var mE={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},_l=wn=class u{static adjustWhitespace(n,h,g,p,f){let b=n.getLineContent(h.lineNumber),S=It(b,0,h.column-1),w;return p.walk((x)=>{if(!(x instanceof hi)||x.parent instanceof La)return!0;if(f&&!f.has(x))return!0;let I=x.value.split(/\r\n|\r|\n/);if(g){let Z=p.offset(x);if(Z===0)I[0]=n.normalizeIndentation(I[0]);else{w=w??p.toString();let X=w.charCodeAt(Z-1);if(X===10||X===13)I[0]=n.normalizeIndentation(S+I[0])}for(let X=1;X<I.length;X++)I[X]=n.normalizeIndentation(S+I[X])}let E=I.join(n.getEOL());if(E!==x.value)x.parent.replace(x,[new hi(E)]),w=void 0;return!0}),S}static adjustSelection(n,h,g,p){if(g!==0||p!==0){let{positionLineNumber:f,positionColumn:b}=h,S=b-g,w=b+p,x=n.validateRange({startLineNumber:f,startColumn:S,endLineNumber:f,endColumn:w});h=F.createWithDirection(x.startLineNumber,x.startColumn,x.endLineNumber,x.endColumn,h.getDirection())}return h}static createEditsAndSnippetsFromSelections(n,h,g,p,f,b,S,w,x){let I=[],E=[];if(!n.hasModel())return{edits:I,snippets:E};let Z=n.getModel(),X=n.invokeWithinContext((Se)=>Se.get(Sa)),J=n.invokeWithinContext((Se)=>new Yp(Se.get(Ic),Z)),Q=()=>S,te=Z.getValueInRange(wn.adjustSelection(Z,n.getSelection(),g,0)),re=Z.getValueInRange(wn.adjustSelection(Z,n.getSelection(),0,p)),le=Z.getLineFirstNonWhitespaceColumn(n.getSelection().positionLineNumber),pe=n.getSelections().map((Se,we)=>({selection:Se,idx:we})).sort((Se,we)=>t.compareRangesUsingStarts(Se.selection,we.selection));for(let{selection:Se,idx:we}of pe){let ae=wn.adjustSelection(Z,Se,g,0),me=wn.adjustSelection(Z,Se,0,p);if(te!==Z.getValueInRange(ae))ae=Se;if(re!==Z.getValueInRange(me))me=Se;let De=Se.setStartPosition(ae.startLineNumber,ae.startColumn).setEndPosition(me.endLineNumber,me.endColumn),Oe=new no().parse(h,!0,f),Me=De.getStartPosition(),Ce=wn.adjustWhitespace(Z,Me,b||we>0&&le!==Z.getLineFirstNonWhitespaceColumn(Se.positionLineNumber),Oe);Oe.resolveVariables(new Zp([J,new Jp(Q,we,pe.length,n.getOption(88)==="spread"),new Xp(Z,Se,we,w),new Ih(Z,Se,x),new Xs,new Qp(X),new tm])),I[we]=Yt.replace(De,Oe.toString()),I[we].identifier={major:we,minor:0},I[we]._isTracked=!0,E[we]=new Uo(n,Oe,Ce)}return{edits:I,snippets:E}}static createEditsAndSnippetsFromEdits(n,h,g,p,f,b,S){if(!n.hasModel()||h.length===0)return{edits:[],snippets:[]};let w=[],x=n.getModel(),I=new no,E=new Md,Z=n.invokeWithinContext((Se)=>new Yp(Se.get(Ic),x)),X=new Xs,J=new Qp(n.invokeWithinContext((Se)=>Se.get(Sa))),Q=new tm,te=()=>f,re=n.getOption(88)==="spread",le=h.map((Se,we)=>({edit:Se,idx:we})).sort((Se,we)=>t.compareRangesUsingStarts(Se.edit.range,we.edit.range)),pe=0;for(let Se=0;Se<le.length;Se++){let{edit:{range:we,template:ae,keepWhitespace:me},idx:De}=le[Se];if(Se>0){let qe=le[Se-1].edit.range,Ft=t.fromPositions(qe.getEndPosition(),we.getStartPosition()),it=new hi(x.getValueInRange(Ft));E.appendChild(it),pe+=it.value.length}let Oe=new Set;E.walk((qe)=>{if(qe instanceof cs)Oe.add(qe);return!0});let Me=I.parseFragment(ae,E);wn.adjustWhitespace(x,we.getStartPosition(),me!==void 0?!me:p,E,new Set(Me));let Ce=F.fromRange(we,0),Pe=new Zp([Z,new Jp(te,De,le.length,re),new Xp(x,Ce,De,b),new Ih(x,Ce,S),X,J,Q]);E.walk((qe)=>{if(qe instanceof cs&&!Oe.has(qe))qe.resolve(Pe);return!0});let tt=E.toString(),ze=tt.slice(pe);pe=tt.length;let rt=Yt.replace(we,ze);rt.identifier={major:Se,minor:0},rt._isTracked=!0,w.push(rt)}return I.ensureFinalTabstop(E,g,!0),{edits:w,snippets:[new Uo(n,E,"")]}}constructor(n,h,g=mE,p){this._editor=n,this._template=h,this._options=g,this._languageConfigurationService=p,this._templateMerges=[],this._snippets=[]}dispose(){Ve(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(n){if(!this._editor.hasModel())return;let{edits:h,snippets:g}=typeof this._template==="string"?wn.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):wn.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=g,this._editor.executeEdits(n??Xn.snippet(),h,(p)=>{let f=p.filter((b)=>!!b.identifier);for(let b=0;b<g.length;b++)g[b].initialize(f[b].textChange);if(this._snippets[0].hasPlaceholder)return this._move(!0);else return f.map((b)=>F.fromPositions(b.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(n,h=mE){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,n]);let{edits:g,snippets:p}=wn.createEditsAndSnippetsFromSelections(this._editor,n,h.overwriteBefore,h.overwriteAfter,!0,h.adjustWhitespace,h.clipboardText,h.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",g,(f)=>{let b=f.filter((x)=>!!x.identifier);for(let x=0;x<p.length;x++)p[x].initialize(b[x].textChange);let S=p[0].isTrivialSnippet,w=p.length===this._snippets.reduce((x,I)=>x+I.activePlaceholderCount,0);if(!S&&w){for(let x of this._snippets)x.merge(p);console.assert(p.length===0)}if(this._snippets[0].hasPlaceholder&&!S&&w)return this._move(void 0);else return b.map((x)=>F.fromPositions(x.range.getEndPosition()))})}next(){let n=this._move(!0);if(n.length>0)this._editor.setSelections(n),this._editor.revealPositionInCenterIfOutsideViewport(n[0].getPosition())}prev(){let n=this._move(!1);if(n.length>0)this._editor.setSelections(n),this._editor.revealPositionInCenterIfOutsideViewport(n[0].getPosition())}_move(n){let h=[];for(let g of this._snippets){let p=g.move(n);h.push(...p)}return h}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 n=this._editor.getSelections();if(n.length<this._snippets.length)return!1;let h=new Map;for(let g of this._snippets){let p=g.computePossibleSelections();if(h.size===0)for(let[f,b]of p){b.sort(t.compareRangesUsingStarts);for(let S of n)if(b[0].containsRange(S)){h.set(f,[]);break}}if(h.size===0)return!1;h.forEach((f,b)=>{f.push(...p.get(b))})}n.sort(t.compareRangesUsingStarts);for(let[g,p]of h){if(p.length!==n.length){h.delete(g);continue}p.sort(t.compareRangesUsingStarts);for(let f=0;f<p.length;f++)if(!p[f].containsRange(n[f])){h.delete(g);continue}}return h.size>0}};_l=wn=ZT([XT(3,ht)],_l);var YT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},im=function(u,n){return function(h,g){n(h,g,u)}},sd,fE={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0},zt=class u{static{sd=this}static{this.ID="snippetController2"}static get(n){return n.getContribution(sd.ID)}static{this.InSnippetMode=new P("inSnippetMode",!1,e(1471,"Whether the editor in current in snippet mode"))}static{this.HasNextTabstop=new P("hasNextTabstop",!1,e(1472,"Whether there is a next tab stop when in snippet mode"))}static{this.HasPrevTabstop=new P("hasPrevTabstop",!1,e(1473,"Whether there is a previous tab stop when in snippet mode"))}static{this.InSnippetChoice=new P("inSnippetChoice",!1,e(1474,"Whether the current snippet tab stop is a choice"))}constructor(n,h,g,p,f){this._editor=n,this._logService=h,this._languageFeaturesService=g,this._languageConfigurationService=f,this._inSnippetObservable=j(this,!1),this._snippetListener=new d,this._modelVersionId=-1,this._inSnippet=sd.InSnippetMode.bindTo(p),this._hasNextTabstop=sd.HasNextTabstop.bindTo(p),this._hasPrevTabstop=sd.HasPrevTabstop.bindTo(p),this._inSnippetChoice=sd.InSnippetChoice.bindTo(p)}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(n,h){try{this._doInsert(n,typeof h>"u"?fE:{...fE,...h})}catch(g){this.cancel(),this._logService.error(g),this._logService.error("snippet_error"),this._logService.error("insert_template=",n),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(n,h){if(!this._editor.hasModel())return;if(this._snippetListener.clear(),h.undoStopBefore)this._editor.getModel().pushStackElement();if(this._session&&typeof n!=="string")this.cancel();if(!this._session)this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new _l(this._editor,n,h,this._languageConfigurationService),this._session.insert(h.reason);else He(typeof n==="string"),this._session.merge(n,h);if(h.undoStopAfter)this._editor.getModel().pushStackElement();if(this._session?.hasChoice){let g={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(x,I)=>{if(!this._session||x!==this._editor.getModel()||!s.equals(this._editor.getPosition(),I))return;let{activeChoice:E}=this._session;if(!E||E.choice.options.length===0)return;let Z=x.getValueInRange(E.range),X=Boolean(E.choice.options.find((Q)=>Q.value===Z)),J=[];for(let Q=0;Q<E.choice.options.length;Q++){let te=E.choice.options[Q];J.push({kind:13,label:te.value,insertText:te.value,sortText:"a".repeat(Q+1),range:E.range,filterText:X?`${Z}_${te.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:e(1475,"Go to next placeholder...")}})}return{suggestions:J}}},p=this._editor.getModel(),f,b=!1,S=()=>{f?.dispose(),b=!1},w=()=>{if(!b)f=this._languageFeaturesService.completionProvider.register({language:p.getLanguageId(),pattern:p.uri.fsPath,scheme:p.uri.scheme,exclusive:!0},g),this._snippetListener.add(f),b=!0};this._choiceCompletions={provider:g,enable:w,disable:S}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent((g)=>g.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())return;if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0,this._inSnippetChoice.reset();return}let{activeChoice:n}=this._session;if(!n||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0,this._inSnippetChoice.reset();return}if(this._inSnippetChoice.set(!0),this._currentChoice!==n.choice)this._currentChoice=n.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{pE(this._editor,this._choiceCompletions.provider)})}finish(){while(this._inSnippet.get())this.next()}cancel(n=!1){if(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,n)this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return Boolean(this._inSnippet.get())}get isInSnippetObservable(){return this._inSnippetObservable}};zt=sd=YT([im(1,Ze),im(2,V),im(3,K),im(4,ht)],zt);fe(zt.ID,zt,4);var nm=nn.bindToContribution(zt.get);G(new nm({id:"jumpToNextSnippetPlaceholder",precondition:L.and(zt.InSnippetMode,zt.HasNextTabstop),handler:(u)=>u.next(),kbOpts:{weight:130,kbExpr:o.textInputFocus,primary:2}}));G(new nm({id:"jumpToPrevSnippetPlaceholder",precondition:L.and(zt.InSnippetMode,zt.HasPrevTabstop),handler:(u)=>u.prev(),kbOpts:{weight:130,kbExpr:o.textInputFocus,primary:1026}}));Dn.registerKeybindingRule({id:"jumpToPrevSnippetPlaceholder",weight:191,when:L.and(zt.InSnippetMode,zt.HasPrevTabstop,zt.InSnippetChoice,o.textInputFocus),primary:1026});G(new nm({id:"leaveSnippet",precondition:zt.InSnippetMode,handler:(u)=>u.cancel(!0),kbOpts:{weight:130,kbExpr:o.textInputFocus,primary:9,secondary:[1033]}}));G(new nm({id:"acceptSnippet",precondition:zt.InSnippetMode,handler:(u)=>u.finish()}));class am{constructor(u,n){this.leadingLineContent=u,this.characterCountDelta=n}}class or{constructor(u,n,h,g,p,f,b=jv.default,S=void 0){if(this.clipboardText=S,this._snippetCompareFn=or._compareCompletionItems,this._items=u,this._column=n,this._wordDistance=g,this._options=p,this._refilterKind=1,this._lineContext=h,this._fuzzyScoreOptions=b,f==="top")this._snippetCompareFn=or._compareCompletionItemsSnippetsUp;else if(f==="bottom")this._snippetCompareFn=or._compareCompletionItemsSnippetsDown}get lineContext(){return this._lineContext}set lineContext(u){if(this._lineContext.leadingLineContent!==u.leadingLineContent||this._lineContext.characterCountDelta!==u.characterCountDelta)this._refilterKind=this._lineContext.characterCountDelta<u.characterCountDelta&&this._filteredItems?2:1,this._lineContext=u}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();let u=new Set;for(let[n,h]of this.getItemsByProvider())if(h.length>0&&h[0].container.incomplete)u.add(n);return u}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){if(this._refilterKind!==0)this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;let u=[],{leadingLineContent:n,characterCountDelta:h}=this._lineContext,g="",p="",f=this._refilterKind===1?this._items:this._filteredItems,b=[],S=!this._options.filterGraceful||f.length>2000?kd:B2;for(let w=0;w<f.length;w++){let x=f[w];if(x.isInvalid)continue;let I=this._itemsByProvider.get(x.provider);if(I)I.push(x);else this._itemsByProvider.set(x.provider,[x]);let E=x.position.column-x.editStart.column,Z=E+h-(x.position.column-this._column);if(g.length!==Z)g=Z===0?"":n.slice(-Z),p=g.toLowerCase();if(x.word=g,Z===0)x.score=is.Default;else{let X=0;while(X<E){let J=g.charCodeAt(X);if(J===32||J===9)X+=1;else break}if(X>=Z)x.score=is.Default;else if(typeof x.completion.filterText==="string"){let J=S(g,p,X,x.completion.filterText,x.filterTextLow,0,this._fuzzyScoreOptions);if(!J)continue;if(Y_(x.completion.filterText,x.textLabel)===0)x.score=J;else x.score=H2(g,p,X,x.textLabel,x.labelLow,0),x.score[0]=J[0]}else{let J=S(g,p,X,x.textLabel,x.labelLow,0,this._fuzzyScoreOptions);if(!J)continue;x.score=J}}x.idx=w,x.distance=this._wordDistance.distance(x.position,x.completion),b.push(x),u.push(x.textLabel.length)}this._filteredItems=b.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:u.length?X1(u.length-0.85,u,(w,x)=>w-x):0}}static _compareCompletionItems(u,n){if(u.score[0]>n.score[0])return-1;else if(u.score[0]<n.score[0])return 1;else if(u.distance<n.distance)return-1;else if(u.distance>n.distance)return 1;else if(u.idx<n.idx)return-1;else if(u.idx>n.idx)return 1;else return 0}static _compareCompletionItemsSnippetsDown(u,n){if(u.completion.kind!==n.completion.kind){if(u.completion.kind===28)return 1;else if(n.completion.kind===28)return-1}return or._compareCompletionItems(u,n)}static _compareCompletionItemsSnippetsUp(u,n){if(u.completion.kind!==n.completion.kind){if(u.completion.kind===28)return-1;else if(n.completion.kind===28)return 1}return or._compareCompletionItems(u,n)}}var JT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},_E=function(u,n){return function(h,g){n(h,g,u)}},Lh;class dm{constructor(u){this.name=u}select(u,n,h){if(h.length===0)return 0;let g=h[0].score[0];for(let p=0;p<h.length;p++){let{score:f,completion:b}=h[p];if(f[0]!==g)break;if(b.preselect)return p}return 0}}class OS extends dm{constructor(){super("first")}memorize(u,n,h){}toJSON(){return}fromJSON(){}}class bE extends dm{constructor(){super("recentlyUsed");this._cache=new Yi(300,0.66),this._seq=0}memorize(u,n,h){let g=`${u.getLanguageId()}/${h.textLabel}`;this._cache.set(g,{touch:this._seq++,type:h.completion.kind,insertText:h.completion.insertText})}select(u,n,h){if(h.length===0)return 0;let g=u.getLineContent(n.lineNumber).substr(n.column-10,n.column-1);if(/\s$/.test(g))return super.select(u,n,h);let p=h[0].score[0],f=-1,b=-1,S=-1;for(let w=0;w<h.length;w++){if(h[w].score[0]!==p)break;let x=`${u.getLanguageId()}/${h[w].textLabel}`,I=this._cache.peek(x);if(I&&I.touch>S&&I.type===h[w].completion.kind&&I.insertText===h[w].completion.insertText)S=I.touch,b=w;if(h[w].completion.preselect&&f===-1)return f=w}if(b!==-1)return b;else if(f!==-1)return f;else return 0}toJSON(){return this._cache.toJSON()}fromJSON(u){this._cache.clear();let n=0;for(let[h,g]of u)g.touch=n,g.type=typeof g.type==="number"?g.type:Jh.fromString(g.type),this._cache.set(h,g);this._seq=this._cache.size}}class vE extends dm{constructor(){super("recentlyUsedByPrefix");this._trie=Qf.forStrings(),this._seq=0}memorize(u,n,h){let{word:g}=u.getWordUntilPosition(n),p=`${u.getLanguageId()}/${g}`;this._trie.set(p,{type:h.completion.kind,insertText:h.completion.insertText,touch:this._seq++})}select(u,n,h){let{word:g}=u.getWordUntilPosition(n);if(!g)return super.select(u,n,h);let p=`${u.getLanguageId()}/${g}`,f=this._trie.get(p);if(!f)f=this._trie.findSubstr(p);if(f)for(let b=0;b<h.length;b++){let{kind:S,insertText:w}=h[b].completion;if(S===f.type&&w===f.insertText)return b}return super.select(u,n,h)}toJSON(){let u=[];return this._trie.forEach((n,h)=>u.push([h,n])),u.sort((n,h)=>-(n[1].touch-h[1].touch)).forEach((n,h)=>n[1].touch=h),u.slice(0,200)}fromJSON(u){if(this._trie.clear(),u.length>0){this._seq=u[0][1].touch+1;for(let[n,h]of u)h.type=typeof h.type==="number"?h.type:Jh.fromString(h.type),this._trie.set(n,h)}}}var MS=class u{static{Lh=this}static{this._strategyCtors=new Map([["recentlyUsedByPrefix",vE],["recentlyUsed",bE],["first",OS]])}static{this._storagePrefix="suggest/memories"}constructor(n,h){this._storageService=n,this._configService=h,this._disposables=new d,this._persistSoon=new ke(()=>this._saveState(),500),this._disposables.add(n.onWillSaveState((g)=>{if(g.reason===Lc.SHUTDOWN)this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(n,h,g){this._withStrategy(n,h).memorize(n,h,g),this._persistSoon.schedule()}select(n,h,g){return this._withStrategy(n,h).select(n,h,g)}_withStrategy(n,h){let g=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:n.getLanguageIdAtPosition(h.lineNumber,h.column),resource:n.uri});if(this._strategy?.name!==g){this._saveState();let p=Lh._strategyCtors.get(g)||OS;this._strategy=new p;try{let b=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,S=this._storageService.get(`${Lh._storagePrefix}/${g}`,b);if(S)this._strategy.fromJSON(JSON.parse(S))}catch(f){}}return this._strategy}_saveState(){if(this._strategy){let h=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,g=JSON.stringify(this._strategy);this._storageService.store(`${Lh._storagePrefix}/${this._strategy.name}`,g,h,1)}}};MS=Lh=JT([_E(0,Mn),_E(1,oe)],MS);var bl=ie("ISuggestMemories");_e(bl,MS,1);var SE;function lm(u){return SE?.(u)??null}function wE(u){SE=u}class dt{static{this.inlineSuggestionVisible=new P("inlineSuggestionVisible",!1,e(1249,"Whether an inline suggestion is visible"))}static{this.inlineSuggestionAlternativeActionVisible=new P("inlineSuggestionAlternativeActionVisible",!1,e(1250,"Whether an alternative action for the inline suggestion is visible."))}static{this.inlineSuggestionHasIndentation=new P("inlineSuggestionHasIndentation",!1,e(1251,"Whether the inline suggestion starts with whitespace"))}static{this.inlineSuggestionHasIndentationLessThanTabSize=new P("inlineSuggestionHasIndentationLessThanTabSize",!0,e(1252,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab"))}static{this.suppressSuggestions=new P("inlineSuggestionSuppressSuggestions",void 0,e(1253,"Whether suggestions should be suppressed for the current suggestion"))}static{this.cursorBeforeGhostText=new P("cursorBeforeGhostText",!1,e(1254,"Whether the cursor is at ghost text"))}static{this.cursorInIndentation=new P("cursorInIndentation",!1,e(1255,"Whether the cursor is in indentation"))}static{this.hasSelection=new P("editor.hasSelection",!1,e(1256,"Whether the editor has a selection"))}static{this.cursorAtInlineEdit=new P("cursorAtInlineEdit",!1,e(1257,"Whether the cursor is at an inline edit"))}static{this.inlineEditVisible=new P("inlineEditIsVisible",!1,e(1258,"Whether an inline edit is visible"))}static{this.tabShouldJumpToInlineEdit=new P("tabShouldJumpToInlineEdit",!1,e(1259,"Whether tab should jump to an inline edit."))}static{this.tabShouldAcceptInlineEdit=new P("tabShouldAcceptInlineEdit",!1,e(1260,"Whether tab should accept the inline edit."))}static{this.inInlineEditsPreviewEditor=new P("inInlineEditsPreviewEditor",!0,e(1261,"Whether the current code editor is showing an inline edits preview"))}}class $o{static{this.None=new class extends $o{distance(){return 0}}}static async create(u,n){if(!n.getOption(134).localityBonus)return $o.None;if(!n.hasModel())return $o.None;let h=n.getModel(),g=n.getPosition();if(!u.canComputeWordRanges(h.uri))return $o.None;let[p]=await new lo().provideSelectionRanges(h,[g]);if(p.length===0)return $o.None;let f=await u.computeWordRanges(h.uri,p[0].range);if(!f)return $o.None;let b=h.getWordUntilPosition(g);return delete f[b.word],new class extends $o{distance(S,w){if(!g.equals(n.getPosition()))return 0;if(w.kind===17)return 2097152;let x=typeof w.label==="string"?w.label:w.label.label,I=f[x];if(Q1(I))return 2097152;let E=Cg(I,t.fromPositions(S),t.compareRangesUsingStarts),Z=E>=0?I[E]:I[Math.max(0,~E-1)],X=p.length;for(let J of p){if(!t.containsRange(J.range,Z))break;X-=1}return X}}}}var QT=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Ys=function(u,n){return function(h,g){n(h,g,u)}},PS;class Js{static shouldAutoTrigger(u){if(!u.hasModel())return!1;let n=u.getModel(),h=u.getPosition();n.tokenization.tokenizeIfCheap(h.lineNumber);let g=n.getWordAtPosition(h);if(!g)return!1;if(g.endColumn!==h.column&&g.startColumn+1!==h.column)return!1;if(!isNaN(Number(g.word)))return!1;return!0}constructor(u,n,h){this.leadingLineContent=u.getLineContent(n.lineNumber).substr(0,n.column-1),this.leadingWord=u.getWordUntilPosition(n),this.lineNumber=n.lineNumber,this.column=n.column,this.triggerOptions=h}}function tN(u,n,h){if(!Boolean(n.getContextKeyValue(dt.inlineSuggestionVisible.key)))return!0;let g=n.getContextKeyValue(dt.suppressSuggestions.key);if(g!==void 0)return!g;return!u.getOption(71).suppressSuggestions}function iN(u,n,h){if(!Boolean(n.getContextKeyValue("inlineSuggestionVisible")))return!0;let g=n.getContextKeyValue(dt.suppressSuggestions.key);if(g!==void 0)return!g;return!u.getOption(71).suppressSuggestions}var vl=PS=class u{constructor(n,h,g,p,f,b,S,w,x){this._editor=n,this._editorWorkerService=h,this._clipboardService=g,this._telemetryService=p,this._logService=f,this._contextKeyService=b,this._configurationService=S,this._languageFeaturesService=w,this._envService=x,this._toDispose=new d,this._triggerCharacterListener=new d,this._triggerQuickSuggest=new di,this._triggerState=void 0,this._completionDisposables=new d,this._onDidCancel=new r,this._onDidTrigger=new r,this._onDidSuggest=new r,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._currentSelection=this._editor.getSelection()||new F(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 I=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{I=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{I=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection((E)=>{if(!I)this._onCursorChange(E)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{if(!I&&this._triggerState!==void 0)this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){Ve(this._triggerCharacterListener),Ve([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 n=new Map;for(let g of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(let p of g.triggerCharacters||[]){let f=n.get(p);if(!f)f=new Set,n.set(p,f);f.add(g)}let h=(g)=>{if(!iN(this._editor,this._contextKeyService,this._configurationService))return;if(Js.shouldAutoTrigger(this._editor))return;if(!g){let b=this._editor.getPosition();g=this._editor.getModel().getLineContent(b.lineNumber).substr(0,b.column-1)}let p="";if(bc(g.charCodeAt(g.length-1))){if(Rn(g.charCodeAt(g.length-2)))p=g.substr(g.length-2)}else p=g.charAt(g.length-1);let f=n.get(p);if(f){let b=new Map;if(this._completionModel){for(let[S,w]of this._completionModel.getItemsByProvider())if(!f.has(S))b.set(S,w)}this.trigger({auto:!0,triggerKind:1,triggerCharacter:p,retrigger:Boolean(this._completionModel),clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:f,providerItemsToReuse:b}})}};this._triggerCharacterListener.add(this._editor.onDidType(h)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>h()))}get state(){if(!this._triggerState)return 0;else if(!this._triggerState.auto)return 1;else return 2}cancel(n=!1){if(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:n})}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){if(this._triggerState!==void 0)if(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel()))this.cancel();else this.trigger({auto:this._triggerState.auto,retrigger:!0})}_onCursorChange(n){if(!this._editor.hasModel())return;let h=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!n.selection.isEmpty()||n.reason!==0&&n.reason!==3||n.source!=="keyboard"&&n.source!=="deleteLeft"){this.cancel();return}if(this._triggerState===void 0&&n.reason===0){if(h.containsRange(this._currentSelection)||h.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))this._doTriggerQuickSuggest()}else if(this._triggerState!==void 0&&n.reason===3)this._refilterCompletionItems()}_onCompositionEnd(){if(this._triggerState===void 0)this._doTriggerQuickSuggest();else this._refilterCompletionItems()}_doTriggerQuickSuggest(){if($r.isAllOff(this._editor.getOption(102)))return;if(this._editor.getOption(134).snippetsPreventQuickSuggestions&&zt.get(this._editor)?.isInSnippet())return;this.cancel(),this._waitForInlineCompletions?.dispose(),this._waitForInlineCompletions=void 0,this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0)return;if(!Js.shouldAutoTrigger(this._editor))return;if(!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;let n=this._editor.getModel(),h=this._editor.getPosition(),g=this._editor.getOption(102);if($r.isAllOff(g))return;let p=!1;if(!$r.isAllOn(g)){n.tokenization.tokenizeIfCheap(h.lineNumber);let f=n.tokenization.getLineTokens(h.lineNumber),b=f.getStandardTokenType(f.findTokenIndexAtOffset(Math.max(h.column-1-1,0))),S=$r.valueFor(g,b);if(S==="off"||S==="inline")return;if(S==="offWhenInlineCompletions")p=this._languageFeaturesService.inlineCompletionsProvider.has(n)&&this._editor.getOption(71).enabled}if(!tN(this._editor,this._contextKeyService,this._configurationService))return;if(!this._languageFeaturesService.completionProvider.has(n))return;if(p)this._waitForInlineCompletionsAndTrigger(n,h);else this.trigger({auto:!0})},this._editor.getOption(103))}_waitForInlineCompletionsAndTrigger(n,h){let g=n.getVersionId(),p=lm(this._editor),f=p?.model.get();if(!p||!f){this.trigger({auto:!0});return}if(f.state.get()?.inlineSuggestion)return;let S=new d;this._waitForInlineCompletions=S;let w=(x)=>{if(S.dispose(),this._waitForInlineCompletions===S)this._waitForInlineCompletions=void 0;if(this._triggerState!==void 0)return;if(!x)return;let I=this._editor.getModel(),E=this._editor.getPosition();if(I===n&&I.getVersionId()===g&&E?.equals(h)&&this._editor.hasWidgetFocus())this.trigger({auto:!0})};yi(()=>{w(!0),f.stop("automatic")},750,S),l2(S,(x)=>{if(p.model.read(x)!==f){x.dispose(),w(!1);return}let E=f.status.read(x),Z=f.state.read(x);if(!Z&&E==="loading")return;x.dispose(),w(!Z)})}_refilterCompletionItems(){He(this._editor.hasModel()),He(this._triggerState!==void 0);let n=this._editor.getModel(),h=this._editor.getPosition(),g=new Js(n,h,{...this._triggerState,refilter:!0});this._onNewContext(g)}trigger(n){if(!this._editor.hasModel())return;let h=this._editor.getModel(),g=new Js(h,this._editor.getPosition(),n);this.cancel(n.retrigger),this._triggerState=n,this._onDidTrigger.fire({auto:n.auto,shy:n.shy??!1,position:this._editor.getPosition()}),this._context=g;let p={triggerKind:n.triggerKind??0};if(n.triggerCharacter)p={triggerKind:1,triggerCharacter:n.triggerCharacter};this._requestToken=new Je;let f=this._editor.getOption(128),b=1;switch(f){case"top":b=0;break;case"bottom":b=2;break}let{itemKind:S,showDeprecated:w}=PS.createSuggestFilter(this._editor),x=new rd(b,n.completionOptions?.kindFilter??S,n.completionOptions?.providerFilter,n.completionOptions?.providerItemsToReuse,w),I=$o.create(this._editorWorkerService,this._editor),E=xh(this._languageFeaturesService.completionProvider,h,this._editor.getPosition(),x,p,this._requestToken.token);Promise.all([E,I]).then(async([Z,X])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){Z.disposable.dispose();return}let J=n?.clipboardText;if(!J&&Z.needsClipboard)J=await this._clipboardService.readText();if(this._triggerState===void 0){Z.disposable.dispose();return}let Q=this._editor.getModel(),te=new Js(Q,this._editor.getPosition(),n),re={...jv.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new or(Z.items,this._context.column,{leadingLineContent:te.leadingLineContent,characterCountDelta:te.column-this._context.column},X,this._editor.getOption(134),this._editor.getOption(128),re,J),this._completionDisposables.add(Z.disposable),this._onNewContext(te),this._reportDurationsTelemetry(Z.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment){for(let le of Z.items)if(le.isInvalid)this._logService.warn(`[suggest] did IGNORE invalid completion item from ${le.provider._debugDisplayName}`,le.completion)}}).catch(ee)}_reportDurationsTelemetry(n){if(Math.random()>0.0001)return;setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(n)}),this._logService.debug("suggest.durations.json",n)})}static createSuggestFilter(n){let h=new Set;if(n.getOption(128)==="none")h.add(28);let p=n.getOption(134);if(!p.showMethods)h.add(0);if(!p.showFunctions)h.add(1);if(!p.showConstructors)h.add(2);if(!p.showFields)h.add(3);if(!p.showVariables)h.add(4);if(!p.showClasses)h.add(5);if(!p.showStructs)h.add(6);if(!p.showInterfaces)h.add(7);if(!p.showModules)h.add(8);if(!p.showProperties)h.add(9);if(!p.showEvents)h.add(10);if(!p.showOperators)h.add(11);if(!p.showUnits)h.add(12);if(!p.showValues)h.add(13);if(!p.showConstants)h.add(14);if(!p.showEnums)h.add(15);if(!p.showEnumMembers)h.add(16);if(!p.showKeywords)h.add(17);if(!p.showWords)h.add(18);if(!p.showColors)h.add(19);if(!p.showFiles)h.add(20);if(!p.showReferences)h.add(21);if(!p.showColors)h.add(22);if(!p.showFolders)h.add(23);if(!p.showTypeParameters)h.add(24);if(!p.showSnippets)h.add(28);if(!p.showUsers)h.add(25);if(!p.showIssues)h.add(26);return{itemKind:h,showDeprecated:p.showDeprecated}}_onNewContext(n){if(!this._context)return;if(n.lineNumber!==this._context.lineNumber){this.cancel();return}if(It(n.leadingLineContent)!==It(this._context.leadingLineContent)){this.cancel();return}if(n.column<this._context.column){if(n.leadingWord.word)this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});else this.cancel();return}if(!this._completionModel)return;if(n.leadingWord.word.length!==0&&n.leadingWord.startColumn>this._context.leadingWord.startColumn){if(Js.shouldAutoTrigger(this._editor)&&this._context){let g=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:g}})}return}if(n.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&n.leadingWord.word.length!==0){let h=new Map,g=new Set;for(let[p,f]of this._completionModel.getItemsByProvider())if(f.length>0&&f[0].container.incomplete)g.add(p);else h.set(p,f);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:g,providerItemsToReuse:h}})}else{let h=this._completionModel.lineContext,g=!1;if(this._completionModel.lineContext={leadingLineContent:n.leadingLineContent,characterCountDelta:n.column-this._context.column},this._completionModel.items.length===0){let p=Js.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(p&&this._context.leadingWord.endColumn<n.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(!this._context.triggerOptions.auto){if(this._completionModel.lineContext=h,g=this._completionModel.items.length>0,g&&n.leadingWord.word.length===0){this.cancel();return}}else{this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:n.triggerOptions,isFrozen:g})}}};vl=PS=QT([Ys(1,Mi),Ys(2,xi),Ys(3,Wn),Ys(4,Ze),Ys(5,K),Ys(6,oe),Ys(7,V),Ys(8,Bv)],vl);var CE=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Eh=function(u,n){return function(h,g){n(h,g,u)}};class yE{constructor(u,n,h,g,p,f,b){this.range=u,this.insertText=n,this.filterText=h,this.additionalTextEdits=g,this.command=p,this.gutterMenuLinkAction=f,this.completion=b,this.doNotLog=!0}}var AS=class u extends AI{constructor(n,h,g,p,f,b){super(f.disposable);this.model=n,this.line=h,this.word=g,this.completionModel=p,this._suggestMemoryService=b}canBeReused(n,h,g){return this.model===n&&this.line===h&&this.word.word.length>0&&this.word.startColumn===g.startColumn&&this.word.endColumn<g.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){let n=[],{items:h}=this.completionModel,g=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},h),p=Ie.slice(h,g),f=Ie.slice(h,0,g),b=5;for(let S of Ie.concat(p,f)){if(S.score===is.Default)continue;let w=new t(S.editStart.lineNumber,S.editStart.column,S.editInsertEnd.lineNumber,S.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),x=S.completion.insertTextRules&&S.completion.insertTextRules&4?{snippet:S.completion.insertText}:S.completion.insertText;if(n.push(new yE(w,x,S.filterTextLow??S.labelLow,S.completion.additionalTextEdits,S.completion.command,S.completion.action,S)),b-->=0)S.resolve(xe.None)}return n}};AS=CE([Eh(5,bl)],AS);var FS=class u extends i{constructor(n,h,g,p){super();this._languageFeatureService=n,this._clipboardService=h,this._suggestMemoryService=g,this._editorService=p,this._store.add(n.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(n,h,g,p){if(g.selectedSuggestionInfo)return;let f;for(let X of this._editorService.listCodeEditors())if(X.getModel()===n){f=X;break}if(!f)return;let b=f.getOption(102);if($r.isAllOff(b))return;n.tokenization.tokenizeIfCheap(h.lineNumber);let S=n.tokenization.getLineTokens(h.lineNumber),w=S.getStandardTokenType(S.findTokenIndexAtOffset(Math.max(h.column-1-1,0)));if($r.valueFor(b,w)!=="inline")return;let x=n.getWordAtPosition(h),I;if(!x?.word)I=this._getTriggerCharacterInfo(n,h);if(!x?.word&&!I)return;if(!x)x=n.getWordUntilPosition(h);if(x.endColumn!==h.column)return;let E,Z=n.getValueInRange(new t(h.lineNumber,1,h.lineNumber,h.column));if(!I&&this._lastResult?.canBeReused(n,h.lineNumber,x)){let X=new am(Z,h.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=X,this._lastResult.acquire(),E=this._lastResult}else{let X=await xh(this._languageFeatureService.completionProvider,n,h,new rd(void 0,vl.createSuggestFilter(f).itemKind,I?.providers),I&&{triggerKind:1,triggerCharacter:I.ch},p),J;if(X.needsClipboard)J=await this._clipboardService.readText();let Q=new or(X.items,h.column,new am(Z,0),$o.None,f.getOption(134),f.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},J);E=new AS(n,h.lineNumber,x,Q,X,this._suggestMemoryService)}return this._lastResult=E,E}handleItemDidShow(n,h){h.completion.resolve(xe.None)}disposeInlineCompletions(n){n.release()}_getTriggerCharacterInfo(n,h){let g=n.getValueInRange(t.fromPositions({lineNumber:h.lineNumber,column:h.column-1},h)),p=new Set;for(let f of this._languageFeatureService.completionProvider.all(n))if(f.triggerCharacters?.includes(g))p.add(f);if(p.size===0)return;return{providers:p,ch:g}}};FS=CE([Eh(0,V),Eh(1,xi),Eh(2,bl),Eh(3,Te)],FS);Vl(FS);var oN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},nN=function(u,n){return function(h,g){n(h,g,u)}};function IE(u){if(u instanceof HS)return u._instance;return u}class HS{constructor(u){this.instantiationService=u}init(...u){}}function LE(u){return u.get()}var xE=class u extends HS{constructor(n,h){super(h);this.init(n)}};xE=oN([nN(1,O)],xE);class ad{validateOrThrow(u){let n=this.validate(u);if(n.error)throw Error(n.error.message);return n.content}}class Dh extends ad{constructor(u){super();this.type=u}validate(u){if(typeof u!==this.type)return{content:void 0,error:{message:`Expected ${this.type}, but got ${typeof u}`}};return{content:u,error:void 0}}getJSONSchema(){return{type:this.type}}}var rN=new Dh("string");function EE(){return rN}new Dh("number");var sN=new Dh("boolean");function WS(){return sN}new Dh("object");class DE extends ad{validate(u){return{content:u,error:void 0}}getJSONSchema(){return{}}}function RE(){return new DE}class BS extends ad{validate(u){if(u!==void 0)return{content:void 0,error:{message:`Expected undefined, but got ${typeof u}`}};return{content:void 0,error:void 0}}getJSONSchema(){return{}}}function kE(){return new BS}class cm{constructor(u){this.validator=u}}function Rh(u){return new cm(u)}class TE extends ad{constructor(u){super();this.properties=u}validate(u){if(typeof u!=="object"||u===null)return{content:void 0,error:{message:"Expected object"}};let n={};for(let h in this.properties){let g=this.properties[h],p=u[h],f=g instanceof cm,b=f?g.validator:g;if(f&&p===void 0)continue;let{content:S,error:w}=b.validate(p);if(w)return{content:void 0,error:{message:`Error in property '${h}': ${w.message}`}};n[h]=S}return{content:n,error:void 0}}getJSONSchema(){let u=[],n={};for(let[g,p]of Object.entries(this.properties)){let f=p instanceof cm,b=f?p.validator:p;if(n[g]=b.getJSONSchema(),!f)u.push(g)}return{type:"object",properties:n,...u.length>0?{required:u}:{}}}}function NE(u){return new TE(u)}class OE extends ad{constructor(u){super();this.validators=u}validate(u){let n;for(let h of this.validators){let{content:g,error:p}=h.validate(u);if(!p)return{content:g,error:void 0};n=p}return{content:void 0,error:n}}getJSONSchema(){return{oneOf:GM(this.validators,(u)=>{if(u instanceof BS)return;return u.getJSONSchema()})}}}function ME(...u){return new OE(u)}class PE extends ad{constructor(u,n){super();this._ref=u,this._validator=n}validate(u){return this._validator.validate(u)}getJSONSchema(){return{$ref:this._ref}}}function AE(u,n){return new PE(u,n)}var aN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},FE=function(u,n){return function(h,g){n(h,g,u)}};function HE(u){return u.sourceId+" @@ "+JSON.stringify({...u,modelUri:u.modelUri?.toString(),sourceId:void 0})}var Sl=class u extends i{static cast(){return this}constructor(n,h,g){super();this._key=n,this._contextKeyService=h,this._dataChannelService=g,this._isEnabledContextKeyValue=dN("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map((p)=>p!==void 0)}log(n){if(!this._isEnabledContextKeyValue.get())return!1;return this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(n),!0}};Sl=aN([FE(1,K),FE(2,qv)],Sl);function dN(u,n){return je(n.onDidChangeContext,()=>n.getContextKeyValue(u))}var lN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},WE=function(u,n){return function(h,g){n(h,g,u)}},hm=class u extends i{constructor(n,h,g){super();this._editor=n,this._instantiationService=h,this._loggerService=g,this._structuredLogger=this._register(this._instantiationService.createInstance(Sl.cast(),"editor.inlineSuggest.logChangeReason.commandId"));let p=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),f=je(this,p.onDidChangeLogLevel,()=>p.getLevel());this._register(W((b)=>{if(!HI(f.read(b),lr.Trace))return;b.store.add(this._editor.onDidChangeModelContent((S)=>{if(this._editor.getModel()?.uri.scheme==="output")return;p.trace("onDidChangeModelContent: "+S.detailedReasons.map((w)=>w.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(W((b)=>{if(!(this._editor instanceof $c))return;if(!this._structuredLogger.isEnabled.read(b))return;b.store.add(this._editor.onDidChangeModelContent((S)=>{let w=this._editor.getModel();if(!w)return;let x=S.detailedReasons[0],I={...x.metadata,sourceId:"TextModel.setChangeReason",source:x.metadata.source,time:Date.now(),modelUri:w.uri,modelVersion:w.getVersionId()};setTimeout(()=>{this._structuredLogger.log(I)},0)}))}))}};hm=lN([WE(1,O),WE(2,uk)],hm);function dd(u){return new BE(u)}class BE extends s0{constructor(u){super();this._textModel=u}getOffset(u){return this._textModel.getOffsetAt(u)}getPosition(u){return this._textModel.getPositionAt(u)}}var cN=[];function VE(){return cN}function VS(u){return hN(u).map((h)=>h.getEndPosition())}function hN(u){let n=q_.createSortPermutation(u,Bn((p)=>p.range,t.compareRangesUsingStarts)),g=new jr(n.apply(u)).getNewRanges();return n.inverse().apply(g)}function KE(u,n){let h=dd(n),g=n.getValue();return u.map((b)=>h.getStringReplacement(b)).map((b)=>b.removeCommonSuffixPrefix(g)).map((b)=>h.getTextReplacement(b))}function zE(u,n){let h=j("result",[]),g=[];return n.add(W((p)=>{let f=u.read(p);Ye((b)=>{if(f.length!==g.length){g.length=f.length;for(let S=0;S<g.length;S++)if(!g[S])g[S]=j("item",f[S]);h.set([...g],b)}g.forEach((S,w)=>S.set(f[w],b))})})),h}class KS{constructor(u){this._contextKeyService=u}bind(u,n){return ks(u,this._contextKeyService,n instanceof Function?n:(h)=>n.read(h))}}function zS(u,n){return new Promise((h)=>{let g=void 0,p=setTimeout(()=>{if(g)g.dispose();h()},u);if(n)g=n.onCancellationRequested(()=>{if(clearTimeout(p),g)g.dispose();h()})})}class wl{static message(u){return new wl(void 0,u)}constructor(u,n=void 0){this.error=u,this.message=n}static is(u){return u instanceof wl}logError(){if(this.message)console.error(`ErrorResult: ${this.message}`,this.error);else console.error("ErrorResult: An unexpected error-case occurred, usually caused by invalid input.",this.error)}}class um{static startNow(u,n,h,g=UE){return new um(u,n,h,Date.now(),g)}constructor(u,n,h,g,p=UE){if(this.startValue=u,this.endValue=n,this.durationMs=h,this.startTimeMs=g,this._interpolationFunction=p,u===n)this.durationMs=0}isFinished(u){return u>=this.startTimeMs+this.durationMs}getValue(u){let n=u-this.startTimeMs;if(n>=this.durationMs)return this.endValue;return this._interpolationFunction(n,this.startValue,this.endValue-this.startValue,this.durationMs)}}function UE(u,n,h,g){return u===g?n+h:h*(-Math.pow(2,-10*u/g)+1)+n}function $E(u,n,h,g){return h*((u=u/g-1)*u*u+1)+n}class US{constructor(u){this._value=u}getValue(u){let n=Date.now();if(!this._value.isFinished(n))hv.instance.invalidateOnNextAnimationFrame(u);return this._value.getValue(n)}isFinished(u){let n=Date.now(),h=this._value.isFinished(n);if(!h)hv.instance.invalidateOnNextAnimationFrame(u);return h}}class hv{constructor(){this._counter=ar(this),this._isScheduled=!1}static{this.instance=new hv}invalidateOnNextAnimationFrame(u){if(this._counter.read(u),!this._isScheduled)this._isScheduled=!0,Ke().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()})}_update(){this._counter.trigger(void 0)}}class qr{constructor(u,n){this.lineNumber=u,this.parts=n,ua(()=>cu(n,(h,g)=>h.column<=g.column))}equals(u){return this.lineNumber===u.lineNumber&&this.parts.length===u.parts.length&&this.parts.every((n,h)=>n.equals(u.parts[h]))}renderForScreenReader(u){if(this.parts.length===0)return"";let n=this.parts[this.parts.length-1],h=u.substr(0,n.column-1);return new jr([...this.parts.map((p)=>new gt(t.fromPositions(new s(1,p.column)),p.lines.map((f)=>f.line).join(`
|
|
34
|
+
`)))]).applyToString(h).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every((u)=>u.lines.length===0)}get lineCount(){return 1+this.parts.reduce((u,n)=>u+n.lines.length-1,0)}}class ld{constructor(u,n,h,g=[]){this.column=u,this.text=n,this.preview=h,this._inlineDecorations=g,this.lines=Ci(this.text).map((p,f)=>({line:p,lineDecorations:Qi.filter(this._inlineDecorations,f+1,1,p.length+1)}))}equals(u){return this.column===u.column&&this.lines.length===u.lines.length&&this.lines.every((n,h)=>n.line===u.lines[h].line&&Qi.equalsArr(n.lineDecorations,u.lines[h].lineDecorations))}}class kh{constructor(u,n,h,g=0){this.lineNumber=u,this.columnRange=n,this.text=h,this.additionalReservedLineCount=g,this.parts=[new ld(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=Ci(this.text)}renderForScreenReader(u){return this.newLines.join(`
|
|
35
|
+
`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every((u)=>u.lines.length===0)}equals(u){return this.lineNumber===u.lineNumber&&this.columnRange.equals(u.columnRange)&&this.newLines.length===u.newLines.length&&this.newLines.every((n,h)=>n===u.newLines[h])&&this.additionalReservedLineCount===u.additionalReservedLineCount}}function $S(u,n){return ot(u,n,jS)}function jS(u,n){if(u===n)return!0;if(!u||!n)return!1;if(u instanceof qr&&n instanceof qr)return u.equals(n);if(u instanceof kh&&n instanceof kh)return u.equals(n);return!1}function Lo(u,n,h){let g=h?u.range.intersectRanges(h):u.range;if(!g)return u;let p=u.text.replaceAll(`\r
|
|
36
|
+
`,`
|
|
37
|
+
`),f=n.getValueInRange(g,1),b=Ar(f,p),S=Kt.ofText(f.substring(0,b)).addToPosition(u.range.getStartPosition()),w=p.substring(b),x=t.fromPositions(S,u.range.getEndPosition());return new gt(x,w)}function gm(u,n){return u.text.startsWith(n.text)&&uN(u.range,n.range)}function uN(u,n){return n.getStartPosition().equals(u.getStartPosition())&&n.getEndPosition().isBeforeOrEqual(u.getEndPosition())}function GS(u,n,h,g,p=0){let f=Lo(u,n);if(f.range.endLineNumber!==f.range.startLineNumber)return;let b=n.getLineContent(f.range.startLineNumber),S=It(b).length;if(f.range.startColumn-1<=S){let J=It(f.text).length,Q=b.substring(f.range.startColumn-1,S),[te,re]=[f.range.getStartPosition(),f.range.getEndPosition()],le=te.column+Q.length<=re.column?te.delta(0,Q.length):re,pe=t.fromPositions(le,re),Se=f.text.startsWith(Q)?f.text.substring(Q.length):f.text.substring(J);f=new gt(pe,Se)}let x=n.getValueInRange(f.range),I=gN(x,f.text);if(!I)return;let E=f.range.startLineNumber,Z=[];if(h==="prefix"){let J=I.filter((Q)=>Q.originalLength===0);if(J.length>1||J.length===1&&J[0].originalStart!==x.length)return}let X=f.text.length-p;for(let J of I){let Q=f.range.startColumn+J.originalStart+J.originalLength;if(h==="subwordSmart"&&g&&g.lineNumber===f.range.startLineNumber&&Q<g.column)return;if(J.originalLength>0)return;if(J.modifiedLength===0)continue;let te=J.modifiedStart+J.modifiedLength,re=Math.max(J.modifiedStart,Math.min(te,X)),le=f.text.substring(J.modifiedStart,re),pe=f.text.substring(re,Math.max(J.modifiedStart,te));if(le.length>0)Z.push(new ld(Q,le,!1));if(pe.length>0)Z.push(new ld(Q,pe,!0))}return new qr(E,Z)}var pm=void 0;function gN(u,n){if(pm?.originalValue===u&&pm?.newValue===n)return pm?.changes;else{let h=GE(u,n,!0);if(h){let g=jE(h);if(g>0){let p=GE(u,n,!1);if(p&&jE(p)<g)h=p}}return pm={originalValue:u,newValue:n,changes:h},h}}function jE(u){let n=0;for(let h of u)n+=h.originalLength;return n}function GE(u,n,h){if(u.length>5000||n.length>5000)return;function g(x){let I=0;for(let E=0,Z=x.length;E<Z;E++){let X=x.charCodeAt(E);if(X>I)I=X}return I}let p=Math.max(g(u),g(n));function f(x){if(x<0)throw Error("unexpected");return p+x+1}function b(x){let I=0,E=0,Z=new Int32Array(x.length);for(let X=0,J=x.length;X<J;X++)if(h&&x[X]==="("){let Q=E*100+I;Z[X]=f(2*Q),I++}else if(h&&x[X]===")"){I=Math.max(I-1,0);let Q=E*100+I;if(Z[X]=f(2*Q+1),I===0)E++}else Z[X]=x.charCodeAt(X);return Z}let S=b(u),w=b(n);return new ba({getElements:()=>S},{getElements:()=>w}).ComputeDiff(!1).changes}function qE(u,n){let h=void 0,g=!1,p=new Q_(new vi(u,void 0,n.update),(f,b)=>{if(!g)h=n.initial instanceof Function?n.initial():n.initial,g=!0;let S=n.update(f,h,b);return h=S,S},n.changeTracker,()=>{if(g)n.disposeFinal?.(h),g=!1},n.equalityComparer??Gr,(f,b,S)=>{if(!g)throw new H("Can only set when there is a listener! This is to prevent leaks.");md(b,(w)=>{h=f,p.setValue(f,w,S)})},Jt.ofCaller());return p}var pN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ZE=function(u,n){return function(h,g){n(h,g,u)}};class XE{constructor(u,n){this._baseService=u,this._intercept=n}publicLog2(u,n){this._intercept(u,n),this._baseService.publicLog2(u,n)}}var mm=class u extends XE{constructor(n,h){super(n,(g,p)=>{let f=!0;if(p&&qS in p)f=Boolean(p[qS]);if(f)h.getDataChannel("editTelemetry").sendData({eventName:g,data:p??{}})})}};mm=pN([ZE(0,Wn),ZE(1,qv)],mm);var qS=Symbol("shouldForwardToChannel");function YE(u){return{[qS]:u}}function ZS(u){if(!u)return!1;let n=u.toLowerCase();return n==="github.copilot"||n==="github.copilot-chat"}function JE(u,n){u.publicLog2("inlineCompletion.endOfLife",n)}var mN=new Set([";",",","=","+","-","*","/","{","}","(",")","[","]","<",">",":",".","!","?","&","|","^","%","@","#","~","`","\\","'",'"',"$"]);function fN(u){return mN.has(u)}function _N(u){return/[a-zA-Z0-9_]/.test(u)}function bN(u){return u===" "||u==="\t"}function fm(u){let n=u.split(/\r\n|\r|\n/);if(n.length>1)return{kind:"multiLine",lineCount:n.length};let h=u.length===1,g;if(h){if(fN(u))g="syntactical";else if(_N(u))g="identifier";else if(bN(u))g="whitespace"}let p=u.match(/[ \t]+/g)||[],f=p.some((I)=>I.length>1),b=p.some((I)=>I.includes(" ")||I.includes("\t\t")),S=u.split(/\s+/).filter((I)=>I.length>0),w=S.length===1&&/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(S[0]),x=S.length>1;return{kind:"singleLine",isSingleCharacter:h,singleCharacterKind:g,isWord:w,isMultipleWords:x,isMultipleWhitespace:f,hasDuplicatedWhitespace:b}}class QE{constructor(u){this.edits=u}toString(){return JSON.stringify({edits:this.edits})}}function YS(u,n,h){if(u.replacements.length===0)return;return new QE(u.replacements.map((g)=>vN(g,n)))}function XS(u){if(u.length===0)return 0;return u.split(/\r\n|\r|\n/).length-1}function vN(u,n,h){let{replaceRange:g,newText:p}=u,f=g.length,b=p.length,S=XS(p);switch(g.isEmpty?"insert":p.length===0?"delete":"replace"){case"insert":return{operation:"insert",properties:SN(g.start,p,n),charactersInserted:b,charactersDeleted:0,linesInserted:S,linesDeleted:0};case"delete":{let x=n.getValue().substring(g.start,g.endExclusive);return{operation:"delete",properties:wN(g.start,g.endExclusive,n),charactersInserted:0,charactersDeleted:f,linesInserted:0,linesDeleted:XS(x)}}case"replace":{let x=n.getValue().substring(g.start,g.endExclusive);return{operation:"replace",properties:CN(x,p),charactersInserted:b,charactersDeleted:f,linesInserted:S,linesDeleted:XS(x)}}}}function SN(u,n,h,g){let p=fm(n),f=h.getPositionAt(u),b=h.getLineContent(f.lineNumber),S=b.length,w,x=b.trim().length===0,I=f.column>S,E=f.column===1;if(x)w="emptyLine";else if(I)w="endOfLine";else if(E)w="startOfLine";else w="middleOfLine";let Z;return{textShape:p,locationShape:w,relativeToCursor:Z}}function wN(u,n,h){let g=h.getValue().substring(u,n),p=fm(g),f=h.getPositionAt(u),b=h.getPositionAt(n),S=h.getLineContent(b.lineNumber),w=b.column>S.length,x=f.lineNumber===b.lineNumber&&f.column===1&&b.column>S.length;return{textShape:p,isAtEndOfLine:w,deletesEntireLineContent:x}}function CN(u,n){let h=fm(u),g=fm(n),p=h.kind==="singleLine"&&h.isWord,f=g.kind==="singleLine"&&g.isWord,b=p&&f,S=n.length>u.length,w=n.length<u.length,x=h.kind==="singleLine"&&g.kind==="singleLine",I=h.kind==="singleLine"&&g.kind==="multiLine",E=h.kind==="multiLine"&&g.kind==="singleLine";return{isWordToWordReplacement:b,isAdditive:S,isSubtractive:w,isSingleLineToSingleLine:x,isSingleLineToMultiLine:I,isMultiLineToSingleLine:E}}function _m(u,n,h,g){let p=Lo(u,h),f=u.range;if(!f||n&&!n.getStartPosition().equals(f.getStartPosition())||g.lineNumber!==p.range.startLineNumber||p.isEmpty)return!1;let b=h.getValueInRange(p.range,1),S=p.text,w=Math.max(0,g.column-p.range.startColumn),x=S.substring(0,w),I=S.substring(w),E=b.substring(0,w),Z=b.substring(w),X=h.getLineIndentColumn(p.range.startLineNumber);if(p.range.startColumn<=X){if(E=E.trimStart(),E.length===0)Z=Z.trimStart();if(x=x.trimStart(),x.length===0)I=I.trimStart()}return x.startsWith(E)&&!!JI(Z,I)}var bm;(function(u){function n(h){return h?.command.id??void 0}u.toString=n})(bm||(bm={}));class nr extends Dg{static snapshot(u){return new nr(u)}constructor(u){super();this._textModel=u,this._version=u.getVersionId()}get uri(){return this._textModel.uri}_assertValid(){if(this._textModel.getVersionId()!==this._version)ee(Error(`TextModel has changed: expected version ${this._version}, got ${this._textModel.getVersionId()}`))}targets(u){return this._textModel.uri.toString()===u.uri.toString()}getValueOfRange(u){return this._assertValid(),this._textModel.getValueInRange(u)}getLineLength(u){return this._assertValid(),this._textModel.getLineLength(u)}get length(){this._assertValid();let u=this._textModel.getLineCount(),n=this._textModel.getLineLength(u);return new Kt(u-1,n)}getEOL(){return this._assertValid(),this._textModel.getEOL()}getPositionAt(u){return this._assertValid(),this._textModel.getPositionAt(u)}getValueInRange(u){return this._assertValid(),this._textModel.getValueInRange(u)}getVersionId(){return this._version}dangerouslyGetUnderlyingModel(){return this._textModel}}var Cl;(function(u){function n(h,g,p=!0){if(!h.isInlineEdit&&!h.action?.uri&&h.action?.kind==="edit")return Th.create(h,g,h.action);else return Nh.create(h,g,p)}u.create=n})(Cl||(Cl={}));function yN(u){let n=u?.kind==="edit"?{...u,alternativeAction:bm.toString(u.alternativeAction),target:u?.target.uri.toString()}:{...u,target:u?.target.uri.toString()};return JSON.stringify(n)}class JS{constructor(u,n,h,g){this._data=u,this.identity=n,this.hint=h,this.originalTextRef=g}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===uo.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;else if(this.action?.kind==="jumpTo")return t.fromPositions(this.action.position);throw new H("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 yN(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(u,n,h,g,p){let f=this.action?.kind==="edit"?this.action.textReplacement.text:"";this._data.reportInlineEditShown(u,f,n,h,this.computeEditKind(g),p)}reportPartialAccept(u,n,h){this._data.reportPartialAccept(u,n,h)}reportEndOfLife(u){this._data.reportEndOfLife(u)}setEndOfLifeReason(u){this._data.setEndOfLifeReason(u)}setIsPreceeded(u){this._data.setIsPreceeded(u.partialAccepts)}setNotShownReasonIfNotSet(u){this._data.setNotShownReason(u)}getSourceCompletion(){return this._sourceInlineCompletion}setRenameProcessingInfo(u){this._data.setRenameProcessingInfo(u)}withAction(u){return this._data.withAction(u)}addPerformanceMarker(u){this._data.addPerformanceMarker(u)}}class Sm{constructor(){this._onDispose=ar(this),this.onDispose=this._onDispose,this._jumpedTo=j(this,!1),this._refCount=0,this.id="InlineCompletionIdentity"+Sm.idCounter++}static{this.idCounter=0}get jumpedTo(){return this._jumpedTo}addRef(){this._refCount++}removeRef(){if(this._refCount--,this._refCount===0)this._onDispose.trigger(void 0)}setJumpTo(u){this._jumpedTo.set(!0,u)}}class Oh{static create(u){return new Oh(t.lift(u.range),u.content,u.style)}constructor(u,n,h){this.range=u,this.content=n,this.style=h}withEdit(u,n){let h=new z(n.getOffset(this.range.getStartPosition()),n.getOffset(this.range.getEndPosition())),g=BI([h],u)[0];if(!g)return;let p=n.getRange(g);return new Oh(p,this.content,this.style)}}class Th extends JS{static create(u,n,h){let g=new Sm,p=n.getTransformer(),f=h.insertText.replace(/\r\n|\r|\n/g,n.getEOL()),b=LN(new ui(p.getOffsetRange(h.range),f),n),S=b.removeCommonSuffixAndPrefix(n.getValue()),w=p.getTextReplacement(b),x=u.hint?Oh.create(u.hint):void 0;return new Th(b,S,w,w.range,h.snippetInfo,u.additionalTextEdits,u,g,x,n)}constructor(u,n,h,g,p,f,b,S,w,x){super(b,S,w,x);this._edit=u,this._trimmedEdit=n,this._textEdit=h,this._originalRange=g,this.snippetInfo=p,this.additionalTextEdits=f,this.isInlineEdit=!1}get action(){return{kind:"edit",textReplacement:this.getSingleTextEdit(),snippetInfo:this.snippetInfo,stringEdit:new Sr([this._trimmedEdit]),alternativeAction:void 0,target:this.originalTextRef}}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(u){return new Th(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,u,this.hint,this.originalTextRef)}withEdit(u,n){if(!this.originalTextRef.targets(n))return this;let h=BI([this._edit.replaceRange],u);if(h.length===0)return;let g=new ui(h[0],this._textEdit.text),p=dd(n),f=p.getTextReplacement(g),b=this.hint;if(b){if(b=b.withEdit(u,p),!b)return}let S=g.removeCommonSuffixAndPrefix(n.getValue());return new Th(g,S,f,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,b,this.originalTextRef)}canBeReused(u,n){let h=this._textEdit.range;return!!h&&h.containsPosition(n)&&this.isVisible(u,n)&&Kt.ofRange(h).isGreaterThanOrEqualTo(Kt.ofRange(this._originalRange))}isVisible(u,n){let h=this.getSingleTextEdit();return _m(h,this._originalRange,u,n)}computeEditKind(u){return YS(new Sr([this._edit]),u)}get editRange(){return this.getSingleTextEdit().range}}class Nh extends JS{static create(u,n,h=!0){let g,p=[];if(u.action?.kind==="edit"){let S=h?xN(n,u.action.range,u.action.insertText):IN(n,u.action.range,u.action.insertText),w=jr.fromStringEdit(S,n),x=S.isEmpty()?new gt(new t(1,1,1,1),""):w.toReplacement(n);p=S.replacements.map((I)=>{let E=t.fromPositions(n.getPositionAt(I.replaceRange.start),n.getTransformer().getPosition(I.replaceRange.endExclusive)),Z=n.getValueInRange(E);return vm.create(I,Z)}),g={kind:"edit",snippetInfo:u.action.snippetInfo,stringEdit:S,textReplacement:x,alternativeAction:u.action.alternativeAction,target:n}}else if(u.action?.kind==="jumpTo")g={kind:"jumpTo",position:u.action.position,offset:n.getTransformer().getOffset(u.action.position),target:n};else if(g=void 0,!u.hint)throw new H("InlineEditItem: action is undefined and no hint is provided");let f=new Sm,b=u.hint?Oh.create(u.hint):void 0;return new Nh(g,u,f,p,b,!1,n.getVersionId(),n)}constructor(u,n,h,g,p,f=!1,b,S){super(n,h,p,S);this._action=u,this._edits=g,this._lastChangePartOfInlineEdit=f,this._inlineEditModelVersion=b,this.snippetInfo=void 0,this.additionalTextEdits=[],this.isInlineEdit=!0}get updatedEditModelVersion(){return this._inlineEditModelVersion}get action(){return this._action}withIdentity(u){return new Nh(this._action,this._data,u,this._edits,this.hint,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion,this.originalTextRef)}canBeReused(u,n){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===u.getVersionId()}withEdit(u,n){if(!this.originalTextRef.targets(n))return this;return this._applyTextModelChanges(u,this._edits,n)}_applyTextModelChanges(u,n,h){let g=dd(h),p=!1,f=this._inlineEditModelVersion,b,S=nr.snapshot(h);if(this.action?.kind==="edit"){if(n=n.map((Z)=>Z.applyTextModelChanges(u)),n.some((Z)=>Z.edit===void 0))return;let x=h.getVersionId();if(p=n.some((Z)=>Z.lastChangeUpdatedEdit),p)f=x??-1;if(x===null||f+20<x)return;if(n=n.filter((Z)=>!Z.edit.isEmpty),n.length===0)return;let I=new Sr(n.map((Z)=>Z.edit));b={kind:"edit",textReplacement:g.getTextEdit(I).toReplacement(new up(h)),snippetInfo:this.snippetInfo,stringEdit:I,alternativeAction:this.action.alternativeAction,target:S}}else if(this.action?.kind==="jumpTo"){let x=this.action.offset,I=u.applyToOffsetOrUndefined(x);if(I===void 0)return;b={kind:"jumpTo",position:g.getPosition(I),offset:I,target:S}}else b=void 0;let w=this.hint;if(w){if(w=w.withEdit(u,g),!w)return}return new Nh(b,this._data,this.identity,n,w,p,f,S)}computeEditKind(u){let n=this.action?.kind==="edit"?this.action.stringEdit:void 0;if(!n)return;return YS(n,u)}}function xN(u,n,h){let g=u.getEOL(),p=u.getValueOfRange(n),f=h.replace(/\r\n|\r|\n/g,g),w=Og.getDefault().computeDiff(Ci(p),Ci(f),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:50}).changes.flatMap((Z)=>Z.innerChanges??[]);function x(Z,X){let J=Kt.fromPosition(X.getStartPosition());return Kt.ofRange(X).createRange(J.addToPosition(Z))}let I=new Ol(f);return new Sr(w.map((Z)=>{let X=x(n.getStartPosition(),Z.originalRange),J=u.getTransformer().getOffsetRange(X),Q=I.getValueOfRange(Z.modifiedRange),te=new ui(J,Q),re=u.getValueOfRange(X);return EN(te,re,w.length,u)}))}function IN(u,n,h){return new Sr([new ui(u.getTransformer().getOffsetRange(n),h)])}class vm{static create(u,n){let h=Ar(u.newText,n),g=Bs(u.newText,n),p=u.newText.substring(h,u.newText.length-g);return new vm(u,p,h,g)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}constructor(u,n,h,g,p=!1){this._edit=u,this._trimmedNewText=n,this._prefixLength=h,this._suffixLength=g,this._lastChangeUpdatedEdit=p}applyTextModelChanges(u){let n=this._clone();return n._applyTextModelChanges(u),n}_clone(){return new vm(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(u){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new H("UpdatedInnerEdits: No edit to apply changes to");let n=this._applyChanges(this._edit,u);if(!n){this._edit=void 0;return}this._edit=n.edit,this._lastChangeUpdatedEdit=n.editHasChanged}_applyChanges(u,n){let h=u.replaceRange.start,g=u.replaceRange.endExclusive,p=u.newText,f=!1,b=this._prefixLength>0||this._suffixLength>0;for(let S=n.replacements.length-1;S>=0;S--){let w=n.replacements[S],x=w.newText.length>0&&w.replaceRange.isEmpty;if(x&&!b&&w.replaceRange.start===h&&p.startsWith(w.newText)){h+=w.newText.length,p=p.substring(w.newText.length),g+=w.newText.length,f=!0;continue}if(x&&b&&w.replaceRange.start===h+this._prefixLength&&this._trimmedNewText.startsWith(w.newText)){g+=w.newText.length,f=!0,this._prefixLength+=w.newText.length,this._trimmedNewText=this._trimmedNewText.substring(w.newText.length);continue}if(w.newText.length===0&&w.replaceRange.length>0&&w.replaceRange.start>=h+this._prefixLength&&w.replaceRange.endExclusive<=g-this._suffixLength){g-=w.replaceRange.length,f=!0;continue}if(w.equals(u)){f=!0,h=w.replaceRange.endExclusive,p="";continue}if(w.replaceRange.start>g)continue;if(w.replaceRange.endExclusive<h){h+=w.newText.length-w.replaceRange.length,g+=w.newText.length-w.replaceRange.length;continue}return}if(this._trimmedNewText.length===0&&h+this._prefixLength===g-this._suffixLength)return{edit:new ui(new z(h+this._prefixLength,h+this._prefixLength),""),editHasChanged:!0};return{edit:new ui(new z(h,g),p),editHasChanged:f}}}function LN(u,n){let h=n.getEOL();if(u.replaceRange.isEmpty&&u.newText.includes(h))u=m0(u,n);return u}function EN(u,n,h,g){let p=g.getEOL();if(u.newText.endsWith(p)&&n.endsWith(p))u=new ui(u.replaceRange.deltaEnd(-p.length),u.newText.slice(0,-p.length));if(h===1&&u.replaceRange.isEmpty&&u.newText.includes(p)){let f=g.getTransformer().getPosition(u.replaceRange.start);if(g.getLineLength(f.lineNumber)!==0)u=m0(u,g)}if(h===1){let f=Ar(n,u.newText),b=Bs(n.slice(f),u.newText.slice(f));if(f+b===n.length)return new ui(u.replaceRange.deltaStart(f).deltaEnd(-b),u.newText.substring(f,u.newText.length-b));if(f+b===u.newText.length)return new ui(u.replaceRange.deltaStart(f).deltaEnd(-b),"")}return u}function m0(u,n){if(!u.replaceRange.isEmpty)throw new H("Unexpected original range");if(u.replaceRange.start===0)return u;let h=n.getEOL(),g=n.getTransformer().getPosition(u.replaceRange.start),{column:p,lineNumber:f}=g;if(p===1&&f>1&&u.newText.endsWith(h)&&!u.newText.startsWith(h))return new ui(u.replaceRange.delta(-1),h+u.newText.slice(0,-h.length));return u}function P0(u,n){let h=new y0,g=new w0(h,(x)=>n.getLanguageConfiguration(x)),p=new v0(new H0([u]),g),f=x0(p,[],void 0,!0),b="",S=u.getLineContent();function w(x,I){if(x.kind===2){if(w(x.openingBracket,I),I=yn(I,x.openingBracket.length),x.child)w(x.child,I),I=yn(I,x.child.length);if(x.closingBracket)w(x.closingBracket,I),I=yn(I,x.closingBracket.length);else{let Z=g.getSingleLanguageBracketTokens(x.openingBracket.languageId).findClosingTokenText(x.openingBracket.bracketIds);b+=Z}}else if(x.kind===3);else if(x.kind===0||x.kind===1)b+=S.substring(Fv(I),Fv(yn(I,x.length)));else if(x.kind===4)for(let E of x.children)w(E,I),I=yn(I,E.length)}return w(f,mr),b}class H0{constructor(u){this.lines=u,this.tokenization={getLineTokens:(n)=>this.lines[n-1]}}getLineCount(){return this.lines.length}getLineLength(u){return this.lines[u-1].getLineContent().length}}var Nt;(function(u){u.Jump="jump",u.Accept="accept",u.Inactive="inactive"})(Nt||(Nt={}));class _o{static create(u,n=!1){return new _o(new ci(B(u),u),n)}constructor(u,n=!1){this.event=u,this.alternativeAction=n}}var Xe;(function(u){u.GhostText="ghostText",u.Custom="custom",u.SideBySide="sideBySide",u.Deletion="deletion",u.InsertionInline="insertionInline",u.InsertionMultiLine="insertionMultiLine",u.WordReplacements="wordReplacements",u.LineReplacement="lineReplacement",u.Collapsed="collapsed",u.JumpTo="jumpTo"})(Xe||(Xe={}));class yl{constructor(u,n,h,g,p,f,b,S){this.cursorColumnDistance=u,this.cursorLineDistance=n,this.lineCountOriginal=h,this.lineCountModified=g,this.characterCountOriginal=p,this.characterCountModified=f,this.disjointReplacements=b,this.sameShapeReplacements=S,this.longDistanceHintVisible=void 0,this.longDistanceHintDistance=void 0,this.isForAnotherDocument=void 0}setLongDistanceViewData(u,n){this.longDistanceHintVisible=!0,this.longDistanceHintDistance=Math.abs(n-u)}getData(){return{cursorColumnDistance:this.cursorColumnDistance,cursorLineDistance:this.cursorLineDistance,lineCountOriginal:this.lineCountOriginal,lineCountModified:this.lineCountModified,characterCountOriginal:this.characterCountOriginal,characterCountModified:this.characterCountModified,disjointReplacements:this.disjointReplacements,sameShapeReplacements:this.sameShapeReplacements,longDistanceHintVisible:this.longDistanceHintVisible,longDistanceHintDistance:this.longDistanceHintDistance,isForAnotherDocument:this.isForAnotherDocument}}}class wm{constructor(){this._nodes=new Set,this._outgoingEdges=new Map}static from(u,n){let h=new wm;for(let g of u)h._nodes.add(g);for(let g of u){let p=n(g);if(p.length>0){let f=new Set;for(let b of p)f.add(b);h._outgoingEdges.set(g,f)}}return h}removeCycles(){let u=[],n=new Set,h=new Set,g=[],p=(f)=>{n.add(f),h.add(f);let b=this._outgoingEdges.get(f);if(b){for(let S of b)if(!n.has(S))p(S);else if(h.has(S))u.push(S),g.push({from:f,to:S})}h.delete(f)};for(let f of this._nodes)if(!n.has(f))p(f);for(let{from:f,to:b}of g){let S=this._outgoingEdges.get(f);if(S)S.delete(b)}return{foundCycles:u}}getOutgoing(u){let n=this._outgoingEdges.get(u);return n?Array.from(n):[]}}function B0(u,n,h,g,p,f){let b=xk("icr"),S=new Je,w=void 0,x={...g,requestUuid:b},I=RN(n,h),E=A2(u,(re)=>re.groupId),Z=wm.from(u,(re)=>re.yieldsToGroupIds?.flatMap((le)=>E.get(le)??[])??[]),{foundCycles:X}=Z.removeCycles();if(X.length>0)vt(Error(`Inline completions: cyclic yield-to dependency detected. Path: ${X.map((re)=>re.toString?re.toString():""+re).join(" -> ")}`));let J=0,Q=new wv(async(re)=>{try{if(J++,S.token.isCancellationRequested)return;let le=Z.getOutgoing(re);for(let De of le){let Oe=await Q.get(De);if(Oe)for(let Me of Oe.inlineSuggestions.items){if(Me.isInlineEdit||typeof Me.insertText!=="string"&&Me.insertText!==void 0)return;if(Me.insertText!==void 0){let Ce=new gt(t.lift(Me.range)??I,Me.insertText);if(_m(Ce,void 0,h,n))return}}}let pe,Se=Date.now();try{pe=await re.provideInlineCompletions(h,n,x,S.token)}catch(De){vt(De);return}let we=Date.now();if(!pe)return;let ae=[],me=new z0(pe,ae,re);if(me.addRef(),QS(S.token,()=>me.removeRef(w)),S.token.isCancellationRequested)return;for(let De of pe.items){let Oe=DN(De,me,I,h,f,x,p,{startTime:Se,endTime:we});if(wl.is(Oe)){Oe.logError();continue}ae.push(Oe)}return me}finally{J--}}),te=ri.fromPromisesResolveOrder(u.map((re)=>Q.get(re))).filter(ni);return{contextWithUuid:x,get didAllProvidersReturn(){return J===0},lists:te,cancelAndDispose:(re)=>{if(w!==void 0)return;w=re,S.dispose(!0)}}}function QS(u,n){if(u.isCancellationRequested)return n(),i.None;else{let h=u.onCancellationRequested(()=>{h.dispose(),n()});return{dispose:()=>h.dispose()}}}function DN(u,n,h,g,p,f,b,S){let w,x=u.uri?q.revive(u.uri):void 0;if(u.jumpToPosition!==void 0)w={kind:"jumpTo",position:s.lift(u.jumpToPosition),uri:x};else if(u.insertText!==void 0){let I,E,Z=u.range?t.lift(u.range):h;if(typeof u.insertText==="string"){if(I=u.insertText,p&&u.completeBracketPairs){I=W0(I,Z.getStartPosition(),g,p);let X=I.length-u.insertText.length;if(X!==0)Z=new t(Z.startLineNumber,Z.startColumn,Z.endLineNumber,Z.endColumn+X)}E=void 0}else if("snippet"in u.insertText){let X=u.insertText.snippet.length;if(p&&u.completeBracketPairs){u.insertText.snippet=W0(u.insertText.snippet,Z.getStartPosition(),g,p);let Q=u.insertText.snippet.length-X;if(Q!==0)Z=new t(Z.startLineNumber,Z.startColumn,Z.endLineNumber,Z.endColumn+Q)}let J=new no().parse(u.insertText.snippet);if(J.children.length===1&&J.children[0]instanceof hi)I=J.children[0].value,E=void 0;else I=J.toString(),E={snippet:u.insertText.snippet,range:Z}}else pc(u.insertText);w={kind:"edit",range:Z,insertText:I,snippetInfo:E,uri:x,alternativeAction:void 0}}else if(w=void 0,!u.hint)return wl.message("Inline completion has no insertText, jumpToPosition nor hint.");return new V0(w,u.hint,u.additionalTextEdits||VE(),u,n,f,u.isInlineEdit??!1,u.supportsRename??!1,b,S,u.correlationId)}class V0{get action(){return this._action}constructor(u,n,h,g,p,f,b,S,w,x,I){this._action=u,this.hint=n,this.additionalTextEdits=h,this.sourceInlineCompletion=g,this.source=p,this.context=f,this.isInlineEdit=b,this.supportsRename=S,this._requestInfo=w,this._providerRequestInfo=x,this._correlationId=I,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 K0,this._viewData={editorType:w.editorType}}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(u,n,h,g,p,f){if(this.updateShownDuration(h),this._didShow||this._didReportEndOfLife)return;this.addPerformanceMarker("shown"),this._didShow=!0,this._editKind=p,this._viewData.viewKind=h,this._viewData.renderData=g,this._timeUntilShown=f-this._requestInfo.startTime,this._timeUntilActuallyShown=Date.now()-this._requestInfo.startTime;let b=new Kg(g.lineCountModified,g.lineCountOriginal,g.characterCountModified,g.characterCountOriginal);if(this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,n,b),this.sourceInlineCompletion.shownCommand)await u.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(u,n,h){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=h.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*h.ratio,1),this._partiallyAcceptedSinceOriginal.count+=h.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,u,n)}reportEndOfLife(u){if(this._didReportEndOfLife)return;if(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),!u)u=this._lastSetEndOfLifeReason??{kind:$l.Ignored,userTypingDisagreed:!1,supersededBy:void 0};if(u.kind===$l.Rejected&&!this._didShow)u={kind:$l.Ignored,userTypingDisagreed:!1,supersededBy:void 0};if(u.kind===$l.Rejected&&this.source.provider.handleRejection)this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion);if(this.source.provider.handleEndOfLifetime){let n={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((h)=>h.toString()).join(","),...this._viewData.renderData?.getData()};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,u,n)}}setIsPreceeded(u){if(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=u}setNotShownReason(u){this._notShownReason??=u}setEndOfLifeReason(u){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=u}updateShownDuration(u){let n=Date.now();if(!this._showStartTime)this._showStartTime=n;let h=u===Xe.Collapsed;if(!h&&this._showUncollapsedStartTime===void 0)this._showUncollapsedStartTime=n;if(h&&this._showUncollapsedStartTime!==void 0)this._showUncollapsedDuration+=n-this._showUncollapsedStartTime}reportInlineEditHidden(){if(this._showStartTime===void 0)return;let u=Date.now();if(this._shownDuration+=u-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime===void 0)return;this._showUncollapsedDuration+=u-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0}setRenameProcessingInfo(u){if(this._renameInfo)throw new H("Rename info has already been set.");this._renameInfo=u}withAction(u){return this._action=u,this}addPerformanceMarker(u){this.performance.mark(u)}}class K0{constructor(){this.markers=[],this.markers.push({name:"start",timeStamp:Date.now()})}mark(u){this.markers.push({name:u,timeStamp:Date.now()})}toString(){let u=[];for(let n=1;n<this.markers.length;n++){let h=this.markers[n].timeStamp-this.markers[n-1].timeStamp;u.push({[this.markers[n].name]:h})}return JSON.stringify(u)}}var Ot;(function(u){u.TextEditor="textEditor",u.DiffEditor="diffEditor",u.Notebook="notebook"})(Ot||(Ot={}));class z0{constructor(u,n,h){this.inlineSuggestions=u,this.inlineSuggestionsData=n,this.provider=h,this.refCount=0}addRef(){this.refCount++}removeRef(u={kind:"other"}){if(this.refCount--,this.refCount===0){for(let n of this.inlineSuggestionsData)n.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,u)}else if(this.refCount<0)ee(new H(`InlineSuggestionList (provider=${this.provider.providerId?.toString()}) refCount went negative (${this.refCount}) — more removeRef than addRef calls.`))}}function RN(u,n){let h=n.getWordAtPosition(u),g=n.getLineMaxColumn(u.lineNumber);return h?new t(u.lineNumber,h.startColumn,u.lineNumber,g):t.fromPositions(u,u.with(void 0,g))}function W0(u,n,h,g){let p=h.getLineContent(n.lineNumber),f=ui.replace(new z(n.column-1,p.length),u),S=h.tokenization.tokenizeLinesAt(n.lineNumber,[f.replace(p)])?.[0].sliceZeroCopy(f.getRangeAfterReplace());if(!S)return u;return P0(S,g)}var kN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Cm=function(u,n){return function(h,g){n(h,g,u)}},cd=new P("renameInputVisible",!1,e(1460,"Whether the rename input widget is visible"));new P("renameInputFocused",!1,e(1461,"Whether the rename input widget is focused"));var ym=class u{constructor(n,h,g,p,f,b){this._editor=n,this._acceptKeybindings=h,this._themeService=g,this._keybindingService=p,this._logService=b,this.allowEditorOverflow=!0,this._disposables=new d,this._visibleContextKey=cd.bindTo(f),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new dn,this._inputWithButton=new U0,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration((S)=>{if(S.hasChanged(59))this._updateFont()})),this._disposables.add(g.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){if(!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 ew(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:(n)=>{this._inputWithButton.input.value=n,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{if(this._renameCandidateListView?.focusedCandidate!==void 0)this._isEditingRenameCandidate=!0;if(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());return this._domNode}_updateStyles(n){if(!this._domNode)return;let h=n.getColor(wu),g=n.getColor(Nv);this._domNode.style.backgroundColor=String(n.getColor(Vr)??""),this._domNode.style.boxShadow=h?` 0 0 8px 2px ${h}`:"",this._domNode.style.border=g?`1px solid ${g}`:"",this._domNode.style.color=String(n.getColor(vk)??"");let p=n.getColor(wk);this._inputWithButton.domNode.style.backgroundColor=String(n.getColor(h0)??""),this._inputWithButton.input.style.backgroundColor=String(n.getColor(h0)??""),this._inputWithButton.domNode.style.borderWidth=p?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=p?"solid":"none",this._inputWithButton.domNode.style.borderColor=p?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;He(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);let n=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(n.fontSize)}px`}_computeLabelFontSize(n){return n*0.8}getPosition(){if(!this._visible)return null;if(!this._editor.hasModel()||!this._editor.getDomNode())return null;let n=ga(this.getDomNode().ownerDocument.body),h=kt(this._editor.getDomNode()),g=this._getTopForPosition();this._nPxAvailableAbove=g+h.top,this._nPxAvailableBelow=n.height-this._nPxAvailableAbove;let p=this._editor.getOption(75),{totalHeight:f}=xl.getLayoutInfo({lineHeight:p}),b=this._nPxAvailableBelow>f*6?[2,1]:[1,2];return{position:this._position,preference:b}}beforeRender(){let[n,h]=this._acceptKeybindings;return this._label.innerText=e(1462,"{0} to Rename, {1} to Preview",this._keybindingService.lookupKeybinding(n)?.getLabel(),this._keybindingService.lookupKeybinding(h)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(n){if(n===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;He(this._renameCandidateListView),He(this._nPxAvailableAbove!==void 0),He(this._nPxAvailableBelow!==void 0);let h=Nl(this._inputWithButton.domNode),g=Nl(this._label),p;if(n===2)p=this._nPxAvailableBelow;else p=this._nPxAvailableAbove;this._renameCandidateListView.layout({height:p-g-h,width:Pr(this._inputWithButton.domNode)})}acceptInput(n){this._trace("invoking acceptInput"),this._currentAcceptInput?.(n)}cancelInput(n,h){this._currentCancelInput?.(n)}focusNextRenameSuggestion(){if(!this._renameCandidateListView?.focusNext())this._inputWithButton.input.value=this._currentName}focusPreviousRenameSuggestion(){if(!this._renameCandidateListView?.focusPrevious())this._inputWithButton.input.value=this._currentName}getInput(n,h,g,p,f){let{start:b,end:S}=this._getSelection(n,h);this._renameCts=f;let w=new d;if(this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,p===void 0)this._inputWithButton.button.style.display="none";else this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=p,this._requestRenameCandidates(h,!1),w.add(c(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(h,!0))),w.add(c(this._inputWithButton.button,T.KEY_DOWN,(I)=>{let E=new Qe(I);if(E.equals(3)||E.equals(10))E.stopPropagation(),E.preventDefault(),this._requestRenameCandidates(h,!0)}));this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",g),this._position=new s(n.startLineNumber,n.startColumn),this._currentName=h,this._inputWithButton.input.value=h,this._inputWithButton.input.setAttribute("selectionStart",b.toString()),this._inputWithButton.input.setAttribute("selectionEnd",S.toString()),this._inputWithButton.input.size=Math.max((n.endColumn-n.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),w.add(D(()=>{this._renameCts=void 0,f.dispose(!0)})),w.add(D(()=>{if(this._renameCandidateProvidersCts!==void 0)this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0})),w.add(D(()=>this._candidates.clear()));let x=new ma;return x.p.finally(()=>{w.dispose(),this._hide()}),this._currentCancelInput=(I)=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),x.complete(I),!0),this._currentAcceptInput=(I)=>{this._trace("invoking _currentAcceptInput"),He(this._renameCandidateListView!==void 0);let E=this._renameCandidateListView.nCandidates,Z,X,J=this._renameCandidateListView.focusedCandidate;if(J!==void 0)this._trace("using new name from renameSuggestion"),Z=J,X={k:"renameSuggestion"};else this._trace("using new name from inputField"),Z=this._inputWithButton.input.value,X=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"};if(Z===h||Z.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(),x.complete({newName:Z,wantsPreview:g&&I,stats:{source:X,nRenameSuggestions:E,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},w.add(f.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),w.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),x.p}_requestRenameCandidates(n,h){if(this._requestRenameCandidatesOnce===void 0)return;if(this._renameCandidateProvidersCts!==void 0)this._renameCandidateProvidersCts.dispose(!0);if(He(this._renameCts),this._inputWithButton.buttonState!=="stop"){this._renameCandidateProvidersCts=new Je;let g=h?Tg.Invoke:Tg.Automatic,p=this._requestRenameCandidatesOnce(g,this._renameCandidateProvidersCts.token);if(p.length===0){this._inputWithButton.setSparkleButton();return}if(!h)this._hadAutomaticRenameSuggestionsInvocation=!0;this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(p,n,this._renameCts.token)}}_getSelection(n,h){He(this._editor.hasModel());let g=this._editor.getSelection(),p=0,f=h.length;if(!t.isEmpty(g)&&!t.spansMultipleLines(g)&&t.containsRange(n,g))p=Math.max(0,g.startColumn-n.startColumn),f=Math.min(n.endColumn,g.endColumn)-n.startColumn;return{start:p,end:f}}_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(n,h,g){let p=(...x)=>this._trace("_updateRenameCandidates",...x);p("start");let f=await yc(Promise.allSettled(n),g);if(this._inputWithButton.setSparkleButton(),f===void 0){p("returning early - received updateRenameCandidates results - undefined");return}let b=f.flatMap((x)=>x.status==="fulfilled"&&ni(x.value)?x.value:[]);p(`received updateRenameCandidates results - total (unfiltered) ${b.length} candidates.`);let S=Ps(b,(x)=>x.newSymbolName);p(`distinct candidates - ${S.length} candidates.`);let w=S.filter(({newSymbolName:x})=>x.trim().length>0&&x!==this._inputWithButton.input.value&&x!==h&&!this._candidates.has(x));if(p(`valid distinct candidates - ${b.length} candidates.`),w.forEach((x)=>this._candidates.add(x.newSymbolName)),w.length<1){p("returning early - no valid distinct candidates");return}p("setting candidates"),this._renameCandidateListView.setCandidates(w),p("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 n=this._editor.getVisibleRanges(),h;if(n.length>0)h=n[0].startLineNumber;else this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),h=Math.max(1,this._position.lineNumber-5);return this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(h)}_trace(...n){this._logService.trace("RenameWidget",...n)}};ym=kN([Cm(2,We),Cm(3,ge),Cm(4,K),Cm(5,Ze)],ym);class ew{constructor(u,n){this._disposables=new d,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",u.appendChild(this._listContainer),this._listWidget=ew._createListWidget(this._listContainer,this._candidateViewHeight,n.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus((h)=>{if(h.elements.length===1)n.onFocusChange(h.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection((h)=>{if(h.elements.length===1)n.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur((h)=>{this._listWidget.setFocus([])})),this._listWidget.style(Ed({listInactiveFocusForeground:wd,listInactiveFocusBackground:xd}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:u,width:n}){this._availableHeight=u,this._minimumWidth=n}setCandidates(u){this._listWidget.splice(0,0,u);let n=this._pickListHeight(this._listWidget.length),h=this._pickListWidth(u);this._listWidget.layout(n,h),this._listContainer.style.height=`${n}px`,this._listContainer.style.width=`${h}px`,Br(e(1463,"Received {0} rename suggestions",u.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 u=this._listWidget.getSelectedElements()[0];if(u!==void 0)return u.newSymbolName;let n=this._listWidget.getFocusedElements()[0];if(n!==void 0)return n.newSymbolName;return}focusNext(){if(this._listWidget.length===0)return!1;let u=this._listWidget.getFocus();if(u.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;else if(u[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;else{this._listWidget.focusNext();let n=this._listWidget.getFocus()[0];return this._listWidget.reveal(n),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;let u=this._listWidget.getFocus();if(u.length===0){this._listWidget.focusLast();let n=this._listWidget.getFocus()[0];return this._listWidget.reveal(n),!0}else if(u[0]===0)return this._listWidget.setFocus([]),!1;else{this._listWidget.focusPrevious();let n=this._listWidget.getFocus()[0];return this._listWidget.reveal(n),!0}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){let{totalHeight:u}=xl.getLayoutInfo({lineHeight:this._lineHeight});return u}_pickListHeight(u){let n=this._candidateViewHeight*u,h=7;return Math.min(n,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(u){let n=Math.ceil(Math.max(...u.map((g)=>g.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+n+10)}static _createListWidget(u,n,h){let g=new class{getTemplateId(f){return"candidate"}getHeight(f){return n}},p=new class{constructor(){this.templateId="candidate"}renderTemplate(f){return new xl(f,h)}renderElement(f,b,S){S.populate(f)}disposeTemplate(f){f.dispose()}};return new kr("NewSymbolNameCandidates",u,g,[p],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class U0{constructor(){this._buttonHoverContent="",this._disposables=new d,this._onDidInputChange=this._disposables.add(new r),this.onDidInputChange=this._onDidInputChange.event}get domNode(){if(!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",e(1464,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=e(1465,"Generate New Name Suggestions"),this._buttonCancelHoverText=e(1466,"Cancel"),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(Li().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,style:1}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(c(this.input,T.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(c(this.input,T.KEY_DOWN,(u)=>{let n=new Qe(u);if(n.keyCode===15||n.keyCode===17)this._onDidInputChange.fire()})),this._disposables.add(c(this.input,T.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(c(this.input,T.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(c(this.input,T.BLUR,()=>{this.domNode.style.outline="none"}));return this._domNode}get input(){return He(this._inputNode),this._inputNode}get button(){return He(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Cr(C.sparkle),mn(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??=Cr(C.stopCircle),mn(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()}}class xl{static{this._PADDING=2}constructor(u,n){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=`${n.lineHeight}px`,this._domNode.style.padding=`${xl._PADDING}px`;let h=document.createElement("div");h.style.display="flex",h.style.alignItems="center",h.style.width=h.style.height=`${n.lineHeight*0.8}px`,this._domNode.appendChild(h),this._icon=Cr(C.sparkle),this._icon.style.display="none",h.appendChild(this._icon),this._label=document.createElement("div"),Sn(this._label,n),this._domNode.appendChild(this._label),u.appendChild(this._domNode)}populate(u){this._updateIcon(u),this._updateLabel(u)}_updateIcon(u){let n=!!u.tags?.includes(ik.AIGenerated);this._icon.style.display=n?"inherit":"none"}_updateLabel(u){this._label.innerText=u.newSymbolName}static getLayoutInfo({lineHeight:u}){return{totalHeight:u+xl._PADDING*2}}dispose(){}}var TN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ud=function(u,n){return function(h,g){n(h,g,u)}},tw;class Mh{constructor(u,n,h){this.model=u,this.position=n,this._providerRenameIdx=0,this._providers=h.ordered(u)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(u){let n=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){let g=this._providers[this._providerRenameIdx];if(!g.resolveRenameLocation)break;let p=await g.resolveRenameLocation(this.model,this.position,u);if(!p)continue;if(p.rejectReason){n.push(p.rejectReason);continue}return p}this._providerRenameIdx=0;let h=this.model.getWordAtPosition(this.position);if(!h)return{range:t.fromPositions(this.position),text:"",rejectReason:n.length>0?n.join(`
|
|
38
|
+
`):void 0};return{range:new t(this.position.lineNumber,h.startColumn,this.position.lineNumber,h.endColumn),text:h.word,rejectReason:n.length>0?n.join(`
|
|
39
|
+
`):void 0}}async provideRenameEdits(u,n){return this._provideRenameEdits(u,this._providerRenameIdx,[],n)}async _provideRenameEdits(u,n,h,g){let p=this._providers[n];if(!p)return{edits:[],rejectReason:h.join(`
|
|
40
|
+
`)};let f=await p.provideRenameEdits(this.model,this.position,u,g);if(!f)return this._provideRenameEdits(u,n+1,h.concat(e(1449,"No result.")),g);else if(f.rejectReason)return this._provideRenameEdits(u,n+1,h.concat(f.rejectReason),g);return f}}function j0(u,n){return u.ordered(n).length>0}async function G0(u,n,h,g,p){return new Mh(n,h,u).provideRenameEdits(g,p??xe.None)}async function NN(u,n,h,g){let p=new Mh(n,h,u),f=await p.resolveRenameLocation(xe.None);if(f?.rejectReason)return{edits:[],rejectReason:f.rejectReason};return p.provideRenameEdits(g,xe.None)}var Qs=class u{static{tw=this}static{this.ID="editor.contrib.renameController"}static get(n){return n.getContribution(tw.ID)}constructor(n,h,g,p,f,b,S,w){this.editor=n,this._instaService=h,this._notificationService=g,this._bulkEditService=p,this._progressService=f,this._logService=b,this._configService=S,this._languageFeaturesService=w,this._disposableStore=new d,this._cts=new Je,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(ym,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){let n=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Je,!this.editor.hasModel()){n("editor has no model");return}let h=this.editor.getPosition(),g=new Mh(this.editor.getModel(),h,this._languageFeaturesService.renameProvider);if(!g.hasProvider()){n("skeleton has no provider");return}let p=new Es(this.editor,5,void 0,this._cts.token),f;try{n("resolving rename location");let J=g.resolveRenameLocation(p.token);this._progressService.showWhile(J,250),f=await J,n("resolved rename location")}catch(J){if(J instanceof Io)n("resolve rename location cancelled",JSON.stringify(J,null,"\t"));else if(n("resolve rename location failed",J instanceof Error?J:JSON.stringify(J,null,"\t")),typeof J==="string"||jo(J))ti.get(this.editor)?.showMessage(J||e(1450,"An unknown error occurred while resolving rename location"),h);return}finally{p.dispose()}if(!f){n("returning early - no loc");return}if(f.rejectReason){n(`returning early - rejected with reason: ${f.rejectReason}`,f.rejectReason),ti.get(this.editor)?.showMessage(f.rejectReason,h);return}if(p.token.isCancellationRequested){n("returning early - cts1 cancelled");return}let b=new Es(this.editor,5,f.range,this._cts.token),S=this.editor.getModel(),w=this._languageFeaturesService.newSymbolNamesProvider.all(S),x=await Promise.all(w.map(async(J)=>[J,await J.supportsAutomaticNewSymbolNamesTriggerKind??!1])),I=(J,Q)=>{let te=x.slice();if(J===Tg.Automatic)te=te.filter(([re,le])=>le);return te.map(([re])=>re.provideNewSymbolNames(S,f.range,J,Q))};n("creating rename input field and awaiting its result");let E=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),Z=await this._renameWidget.getInput(f.range,f.text,E,w.length>0?I:void 0,b);if(n("received response from rename input field"),typeof Z==="boolean"){if(n(`returning early - rename input field response - ${Z}`),Z)this.editor.focus();b.dispose();return}this.editor.focus(),n("requesting rename edits");let X=yc(g.provideRenameEdits(Z.newName,b.token),b.token).then(async(J)=>{if(!J){n("returning early - no rename edits result");return}if(!this.editor.hasModel()){n("returning early - no model after rename edits are provided");return}if(J.rejectReason){n(`returning early - rejected with reason: ${J.rejectReason}`),this._notificationService.info(J.rejectReason);return}this.editor.setSelection(t.fromPositions(this.editor.getSelection().getPosition())),n("applying edits"),this._bulkEditService.apply(J,{editor:this.editor,showPreview:Z.wantsPreview,label:e(1451,"Renaming '{0}' to '{1}'",f?.text,Z.newName),code:"undoredo.rename",quotableLabel:e(1452,"Renaming {0} to {1}",f?.text,Z.newName),respectAutoSaveConfig:!0,reason:Xn.rename(f?.text,Z.newName)}).then((Q)=>{if(n("edits applied"),Q.ariaSummary)zn(e(1453,"Successfully renamed '{0}' to '{1}'. Summary: {2}",f.text,Z.newName,Q.ariaSummary))}).catch((Q)=>{n(`error when applying edits ${JSON.stringify(Q,null,"\t")}`),this._notificationService.error(e(1454,"Rename failed to apply edits")),this._logService.error(Q)})},(J)=>{n("error when providing rename edits",JSON.stringify(J,null,"\t")),this._notificationService.error(e(1455,"Rename failed to compute edits")),this._logService.error(J)}).finally(()=>{b.dispose()});return n("returning rename operation"),this._progressService.showWhile(X,250),X}acceptRenameInput(n){this._renameWidget.acceptInput(n)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}};Qs=tw=TN([ud(1,O),ud(2,wt),ud(3,Dc),ud(4,Us),ud(5,Ze),ud(6,Tv),ud(7,V)],Qs);class q0 extends U{constructor(){super({id:"editor.action.rename",label:y(1457,"Rename Symbol"),precondition:L.and(o.writable,o.hasRenameProvider),kbOpts:{kbExpr:o.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1},canTriggerInlineEdits:!0})}runCommand(u,n){let h=u.get(Te),[g,p]=Array.isArray(n)&&n||[void 0,void 0];if(q.isUri(g)&&s.isIPosition(p))return h.openCodeEditor({resource:g},h.getActiveCodeEditor()).then((f)=>{if(!f)return;f.setPosition(p),f.invokeWithinContext((b)=>(this.reportTelemetry(b,f),this.run(b,f)))},ee);return super.runCommand(u,n)}run(u,n){let h=u.get(Ze),g=Qs.get(n);if(g)return h.trace("[RenameAction] got controller, running..."),g.run();return h.trace("[RenameAction] returning early - controller missing"),Promise.resolve()}}fe(Qs.ID,Qs,4);A(q0);var iw=nn.bindToContribution(Qs.get);G(new iw({id:"acceptRenameInput",precondition:cd,handler:(u)=>u.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:o.focus,primary:3}}));G(new iw({id:"acceptRenameInputWithPreview",precondition:L.and(cd,L.has("config.editor.rename.enablePreview")),handler:(u)=>u.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:o.focus,primary:2051}}));G(new iw({id:"cancelRenameInput",precondition:cd,handler:(u)=>u.cancelRenameInput(),kbOpts:{weight:199,kbExpr:o.focus,primary:9,secondary:[1033]}}));lt(class u extends Cn{constructor(){super({id:"focusNextRenameSuggestion",title:{...y(1458,"Focus Next Rename Suggestion")},precondition:cd,keybinding:[{primary:18,weight:199}]})}run(n){let h=n.get(Te).getFocusedCodeEditor();if(!h)return;let g=Qs.get(h);if(!g)return;g.focusNextRenameSuggestion()}});lt(class u extends Cn{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...y(1459,"Focus Previous Rename Suggestion")},precondition:cd,keybinding:[{primary:16,weight:199}]})}run(n){let h=n.get(Te).getFocusedCodeEditor();if(!h)return;let g=Qs.get(h);if(!g)return;g.focusPreviousRenameSuggestion()}});Fr("_executeDocumentRenameProvider",function(u,n,h,...g){let[p]=g;He(typeof p==="string");let{renameProvider:f}=u.get(V);return NN(f,n,h,p)});Fr("_executePrepareRename",async function(u,n,h){let{renameProvider:g}=u.get(V),f=await new Mh(n,h,g).resolveRenameLocation(xe.None);if(f?.rejectReason)throw Error(f.rejectReason);return f});pt.as(Ao.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:e(1456,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var ON=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},kl=function(u,n){return function(h,g){n(h,g,u)}},Jr;(function(u){u.no="no",u.yes="yes",u.maybe="maybe"})(Jr||(Jr={}));(function(u){function n(h){switch(h){case"no":return u.no;case"yes":return u.yes;case"maybe":return u.maybe;default:return u.no}}u.fromString=n})(Jr||(Jr={}));class Z0{constructor(){}inferRename(u,n,h,g){let p=new t(n.startLineNumber,1,n.endLineNumber,u.getLineMaxColumn(n.endLineNumber)),f=n.startColumn-p.startColumn,b=p.endColumn-n.endColumn,S=u.getValueInRange(p),w=u.getValueInRange(new t(p.startLineNumber,p.startColumn,p.startLineNumber,p.startColumn+f))+h+u.getValueInRange(new t(p.endLineNumber,p.endColumn-b,p.endLineNumber,p.endColumn)),x=[],I=[],E=void 0,Z=void 0,X=void 0,J=u.getOffsetAt(p.getStartPosition()),{changes:Q}=new ba(new kv(S),new kv(w)).ComputeDiff(!0);if(Q.length===0)return;let te=[];for(let pe of Q){if(te.length===0){te.push(pe);continue}let Se=te[te.length-1],we=pe.originalStart-(Se.originalStart+Se.originalLength);if(we>0){let ae=J+Se.originalStart+Se.originalLength,me=u.getPositionAt(ae),De=u.getWordAtPosition(me);if(De){let Oe=u.getOffsetAt(new s(me.lineNumber,De.startColumn)),Me=u.getOffsetAt(new s(me.lineNumber,De.endColumn)),Ce=ae+we;if(Oe<=ae&&Ce<=Me&&Oe<=Ce&&Ce<=Me){Se.originalLength=pe.originalStart+pe.originalLength-Se.originalStart,Se.modifiedLength=pe.modifiedStart+pe.modifiedLength-Se.modifiedStart;continue}}}te.push(pe)}let re=0;for(let pe of te){let Se=S.substring(pe.originalStart,pe.originalStart+pe.originalLength),we=w.substring(pe.modifiedStart,pe.modifiedStart+pe.modifiedLength),ae=J+pe.originalStart,me=u.getPositionAt(ae),De=ae+pe.originalLength,Oe=u.getPositionAt(De),Me=t.fromPositions(me,Oe),Ce=we.length-pe.originalLength;if(/\s/.test(Se)){x.push(new gt(Me,we)),re+=Ce;continue}if(Se.length>0){g.lastIndex=0;let qe=g.exec(Se);if(qe===null||qe.index!==0||qe[0].length!==Se.length){x.push(new gt(Me,we)),re+=Ce;continue}}if(/\s/.test(we)){x.push(new gt(Me,we)),re+=Ce;continue}if(we.length>0){g.lastIndex=0;let qe=g.exec(we);if(qe===null||qe.index!==0||qe[0].length!==we.length){x.push(new gt(Me,we)),re+=Ce;continue}}let Pe=u.getWordAtPosition(me);if(Pe===null){x.push(new gt(Me,we)),re+=Ce;continue}let tt=pe.originalStart+1,ze=pe.originalLength===0&&pe.modifiedLength>0,rt;if(ze&&tt===Pe.endColumn&&Pe.endColumn>Pe.startColumn)rt=this.getTokenAtPosition(u,new s(me.lineNumber,Pe.startColumn));else rt=this.getTokenAtPosition(u,me);if(Pe.startColumn!==rt.range.startColumn||Pe.endColumn!==rt.range.endColumn){x.push(new gt(Me,we)),re+=Ce;continue}if(rt.type===0){let qe=u.getValueInRange(rt.range);if(qe.length===0){x.push(new gt(Me,we)),re+=Ce;continue}if(E===void 0)E=qe;else if(E!==qe){x.push(new gt(Me,we)),re+=Ce;continue}let Ft=u.getOffsetAt(rt.range.getStartPosition())-J+re,it=u.getOffsetAt(rt.range.getEndPosition())-J+re;if(qe=w.substring(Ft,it+Ce),qe.length===0){x.push(new gt(Me,we)),re+=Ce;continue}if(Z===void 0)Z=qe;else if(Z!==qe){x.push(new gt(Me,we)),re+=Ce;continue}if(X===void 0)X=rt.range.getStartPosition();if(E!==void 0&&Z!==void 0&&E.length>0&&Z.length>0&&E!==Z)I.push(new gt(rt.range,Z));else I.push(new gt(Me,we));re+=Ce}else x.push(new gt(Me,we)),re+=we.length-pe.originalLength}if(E===void 0||Z===void 0||X===void 0||E.length===0||Z.length===0||E===Z)return;g.lastIndex=0;let le=g.exec(E);if(le===null||le.index!==0||le[0].length!==E.length)return;if(g.lastIndex=0,le=g.exec(Z),le===null||le.index!==0||le[0].length!==Z.length)return;return{renames:{edits:I,position:X,oldName:E,newName:Z},others:{edits:x}}}getTokenAtPosition(u,n){u.tokenization.tokenizeIfCheap(n.lineNumber);let h=u.tokenization.getLineTokens(n.lineNumber),g=h.findTokenIndexAtOffset(n.column-1);return{type:h.getStandardTokenType(g),range:new t(n.lineNumber,1+h.getStartOffset(g),n.lineNumber,1+h.getEndOffset(g))}}}class Ph{static create(u,n){let h=u.getFocusedCodeEditor();if(h===null)return;if(h.getModel()!==n)return;return new Ph(h,n.getVersionId())}constructor(u,n){this.editor=u,this.versionId=n}equals(u){if(u===void 0)return!1;return this.editor===u.editor&&this.versionId===u.versionId}}class X0{constructor(u,n,h,g,p,f,b,S,w){if(this._result=void 0,this._commandService=n,this._textModel=g,this._state=p,this._requestUuid=h,this._cancellationTokenSource=new Je,S===void 0||w===void 0){this._promise=G0(u.renameProvider,g,f,b,this._cancellationTokenSource.token);return}else this._promise=this.sendNesRenameRequest(g,f,w,b,S)}get requestUuid(){return this._requestUuid}isValid(u){return this._state.equals(Ph.create(u,this._textModel))}cancel(){this._cancellationTokenSource.cancel()}async getCount(){if(this._cancellationTokenSource.token.isCancellationRequested)return 0;let u=await this.getResult();if(u===void 0||this._cancellationTokenSource.token.isCancellationRequested)return 0;return u.edits.length}async getWorkspaceEdit(){return this.getResult()}async getResult(){if(this._cancellationTokenSource.token.isCancellationRequested)return;if(this._result===void 0)this._result=await this._promise;if(this._result.rejectReason||this._cancellationTokenSource.token.isCancellationRequested)return;return this._result}async sendNesRenameRequest(u,n,h,g,p){try{let f=await this._commandService.executeCommand("github.copilot.nes.postRename",u.uri,n,h,g,p);if(f===void 0)return{rejectReason:"Rename failed",edits:[]};let b=[];for(let S of f)for(let w of S.changes){let x=new t(w.range.start.line+1,w.range.start.character+1,w.range.end.line+1,w.range.end.character+1),I=new Oc(S.file,new gt(x,w.newText??g));b.push(I)}return{edits:b}}catch(f){return{rejectReason:"Rename failed",edits:[]}}}}var xm=class u extends i{constructor(n,h,g,p,f,b){super();this._commandService=n,this._languageFeaturesService=h,this._languageConfigurationService=g,this._renameSymbolTrackerService=f,this._codeEditorService=b,this._renameInferenceEngine=new Z0,this._renameRunnable=void 0,this._register($e.registerCommand(Gb,async(S,w,x)=>{if(x===void 0||!x.isValid(this._codeEditorService))return;try{let I=await x.getWorkspaceEdit();if(I===void 0)return;p.apply(I,{reason:w})}finally{if(this._renameRunnable===x)this._renameRunnable=void 0}}))}async proposeRenameRefactoring(n,h,g){if(!h.supportsRename||h.action?.kind!=="edit"||g.selectedSuggestionInfo)return h;if(!j0(this._languageFeaturesService.renameProvider,n))return h;let p=Ph.create(this._codeEditorService,n);if(p===void 0)return h;let f=Date.now(),b=h.action.textReplacement,S=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()),w=this._renameInferenceEngine.inferRename(n,b.range,b.text,S.wordDefinition);if(w===void 0||w.renames.edits.length===0)return h;let{oldName:x,newName:I,position:E,edits:Z}=w.renames,X=this._renameSymbolTrackerService.trackedWord.get(),J=void 0;if(X!==void 0&&X.model===n&&X.originalWord===x&&X.currentWord===I)J=X.currentRange;let Q=!1,te=await o2(this.checkRenamePrecondition(h,n,E,x,I,J),100,()=>{Q=!0}),re=this.isRenamePossible(h,te,p,n);if(h.setRenameProcessingInfo({createdRename:re,duration:Date.now()-f,timedOut:Q,droppedOtherEdits:re?w.others.edits.length:void 0,droppedRenameEdits:re?Z.length-1:void 0}),!re)return h;if(this._renameRunnable===void 0)this._renameRunnable=new X0(this._languageFeaturesService,this._commandService,h.requestUuid,n,p,E,I,J,J!==void 0?x:void 0);let le=Xn.inlineCompletionAccept({nes:h.isInlineEdit,requestUuid:h.requestUuid,providerId:h.source.provider.providerId,languageId:n.getLanguageId(),correlationId:h.getSourceCompletion().correlationId}),pe={id:Gb,title:e(1274,"Rename"),arguments:[le,this._renameRunnable]},Se={label:e(1275,"Rename"),icon:C.replaceAll,command:pe,count:this._renameRunnable.getCount()},we={kind:"edit",range:Z[0].range,insertText:Z[0].text,snippetInfo:h.snippetInfo,alternativeAction:Se,uri:n.uri},ae=nr.snapshot(n);return Cl.create(h.withAction(we),ae,!1)}async checkRenamePrecondition(n,h,g,p,f,b){let S={canRename:Jr.no,timedOut:!1};try{let w=await this._commandService.executeCommand("github.copilot.nes.prepareRename",h.uri,g,p,f,n.requestUuid,b);if(w===void 0)return S;else if(typeof w==="string"){let x=Jr.fromString(w);if(x===Jr.yes||x===Jr.maybe)return{canRename:x,oldName:p,onOldState:!1};else return{canRename:x,timedOut:!1}}else return w}catch(w){return S}}isRenamePossible(n,h,g,p){if(h===void 0||h.canRename===Jr.no)return!1;if(!g.equals(Ph.create(this._codeEditorService,p)))return!1;if(this._renameRunnable===void 0)return!0;if(this._renameRunnable.requestUuid===n.requestUuid)return!1;else return this._renameRunnable.cancel(),this._renameRunnable=void 0,!0}};xm=ON([kl(0,Ue),kl(1,V),kl(2,ht),kl(3,Dc),kl(4,Kk),kl(5,Te)],xm);var MN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Wl=function(u,n){return function(h,g){n(h,g,u)}},ow,Im=class u extends i{static{ow=this}static{this._requestId=0}constructor(n,h,g,p,f,b,S,w,x,I,E){super();if(this._textModel=n,this._versionId=h,this._debounceValue=g,this._cursorPosition=p,this._languageConfigurationService=b,this._logService=S,this._configurationService=w,this._instantiationService=x,this._contextKeyService=I,this._textModelService=E,this._updateOperation=this._register(new de),this._state=qE(this,{initial:()=>({inlineCompletions:vo.createEmpty(),suggestWidgetInlineCompletions:vo.createEmpty()}),disposeFinal:(Z)=>{Z.inlineCompletions.dispose(),Z.suggestWidgetInlineCompletions.dispose()},changeTracker:P2(()=>({versionId:this._versionId})),update:(Z,X,J)=>{let Q=Sr.compose(J.changes.map((te)=>te.change?Tk(te.change.changes):Sr.empty).filter(ni));if(Q.isEmpty())return X;try{return{inlineCompletions:X.inlineCompletions.createStateWithAppliedEdit(Q,this._textModel),suggestWidgetInlineCompletions:X.suggestWidgetInlineCompletions.createStateWithAppliedEdit(Q,this._textModel)}}finally{X.inlineCompletions.dispose(),X.suggestWidgetInlineCompletions.dispose()}}}),this.inlineCompletions=this._state.map(this,(Z)=>Z.inlineCompletions),this.suggestWidgetInlineCompletions=this._state.map(this,(Z)=>Z.suggestWidgetInlineCompletions),this._completionsEnabled=void 0,this.clearOperationOnTextModelChange=m(this,(Z)=>{this._versionId.read(Z),this._updateOperation.clear();return}),this._loadingCount=j(this,0),this.loading=this._loadingCount.map(this,(Z)=>Z>0),this._dataChannelTelemetryService=this._instantiationService.createInstance(mm),this._loggingEnabled=ZI("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=ZI("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(Sl.cast(),"editor.inlineSuggest.logFetch.commandId")),this._renameProcessor=this._store.add(this._instantiationService.createInstance(xm)),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store),f)this._updateCompletionsEnablement(f),this._register(this._configurationService.onDidChangeConfiguration((Z)=>{if(Z.affectsConfiguration(f))this._updateCompletionsEnablement(f)}));this._state.recomputeInitiallyAndOnChange(this._store)}_updateCompletionsEnablement(n){let h=this._configurationService.getValue(n);if(!cn(h))this._completionsEnabled=void 0;else this._completionsEnabled=h}_log(n){if(this._loggingEnabled.get())this._logService.info(HE(n));this._structuredFetchLogger.log(n)}fetch(n,h,g,p,f,b,S){let w=this._cursorPosition.get(),x=new Y0(w,g,this._textModel.getVersionId(),new Set(n)),I=g.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(x))return this._updateOperation.value.promise;else if(I?.request?.satisfies(x))return Promise.resolve(!0);let E=!!this._updateOperation.value;this._updateOperation.clear();let Z=new Je,X=(async()=>{let Q=new d;this._loadingCount.set(this._loadingCount.get()+1,void 0);let te=!1,re=()=>{if(!te)te=!0,this._loadingCount.set(this._loadingCount.get()-1,void 0)};Q.add(new ke(()=>re(),1e4)).schedule();let pe=n.filter((we)=>we.providerId),Se=new J0(g,S,pe);try{let we=this._debounceValue.get(this._textModel),ae=pk(n.map((it)=>it.debounceDelayMs),YM(Ui))??we;if(E||f&&g.triggerKind===uo.Automatic)await zS(ae,Z.token);if(Z.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==x.versionId)return Se.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;let De=ow._requestId++;if(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:De,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:g.triggerKind,suggestInfo:g.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:h});let Oe=new Date,Me=B0(n,this._cursorPosition.get(),this._textModel,g,S,this._languageConfigurationService);QS(Z.token,()=>Me.cancelAndDispose({kind:"tokenCancellation"}));let Ce=!1,Pe=!1,tt=[];for await(let it of Me.lists){if(!it)continue;it.addRef(),Q.add(D(()=>it.removeRef(it.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(let ft of it.inlineSuggestionsData){if(Pe=!0,!g.includeInlineEdits&&(ft.isInlineEdit||ft.showInlineEditMenu)){ft.setNotShownReason("notInlineEditRequested");continue}if(!g.includeInlineCompletions&&!(ft.isInlineEdit||ft.showInlineEditMenu)){ft.setNotShownReason("notInlineCompletionRequested");continue}ft.addPerformanceMarker("providerReturned");let Bt=ft.action?.uri,yt,St;if(Bt&&Bt.toString()!==this._textModel.uri.toString()){let Rt=await this._textModelService.createModelReference(Bt);yt=Rt.object.textEditorModel,St=Rt}else yt=this._textModel,St=void 0;let Vt=nr.snapshot(yt),Wt=Cl.create(ft,Vt);if(St){let Rt=Mo(Wt.identity.onDispose,()=>{St?.dispose(),Rt.dispose()})}if(ft.addPerformanceMarker("itemCreated"),tt.push(Wt),!Wt.isInlineEdit&&!Wt.showInlineEditMenu&&g.triggerKind===uo.Automatic){if(Wt.isVisible(this._textModel,this._cursorPosition.get()))Ce=!0}}if(Ce)break}tt.forEach((it)=>it.addPerformanceMarker("providersResolved"));let ze=await Promise.all(tt.map(async(it)=>this._renameProcessor.proposeRenameRefactoring(this._textModel,it,g)));if(ze.forEach((it)=>it.addPerformanceMarker("renameProcessed")),Me.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){let it=Me.didAllProvidersReturn,ft=void 0;if(Z.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==x.versionId)ft="canceled";let Bt=ze.map((yt)=>{let St=yt.getSourceCompletion();if(St.doNotLog)return;let Vt={insertText:St.insertText,range:St.range,additionalTextEdits:St.additionalTextEdits,uri:St.uri,command:St.command,gutterMenuLinkAction:St.gutterMenuLinkAction,shownCommand:St.shownCommand,completeBracketPairs:St.completeBracketPairs,isInlineEdit:St.isInlineEdit,showInlineEditMenu:St.showInlineEditMenu,showRange:St.showRange,warning:St.warning,hint:St.hint,supportsRename:St.supportsRename,correlationId:St.correlationId,jumpToPosition:St.jumpToPosition};return{...mv(Vt,(Wt)=>{if(t.isIRange(Wt))return t.lift(Wt).toString();if(s.isIPosition(Wt))return s.lift(Wt).toString();if(vv.is(Wt))return{$commandId:Wt.id};return Wt}),$providerId:yt.source.provider.providerId?.toString()}}).filter((yt)=>yt!==void 0);this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:De,durationMs:Date.now()-Oe.getTime(),error:ft,result:Bt,time:Date.now(),didAllProvidersReturn:it})}if(Se.setRequestUuid(Me.contextWithUuid.requestUuid),Pe){if(Se.setHasProducedSuggestion(),ze.length>0&&Z.token.isCancellationRequested)ze.forEach((it)=>it.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"))}else if(Z.token.isCancellationRequested)Se.setNoSuggestionReasonIfNotSet("canceled:whileFetching");else{let it=this._contextKeyService.getContextKeyValue("completionsQuotaExceeded");Se.setNoSuggestionReasonIfNotSet(it?"completionsQuotaExceeded":"noSuggestion")}let rt=g.earliestShownDateTime-Date.now();if(rt>0)await zS(rt,Z.token);if(ze.forEach((it)=>it.addPerformanceMarker("minShowDelayPassed")),Z.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==x.versionId||b.get()){let it=Z.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==x.versionId?"canceled:documentChanged":b.get()?"canceled:userJumped":"unknown";return ze.forEach((ft)=>ft.setNotShownReasonIfNotSet(it)),!1}let qe=new Date;this._debounceValue.update(this._textModel,qe.getTime()-Oe.getTime());let Ft=this._cursorPosition.get();this._updateOperation.clear(),Ye((it)=>{let ft=this._state.get();if(g.selectedSuggestionInfo)this._state.set({inlineCompletions:vo.createEmpty(),suggestWidgetInlineCompletions:ft.suggestWidgetInlineCompletions.createStateWithAppliedResults(ze,x,this._textModel,Ft,p)},it);else this._state.set({inlineCompletions:ft.inlineCompletions.createStateWithAppliedResults(ze,x,this._textModel,Ft,p),suggestWidgetInlineCompletions:vo.createEmpty()},it);ft.inlineCompletions.dispose(),ft.suggestWidgetInlineCompletions.dispose()})}finally{Q.dispose(),re(),this._sendInlineCompletionsRequestTelemetry(Se)}return!0})(),J=new Q0(x,Z,X);return this._updateOperation.value=J,X}clear(n){if(this._store.isDisposed)return;this._updateOperation.clear();let h=this._state.get();this._state.set({inlineCompletions:vo.createEmpty(),suggestWidgetInlineCompletions:vo.createEmpty()},n),h.inlineCompletions.dispose(),h.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){let n=this.inlineCompletions.get(),h=this.suggestWidgetInlineCompletions.get();if(!h)return;Ye((g)=>{if(!n||(h.request?.versionId??-1)>(n.request?.versionId??-1)){n?.dispose();let p=this._state.get();this._state.set({inlineCompletions:h.clone(),suggestWidgetInlineCompletions:vo.createEmpty()},g),p.inlineCompletions.dispose(),p.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(g)})}seedWithCompletion(n,h){let g=this._state.get();this._state.set({inlineCompletions:new vo([n],void 0),suggestWidgetInlineCompletions:vo.createEmpty()},h),g.inlineCompletions.dispose(),g.suggestWidgetInlineCompletions.dispose()}_sendInlineCompletionsRequestTelemetry(n){if(!this._sendRequestData.get()&&!this._contextKeyService.getContextKeyValue("isRunningUnificationExperiment"))return;if(n.requestUuid===void 0||n.hasProducedSuggestion)return;if(!VI(this._completionsEnabled,this._textModel.getLanguageId()))return;if(!n.providers.some((g)=>ZS(g.providerId?.extensionId)))return;let h={opportunityId:n.requestUuid,noSuggestionReason:n.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,skuPlan:n.requestInfo.sku?.plan,skuType:n.requestInfo.sku?.type,editorType:n.requestInfo.editorType,requestReason:n.requestInfo.reason,typingInterval:n.requestInfo.typingInterval,typingIntervalCharacterCount:n.requestInfo.typingIntervalCharacterCount,languageId:n.requestInfo.languageId,selectedSuggestionInfo:!!n.context.selectedSuggestionInfo,availableProviders:n.providers.map((g)=>g.providerId?.toString()).filter(ni).join(","),...YE(n.providers.some((g)=>ZS(g.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,superseded:void 0,reason:void 0,acceptedAlternativeAction:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,longDistanceHintVisible:void 0,longDistanceHintDistance:void 0,isForAnotherDocument:void 0,notShownReason:void 0,renameCreated:!1,renameDuration:void 0,renameTimedOut:!1,renameDroppedOtherEdits:void 0,renameDroppedRenameEdits:void 0,performanceMarkers:void 0,editKind:void 0};JE(this._dataChannelTelemetryService,h)}clearSuggestWidgetInlineCompletions(n){if(this._updateOperation.value?.request.context.selectedSuggestionInfo)this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}};Im=ow=MN([Wl(5,ht),Wl(6,Ze),Wl(7,oe),Wl(8,O),Wl(9,K),Wl(10,Nn)],Im);class Y0{constructor(u,n,h,g){this.position=u,this.context=n,this.versionId=h,this.providers=g}satisfies(u){return this.position.equals(u.position)&&PI(this.context.selectedSuggestionInfo,u.context.selectedSuggestionInfo,Rf())&&(u.context.triggerKind===uo.Automatic||this.context.triggerKind===uo.Explicit)&&this.versionId===u.versionId&&PN(u.providers,this.providers)}}class J0{constructor(u,n,h){this.context=u,this.requestInfo=n,this.providers=h,this.hasProducedSuggestion=!1}setRequestUuid(u){this.requestUuid=u}setNoSuggestionReasonIfNotSet(u){this.noSuggestionReason??=u}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}}function PN(u,n){return[...u].every((h)=>n.has(h))}class Q0{constructor(u,n,h){this.request=u,this.cancellationTokenSource=n,this.promise=h}dispose(){this.cancellationTokenSource.cancel()}}class vo extends i{static createEmpty(){return new vo([],void 0)}constructor(u,n){super();this.inlineCompletions=u,this.request=n;for(let h of this.inlineCompletions)h.addRef();this._register({dispose:()=>{for(let h of this.inlineCompletions)h.removeRef()}})}_findById(u){return this.inlineCompletions.find((n)=>n.identity===u)}_findByHash(u){return this.inlineCompletions.find((n)=>n.hash===u)}createStateWithAppliedEdit(u,n){let h=this.inlineCompletions.map((g)=>g.withEdit(u,n)).filter(ni);return new vo(h,this.request)}createStateWithAppliedResults(u,n,h,g,p){let f=void 0;if(p){let w=this._findById(p);if(w&&w.canBeReused(h,n.position)){f=w;let x=u.find((I)=>I.hash===w.hash);if(x)u=FN(x,u);else u=[w,...u]}}let b=f?!f.isInlineEdit:u.some((w)=>!w.isInlineEdit&&w.isVisible(h,g)),S=[];for(let w of u){let x=this._findByHash(w.hash),I;if(x&&x!==w)I=w.withIdentity(x.identity),w.setIsPreceeded(x),x.setEndOfLifeReason({kind:$l.Ignored,userTypingDisagreed:!1,supersededBy:w.getSourceCompletion()});else I=w;if(b!==I.isInlineEdit)S.push(I)}return S.sort(Bn((w)=>w.showInlineEditMenu,ek)),S=AN(S,(w)=>w.semanticId),new vo(S,n)}clone(){return new vo(this.inlineCompletions,this.request)}}function AN(u,n){let h=new Set;return u.filter((g)=>{let p=n(g);if(h.has(p))return!1;return h.add(p),!0})}function FN(u,n){let h=n.indexOf(u);if(h>-1)return[u,...n.slice(0,h),...n.slice(h+1)];return n}class Qr extends i{static{this.MAX_SESSION_GAP_MS=3000}static{this.MIN_SESSION_DURATION_MS=1000}static{this.SESSION_HISTORY_LIMIT=50}static{this.TYPING_SPEED_WINDOW_MS=300000}static{this.MIN_CHARS_FOR_RELIABLE_SPEED=20}getTypingInterval(){if(this._cacheInvalidated||this._cachedTypingIntervalResult===null)this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1;return this._cachedTypingIntervalResult}constructor(u){super();this._textModel=u,this._typingSessions=[],this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0,this._register(this._textModel.onDidChangeContent((n)=>this._updateTypingSpeed(n)))}_updateTypingSpeed(u){let n=Date.now();if(!this._isUserTyping(u)){this._finalizeCurrentSession();return}if(this._currentSession&&n-this._lastChangeTime>Qr.MAX_SESSION_GAP_MS)this._finalizeCurrentSession();if(!this._currentSession)this._currentSession={startTime:n,endTime:n,characterCount:0};this._currentSession.endTime=n,this._currentSession.characterCount+=this._getActualCharacterCount(u),this._lastChangeTime=n,this._cacheInvalidated=!0}_getActualCharacterCount(u){let n=0;for(let h of u.changes)n+=Math.max(h.text.length,h.rangeLength);return n}_isUserTyping(u){if(!u.detailedReasons||u.detailedReasons.length===0)return!1;for(let n of u.detailedReasons)if(this._isUserTypingReason(n))return!0;return!1}_isUserTypingReason(u){if(u.metadata.isUndoing||u.metadata.isRedoing)return!1;switch(u.metadata.source){case"cursor":{let n=u.metadata.kind;return n==="type"||n==="compositionType"||n==="compositionEnd"}default:return!1}}_finalizeCurrentSession(){if(!this._currentSession)return;if(this._currentSession.endTime-this._currentSession.startTime>=Qr.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0){if(this._typingSessions.push(this._currentSession),this._typingSessions.length>Qr.SESSION_HISTORY_LIMIT)this._typingSessions.shift()}this._currentSession=null}_calculateTypingInterval(){if(this._currentSession){let u={...this._currentSession};if(u.endTime-u.startTime>=Qr.MIN_SESSION_DURATION_MS&&u.characterCount>0){let h=[...this._typingSessions,u];return this._calculateSpeedFromSessions(h)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(u){if(u.length===0)return{averageInterval:0,characterCount:0};let n=[...u].sort((x,I)=>I.endTime-x.endTime),h=Date.now()-Qr.TYPING_SPEED_WINDOW_MS,g=n.filter((x)=>x.endTime>h),p=n.splice(g.length),f=fv(g.map((x)=>x.characterCount));for(let x=0;x<p.length&&f<Qr.MIN_CHARS_FOR_RELIABLE_SPEED;x++)g.push(p[x]),f+=p[x].characterCount;let b=fv(g.map((x)=>x.endTime-x.startTime));if(b===0||f<=1)return{averageInterval:0,characterCount:f};let S=Math.max(1,f-1),w=b/S;return{averageInterval:Math.round(w),characterCount:f}}dispose(){this._finalizeCurrentSession(),super.dispose()}}var HN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ea=function(u,n){return function(h,g){n(h,g,u)}},Lm=class u extends i{get isAcceptingPartially(){return this._isAcceptingPartially}get editor(){return this._editor}constructor(n,h,g,p,f,b,S,w,x,I,E,Z,X,J,Q,te){super();this.textModel=n,this._selectedSuggestItem=h,this._textModelVersionId=g,this._positions=p,this._debounceValue=f,this._enabled=b,this._isSuppressed=S,this._editor=w,this._instantiationService=x,this._commandService=I,this._languageConfigurationService=E,this._accessibilityService=Z,this._languageFeaturesService=X,this._codeEditorService=J,this._inlineCompletionsService=Q,this._isActive=j(this,!1),this._onlyRequestInlineEditsSignal=ar(this),this._forceUpdateExplicitlySignal=ar(this),this._noDelaySignal=ar(this),this._fetchSpecificProviderSignal=ar(this),this._selectedInlineCompletionId=j(this,void 0),this.primaryPosition=m(this,(ae)=>this._positions.read(ae)[0]??new s(1,1)),this.allPositions=m(this,(ae)=>this._positions.read(ae)),this.sku=j(this,void 0),this._isAcceptingPartially=!1,this._appearedInsideViewport=m(this,(ae)=>{let me=this.state.read(ae);if(!me||!me.inlineSuggestion)return!1;return rw(this._editor,me.inlineSuggestion,ae)}),this._onDidAccept=this._register(new r),this.onDidAccept=this._onDidAccept.event,this._lastShownInlineCompletionInfo=void 0,this._lastAcceptedInlineCompletionInfo=void 0,this._didUndoInlineEdits=sk({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(ae,me)=>(me.didUndo=ae.didChange(this._textModelVersionId)&&!!ae.change?.isUndoing,!0)}},(ae,me)=>{let De=this._textModelVersionId.read(ae);if(De!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===De-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&me.didUndo)return this._lastAcceptedInlineCompletionInfo=void 0,!0;return!1}),this._preserveCurrentCompletionReasons=new Set([os.Redo,os.Undo,os.AcceptWord]),this.dontRefetchSignal=ar(this),this._fetchInlineCompletionsPromise=sk({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:uo.Automatic,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,changeHint:void 0,textChange:!1,changeReason:""}),handleChange:(ae,me)=>{if(ae.didChange(this._textModelVersionId)){if(this._preserveCurrentCompletionReasons.has(this._getReason(ae.change)))me.preserveCurrentCompletion=!0;let De=ae.change?.detailedReasons??[];me.changeReason=De.length>0?De[0].getType():"",me.textChange=!0}else if(ae.didChange(this._forceUpdateExplicitlySignal))me.preserveCurrentCompletion=!0,me.inlineCompletionTriggerKind=uo.Explicit;else if(ae.didChange(this.dontRefetchSignal))me.dontRefetch=!0;else if(ae.didChange(this._onlyRequestInlineEditsSignal))me.onlyRequestInlineEdits=!0;else if(ae.didChange(this._fetchSpecificProviderSignal))me.provider=ae.change?.provider,me.changeHint=ae.change?.changeHint;return!0}}},(ae,me)=>{if(this._source.clearOperationOnTextModelChange.read(ae),this._noDelaySignal.read(ae),this.dontRefetchSignal.read(ae),this._onlyRequestInlineEditsSignal.read(ae),this._forceUpdateExplicitlySignal.read(ae),this._fetchSpecificProviderSignal.read(ae),!(!this._isSuppressed()&&(this._enabled.read(ae)&&this._selectedSuggestItem.read(ae)||this._isActive.read(ae))&&(!this._inlineCompletionsService.isSnoozing()||me.inlineCompletionTriggerKind===uo.Explicit))){this._source.cancelUpdate();return}this._textModelVersionId.read(ae);let Oe=this._source.suggestWidgetInlineCompletions.read(void 0),Me=this._selectedSuggestItem.read(ae);if(this._shouldShowOnSuggestConflict.read(void 0))Me=void 0;if(Oe&&!Me)this._source.seedInlineCompletionsWithSuggestWidget();if(me.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(ae)&&me.inlineCompletionTriggerKind!==uo.Explicit){Ye((Bt)=>{this._source.clear(Bt)});return}let Ce="";if(me.provider)Ce+="providerOnDidChange";else if(me.inlineCompletionTriggerKind===uo.Explicit)Ce+="explicit";if(me.changeReason)Ce+=Ce.length>0?`:${me.changeReason}`:me.changeReason;let Pe=this._typing.getTypingInterval(),tt={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:Ce,typingInterval:Pe.averageInterval,typingIntervalCharacterCount:Pe.characterCount,availableProviders:[],sku:this.sku.read(void 0)},ze={triggerKind:me.inlineCompletionTriggerKind,selectedSuggestionInfo:Me?.toSelectedSuggestionInfo(),includeInlineCompletions:!me.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(ae),requestIssuedDateTime:tt.startTime,earliestShownDateTime:tt.startTime+(me.inlineCompletionTriggerKind===uo.Explicit||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0)),changeHint:me.changeHint};if(ze.triggerKind===uo.Automatic&&me.textChange){if(this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId)ze={...ze,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit}}let rt=this.selectedInlineCompletion.read(void 0)??this._inlineSuggestionItems.read(void 0)?.inlineEdit,qe=me.preserveCurrentCompletion||rt?.forwardStable?rt:void 0,Ft=this._jumpedToId.map((Bt)=>!!Bt&&Bt===this._inlineSuggestionItems.read(void 0)?.inlineEdit?.semanticId),it=me.provider?{providers:[me.provider],label:"single:"+me.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},ft=this.getAvailableProviders(it.providers);return tt.availableProviders=ft.map((Bt)=>Bt.providerId).filter(ni),this._source.fetch(ft,it.label,ze,qe?.identity,me.shouldDebounce,Ft,tt)}),this._inlineSuggestionItems=In({owner:this},(ae)=>{let me=this._source.inlineCompletions.read(ae);if(!me)return;let De=this.primaryPosition.read(ae),Oe=void 0,Me=[];for(let Ce of me.inlineCompletions)if(!Ce.isInlineEdit){if(Ce.isVisible(this.textModel,De))Me.push(Ce)}else Oe=Ce;if(Me.length!==0)Oe=void 0;return{inlineCompletions:Me,inlineEdit:Oe}}),this._inlineCompletionItems=In({owner:this,equalsFn:Yh()},(ae)=>this._inlineSuggestionItems.read(ae)?.inlineCompletions??[]),this.selectedInlineCompletionIndex=m(this,(ae)=>{let me=this._selectedInlineCompletionId.read(ae),De=this._inlineCompletionItems.read(ae),Oe=this._selectedInlineCompletionId===void 0?-1:De.findIndex((Me)=>Me.semanticId===me);if(Oe===-1)return this._selectedInlineCompletionId.set(void 0,void 0),0;return Oe}),this.selectedInlineCompletion=m(this,(ae)=>{let me=this._inlineCompletionItems.read(ae),De=this.selectedInlineCompletionIndex.read(ae);return me[De]}),this.activeCommands=In({owner:this,equalsFn:Yh()},(ae)=>this.selectedInlineCompletion.read(ae)?.source.inlineSuggestions.commands??[]),this.inlineCompletionsCount=m(this,(ae)=>{if(this.lastTriggerKind.read(ae)===uo.Explicit)return this._inlineCompletionItems.read(ae).length;else return}),this._hasVisiblePeekWidgets=m(this,(ae)=>this._editorObs.openedPeekWidgets.read(ae)>0),this._shouldShowOnSuggestConflict=m(this,(ae)=>{let me=this._showOnSuggestConflict.read(ae);if(me!=="never"){if(!!this.selectedInlineCompletion.read(ae)){let Oe=this._selectedSuggestItem.read(ae);if(!Oe)return!1;if(me==="whenSuggestListIsIncomplete")return Oe.listIncomplete;return!0}}return!1}),this.state=In({owner:this,equalsFn:(ae,me)=>{if(!ae||!me)return ae===me;if(ae.kind==="ghostText"&&me.kind==="ghostText")return $S(ae.ghostTexts,me.ghostTexts)&&ae.inlineSuggestion===me.inlineSuggestion&&ae.suggestItem===me.suggestItem;else if(ae.kind==="inlineEdit"&&me.kind==="inlineEdit")return ae.inlineSuggestion===me.inlineSuggestion;return!1}},(ae)=>{let me=this.textModel;if(this._suppressInSnippetMode.read(ae)&&this._isInSnippetMode.read(ae))return;let De=this._inlineSuggestionItems.read(ae),Oe=De?.inlineEdit;if(Oe){if(this._hasVisiblePeekWidgets.read(ae))return;let Ce=this.primaryPosition.map((rt)=>ne.fromRangeInclusive(Oe.targetRange).addMargin(1,1).contains(rt.lineNumber)),Pe=Oe.action?.kind==="edit"?Oe.action.stringEdit:void 0,tt=Pe?jr.fromStringEdit(Pe,new up(this.textModel)).replacements:[],ze=(De.inlineEdit?.command?.id==="vscode.open"||De.inlineEdit?.command?.id==="_workbench.open")&&De.inlineEdit?.command.arguments?.length?q.from(De.inlineEdit?.command.arguments[0]):void 0;if(!Oe.originalTextRef.targets(this.textModel))ze=Oe.originalTextRef.uri;return{kind:"inlineEdit",inlineSuggestion:Oe,edits:tt,cursorAtInlineEdit:Ce,nextEditUri:ze}}let Me=this._selectedSuggestItem.read(ae);if(!this._shouldShowOnSuggestConflict.read(ae)&&Me){let Ce=Lo(Me.getSingleTextEdit(),me),Pe=this._computeAugmentation(Ce,ae);if(!this._suggestPreviewEnabled.read(ae)&&!Pe)return;let ze=Pe?.edit??Ce,rt=Pe?Pe.edit.text.length-Ce.text.length:0,qe=this._suggestPreviewMode.read(ae),Ft=this._positions.read(ae),ft=[ze,...nw(this.textModel,Ft,ze)].map((Vt,Wt)=>({edit:Vt,ghostText:Vt?GS(Vt,me,qe,Ft[Wt],rt):void 0})).filter(({edit:Vt,ghostText:Wt})=>Vt!==void 0&&Wt!==void 0),Bt=ft.map(({edit:Vt})=>Vt),yt=ft.map(({ghostText:Vt})=>Vt),St=yt[0]??new qr(ze.range.endLineNumber,[]);return{kind:"ghostText",edits:Bt,primaryGhostText:St,ghostTexts:yt,inlineSuggestion:Pe?.completion,suggestItem:Me}}else{if(!this._isActive.read(ae))return;let Ce=this.selectedInlineCompletion.read(ae);if(!Ce)return;let Pe=Ce.getSingleTextEdit(),tt=this._inlineSuggestMode.read(ae),ze=this._positions.read(ae),qe=[Pe,...nw(this.textModel,ze,Pe)].map((ft,Bt)=>({edit:ft,ghostText:ft?GS(ft,me,tt,ze[Bt],0):void 0})).filter(({edit:ft,ghostText:Bt})=>ft!==void 0&&Bt!==void 0),Ft=qe.map(({edit:ft})=>ft),it=qe.map(({ghostText:ft})=>ft);if(!it[0])return;return{kind:"ghostText",edits:Ft,primaryGhostText:it[0],ghostTexts:it,inlineSuggestion:Ce,suggestItem:void 0}}}),this.status=m(this,(ae)=>{if(this._source.loading.read(ae))return"loading";let me=this.state.read(ae);if(me?.kind==="ghostText")return"ghostText";if(me?.kind==="inlineEdit")return"inlineEdit";return"noSuggestion"}),this.inlineCompletionState=m(this,(ae)=>{let me=this.state.read(ae);if(!me||me.kind!=="ghostText")return;if(this._editorObs.inComposition.read(ae))return;return me}),this.inlineEditState=m(this,(ae)=>{let me=this.state.read(ae);if(!me||me.kind!=="inlineEdit")return;return me}),this.inlineEditAvailable=m(this,(ae)=>!!this.inlineEditState.read(ae)),this.warning=m(this,(ae)=>this.inlineCompletionState.read(ae)?.inlineSuggestion?.warning),this.ghostTexts=In({owner:this,equalsFn:$S},(ae)=>{let me=this.inlineCompletionState.read(ae);if(!me)return;return me.ghostTexts}),this.primaryGhostText=In({owner:this,equalsFn:jS},(ae)=>{let me=this.inlineCompletionState.read(ae);if(!me)return;return me?.primaryGhostText}),this.showCollapsed=m(this,(ae)=>{let me=this.state.read(ae);if(!me||me.kind!=="inlineEdit")return!1;if(me.inlineSuggestion.hint||me.inlineSuggestion.action?.kind==="jumpTo")return!1;let De=me.inlineSuggestion.updatedEditModelVersion===this._textModelVersionId.read(ae);return(this._inlineEditsShowCollapsedEnabled.read(ae)||!De)&&this._jumpedToId.read(ae)!==me.inlineSuggestion.semanticId&&!this._inAcceptFlow.read(ae)}),this._tabShouldIndent=m(this,(ae)=>{if(this._inAcceptFlow.read(ae))return!1;function me(Me){return Me.startLineNumber!==Me.endLineNumber}function De(Me,Ce){let Pe=Me.getLineIndentColumn(Ce),tt=Me.getLineLastNonWhitespaceColumn(Ce),ze=Math.max(tt,Pe);return new t(Ce,Pe,Ce,ze)}return this._editorObs.selections.read(ae)?.some((Me)=>{if(Me.isEmpty())return this.textModel.getLineLength(Me.startLineNumber)===0;else return me(Me)||Me.containsRange(De(this.textModel,Me.startLineNumber))})}),this.tabShouldJumpToInlineEdit=m(this,(ae)=>{if(this._tabShouldIndent.read(ae))return!1;let me=this.inlineEditState.read(ae);if(!me)return!1;if(me.inlineSuggestion.action?.kind==="jumpTo")return!0;if(this.showCollapsed.read(ae))return!0;if(this._inAcceptFlow.read(ae)&&this._appearedInsideViewport.read(ae))return!1;return!me.cursorAtInlineEdit.read(ae)}),this.tabShouldAcceptInlineEdit=m(this,(ae)=>{let me=this.inlineEditState.read(ae);if(!me)return!1;if(me.inlineSuggestion.action?.kind==="jumpTo")return!1;if(this.showCollapsed.read(ae))return!1;if(this._tabShouldIndent.read(ae))return!1;if(this._inAcceptFlow.read(ae)&&this._appearedInsideViewport.read(ae))return!0;if(me.inlineSuggestion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(ae))return!0;if(this._jumpedToId.read(ae)===me.inlineSuggestion.semanticId)return!0;return me.cursorAtInlineEdit.read(ae)}),this._jumpedToId=j(this,void 0),this._inAcceptFlow=j(this,!1),this.inAcceptFlow=this._inAcceptFlow,this._source=this._register(this._instantiationService.createInstance(Im,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition,Mf.defaultChatAgent?.completionsEnablementSetting)),this.lastTriggerKind=this._source.inlineCompletions.map(this,(ae)=>ae?.request?.context.triggerKind),this._editorObs=ct(this._editor);let re=this._editorObs.getOption(134);this._suggestPreviewEnabled=re.map((ae)=>ae.preview),this._suggestPreviewMode=re.map((ae)=>ae.previewMode);let le=this._editorObs.getOption(71);this._inlineSuggestMode=le.map((ae)=>ae.mode),this._suppressedInlineCompletionGroupIds=le.map((ae)=>new Set(ae.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=le.map((ae)=>!!ae.edits.enabled),this._inlineEditsShowCollapsedEnabled=le.map((ae)=>ae.edits.showCollapsed),this._triggerCommandOnProviderChange=le.map((ae)=>ae.triggerCommandOnProviderChange),this._minShowDelay=le.map((ae)=>ae.minShowDelay),this._showOnSuggestConflict=le.map((ae)=>ae.experimental.showOnSuggestConflict),this._suppressInSnippetMode=le.map((ae)=>ae.suppressInSnippetMode);let pe=zt.get(this._editor);this._isInSnippetMode=pe?.isInSnippetObservable??Ne(!1),te.getDefaultAccount().then(WN((ae)=>this.sku.set(e1(ae),void 0),this._store)),this._register(te.onDidChangeDefaultAccount((ae)=>this.sku.set(e1(ae),void 0))),this._typing=this._register(new Qr(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing((ae)=>{if(ae)this.stop()}));{let ae=this.textModel.uri.scheme===se.vscodeNotebookCell,[me]=this._codeEditorService.listDiffEditors().filter((De)=>De.getOriginalEditor().getId()===this._editor.getId()||De.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!me,this.editorType=ae?Ot.Notebook:this.isInDiffEditor?Ot.DiffEditor:Ot.TextEditor}this._register(Zh(this.state,(ae)=>{if(ae&&ae.inlineSuggestion)this._inlineCompletionsService.reportNewCompletion(ae.inlineSuggestion.requestUuid)})),this._register(Zh(this._fetchInlineCompletionsPromise)),this._register(W((ae)=>{this._editorObs.versionId.read(ae),this._inAcceptFlow.set(!1,void 0)})),this._register(W((ae)=>{if(this.state.map((De,Oe)=>!De||De.kind==="inlineEdit"&&!De.cursorAtInlineEdit.read(Oe)).read(ae))this._jumpedToId.set(void 0,void 0)})),this._register(W((ae)=>{let me=this.state.map((De)=>De?.inlineSuggestion).read(ae);if(me)me.addPerformanceMarker("activeSuggestion")}));let Se=this.inlineEditState.map((ae)=>ae?.inlineSuggestion.semanticId);this._register(W((ae)=>{if(Se.read(ae))this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineSuggestion}}));let we=je(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(n));gd(this,we,(ae,me)=>{if(!ae.onDidChangeInlineCompletions)return;me.add(ae.onDidChangeInlineCompletions((De)=>{if(!this._enabled.get())return;if((this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}let Me=this.state.get();if(Me&&(Me.inlineSuggestion||Me.edits)&&Me.inlineSuggestion?.source.provider!==ae)return;Ye((Ce)=>{this._fetchSpecificProviderSignal.trigger(Ce,{provider:ae,changeHint:De??void 0}),this.trigger(Ce)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}getIndentationInfo(n){let h=!1,g=!0,p=this?.primaryGhostText.read(n);if(!!this?._selectedSuggestItem&&p&&p.parts.length>0){let{column:f,lines:b}=p.parts[0],S=b[0].line,w=this.textModel.getLineIndentColumn(p.lineNumber);if(f<=w){let I=Yn(S);if(I===-1)I=S.length-1;h=I>0;let E=this.textModel.getOptions().tabSize;g=$t.visibleColumnFromColumn(S,I+1,E)<E}}return{startsWithIndentation:h,startsWithIndentationLessThanTabSize:g}}_getReason(n){if(n?.isUndoing)return os.Undo;if(n?.isRedoing)return os.Redo;if(this.isAcceptingPartially)return os.AcceptWord;return os.Other}getAvailableProviders(n){let h=this._suppressedInlineCompletionGroupIds.get(),g=n.filter((b)=>!(b.groupId&&h.has(b.groupId))),p=new Set;for(let b of g)b.excludesGroupIds?.forEach((S)=>p.add(S));let f=[];for(let b of g){if(b.groupId&&p.has(b.groupId))continue;f.push(b)}return f}async trigger(n,h={}){md(n,(g)=>{if(h.onlyFetchInlineEdits)this._onlyRequestInlineEditsSignal.trigger(g);if(h.noDelay)this._noDelaySignal.trigger(g);if(this._isActive.set(!0,g),h.explicit)this._inAcceptFlow.set(!0,g),this._forceUpdateExplicitlySignal.trigger(g);if(h.provider)this._fetchSpecificProviderSignal.trigger(g,{provider:h.provider,changeHint:h.changeHint})}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(n,h=!1){return this.trigger(n,{onlyFetchInlineEdits:h,explicit:!0})}stop(n="automatic",h){md(h,(g)=>{if(n==="explicitCancel"){let p=this.state.get()?.inlineSuggestion;if(p)p.reportEndOfLife({kind:$l.Rejected})}this._isActive.set(!1,g),this._source.clear(g)})}_computeAugmentation(n,h){let g=this.textModel,p=this._source.suggestWidgetInlineCompletions.read(h),f=p?p.inlineCompletions.filter((S)=>!S.isInlineEdit):[this.selectedInlineCompletion.read(h)].filter(ni);return y2(f,(S)=>{let w=S.getSingleTextEdit();return w=Lo(w,g,t.fromPositions(w.range.getStartPosition(),n.range.getEndPosition())),gm(w,n)?{completion:S,edit:w}:void 0})}async _deltaSelectedInlineCompletionIndex(n){await this.triggerExplicitly();let h=this._inlineCompletionItems.get()||[];if(h.length>0){let g=(this.selectedInlineCompletionIndex.get()+n+h.length)%h.length;this._selectedInlineCompletionId.set(h[g].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(n,h,g=void 0){if(g)return Xn.inlineCompletionPartialAccept({nes:n.isInlineEdit,requestUuid:n.requestUuid,providerId:n.source.provider.providerId,languageId:h,type:g,correlationId:n.getSourceCompletion().correlationId});else return Xn.inlineCompletionAccept({nes:n.isInlineEdit,requestUuid:n.requestUuid,correlationId:n.getSourceCompletion().correlationId,providerId:n.source.provider.providerId,languageId:h})}async accept(n=this._editor,h=!1){if(n.getModel()!==this.textModel)throw new H;let g,p=!1,f=this.state.get();if(f?.kind==="ghostText"){if(!f||f.primaryGhostText.isEmpty()||!f.inlineSuggestion)return;g=f.inlineSuggestion}else if(f?.kind==="inlineEdit")g=f.inlineSuggestion,p=!!f.nextEditUri;else return;g.addRef();try{let b=!1;if(n.pushUndoStop(),!g.originalTextRef.targets(this.textModel)){let S=await this._codeEditorService.openCodeEditor({resource:g.originalTextRef.uri},this._editor);if(S){let x=lm(S)?.model.get();S.focus(),x?.transplantCompletion(g),S.revealLineInCenter(g.targetRange.startLineNumber)}}else if(p);else if(g.action?.kind==="edit"){let S=g.action;if(h&&S.alternativeAction){b=!0;let w=S.alternativeAction.command;await this._commandService.executeCommand(w.id,...w.arguments||[]).then(void 0,vt)}else if(S.snippetInfo){let w=gt.delete(S.textReplacement.range),x=g.additionalTextEdits.map((E)=>new gt(t.lift(E.range),E.text??"")),I=jr.fromParallelReplacementsUnsorted([w,...x]);n.edit(I,this._getMetadata(g,this.textModel.getLanguageId())),n.setPosition(S.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),zt.get(n)?.insert(S.snippetInfo.snippet,{undoStopBefore:!1})}else{let w=f.edits,x=w;if(f.kind==="ghostText")x=KE(w,this.textModel);let I=VS(x).map((X)=>F.fromPositions(X)),E=g.additionalTextEdits.map((X)=>new gt(t.lift(X.range),X.text??"")),Z=jr.fromParallelReplacementsUnsorted([...w,...E]);if(n.edit(Z,this._getMetadata(g,this.textModel.getLanguageId())),g.hint===void 0)n.setSelections(f.kind==="inlineEdit"?I.slice(-1):I,"inlineCompletionAccept");if(f.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){let X=Z.getNewRanges(),J=this._store.add(new t1(n,X,()=>{this._store.delete(J)}))}}}if(this._onDidAccept.fire(),this.stop(),g.command)await this._commandService.executeCommand(g.command.id,...g.command.arguments||[]).then(void 0,vt);if(b)this.trigger(void 0);g.reportEndOfLife({kind:$l.Accepted,alternativeAction:h})}finally{g.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:g}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(n,h)=>{let g=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column),p=this._languageConfigurationService.getLanguageConfiguration(g),f=new RegExp(p.wordDefinition.source,p.wordDefinition.flags.replace("g","")),b=h.match(f),S=0;if(b&&b.index!==void 0)if(b.index===0)S=b[0].length;else S=b.index;else S=h.length;let x=/\s+/g.exec(h);if(x&&x.index!==void 0){if(x.index+x[0].length<S)S=x.index+x[0].length}return S},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(n,h)=>{let g=h.match(/\n/);if(g&&g.index!==void 0)return g.index+1;return h.length},1)}async _acceptNext(n,h,g,p){if(n.getModel()!==this.textModel)throw new H;let f=this.inlineCompletionState.get();if(!f||f.primaryGhostText.isEmpty()||!f.inlineSuggestion)return;let{primaryGhostText:b,inlineSuggestion:S}=f;if(S.snippetInfo){await this.accept(n);return}let w=b.parts[0],x=new s(b.lineNumber,w.column),I=w.text,E=g(x,I);if(E===I.length&&b.parts.length===1){this.accept(n);return}let Z=I.substring(0,E),X=this._positions.get(),J=X[0];S.addRef();try{this._isAcceptingPartially=!0;try{n.pushUndoStop();let le=t.fromPositions(J,x),pe=n.getModel().getValueInRange(le)+Z,Se=new gt(le,pe),we=[Se,...nw(this.textModel,X,Se)].filter(ni),ae=VS(we).map((me)=>F.fromPositions(me));n.edit(jr.fromParallelReplacementsUnsorted(we),this._getMetadata(S,this.textModel.getLanguageId(),h)),n.setSelections(ae,"inlineCompletionPartialAccept"),n.revealPositionInCenterIfOutsideViewport(n.getPosition(),0)}finally{this._isAcceptingPartially=!1}let Q=t.fromPositions(S.editRange.getStartPosition(),Kt.ofText(Z).addToPosition(x)),re=n.getModel().getValueInRange(Q,1).length;S.reportPartialAccept(re,{kind:p,acceptedLength:re},{characters:E,ratio:E/I.length,count:1})}finally{S.removeRef()}}handleSuggestAccepted(n){let h=Lo(n.getSingleTextEdit(),this.textModel),g=this._computeAugmentation(h,void 0);if(!g)return;let f=this.textModel.getValueInRange(g.completion.editRange,1).length+h.text.length;g.completion.reportPartialAccept(h.text.length,{kind:2,acceptedLength:f},{characters:h.text.length,count:1,ratio:1})}extractReproSample(){let n=this.textModel.getValue(),h=this.state.get()?.inlineSuggestion;return{documentValue:n,inlineCompletion:h?.getSourceCompletion()}}jump(){let n=this.inlineEditState.get();if(!n)return;let h=n.inlineSuggestion;if(!h.originalTextRef.targets(this.textModel)){this.accept(this._editor);return}h.addRef();try{Ye((g)=>{if(h.action?.kind==="jumpTo")this.stop(void 0,g),h.reportEndOfLife({kind:$l.Accepted,alternativeAction:!1});this._jumpedToId.set(n.inlineSuggestion.semanticId,g),this.dontRefetchSignal.trigger(g);let p=n.inlineSuggestion.targetRange,f=p.getStartPosition();if(this._editor.setPosition(f,"inlineCompletions.jump"),p.isSingleLine()&&(n.inlineSuggestion.hint||n.inlineSuggestion.action?.kind==="edit"&&!n.inlineSuggestion.action.textReplacement.text.includes(`
|
|
41
|
+
`))||n.inlineSuggestion.action?.kind==="jumpTo")this._editor.revealPosition(f,0);else{let S=new t(p.startLineNumber-1,1,p.endLineNumber+1,1);this._editor.revealRange(S,0)}n.inlineSuggestion.identity.setJumpTo(g),this._editor.focus()})}finally{h.removeRef()}}async handleInlineSuggestionShown(n,h,g,p){await n.reportInlineEditShown(this._commandService,h,g,this.textModel,p)}transplantCompletion(n){Ye((h)=>{this._source.seedWithCompletion(n,h),this._isActive.set(!0,h),this._inAcceptFlow.set(!0,h),this.dontRefetchSignal.trigger(h)})}};Lm=HN([ea(8,O),ea(9,Ue),ea(10,ht),ea(11,on),ea(12,V),ea(13,Te),ea(14,C0),ea(15,jk)],Lm);var os;(function(u){u[u.Undo=0]="Undo",u[u.Redo=1]="Redo",u[u.AcceptWord=2]="AcceptWord",u[u.Other=3]="Other"})(os||(os={}));function nw(u,n,h){if(n.length===1)return[];let g=new up(u),p=g.getTransformer(),f=p.getOffset(n[0]),b=n.slice(1).map((Z)=>p.getOffset(Z));h=h.removeCommonPrefixAndSuffix(g);let S=p.getStringReplacement(h),w=S.replaceRange.start-f,x=S.replaceRange.join(z.emptyAt(f)),I=g.getValueOfOffsetRange(x);return b.map((Z)=>{let X=Z+w,J=X+S.replaceRange.length,Q=new z(X,J),te=Q.join(z.emptyAt(Z));if(g.getValueOfOffsetRange(te)!==I)return;let le=new ui(Q,S.newText);return p.getTextReplacement(le)}).filter(ni)}class t1 extends i{constructor(u,n,h){super();if(h)this._register({dispose:()=>h()});this._register(ct(u).setDecorations(Ne(n.map((p)=>({range:p,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));let g=new US(um.startNow(1,0,1000,$E));this._register(W((p)=>{let f=g.getValue(p);if(u.getContainerDomNode().style.setProperty("--animation-opacity",f.toString()),g.isFinished(p))this.dispose()}))}}function rw(u,n,h=void 0){let g=n.targetRange;ct(u).scrollTop.read(h);let p=u.getVisibleRanges();if(p.length<1)return!1;return new t(p[0].startLineNumber,p[0].startColumn,p[p.length-1].endLineNumber,p[p.length-1].endColumn).containsRange(g)}function e1(u){if(u?.entitlementsData?.access_type_sku&&u?.entitlementsData?.copilot_plan)return{type:u.entitlementsData.access_type_sku,plan:u.entitlementsData.copilot_plan};return}class i1{constructor(u){this.handler=(n)=>this._cb?.(n),this._cb=u}dispose(){this._cb=void 0}}function WN(u,n){let h=new i1(u);return n.add(h),h.handler}var BN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},VN=function(u,n){return function(h,g){n(h,g,u)}},sw,Ah=class u{static{sw=this}static{this.AtEnd=new P("atEndOfWord",!1,{type:"boolean",description:e(1568,"A context key that is true when at the end of a word. Note that this is only defined when tab-completions are enabled")})}constructor(n,h){this._editor=n,this._enabled=!1,this._ckAtEnd=sw.AtEnd.bindTo(h),this._configListener=this._editor.onDidChangeConfiguration((g)=>g.hasChanged(139)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){let n=this._editor.getOption(139)==="on";if(this._enabled===n)return;if(this._enabled=n,this._enabled){let h=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}let g=this._editor.getModel(),p=this._editor.getSelection(),f=g.getWordAtPosition(p.getStartPosition());if(!f){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(f.endColumn===p.getStartPosition().column&&p.getStartPosition().lineNumber===p.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(h),h()}else if(this._selectionListener)this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0}};Ah=sw=BN([VN(1,K)],Ah);var KN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},zN=function(u,n){return function(h,g){n(h,g,u)}},Fh,Id=class u{static{Fh=this}static{this.OtherSuggestions=new P("hasOtherSuggestions",!1)}constructor(n,h){this._editor=n,this._index=0,this._ckOtherSuggestions=Fh.OtherSuggestions.bindTo(h)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:n,index:h},g){if(n.items.length===0){this.reset();return}if(Fh._moveIndex(!0,n,h)===h){this.reset();return}this._acceptNext=g,this._model=n,this._index=h,this._listener=this._editor.onDidChangeCursorPosition(()=>{if(!this._ignore)this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(n,h,g){let p=g;for(let f=h.items.length;f>0;f--){if(p=(p+h.items.length+(n?1:-1))%h.items.length,p===g)break;if(!h.items[p].completion.additionalTextEdits)break}return p}next(){this._move(!0)}prev(){this._move(!1)}_move(n){if(!this._model)return;try{this._ignore=!0,this._index=Fh._moveIndex(n,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}};Id=Fh=KN([zN(1,K)],Id);class aw{constructor(u,n,h,g){this._disposables=new d,this._disposables.add(h.onDidSuggest((p)=>{if(p.completionModel.items.length===0)this.reset()})),this._disposables.add(h.onDidCancel((p)=>{this.reset()})),this._disposables.add(n.onDidShow(()=>this._onItem(n.getFocusedItem()))),this._disposables.add(n.onDidFocus(this._onItem,this)),this._disposables.add(n.onDidHide(this.reset,this)),this._disposables.add(u.onWillType((p)=>{if(this._active&&!n.isFrozen()&&h.state!==0){let f=p.charCodeAt(p.length-1);if(this._active.acceptCharacters.has(f)&&u.getOption(0))g(this._active.item)}}))}_onItem(u){if(!u||!Kn(u.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===u.item)return;let n=new Ff;for(let h of u.item.completion.commitCharacters)if(h.length>0)n.add(h.charCodeAt(0));this._active={acceptCharacters:n,item:u}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}class Em{static{this._maxSelectionLength=51200}constructor(u,n){this._disposables=new d,this._lastOvertyped=[],this._locked=!1,this._disposables.add(u.onWillType(()=>{if(this._locked||!u.hasModel())return;let h=u.getSelections(),g=h.length,p=!1;for(let b=0;b<g;b++)if(!h[b].isEmpty()){p=!0;break}if(!p){if(this._lastOvertyped.length!==0)this._lastOvertyped.length=0;return}this._lastOvertyped=[];let f=u.getModel();for(let b=0;b<g;b++){let S=h[b];if(f.getValueLengthInRange(S)>Em._maxSelectionLength)return;this._lastOvertyped[b]={value:f.getValueInRange(S),multiline:S.startLineNumber!==S.endLineNumber}}})),this._disposables.add(n.onDidTrigger((h)=>{this._locked=!0})),this._disposables.add(n.onDidCancel((h)=>{this._locked=!1}))}getLastOvertypedInfo(u){if(u>=0&&u<this._lastOvertyped.length)return this._lastOvertyped[u];return}dispose(){this._disposables.dispose()}}var UN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},dw=function(u,n){return function(h,g){n(h,g,u)}},Dm=class u{constructor(n,h,g,p,f,b){this._menuId=h,this._menuService=f,this._contextKeyService=b,this._menuDisposables=new d,this.element=k(n,_(".suggest-status-bar"));let S=(w)=>{if(g?.showIconsNoKeybindings)return w instanceof Gi?p.createInstance(Bl,w,void 0):void 0;else return w instanceof Gi?p.createInstance(Fk,w,{useComma:!1}):void 0};this._leftActions=new er(this.element,{actionViewItemProvider:S}),this._rightActions=new er(this.element,{actionViewItemProvider:S}),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 n=this._menuService.createMenu(this._menuId,this._contextKeyService),h=()=>{let g=[],p=[];for(let[f,b]of n.getActions())if(f==="left")g.push(...b);else p.push(...b);this._leftActions.clear(),this._leftActions.push(g),this._rightActions.clear(),this._rightActions.push(p)};this._menuDisposables.add(n.onDidChange(()=>h())),this._menuDisposables.add(n)}hide(){this._menuDisposables.clear()}};Dm=UN([dw(3,O),dw(4,Ai),dw(5,K)],Dm);var $N=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},o1=function(u,n){return function(h,g){n(h,g,u)}};function Hh(u){return!!u&&Boolean(u.completion.documentation||u.completion.detail&&u.completion.detail!==u.completion.label)}var Rm=class u{constructor(n,h,g){this._editor=n,this._themeService=h,this._markdownRendererService=g,this._onDidClose=new r,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new r,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new d,this._renderDisposeable=new d,this._size=new at(330,0),this.domNode=_(".suggest-details"),this.domNode.classList.add("no-docs"),this._body=_(".body"),this._scrollbar=new Fl(this._body,{alwaysConsumeMouseWheel:!0}),k(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=k(this._body,_(".header")),this._close=k(this._header,_("span"+Y.asCSSSelector(C.close))),this._close.title=e(1563,"Close"),this._close.ariaLabel=e(1564,"Close"),this._close.role="button",this._close.tabIndex=-1,this._type=k(this._header,_("p.type")),this._docs=k(this._body,_("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration((p)=>{if(p.hasChanged(59))this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose(),this._onDidClose.dispose(),this._onDidChangeContents.dispose()}_configureFont(){let n=this._editor.getOptions(),h=n.get(59),g=h.getMassagedFontFamily(),p=n.get(135)||h.fontSize,f=n.get(136)||h.lineHeight,b=h.fontWeight,S=`${p}px`,w=`${f}px`;this.domNode.style.fontSize=S,this.domNode.style.lineHeight=`${f/p}`,this.domNode.style.fontWeight=b,this.domNode.style.fontFeatureSettings=h.fontFeatureSettings,this._type.style.fontFamily=g,this._close.style.height=w,this._close.style.width=w}getLayoutInfo(){let n=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,h=go(this._themeService.getColorTheme().type)?2:1,g=h*2;return{lineHeight:n,borderWidth:h,borderHeight:g,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=e(1565,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(n,h){this._renderDisposeable.clear();let{detail:g,documentation:p}=n.completion;if(h){let f="";f+=`score: ${n.score[0]}
|
|
42
|
+
`,f+=`prefix: ${n.word??"(no prefix)"}
|
|
43
|
+
`,f+=`word: ${n.completion.filterText?n.completion.filterText+" (filterText)":n.textLabel}
|
|
44
|
+
`,f+=`distance: ${n.distance} (localityBonus-setting)
|
|
45
|
+
`,f+=`index: ${n.idx}, based on ${n.completion.sortText&&`sortText: "${n.completion.sortText}"`||"label"}
|
|
46
|
+
`,f+=`commit_chars: ${n.completion.commitCharacters?.join("")}
|
|
47
|
+
`,p=new Pn().appendCodeblock("empty",f),g=`Provider: ${n.provider._debugDisplayName}`}if(!h&&!Hh(n)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),g){let f=g.length>1e5?`${g.substr(0,1e5)}…`:g;this._type.textContent=f,this._type.title=f,Mr(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(f))}else mn(this._type),this._type.title="",fr(this._type),this.domNode.classList.add("no-type");if(mn(this._docs),typeof p==="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=p;else if(p){this._docs.classList.add("markdown-docs"),mn(this._docs);let f=this._markdownRendererService.render(p,{context:this._editor,asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(f.element),this._renderDisposeable.add(f)}this.domNode.classList.toggle("detail-and-doc",!!g&&!!p),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=(f)=>{f.preventDefault(),f.stopPropagation()},this._close.onclick=(f)=>{f.preventDefault(),f.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(n,h){let g=new at(n,h);if(!at.equals(g,this._size))this._size=g,u2(this.domNode,n,h);this._scrollbar.scanDomNode()}scrollDown(n=8){this._body.scrollTop+=n}scrollUp(n=8){this._body.scrollTop-=n}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}focus(){this.domNode.focus()}};Rm=$N([o1(1,We),o1(2,Wr)],Rm);class lw{constructor(u,n){this.widget=u,this._editor=n,this.allowEditorOverflow=!0,this._disposables=new d,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new ed,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(u.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let h,g,p=0,f=0;this._disposables.add(this._resizable.onDidWillResize(()=>{h=this._topLeft,g=this._resizable.size})),this._disposables.add(this._resizable.onDidResize((b)=>{if(h&&g){this.widget.layout(b.dimension.width,b.dimension.height);let S=!1;if(b.west)f=g.width-b.dimension.width,S=!0;if(b.north)p=g.height-b.dimension.height,S=!0;if(S)this._applyTopLeft({top:h.top+p,left:h.left+f})}if(b.done)h=void 0,g=void 0,p=0,f=0,this._userSize=b.dimension})),this._disposables.add(this.widget.onDidChangeContents(()=>{if(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(){if(!this._added)this._editor.addOverlayWidget(this),this._added=!0}hide(u=!1){if(this._resizable.clearSashHoverState(),this._added)this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0;if(u)this._userSize=void 0,this.widget.clearContents()}placeAtAnchor(u,n){let h=u.getBoundingClientRect();this._anchorBox=h,this._preferAlignAtTop=n,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,n)}_placeAtAnchor(u,n,h){let g=ga(this.getDomNode().ownerDocument.body),p=this.widget.getLayoutInfo(),f=new at(220,2*p.lineHeight),b=u.top,S=function(){let ae=g.width-(u.left+u.width+p.borderWidth+p.horizontalPadding),me=-p.borderWidth+u.left+u.width,De=new at(ae,g.height-u.top-p.borderHeight-p.verticalPadding),Oe=De.with(void 0,u.top+u.height-p.borderHeight-p.verticalPadding);return{top:b,left:me,fit:ae-n.width,maxSizeTop:De,maxSizeBottom:Oe,minSize:f.with(Math.min(ae,f.width))}}(),w=function(){let ae=u.left-p.borderWidth-p.horizontalPadding,me=Math.max(p.horizontalPadding,u.left-n.width-p.borderWidth),De=new at(ae,g.height-u.top-p.borderHeight-p.verticalPadding),Oe=De.with(void 0,u.top+u.height-p.borderHeight-p.verticalPadding);return{top:b,left:me,fit:ae-n.width,maxSizeTop:De,maxSizeBottom:Oe,minSize:f.with(Math.min(ae,f.width))}}(),x=function(){let ae=u.left,me=-p.borderWidth+u.top+u.height,De=new at(u.width-p.borderHeight,g.height-u.top-u.height-p.verticalPadding);return{top:me,left:ae,fit:De.height-n.height,maxSizeBottom:De,maxSizeTop:De,minSize:f.with(De.width)}}(),I=function(){let ae=u.left,me=new at(u.width-p.borderHeight,u.top-p.verticalPadding);return{top:Math.max(p.verticalPadding,u.top-n.height),left:ae,fit:me.height-n.height,maxSizeTop:me,maxSizeBottom:me,minSize:f.with(me.width)}}(),Z=[S,w,h?x:I],X=Z.find((ae)=>ae.fit>=0)??Z.sort((ae,me)=>me.fit-ae.fit)[0],J=u.top+u.height-p.borderHeight,Q,te=n.height,re=Math.max(X.maxSizeTop.height,X.maxSizeBottom.height);if(te>re)te=re;let le;if(h)if(te<=X.maxSizeTop.height)Q=!0,le=X.maxSizeTop;else Q=!1,le=X.maxSizeBottom;else if(te<=X.maxSizeBottom.height)Q=!1,le=X.maxSizeBottom;else Q=!0,le=X.maxSizeTop;let{top:pe,left:Se}=X;if(X===I)pe=u.top-te+p.borderWidth;else if(!Q&&te>u.height)pe=J-te;let we=this._editor.getDomNode();if(we){let ae=we.getBoundingClientRect();pe-=ae.top,Se-=ae.left}if(this._applyTopLeft({left:Se,top:pe}),X===I)this._resizable.enableSashes(!0,!1,!1,!0);else this._resizable.enableSashes(!Q,X===S,Q,X!==S);this._resizable.minSize=X.minSize,this._resizable.maxSize=le,this._resizable.layout(te,Math.min(le.width,n.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(u){this._topLeft=u,this._editor.layoutOverlayWidget(this)}}var NI=ie("fileService"),So;(function(u){u[u.FILE=0]="FILE",u[u.FOLDER=1]="FOLDER",u[u.ROOT_FOLDER=2]="ROOT_FOLDER"})(So||(So={}));var jN=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function Ld(u,n,h,g,p){if(Y.isThemeIcon(p))return[`codicon-${p.id}`,"predefined-file-icon"];if(q.isUri(p))return[];let f=g===So.ROOT_FOLDER?["rootfolder-icon"]:g===So.FOLDER?["folder-icon"]:["file-icon"];if(h){let b;if(h.scheme===se.data)b=gu.parseMetaData(h).get(gu.META_DATA_LABEL);else{let S=h.path.match(jN);if(S){if(b=km(S[2].toLowerCase()),S[1])f.push(`${km(S[1].toLowerCase())}-name-dir-icon`)}else b=km(h.authority.toLowerCase())}if(g===So.ROOT_FOLDER)f.push(`${b}-root-name-folder-icon`);else if(g===So.FOLDER)f.push(`${b}-name-folder-icon`);else{if(b){if(f.push(`${b}-name-file-icon`),f.push("name-file-icon"),b.length<=255){let w=b.split(".");for(let x=1;x<w.length;x++)f.push(`${w.slice(x).join(".")}-ext-file-icon`)}f.push("ext-file-icon")}let S=GN(u,n,h);if(S)f.push(`${km(S)}-lang-file-icon`)}}return f}function GN(u,n,h){if(!h)return null;let g=null;if(h.scheme===se.data){let f=gu.parseMetaData(h).get(gu.META_DATA_MIME);if(f)g=n.getLanguageIdByMimeType(f)}else{let p=u.getModel(h);if(p)g=p.getLanguageId()}if(g&&g!==cr)return g;return n.guessLanguageIdByFilepathOrFirstLine(h)}function km(u){return u.replace(/[\s]/g,"/")}var qN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},cw=function(u,n){return function(h,g){n(h,g,u)}},ZN=Mt("suggest-more-info",C.chevronRight,e(1566,"Icon for more information in the suggest widget.")),XN=new class u{static{this._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/}static{this._regexStrict=new RegExp(`^${u._regexRelaxed.source}$`,"i")}extract(n,h){if(n.textLabel.match(u._regexStrict))return h[0]=n.textLabel,!0;if(n.completion.detail&&n.completion.detail.match(u._regexStrict))return h[0]=n.completion.detail,!0;if(n.completion.documentation){let g=typeof n.completion.documentation==="string"?n.completion.documentation:n.completion.documentation.value,p=u._regexRelaxed.exec(g);if(p&&(p.index===0||p.index+p[0].length===g.length))return h[0]=p[0],!0}return!1}},Tm=class u{constructor(n,h,g,p){this._editor=n,this._modelService=h,this._languageService=g,this._themeService=p,this._onDidToggleDetails=new r,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(n){let h=new d,g=n;g.classList.add("show-file-icons");let p=k(n,_(".icon")),f=k(p,_("span.colorspan")),b=k(n,_(".contents")),S=k(b,_(".main")),w=k(S,_(".icon-label.codicon")),x=k(S,_("span.left")),I=k(S,_("span.right")),E=new Eu(x,{supportHighlights:!0,supportIcons:!0});h.add(E);let Z=k(x,_("span.signature-label")),X=k(x,_("span.qualifier-label")),J=k(I,_("span.details-label")),Q=k(I,_("span.readMore"+Y.asCSSSelector(ZN)));return Q.title=e(1567,"Read More"),{root:g,left:x,right:I,icon:p,colorspan:f,iconLabel:E,iconContainer:w,parametersLabel:Z,qualifierLabel:X,detailsLabel:J,readMore:Q,disposables:h,configureFont:()=>{let re=this._editor.getOptions(),le=re.get(59),pe=le.getMassagedFontFamily(),{fontFeatureSettings:Se,fontVariationSettings:we}=le,ae=re.get(135)||le.fontSize,me=re.get(136)||le.lineHeight,{fontWeight:De,letterSpacing:Oe}=le,Me=`${ae}px`,Ce=`${me}px`,Pe=`${Oe}px`;g.style.fontSize=Me,g.style.fontWeight=De,g.style.letterSpacing=Pe,S.style.fontFamily=pe,S.style.fontFeatureSettings=Se,S.style.fontVariationSettings=we,S.style.lineHeight=Ce,p.style.height=Ce,p.style.width=Ce,Q.style.height=Ce,Q.style.width=Ce}}}renderElement(n,h,g){g.configureFont();let{completion:p}=n;g.colorspan.style.backgroundColor="";let f={labelEscapeNewLines:!0,matches:ap(n.score)},b=[];if(p.kind===19&&XN.extract(n,b))g.icon.className="icon customcolor",g.iconContainer.className="icon hide",g.colorspan.style.backgroundColor=b[0];else if(p.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){g.icon.className="icon hide",g.iconContainer.className="icon hide";let S=Ld(this._modelService,this._languageService,q.from({scheme:"fake",path:n.textLabel}),So.FILE),w=Ld(this._modelService,this._languageService,q.from({scheme:"fake",path:p.detail}),So.FILE);f.extraClasses=S.length>w.length?S:w}else if(p.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons)g.icon.className="icon hide",g.iconContainer.className="icon hide",f.extraClasses=[Ld(this._modelService,this._languageService,q.from({scheme:"fake",path:n.textLabel}),So.FOLDER),Ld(this._modelService,this._languageService,q.from({scheme:"fake",path:p.detail}),So.FOLDER)].flat();else g.icon.className="icon hide",g.iconContainer.className="",g.iconContainer.classList.add("suggest-icon",...Y.asClassNameArray(Jh.toIcon(p.kind)));if(p.tags&&p.tags.indexOf(1)>=0)f.extraClasses=(f.extraClasses||[]).concat(["deprecated"]),f.matches=[];if(g.iconLabel.setLabel(n.textLabel,void 0,f),typeof p.label==="string")g.parametersLabel.textContent="",g.detailsLabel.textContent=hw(p.detail||""),g.root.classList.add("string-label");else g.parametersLabel.textContent=hw(p.label.detail||""),g.detailsLabel.textContent=hw(p.label.description||""),g.root.classList.remove("string-label");if(this._editor.getOption(134).showInlineDetails)Mr(g.detailsLabel);else fr(g.detailsLabel);if(Hh(n))g.right.classList.add("can-expand-details"),Mr(g.readMore),g.readMore.onmousedown=(S)=>{S.stopPropagation(),S.preventDefault()},g.readMore.onclick=(S)=>{S.stopPropagation(),S.preventDefault(),this._onDidToggleDetails.fire()};else g.right.classList.remove("can-expand-details"),fr(g.readMore),g.readMore.onmousedown=null,g.readMore.onclick=null}disposeTemplate(n){n.disposables.dispose()}};Tm=qN([cw(1,Et),cw(2,xt),cw(3,We)],Tm);function hw(u){return u.replace(/\r\n|\r|\n/g,"")}var YN=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Nm=function(u,n){return function(h,g){n(h,g,u)}},Kl,Om=a("editorSuggestWidget.background",Vr,e(1545,"Background color of the suggest widget."));a("editorSuggestWidget.border",Vf,e(1546,"Border color of the suggest widget."));var uw=a("editorSuggestWidget.foreground",Ka,e(1547,"Foreground color of the suggest widget.")),n1=a("editorSuggestWidget.selectedForeground",{dark:wd,light:wd,hcDark:Om,hcLight:Om},e(1548,"Foreground color of the selected entry in the suggest widget."));a("editorSuggestWidget.selectedIconForeground",{dark:Wg,light:Wg,hcDark:Om,hcLight:Om},e(1549,"Icon foreground color of the selected entry in the suggest widget."));var JN=a("editorSuggestWidget.selectedBackground",{dark:xd,light:xd,hcDark:uw,hcLight:uw},e(1550,"Background color of the selected entry in the suggest widget.")),QN=a("editorSuggestWidget.focusOutline",Xt,e(1551,"Outline color of the focused (keyboard-navigated) entry in the suggest widget."));a("editorSuggestWidget.highlightForeground",qf,e(1552,"Color of the match highlights in the suggest widget."));a("editorSuggestWidget.focusHighlightForeground",{dark:u0,light:u0,hcDark:n1,hcLight:n1},e(1553,"Color of the match highlights in the suggest widget when an item is focused."));a("editorSuggestWidgetStatus.foreground",be(uw,0.5),e(1554,"Foreground color of the suggest widget status."));class r1{constructor(u,n){this._service=u,this._key=`suggestWidget.size/${n.getEditorType()}/${n instanceof Hi}`}restore(){let u=this._service.get(this._key,0)??"";try{let n=JSON.parse(u);if(at.is(n))return at.lift(n)}catch{}return}store(u){this._service.store(this._key,JSON.stringify(u),0,1)}reset(){this._service.remove(this._key,0)}}var Mm=class u{static{Kl=this}static{this.LOADING_MESSAGE=e(1555,"Loading...")}static{this.NO_SUGGESTIONS_MESSAGE=e(1556,"No suggestions.")}constructor(n,h,g,p,f){this.editor=n,this._storageService=h,this._state=0,this._isAuto=!1,this._loadingTimeout=new de,this._pendingLayout=new de,this._pendingShowDetails=new de,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new di,this._disposables=new d,this._onDidSelect=new gc,this._onDidFocus=new gc,this._onDidHide=new r,this._onDidShow=new r,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new r,this.element=new ed,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new s1(this,n),this._persistedSize=new r1(h,n);class b{constructor(J,Q,te=!1,re=!1){this.persistedSize=J,this.currentSize=Q,this.persistHeight=te,this.persistWidth=re}}let S;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),S=new b(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize((J)=>{if(this._resize(J.dimension.width,J.dimension.height),S)S.persistHeight=S.persistHeight||!!J.north||!!J.south,S.persistWidth=S.persistWidth||!!J.east||!!J.west;if(!J.done)return;if(S){let{itemHeight:Q,defaultSize:te}=this.getLayoutInfo(),re=Math.round(Q/2),{width:le,height:pe}=this.element.size;if(!S.persistHeight||Math.abs(S.currentSize.height-pe)<=re)pe=S.persistedSize?.height??te.height;if(!S.persistWidth||Math.abs(S.currentSize.width-le)<=re)le=S.persistedSize?.width??te.width;this._persistedSize.store(new at(le,pe))}this._contentWidget.unlockPreference(),S=void 0})),this._messageElement=k(this.element.domNode,_(".message")),this._listElement=k(this.element.domNode,_(".tree"));let w=this._disposables.add(f.createInstance(Rm,this.editor));w.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new lw(w,this.editor);let x=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);x();let I=()=>this.element.domNode.classList.toggle("fit-width-to-details",this.editor.getOption(134).fitWidthToDetails);I();let E=f.createInstance(Tm,this.editor);this._disposables.add(E),this._disposables.add(E.onDidToggleDetails(()=>this.toggleDetails())),this._list=new kr("SuggestWidget",this._listElement,{getHeight:(J)=>this.getLayoutInfo().itemHeight,getTemplateId:(J)=>"suggestion"},[E],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>rn?"listitem":"option",getWidgetAriaLabel:()=>e(1557,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:(J)=>{let Q=J.textLabel,te=Jh.toLabel(J.completion.kind);if(typeof J.completion.label!=="string"){let{detail:Se,description:we}=J.completion.label;if(Se&&we)Q=e(1558,"{0} {1}, {2}, {3}",Q,Se,we,te);else if(Se)Q=e(1559,"{0} {1}, {2}",Q,Se,te);else if(we)Q=e(1560,"{0}, {1}, {2}",Q,we,te)}else Q=e(1561,"{0}, {1}",Q,te);if(!J.isResolved||!this._isDetailsVisible())return Q;let{documentation:re,detail:le}=J.completion,pe=qa("{0}{1}",le||"",re?typeof re==="string"?re:re.value:"");return e(1562,"{0}, docs: {1}",Q,pe)}}}),this._list.style(Ed({listInactiveFocusBackground:JN,listInactiveFocusOutline:QN})),this._status=f.createInstance(Dm,this.element.domNode,vn,void 0);let Z=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);Z(),this._disposables.add(this._list.onMouseDown((J)=>this._onListMouseDownOrTap(J))),this._disposables.add(this._list.onTap((J)=>this._onListMouseDownOrTap(J))),this._disposables.add(this._list.onDidChangeSelection((J)=>this._onListSelection(J))),this._disposables.add(this._list.onDidChangeFocus((J)=>this._onListFocus(J))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration((J)=>{if(J.hasChanged(134))Z(),x(),I();if(this._completionModel&&(J.hasChanged(59)||J.hasChanged(135)||J.hasChanged(136)))this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Fe.Visible.bindTo(g),this._ctxSuggestWidgetDetailsVisible=Fe.DetailsVisible.bindTo(g),this._ctxSuggestWidgetMultipleSuggestions=Fe.MultipleSuggestions.bindTo(g),this._ctxSuggestWidgetHasFocusedSuggestion=Fe.HasFocusedSuggestion.bindTo(g),this._ctxSuggestWidgetDetailsFocused=Fe.DetailsFocused.bindTo(g);let X=wi(this._details.widget.domNode);this._disposables.add(X),this._disposables.add(X.onDidFocus(()=>this._ctxSuggestWidgetDetailsFocused.set(!0))),this._disposables.add(X.onDidBlur(()=>this._ctxSuggestWidgetDetailsFocused.set(!1))),this._disposables.add(Ct(this._details.widget.domNode,"keydown",(J)=>{this._onDetailsKeydown.fire(J)})),this._disposables.add(this.editor.onMouseDown((J)=>this._onEditorMouseDown(J)))}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(n){if(this._details.widget.domNode.contains(n.target.element))this._details.widget.domNode.focus();else if(this.element.domNode.contains(n.target.element))this.editor.focus()}_onCursorSelectionChanged(){if(this._state!==0)this._contentWidget.layout()}_onListMouseDownOrTap(n){if(typeof n.element>"u"||typeof n.index>"u")return;n.browserEvent.preventDefault(),n.browserEvent.stopPropagation(),this._select(n.element,n.index)}_onListSelection(n){if(n.elements.length)this._select(n.elements[0],n.indexes[0])}_select(n,h){let g=this._completionModel;if(g)this._onDidSelect.fire({item:n,index:h,model:g}),this.editor.focus()}_onListFocus(n){if(this._ignoreFocusEvents)return;if(this._state===5)this._setState(3);if(!n.elements.length){if(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 h=n.elements[0],g=n.indexes[0];if(h!==this._focusedItem)this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=h,this._list.reveal(g),this._currentSuggestionDetails=Zt(async(p)=>{let f=yi(()=>{if(this._isDetailsVisible())this._showDetails(!0,!1)},250),b=p.onCancellationRequested(()=>f.dispose());try{return await h.resolve(p)}finally{f.dispose(),b.dispose()}}),this._currentSuggestionDetails.then(()=>{if(g>=this._list.length||h!==this._list.element(g))return;if(this._ignoreFocusEvents=!0,this._list.splice(g,1,[h]),this._list.setFocus([g]),this._ignoreFocusEvents=!1,this._isDetailsVisible())this._showDetails(!1,!1);else this.element.domNode.classList.remove("docs-side");this.editor.setAriaOptions({activeDescendant:this._list.getElementID(g)})}).catch(ee);this._onDidFocus.fire({item:h,index:g,model:this._completionModel})}_setState(n){if(this._state===n)return;switch(this._state=n,this.element.domNode.classList.toggle("frozen",n===4),this.element.domNode.classList.remove("message"),n){case 0:fr(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=Kl.LOADING_MESSAGE,fr(this._listElement,this._status.element),Mr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Br(Kl.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Kl.NO_SUGGESTIONS_MESSAGE,fr(this._listElement,this._status.element),Mr(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,Br(Kl.NO_SUGGESTIONS_MESSAGE);break;case 3:fr(this._messageElement),Mr(this._listElement,this._status.element),this._show();break;case 4:fr(this._messageElement),Mr(this._listElement,this._status.element),this._show();break;case 5:fr(this._messageElement),Mr(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(n,h){if(this._state!==0)return;if(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!n,!this._isAuto)this._loadingTimeout.value=yi(()=>this._setState(1),h)}showSuggestions(n,h,g,p,f){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout.clear(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==n)this._completionModel=n;if(g&&this._state!==2&&this._state!==0){this._setState(4);return}let b=this._completionModel.items.length,S=b===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(b>1),S){this._setState(p?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(g?4:3),this._list.reveal(h,0,h===0?0:this.getLayoutInfo().itemHeight*0.33),this._list.setFocus(f?[]:[h])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=_v(B(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){if(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};return}toggleDetailsFocus(){if(this._state===5)this._list.setFocus(this._list.getFocus()),this._setState(3);else if(this._state===3)if(this._setState(5),!this._isDetailsVisible())this.toggleDetails(!0);else this._details.widget.focus()}toggleDetails(n=!1){if(this._isDetailsVisible())this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details");else if((Hh(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,n)}_showDetails(n,h){this._pendingShowDetails.value=_v(B(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let g=!1;if(n)this._details.widget.renderLoading();else this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode);if(!this._details.widget.isEmpty){if(this._positionDetails(),this.element.domNode.classList.add("shows-details"),h)this._details.widget.focus(),g=!0}else this._details.hide();if(!g)this.editor.focus()})}toggleExplainMode(){if(this._list.getFocusedElements()[0])if(this._explainMode=!this._explainMode,!this._isDetailsVisible())this.toggleDetails();else this._showDetails(!1,!1)}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 n=this._persistedSize.restore(),h=Math.ceil(this.getLayoutInfo().itemHeight*4.3);if(n&&n.height<h)this._persistedSize.store(n.with(void 0,h))}isFrozen(){return this._state===4}_afterRender(n){if(n===null){if(this._isDetailsVisible())this._details.hide();return}if(this._state===2||this._state===1)return;if(this._isDetailsVisible()&&!this._details.widget.isEmpty)this._details.show();this._positionDetails()}_layout(n){if(!this.editor.hasModel())return;if(!this.editor.getDomNode())return;let h=ga(this.element.domNode.ownerDocument.body),g=this.getLayoutInfo();if(!n)n=g.defaultSize;let p=n.height,f=n.width;if(this._status.element.style.height=`${g.itemHeight}px`,this._state===2||this._state===1)p=g.itemHeight+g.borderHeight,f=g.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new at(f,p),this._contentWidget.setPreference(2);else{let b=h.width-g.borderHeight-2*g.horizontalPadding;if(f>b)f=b;let S=this._completionModel?this._completionModel.stats.pLabelLen*g.typicalHalfwidthCharacterWidth:f;if(this.editor.getOption(134).fitWidthToDetails&&this._completionModel&&!this._persistedSize.restore()){let le=Math.min(b,this.editor.getLayoutInfo().width),pe=Math.min(le,this._measureContentWidth(g));f=Math.max(f,pe),S=Math.max(S,pe)}let w=g.statusBarHeight+this._list.contentHeight+g.borderHeight,x=g.itemHeight+g.statusBarHeight,I=kt(this.editor.getDomNode()),E=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),Z=I.top+E.top+E.height,X=Math.min(h.height-Z-g.verticalPadding,w),J=I.top+E.top-g.verticalPadding,Q=Math.min(J,w),te=Math.min(Math.max(Q,X)+g.borderHeight,w);if(p===this._cappedHeight?.capped)p=this._cappedHeight.wanted;if(p<x)p=x;if(p>te)p=te;let re=150;if(p>X&&Q>X||this._forceRenderingAbove&&J>re)this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),te=Q;else this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),te=X;this.element.preferredSize=new at(S,g.defaultSize.height),this.element.maxSize=new at(b,te),this.element.minSize=new at(220,x),this._cappedHeight=p===w?{wanted:this._cappedHeight?.wanted??n.height,capped:p}:void 0}this._resize(f,p)}_resize(n,h){let{width:g,height:p}=this.element.maxSize;n=Math.min(g,n),h=Math.min(p,h);let{statusBarHeight:f}=this.getLayoutInfo();this._list.layout(h-f,n),this._listElement.style.height=`${h-f}px`,this.element.layout(h,n),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){if(this._isDetailsVisible())this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}_measureContentWidth(n){let h=this._completionModel;if(!h)return 0;if(this._fitContentWidth?.model===h)return this._fitContentWidth.width;if(this._measureContext===void 0)this._measureContext=_("canvas").getContext("2d");let g;if(this._measureContext){let b=this.editor.getOptions(),S=b.get(59),w=b.get(135)||S.fontSize;this._measureContext.font=`${S.fontWeight} ${w}px ${S.getMassagedFontFamily()}`,g=0;for(let x of h.items){let{completion:I}=x,E=x.textLabel;if(typeof I.label==="string")E+=I.detail??"";else E+=(I.label.detail??"")+(I.label.description??"");g=Math.max(g,this._measureContext.measureText(E).width)}}else g=h.stats.pLabelLen*n.typicalHalfwidthCharacterWidth;let p=2*n.itemHeight+2*n.horizontalPadding+20,f=g+p;return this._fitContentWidth={model:h,width:f},f}getLayoutInfo(){let n=this.editor.getOption(59),h=Ki(this.editor.getOption(136)||n.lineHeight,8,1000),g=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:h,p=this._details.widget.getLayoutInfo().borderWidth,f=2*p;return{itemHeight:h,statusBarHeight:g,borderWidth:p,borderHeight:f,typicalHalfwidthCharacterWidth:n.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new at(430,g+12*h)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(n){this._storageService.store("expandSuggestionDocs",n,0,0)}forceRenderingAbove(){if(!this._forceRenderingAbove)this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore())}stopForceRenderingAbove(){this._forceRenderingAbove=!1}};Mm=Kl=YN([Nm(1,Mn),Nm(2,K),Nm(3,We),Nm(4,O)],Mm);class s1{constructor(u,n){this._widget=u,this._editor=n,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){if(this._added)this._added=!1,this._editor.removeContentWidget(this)}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){if(this._hidden=!1,!this._added)this._added=!0,this._editor.addContentWidget(this)}hide(){if(!this._hidden)this._hidden=!0,this.layout()}layout(){this._editor.layoutContentWidget(this)}getPosition(){if(this._hidden||!this._position||!this._preference)return null;return{position:this._position,preference:[this._preference]}}beforeRender(){let{height:u,width:n}=this._widget.element.size,{borderWidth:h,horizontalPadding:g}=this._widget.getLayoutInfo();return new at(n+2*h+g,u+2*h)}afterRender(u){this._widget._afterRender(u)}setPreference(u){if(!this._preferenceLocked)this._preference=u}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(u){this._position=u}}var eO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},zl=function(u,n){return function(h,g){n(h,g,u)}},gw;class a1{constructor(u,n){if(this._model=u,this._position=n,this._decorationOptions=ue.register({description:"suggest-line-suffix",stickiness:1}),u.getLineMaxColumn(n.lineNumber)!==n.column){let g=u.getOffsetAt(n),p=u.getPositionAt(g+1);u.changeDecorations((f)=>{if(this._marker)f.removeDecoration(this._marker);this._marker=f.addDecoration(t.fromPositions(n,p),this._decorationOptions)})}}dispose(){if(this._marker&&!this._model.isDisposed())this._model.changeDecorations((u)=>{u.removeDecoration(this._marker),this._marker=void 0})}delta(u){if(this._model.isDisposed()||this._position.lineNumber!==u.lineNumber)return 0;if(this._marker){let n=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(n.getStartPosition())-this._model.getOffsetAt(u)}else return this._model.getLineMaxColumn(u.lineNumber)-u.column}}var Go=class u{static{gw=this}static{this.ID="editor.contrib.suggestController"}static get(n){return n.getContribution(gw.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}constructor(n,h,g,p,f,b,S){this._memoryService=h,this._commandService=g,this._contextKeyService=p,this._instantiationService=f,this._logService=b,this._telemetryService=S,this._lineSuffix=new de,this._toDispose=new d,this._selectors=new d1((E)=>E.priority),this._onWillInsertSuggestItem=new r,this._wantsForceRenderingAbove=!1,this.editor=n,this.model=f.createInstance(vl,this.editor),this._selectors.register({priority:0,select:(E,Z,X)=>this._memoryService.select(E,Z,X)});let w=Fe.InsertMode.bindTo(p);w.set(n.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>w.set(n.getOption(134).insertMode))),this.widget=this._toDispose.add(new t0(B(n.getDomNode()),()=>{let E=this._instantiationService.createInstance(Mm,this.editor);this._toDispose.add(E),this._toDispose.add(E.onDidSelect((te)=>this._insertSuggestion(te,0),this));let Z=new aw(this.editor,E,this.model,(te)=>this._insertSuggestion(te,2));this._toDispose.add(Z);let X=Fe.MakesTextEdit.bindTo(this._contextKeyService),J=Fe.HasInsertAndReplaceRange.bindTo(this._contextKeyService),Q=Fe.CanResolve.bindTo(this._contextKeyService);if(this._toDispose.add(D(()=>{X.reset(),J.reset(),Q.reset()})),this._toDispose.add(E.onDidFocus(({item:te})=>{let re=this.editor.getPosition(),le=te.editStart.column,pe=re.column,Se=!0;if(this.editor.getOption(1)==="smart"&&this.model.state===2&&!te.completion.additionalTextEdits&&!(te.completion.insertTextRules&4)&&pe-le===te.completion.insertText.length)Se=this.editor.getModel().getValueInRange({startLineNumber:re.lineNumber,startColumn:le,endLineNumber:re.lineNumber,endColumn:pe})!==te.completion.insertText;X.set(Se),J.set(!s.equals(te.editInsertEnd,te.editReplaceEnd)),Q.set(Boolean(te.provider.resolveCompletionItem)||Boolean(te.completion.documentation)||te.completion.detail!==te.completion.label)})),this._wantsForceRenderingAbove)E.forceRenderingAbove();return E})),this._overtypingCapturer=this._toDispose.add(new t0(B(n.getDomNode()),()=>this._toDispose.add(new Em(this.editor,this.model)))),this._alternatives=this._toDispose.add(new t0(B(n.getDomNode()),()=>this._toDispose.add(new Id(this.editor,this._contextKeyService)))),this._toDispose.add(f.createInstance(Ah,n)),this._toDispose.add(this.model.onDidTrigger((E)=>{this.widget.value.showTriggered(E.auto,E.shy?250:50),this._lineSuffix.value=new a1(this.editor.getModel(),E.position)})),this._toDispose.add(this.model.onDidSuggest((E)=>{if(E.triggerOptions.shy)return;let Z=-1;for(let J of this._selectors.itemsOrderedByPriorityDesc)if(Z=J.select(this.editor.getModel(),this.editor.getPosition(),E.completionModel.items),Z!==-1)break;if(Z===-1)Z=0;if(this.model.state===0)return;let X=!1;if(E.triggerOptions.auto){let J=this.editor.getOption(134);if(J.selectionMode==="never"||J.selectionMode==="always")X=J.selectionMode==="never";else if(J.selectionMode==="whenTriggerCharacter")X=E.triggerOptions.triggerKind!==1;else if(J.selectionMode==="whenQuickSuggestion")X=E.triggerOptions.triggerKind===1&&!E.triggerOptions.refilter}this.widget.value.showSuggestions(E.completionModel,Z,E.isFrozen,E.triggerOptions.auto,X)})),this._toDispose.add(this.model.onDidCancel((E)=>{if(!E.retrigger)this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));let x=Fe.AcceptSuggestionsOnEnter.bindTo(p),I=()=>{let E=this.editor.getOption(1);x.set(E==="on"||E==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>I())),I()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(n,h){if(!n||!n.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;let g=zt.get(this.editor);if(!g)return;this._onWillInsertSuggestItem.fire({item:n.item});let p=this.editor.getModel(),f=p.getAlternativeVersionId(),{item:b}=n,S=[],w=new Je;if(!(h&1))this.editor.pushUndoStop();let x=this.getOverwriteInfo(b,Boolean(h&8));this._memoryService.memorize(p,this.editor.getPosition(),b);let I=b.isResolved,E=-1,Z=-1;if(Array.isArray(b.completion.additionalTextEdits)){this.model.cancel();let J=rs.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",b.completion.additionalTextEdits.map((Q)=>{let te=t.lift(Q.range);if(te.startLineNumber===b.position.lineNumber&&te.startColumn>b.position.column){let re=this.editor.getPosition().column-b.position.column,le=re,pe=t.spansMultipleLines(te)?0:re;te=new t(te.startLineNumber,te.startColumn+le,te.endLineNumber,te.endColumn+pe)}return Yt.replaceMove(te,Q.text)})),J.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!I){let J=new dn,Q,te=p.onDidChangeContent((Se)=>{if(Se.isFlush){w.cancel(),te.dispose();return}for(let we of Se.changes){let ae=t.getEndPosition(we.range);if(!Q||s.isBefore(ae,Q))Q=ae}}),re=h;h|=2;let le=!1,pe=this.editor.onWillType(()=>{if(pe.dispose(),le=!0,!(re&2))this.editor.pushUndoStop()});S.push(b.resolve(w.token).then(()=>{if(!b.completion.additionalTextEdits||w.token.isCancellationRequested)return;if(Q&&b.completion.additionalTextEdits.some((we)=>s.isBefore(Q,t.getStartPosition(we.range))))return!1;if(le)this.editor.pushUndoStop();let Se=rs.capture(this.editor);if(this.editor.executeEdits("suggestController.additionalTextEdits.async",b.completion.additionalTextEdits.map((we)=>Yt.replaceMove(t.lift(we.range),we.text))),Se.restoreRelativeVerticalPositionOfCursor(this.editor),le||!(re&2))this.editor.pushUndoStop();return!0}).then((Se)=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",J.elapsed(),Se),Z=Se===!0?1:Se===!1?0:-2}).finally(()=>{te.dispose(),pe.dispose()}))}let{insertText:X}=b.completion;if(!(b.completion.insertTextRules&4))X=no.escape(X);if(this.model.cancel(),g.insert(X,{overwriteBefore:x.overwriteBefore,overwriteAfter:x.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(b.completion.insertTextRules&1),clipboardText:n.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:Xn.suggest({providerId:yv.fromExtensionId(b.extensionId?.value)})}),!(h&2))this.editor.pushUndoStop();if(b.completion.command)if(b.completion.command.id===Pm.id)this.model.trigger({auto:!0,retrigger:!0});else{let J=new dn;S.push(this._commandService.executeCommand(b.completion.command.id,...b.completion.command.arguments?[...b.completion.command.arguments]:[]).catch((Q)=>{if(b.completion.extensionId)vt(Q);else ee(Q)}).finally(()=>{E=J.elapsed()}))}if(h&4)this._alternatives.value.set(n,(J)=>{w.cancel();while(p.canUndo()){if(f!==p.getAlternativeVersionId())p.undo();this._insertSuggestion(J,3|(h&8?8:0));break}});this._alertCompletionItem(b),Promise.all(S).finally(()=>{this._reportSuggestionAcceptedTelemetry(b,p,I,E,Z,n.index,n.model.items),this.model.clear(),w.dispose()})}_reportSuggestionAcceptedTelemetry(n,h,g,p,f,b,S){if(Math.random()>0.0001)return;let w=new Map;for(let Z=0;Z<Math.min(30,S.length);Z++){let X=S[Z].textLabel;if(w.has(X))w.get(X).push(Z);else w.set(X,[Z])}let x=w.get(n.textLabel),E=x&&x.length>1?x[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:n.extensionId?.value??"unknown",providerId:n.provider._debugDisplayName??"unknown",kind:n.completion.kind,basenameHash:hu(Pi(h.uri)).toString(16),languageId:h.getLanguageId(),fileExtension:m2(h.uri),resolveInfo:!n.provider.resolveCompletionItem?-1:g?1:0,resolveDuration:n.resolveDuration,commandDuration:p,additionalEditsAsync:f,index:b,firstIndex:E})}getOverwriteInfo(n,h){He(this.editor.hasModel());let g=this.editor.getOption(134).insertMode==="replace";if(h)g=!g;let p=n.position.column-n.editStart.column,f=(g?n.editReplaceEnd.column:n.editInsertEnd.column)-n.position.column,b=this.editor.getPosition().column-n.position.column,S=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:p+b,overwriteAfter:f+S}}_alertCompletionItem(n){if(Kn(n.completion.additionalTextEdits)){let h=e(1534,"Accepting '{0}' made {1} additional edits",n.textLabel,n.completion.additionalTextEdits.length);zn(h)}}triggerSuggest(n,h,g){if(this.editor.hasModel())this.model.trigger({auto:h??!1,completionOptions:{providerFilter:n,kindFilter:g?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus()}triggerSuggestAndAcceptBest(n){if(!this.editor.hasModel())return;let h=this.editor.getPosition(),g=()=>{if(h.equals(this.editor.getPosition()))this._commandService.executeCommand(n.fallback)},p=(f)=>{if(f.completion.insertTextRules&4||f.completion.additionalTextEdits)return!0;let b=this.editor.getPosition(),S=f.editStart.column,w=b.column;if(w-S!==f.completion.insertText.length)return!0;return this.editor.getModel().getValueInRange({startLineNumber:b.lineNumber,startColumn:S,endLineNumber:b.lineNumber,endColumn:w})!==f.completion.insertText};R.once(this.model.onDidTrigger)((f)=>{let b=[];R.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{Ve(b),g()},void 0,b),this.model.onDidSuggest(({completionModel:S})=>{if(Ve(b),S.items.length===0){g();return}let w=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),S.items),x=S.items[w];if(!p(x)){g();return}this.editor.pushUndoStop(),this._insertSuggestion({index:w,item:x,model:S},7)},void 0,b)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(h,0),this.editor.focus()}acceptSelectedSuggestion(n,h){let g=this.widget.value.getFocusedItem(),p=0;if(n)p|=4;if(h)p|=8;this._insertSuggestion(g,p)}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(){if(this.widget.isInitialized)this.widget.value.forceRenderingAbove();else this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){if(this.widget.isInitialized)this.widget.value.stopForceRenderingAbove();else this._wantsForceRenderingAbove=!1}registerSelector(n){return this._selectors.register(n)}};Go=gw=eO([zl(1,bl),zl(2,Ue),zl(3,K),zl(4,O),zl(5,Ze),zl(6,Wn)],Go);class d1{constructor(u){this.prioritySelector=u,this._items=[]}register(u){if(this._items.indexOf(u)!==-1)throw Error("Value is already registered");return this._items.push(u),this._items.sort((n,h)=>this.prioritySelector(h)-this.prioritySelector(n)),{dispose:()=>{let n=this._items.indexOf(u);if(n>=0)this._items.splice(n,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}class Pm extends U{static{this.id="editor.action.triggerSuggest"}constructor(){super({id:Pm.id,label:y(1543,"Trigger Suggest"),precondition:L.and(o.writable,o.hasCompletionItemProvider,Fe.Visible.toNegated()),kbOpts:{kbExpr:o.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(u,n,h){let g=Go.get(n);if(!g)return;let p;if(h&&typeof h==="object"){if(h.auto===!0)p=!0}g.triggerSuggest(void 0,p,void 0)}}fe(Go.ID,Go,2);A(Pm);var to=190,Bi=nn.bindToContribution(Go.get);G(new Bi({id:"acceptSelectedSuggestion",precondition:L.and(Fe.Visible,Fe.HasFocusedSuggestion),handler(u){u.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:L.and(Fe.Visible,o.textInputFocus),weight:to},{primary:3,kbExpr:L.and(Fe.Visible,o.textInputFocus,Fe.AcceptSuggestionsOnEnter,Fe.MakesTextEdit),weight:to}],menuOpts:[{menuId:vn,title:e(1535,"Insert"),group:"left",order:1,when:L.and(Fe.HasFocusedSuggestion,Fe.HasInsertAndReplaceRange.toNegated())},{menuId:vn,title:e(1536,"Insert"),group:"left",order:1,when:L.and(Fe.HasFocusedSuggestion,Fe.HasInsertAndReplaceRange,Fe.InsertMode.isEqualTo("insert"))},{menuId:vn,title:e(1537,"Replace"),group:"left",order:1,when:L.and(Fe.HasFocusedSuggestion,Fe.HasInsertAndReplaceRange,Fe.InsertMode.isEqualTo("replace"))}]}));G(new Bi({id:"acceptAlternativeSelectedSuggestion",precondition:L.and(Fe.Visible,o.textInputFocus,Fe.HasFocusedSuggestion),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:1027,secondary:[1026]},handler(u){u.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:vn,group:"left",order:2,when:L.and(Fe.HasFocusedSuggestion,Fe.HasInsertAndReplaceRange,Fe.InsertMode.isEqualTo("insert")),title:e(1538,"Replace")},{menuId:vn,group:"left",order:2,when:L.and(Fe.HasFocusedSuggestion,Fe.HasInsertAndReplaceRange,Fe.InsertMode.isEqualTo("replace")),title:e(1539,"Insert")}]}));$e.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion");G(new Bi({id:"hideSuggestWidget",precondition:Fe.Visible,handler:(u)=>u.cancelSuggestWidget(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:9,secondary:[1033]}}));G(new Bi({id:"selectNextSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectNextSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}},menuOpts:{menuId:vn,group:"left",order:0,when:Fe.HasFocusedSuggestion.toNegated(),title:e(1540,"Select")}}));G(new Bi({id:"selectNextPageSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectNextPageSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:12,secondary:[2060]}}));G(new Bi({id:"selectLastSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectLastSuggestion()}));G(new Bi({id:"selectPrevSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectPrevSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}}));G(new Bi({id:"selectPrevPageSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectPrevPageSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:11,secondary:[2059]}}));G(new Bi({id:"selectFirstSuggestion",precondition:L.and(Fe.Visible,L.or(Fe.MultipleSuggestions,Fe.HasFocusedSuggestion.negate())),handler:(u)=>u.selectFirstSuggestion()}));G(new Bi({id:"focusSuggestion",precondition:L.and(Fe.Visible,Fe.HasFocusedSuggestion.negate()),handler:(u)=>u.focusSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}}));G(new Bi({id:"focusAndAcceptSuggestion",precondition:L.and(Fe.Visible,Fe.HasFocusedSuggestion.negate()),handler:(u)=>{u.focusSuggestion(),u.acceptSelectedSuggestion(!0,!1)}}));G(new Bi({id:"toggleSuggestionDetails",precondition:L.and(Fe.Visible,Fe.HasFocusedSuggestion),handler:(u)=>u.toggleSuggestionDetails(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:vn,group:"right",order:1,when:L.and(Fe.DetailsVisible,Fe.CanResolve),title:e(1541,"Show Less")},{menuId:vn,group:"right",order:1,when:L.and(Fe.DetailsVisible.toNegated(),Fe.CanResolve),title:e(1542,"Show More")}]}));G(new Bi({id:"toggleExplainMode",precondition:Fe.Visible,handler:(u)=>u.toggleExplainMode(),kbOpts:{weight:100,primary:2138}}));G(new Bi({id:"toggleSuggestionFocus",precondition:Fe.Visible,handler:(u)=>u.toggleSuggestionFocus(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:2570,mac:{primary:778}}}));G(new Bi({id:"insertBestCompletion",precondition:L.and(o.textInputFocus,L.equals("config.editor.tabCompletion","on"),Ah.AtEnd,Fe.Visible.toNegated(),Id.OtherSuggestions.toNegated(),zt.InSnippetMode.toNegated()),handler:(u,n)=>{u.triggerSuggestAndAcceptBest(cn(n)?{fallback:"tab",...n}:{fallback:"tab"})},kbOpts:{weight:to,primary:2}}));G(new Bi({id:"insertNextSuggestion",precondition:L.and(o.textInputFocus,L.equals("config.editor.tabCompletion","on"),Id.OtherSuggestions,Fe.Visible.toNegated(),zt.InSnippetMode.toNegated()),handler:(u)=>u.acceptNextSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:2}}));G(new Bi({id:"insertPrevSuggestion",precondition:L.and(o.textInputFocus,L.equals("config.editor.tabCompletion","on"),Id.OtherSuggestions,Fe.Visible.toNegated(),zt.InSnippetMode.toNegated()),handler:(u)=>u.acceptPrevSuggestion(),kbOpts:{weight:to,kbExpr:o.textInputFocus,primary:1026}}));G(new class extends nn{constructor(){super({id:"suggestWidgetCopy",precondition:Fe.DetailsFocused,kbOpts:{weight:to+10,kbExpr:Fe.DetailsFocused,primary:2081,win:{primary:2081,secondary:[2067]}}})}runEditorCommand(u,n){B(n.getDomNode()).document.execCommand("copy")}});A(class extends U{constructor(){super({id:"editor.action.resetSuggestSize",label:y(1544,"Reset Suggest Widget Size"),precondition:void 0})}run(u,n){Go.get(n)?.resetWidgetSize()}});class l1 extends i{get selectedItem(){return this._currentSuggestItemInfo}constructor(u,n,h){super();this.editor=u,this.suggestControllerPreselector=n,this.onWillAccept=h,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new r),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(u.onKeyDown((p)=>{if(p.shiftKey&&!this.isShiftKeyPressed)this.isShiftKeyPressed=!0,this.update(this._isActive)})),this._register(u.onKeyUp((p)=>{if(p.shiftKey&&this.isShiftKeyPressed)this.isShiftKeyPressed=!1,this.update(this._isActive)}));let g=Go.get(this.editor);if(g){this._register(g.registerSelector({priority:100,select:(b,S,w)=>{let x=this.editor.getModel();if(!x)return-1;let I=this.suggestControllerPreselector(),E=I?Lo(I,x):void 0;if(!E)return-1;let Z=s.lift(S),X=w.map((Q,te)=>{let re=$h.fromSuggestion(g,x,Z,Q,this.isShiftKeyPressed),le=Lo(re.getSingleTextEdit(),x),pe=gm(E,le);return{index:te,valid:pe,prefixLength:le.text.length,suggestItem:Q}}).filter((Q)=>Q&&Q.valid&&Q.prefixLength>0),J=o0(X,Bn((Q)=>Q.prefixLength,Ui));return J?J.index:-1}}));let p=!1,f=()=>{if(p)return;p=!0,this._register(g.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(g.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(g.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)}))};this._register(R.once(g.model.onDidTrigger)((b)=>{f()})),this._register(g.onWillInsertSuggestItem((b)=>{let S=this.editor.getPosition(),w=this.editor.getModel();if(!S||!w)return;let x=$h.fromSuggestion(g,w,S,b.item,this.isShiftKeyPressed);this.onWillAccept(x)}))}this.update(this._isActive)}update(u){let n=this.getSuggestItemInfo();if(this._isActive!==u||!tO(this._currentSuggestItemInfo,n))this._isActive=u,this._currentSuggestItemInfo=n,this._onDidSelectedItemChange.fire()}getSuggestItemInfo(){let u=Go.get(this.editor);if(!u||!this.isSuggestWidgetVisible)return;let n=u.widget.value.getFocusedItem(),h=this.editor.getPosition(),g=this.editor.getModel();if(!n||!h||!g)return;return $h.fromSuggestion(u,g,h,n.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Go.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Go.get(this.editor)?.forceRenderingAbove()}}class $h{static fromSuggestion(u,n,h,g,p){let{insertText:f}=g.completion,b=!1;if(g.completion.insertTextRules&4){let w=new no().parse(f);if(w.children.length<100)_l.adjustWhitespace(n,h,!0,w);f=w.toString(),b=!0}let S=u.getOverwriteInfo(g,p);return new $h(t.fromPositions(h.delta(0,-S.overwriteBefore),h.delta(0,Math.max(S.overwriteAfter,0))),f,g.completion.kind,b,g.container.incomplete??!1)}constructor(u,n,h,g,p){this.range=u,this.insertText=n,this.completionItemKind=h,this.isSnippetText=g,this.listIncomplete=p}equals(u){return this.range.equalsRange(u.range)&&this.insertText===u.insertText&&this.completionItemKind===u.completionItemKind&&this.isSnippetText===u.isSnippetText}toSelectedSuggestionInfo(){return new K_(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new gt(this.range,this.insertText)}}function tO(u,n){if(u===n)return!0;if(!u||!n)return!1;return u.equals(n)}class pw extends i{constructor(u,n,h){super();this._editorObs=u,this._handleSuggestAccepted=n,this._suggestControllerPreselector=h,this._suggestWidgetAdaptor=this._register(new l1(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),(g)=>this._editorObs.forceUpdate((p)=>{this._handleSuggestAccepted(g)}))),this.selectedItem=je(this,(g)=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate((p)=>g(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}}class mw{constructor(u,n){this.lineNumber=u,this.columnRange=n}}class Am{constructor(u,n){if(this.startColumn=u,this.endColumnExclusive=n,u>n)throw new H(`startColumn ${u} cannot be after endColumnExclusive ${n}`)}toRange(u){return new t(u,this.startColumn,u,this.endColumnExclusive)}equals(u){return this.startColumn===u.startColumn&&this.endColumnExclusive===u.endColumnExclusive}toZeroBasedOffsetRange(){return new z(this.startColumn-1,this.endColumnExclusive-1)}}class ta{static fromLineTokens(u){let n=[];for(let h=0;h<u.getCount();h++)n.push(new fw(u.getTokenText(h),u.getMetadata(h)));return ta.create(n)}static create(u){return new ta(u)}constructor(u){this._tokenInfo=u}toLineTokens(u){return Tt.createFromTextAndMetadata(this.map((n,h)=>({text:h.text,metadata:h.metadata})),u)}map(u){let n=[],h=0;for(let g of this._tokenInfo){let p=new z(h,h+g.text.length);n.push(u(p,g)),h+=g.text.length}return n}slice(u){let n=[],h=0;for(let g of this._tokenInfo){let p=h,f=p+g.text.length;if(f>u.start){if(p>=u.endExclusive)break;let b=Math.max(0,u.start-p),S=Math.max(0,f-u.endExclusive);n.push(new fw(g.text.slice(b,g.text.length-S),g.metadata))}h+=g.text.length}return ta.create(n)}append(u){let n=this._tokenInfo.concat(u._tokenInfo);return ta.create(n)}}class fw{constructor(u,n){this.text=u,this.metadata=n}}var iO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},oO=function(u,n){return function(h,g){n(h,g,u)}};class Hm{static from(u){if(!u)return;return new Hm(u.icon)}constructor(u=C.warning){this.icon=u}}var u1="ghost-text",ia=class u extends i{constructor(n,h,g,p){super();if(this._editor=n,this._data=h,this._languageService=p,this._isDisposed=j(this,!1),this._warningState=m((f)=>{let b=this._data.read(f),S=b?.warning;if(!b||!S)return;let w=b.ghostText;return{lineNumber:w.lineNumber,position:new s(w.lineNumber,w.parts[0].column),icon:S.icon}}),this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._nonWhitespaceCount=m(this,(f)=>{let b=this._data.read(f);if(!b)return;return b.ghostText.parts.map((x)=>x.lines.map((I)=>I.line).join("")).join("").replace(/\s/g,"").length}),this._extraClassNames=m(this,(f)=>{let b=this._extraClasses.slice();if(this._warningState.read(f))b.push("warning");let S=this._nonWhitespaceCount.read(f);if(this._highlightShortText&&S&&S<3)b.push("short-text");else if(this._useSyntaxHighlighting.read(f))b.push("syntax-highlighted");return b.map((x)=>` ${x}`).join("")}),this._state=m(this,(f)=>{if(this._isDisposed.read(f))return;let b=this._data.read(f);if(!b)return;let S=this._editorObs.model.read(f);if(!S)return;let w=b.ghostText,x=w instanceof kh?w.columnRange:void 0,I=this._useSyntaxHighlighting.read(f),E=this._extraClassNames.read(f),{inlineTexts:Z,additionalLines:X,hiddenRange:J,additionalLinesOriginalSuffix:Q}=nO(w,S,u1+E),te=S.getLineContent(w.lineNumber),re=new Sr(Z.map((Me)=>ui.insert(Me.column-1,Me.text))),le=I?S.tokenization.tokenizeLinesAt(w.lineNumber,[re.apply(te),...X.map((Me)=>Me.content)]):void 0,pe=re.getNewRanges(),Se=Z.map((Me,Ce)=>({...Me,tokens:le?.[0]?.getTokensInRange(pe[Ce])})),we=X.map((Me,Ce)=>{let Pe=le?.[Ce+1]??Tt.createEmpty(Me.content,this._languageService.languageIdCodec);if(Ce===X.length-1&&Q){let ze=ta.fromLineTokens(S.tokenization.getLineTokens(Q.lineNumber)).slice(Q.columnRange.toZeroBasedOffsetRange());Pe=ta.fromLineTokens(Pe).append(ze).toLineTokens(Pe.languageIdCodec)}return new m1(Pe,Me.decorations)}),ae=this._editor.getSelection()?.getStartPosition().column,me=Se.filter((Me)=>Me.text!==""),De=me.length!==0,Oe=new yl((De?me[0].column:1)-ae,De?0:X.findIndex((Me)=>Me.content!=="")+1,De?1:0,X.length+(De?1:0),0,fv(me.map((Me)=>Me.text.length))+fv(we.map((Me)=>Me.content.getTextLength())),me.length+(X.length>0?1:0),me.length>1&&we.length===0?me.every((Me)=>Me.text===me[0].text):void 0);return{replacedRange:x,inlineTexts:Se,additionalLines:we,hiddenRange:J,lineNumber:w.lineNumber,additionalReservedLineCount:this._minReservedLineCount.read(f),targetTextModel:S,syntaxHighlightingEnabled:I,telemetryViewData:Oe,handleInlineCompletionShown:b.handleInlineCompletionShown}}),this._decorations=m(this,(f)=>{let b=this._state.read(f);if(!b)return[];let S=[],w=this._extraClassNames.read(f);if(b.replacedRange)S.push({range:b.replacedRange.toRange(b.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+w,description:"GhostTextReplacement"}});if(b.hiddenRange)S.push({range:b.hiddenRange.toRange(b.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(let x of b.inlineTexts){let I="";if(this._highlightShortText&&x.text.length<5)I+=" short-text";S.push({range:t.fromPositions(new s(b.lineNumber,x.column)),options:{description:"ghost-text-decoration",after:{content:x.text,tokens:x.tokens,inlineClassName:(x.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+w+I+x.lineDecorations.map((E)=>" "+E.className).join(" "),cursorStops:xs.Left,attachedData:new Fm(this)},showIfCollapsed:!0}})}return S}),this.isHovered=m(this,(f)=>{if(this._isDisposed.read(f))return!1;return this._isInlineTextHovered.read(f)||this._additionalLinesWidget.isHovered.read(f)}),this._extraClasses=g.extraClasses??[],this._isClickable=g.isClickable??!1,this._shouldKeepCursorStable=g.shouldKeepCursorStable??!1,this._minReservedLineCount=g.minReservedLineCount??Ne(0),this._useSyntaxHighlighting=g.useSyntaxHighlighting??Ne(!0),this._highlightShortText=g.highlightShortSuggestions??!1,this._editorObs=ct(this._editor),this._additionalLinesWidget=this._register(new p1(this._editor,In({owner:this,equalsFn:pu(Rf())},(f)=>{let b=this._state.read(f);return b?new g1(b.lineNumber,b.additionalLines,b.additionalReservedLineCount):void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered((f)=>f.target.type===6&&f.target.detail.injectedText?.options.attachedData instanceof Fm&&f.target.detail.injectedText.options.attachedData.owner===this,this._store),this._register(D(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this._decorations)),this._isClickable)this._register(this._additionalLinesWidget.onDidClick((f)=>this._onDidClick.fire(f))),this._register(this._editor.onMouseUp((f)=>{if(f.target.type!==6)return;let b=f.target.detail.injectedText?.options.attachedData;if(b instanceof Fm&&b.owner===this)this._onDidClick.fire(f.event)}));this._register(W((f)=>{let b=this._state.read(f);b?.handleInlineCompletionShown(b.telemetryViewData)})),this._register(oi((f,b)=>{return}))}static getWarningWidgetContext(n){let h=n.ghostTextViewWarningWidgetData;if(h)return h;else if(n.parentElement)return this.getWarningWidgetContext(n.parentElement);return}ownsViewZone(n){return this._additionalLinesWidget.viewZoneId===n}};ia=iO([oO(3,xt)],ia);class Fm{constructor(u){this.owner=u}}function nO(u,n,h){let g=[],p=[];function f(E,Z){if(p.length>0){let X=p[p.length-1];if(Z)X.decorations.push(new Qi(X.content.length+1,X.content.length+1+E[0].line.length,Z,0));X.content+=E[0].line,E=E.slice(1)}for(let X of E)p.push({content:X.line,decorations:Z?[new Qi(1,X.line.length+1,Z,0),...X.lineDecorations]:[...X.lineDecorations]})}let b=n.getLineContent(u.lineNumber),S=void 0,w=0;for(let E of u.parts){let Z=E.lines;if(S===void 0)g.push({column:E.column,text:Z[0].line,preview:E.preview,lineDecorations:Z[0].lineDecorations}),Z=Z.slice(1);else f([{line:b.substring(w,E.column-1),lineDecorations:[]}],void 0);if(Z.length>0){if(f(Z,h),S===void 0&&E.column<=b.length)S=E.column}w=E.column-1}let x=void 0;if(S!==void 0)x=new mw(u.lineNumber,new Am(w+1,b.length+1));let I=S!==void 0?new Am(S,b.length+1):void 0;return{inlineTexts:g,additionalLines:p,hiddenRange:I,additionalLinesOriginalSuffix:x}}class g1{constructor(u,n,h){this.lineNumber=u,this.additionalLines=n,this.minReservedLineCount=h}equals(u){if(this.lineNumber!==u.lineNumber)return!1;if(this.minReservedLineCount!==u.minReservedLineCount)return!1;return ot(this.additionalLines,u.additionalLines,Rf())}}class p1 extends i{get viewZoneId(){return this._viewZoneInfo?.viewZoneId}constructor(u,n,h,g){super();if(this._editor=u,this._lines=n,this._shouldKeepCursorStable=h,this._isClickable=g,this._viewZoneHeight=j("viewZoneHeight",void 0),this.editorOptionsChanged=Ri("editorOptionChanged",R.filter(this._editor.onDidChangeConfiguration,(p)=>p.hasChanged(40)||p.hasChanged(133)||p.hasChanged(113)||p.hasChanged(108)||p.hasChanged(60)||p.hasChanged(59)||p.hasChanged(75)||p.hasChanged(176))),this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new de),this.isHovered=ct(this._editor).isTargetHovered((p)=>c1(p.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof $c&&this._shouldKeepCursorStable)this._register(this._editor.onBeforeExecuteEdit((p)=>this.hasBeenAccepted=p.source==="inlineCompletionAccept"));this._register(W((p)=>{let f=this._lines.read(p);if(this.editorOptionsChanged.read(p),f)this.hasBeenAccepted=!1,this.updateLines(f.lineNumber,f.additionalLines,f.minReservedLineCount);else this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones((u)=>{this.removeActiveViewZone(u)})}updateLines(u,n,h){let g=this._editor.getModel();if(!g)return;let{tabSize:p}=g.getOptions();ct(this._editor).transaction((f)=>{this._editor.changeViewZones((b)=>{let S=new d;this.removeActiveViewZone(b);let w=Math.max(n.length,h);if(w>0){let x=document.createElement("div");if(rO(x,p,n,this._editor.getOptions(),this._isClickable),this._isClickable)S.add(c(x,"mousedown",(I)=>{I.preventDefault()})),S.add(c(x,"click",(I)=>{if(c1(I.target))this._onDidClick.fire(new ci(B(I),I))}));this.addViewZone(b,u,w,x)}this._viewZoneListener.value=S})})}addViewZone(u,n,h,g){let p=u.addZone({afterLineNumber:n,heightInLines:h,domNode:g,afterColumnAffinity:1,onComputedHeight:(f)=>{this._viewZoneHeight.set(f,void 0)}});this.keepCursorStable(n,h),this._viewZoneInfo={viewZoneId:p,heightInLines:h,lineNumber:n}}removeActiveViewZone(u){if(this._viewZoneInfo){if(u.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(u,n){if(!this._shouldKeepCursorStable)return;let h=this._editor.getSelection()?.getStartPosition()?.lineNumber;if(h!==void 0&&u<h)this._editor.setScrollTop(this._editor.getScrollTop()+n*this._editor.getOption(75))}}function c1(u){return Le(u)&&u.classList.contains(u1)}class m1{constructor(u,n){this.content=u,this.decorations=n}equals(u){if(!this.content.equals(u.content))return!1;return Qi.equalsArr(this.decorations,u.decorations)}}function rO(u,n,h,g,p){let f=g.get(40),b=g.get(133),S="none",w=g.get(108),x=g.get(60),I=g.get(59),E=g.get(75),Z=g.get(176)==="twoCells",X="suggest-preview-text";if(p)X+=" clickable";let J=new ws(1e4);J.appendString(`<div class="${X}">`);for(let re=0,le=h.length;re<le;re++){let pe=h[re],Se=pe.content;J.appendString('<div class="view-line'),J.appendString('" style="top:'),J.appendString(String(re*E)),J.appendString('px;width:1000000px;">');let we=Se.getLineContent(),ae=uu(we),me=Il(we);yd(new _s(I.isMonospace&&!f,I.canUseHalfwidthRightwardsArrow,we,!1,ae,me,0,Se,pe.decorations.slice(),n,0,I.spaceWidth,I.middotWidth,I.wsmiddotWidth,b,"none",w,x!==Do.OFF,null,null,0,!1,Z),J),J.appendString("</div>")}J.appendString("</div>"),Sn(u,I);let Q=J.build(),te=h1?h1.createHTML(Q):Q;u.innerHTML=te}var h1=Hr("editorGhostText",{createHTML:(u)=>u});class oa{constructor(u,n){this.width=u,this.height=n}toString(){return`(${this.width},${this.height})`}transpose(){return new oa(this.height,this.width)}toDimension(){return{width:this.width,height:this.height}}}class st{static fromPoints(u,n){return new st(u.x,u.y,n.x,n.y)}static fromPointSize(u,n){return new st(u.x,u.y,u.x+n.x,u.y+n.y)}static fromLeftTopRightBottom(u,n,h,g){return new st(u,n,h,g)}static fromLeftTopWidthHeight(u,n,h,g){return new st(u,n,u+h,n+g)}static fromRanges(u,n){return new st(u.start,n.start,u.endExclusive,n.endExclusive)}static hull(u){let{MAX_SAFE_INTEGER:n,MAX_SAFE_INTEGER:h,MIN_SAFE_INTEGER:g,MIN_SAFE_INTEGER:p}=Number;for(let f of u)n=Math.min(n,f.left),h=Math.min(h,f.top),g=Math.max(g,f.right),p=Math.max(p,f.bottom);return new st(n,h,g,p)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(u,n,h,g){if(this.left=u,this.top=n,this.right=h,this.bottom=g,u>h)throw new H("Invalid arguments: Horizontally offset by "+(u-h));if(n>g)throw new H("Invalid arguments: Vertically offset by "+(n-g))}withMargin(u,n,h,g){let p,f,b,S;if(n===void 0&&h===void 0&&g===void 0)p=f=b=S=u;else if(h===void 0&&g===void 0)p=f=n,b=S=u;else p=g,f=n,b=u,S=h;return new st(this.left-p,this.top-b,this.right+f,this.bottom+S)}intersectVertical(u){let n=Math.max(this.top,u.start),h=Math.min(this.bottom,u.endExclusive);return new st(this.left,n,this.right,Math.max(n,h))}intersectHorizontal(u){let n=Math.max(this.left,u.start),h=Math.min(this.right,u.endExclusive);return new st(n,this.top,Math.max(n,h),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(u){let n=Math.max(this.left,u.left),h=Math.min(this.right,u.right),g=Math.max(this.top,u.top),p=Math.min(this.bottom,u.bottom);if(n>h||g>p)return;return new st(n,g,h,p)}containsRect(u){return this.left<=u.left&&this.top<=u.top&&this.right>=u.right&&this.bottom>=u.bottom}containsPoint(u){return this.left<=u.x&&this.top<=u.y&&this.right>=u.x&&this.bottom>=u.y}moveToBeContainedIn(u){let n=this.width,h=this.height,g=this.left,p=this.top;if(g<u.left)g=u.left;else if(g+n>u.right)g=u.right-n;if(p<u.top)p=u.top;else if(p+h>u.bottom)p=u.bottom-h;return new st(g,p,g+n,p+h)}withWidth(u){return new st(this.left,this.top,this.left+u,this.bottom)}withHeight(u){return new st(this.left,this.top,this.right,this.top+u)}withTop(u){return new st(this.left,u,this.right,this.bottom)}withLeft(u){return new st(u,this.top,this.right,this.bottom)}translateX(u){return new st(this.left+u,this.top,this.right+u,this.bottom)}translateY(u){return new st(this.left,this.top+u,this.right,this.bottom+u)}getLeftBottom(){return new _i(this.left,this.bottom)}getRightBottom(){return new _i(this.right,this.bottom)}getRightTop(){return new _i(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(u){return new st(u.start,this.top,u.endExclusive,this.bottom)}getSize(){return new oa(this.width,this.height)}}class Ul{constructor(u,n,h,g=null){this.startLineNumbers=u,this.endLineNumbers=n,this.lastLineRelativePosition=h,this.showEndForLine=g}equals(u){return!!u&&this.lastLineRelativePosition===u.lastLineRelativePosition&&this.showEndForLine===u.showEndForLine&&ot(this.startLineNumbers,u.startLineNumbers)&&ot(this.endLineNumbers,u.endLineNumbers)}static get Empty(){return new Ul([],[],0)}}var f1=Hr("stickyScrollViewLayer",{createHTML:(u)=>u}),_w="data-sticky-line-index",_1="data-sticky-is-line",sO="data-sticky-is-line-number",b1="data-sticky-is-folding-icon";class bw extends i{get height(){return this._height}constructor(u){super();this._foldingIconStore=this._register(new d),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 r),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._editor=u,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",u instanceof Hi),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);let n=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration((h)=>{if(h.hasChanged(131))n()})),this._register(this._editor.onDidScrollChange((h)=>{if(h.scrollLeftChanged)n();if(h.scrollWidthChanged)this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{n(),this._updateWidgetWidth()})),n(),this._register(this._editor.onDidLayoutChange((h)=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(u){return this._renderedStickyLines.find((n)=>n.lineNumber===u)}getCurrentLines(){return this._lineNumbers}setState(u,n,h){let g=!this._state&&!u,p=this._state&&this._state.equals(u);if(h===void 0&&(g||p))return;let f=this._findRenderingData(u),b=this._lineNumbers;this._lineNumbers=f.lineNumbers,this._lastLineRelativePosition=f.lastLineRelativePosition;let S=this._findIndexToRebuildFrom(b,this._lineNumbers,h);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,n,S),this._state=u}_findRenderingData(u){if(!u)return{lineNumbers:[],lastLineRelativePosition:0};let n=[...u.startLineNumbers];if(u.showEndForLine!==null)n[u.showEndForLine]=u.endLineNumbers[u.showEndForLine];let h=0;for(let g=0;g<n.length;g++){let p=new s(n[g],1),f=this._editor._getViewModel();if(f&&p.lineNumber<=f.getLineCount())h+=this._editor.getLineHeightForPosition(new s(n[g],1))}if(h===0)return{lineNumbers:[],lastLineRelativePosition:0};return{lineNumbers:n,lastLineRelativePosition:u.lastLineRelativePosition}}_findIndexToRebuildFrom(u,n,h){if(n.length===0)return 0;if(h!==void 0)return h;let g=n.findIndex((p)=>!u.includes(p));return g===-1?0:g}_updateWidgetWidth(){let u=this._editor.getLayoutInfo(),n=u.contentLeft;this._lineNumbersDomNode.style.width=`${n}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-u.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${u.width-u.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(u){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${u?0.5:0}s`)}_setFoldingIconsVisibility(u){for(let n of this._renderedStickyLines){let h=n.foldingIcon;if(!h)continue;h.setVisible(u?!0:h.isCollapsed)}}async _renderRootNode(u,n,h,g){let p=this._editor._getViewModel();if(!p){this._clearWidget();return}if(u.length===0){this._clearWidget();return}let f=[],b=u[u.length-1],S=0;for(let x=0;x<this._renderedStickyLines.length;x++)if(x<g){let I=this._renderedStickyLines[x];f.push(this._updatePosition(I,S,I.lineNumber===b)),S+=I.height}else{let I=this._renderedStickyLines[x];I.lineNumberDomNode.remove(),I.lineDomNode.remove()}let w=this._editor.getLayoutInfo();for(let x=g;x<u.length;x++){let I=u[x];if(I>p.getLineCount())continue;let E=this._renderChildNode(p,x,I,S,b===I,h,w);S+=E.height,this._linesDomNode.appendChild(E.lineDomNode),this._lineNumbersDomNode.appendChild(E.lineNumberDomNode),f.push(E)}if(h)this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin);this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map((x)=>x.scrollWidth))+w.verticalScrollbarWidth,this._renderedStickyLines=f,this._setHeight(S+n),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let u=0;u<this._renderedStickyLines.length;u++){let n=this._renderedStickyLines[u];n.lineNumberDomNode.remove(),n.lineDomNode.remove()}this._setHeight(0)}_setHeight(u){if(this._height===u)return;if(this._height=u,this._height===0)this._rootDomNode.style.display="none";else 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(){if(this._foldingIconStore.clear(),this._editor.getOption(126)!=="mouseover")return;this._foldingIconStore.clear(),this._foldingIconStore.add(c(this._lineNumbersDomNode,T.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(c(this._lineNumbersDomNode,T.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)}))}_renderChildNode(u,n,h,g,p,f,b){let S=new v1(this._editor,u,b,f,this._isOnGlyphMargin,n,h);return this._updatePosition(S,g,p)}_updatePosition(u,n,h){let{lineDomNode:g,lineNumberDomNode:p}=u;if(h){g.style.zIndex="0",p.style.zIndex="0";let b=`${n+this._lastLineRelativePosition+(u.foldingIcon?.isCollapsed?1:0)}px`;g.style.top=b,p.style.top=b}else g.style.zIndex="1",p.style.zIndex="1",g.style.top=`${n}px`,p.style.top=`${n}px`;return u}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOrdinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(u){if(0<=u&&u<this._renderedStickyLines.length)this._renderedStickyLines[u].lineDomNode.focus()}getEditorPositionFromNode(u){if(!u||u.children.length>0)return null;let n=this._getRenderedStickyLineFromChildDomNode(u);if(!n)return null;let h=rp(n.characterMapping,u,0);return new s(n.lineNumber,h)}getLineNumberFromChildDomNode(u){return this._getRenderedStickyLineFromChildDomNode(u)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(u){let n=this.getLineIndexFromChildDomNode(u);if(n===null||n<0||n>=this._renderedStickyLines.length)return null;return this._renderedStickyLines[n]}getLineIndexFromChildDomNode(u){let n=this._getAttributeValue(u,_w);return n?parseInt(n,10):null}isInStickyLine(u){return this._getAttributeValue(u,_1)!==void 0}isInFoldingIconDomNode(u){return this._getAttributeValue(u,b1)!==void 0}_getAttributeValue(u,n){while(u&&u!==this._rootDomNode){let h=u.getAttribute(n);if(h!==null)return h;u=u.parentElement}return}}class v1{constructor(u,n,h,g,p,f,b){this.index=f,this.lineNumber=b;let S=n.coordinatesConverter.convertModelPositionToViewPosition(new s(b,1)).lineNumber,w=n.getViewLineRenderingData(S),x=u.getOption(76),I=u.getOption(117).verticalScrollbarSize,E;try{E=Qi.filter(w.inlineDecorations,S,w.minColumn,w.maxColumn)}catch(me){E=[]}let Z=u.getLineHeightForPosition(new s(b,1)),X=n.getTextDirection(b),J=u.getOption(59),Q=new _s(!0,!0,w.content,w.continuesWithWrappedLine,w.isBasicASCII,w.containsRTL,0,w.tokens,E,w.tabSize,w.startVisibleColumn,J.spaceWidth,1,1,500,"none",!0,!0,null,X,I,!1,u.getOption(176)==="twoCells"),te=new ws(2000),re=yd(Q,te);this.characterMapping=re.characterMapping;let le;if(f1)le=f1.createHTML(te.build());else le=te.build();let pe=document.createElement("span");pe.setAttribute(_w,String(f)),pe.setAttribute(_1,""),pe.setAttribute("role","listitem"),pe.tabIndex=0,pe.className="sticky-line-content",pe.classList.add(`stickyLine${b}`),pe.style.lineHeight=`${Z}px`,pe.innerHTML=le;let Se=document.createElement("span");Se.setAttribute(_w,String(f)),Se.setAttribute(sO,""),Se.className="sticky-line-number",Se.style.lineHeight=`${Z}px`;let we=h.contentLeft;Se.style.width=`${we}px`;let ae=document.createElement("span");if(x.renderType===1||x.renderType===3&&b%10===0)ae.innerText=b.toString();else if(x.renderType===2)ae.innerText=Math.abs(b-u.getPosition().lineNumber).toString();if(ae.className="sticky-line-number-inner",ae.style.width=`${h.lineNumbersWidth}px`,ae.style.paddingLeft=`${h.lineNumbersLeft}px`,Se.appendChild(ae),this.foldingIcon=this._renderFoldingIconForLine(u,g,b,Z,p),this.foldingIcon)Se.appendChild(this.foldingIcon.domNode),this.foldingIcon.domNode.style.left=`${h.lineNumbersWidth+h.lineNumbersLeft}px`,this.foldingIcon.domNode.style.lineHeight=`${Z}px`;u.applyFontInfo(pe),u.applyFontInfo(Se),Se.style.lineHeight=`${Z}px`,pe.style.lineHeight=`${Z}px`,Se.style.height=`${Z}px`,pe.style.height=`${Z}px`,this.scrollWidth=pe.scrollWidth,this.lineDomNode=pe,this.lineNumberDomNode=Se,this.height=Z}_renderFoldingIconForLine(u,n,h,g,p){let f=u.getOption(126);if(!n||f==="never")return;let b=n.regions,S=b.findRange(h),w=b.getStartLineNumber(S);if(h!==w)return;let I=b.isCollapsed(S),E=new S1(I,w,b.getEndLineNumber(S),g);return E.setVisible(p?!0:I||f==="always"),E.domNode.setAttribute(b1,""),E}}class S1{constructor(u,n,h,g){this.isCollapsed=u,this.foldingStartLine=n,this.foldingEndLine=h,this.dimension=g,this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${g}px`,this.domNode.style.lineHeight=`${g}px`,this.domNode.className=Y.asClassName(u?Kc:Vc)}setVisible(u){this.domNode.style.cursor=u?"pointer":"default",this.domNode.style.opacity=u?"1":"0"}}var aO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},vw=function(u,n){return function(h,g){n(h,g,u)}};class Dd{remove(){this.parent?.children.delete(this.id)}static findId(u,n){let h;if(typeof u==="string")h=`${n.id}/${u}`;else if(h=`${n.id}/${u.name}`,n.children.get(h)!==void 0)h=`${n.id}/${u.name}_${u.range.startLineNumber}_${u.range.startColumn}`;let g=h;for(let p=0;n.children.get(g)!==void 0;p++)g=`${h}_${p}`;return g}static empty(u){return u.children.size===0}}class jh extends Dd{constructor(u,n,h){super();this.id=u,this.parent=n,this.symbol=h,this.children=new Map}}class Wm extends Dd{constructor(u,n,h,g){super();this.id=u,this.parent=n,this.label=h,this.order=g,this.children=new Map}}class rr extends Dd{static create(u,n,h){let g=new Je(h),p=new rr(n.uri),f=u.ordered(n),b=f.map((w,x)=>{let I=Dd.findId(`provider_${x}`,p),E=new Wm(I,p,w.displayName??"Unknown Outline Provider",x);return Promise.resolve(w.provideDocumentSymbols(n,g.token)).then((Z)=>{for(let X of Z||[])rr._makeOutlineElement(X,E);return E},(Z)=>(vt(Z),E)).then((Z)=>{if(!Dd.empty(Z))p._groups.set(I,Z);else Z.remove()})}),S=u.onDidChange(()=>{let w=u.ordered(n);if(!ot(w,f))g.cancel()});return Promise.all(b).then(()=>{if(g.token.isCancellationRequested&&!h.isCancellationRequested)return rr.create(u,n,h);else return p._compact()}).finally(()=>{g.dispose(),S.dispose(),g.dispose()})}static _makeOutlineElement(u,n){let h=Dd.findId(u,n),g=new jh(h,n,u);if(u.children)for(let p of u.children)rr._makeOutlineElement(p,g);n.children.set(g.id,g)}constructor(u){super();this.uri=u,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let u=0;for(let[n,h]of this._groups)if(h.children.size===0)this._groups.delete(n);else u+=1;if(u!==1)this.children=this._groups;else{let n=Ie.first(this._groups.values());for(let[,h]of n.children)h.parent=this,this.children.set(h.id,h)}return this}getTopLevelSymbols(){let u=[];for(let n of this.children.values())if(n instanceof jh)u.push(n.symbol);else u.push(...Ie.map(n.children.values(),(h)=>h.symbol));return u.sort((n,h)=>t.compareRangesUsingStarts(n.range,h.range))}asListOfDocumentSymbols(){let u=this.getTopLevelSymbols(),n=[];return rr._flattenDocumentSymbols(n,u,""),n.sort((h,g)=>s.compare(t.getStartPosition(h.range),t.getStartPosition(g.range))||s.compare(t.getEndPosition(g.range),t.getEndPosition(h.range)))}static _flattenDocumentSymbols(u,n,h){for(let g of n)if(u.push({kind:g.kind,tags:g.tags,name:g.name,detail:g.detail,containerName:g.containerName||h,range:g.range,selectionRange:g.selectionRange,children:void 0}),g.children)rr._flattenDocumentSymbols(u,g.children,g.name)}}var zh=ie("IOutlineModelService"),Sw=class u{constructor(n,h,g){this._languageFeaturesService=n,this._disposables=new d,this._cache=new Yi(15,0.7),this._debounceInformation=h.for(n.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(g.onModelRemoved((p)=>{this._cache.delete(p.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(n,h){let g=this._languageFeaturesService.documentSymbolProvider,p=g.ordered(n),f=this._cache.get(n.id);if(!f||f.versionId!==n.getVersionId()||!ot(f.provider,p)){let S=new Je;f={versionId:n.getVersionId(),provider:p,promiseCnt:0,source:S,promise:rr.create(g,n,S.token),model:void 0},this._cache.set(n.id,f);let w=Date.now();f.promise.then((x)=>{f.model=x,this._debounceInformation.update(n,Date.now()-w)}).catch((x)=>{this._cache.delete(n.id)})}if(f.model)return f.model;f.promiseCnt+=1;let b=h.onCancellationRequested(()=>{if(--f.promiseCnt===0)f.source.cancel(),this._cache.delete(n.id)});try{return await f.promise}finally{b.dispose()}}};Sw=aO([vw(0,V),vw(1,ur),vw(2,Et)],Sw);_e(zh,Sw,1);class na{constructor(u,n){this.startLineNumber=u,this.endLineNumber=n}}class Gl{constructor(u,n,h){this.range=u,this.children=n,this.parent=h}}class Bm{constructor(u,n,h,g){this.uri=u,this.version=n,this.element=h,this.outlineProviderId=g}}var Km=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},eu=function(u,n){return function(h,g){n(h,g,u)}},Xh;(function(u){u.OUTLINE_MODEL="outlineModel",u.FOLDING_PROVIDER_MODEL="foldingProviderModel",u.INDENTATION_MODEL="indentationModel"})(Xh||(Xh={}));var ra;(function(u){u[u.VALID=0]="VALID",u[u.INVALID=1]="INVALID",u[u.CANCELED=2]="CANCELED"})(ra||(ra={}));var Vm=class u extends i{constructor(n,h,g,p){super();switch(this._editor=n,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new Ji(300)),this._updateOperation=this._register(new d),this._editor.getOption(131).defaultModel){case Xh.OUTLINE_MODEL:this._modelProviders.push(new ww(this._editor,p));case Xh.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new yw(this._editor,h,p));case Xh.INDENTATION_MODEL:this._modelProviders.push(new Cw(this._editor,g));break}}dispose(){this._modelProviders.forEach((n)=>n.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){if(this._modelPromise)this._modelPromise.cancel(),this._modelPromise=null}async update(n){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(let h of this._modelProviders){let{statusPromise:g,modelPromise:p}=h.computeStickyModel(n);this._modelPromise=p;let f=await g;if(this._modelPromise!==p)return null;switch(f){case ra.CANCELED:return this._updateOperation.clear(),null;case ra.VALID:return h.stickyModel}}return null}).catch((h)=>(ee(h),null))}};Vm=Km([eu(2,O),eu(3,V)],Vm);class xw extends i{constructor(u){super();this._editor=u,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,ra.INVALID}computeStickyModel(u){if(u.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};let n=Zt((h)=>this.createModelFromProvider(h));return{statusPromise:n.then((h)=>{if(!this.isModelValid(h))return this._invalid();if(u.isCancellationRequested)return ra.CANCELED;return this._stickyModel=this.createStickyModel(u,h),ra.VALID}).then(void 0,(h)=>(ee(h),ra.CANCELED)),modelPromise:n}}isModelValid(u){return!0}isProviderValid(){return!0}}var ww=class u extends xw{constructor(n,h){super(n);this._languageFeaturesService=h}createModelFromProvider(n){return rr.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),n)}createStickyModel(n,h){let{stickyOutlineElement:g,providerID:p}=this._stickyModelFromOutlineModel(h,this._stickyModel?.outlineProviderId),f=this._editor.getModel();return new Bm(f.uri,f.getVersionId(),g,p)}isModelValid(n){return n&&n.children.size>0}_stickyModelFromOutlineModel(n,h){let g;if(Ie.first(n.children.values())instanceof Wm){let S=Ie.find(n.children.values(),(w)=>w.id===h);if(S)g=S.children;else{let w="",x=-1,I=void 0;for(let[E,Z]of n.children.entries()){let X=this._findSumOfRangesOfGroup(Z);if(X>x)I=Z,x=X,w=Z.id}h=w,g=I.children}}else g=n.children;let p=[],f=Array.from(g.values()).sort((S,w)=>{let x=new na(S.symbol.range.startLineNumber,S.symbol.range.endLineNumber),I=new na(w.symbol.range.startLineNumber,w.symbol.range.endLineNumber);return this._comparator(x,I)});for(let S of f)p.push(this._stickyModelFromOutlineElement(S,S.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new Gl(void 0,p,void 0),providerID:h}}_stickyModelFromOutlineElement(n,h){let g=[];for(let f of n.children.values())if(f.symbol.selectionRange.startLineNumber!==f.symbol.range.endLineNumber)if(f.symbol.selectionRange.startLineNumber!==h)g.push(this._stickyModelFromOutlineElement(f,f.symbol.selectionRange.startLineNumber));else for(let b of f.children.values())g.push(this._stickyModelFromOutlineElement(b,f.symbol.selectionRange.startLineNumber));g.sort((f,b)=>this._comparator(f.range,b.range));let p=new na(n.symbol.selectionRange.startLineNumber,n.symbol.range.endLineNumber);return new Gl(p,g,void 0)}_comparator(n,h){if(n.startLineNumber!==h.startLineNumber)return n.startLineNumber-h.startLineNumber;else return h.endLineNumber-n.endLineNumber}_findSumOfRangesOfGroup(n){let h=0;for(let g of n.children.values())h+=this._findSumOfRangesOfGroup(g);if(n instanceof jh)return h+n.symbol.range.endLineNumber-n.symbol.selectionRange.startLineNumber;else return h}};ww=Km([eu(1,V)],ww);class Iw extends xw{constructor(u){super(u);this._foldingLimitReporter=this._register(new ug(u))}createStickyModel(u,n){let h=this._fromFoldingRegions(n),g=this._editor.getModel();return new Bm(g.uri,g.getVersionId(),h,void 0)}isModelValid(u){return u!==null}_fromFoldingRegions(u){let n=u.length,h=[],g=new Gl(void 0,[],void 0);for(let p=0;p<n;p++){let f=u.getParentIndex(p),b;if(f!==-1)b=h[f];else b=g;let S=new Gl(new na(u.getStartLineNumber(p),u.getEndLineNumber(p)+1),[],b);b.children.push(S),h.push(S)}return g}}var Cw=class u extends Iw{constructor(n,h){super(n);this._languageConfigurationService=h,this.provider=this._register(new Zd(n.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(n){return this.provider.compute(n)}};Cw=Km([eu(1,ht)],Cw);var yw=class u extends Iw{constructor(n,h,g){super(n);this._languageFeaturesService=g,this.provider=this._register(new de),this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(n,h)})),this._updateProvider(n,h)}_updateProvider(n,h){let g=Gn.getFoldingRangeProviders(this._languageFeaturesService,n.getModel());if(g.length===0)return;this.provider.value=new Yd(n.getModel(),g,h,this._foldingLimitReporter,void 0)}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(n){return this.provider.value?.compute(n)??null}};yw=Km([eu(2,V)],yw);var dO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},w1=function(u,n){return function(h,g){n(h,g,u)}};class C1{constructor(u,n,h,g){this.startLineNumber=u,this.endLineNumber=n,this.top=h,this.height=g}}var zm=class u extends i{constructor(n,h,g){super();this._languageFeaturesService=h,this._languageConfigurationService=g,this._onDidChangeStickyScroll=this._register(new r),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=n,this._sessionStore=this._register(new d),this._updateSoon=this._register(new ke(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration((p)=>{if(p.hasChanged(131))this.readConfiguration()})),this.readConfiguration()}readConfiguration(){if(this._sessionStore.clear(),!this._editor.getOption(131).enabled)return;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(D(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update()}getVersionId(){return this._model?.version}updateStickyModelProvider(){if(this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel())this._stickyModelProvider=new Vm(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService)}async update(){this._cts?.dispose(!0),this._cts=new Je,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(n){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}let h=await this._stickyModelProvider.update(n);if(!n.isCancellationRequested)this._model=h}getCandidateStickyLinesIntersecting(n){if(!this._model?.element)return[];let h=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(n,this._model.element,h,0,0,-1),this.filterHiddenRanges(h)}getCandidateStickyLinesIntersectingFromStickyModel(n,h,g,p,f,b){let S=this._editor.getModel();if(!S)return;if(h.children.length===0)return;let w=b,x=[];for(let Z=0;Z<h.children.length;Z++){let X=h.children[Z];if(X.range)x.push(X.range.startLineNumber)}let I=this.updateIndex(Cg(x,n.startLineNumber,(Z,X)=>Z-X)),E=this.updateIndex(Cg(x,n.endLineNumber,(Z,X)=>Z-X));for(let Z=I;Z<=E;Z++){let X=h.children[Z];if(!X||!X.range)continue;let{startLineNumber:J,endLineNumber:Q}=X.range;if(Q>J+1&&n.startLineNumber<=Q+1&&J-1<=n.endLineNumber&&J!==w&&S.isValidRange(new t(J,1,Q,1))){w=J;let te=this._editor.getLineHeightForPosition(new s(J,1));g.push(new C1(J,Q-1,f,te)),this.getCandidateStickyLinesIntersectingFromStickyModel(n,X,g,p+1,f+te,J)}}}filterHiddenRanges(n){let h=this._editor._getViewModel()?.getHiddenAreas();if(!h)return n;return n.filter((g)=>!h.some((p)=>g.startLineNumber>=p.startLineNumber&&g.endLineNumber<=p.endLineNumber+1))}updateIndex(n){if(n===-1)return 0;else if(n<0)return-n-2;return n}};zm=dO([w1(1,V),w1(2,ht)],zm);var lO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},ql=function(u,n){return function(h,g){n(h,g,u)}},Lw,As=class u extends i{static{Lw=this}static{this.ID="store.contrib.stickyScrollController"}constructor(n,h,g,p,f,b,S){super();this._editor=n,this._contextMenuService=h,this._languageFeaturesService=g,this._instaService=p,this._contextKeyService=S,this._sessionStore=new d,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._mouseTarget=null,this._onDidChangeStickyScrollHeight=this._register(new r),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._stickyScrollWidget=new bw(this._editor),this._stickyLineCandidateProvider=new zm(this._editor,g,f),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=Ul.Empty;let w=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight((I)=>{I.changes.forEach((E)=>{let Z=E.lineNumber;if(this._widgetState.startLineNumbers.includes(Z))this._renderStickyScroll(Z)})})),this._register(this._editor.onDidChangeFont((I)=>{I.changes.forEach((E)=>{let Z=E.lineNumber;if(this._widgetState.startLineNumbers.includes(Z))this._renderStickyScroll(Z)})})),this._register(this._editor.onDidChangeConfiguration((I)=>{this._readConfigurationChange(I)})),this._register(c(w,T.CONTEXT_MENU,async(I)=>{this._onContextMenu(B(w),I)})),this._stickyScrollFocusedContextKey=o.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=o.stickyScrollVisible.bindTo(this._contextKeyService);let x=this._register(wi(w));this._register(x.onDidBlur((I)=>{if(this._positionRevealed===!1&&w.clientHeight===0)this._focusedStickyElementIndex=-1,this.focus();else this._disposeFocusStickyScrollStore()})),this._register(x.onDidFocus((I)=>{this.focus()})),this._registerMouseListeners(),this._register(c(w,T.MOUSE_DOWN,(I)=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight((I)=>{this._onDidChangeStickyScrollHeight.fire(I)})),this._onDidResize(),this._readConfiguration()}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(n){return n.getContribution(Lw.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}if(this._stickyScrollFocusedContextKey.get()===!0)return;this._focused=!0,this._focusDisposableStore=new d,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}focusNext(){if(this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1)this._focusNav(!0)}focusPrevious(){if(this._focusedStickyElementIndex>0)this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(n){this._focusedStickyElementIndex=n?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){let n=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:n[this._focusedStickyElementIndex],column:1})}_revealPosition(n){this._reveaInEditor(n,()=>this._editor.revealPosition(n))}_revealLineInCenterIfOutsideViewport(n){this._reveaInEditor(n,()=>this._editor.revealLineInCenterIfOutsideViewport(n.lineNumber,0))}_reveaInEditor(n,h){if(this._focused)this._disposeFocusStickyScrollStore();this._positionRevealed=!0,h(),this._editor.setSelection(t.fromPositions(n)),this._editor.focus()}_registerMouseListeners(){let n=this._register(new d),h=this._register(new Tr(this._editor,{extractLineNumberFromMouseEvent:(f)=>{let b=this._stickyScrollWidget.getEditorPositionFromNode(f.target.element);return b?b.lineNumber:0}})),g=(f)=>{if(!this._editor.hasModel())return null;if(f.target.type!==12||f.target.detail!==this._stickyScrollWidget.getId())return null;let b=f.target.element;if(!b||b.innerText!==b.innerHTML)return null;let S=this._stickyScrollWidget.getEditorPositionFromNode(b);if(!S)return null;return{range:new t(S.lineNumber,S.column,S.lineNumber,S.column+b.innerText.length),textElement:b}},p=this._stickyScrollWidget.getDomNode();this._register(Ct(p,T.CLICK,(f)=>{if(f.ctrlKey||f.altKey||f.metaKey)return;if(!f.leftButton)return;if(f.shiftKey){let x=this._stickyScrollWidget.getLineIndexFromChildDomNode(f.target);if(x===null)return;let I=new s(this._endLineNumbers[x],1);this._revealLineInCenterIfOutsideViewport(I);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(f.target)){let x=this._stickyScrollWidget.getLineNumberFromChildDomNode(f.target);this._toggleFoldingRegionForLine(x);return}if(!this._stickyScrollWidget.isInStickyLine(f.target))return;let w=this._stickyScrollWidget.getEditorPositionFromNode(f.target);if(!w){let x=this._stickyScrollWidget.getLineNumberFromChildDomNode(f.target);if(x===null)return;w=new s(x,1)}this._revealPosition(w)})),this._register(c(Ge,T.MOUSE_MOVE,(f)=>{this._mouseTarget=f.target,this._onMouseMoveOrKeyDown(f)})),this._register(c(Ge,T.KEY_DOWN,(f)=>{this._onMouseMoveOrKeyDown(f)})),this._register(c(Ge,T.KEY_UP,()=>{if(this._showEndForLine!==void 0)this._showEndForLine=void 0,this._renderStickyScroll()})),this._register(h.onMouseMoveOrRelevantKeyDown(([f,b])=>{let S=g(f);if(!S||!f.hasTriggerModifier||!this._editor.hasModel()){n.clear();return}let{range:w,textElement:x}=S;if(!w.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=w,n.clear();else if(x.style.textDecoration==="underline")return;let I=new Je;n.add(D(()=>I.dispose(!0)));let E;Os(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new s(w.startLineNumber,w.startColumn+1),!1,I.token).then((Z)=>{if(I.token.isCancellationRequested)return;if(Z.length!==0){this._candidateDefinitionsLength=Z.length;let X=x;if(E!==X)n.clear(),E=X,E.style.textDecoration="underline",n.add(D(()=>{E.style.textDecoration="none"}));else if(!E)E=X,E.style.textDecoration="underline",n.add(D(()=>{E.style.textDecoration="none"}))}else n.clear()})})),this._register(h.onCancel(()=>{n.clear()})),this._register(h.onExecute(async(f)=>{if(f.target.type!==12||f.target.detail!==this._stickyScrollWidget.getId())return;let b=this._stickyScrollWidget.getEditorPositionFromNode(f.target.element);if(!b)return;if(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor)return;if(this._candidateDefinitionsLength>1){if(this._focused)this._disposeFocusStickyScrollStore();this._revealPosition({lineNumber:b.lineNumber,column:1})}this._instaService.invokeFunction(Hp,f,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})}))}_onContextMenu(n,h){let g=new ci(n,h);this._contextMenuService.showContextMenu({menuId:l.StickyScrollContext,getAnchor:()=>g,menuActionOptions:{renderShortTitle:!0}})}_onMouseMoveOrKeyDown(n){if(!n.shiftKey)return;if(!this._mouseTarget||!Le(this._mouseTarget))return;let h=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);if(h===null||this._showEndForLine===h)return;this._showEndForLine=h,this._renderStickyScroll()}_toggleFoldingRegionForLine(n){if(!this._foldingModel||n===null)return;let h=this._stickyScrollWidget.getRenderedStickyLine(n),g=h?.foldingIcon;if(!g)return;Bc(this._foldingModel,1,[n]),g.isCollapsed=!g.isCollapsed;let p=(g.isCollapsed?this._editor.getTopForLineNumber(g.foldingEndLine):this._editor.getTopForLineNumber(g.foldingStartLine))-this._editor.getOption(75)*h.index+1;this._editor.setScrollTop(p),this._renderStickyScroll(n)}_readConfiguration(){let n=this._editor.getOption(131);if(n.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else if(n.enabled&&!this._enabled)this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange((g)=>{if(g.scrollTopChanged)this._showEndForLine=void 0,this._renderStickyScroll()})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens((g)=>this._onTokensChange(g))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0;if(this._editor.getOption(76).renderType===2){if(!this._cursorPositionListener)this._cursorPositionListener=this._editor.onDidChangeCursorPosition((g)=>{if(this._positionLineNumber===g.position.lineNumber)return;this._positionLineNumber=g.position.lineNumber,this._showEndForLine=void 0,this._renderStickyScroll(0)}),this._sessionStore.add(this._cursorPositionListener)}else if(this._cursorPositionListener)this._sessionStore.delete(this._cursorPositionListener),this._cursorPositionListener.dispose(),this._cursorPositionListener=void 0}_readConfigurationChange(n){if(n.hasChanged(131)||n.hasChanged(81)||n.hasChanged(75)||n.hasChanged(126)||n.hasChanged(76))this._readConfiguration();if(n.hasChanged(76)||n.hasChanged(52)||n.hasChanged(126)||n.hasChanged(59)||n.hasChanged(176))this._renderStickyScroll(0)}_needsUpdate(n){let h=this._stickyScrollWidget.getCurrentLines();for(let g of h)for(let p of n.ranges)if(g>=p.fromLineNumber&&g<=p.toLineNumber)return!0;return!1}_onTokensChange(n){if(this._needsUpdate(n))this._renderStickyScroll(0)}_onDidResize(){let h=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(h*0.25),this._renderStickyScroll(0)}async _renderStickyScroll(n){let h=this._editor.getModel();if(!h||h.isTooLargeForTokenization()){this._resetState();return}let g=this._updateAndGetMinRebuildFromLine(n),p=this._stickyLineCandidateProvider.getVersionId();if(p===void 0||p===h.getVersionId())if(!this._focused)await this._updateState(g);else if(this._focusedStickyElementIndex===-1){if(await this._updateState(g),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1)this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}else{let b=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];if(await this._updateState(g),this._stickyScrollWidget.lineNumberCount===0)this._focusedStickyElementIndex=-1;else{if(!this._stickyScrollWidget.lineNumbers.includes(b))this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1;this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}}}_updateAndGetMinRebuildFromLine(n){if(n!==void 0){let h=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(n,h)}return this._minRebuildFromLine}async _updateState(n){this._minRebuildFromLine=void 0,this._foldingModel=await Gn.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();let h=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(h),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,n)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=Ul.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){let n=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),h=this._editor.getScrollTop(),g=0,p=[],f=[],b=this._editor.getVisibleRanges();if(b.length!==0){let S=new na(b[0].startLineNumber,b[b.length-1].endLineNumber),w=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(S);for(let x of w){let{startLineNumber:I,endLineNumber:E,top:Z}=x,X=Z+x.height,J=this._editor.getTopForLineNumber(I)-h,Q=this._editor.getBottomForLineNumber(E)-h;if(Z>J&&Z<=Q){if(p.push(I),f.push(E+1),X>Q)g=Q-X}if(p.length===n)break}}return this._endLineNumbers=f,new Ul(p,f,g,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}};As=Lw=lO([ql(1,Qn),ql(2,V),ql(3,O),ql(4,ht),ql(5,ur),ql(6,K)],As);var aa=a("inlineEdit.originalBackground",be(vu,0.2),e(1286,"Background color for the original text in inline edits."),!0),Um=a("inlineEdit.modifiedBackground",be(tp,0.3),e(1287,"Background color for the modified text in inline edits."),!0);a("inlineEdit.originalChangedLineBackground",be(vu,0.8),e(1288,"Background color for the changed lines in the original text of inline edits."),!0);var y1=a("inlineEdit.originalChangedTextBackground",be(vu,0.8),e(1289,"Overlay color for the changed text in the original text of inline edits."),!0),x1=a("inlineEdit.modifiedChangedLineBackground",{light:be(l0,0.7),dark:be(l0,0.7),hcDark:l0,hcLight:l0},e(1290,"Background color for the changed lines in the modified text of inline edits."),!0),I1=a("inlineEdit.modifiedChangedTextBackground",be(tp,0.7),e(1291,"Overlay color for the changed text in the modified text of inline edits."),!0),da=a("inlineEdit.gutterIndicator.primaryForeground",Dv,e(1292,"Foreground color for the primary inline edit gutter indicator.")),qo=a("inlineEdit.gutterIndicator.primaryBorder",ip,e(1293,"Border color for the primary inline edit gutter indicator.")),dr=a("inlineEdit.gutterIndicator.primaryBackground",{light:be(qo,0.5),dark:be(qo,0.4),hcDark:be(qo,0.4),hcLight:be(qo,0.5)},e(1294,"Background color for the primary inline edit gutter indicator.")),L1=a("inlineEdit.gutterIndicator.secondaryForeground",Iv,e(1295,"Foreground color for the secondary inline edit gutter indicator.")),E1=a("inlineEdit.gutterIndicator.secondaryBorder",Uf,e(1296,"Border color for the secondary inline edit gutter indicator.")),Zl=a("inlineEdit.gutterIndicator.secondaryBackground",Hg,e(1297,"Background color for the secondary inline edit gutter indicator.")),D1=a("inlineEdit.gutterIndicator.successfulForeground",Dv,e(1298,"Foreground color for the successful inline edit gutter indicator.")),Ew=a("inlineEdit.gutterIndicator.successfulBorder",ip,e(1299,"Border color for the successful inline edit gutter indicator.")),Xl=a("inlineEdit.gutterIndicator.successfulBackground",Ew,e(1300,"Background color for the successful inline edit gutter indicator.")),R1=a("inlineEdit.gutterIndicator.background",{hcDark:be("tab.inactiveBackground",0.5),hcLight:be("tab.inactiveBackground",0.5),dark:be("tab.inactiveBackground",0.5),light:"#5f5f5f18"},e(1301,"Background color for the inline edit gutter indicator.")),tu=a("inlineEdit.originalBorder",{light:vu,dark:vu,hcDark:vu,hcLight:vu},e(1302,"Border color for the original text in inline edits.")),iu=a("inlineEdit.modifiedBorder",{light:Po(tp,0.6),dark:tp,hcDark:tp,hcLight:tp},e(1303,"Border color for the modified text in inline edits.")),cO=a("inlineEdit.tabWillAcceptModifiedBorder",{light:Po(iu,0),dark:Po(iu,0),hcDark:Po(iu,0),hcLight:Po(iu,0)},e(1304,"Modified border color for the inline edits widget when tab will accept it.")),hO=a("inlineEdit.tabWillAcceptOriginalBorder",{light:Po(tu,0),dark:Po(tu,0),hcDark:Po(tu,0),hcLight:Po(tu,0)},e(1305,"Original border color for the inline edits widget over the original text when tab will accept it."));function ss(u){return u.map((n)=>n===Nt.Accept?cO:iu)}function la(u){return u.map((n)=>n===Nt.Accept?hO:tu)}function Ut(u,n){let h;if(typeof u==="string")h=sa(u,n);else h=u.map((p,f)=>sa(p,n).read(f));let g=sa(Zr,n);return h.map((p,f)=>p.makeOpaque(g.read(f)))}function io(u){let n;switch(u){case Ot.TextEditor:n=Zr;break;case Ot.DiffEditor:n=Zr;break;case Ot.Notebook:n="notebook.cellEditorBackground";break;default:pc(u,"Not supported editor type yet")}return M(n)}function sa(u,n){return Vs({owner:{observeColor:u},equalsFn:(h,g)=>h.equals(g),debugName:()=>`observeColor(${u})`},n.onDidColorThemeChange,()=>{let h=n.getColorTheme().getColor(u);if(!h)throw new H(`Missing color: ${u}`);return h})}var jt=3;function Eo(u,n,h){let g=u.model.read(h);if(!g)return 0;let p=0;for(let b=n.startLineNumber;b<n.endLineNumberExclusive;b++){let S=u.getWidthOfLine(b,h);p=Math.max(p,S)}let f=n.mapToLineArray((b)=>g.getLineContent(b));if(p<5&&f.some((b)=>b.length>0)&&g.uri.scheme!=="file")console.log("unexpected width");return p}function k1(u,n,h){Ri(u,u.editor.onDidChangeLineHeight).read(h);let g=u.model.read(h);if(!g)throw new H("Model is required");let p=[];for(let f=n.startLineNumber;f<n.endLineNumberExclusive;f++){let b=u.getWidthOfLine(f,h);if(b===-1){let w=g.getLineMaxColumn(f),x=u.editor.getOption(59).typicalHalfwidthCharacterWidth;b=w*x}let S=u.editor.getLineHeightForPosition(new s(f,1));p.push(new oa(b,S))}return p}function T1(u,n,h){if(u.layoutInfo.read(h),u.value.read(h),!u.model.read(h))return 0;return u.scrollTop.read(h),u.editor.getOffsetForColumn(n.lineNumber,n.column)}function Yl(u,n,h,g,p=void 0){let f=g.getModel();if(!f)return{prefixTrim:0,prefixLeftOffset:0};let b=u.map((Z)=>Z.isSingleLine()?Z.startColumn-1:0),S=n.mapToLineArray((Z)=>$k(f.getLineContent(Z))),w=h.filter((Z)=>Z!=="").map((Z)=>$k(Z)),x=Math.min(...b,...S,...w),I;if(f.getLineIndentColumn(n.startLineNumber)>=x+1)ct(g).scrollTop.read(p),I=g.getOffsetForColumn(n.startLineNumber,x+1);else if(h.length>0)I=ou(h[0].slice(0,x),g,f);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:x,prefixLeftOffset:I}}function ou(u,n,h){let g=n.getOption(59).typicalHalfwidthCharacterWidth,p=h.getOptions().tabSize*g,f=u.split("\t").length-1;return(u.length-f)*g+f*p}function Jl(u){let n=u.layoutInfoContentLeft,h=m({name:"editor.validOverlay.width"},(p)=>{let f=u.layoutInfoMinimap.read(p).minimapLeft!==0,b=Math.max(0,u.layoutInfoWidth.read(p)-n.read(p));if(f){let S=u.layoutInfoMinimap.read(p).minimapWidth+u.layoutInfoVerticalScrollbarWidth.read(p);return Math.max(0,b-S)}return b}),g=m({name:"editor.validOverlay.height"},(p)=>u.layoutInfoHeight.read(p)+u.contentHeight.read(p));return m({name:"editor.validOverlay"},(p)=>st.fromLeftTopWidthHeight(n.read(p),0,h.read(p),g.read(p)))}function N1(u,n){let h=[];for(let g of u){let p=n.mapRange(g.modifiedRange);h.push(new Zi(g.originalRange,p))}return h}function Ql(...u){return u.filter((n)=>typeof n==="string").join(" ")}function uO(u,n){return new t(n.lineNumber,n.column+u.start,n.lineNumber,n.column+u.endExclusive)}function gO(u,n){let h=0;e:for(let g=0,p=u.length;g<p;g++)switch(u.charCodeAt(g)){case 9:h+=n;break;case 32:h++;break;default:break e}return h-h%n}function pO(u,n,h){let g=n-n%h,p=0;for(;p<u.length;p++){if(g===0)break;switch(u.charCodeAt(p)){case 9:g-=h;break;case 32:g--;break;default:throw new H("Unexpected character found while calculating indent length")}}return p}function O1(u,n,h){let g=Ci(u),p=[],f=fk(n.mapToLineArray((b)=>gO(g[b-1],h)),Ui);return n.forEach((b)=>{let S=pO(g[b-1],f,h);p.push(new gt(uO(new z(0,S),new s(b,1)),""))}),new jr(p)}class ec{constructor(){this._data=""}moveTo(u){return this._data+=`M ${u.x} ${u.y} `,this}lineTo(u){return this._data+=`L ${u.x} ${u.y} `,this}build(){return this._data}}function ji(u){let n=fo(void 0,(h,g)=>u.read(h)||g);return In({debugName:()=>`${u.debugName}.mapOutFalsy`},(h)=>{if(n.read(h),!u.read(h))return;return n})}function Gt(u,n=Jt.ofCaller()){return{left:m({name:"editor.validOverlay.left"},(h)=>u(h)?.left,n),top:m({name:"editor.validOverlay.top"},(h)=>u(h)?.top,n),width:m({name:"editor.validOverlay.width"},(h)=>{let g=u(h);if(!g)return;return g.width},n),height:m({name:"editor.validOverlay.height"},(h)=>{let g=u(h);if(!g)return;return g.height},n)}}function M1(u,n){let h=u.getContainerDomNode(),g=j("domRect",h.getBoundingClientRect());return n.add(u.onDidLayoutChange((p)=>{g.set(h.getBoundingClientRect(),void 0)})),g}var mO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Dw=function(u,n){return function(h,g){n(h,g,u)}},$m=class u{constructor(n,h,g,p,f,b){this._editorObs=n,this._data=h,this._close=g,this._contextKeyService=p,this._keybindingService=f,this._commandService=b,this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map((S)=>S.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){let n=j("active",void 0),h=(Q)=>({title:Q.title,icon:Q.icon,keybinding:typeof Q.commandId==="string"?this._getKeybinding(Q.commandArgs?void 0:Q.commandId):m(this,(te)=>typeof Q.commandId==="string"?void 0:this._getKeybinding(Q.commandArgs?void 0:Q.commandId.read(te)).read(te)),isActive:n.map((te)=>te===Q.id),onHoverChange:(te)=>n.set(te?Q.id:void 0,void 0),onAction:()=>{let te=typeof Q.commandId==="string"?Q.commandId:Q.commandId.get();return this._close(!0,te),this._commandService.executeCommand(te,...Q.commandArgs??[])}}),g=this._data.extensionCommands.map((Q)=>Q.map((te,re)=>ca(h({id:te.command.id+"_"+re,title:te.command.title,icon:te.icon??C.symbolEvent,commandId:te.command.id,commandArgs:te.command.arguments})))),p=[];for(let Q of g)if(Q.length>0)p.push(Rw()),p.push(...Q);if(this._data.extensionCommandsOnly)return P1(p.slice(1));let f=fO(this._data.displayName),b=ca(h({id:"gotoAndAccept",title:e(1276,"Go To / Accept"),icon:C.check,commandId:fn})),S=ca(h({id:"reject",title:e(1277,"Reject"),icon:C.close,commandId:Ep})),w=this._data.alternativeAction?ca(h({id:"alternativeCommand",title:this._data.alternativeAction.command.title,icon:this._data.alternativeAction.icon,commandId:Ya})):void 0,x=[],I=this._inlineEditsShowCollapsed.map((Q)=>Q?ca(h({id:"showExpanded",title:e(1278,"Show Expanded"),icon:C.expandAll,commandId:hh})):ca(h({id:"showCollapsed",title:e(1279,"Show Collapsed"),icon:C.collapseAll,commandId:hh}))),E=ca(h({id:"snooze",title:e(1280,"Snooze"),icon:C.bellSlash,commandId:"editor.action.inlineSuggest.snooze"})),Z=ca(h({id:"settings",title:e(1281,"Settings"),icon:C.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),X=this._data.action?[this._data.action]:[],J=X.length>0?_O(X.map((Q)=>({id:Q.id,label:Q.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(Q.id,...Q.arguments??[]),class:void 0,tooltip:Q.tooltip??Q.title})),{hoverDelegate:M2}):void 0;return P1([f,b,w,S,I,x.length?Rw():void 0,...x,E,Z,...p,J?Rw():void 0,J])}_getKeybinding(n){if(!n)return Ne(void 0);return je(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(n))}};$m=mO([Dw(3,K),Dw(4,ge),Dw(5,Ue)],$m);function P1(u){return he.div({class:"content",style:{margin:4,minWidth:180}},u)}function fO(u){return he.div({class:"header",style:{color:M(a0),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[u])}function ca(u){return m({name:"inlineEdits.option"},(n)=>he.div({class:["monaco-menu-option",u.isActive?.map((h)=>h&&"active")],onmouseenter:()=>u.onHoverChange?.(!0),onmouseleave:()=>u.onHoverChange?.(!1),onclick:u.onAction,onkeydown:(h)=>{if(h.key==="Enter")u.onAction?.()},tabIndex:0,style:{borderRadius:3}},[he.elem("span",{style:{fontSize:16,display:"flex"}},[Y.isThemeIcon(u.icon)?Cr(u.icon):u.icon.map((h)=>Cr(h))]),he.elem("span",{},[u.title]),he.div({style:{marginLeft:"auto"},ref:(h)=>{let g=n.store.add(new Xa(h,Oi,{disableTitle:!0,...Vv,keybindingLabelShadow:void 0,keybindingLabelForeground:M(a0),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));n.store.add(W((p)=>{g.set(u.keybinding.read(p))}))}})]))}function _O(u,n){return m({name:"inlineEdits.actionBar"},(h)=>he.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[he.div({ref:(g)=>{h.store.add(new er(g,n)).push(u,{icon:!1,label:!0})}})]))}function Rw(){return he.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:M(R2),padding:"2px 0"}},he.div({style:{borderBottom:`1px solid ${M(Uf)}`}}))}var bO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},nu=function(u,n){return function(h,g){n(h,g,u)}};class ru{constructor(u,n,h,g,p){this.gutterMenuData=u,this.originalRange=n,this.model=h,this.altAction=g,this.customization=p}}class ic{static fromInlineSuggestion(u){let n=u.action?.kind==="edit"?u.action.alternativeAction:void 0,h=u.source.inlineSuggestions.commands??[];return new ic(u.gutterMenuLinkAction,u.source.provider.displayName??e(1282,"Inline Suggestion"),h.length>0?[h]:[],n,u.source.provider.modelInfo,u.source.provider.setModelId?.bind(u.source.provider))}constructor(u,n,h,g,p,f,b=!1){this.action=u,this.displayName=n,this.extensionCommands=h,this.alternativeAction=g,this.modelInfo=p,this.setModelId=f,this.extensionCommandsOnly=b}}class oc{static fromInlineCompletionModel(u){return new oc(()=>u.accept(),()=>u.jump())}constructor(u,n){this.accept=u,this.jump=n}}var kw=16,A1=2,tc=class u extends i{constructor(n,h,g,p,f,b,S,w,x,I,E){super();this._editorObs=n,this._data=h,this._tabAction=g,this._verticalOffset=p,this._isHoveringOverInlineEdit=f,this._focusIsInMenu=b,this._hoverService=S,this._instantiationService=w,this._accessibilityService=x,this._themeService=I,this._userInteractionService=E,this._onDidCloseWithCommand=this._register(new r),this._modifierPressed=m(this,(X)=>this._userInteractionService.readModifierKeyStatus(this._editorObs.editor.getDomNode(),X).shiftKey),this._gutterIndicatorStyles=m(this,(X)=>{let J=this._tabAction.read(X),Q=this._data.read(X)?.altAction,te=this._modifierPressed.read(X);if(Q&&te)J=Nt.Inactive;switch(J){case Nt.Inactive:return{background:Ut(Zl,this._themeService).read(X).toString(),foreground:Ut(L1,this._themeService).read(X).toString(),border:Ut(E1,this._themeService).read(X).toString()};case Nt.Jump:return{background:Ut(dr,this._themeService).read(X).toString(),foreground:Ut(da,this._themeService).read(X).toString(),border:Ut(qo,this._themeService).read(X).toString()};case Nt.Accept:return{background:Ut(Xl,this._themeService).read(X).toString(),foreground:Ut(D1,this._themeService).read(X).toString(),border:Ut(Ew,this._themeService).read(X).toString()};default:pc()}}),this._state=m(this,(X)=>{let J=this._originalRangeObs.read(X);if(!J)return;return{range:J,lineOffsetRange:this._editorObs.observeLineOffsetRange(J,X.store)}}),this._lineNumberToRender=m(this,(X)=>{if(this._verticalOffset.read(X)!==0)return"";let J=this._data.read(X)?.originalRange.startLineNumber,Q=this._editorObs.getOption(76).read(X);if(J===void 0||Q.renderType===0)return"";if(Q.renderType===3){let te=this._editorObs.cursorPosition.read(X);if(J%10===0||te&&te.lineNumber===J)return J.toString();return""}if(Q.renderType===2){let te=this._editorObs.cursorPosition.read(X);if(!te)return"";let re=Math.abs(J-te.lineNumber);if(re===0)return J.toString();return re.toString()}if(Q.renderType===4){if(Q.renderFn)return Q.renderFn(J);return""}return J.toString()}),this._availableWidthForIcon=m(this,(X)=>{let J=this._editorObs.editor.getModel(),Q=this._editorObs.editor,te=this._editorObs.layoutInfo.read(X),re=te.decorationsLeft+te.decorationsWidth-te.glyphMarginLeft;if(!J||re<=0)return()=>0;if(te.lineNumbersLeft===0)return()=>re;let le=this._editorObs.getOption(76).read(X);if(le.renderType===2||le.renderType===0)return()=>re;let pe=Q.getOption(59).typicalHalfwidthCharacterWidth,Se=te.lineNumbersLeft+te.lineNumbersWidth,ae=(J.getLineCount()+1).toString().length,me=[];for(let De=1;De<=ae;De++){let Oe=10**(De-1),Me=Q.getTopForLineNumber(Oe),Ce=De*pe,Pe=Math.min(re,Math.max(0,Se-Ce-te.glyphMarginLeft));me.push({firstLineNumberWithDigitCount:Oe,topOfLineNumber:Me,usableWidthLeftOfLineNumber:Pe})}return(De)=>{for(let Oe=me.length-1;Oe>=0;Oe--)if(De>=me[Oe].topOfLineNumber)return me[Oe].usableWidthLeftOfLineNumber;throw new H("Could not find avilable width for icon")}}),this._layout=m(this,(X)=>{let J=this._state.read(X);if(!J)return;let Q=this._editorObs.layoutInfo.read(X),te=this._editorObs.observeLineHeightForLine(J.range.map((Rt)=>Rt.startLineNumber)).read(X),re=1,le=2,pe=Q.decorationsLeft+Q.decorationsWidth-Q.glyphMarginLeft-2*re,Se=Q.height-2*le,we=st.fromLeftTopWidthHeight(re,le,pe,Se),ae=we.withTop(this._stickyScrollHeight.read(X)),me=we.withTop(ae.top+le),De=J.lineOffsetRange.read(X),Oe=st.fromRanges(z.fromTo(me.left,me.right),De),Me=te,Ce=this._verticalOffset.read(X),Pe=Oe.withHeight(Me).translateY(Ce),tt=ae.containsRect(Pe),ze=this._data.read(X)?.customization?.icon,rt=ze?Ne(ze):this._tabAction.map((Rt)=>Rt===Nt.Accept?C.keyboardTab:C.arrowRight),qe=ze?Ne(ze):m(this,(Rt)=>{if(this._isHoveredOverIconDebounced.read(Rt)||this._isHoveredOverInlineEditDebounced.read(Rt))return C.check;if(this._tabAction.read(Rt)===Nt.Accept)return C.keyboardTab;let fi=this._editorObs.cursorLineNumber.read(Rt)??0,ls=J.range.read(Rt).startLineNumber;return fi<=ls?C.keyboardTabAbove:C.keyboardTabBelow}),Ft=22,it=(Rt)=>{let fi=this._availableWidthForIcon.read(void 0)(Rt.bottom+this._editorObs.editor.getScrollTop())-re;return Math.max(Math.min(fi,Ft),kw)};if(tt){let Rt=Pe,fi;if(Q.lineNumbersWidth===0)fi=Math.max(0,Math.min(Math.max(Q.lineNumbersLeft-we.left,0),Rt.width-Ft));else fi=Math.max(Q.lineNumbersLeft+Q.lineNumbersWidth-we.left,0);let ls=Rt.withWidth(fi),Ro=kw+A1,Tn=Math.min(Rt.width-fi,Ft),va=Rt.withWidth(Math.max(Tn,Ro)).translateX(fi),_f=Tn>=Ro;return{gutterEditArea:Oe,icon:qe,iconDirection:"right",iconRect:va,iconVisible:_f,pillRect:Rt,lineNumberRect:ls}}let ft=we.intersect(Oe);if(ft&&ft.height>=Me){let Rt=Pe.moveToBeContainedIn(me).moveToBeContainedIn(ft),fi=Rt.withWidth(it(Rt));return{gutterEditArea:Oe,icon:qe,iconDirection:"right",iconRect:fi,pillRect:fi,iconVisible:!0}}let yt=Pe.moveToBeContainedIn(we),St=yt.withWidth(it(yt)),Vt=St,Wt=St.top<Pe.top?"top":"bottom";return{gutterEditArea:Oe,icon:rt,iconDirection:Wt,iconRect:Vt,pillRect:St,iconVisible:!0}}),this._iconRef=he.ref(),this.isVisible=this._layout.map((X)=>!!X),this._hoverVisible=j(this,!1),this.isHoverVisible=this._hoverVisible,this._isHoveredOverIcon=j(this,!1),this._isHoveredOverIconDebounced=lk(this._isHoveredOverIcon,100),this.isHoveredOverIcon=this._isHoveredOverIconDebounced,this._indicator=he.div({class:"inline-edits-view-gutter-indicator",style:{position:"absolute",overflow:"visible"}},ji(this._layout).map((X)=>!X?[]:[he.div({style:{position:"absolute",background:M(R1),borderRadius:`${jt}px`,...Gt((J)=>X.read(J).gutterEditArea)}}),he.div({class:"icon",ref:this._iconRef,tabIndex:0,onclick:()=>{let Q=this._layout.get()?.icon.get()===C.check,te=this._data.get();if(!te)throw new H("Gutter indicator data not available");if(this._editorObs.editor.focus(),Q)te.model.accept();else te.model.jump()},onmouseenter:()=>{this._isHoveredOverIcon.set(!0,void 0),this._showHover()},onmouseleave:()=>this._isHoveredOverIcon.set(!1,void 0),style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map((J)=>J.background),["--vscodeIconForeground"]:this._gutterIndicatorStyles.map((J)=>J.foreground),border:this._gutterIndicatorStyles.map((J)=>`1px solid ${J.border}`),boxSizing:"border-box",borderRadius:`${jt}px`,display:"flex",justifyContent:X.map((J)=>J.iconDirection==="bottom"?"flex-start":"flex-end"),transition:this._modifierPressed.map((J)=>J?"":"background-color 0.2s ease-in-out, width 0.2s ease-in-out"),...Gt((J)=>X.read(J).pillRect)}},[he.div({className:"line-number",style:{lineHeight:X.map((J)=>J.lineNumberRect?J.lineNumberRect.height:0),display:X.map((J)=>J.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:X.map((J)=>J.lineNumberRect?J.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map((J)=>J.foreground)}},this._lineNumberToRender),he.div({style:{transform:X.map((J)=>`rotate(${vO(J.iconDirection)}deg)`),transition:"rotate 0.2s ease-in-out, opacity 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",opacity:X.map((J)=>J.iconVisible?"1":"0"),marginRight:X.map((J)=>J.pillRect.width-J.iconRect.width-(J.lineNumberRect?.width??0)),width:X.map((J)=>J.iconRect.width),position:"relative",right:X.map((J)=>J.iconDirection==="top"?"1px":"0"),color:this._data.map((J)=>J?.customization?.icon?.color?M(J.customization.icon.color.id):void 0)}},[X.map((J,Q)=>SO(Cr(J.icon.read(Q)),{fontSize:wO(Math.min(J.iconRect.width-A1,kw))}))])])])),this._originalRangeObs=ji(this._data.map((X)=>X?.originalRange)),this._stickyScrollController=As.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?je(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Ne(0),this._isHoveredOverInlineEditDebounced=lk(this._isHoveringOverInlineEdit,100);let Z=this._indicator.keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:Z.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:Ne(0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._register(Mo(this._isHoveredOverInlineEditDebounced,(X)=>{if(X)this.triggerAnimation()})),this._register(W((X)=>{if(Z.readEffect(X),Z.element)this._editorObs.editor.applyFontInfo(Z.element)}))}triggerAnimation(){if(this._accessibilityService.isMotionReduced())return new Animation(null,null).finished;return this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map((h)=>h.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;let n=this._data.get();if(!n)throw new H("Gutter indicator data not available");let h=new d,g=h.add(this._instantiationService.createInstance($m,this._editorObs,n.gutterMenuData,(b,S)=>{if(b)this._editorObs.editor.focus();if(S)this._onDidCloseWithCommand.fire(S);f?.dispose()}).toDisposableLiveElement()),p=this._userInteractionService.createFocusTracker(g.element,h);h.add(W((b)=>{this._focusIsInMenu.set(p.read(b),void 0)})),h.add(D(()=>this._focusIsInMenu.set(!1,void 0)));let f=this._hoverService.showInstantHover({target:this._iconRef.element,content:g.element});if(f)this._hoverVisible.set(!0,void 0),h.add(this._editorObs.editor.onDidScrollChange(()=>f.dispose())),h.add(f.onDispose(()=>{this._hoverVisible.set(!1,void 0),h.dispose()}));else h.dispose()}};tc=bO([nu(6,An),nu(7,O),nu(8,on),nu(9,We),nu(10,Fo)],tc);function vO(u){switch(u){case"top":return 90;case"bottom":return-90;case"right":return 0}}function SO(u,n){for(let h in n)u.style[h]=n[h];return u}function wO(u){return`${u}px`}var CO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},F1=function(u,n){return function(h,g){n(h,g,u)}},wo;(function(u){u.FirstTime="firstTime",u.SecondTime="secondTime",u.Active="active"})(wo||(wo={}));var jm=class u extends i{constructor(n,h,g,p,f){super();this._model=n,this._indicator=h,this._collapsedView=g,this._storageService=p,this._configurationService=f,this._disposables=this._register(new de),this._setupDone=j({name:"setupDone"},!1),this._activeCompletionId=m((b)=>{let S=this._model.read(b);if(!S)return;if(!this._setupDone.read(b))return;let w=this._indicator.read(b);if(!w||!w.isVisible.read(b))return;return S.inlineEdit.inlineCompletion.identity.id}),this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()===wo.Active)return;let n=new d,h=!1,g=!1,p=0,f=0;return n.add(O2(this._activeCompletionId,async(b,S,w,x)=>{if(b===void 0)return;let I=this.getNewUserType();switch(I){case wo.FirstTime:{if(p++>=5||h)I=wo.SecondTime,this.setNewUserType(I);break}case wo.SecondTime:{if(f++>=3&&g)I=wo.Active,this.setNewUserType(I);break}}switch(I){case wo.FirstTime:{for(let E=0;E<3&&!x.isCancellationRequested;E++)await this._indicator.get()?.triggerAnimation(),await Oo(500);break}case wo.SecondTime:{this._indicator.get()?.triggerAnimation();break}}})),n.add(W((b)=>{if(this._collapsedView.isVisible.read(b)){if(this.getNewUserType()!==wo.Active)this._collapsedView.triggerAnimation()}})),n.add(W((b)=>{let S=this._indicator.read(b);if(!S)return;b.store.add(Mo(S.isHoveredOverIcon,async(w)=>{if(w)h=!0}))})),n.add(W((b)=>{let S=this._model.read(b);if(!S)return;b.store.add(S.onDidAccept(()=>{g=!0}))})),n}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,wo.FirstTime)}setNewUserType(n){switch(n){case wo.FirstTime:throw new H("UserKind should not be set to first time");case wo.SecondTime:break;case wo.Active:this._disposables.clear();break}this._storageService.store("inlineEditsGutterIndicatorUserKind",n,-1,0)}_initializeDebugSetting(){if(this._configurationService.getValue("editor.inlineSuggest.edits.resetNewUserExperience"))this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1);return this._configurationService.onDidChangeConfiguration((g)=>{if(g.affectsConfiguration("editor.inlineSuggest.edits.resetNewUserExperience")&&this._configurationService.getValue("editor.inlineSuggest.edits.resetNewUserExperience"))this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience()})}};jm=CO([F1(3,Mn),F1(4,oe)],jm);class Tw{static{this.empty=new Tw([])}constructor(u){this.replacements=u,Uh(cu(u,(n,h)=>n.lineRange.endLineNumberExclusive<=h.lineRange.startLineNumber))}toString(){return this.replacements.map((u)=>u.toString()).join(",")}getNewLineRanges(){let u=[],n=0;for(let h of this.replacements)u.push(ne.ofLength(h.lineRange.startLineNumber+n,h.newLines.length)),n+=h.newLines.length-h.lineRange.length;return u}}class nc{static fromSingleTextEdit(u,n){let h=Ci(u.text),g=u.range.startLineNumber,p=n.getValueOfRange(t.fromPositions(new s(u.range.startLineNumber,1),u.range.getStartPosition()));h[0]=p+h[0];let f=u.range.endLineNumber+1,b=n.getTransformer().getLineLength(u.range.endLineNumber)+1,S=n.getValueOfRange(t.fromPositions(u.range.getEndPosition(),new s(u.range.endLineNumber,b)));h[h.length-1]=h[h.length-1]+S;let w=u.range.startColumn===n.getTransformer().getLineLength(u.range.startLineNumber)+1,x=u.range.endColumn===1;if(w&&h[0].length===p.length)g++,h.shift();if(h.length>0&&g<f&&x&&h[h.length-1].length===S.length)f--,h.pop();return new nc(new ne(g,f),h)}constructor(u,n){this.lineRange=u,this.newLines=n}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}toLineEdit(){return new Tw([this])}}class Nw{get lineEdit(){if(this.action?.kind==="jumpTo")return new nc(ne.ofLength(this.action.position.lineNumber,0),[]);else if(this.action?.kind==="edit")return nc.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText);return new nc(new ne(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(ne.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}constructor(u,n,h,g,p,f,b){this.originalText=u,this.action=n,this.edit=h,this.cursorPosition=g,this.multiCursorPositions=p,this.commands=f,this.inlineCompletion=b}}class Ow{constructor(u,n,h){this._model=u,this.inlineEdit=n,this.tabAction=h,this.editorType=this._model.editorType,this.displayLocation=this.inlineEdit.inlineCompletion.hint,this.inViewPort=m(this,(g)=>rw(this._model.editor,this.inlineEdit.inlineCompletion,g)),this.onDidAccept=this._model.onDidAccept}accept(u){this._model.accept(void 0,u)}handleInlineEditShownNextFrame(u,n){let h=this.inlineEdit.inlineCompletion,g=Date.now();h.addRef(),Ua(()=>{this._model.handleInlineSuggestionShown(h,u,n,g),h.removeRef()})}}var yO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},xO=function(u,n){return function(h,g){n(h,g,u)}},Gm=class u extends i{constructor(n,h,g){super();this._editor=n,this._edit=h,this._accessibilityService=g,this.onDidClick=R.None,this._iconRef=he.ref(),this.isHovered=Ne(!1),this._editorObs=ct(this._editor);let f=this._edit.map((x)=>x?.edit?.replacements[0]??null).map((x)=>x?Lo(x,this._editor.getModel()).range.getStartPosition():null),b=this._editorObs.observePosition(f,this._store),S=m((x)=>{let I=b.read(x);if(!I)return null;let E=this._editorObs.layoutInfoContentLeft.read(x),Z=this._editorObs.scrollLeft.read(x);return new _i(E+I.x-Z,I.y)}),w=he.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(S)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:w,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:Ne(0)})),this.isVisible=this._edit.map((x,I)=>!!x&&S.read(I)!==null)}triggerAnimation(){if(this._accessibilityService.isMotionReduced())return new Animation(null,null).finished;return this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:0.2,transform:"translateY(1px)"},{offset:0.36,transform:"translateY(-1px)"},{offset:0.52,transform:"translateY(1px)"},{offset:0.68,transform:"translateY(-1px)"},{offset:0.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2000}).finished}getCollapsedIndicator(n){let h=this._editorObs.layoutInfoContentLeft,g=n.map((f,b)=>f?f.deltaX(-h.read(b)):null),p=this.createIconPath(g);return he.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...Gt((f)=>Jl(this._editorObs).read(f)),overflow:"hidden",pointerEvents:"none"}},[he.svgElem("path",{class:"collapsedViewPath",d:p,fill:M(qo)})])}createIconPath(n){return n.map((f)=>{if(!f)return new ec().build();let b=f.deltaX(-3).deltaY(-1),S=b.deltaX(6),w=b.deltaY(1),x=S.deltaY(1),I=w.deltaX(3).deltaY(3);return new ec().moveTo(b).lineTo(S).lineTo(x).lineTo(I).lineTo(w).lineTo(b).build()})}};Gm=yO([xO(2,on)],Gm);var IO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},H1=function(u,n){return function(h,g){n(h,g,u)}},qm=14,Mw=0,as=4,Zm=4,B1=2,Xm=class u extends i{constructor(n,h,g,p,f,b){super();this._editor=n,this._languageService=b,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._isHovered=j(this,!1),this.isHovered=this._isHovered,this._viewRef=he.ref(),this._editorObs=ct(this._editor);let S=g.map((E,Z)=>{let X;switch(E){case Nt.Inactive:X=Zl;break;case Nt.Jump:X=dr;break;case Nt.Accept:X=Xl;break}return{border:Ut(X,f).read(Z).toString(),background:io(p.read(Z))}}),w=h.map((E)=>E?this.getState(E):void 0),x=w.map((E)=>E?this.getRendering(E,S):void 0);this.minEditorScrollHeight=m(this,(E)=>{let Z=w.read(E);if(!Z)return 0;return Z.rect.read(E).bottom+this._editor.getScrollTop()});let I=he.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[x]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:I.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:fo(this,(E,Z)=>{let X=w.read(E);if(!X)return Z??0;let J=X.rect.map((Q)=>Q.right).read(E)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(E)+as-this._editorObs.layoutInfoContentLeft.read(E);return Math.max(Z??0,J)}).recomputeInitiallyAndOnChange(this._store)})),this._register(W((E)=>{if(!x.read(E)){this._isHovered.set(!1,void 0);return}this._isHovered.set(I.isHovered.read(E),void 0)}))}fitsInsideViewport(n,h,g){let p=this._editorObs.layoutInfoWidth.read(g),f=this._editorObs.layoutInfoContentLeft.read(g),b=this._editor.getLayoutInfo().verticalScrollbarWidth,S=this._editorObs.layoutInfoMinimap.read(g).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(g).minimapWidth:0,w=Eo(this._editorObs,n,void 0),x=ou(h,this._editor,this._editor.getModel()),I=as+qm;return w+x+I<p-f-b-S}getState(n){let h=m(this,(S)=>{let w=n.range.startLineNumber,x=n.range.endLineNumber,I=n.range.startColumn,E=n.range.endColumn,Z=this._editor.getModel()?.getLineCount()??0,X=Eo(this._editorObs,new ne(w,w+1),S),J=w+1<=Z?Eo(this._editorObs,new ne(w+1,w+2),S):void 0,Q=w-1>=1?Eo(this._editorObs,new ne(w-1,w),S):void 0,te=this._editor.getOffsetForColumn(w,I),re=this._editor.getOffsetForColumn(x,E);return{lineWidth:X,lineWidthBelow:J,lineWidthAbove:Q,startContentLeftOffset:te,endContentLeftOffset:re}}),g=n.range.startLineNumber,p=n.range.endLineNumber,f=this.fitsInsideViewport(new ne(g,p+1),n.content,void 0);return{rect:m(this,(S)=>{let w=this._editorObs.getOption(59).read(S).typicalHalfwidthCharacterWidth,{lineWidth:x,lineWidthBelow:I,lineWidthAbove:E,startContentLeftOffset:Z,endContentLeftOffset:X}=h.read(S),J=this._editorObs.layoutInfoContentLeft.read(S),Q=this._editorObs.observeLineHeightForLine(g).recomputeInitiallyAndOnChange(S.store).read(S),te=this._editorObs.scrollTop.read(S),re=this._editorObs.scrollLeft.read(S),le;if(g===p&&X+5*w>=x&&f)le="end";else if(I!==void 0&&I+qm-Zm-as<Z)le="below";else if(E!==void 0&&E+qm-Zm-as<Z)le="above";else le="end";let pe,Se,we=0,ae=0;switch(le){case"end":{pe=this._editorObs.editor.getTopForLineNumber(g),Se=x,we=as+qm;break}case"below":{pe=this._editorObs.editor.getTopForLineNumber(g+1),Se=Z,we=as+Zm,ae=Mw+B1;break}case"above":{pe=this._editorObs.editor.getTopForLineNumber(g-1),Se=Z,we=as+Zm,ae=-Mw+B1;break}}return st.fromLeftTopWidthHeight(J+Se-re,pe-te,w*n.content.length,Q).withMargin(Mw,as).translateX(we).translateY(ae)}),label:n.content,kind:n.style}}getRendering(n,h){let g=document.createElement("div"),p=this._editor.getModel().tokenization.tokenizeLinesAt(1,[n.label])?.[0],f;if(p&&n.kind===nk.Code)f=Al.fromLineTokens(p).toLineTokens(n.label,this._languageService.languageIdCodec);else f=Tt.createEmpty(n.label,this._languageService.languageIdCodec);let b=$u(new Td([f]),Qa.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],g,!0);g.style.width=`${b.minWidthInPx}px`;let S=n.rect.map((w)=>w.withMargin(0,as));return he.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...Gt((w)=>S.read(w)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:h.map((w)=>`1px solid ${w.border}`),borderRadius:`${jt}px`,backgroundColor:h.map((w)=>w.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:(w)=>{w.preventDefault()},onclick:(w)=>{this._onDidClick.fire(_o.create(w))}},[g])}};Xm=IO([H1(4,We),H1(5,xt)],Xm);var LO=0,EO=0,Pw=1,DO=1,RO=3,Aw=jt;class Fw extends i{constructor(u,n,h,g){super();this._editor=u,this._edit=n,this._uiState=h,this._tabAction=g,this.onDidClick=R.None,this._display=m(this,(b)=>this._uiState.read(b)?"block":"none"),this._editorMaxContentWidthInRange=m(this,(b)=>{let S=this._originalDisplayRange.read(b);if(!S)return Ne(0);return this._editorObs.versionId.read(b),fo(this,(w,x)=>{let I=Eo(this._editorObs,S,w);return Math.max(I,x??0)})}).map((b,S)=>b.read(S)),this._maxPrefixTrim=m(this,(b)=>{let S=this._uiState.read(b);if(!S)return{prefixTrim:0,prefixLeftOffset:0};return Yl(S.deletions,S.originalRange,[],this._editor)}),this._editorLayoutInfo=m(this,(b)=>{let S=this._edit.read(b);if(!S)return null;if(!this._uiState.read(b))return null;let x=this._editorObs.layoutInfo.read(b),I=this._editorObs.scrollLeft.read(b),E=this._editorObs.getOption(59).map((le)=>le.typicalHalfwidthCharacterWidth).read(b),Z=x.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(b),E)-I,X=S.originalLineRange,J=this._originalVerticalStartPosition.read(b)??this._editor.getTopForLineNumber(X.startLineNumber)-this._editorObs.scrollTop.read(b),Q=this._originalVerticalEndPosition.read(b)??this._editor.getTopForLineNumber(X.endLineNumberExclusive)-this._editorObs.scrollTop.read(b),te=x.contentLeft+this._maxPrefixTrim.read(b).prefixLeftOffset-I;if(Z<=te)return null;return{codeRect:st.fromLeftTopRightBottom(te,J,Z,Q).withMargin(EO,LO),contentLeft:x.contentLeft}}).recomputeInitiallyAndOnChange(this._store),this._originalOverlay=he.div({style:{pointerEvents:"none"}},m(this,(b)=>{let S=ji(this._editorLayoutInfo).read(b);if(!S)return;let w=S.map((X)=>st.fromLeftTopRightBottom(X.contentLeft-Aw-Pw,X.codeRect.top,X.contentLeft,X.codeRect.bottom)),x=m(this,(X)=>{let J=S.read(X).codeRect,Q=w.read(X);return J.intersectHorizontal(new z(Q.left,Number.MAX_SAFE_INTEGER))}),I=this._uiState.map((X)=>X?.editorType===Ot.DiffEditor?RO:DO).read(b),E=x.map((X)=>X.withMargin(I,I)),Z=io(this._uiState.map((X)=>X?.editorType??Ot.TextEditor).read(b));return[he.div({class:"originalSeparatorDeletion",style:{...E.read(b).toStyles(),borderRadius:`${Aw}px`,border:`${Pw+I}px solid ${Z}`,boxSizing:"border-box"}}),he.div({class:"originalOverlayDeletion",style:{...x.read(b).toStyles(),borderRadius:`${Aw}px`,border:la(this._tabAction).map((X)=>`${Pw}px solid ${M(X)}`),boxSizing:"border-box",backgroundColor:M(aa)}}),he.div({class:"originalOverlayHiderDeletion",style:{...w.read(b).toStyles(),backgroundColor:Z}})]})).keepUpdated(this._store),this._nonOverflowView=he.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store),this.isHovered=Ne(!1),this._editorObs=ct(this._editor);let p=m(this,(b)=>{let S=this._edit.read(b);return S?new s(S.originalLineRange.startLineNumber,1):null}),f=m(this,(b)=>{let S=this._edit.read(b);return S?new s(S.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map((b)=>b?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(p,this._store).map((b)=>b?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(f,this._store).map((b)=>b?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:m(this,(b)=>{let S=this._editorLayoutInfo.read(b);if(S===null)return 0;return S.codeRect.width})}))}}var kO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},$1=function(u,n){return function(h,g){n(h,g,u)}},rc=1,TO=1,NO=3,Hw=jt,Ym=class u extends i{constructor(n,h,g,p,f){super();this._editor=n,this._input=h,this._tabAction=g,this._languageService=f,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._state=m(this,(b)=>{let S=this._input.read(b);if(!S)return;let w=this._editor.getModel(),x=w.getEOL();if(S.startColumn===1&&S.lineNumber>1&&w.getLineLength(S.lineNumber)!==0&&S.text.endsWith(x)&&!S.text.startsWith(x)){let I=w.getLineLength(S.lineNumber-1)+1;return{lineNumber:S.lineNumber-1,column:I,text:x+S.text.slice(0,-x.length)}}return{lineNumber:S.lineNumber,column:S.startColumn,text:S.text}}),this._trimVertically=m(this,(b)=>{let S=this._state.read(b);if(!S)return{topOffset:0,contentHeight:0,linesTop:0,linesBottom:0};let w=S.text,x=this._editor.getLineHeightForPosition(new s(S.lineNumber,1)),I=this._editor.getModel().getEOL(),E=w.split(I).length,Z=0,X=0;if(w.trim()!==""){let J=0;for(;J<w.length&&w.startsWith(I,J);J+=I.length)Z+=1;for(let Q=w.length;Q>J&&w.endsWith(I,Q);Q-=I.length)X+=1}return{topOffset:Z*x,contentHeight:(E-Z-X)*x,linesTop:Z,linesBottom:X}}),this._maxPrefixTrim=m(this,(b)=>{let S=this._state.read(b);if(!S)return{prefixLeftOffset:0,prefixTrim:0};let w=this._editor.getModel(),x=w.getEOL(),I=this._trimVertically.read(b),E=S.text.split(x),Z=E.slice(I.linesTop,E.length-I.linesBottom);if(I.linesTop===0)Z[0]=w.getLineContent(S.lineNumber)+Z[0];let X=new ne(S.lineNumber,S.lineNumber+(I.linesTop>0?0:1));return Yl([],X,Z,this._editor)}),this._ghostText=m((b)=>{let S=this._state.read(b),w=this._maxPrefixTrim.read(b);if(!S)return;let I=this._editor.getModel().getEOL(),Z=S.text.split(I).map((X,J)=>new Cd(new t(J+1,J===0?1:w.prefixTrim+1,J+1,X.length+1),"modified-background",0));return new qr(S.lineNumber,[new ld(S.column,S.text,!1,Z)])}),this._display=m(this,(b)=>this._state.read(b)?"block":"none"),this._editorMaxContentWidthInRange=m(this,(b)=>{let S=this._state.read(b);if(!S)return 0;this._editorObs.versionId.read(b);let w=this._editor.getModel(),x=w.getEOL(),I=S.text.startsWith(x)?"":w.getValueInRange(new t(S.lineNumber,1,S.lineNumber,S.column)),E=w.getValueInRange(new t(S.lineNumber,S.column,S.lineNumber,w.getLineLength(S.lineNumber)+1)),X=(I+S.text+E).split(x),J=Qa.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),Q=X.map((te)=>{let re=w.tokenization.tokenizeLinesAt(S.lineNumber,[te])?.[0],le;if(re)le=Al.fromLineTokens(re).toLineTokens(te,this._languageService.languageIdCodec);else le=Tt.createEmpty(te,this._languageService.languageIdCodec);return $u(new Td([le]),J,[],_("div"),!0).minWidthInPx});return Math.max(...Q)}),this.startLineOffset=this._trimVertically.map((b)=>b.topOffset),this.originalLines=this._state.map((b)=>b?new ne(b.lineNumber,Math.min(b.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0),this._overlayLayout=m(this,(b)=>{this._ghostText.read(b);let S=this._state.read(b);if(!S)return null;this._editorObs.observePosition(j(this,new s(S.lineNumber,S.column)),b.store).read(b);let w=this._editorObs.layoutInfo.read(b),x=this._editorObs.scrollLeft.read(b),I=this._editorObs.layoutInfoVerticalScrollbarWidth.read(b),E=w.contentLeft+this._editorMaxContentWidthInRange.read(b)-x,Z=this._maxPrefixTrim.read(b).prefixLeftOffset??0,X=w.contentLeft+Z-x;if(E<=X)return null;let{topOffset:J,contentHeight:Q}=this._trimVertically.read(b),te=this._editorObs.scrollTop.read(b),re=this._editor.getTopForLineNumber(S.lineNumber)-te+J,le=re+Q,pe=new st(X,re,E,le);return{overlay:pe,startsAtContentLeft:Z===0,contentLeft:w.contentLeft,minContentWidthRequired:Z+pe.width+I}}).recomputeInitiallyAndOnChange(this._store),this._modifiedOverlay=he.div({style:{pointerEvents:"none"}},m(this,(b)=>{let S=ji(this._overlayLayout).read(b);if(!S)return;let w=S.map((X)=>st.fromLeftTopRightBottom(X.contentLeft-Hw-rc,X.overlay.top,X.contentLeft,X.overlay.bottom)).read(b),x=this._input.map((X)=>X?.editorType===Ot.DiffEditor?NO:TO).read(b),I=S.map((X)=>X.overlay.withMargin(0,rc,rc,X.startsAtContentLeft?0:rc).intersectHorizontal(new z(w.left,Number.MAX_SAFE_INTEGER))),E=I.map((X)=>X.withMargin(x,x)),Z=io(this._input.read(void 0)?.editorType??Ot.TextEditor);return[he.div({class:"originalUnderlayInsertion",style:{...E.read(b).toStyles(),borderRadius:Hw,border:`${rc+x}px solid ${Z}`,boxSizing:"border-box"}}),he.div({class:"originalOverlayInsertion",style:{...I.read(b).toStyles(),borderRadius:Hw,border:ss(this._tabAction).map((X)=>`${rc}px solid ${M(X)}`),boxSizing:"border-box",backgroundColor:M(Um)}}),he.div({class:"originalOverlayHiderInsertion",style:{...w.toStyles(),backgroundColor:Z}})]})).keepUpdated(this._store),this._view=he.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store),this._editorObs=ct(this._editor),this._ghostTextView=this._register(p.createInstance(ia,this._editor,m((b)=>{let S=this._ghostText.read(b);if(!S)return;return{ghostText:S,handleInlineCompletionShown:(w)=>{},warning:void 0}}),{extraClasses:["inline-edit"],isClickable:!0,shouldKeepCursorStable:!0})),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick((b)=>{this._onDidClick.fire(new _o(b))})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:m(this,(b)=>{let S=this._overlayLayout.read(b);if(S===null)return 0;return S.minContentWidthRequired})}))}};Ym=kO([$1(3,O),$1(4,xt)],Ym);var OO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},j1=function(u,n){return function(h,g){n(h,g,u)}},Jm=class u extends i{constructor(n,h,g,p,f,b){super();this._editor=n,this._edit=h,this._editorType=g,this._tabAction=p,this._languageService=f,this._themeService=b,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._maxPrefixTrim=this._edit.map((S,w)=>S?Yl(S.replacements.flatMap((x)=>[x.originalRange,x.modifiedRange]),S.originalRange,S.modifiedLines,this._editor.editor,w):void 0),this._modifiedLineElements=m(this,(S)=>{let w=[],x=0,I=this._maxPrefixTrim.read(S),E=this._edit.read(S);if(!E||!I)return;let Z=I.prefixTrim,X=MO(E.replacements.map((te)=>te.modifiedRange)).map((te)=>new t(te.startLineNumber,te.startColumn-Z,te.endLineNumber,te.endColumn-Z)),J=this._editor.model.get(),Q=E.modifiedRange.startLineNumber;for(let te=0;te<E.modifiedRange.length;te++){let re=document.createElement("div"),le=Q+te,pe=E.modifiedLines[te].slice(Z),Se=J.tokenization.tokenizeLinesAt(le,[pe])?.[0],we;if(Se)we=Al.fromLineTokens(Se).toLineTokens(pe,this._languageService.languageIdCodec);else we=Tt.createEmpty(pe,this._languageService.languageIdCodec);let ae=[];for(let De of X.filter((Oe)=>Oe.startLineNumber===le)){let Oe=Math.min(De.endColumn,pe.length+1);ae.push(new Cd(new t(1,De.startColumn,1,Oe),"inlineCompletions-modified-bubble",0))}let me=$u(new Td([we]),Qa.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),ae,re,!0);this._editor.getOption(59).read(S),x=Math.max(x,me.minWidthInPx),w.push(re)}return{lines:w,requiredWidth:x}}),this._layout=m(this,(S)=>{let w=this._modifiedLineElements.read(S),x=this._maxPrefixTrim.read(S),I=this._edit.read(S);if(!w||!x||!I)return;let{prefixLeftOffset:E}=x,{requiredWidth:Z}=w,X=this._editor.observeLineHeightsForLineRange(I.originalRange).read(S),J=(()=>{let qe=X.slice(0,I.modifiedRange.length);while(qe.length<I.modifiedRange.length)qe.push(X[X.length-1]);return qe})(),Q=this._editor.layoutInfoContentLeft.read(S),te=this._editor.layoutInfoVerticalScrollbarWidth.read(S),re=this._editor.scrollLeft.read(S),le=this._editor.scrollTop.read(S),pe=Q-re,Se=this._editor.editor.getModel(),we=I.originalRange.mapToLineArray((qe)=>this._editor.editor.getOffsetForColumn(qe,Se.getLineMaxColumn(qe))-E),ae=Math.max(...we,Z),me=I.originalRange.startLineNumber,De=I.originalRange.endLineNumberExclusive-1,Oe=this._editor.editor.getTopForLineNumber(me)-le,Me=this._editor.editor.getBottomForLineNumber(De)-le,Ce=st.fromLeftTopWidthHeight(pe+E,Oe,ae,Me-Oe),Pe=st.fromLeftTopWidthHeight(Ce.left,Ce.bottom,Ce.width,J.reduce((qe,Ft)=>qe+Ft,0)),tt=st.hull([Ce,Pe]),ze=tt.intersectVertical(new z(Ce.bottom,Number.MAX_SAFE_INTEGER)),rt=new st(ze.left,ze.top,ze.right,ze.bottom);return{originalLinesOverlay:Ce,modifiedLinesOverlay:Pe,background:tt,lowerBackground:ze,lowerText:rt,modifiedLineHeights:J,minContentWidthRequired:E+ae+te}}),this._viewZoneInfo=m((S)=>{if(!this._editor.getOption(71).map((X)=>X.edits.allowCodeShifting==="always").read(S))return;let x=this._layout.read(S),I=this._edit.read(S);if(!x||!I)return;let E=x.lowerBackground.height,Z=I.originalRange.endLineNumberExclusive;return{height:E,lineNumber:Z}}),this.minEditorScrollHeight=m(this,(S)=>{let w=ji(this._layout).read(S);if(!w||this._viewZoneInfo.read(S)!==void 0)return 0;return w.read(S).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=he.div({class:"line-replacement"},[m(this,(S)=>{let w=ji(this._layout).read(S),x=this._modifiedLineElements.read(S);if(!w||!x)return[];let I=w.read(S),E=this._editor.layoutInfoContentLeft.read(S),Z=this._editorType.read(S)===Ot.DiffEditor?3:1;x.lines.forEach((te,re)=>{te.style.width=`${I.lowerText.width}px`,te.style.height=`${I.modifiedLineHeights[re]}px`,te.style.position="relative"});let X=ss(this._tabAction).read(S),J=la(this._tabAction).read(S),Q=io(this._editorType.read(S));return[he.div({style:{position:"absolute",...Gt((te)=>Jl(this._editor).read(te)),overflow:"hidden",pointerEvents:"none"}},[he.div({class:"borderAroundLineReplacement",style:{position:"absolute",...Gt((te)=>w.read(te).background.translateX(-E).withMargin(Z)),borderRadius:`${jt}px`,border:`${Z+1}px solid ${Q}`,boxSizing:"border-box",pointerEvents:"none"}}),he.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...Gt((te)=>w.read(te).background.translateX(-E)),borderRadius:`${jt}px`,border:Ut(J,this._themeService).map((te)=>`1px solid ${te.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:M(aa)}}),he.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...Gt((te)=>w.read(te).lowerBackground.translateX(-E)),borderRadius:`0 0 ${jt}px ${jt}px`,background:Q,boxShadow:`${M(Mg)} 0 6px 6px -6px`,border:`1px solid ${M(X)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:(te)=>{te.preventDefault()},onclick:(te)=>this._onDidClick.fire(_o.create(te))},[he.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:M(x1)}})]),he.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...Gt((te)=>w.read(te).lowerText.translateX(-E)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:`0 0 ${jt}px ${jt}px`,overflow:"hidden"}},[...x.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered((S)=>this._isMouseOverWidget(S),this._store),this._previousViewZoneInfo=void 0,this._register(D(()=>this._editor.editor.changeViewZones((S)=>this.removePreviousViewZone(S)))),this._register(a2(this._viewZoneInfo,({lastValue:S,newValue:w})=>{if(S===w||S?.height===w?.height&&S?.lineNumber===w?.lineNumber)return;this._editor.editor.changeViewZones((x)=>{if(this.removePreviousViewZone(x),!w)return;this.addViewZone(w,x)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:m(this,(S)=>this._layout.read(S)?.minContentWidthRequired??0),position:Ne({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(n){let h=this._layout.get();if(!h||!(n.event instanceof Ml))return!1;return h.lowerBackground.containsPoint(new _i(n.event.relativePos.x,n.event.relativePos.y))}removePreviousViewZone(n){if(!this._previousViewZoneInfo)return;n.removeZone(this._previousViewZoneInfo.id);let h=this._editor.cursorLineNumber.get();if(h!==null&&h>=this._previousViewZoneInfo.lineNumber)this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height);this._previousViewZoneInfo=void 0}addViewZone(n,h){let g=h.addZone({afterLineNumber:n.lineNumber-1,heightInPx:n.height,domNode:_("div")});this._previousViewZoneInfo={height:n.height,lineNumber:n.lineNumber,id:g};let p=this._editor.cursorLineNumber.get();if(p!==null&&p>=n.lineNumber)this._editor.editor.setScrollTop(this._editor.scrollTop.get()+n.height)}};Jm=OO([j1(4,xt),j1(5,We)],Jm);function MO(u){let n=[];while(u.length){let h=u.shift();if(h.startLineNumber!==h.endLineNumber)u.push(new t(h.startLineNumber+1,1,h.endLineNumber,h.endColumn)),h=new t(h.startLineNumber,h.startColumn,h.startLineNumber,Number.MAX_SAFE_INTEGER);n.push(h)}return n}function eD(u,n){let h={};for(let[b,S]of Object.entries(n))if(Array.isArray(S))h[b]={min:0,rules:S};else h[b]={min:S.min??0,rules:S.rules??[{max:S.max,priority:S.priority,share:S.share}]};let g={},p=0;for(let[b,S]of Object.entries(h))g[b]=S.min,p+=S.min;if(p>u)return null;let f=u-p;while(f>0){let b=[];for(let[Z,X]of Object.entries(h))for(let J=0;J<X.rules.length;J++){let Q=X.rules[J],te=g[Z],re=Q.max??1/0;if(te<re)b.push({partKey:Z,ruleIndex:J,rule:Q,priority:Q.priority??0,share:Q.share??1})}if(b.length===0)break;let S=Math.max(...b.map((Z)=>Z.priority)),w=b.filter((Z)=>Z.priority===S),x=w.reduce((Z,X)=>Z+X.share,0),I=0,E=[];for(let Z of w){let X=Z.rule,J=g[Z.partKey],te=(X.max??1/0)-J,re=f*Z.share/x,le=Math.min(re,te);E.push({partKey:Z.partKey,ruleIndex:Z.ruleIndex,amount:le}),I+=le}if(I===0)break;for(let Z of E)g[Z.partKey]+=Z.amount;if(f-=I,f<0.0001)break}return g}var PO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Ww=function(u,n){return function(h,g){n(h,g,u)}},Qm=class u extends i{constructor(n,h,g,p,f,b){super();this._editor=n,this._data=g,this._themeService=p,this._keybindingService=f,this._contextKeyService=b,this._styles=m(this,(w)=>({background:Ut(dr,this._themeService).read(w).toString(),foreground:Ut(da,this._themeService).read(w).toString(),border:Ut(qo,this._themeService).read(w).toString()})),this._pos=m(this,(w)=>this._editor.observePosition(m((x)=>this._data.read(x)?.jumpToPosition||null),w.store)).flatten(),this._layout=m(this,(w)=>{let x=this._data.read(w);if(!x)return;let I=x.jumpToPosition,E=this._editor.observeLineHeightForLine(Ne(I.lineNumber)).read(w),Z=this._editor.scrollLeft.read(w),X=this._pos.read(w);if(!X)return;let J=this._editor.layoutInfo.read(w);return{widgetRect:st.fromLeftTopWidthHeight(X.x+J.contentLeft+2-Z,X.y,100,E)}}),this._blink=AO([{value:!0,durationMs:600},{value:!1,durationMs:600}]),this._widget=he.div({class:"inline-edit-jump-to-widget",style:{position:"absolute",display:this._layout.map((w)=>w?"flex":"none"),alignItems:"center",cursor:"pointer",userSelect:"none",...Gt((w)=>this._layout.read(w)?.widgetRect)}},m((w)=>{if(this._data.read(w)===void 0)return[];return he.div({style:{display:"flex",alignItems:"center",gap:"4px",padding:"0 4px",height:"100%",backgroundColor:this._styles.map((x)=>x.background),["--vscodeIconForeground"]:this._styles.map((x)=>x.foreground),border:this._styles.map((x)=>`1px solid ${x.border}`),borderRadius:"3px",boxSizing:"border-box",fontSize:"11px",color:this._styles.map((x)=>x.foreground)}},[this._style==="cursor"?he.elem("div",{style:{borderLeft:"2px solid",height:14,opacity:this._blink.map((x)=>x?"0":"1")}}):[m(()=>he.elem("div",{},FO(this._keybinding))),he.elem("div",{style:{lineHeight:this._layout.map((x)=>x?.widgetRect.height),marginTop:"-2px"}},["to jump"])]])})),this._style=h.style,this._keybinding=this._getKeybinding(fn);let S=this._widget.keepUpdated(this._store);this._register(this._editor.createOverlayWidget({domNode:S.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:Ne(0)})),this._register(this._editor.setDecorations(m((w)=>{let x=this._data.read(w);if(!x)return[];return[{range:t.fromPositions(x.jumpToPosition,x.jumpToPosition),options:{description:"inline-edit-jump-to-decoration",inlineClassNameAffectsLetterSpacing:!0,showIfCollapsed:!0,after:{content:this._style==="label"?" ":" "}}}]})))}_getKeybinding(n,h=Jt.ofCaller()){if(!n)return Ne(void 0);return je(this,this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(n),h)}};Qm=PO([Ww(3,We),Ww(4,ge),Ww(5,K)],Qm);function AO(u,n=Jt.ofCaller()){let h=0;return je(void 0,(g)=>{h=0;let p=new ke(()=>{h=(h+1)%u.length,g(null),p.schedule(u[h].durationMs)},0);return p.schedule(0),p},()=>u[h].value,n)}function FO(u){return m((n)=>he.div({style:{},ref:(h)=>{let g=n.store.add(new Xa(h,Oi,{disableTitle:!0,...Vv,keybindingLabelShadow:void 0,keybindingLabelForeground:M(da),keybindingLabelBackground:"transparent",keybindingLabelBorder:M(da),keybindingLabelBottomBorder:void 0}));n.store.add(W((p)=>{g.set(u.read(p))}))}}))}var HO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},WO=function(u,n){return function(h,g){n(h,g,u)}};function BO(u,n,h){let g=Math.max(1,Math.min(h,u)),p=Math.max(1,g-n),f=Math.min(h+1,g+n+1);return new ne(p,f)}var ef=class u extends i{constructor(n,h,g,p,f){super();this._previewTextModel=n,this._properties=h,this._parentEditor=g,this._tabAction=p,this._instantiationService=f,this._previewRef=he.ref(),this.element=he.div({class:"preview",style:{},ref:this._previewRef}),this._state=m(this,(b)=>{let S=this._properties.read(b);if(!S)return;let w,x;if(S.nextCursorPosition!==null)w="original",x=S.nextCursorPosition.lineNumber;else if(S.diff[0].innerChanges?.every((J)=>J.modifiedRange.isEmpty()))w="original",x=S.diff[0].original.startLineNumber;else w="modified",x=S.diff[0].modified.startLineNumber;let I=w==="modified"?nr.snapshot(this._previewTextModel):S.target,E=this._parentEditorObs.getOption(71).read(b).edits.longDistanceHintContextLineCount,Z=w==="modified"?this._previewTextModel:S.target.dangerouslyGetUnderlyingModel(),X=BO(x,E,Z.getLineCount());return{mode:w,targetLineNumber:x,visibleLineRange:X,textModel:I,diff:S.diff}}),this.updatePreviewEditorEffect=m(this,(b)=>{this._previewEditorObs.model.read(b);let S=this._state.read(b)?.visibleLineRange;if(!S)return;let w=[];if(S.startLineNumber>1)w.push(new t(1,1,S.startLineNumber-1,1));if(S.endLineNumberExclusive<this._previewTextModel.getLineCount()+1)w.push(new t(S.endLineNumberExclusive,1,this._previewTextModel.getLineCount()+1,1));this.previewEditor.setHiddenAreas(w,void 0,!0)}),this.horizontalContentRangeInPreviewEditorToShow=m(this,(b)=>this._getHorizontalContentRangeInPreviewEditorToShow(this.previewEditor,b)),this.contentHeight=m(this,(b)=>{let S=this._state.read(b);if(!S)return Ne(null);return this._previewEditorObs.observeLineHeightsForLineRange(S.visibleLineRange).map((w)=>w.reduce((x,I)=>x+I,0))}).flatten(),this._editorDecorations=m(this,(b)=>{let S=this._state.read(b);if(!S)return;let w={diff:S.diff},x=[],I=[],E=ue.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),Z=ue.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),X=ue.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0});for(let J of w.diff)if(J.modified.isEmpty||J.original.isEmpty){if(!J.original.isEmpty)x.push({range:J.original.toInclusiveRange(),options:E});if(!J.modified.isEmpty)I.push({range:J.modified.toInclusiveRange(),options:Z})}else for(let Q of J.innerChanges||[]){if(J.original.contains(Q.originalRange.startLineNumber)&&!Q.originalRange.isEmpty())x.push({range:Q.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:Ql("inlineCompletions-char-delete",Q.originalRange.isEmpty()&&"empty"),zIndex:1}});if(J.modified.contains(Q.modifiedRange.startLineNumber))I.push({range:Q.modifiedRange,options:X})}return{originalDecorations:x,modifiedDecorations:I}}),this.previewEditor=this._register(this._createPreviewEditor()),this._parentEditorObs=ct(this._parentEditor),this._register(W((b)=>{let S=this._state.read(b)?.textModel||null;if(S)this.previewEditor.setModel(S.dangerouslyGetUnderlyingModel())})),this._previewEditorObs=ct(this.previewEditor),this._register(this._previewEditorObs.setDecorations(m((b)=>{let S=this._state.read(b),w=this._editorDecorations.read(b);return(S?.mode==="original"?w?.originalDecorations:w?.modifiedDecorations)??[]}))),this._register(W((b)=>{if(!this._properties.read(b))return;let S=this._parentEditorObs.cursorPosition.read(b);if(S)this.previewEditor.setPosition(this._previewTextModel.validatePosition(S),"longDistanceHintPreview")})),this._register(W((b)=>{let S=this._state.read(b);if(!S)return;let w=(S.visibleLineRange.endLineNumberExclusive-1).toString().length;this.previewEditor.updateOptions({lineNumbersMinChars:w+1})})),this._register(this._instantiationService.createInstance(tc,this._previewEditorObs,m((b)=>{let S=this._state.read(b);if(!S)return;let w=this._properties.read(b);if(!w)return;return new ru(w.inlineSuggestInfo,ne.ofLength(S.targetLineNumber,1),w.model,void 0)}),this._tabAction,Ne(0),Ne(!1),j(this,!1))),this.updatePreviewEditorEffect.recomputeInitiallyAndOnChange(this._store)}_createPreviewEditor(){return this._instantiationService.createInstance(Hi,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:{[dt.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._parentEditor)}_getHorizontalContentRangeInPreviewEditorToShow(n,h){let g=this._state.read(h);if(!g)return;let p=g.diff,f=this._properties.read(h)?.nextCursorPosition,b=g.visibleLineRange,S=this._previewEditorObs.layoutInfo.read(h),w=Eo(this._previewEditorObs,b,h),x;if(f)x=t.fromPositions(f);else if(p[0].innerChanges)x=g.mode==="modified"?p[0].innerChanges[0].modifiedRange:p[0].innerChanges[0].originalRange;else return;let I=VO(n.getModel(),x,5),E=this._previewEditorObs.getLeftOfPosition(I.getStartPosition(),h),Z=this._previewEditorObs.getLeftOfPosition(I.getEndPosition(),h),X=Ki(E,0,w),J=Ki(Z,X,w),Q=n.getModel().getLineFirstNonWhitespaceColumn(I.startLineNumber),te=this._previewEditorObs.getLeftOfPosition(new s(I.startLineNumber,Q),h),re=new z(X,J);return{indentationEnd:te,preferredRangeToReveal:re,maxEditorWidth:w+S.contentLeft,contentWidth:w,nonContentWidth:S.contentLeft}}layout(n,h){this.previewEditor.layout(n),this._previewEditorObs.editor.setScrollLeft(h)}};ef=HO([WO(4,O)],ef);function VO(u,n,h){let g=n.getStartPosition(),p=n.getEndPosition(),f=u.getLineContent(g.lineNumber);function b(I){let E=f.charAt(I-1);return/[a-zA-Z0-9_]/.test(E)}function S(I){let E=f.charAt(I-1);return E===" "||E==="\t"}let w=g.column;while(w>1&&b(w)&&!S(w-1)&&g.column-w<h)w--;let x=p.column-1;while(x<=f.length&&b(x)&&!S(x+1)&&x-p.column<h)x++;return new t(g.lineNumber,w,p.lineNumber,x+1)}function tD(u,n){let{start:h,endExclusive:g}=u,p=Number.MAX_VALUE,f=0;for(let b of n){let S=f+b.width,w=Math.max(h,f),x=Math.min(g,S);if(w<x)p=Math.min(p,b.height);f=S}if(g>f)return 0;return p===Number.MAX_VALUE?0:p}class tf{constructor(u,n,h){this._lineRangeInfo=u,this.availableSpaceSizes=u.sizes.map((g,p)=>{let f=u.lineRange.startLineNumber+p,b=h(f);return new oa(Math.max(0,n-g.width-b),g.height)}),this.availableSpaceHeightPrefixSums=zO(this.availableSpaceSizes,(g)=>g.height),this.availableSpaceSizesTransposed=this.availableSpaceSizes.map((g)=>g.transpose())}getWidgetVerticalOutline(u,n,h){let g=u-this._lineRangeInfo.lineRange.startLineNumber,p=this._lineRangeInfo.top+this.availableSpaceHeightPrefixSums[g],f=z.ofStartAndLength(p,n),{previewEditorMargin:b,widgetPadding:S,widgetBorder:w,lowerBarHeight:x}=h;return f.withMargin(b+S+w).withMargin(0,x)}tryFindWidgetOutline(u,n,h,g){if(this._lineRangeInfo.lineRange.length<3)return;return KO(this._lineRangeInfo.lineRange.addMargin(-1,-1),u,(p)=>{let f=this.getWidgetVerticalOutline(p,n,g),b=tD(f.delta(-this._lineRangeInfo.top),this.availableSpaceSizesTransposed);if(b<g.minWidgetWidth)return;return{horizontalWidgetRange:z.ofStartAndLength(h-b,b),verticalWidgetRange:f}})}}function iD(u,n,h,g,p){let f=[],b=u.startLineNumber,S=h,w=[];for(let x=0;x<n.length;x++){let I=u.startLineNumber+x,E=S+w.reduce((X,J)=>X+J.height,0),Z=g.editor.getTopForLineNumber(I);if(x>0&&Z!==E)f.push({lineRange:ne.ofLength(b,I-b),top:S,sizes:w}),b=I,S=Z,w=[];w.push(n[x])}return f.push({lineRange:ne.ofLength(b,u.endLineNumberExclusive-b),top:S,sizes:w}),m({owner:"splitIntoContinuousLineRanges"},(x)=>g.observeTopForLineNumber(u.endLineNumberExclusive-1).read(x)).read(p),f}function KO(u,n,h){for(let g=0;;g++){let p=n+g;if(p<=u.endLineNumberExclusive){let b=h(p);if(b!==void 0)return b}let f=n-g;if(f>=u.startLineNumber){let b=h(f);if(b!==void 0)return b}if(f<u.startLineNumber&&p>u.endLineNumberExclusive)return}}function zO(u,n){let h=[0],g=0;for(let p of u)g+=n(p),h.push(g);return h}var UO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},su=function(u,n){return function(h,g){n(h,g,u)}},$O=6,Bw={EMPTY_SPACE:425,OVERLAY:375},jO=250,GO={previewEditorMargin:2,widgetPadding:2,widgetBorder:1,lowerBarHeight:20,minWidgetWidth:jO},of=class u extends i{constructor(n,h,g,p,f,b,S,w,x){super();this._editor=n,this._viewState=h,this._previewTextModel=g,this._tabAction=p,this._instantiationService=f,this._themeService=b,this._keybindingService=S,this._modelService=w,this._languageService=x,this.onDidClick=R.None,this._viewWithElement=void 0,this._hintTextPosition=m(this,(I)=>{let E=this._viewState.read(I);return E?new s(E.hint.lineNumber,Number.MAX_SAFE_INTEGER):null}),this._lineSizesAroundHintPosition=m(this,(I)=>{let E=this._viewState.read(I),Z=this._hintTextPosition.read(I);if(!E||!Z)return[];let X=this._editorObs.model.read(I);if(!X)return[];let J=ne.ofLength(Z.lineNumber,1).addMargin(5,5).intersect(ne.ofLength(1,X.getLineCount()));if(!J)return[];let Q=k1(this._editorObs,J,I),te=this._editorObs.observeTopForLineNumber(J.startLineNumber).read(I);return iD(J,Q,te,this._editorObs,I)}),this._isVisibleDelayed=FI(m(this,(I)=>this._viewState.read(I)?.hint.isVisible),(I,E)=>I===!0&&E===!1?200:0),this._previewEditorLayoutInfo=m(this,(I)=>{let E=this._viewState.read(I);if(!E||!this._isVisibleDelayed.read(I))return;let Z=this._lineSizesAroundHintPosition.read(I);if(Z.length===0)return;let X=this._editorObs.scrollTop.read(I),J=this._editorObs.scrollLeft.read(I),Q=this._editorObs.layoutInfo.read(I),te=this._previewEditor.contentHeight.read(I),re=this._previewEditor.horizontalContentRangeInPreviewEditorToShow.read(I);if(!te||!re)return;let le=Q.contentWidth-Q.verticalScrollbarWidth,pe=Q.contentLeft+le;if(!this._editorObs.cursorLineNumber.read(I))return;let we=GO,me=te+2,De,Oe,Me=(Ro)=>Ro===E.hint.lineNumber?40:20;for(let Ro of Z){let Tn=new tf(Ro,le,Me);if(Oe=Tn,De=Tn.tryFindWidgetOutline(E.hint.lineNumber,me,pe,we),De)break}let Ce="empty-space";if(!De){Ce="overlay";let Ro=Math.min(Q.width-Q.contentLeft,Bw.OVERLAY),Tn=Oe??new tf(Z[0],le,Me);De={horizontalWidgetRange:z.ofStartAndLength(pe-Ro,Ro),verticalWidgetRange:Tn.getWidgetVerticalOutline(E.hint.lineNumber+2,me,we).delta(10)}}if(!De)return;let Pe=st.fromRanges(De.horizontalWidgetRange,De.verticalWidgetRange).translateX(-J).translateY(-X),{previewEditorMargin:tt,widgetPadding:ze,widgetBorder:rt,lowerBarHeight:qe}=we,Ft=Ce==="overlay"?Bw.OVERLAY:Bw.EMPTY_SPACE,it=re.maxEditorWidth+tt+ze,ft=Math.min(Ft,Math.max(it,we.minWidgetWidth)),Bt=eD(Pe.width,{spaceBefore:{min:0,max:10,priority:1},content:{min:50,rules:[{max:150,priority:2},{max:ft,priority:1}]},spaceAfter:{min:10}});if(!Bt)return null;let yt=qO([Bt.spaceBefore,Bt.content,Bt.spaceAfter],Pe.left);Pe.withHorizontalRange(yt[0]);let St=Pe.withHorizontalRange(yt[1]);Pe.withHorizontalRange(yt[2]);let Vt=St.withMargin(-ze-rt-tt).withMargin(0,0,-qe,0),Wt=Vt.width-re.nonContentWidth,Rt=Wt*0.8,fi=re.preferredRangeToReveal.intersect(z.ofStartAndLength(re.preferredRangeToReveal.start,Rt))??re.preferredRangeToReveal,ls=ZO(re.indentationEnd,Wt,fi);return{codeEditorSize:Vt.getSize(),codeScrollLeft:J,contentLeft:Q.contentLeft,widgetRect:St,previewEditorMargin:tt,widgetPadding:ze,widgetBorder:rt,lowerBarHeight:qe,desiredPreviewEditorScrollLeft:ls.newScrollPosition}}),this._view=he.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:m(this,(I)=>this._previewEditorLayoutInfo.read(I)?"block":"none")}},[m(this,(I)=>[this._widgetContent])]),this._widgetContent=m(this,(I)=>he.div({class:["inline-edits-long-distance-hint-widget","show-file-icons"],style:{position:"absolute",overflow:"hidden",cursor:"pointer",background:M(Vr),padding:this._previewEditorLayoutInfo.map((E)=>E?.widgetPadding),boxSizing:"border-box",borderRadius:$O,border:m((E)=>`${this._previewEditorLayoutInfo.read(E)?.widgetBorder}px solid ${this._styles.read(E).border}`),display:"flex",flexDirection:"column",opacity:m((E)=>this._viewState.read(E)?.hint.isVisible?"1":"0"),transition:"opacity 200ms ease-in-out",...Gt((E)=>this._previewEditorLayoutInfo.read(E)?.widgetRect)},onmousedown:(E)=>{E.preventDefault()},onclick:()=>{this._viewState.read(void 0)?.model.jump()}},[he.div({class:["editorContainer"],style:{overflow:"hidden",padding:this._previewEditorLayoutInfo.map((E)=>E?.previewEditorMargin),background:this._styles.map((E)=>E.background),pointerEvents:"none"}},[m(this,(E)=>this._previewEditor.element)]),he.div({class:"bar",style:{color:M(a0),pointerEvents:"none",margin:"0 4px",height:this._previewEditorLayoutInfo.map((E)=>E?.lowerBarHeight),display:"flex",justifyContent:"space-between",alignItems:"center"}},[m(this,(E)=>{let Z=[],X=this._viewState.read(E);if(!X)return Z;let J=this._editorObs.model.read(E),Q=X.target.uri,te=!J||!X.target.targets(J);if(te){let we=Pi(Q),ae=Ld(this._modelService,this._languageService,Q,So.FILE);Z.push(he.div({class:"target-file",style:{display:"flex",alignItems:"center",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},[he.elem("span",{class:ae,style:{flexShrink:"0",marginRight:"4px"}}),we]))}else{let we=this._originalOutlineSource.read(E),ae=this._originalTargetLineNumber.read(E),me=we?.getAt(ae,E).slice(0,1)??[],De=[];if(me.length>0)for(let Oe=0;Oe<me.length;Oe++){let Me=me[Oe],Ce=Gh.toIcon(Me.kind);De.push(he.div({class:"breadcrumb-item",style:{display:"flex",alignItems:"center",flex:"1 1 auto",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},[Cr(Ce)," ",Me.name,...Oe===me.length-1?[]:[Cr(C.chevronRight)]]))}Z.push(he.div({class:"outline-elements",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},De))}let re=this._originalTargetLineNumber.read(E),le=te?C.arrowRight:X.hint.lineNumber<re?C.arrowDown:C.arrowUp,pe=this._keybindingService.lookupKeybinding(dl),Se=te?"Go to file":"Go to suggestion";if(pe&&pe.getLabel()==="Tab")Se=te?"Tab to open":"Tab to jump";return Z.push(he.div({class:"go-to-label",style:{position:"relative",display:"flex",alignItems:"center",flex:"0 0 auto",paddingLeft:"6px"}},[Se," ",Cr(le)])),Z})])])),this._originalTargetLineNumber=m(this,(I)=>{let E=this._viewState.read(I);if(!E)return-1;if(E.edit.action?.kind==="jumpTo")return E.edit.action.position.lineNumber;return E.diff[0]?.original.startLineNumber??-1}),this._originalOutlineSource=po(this,(I)=>{let E=this._editorObs.model.read(I),Z=hp._breadcrumbsSourceFactory.read(I);return!E||!Z?void 0:Z(E,this._instantiationService)}),this._styles=m((I)=>{let E=this._tabAction.read(I),Z=sa(Vf,this._themeService).read(I),X=je(this._themeService.onDidColorThemeChange,()=>{let Q=this._themeService.getColorTheme();return Q.type==="hcDark"||Q.type==="hcLight"}).read(I),J;if(X)J=Z;else{let Q;switch(E){case Nt.Inactive:Q=Zl;break;case Nt.Jump:Q=dr;break;case Nt.Accept:Q=Xl;break}J=Ut(Q,this._themeService).read(I)}return{border:J.toString(),background:io(this._viewState.map((Q)=>Q?.editorType??Ot.TextEditor).read(I))}}),this._editorObs=ct(this._editor),this._previewEditor=this._register(this._instantiationService.createInstance(ef,this._previewTextModel,m((I)=>{let E=this._viewState.read(I);if(!E)return;return{diff:E.diff,model:E.model,inlineSuggestInfo:E.inlineSuggestInfo,nextCursorPosition:E.nextCursorPosition,target:E.target}}),this._editor,this._tabAction)),this._viewWithElement=this._view.keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._viewWithElement.element,position:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:Ne(0)})),this._widgetContent.get().keepUpdated(this._store),this._register(W((I)=>{let E=this._previewEditorLayoutInfo.read(I);if(!E)return;this._previewEditor.layout(E.codeEditorSize.toDimension(),E.desiredPreviewEditorScrollLeft)})),this._isVisibleDelayed.recomputeInitiallyAndOnChange(this._store)}get isHovered(){return this._widgetContent.get().didMouseMoveDuringHover}};of=UO([su(4,O),su(5,We),su(6,ge),su(7,Et),su(8,xt)],of);function qO(u,n=0){let h=[],g=n;for(let p of u)h.push(new z(g,g+p)),g+=p;return h}function ZO(u,n,h){let g=new z(u,u+n);if(g.containsRange(h))return{newScrollPosition:u};if(h.length>n)return{newScrollPosition:h.start};if(h.endExclusive>g.endExclusive)return{newScrollPosition:h.endExclusive-n};if(h.start<g.start)return{newScrollPosition:h.start};return{newScrollPosition:u}}var XO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Vw=function(u,n){return function(h,g){n(h,g,u)}},sc=0,au=0,xn=1,YO=1,JO=3,ds=jt,Kw=20,oD=12,lu=class u extends i{static fitsInsideViewport(n,h,g,p){let f=ct(n),b=f.layoutInfoWidth.read(p),S=f.layoutInfoContentLeft.read(p),w=n.getLayoutInfo().verticalScrollbarWidth,x=f.layoutInfoMinimap.read(p).minimapLeft!==0?f.layoutInfoMinimap.read(p).minimapWidth:0,I=Eo(f,g.displayRange,void 0),E=g.lineEdit.newLines.reduce((J,Q)=>Math.max(J,ou(Q,n,h)),0),Z=Kw,X=oD+2*xn;return I+E+Z+X<b-S-w-x}constructor(n,h,g,p,f,b,S,w){super();this._editor=n,this._edit=h,this._previewTextModel=g,this._uiState=p,this._tabAction=f,this._instantiationService=b,this._themeService=S,this._userInteractionService=w,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._editorObs=ct(this._editor),this._display=m(this,(E)=>this._uiState.read(E)?"block":"none"),this.previewRef=he.ref();let x=this._uiState.map((E)=>E?.editorType===Ot.DiffEditor?JO:YO);this._editorContainer=he.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:(E)=>{E.preventDefault()},onclick:(E)=>{this._onDidClick.fire(_o.create(E))}},[he.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(Hi,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:{[dt.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=ct(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=m(this,(E)=>{if(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 Z=this._uiState.read(E),X=this._edit.read(E);if(!Z||!X)return;let J=X.originalLineRange,Q=[];if(J.startLineNumber>1)Q.push(new t(1,1,J.startLineNumber-1,1));if(J.startLineNumber+Z.newTextLineCount<this._previewTextModel.getLineCount()+1)Q.push(new t(J.startLineNumber+Z.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1));this.previewEditor.setHiddenAreas(Q,void 0,!0);let te=[...this._activeViewZones];this._activeViewZones=[];let re=J.endLineNumberExclusive-J.startLineNumber-Z.newTextLineCount;this.previewEditor.changeViewZones((le)=>{if(te.forEach((pe)=>le.removeZone(pe)),re>0)this._activeViewZones.push(le.addZone({afterLineNumber:J.startLineNumber+Z.newTextLineCount-1,heightInLines:re,showInHiddenAreas:!0,domNode:_("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=m(this,(E)=>{let Z=this._edit.read(E);if(!Z)return 0;return this._updatePreviewEditor.read(E),Eo(this._previewEditorObs,Z.modifiedLineRange,E)}),this._cursorPosIfTouchesEdit=m(this,(E)=>{let Z=this._editorObs.cursorPosition.read(E),X=this._edit.read(E);if(!X||!Z)return;return X.modifiedLineRange.contains(Z.lineNumber)?Z:void 0}),this._originalStartPosition=m(this,(E)=>{let Z=this._edit.read(E);return Z?new s(Z.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=m(this,(E)=>{let Z=this._edit.read(E);return Z?new s(Z.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=m(this,(E)=>{let Z=this._originalDisplayRange.read(E);if(!Z)return Ne(0);return this._editorObs.versionId.read(E),fo(this,(X,J)=>{let Q=Eo(this._editorObs,Z,X);return Math.max(Q,J??0)})}).map((E,Z)=>E.read(Z));let I=M1(this._editor,this._store);this._previewEditorLayoutInfo=m(this,(E)=>{let Z=this._edit.read(E);if(!Z)return null;if(!this._uiState.read(E))return null;let J=Z.originalLineRange,Q=this._editorObs.scrollLeft.read(E),te=this._editorMaxContentWidthInRange.read(E),re=this._editorObs.layoutInfo.read(E),le=this._previewEditorWidth.read(E),pe=re.contentWidth-re.verticalScrollbarWidth,Se=I.read(E),we=re.contentLeft+re.contentWidth+Se.left,ae=B(this._editor.getContainerDomNode()).innerWidth-we,me=B(this._editor.getContainerDomNode()).innerWidth-Se.right,De=Math.min(re.contentWidth*0.3,le,100),Oe=0,Me=Oe+ae,Ce=this._cursorPosIfTouchesEdit.read(E),Pe=Math.max(pe+Q-Oe-Math.max(0,De-Me),Math.min(Ce?T1(this._editorObs,Ce,E)+50:0,pe+Q)),tt=Math.min(te+Kw,Pe),ze=te+Kw+le+70,rt=Pe-tt,qe,Ft;if(tt>Q)qe=0,Ft=re.contentLeft+tt-Q;else qe=Q-tt,Ft=re.contentLeft;let it=this._originalVerticalStartPosition.read(E)??this._editor.getTopForLineNumber(J.startLineNumber)-this._editorObs.scrollTop.read(E),ft=this._originalVerticalEndPosition.read(E)??this._editor.getBottomForLineNumber(J.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(E),Bt=re.contentLeft-Q,yt=st.fromLeftTopRightBottom(Bt,it,Ft,ft),St=yt.height===0;if(!St)yt=yt.withMargin(au,sc);let Wt=this._previewEditorObs.observeLineHeightsForLineRange(Z.modifiedLineRange).read(E).reduce((_f,xD)=>_f+xD,0),Rt=ft-it,fi=Math.max(Rt,Wt),ls=rt===0,Ro=0,Tn=Math.min(le+oD,me+re.width-re.contentLeft-Ro),va=st.fromLeftTopWidthHeight(yt.right+Ro,it,Tn,fi);if(!St)va=va.withMargin(au,sc).translateX(sc+xn);else va=va.withMargin(au,sc).translateY(au);return{codeRect:yt,editRect:va,codeScrollLeft:Q,contentLeft:re.contentLeft,isInsertion:St,maxContentWidth:ze,shouldShowShadow:ls,desiredPreviewEditorScrollLeft:qe,previewEditorWidth:Tn}}),this._stickyScrollController=As.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?je(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Ne(0),this._shouldOverflow=m(this,(E)=>!1),this._originalBackgroundColor=je(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(aa)??v.transparent),this._editorBackgroundColor=this._uiState.map((E)=>io(E?.editorType??Ot.TextEditor)),this._backgroundSvg=he.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[he.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:m(this,(E)=>{let Z=this._previewEditorLayoutInfo.read(E);if(!Z)return;if(this._originalBackgroundColor.read(E).isTransparent())return;return new ec().moveTo(Z.codeRect.getRightTop()).lineTo(Z.codeRect.getRightTop().deltaX(1000)).lineTo(Z.codeRect.getRightBottom().deltaX(1000)).lineTo(Z.codeRect.getRightBottom()).build()}),style:{fill:this._editorBackgroundColor}})]).keepUpdated(this._store),this._originalOverlay=he.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map((E)=>E?.isInsertion?"none":"block")}},m(this,(E)=>{let Z=ji(this._previewEditorLayoutInfo).read(E);if(!Z)return;let X=this._editorBackgroundColor.read(E),J=x.read(E),Q=la(this._tabAction).map((Oe)=>`${xn}px solid ${M(Oe)}`),te=`${xn+J}px solid ${X}`,re=Z.read(E).codeScrollLeft!==0,le=Z.map((Oe)=>Oe.codeRect.bottom<Oe.editRect.bottom),pe=ds*2+xn*2,Se=Z.map((Oe)=>st.fromLeftTopRightBottom(Oe.contentLeft-ds-xn,Oe.codeRect.top,Oe.contentLeft,Oe.codeRect.bottom+pe)).read(E),we=new z(Se.left,Number.MAX_SAFE_INTEGER),ae=Z.map((Oe)=>Oe.codeRect.intersectHorizontal(we)),me=ae.map((Oe)=>Oe.withMargin(J,0,J,J).intersectHorizontal(we)),De=ae.map((Oe)=>st.fromLeftTopWidthHeight(Oe.right-pe+xn,Oe.bottom-xn,pe,pe).intersectHorizontal(we));return[he.div({class:"originalSeparatorSideBySide",style:{...me.read(E).toStyles(),boxSizing:"border-box",borderRadius:`${ds}px 0 0 ${ds}px`,borderTop:te,borderBottom:te,borderLeft:re?"none":te}}),he.div({class:"originalOverlaySideBySide",style:{...ae.read(E).toStyles(),boxSizing:"border-box",borderRadius:`${ds}px 0 0 ${ds}px`,borderTop:Q,borderBottom:Q,borderLeft:re?"none":Q,backgroundColor:M(aa)}}),he.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:le.map((Oe)=>Oe?"block":"none"),...De.read(E).toStyles()}},[he.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:Ut(aa,this._themeService).map((Oe)=>Oe.toString())}}),he.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:Q,borderRight:Q,borderRadius:"0 100% 0 0",backgroundColor:X}})]),he.div({class:"originalOverlaySideBySideHider",style:{...Se.toStyles(),backgroundColor:X}})]})).keepUpdated(this._store),this._modifiedOverlay=he.div({style:{pointerEvents:"none"}},m(this,(E)=>{let Z=ji(this._previewEditorLayoutInfo).read(E);if(!Z)return;let X=Z.map((ae)=>ae.codeRect.bottom<ae.editRect.bottom),J=this._editorBackgroundColor.read(E),Q=x.read(E),te=X.map((ae)=>`0 ${ds}px ${ds}px ${ae?ds:0}px`),re=Ut(ss(this._tabAction),this._themeService).map((ae)=>`1px solid ${ae.toString()}`),le=`${xn+Q}px solid ${J}`,pe=Z.map((ae)=>ae.editRect.withMargin(0,xn)),Se=pe.map((ae)=>ae.withMargin(Q,Q,Q,0)),we=m(this,(ae)=>{let me=pe.read(ae),De=Z.read(ae);if(!De.isInsertion||De.contentLeft>=me.left)return st.fromLeftTopWidthHeight(me.left,me.top,0,0);return new st(De.contentLeft,me.top,me.left,me.top+xn*2)});return[he.div({class:"modifiedInsertionSideBySide",style:{...we.read(E).toStyles(),backgroundColor:ss(this._tabAction).map((ae)=>M(ae))}}),he.div({class:"modifiedSeparatorSideBySide",style:{...Se.read(E).toStyles(),borderRadius:te,borderTop:le,borderBottom:le,borderRight:le,boxSizing:"border-box"}}),he.div({class:"modifiedOverlaySideBySide",style:{...pe.read(E).toStyles(),borderRadius:te,border:re,boxSizing:"border-box",backgroundColor:M(Um)}})]})).keepUpdated(this._store),this._nonOverflowView=he.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,m(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:Ne(null),allowEditorOverflow:!1,minContentWidthInPx:m(this,(E)=>{let Z=this._previewEditorLayoutInfo.read(E)?.maxContentWidth;if(Z===void 0)return 0;return Z})})),this.previewEditor.setModel(this._previewTextModel),this._register(W((E)=>{let Z=this._previewEditorLayoutInfo.read(E);if(!Z)return;let X=Z.editRect.withMargin(-au,-sc);this.previewEditor.layout({height:X.height,width:Z.previewEditorWidth+15}),this._editorContainer.element.style.top=`${X.top}px`,this._editorContainer.element.style.left=`${X.left}px`,this._editorContainer.element.style.width=`${Z.previewEditorWidth+sc}px`})),this._register(W((E)=>{let Z=this._previewEditorLayoutInfo.read(E);if(!Z)return;this._previewEditorObs.editor.setScrollLeft(Z.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}};lu=XO([Vw(5,O),Vw(6,We),Vw(7,Fo)],lu);var QO=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Cu=function(u,n){return function(h,g){n(h,g,u)}};class Uw{constructor(u,n,h){this.edit=u,this.editorType=n,this.alternativeAction=h}equals(u){return this.edit.equals(u.edit)&&this.alternativeAction===u.alternativeAction}}var Vi=1,nD="word-replacement-view-overlay",rD="word-replacement-view-widget",sD="word-replacement-view-replacement",zw="word-replacement-view-rename",Rd=class u extends i{static{this.MAX_LENGTH=100}constructor(n,h,g,p,f,b,S,w){super();this._editor=n,this._viewData=h,this._tabAction=g,this._languageService=p,this._themeService=f,this._keybindingService=b,this._hoverService=S,this._userInteractionService=w,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this._start=this._editor.observePosition(Ne(this._viewData.edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(Ne(this._viewData.edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._primaryElement=j(this,null),this._secondaryElement=j(this,null),this.isHovered=m(this,(Z)=>{let X=this._primaryElement.read(Z);if(!X)return!1;return this._userInteractionService.createHoverTracker(X.element,Z.store).read(Z)}),this._renderTextEffect=m(this,(Z)=>{let X=this._editor.model.read(void 0);if(!X)return;let J=X.getLineContent(this._viewData.edit.range.startLineNumber),Q=ui.replace(new z(this._viewData.edit.range.startColumn-1,this._viewData.edit.range.endColumn-1),this._viewData.edit.text),te=Q.replace(J),re=X.tokenization.tokenizeLinesAt(this._viewData.edit.range.startLineNumber,[te])?.[0],le;if(re)le=Al.fromLineTokens(re).slice(Q.getRangeAfterReplace()).toLineTokens(this._viewData.edit.text,this._languageService.languageIdCodec);else le=Tt.createEmpty(this._viewData.edit.text,this._languageService.languageIdCodec);let pe=$u(new Td([le]),Qa.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${pe.minWidthInPx}px`});let x=this._editor.observeLineHeightForPosition(this._viewData.edit.range.getStartPosition()),I=MI(this._viewData.alternativeAction?.count??new Promise((Z)=>Z(void 0))).map((Z)=>Z.value),E=m(this,(Z)=>this._userInteractionService.readModifierKeyStatus(this._editor.editor.getDomNode(),Z).shiftKey);this._layout=m(this,(Z)=>{this._renderTextEffect.read(Z);let X=this._start.read(Z),J=this._end.read(Z);if(!X||!J||X.x>J.x||X.y>J.y)return;let Q=x.read(Z);if(Q<=0)return;let te=this._editor.scrollLeft.read(Z),re=this._editor.getOption(59).read(Z).typicalHalfwidthCharacterWidth,le=3*re,Se=new _i(le,4),we=void 0;if(this._viewData.alternativeAction){let Me=this._viewData.alternativeAction.label,Ce=I.read(Z),Pe=E.read(Z),tt=Ce!==void 0?Ce===1?e(1283,"{0} 1 occurrence",Me):e(1284,"{0} {1} occurrences",Me,Ce):Me,ze=e(1285,"{0} show occurrences","[shift]");we={label:Ce!==void 0?Pe?tt:Me:Me,tooltip:tt?`${tt}
|
|
48
|
+
${ze}`:void 0,icon:void 0,count:Ce,keybinding:this._keybindingService.lookupKeybinding(Ya),active:E}}let ae=st.fromPoints(X,J).withHeight(Q).translateX(-te),me=st.fromPointSize(ae.getLeftBottom().add(Se),new _i(this._viewData.edit.text.length*re,ae.height)),De=me.withWidth(me.width+(we?we.label.length*re+8+4+12:0)),Oe=De.withLeft(ae.left);return{alternativeAction:we,originalLine:ae,codeLine:me,modifiedLine:De,lowerBackground:Oe,lineHeight:Q}}),this.minEditorScrollHeight=m(this,(Z)=>{let X=ji(this._layout).read(Z);if(!X)return 0;return X.read(Z).modifiedLine.bottom+Vi+this._editor.editor.getScrollTop()}),this._root=he.div({class:"word-replacement"},[m(this,(Z)=>{let X=ji(this._layout).read(Z);if(!X)return[];let J=la(this._tabAction).map((Ce)=>M(Ce)).read(Z),Q=ss(this._tabAction).map((Ce)=>M(Ce)).read(Z);this._line.style.lineHeight=`${X.read(Z).modifiedLine.height+2*Vi}px`;let te=Ne(!1),re=X.map((Ce)=>Ce.alternativeAction),le=m((Ce)=>(re.read(Ce)?.active.read(Ce)??!1)||te.read(Ce)),Se=je(this._themeService.onDidColorThemeChange,()=>{let Ce=this._themeService.getColorTheme();return Ce.type==="hcDark"||Ce.type==="hcLight"}).read(Z)?sa(Be,this._themeService).read(Z):null,we={borderColor:Se?Se.toString():Q,backgroundColor:M(I1),color:"",opacity:"1"},ae={borderColor:Se?Se.toString():M(qo),backgroundColor:M(dr),color:M(da),opacity:"1"},me={borderColor:Se?Se.toString():sa(Iv,this._themeService).map((Ce)=>Ce.transparent(0.2).toString()).read(Z),backgroundColor:io(this._viewData.editorType),color:"",opacity:"0.7"},De=io(this._viewData.editorType),Oe=m(this,(Ce)=>le.read(Ce)?we:we),Me=m(this,(Ce)=>le.read(Ce)?ae:me);return[he.div({id:nD,style:{position:"absolute",...Gt((Ce)=>Jl(this._editor).read(Ce)),overflow:"hidden",pointerEvents:"none"}},[he.div({style:{position:"absolute",...Gt((Ce)=>X.read(Ce).lowerBackground.withMargin(Vi,2*Vi,Vi,0)),background:De,cursor:"pointer",pointerEvents:"auto"},onmousedown:(Ce)=>this._mouseDown(Ce)}),he.div({id:rD,style:{position:"absolute",...Gt((Ce)=>X.read(Ce).modifiedLine.withMargin(Vi,2*Vi)),width:void 0,pointerEvents:"auto",boxSizing:"border-box",borderRadius:`${jt}px`,background:De,display:"flex",justifyContent:"left",outline:`2px solid ${De}`},onmousedown:(Ce)=>this._mouseDown(Ce)},[he.div({id:sD,style:{fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),width:Gt((Ce)=>X.read(Ce).codeLine.withMargin(Vi,2*Vi)).width,borderRadius:`${jt}px`,border:Oe.map((Ce)=>`${Vi}px solid ${Ce.borderColor}`),boxSizing:"border-box",padding:`${Vi}px`,opacity:Oe.map((Ce)=>Ce.opacity),background:Oe.map((Ce)=>Ce.backgroundColor),display:"flex",justifyContent:"left",alignItems:"center",pointerEvents:"auto",cursor:"pointer"},obsRef:(Ce)=>{this._primaryElement.set(Ce,void 0)}},[this._line]),m(this,(Ce)=>{let Pe=re.read(Ce);if(!Pe)return;let tt=document.createElement("div");return Ce.store.add(new Xa(tt,Oi,{...Xk,disableTitle:!0})).set(Pe.keybinding),he.div({id:zw,style:{position:"relative",borderRadius:`${jt}px`,borderTop:`${Vi}px solid`,borderRight:`${Vi}px solid`,borderBottom:`${Vi}px solid`,borderLeft:`${Vi}px solid`,borderColor:Me.map((rt)=>rt.borderColor),opacity:Me.map((rt)=>rt.opacity),color:Me.map((rt)=>rt.color),display:"flex",justifyContent:"center",alignItems:"center",padding:"0 4px 0 1px",marginLeft:"4px",background:Me.map((rt)=>rt.backgroundColor),cursor:"pointer",textWrap:"nowrap"},class:"inline-edit-alternative-action-label",obsRef:(rt)=>{this._secondaryElement.set(rt,void 0)},ref:(rt)=>{if(Pe.tooltip)Ce.store.add(this._hoverService.setupDelayedHoverAtMouse(rt,{content:Pe.tooltip,appearance:{compact:!0}}))}},[tt,_("div.inline-edit-alternative-action-label-separator"),Pe.icon?Cr(Pe.icon):void 0,Pe.label])})]),he.div({style:{position:"absolute",...Gt((Ce)=>X.read(Ce).originalLine.withMargin(Vi)),boxSizing:"border-box",borderRadius:`${jt}px`,border:`${Vi}px solid ${J}`,background:M(y1),pointerEvents:"none"}},[]),he.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:X.map((Ce)=>Ce.modifiedLine.left-16),top:X.map((Ce)=>Ce.modifiedLine.top+Math.round((Ce.lineHeight-14-5)/2)),pointerEvents:"none"},onmousedown:(Ce)=>this._mouseDown(Ce)},[he.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:M(Iv)}),he.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:M(Iv)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:Ne(0),position:Ne({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_mouseDown(n){let h=eM(n.target,new Set([rD,sD,zw,nD]));if(!h)return;n.preventDefault(),this._onDidClick.fire(_o.create(n,h===zw))}};Rd=QO([Cu(3,xt),Cu(4,We),Cu(5,ge),Cu(6,An),Cu(7,Fo)],Rd);function eM(u,n){let h=u;while(h){if(n.has(h.id))return h.id;h=h.parentElement}return null}class $w extends i{constructor(u,n,h){super();this._originalEditor=u,this._state=n,this._modifiedTextModel=h,this._onDidClick=this._register(new r),this.onDidClick=this._onDidClick.event,this.isHovered=ct(this._originalEditor).isTargetHovered((p)=>p.target.type===6&&p.target.detail.injectedText?.options.attachedData instanceof nf&&p.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=oM(this._modifiedTextModel),this._decorations=m(this,(p)=>{let f=this._state.read(p);if(!f)return;let b=f.modifiedText,S=f.mode==="insertionInline",w=f.diff.length===1&&f.diff[0].innerChanges?.length===1,x=!0,I=[],E=[],Z=ue.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),X=ue.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),J=ue.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),Q=ue.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),te=ue.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),re=ue.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),le=ue.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),pe=f.mode!=="sideBySide"&&f.mode!=="deletion"&&f.mode!=="insertionInline"&&f.mode!=="lineReplacement",Se=f.mode==="lineReplacement";for(let we of f.diff){if(pe){if(!we.original.isEmpty)I.push({range:we.original.toInclusiveRange(),options:X});if(!we.modified.isEmpty)E.push({range:we.modified.toInclusiveRange(),options:Z})}if(we.modified.isEmpty||we.original.isEmpty){if(!we.original.isEmpty)I.push({range:we.original.toInclusiveRange(),options:J});if(!we.modified.isEmpty)E.push({range:we.modified.toInclusiveRange(),options:Q})}else{let ae=S&&tM(we);for(let me of we.innerChanges||[]){if(we.original.contains(me.originalRange.startLineNumber)&&!(Se&&me.originalRange.isEmpty())){let De=this._originalEditor.getModel()?.getValueInRange(me.originalRange,1);I.push({range:me.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:Ql("inlineCompletions-char-delete",me.originalRange.isSingleLine()&&f.mode==="insertionInline"&&"single-line-inline",me.originalRange.isEmpty()&&"empty",(me.originalRange.isEmpty()&&w||f.mode==="deletion"&&De===`
|
|
49
|
+
`)&&x&&!ae&&"diff-range-empty"),inlineClassName:ae?Ql("strike-through","inlineCompletions"):null,zIndex:1}})}if(we.modified.contains(me.modifiedRange.startLineNumber))E.push({range:me.modifiedRange,options:me.modifiedRange.isEmpty()&&x&&!ae&&w?re:te});if(ae){let De=b.getValueOfRange(me.modifiedRange),Oe=De.length>3?[{text:De.slice(0,1),extraClasses:["start"],offsetRange:new z(me.modifiedRange.startColumn-1,me.modifiedRange.startColumn)},{text:De.slice(1,-1),extraClasses:[],offsetRange:new z(me.modifiedRange.startColumn,me.modifiedRange.endColumn-2)},{text:De.slice(-1),extraClasses:["end"],offsetRange:new z(me.modifiedRange.endColumn-2,me.modifiedRange.endColumn-1)}]:[{text:De,extraClasses:["start","end"],offsetRange:new z(me.modifiedRange.startColumn-1,me.modifiedRange.endColumn)}];this._tokenizationFinished.read(p);let Me=this._modifiedTextModel.tokenization.getLineTokens(me.modifiedRange.startLineNumber);for(let{text:Ce,extraClasses:Pe,offsetRange:tt}of Oe)I.push({range:t.fromPositions(me.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:Me.getTokensInRange(tt),content:Ce,inlineClassName:Ql("inlineCompletions-char-insert",me.modifiedRange.isSingleLine()&&f.mode==="insertionInline"&&"single-line-inline",...Pe),cursorStops:xs.None,attachedData:new nf(this)},zIndex:2,showIfCollapsed:!0}})}}}}if(f.editorType===Ot.DiffEditor){for(let we of f.diff)if(!we.original.isEmpty)I.push({range:we.original.toExclusiveRange(),options:le})}return{originalDecorations:I,modifiedDecorations:E}}),this._register(ct(this._originalEditor).setDecorations(this._decorations.map((p)=>p?.originalDecorations??[])));let g=this._state.map((p)=>p?.modifiedCodeEditor);this._register(oi((p,f)=>{let b=g.read(p);if(b)f.add(ct(b).setDecorations(this._decorations.map((S)=>S?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp((p)=>{if(p.target.type!==6)return;let f=p.target.detail.injectedText?.options.attachedData;if(f instanceof nf&&f.owner===this)this._onDidClick.fire(new _o(p.event))}))}}class nf{constructor(u){this.owner=u}}function tM(u){if(!u.innerChanges)return!1;return u.innerChanges.every((n)=>M0(n.modifiedRange)&&M0(n.originalRange))}var iM=0;function oM(u){return je(u.onDidChangeTokens,()=>iM++)}var nM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},rM=function(u,n){return function(h,g){n(h,g,u)}},rf=class u extends i{constructor(n,h,g,p,f,b){super();this._editor=n,this._model=h,this._simpleModel=g,this._inlineSuggestInfo=p,this._showCollapsed=f,this._instantiationService=b,this._tabAction=m((I)=>this._model.read(I)?.tabAction.read(I)??Nt.Inactive),this.displayRange=m(this,(I)=>{let E=this._uiState.read(I);if(!E)return;if(E.target.uri.toString()!==this._editorObs.model.read(I)?.uri.toString())return;if(E.state?.kind==="custom"){let Z=E.state.displayLocation?.range;if(!Z)throw new H("custom view should have a range");return new ne(Z.startLineNumber,Z.endLineNumber)}if(E.state?.kind==="insertionMultiLine")return this._insertion.originalLines.read(I);return E.edit.displayRange}),this._currentInlineEditCache=void 0,this._uiState=m(this,(I)=>{let E=this._model.read(I),Z=this._editorObs.model.read(I);if(!E||!Z||!this._constructorDone.read(I))return;let X=E.inlineEdit,J,Q,te=void 0;if(X.edit)Q=Zi.fromEdit(X.edit),te=new Ol(X.edit.apply(X.originalText)),J=Hf(Q,X.originalText,te);else Q=[],J=[],te=X.originalText;let re=this._determineRenderState(E,I,J,te);if(!re){ee(Error(`unable to determine view: tried to render ${this._previousView?.view}`));return}let le=this._getLongDistanceHintState(E,I);if(le&&le.isVisible)re.viewData.setLongDistanceViewData(le.lineNumber,X.lineEdit.lineRange.startLineNumber);if(re.viewData.isForAnotherDocument=!X.originalText.targets(Z),re.kind===Xe.SideBySide){let we=O1(te.getValue(),X.modifiedLineRange,Z.getOptions().tabSize);te=new Ol(we.applyToString(te.getValue())),Q=N1(Q,we),J=Hf(Q,X.originalText,te)}this._previewTextModel.setLanguage(Z.getLanguageId());let pe=this._previewTextModel.getValue();if(pe!==te.getValue()){this._previewTextModel.setEOL(Z.getEndOfLineSequence());let ae=Sr.replace(new z(0,pe.length),te.getValue()).removeCommonSuffixPrefix(pe),me=dd(this._previewTextModel).getTextEdit(ae);this._previewTextModel.edit(me)}if(this._showCollapsed.read(I))re={kind:Xe.Collapsed,viewData:re.viewData};E.handleInlineEditShownNextFrame(re.kind,re.viewData);let Se=X.action?.kind==="jumpTo"?X.action.position:null;return{state:re,diff:J,edit:X,newText:te.getValue(),newTextLineCount:X.modifiedLineRange.length,editorType:E.editorType,longDistanceHint:le,nextCursorPosition:Se,target:X.inlineCompletion.originalTextRef}}),this.inlineEditsIsHovered=m(this,(I)=>this._sideBySide.isHovered.read(I)||this._wordReplacementViews.read(I).some((E)=>E.isHovered.read(I))||this._deletion.isHovered.read(I)||this._inlineDiffView.isHovered.read(I)||this._lineReplacementView.isHovered.read(I)||this._insertion.isHovered.read(I)||this._customView.isHovered.read(I)||this._longDistanceHint.map((E,Z)=>E?.isHovered.read(Z)??!1).read(I)),this.gutterIndicatorOffset=m(this,(I)=>{if(this._uiState.read(I)?.state?.kind==="insertionMultiLine")return this._insertion.startLineOffset.read(I);return 0}),this._editorObs=ct(this._editor),this._constructorDone=j(this,!1),this._previewTextModel=this._register(this._instantiationService.createInstance(_u,"",this._editor.getModel().getLanguageId(),{..._u.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._sideBySide=this._register(this._instantiationService.createInstance(lu,this._editor,this._model.map((I)=>I?.inlineEdit),this._previewTextModel,this._uiState.map((I)=>I&&I.state?.kind===Xe.SideBySide?{newTextLineCount:I.newTextLineCount,editorType:I.editorType}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(Fw,this._editor,this._model.map((I)=>I?.inlineEdit),this._uiState.map((I)=>I&&I.state?.kind===Xe.Deletion?{originalRange:I.state.originalRange,deletions:I.state.deletions,editorType:I.editorType}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(Ym,this._editor,this._uiState.map((I)=>I&&I.state?.kind===Xe.InsertionMultiLine?{lineNumber:I.state.lineNumber,startColumn:I.state.column,text:I.state.text,editorType:I.editorType}:void 0),this._tabAction)),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(Gm,this._editor,this._model.map((I,E)=>this._uiState.read(E)?.state?.kind===Xe.Collapsed?I?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(Xm,this._editor,this._model.map((I,E)=>this._uiState.read(E)?.state?.kind===Xe.Custom?I?.displayLocation:void 0),this._tabAction,this._uiState.map((I)=>I?.editorType??Ot.TextEditor))),this._showLongDistanceHint=this._editorObs.getOption(71).map(this,(I)=>I.edits.showLongDistanceHint),this._longDistanceHint=m(this,(I)=>{if(!this._showLongDistanceHint.read(I))return;return I.store.add(this._instantiationService.createInstance(of,this._editor,this._uiState.map((E,Z)=>E?.longDistanceHint?{hint:E.longDistanceHint,newTextLineCount:E.newTextLineCount,edit:E.edit,diff:E.diff,editorType:E.editorType,model:this._simpleModel.read(Z),inlineSuggestInfo:this._inlineSuggestInfo.read(Z),nextCursorPosition:E.nextCursorPosition,target:E.target}:void 0),this._previewTextModel,this._tabAction))}).recomputeInitiallyAndOnChange(this._store),this._inlineDiffViewState=m(this,(I)=>{let E=this._uiState.read(I);if(!E||!E.state)return;if(E.state.kind==="wordReplacements"||E.state.kind==="insertionMultiLine"||E.state.kind==="collapsed"||E.state.kind==="custom"||E.state.kind==="jumpTo")return;return{modifiedText:new Ol(E.newText),diff:E.diff,mode:E.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,editorType:E.editorType}}),this._inlineDiffView=this._register(new $w(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._jumpToView=this._register(this._instantiationService.createInstance(Qm,this._editorObs,{style:"label"},m((I)=>{let E=this._uiState.read(I);if(E?.state?.kind===Xe.JumpTo)return{jumpToPosition:E.state.position};return})));let S=In({equalsFn:X_.arrayC(X_.thisC())},(I)=>{let E=this._uiState.read(I);return E?.state?.kind===Xe.WordReplacements?E.state.replacements.map((Z)=>new Uw(Z,E.editorType,E.state?.alternativeAction)):[]});this._wordReplacementViews=gd(this,S,(I,E)=>E.add(this._instantiationService.createInstance(Rd,this._editorObs,I,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(Jm,this._editorObs,this._uiState.map((I)=>I?.state?.kind===Xe.LineReplacement?{originalRange:I.state.originalRange,modifiedRange:I.state.modifiedRange,modifiedLines:I.state.modifiedLines,replacements:I.state.replacements}:void 0),this._uiState.map((I)=>I?.editorType??Ot.TextEditor),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map((I)=>I.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map((I)=>I.edits.renderSideBySide),this._register(W((I)=>{let E=this._model.read(I);if(!E)return;I.store.add(R.any(this._sideBySide.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(I).map((Z)=>Z.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)((Z)=>{if(this._viewHasBeenShownLongerThan(350))Z.event.preventDefault(),E.accept(Z.alternativeAction)}))})),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store);let w=m(this,(I)=>Math.max(...this._wordReplacementViews.read(I).map((E)=>E.minEditorScrollHeight.read(I)),this._lineReplacementView.minEditorScrollHeight.read(I),this._customView.minEditorScrollHeight.read(I))).recomputeInitiallyAndOnChange(this._store),x;this._register(W((I)=>{let E=w.read(I),Z=this._editorObs.model.read(I);if(!Z)return;this._editor.changeViewZones((X)=>{let J=this._editor.getScrollHeight(),Q=E-J+1;if(Q!==0&&x!==void 0)X.removeZone(x),x=void 0;if(Q<=0)return;x=X.addZone({afterLineNumber:Z.getLineCount(),heightInPx:Q,domNode:_("div.minScrollHeightViewZone")})})})),this._constructorDone.set(!0,void 0)}_getLongDistanceHintState(n,h){if(n.inlineEdit.inlineCompletion.identity.jumpedTo.read(h))return;if(n.inlineEdit.action===void 0)return;let g=this._editorObs.model.read(h);if(!g||!n.inlineEdit.originalText.targets(g))return{isVisible:!0,lineNumber:n.inlineEdit.cursorPosition.lineNumber};if(this._currentInlineEditCache?.inlineSuggestionIdentity!==n.inlineEdit.inlineCompletion.identity)this._currentInlineEditCache={inlineSuggestionIdentity:n.inlineEdit.inlineCompletion.identity,firstCursorLineNumber:n.inlineEdit.cursorPosition.lineNumber};return{lineNumber:this._currentInlineEditCache.firstCursorLineNumber,isVisible:!n.inViewPort.read(h)}}_getCacheId(n){return n.inlineEdit.inlineCompletion.identity.id}_determineView(n,h,g,p){let f=n.inlineEdit,b=this._previousView?.id===this._getCacheId(n)&&this._previousView?.uri.toString()===this._editorObs.model.get().uri.toString(),S=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(h)&&(this._previousView?.view===Xe.SideBySide||this._previousView?.view===Xe.LineReplacement);if(b&&!S)return this._previousView.view;let w=n.inlineEdit.inlineCompletion.action;if(w?.kind==="edit"&&w.alternativeAction)return Xe.WordReplacements;let x=n.inlineEdit.inlineCompletion.originalTextRef.uri,I=this._editorObs.model.read(h)?.uri;if(I&&x.toString()!==I.toString())return Xe.Custom;if(n.displayLocation&&!n.inlineEdit.inlineCompletion.identity.jumpedTo.read(h))return Xe.Custom;let E=f.originalLineRange.length,Z=f.modifiedLineRange.length,X=g.flatMap((Q)=>Q.innerChanges??[]),J=X.length===1;if(n.editorType!==Ot.DiffEditor){if(J&&this._useCodeShifting.read(h)!=="never"&&hD(g)){if(aM(g,f.cursorPosition))return Xe.InsertionInline;return Xe.LineReplacement}if(dD(X,f,p))return Xe.Deletion;if(aD(g)&&this._useCodeShifting.read(h)==="always")return Xe.InsertionMultiLine;if(X.every((te)=>Kt.ofRange(te.originalRange).columnCount<Rd.MAX_LENGTH&&Kt.ofRange(te.modifiedRange).columnCount<Rd.MAX_LENGTH)&&J&&E===1&&Z===1){let te=X.map((le)=>p.getValueOfRange(le.modifiedRange)),re=X.map((le)=>n.inlineEdit.originalText.getValueOfRange(le.originalRange));if(!te.some((le)=>le.includes("\t"))&&!re.some((le)=>le.includes("\t"))){if(!X.some((le)=>le.originalRange.isEmpty())||!lD(X.map((le)=>new gt(le.originalRange,"")),f.originalText).some((le)=>le.range.isEmpty()&&Kt.ofRange(le.range).columnCount<Rd.MAX_LENGTH))return Xe.WordReplacements}}}if(E>0&&Z>0){if(E===1&&Z===1&&n.editorType!==Ot.DiffEditor)return Xe.LineReplacement;if(this._renderSideBySide.read(h)!=="never"&&lu.fitsInsideViewport(this._editor,this._previewTextModel,f,h))return Xe.SideBySide;return Xe.LineReplacement}if(n.editorType===Ot.DiffEditor){if(dD(X,f,p))return Xe.Deletion;if(aD(g)&&this._useCodeShifting.read(h)==="always")return Xe.InsertionMultiLine}return Xe.SideBySide}_determineRenderState(n,h,g,p){if(n.inlineEdit.action?.kind==="jumpTo")return{kind:Xe.JumpTo,position:n.inlineEdit.action.position,viewData:cD()};let f=n.inlineEdit,b=this._determineView(n,h,g,p);if(this._willRenderAboveCursor(h,f,b))switch(b){case Xe.LineReplacement:case Xe.WordReplacements:b=Xe.SideBySide;break}this._previousView={id:this._getCacheId(n),view:b,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now(),uri:this._editorObs.model.get().uri};let S=g.flatMap((Z)=>Z.innerChanges??[]),w=this._editor.getModel(),x=S.map((Z)=>({originalRange:Z.originalRange,modifiedRange:Z.modifiedRange,original:f.originalText.getValueOfRange(Z.originalRange),modified:p.getValueOfRange(Z.modifiedRange)})),I=sM(f,x,w);switch(b){case Xe.InsertionInline:return{kind:Xe.InsertionInline,viewData:I};case Xe.SideBySide:return{kind:Xe.SideBySide,viewData:I};case Xe.Collapsed:return{kind:Xe.Collapsed,viewData:I};case Xe.Custom:return{kind:Xe.Custom,displayLocation:n.displayLocation,viewData:I}}if(b===Xe.Deletion)return{kind:Xe.Deletion,originalRange:f.originalLineRange,deletions:S.map((Z)=>Z.originalRange),viewData:I};if(b===Xe.InsertionMultiLine){let Z=S[0];return{kind:Xe.InsertionMultiLine,lineNumber:Z.originalRange.startLineNumber,column:Z.originalRange.startColumn,text:p.getValueOfRange(Z.modifiedRange),viewData:I}}let E=x.map((Z)=>new gt(Z.originalRange,Z.modified));if(E.length===0)return;if(b===Xe.WordReplacements){let Z=dM(E,f.originalText);if(Z.some((X)=>X.range.isEmpty()))Z=lD(E,f.originalText);return{kind:Xe.WordReplacements,replacements:Z,alternativeAction:n.inlineEdit.action?.alternativeAction,viewData:I}}if(b===Xe.LineReplacement)return{kind:Xe.LineReplacement,originalRange:f.originalLineRange,modifiedRange:f.modifiedLineRange,modifiedLines:f.modifiedLineRange.mapToLineArray((Z)=>p.getLineAt(Z)),replacements:S.map((Z)=>({originalRange:Z.originalRange,modifiedRange:Z.modifiedRange})),viewData:I};return}_willRenderAboveCursor(n,h,g){if(this._useCodeShifting.read(n)==="always")return!1;for(let f of h.multiCursorPositions){if(g===Xe.WordReplacements&&f.lineNumber===h.originalLineRange.startLineNumber+1)return!0;if(g===Xe.LineReplacement&&f.lineNumber>=h.originalLineRange.endLineNumberExclusive&&f.lineNumber<h.modifiedLineRange.endLineNumberExclusive+h.modifiedLineRange.length)return!0}return!1}_viewHasBeenShownLongerThan(n){let h=this._previousView?.timestamp;if(!h)throw new H("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-h>=n}};rf=nM([rM(5,O)],rf);var cD=()=>new yl(-1,-1,-1,-1,-1,-1,-1,!0);function sM(u,n,h){if(!u.edit)return cD();let g=u.cursorPosition,p=n.length===0?!1:n[0].modified.startsWith(h.getEOL());return new yl(u.edit.replacements.length===0?0:u.edit.replacements[0].range.getStartPosition().column-g.column,u.lineEdit.lineRange.startLineNumber-g.lineNumber+(p&&u.lineEdit.lineRange.startLineNumber>=g.lineNumber?1:0),u.lineEdit.lineRange.length,u.lineEdit.newLines.length,n.reduce((b,S)=>b+S.original.length,0),n.reduce((b,S)=>b+S.modified.length,0),n.length,n.every((b)=>b.original===n[0].original&&b.modified===n[0].modified))}function hD(u){return u.every((h)=>h.innerChanges.every((g)=>n(g)));function n(h){if(!h.originalRange.isEmpty())return!1;if(h.modifiedRange.startLineNumber!==h.modifiedRange.endLineNumber)return!1;return!0}}function aM(u,n){if(!n)return!1;if(!hD(u))return!1;let h=n;return u.every((p)=>p.innerChanges.every((f)=>g(f)));function g(p){let f=p.originalRange.getStartPosition();if(h.isBeforeOrEqual(f))return!0;if(f.lineNumber<h.lineNumber)return!0;return!1}}function aD(u){let n=u.flatMap((g)=>g.innerChanges??[]);if(n.length!==1)return!1;let h=n[0];if(!h.originalRange.isEmpty())return!1;if(h.modifiedRange.startLineNumber===h.modifiedRange.endLineNumber)return!1;return!0}function dD(u,n,h){return u.map((p)=>({original:n.originalText.getValueOfRange(p.originalRange),modified:h.getValueOfRange(p.modifiedRange)})).every(({original:p,modified:f})=>f.trim()===""&&p.length>0&&(p.length>f.length||p.trim()!==""))}function dM(u,n){return uD(u,n,(h)=>/^[a-zA-Z]$/.test(h))}function lD(u,n){return uD(u,n,(h)=>!/^\s$/.test(h))}function uD(u,n,h){let g=[];u.sort((f,b)=>t.compareRangesUsingStarts(f.range,b.range));for(let f of u){let b=f.range.startColumn-1,S=f.range.endColumn-2,w="",x="",I=n.getLineAt(f.range.startLineNumber),E=n.getLineAt(f.range.endLineNumber);if(p(I[b]))while(p(I[b-1]))w=I[b-1]+w,b--;if(p(E[S])||S<b)while(p(E[S+1]))x+=E[S+1],S++;let Z=new gt(new t(f.range.startLineNumber,b+1,f.range.endLineNumber,S+2),w+f.text+x);if(g.length>0&&t.areIntersectingOrTouching(g[g.length-1].range,Z.range))Z=gt.joinReplacements([g.pop(),Z],n);g.push(Z)}function p(f){if(f===void 0)return!1;return h(f)}return g}var lM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},cM=function(u,n){return function(h,g){n(h,g,u)}},sf=class u extends i{constructor(n,h,g,p){super();this._editor=n,this._model=h,this._showCollapsed=g,this._inlineEdit=m(this,(f)=>{let b=this._model.read(f);if(!b)return;if(!this._editor.getModel())return;let w=b.inlineEditState.read(f);if(!w)return;let x=w.inlineSuggestion.action,I;if(x?.kind==="edit"){let E=x.stringEdit,Z=w.inlineSuggestion.originalTextRef.getTransformer(),X=E.replacements.map((J)=>{let Q=t.fromPositions(Z.getPosition(J.replaceRange.start),Z.getPosition(J.replaceRange.endExclusive));return new gt(Q,J.newText)});I=new jr(X)}else I=void 0;return new Nw(w.inlineSuggestion.originalTextRef,x,I,b.primaryPosition.read(void 0),b.allPositions.read(void 0),w.inlineSuggestion.source.inlineSuggestions.commands??[],w.inlineSuggestion)}),this._inlineEditModel=m(this,(f)=>{let b=this._model.read(f);if(!b)return;let S=this._inlineEdit.read(f);if(!S)return;let w=m(this,(x)=>{if(this._editorObs.isFocused.read(x)){if(b.tabShouldJumpToInlineEdit.read(x))return Nt.Jump;if(b.tabShouldAcceptInlineEdit.read(x))return Nt.Accept}return Nt.Inactive});return new Ow(b,S,w)}),this._editorObs=ct(this._editor),this.view=this._register(p.createInstance(rf,this._editor,this._inlineEditModel,this._model.map((f)=>f?oc.fromInlineCompletionModel(f):void 0),this._inlineEdit.map((f)=>f?ic.fromInlineSuggestion(f.inlineCompletion):void 0),this._showCollapsed))}};sf=lM([cM(3,O)],sf);var hM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},uM=function(u,n){return function(h,g){n(h,g,u)}},af=class u extends i{static{this.hot=Gv(this)}constructor(n,h,g,p){super();this._editor=n,this._model=h,this._focusIsInMenu=g,this._instantiationService=p,this._ghostTexts=m(this,(f)=>this._model.read(f)?.ghostTexts.read(f)??[]),this._inlineEdit=m(this,(f)=>this._model.read(f)?.inlineEditState.read(f)?.inlineSuggestion),this._everHadInlineEdit=fo(this,(f,b)=>b||!!this._inlineEdit.read(f)||!!this._model.read(f)?.inlineCompletionState.read(f)?.inlineSuggestion?.showInlineEditMenu),this._indicatorIsHoverVisible=j(this,void 0),this._showInlineEditCollapsed=m(this,(f)=>(this._model.read(f)?.showCollapsed.read(f)??!1)&&!this._indicatorIsHoverVisible.read(f)?.read(f)),this._inlineEditWidget=po((f)=>{if(!this._everHadInlineEdit.read(f))return;return this._instantiationService.createInstance(sf,this._editor,this._model,this._showInlineEditCollapsed)}),this._gutterIndicatorState=m((f)=>{let b=this._model.read(f);if(!b)return;let S=b.state.read(f);if(S?.kind==="ghostText"&&S.inlineSuggestion?.showInlineEditMenu)return{displayRange:ne.ofLength(S.primaryGhostText.lineNumber,1),tabAction:m(this,(w)=>this._editorObs.isFocused.read(w)?Nt.Accept:Nt.Inactive),gutterIndicatorOffset:Ne(gM(S.inlineSuggestion,this._editor)),inlineSuggestion:S.inlineSuggestion,model:b};else if(S?.kind==="inlineEdit"){let w=this._inlineEditWidget.read(f)?.view;if(!w)return;let x=w.displayRange.read(f);if(!x)return;return{displayRange:x,tabAction:m((I)=>{if(this._editorObs.isFocused.read(I)){if(b.tabShouldJumpToInlineEdit.read(I))return Nt.Jump;if(b.tabShouldAcceptInlineEdit.read(I))return Nt.Accept}return Nt.Inactive}),gutterIndicatorOffset:w.gutterIndicatorOffset,inlineSuggestion:S.inlineSuggestion,model:b}}else return}),this._stablizedGhostTexts=zE(this._ghostTexts,this._store),this._editorObs=ct(this._editor),this._ghostTextWidgets=gd(this,this._stablizedGhostTexts,(f,b)=>b.add(this._createGhostText(f))).recomputeInitiallyAndOnChange(this._store),this._inlineEditWidget.recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map((f)=>f.fontFamily),this._register(w2(m((f)=>`
|
|
50
|
+
.monaco-editor .ghost-text-decoration,
|
|
51
|
+
.monaco-editor .ghost-text-decoration-preview,
|
|
52
|
+
.monaco-editor .ghost-text {
|
|
53
|
+
font-family: ${this._fontFamily.read(f)};
|
|
54
|
+
}`))),this._register(new Rp(this._editor,this._model,this._instantiationService)),this._indicator=this._register(this._instantiationService.createInstance(tc,this._editorObs,m((f)=>{let b=this._gutterIndicatorState.read(f);if(!b)return;return new ru(ic.fromInlineSuggestion(b.inlineSuggestion),b.displayRange,oc.fromInlineCompletionModel(b.model),b.inlineSuggestion.action?.kind==="edit"?b.inlineSuggestion.action.alternativeAction:void 0)}),this._gutterIndicatorState.map((f,b)=>f?.tabAction?.read(b)??Nt.Inactive),this._gutterIndicatorState.map((f,b)=>f?.gutterIndicatorOffset?.read(b)??0),this._inlineEditWidget.map((f,b)=>f?.view.inlineEditsIsHovered.read(b)??!1),this._focusIsInMenu)),this._indicatorIsHoverVisible.set(this._indicator.isHoverVisible,void 0),m((f)=>{let b=this._inlineEditWidget.read(f);if(!b)return;return f.store.add(this._instantiationService.createInstance(jm,b._inlineEditModel,Ne(this._indicator),b.view._inlineCollapsedView))}).recomputeInitiallyAndOnChange(this._store)}_createGhostText(n){return this._instantiationService.createInstance(ia,this._editor,m((h)=>{let g=this._model.read(h),p=g?.inlineCompletionState.read(h)?.inlineSuggestion;if(!g||!p)return{ghostText:n.read(h),handleInlineCompletionShown:()=>{},warning:void 0};return{ghostText:n.read(h),handleInlineCompletionShown:(f)=>g.handleInlineSuggestionShown(p,Xe.GhostText,f,Date.now()),warning:Hm.from(g?.warning.read(h))}}),{useSyntaxHighlighting:this._editorObs.getOption(71).map((h)=>h.syntaxHighlightingEnabled),highlightShortSuggestions:!0})}shouldShowHoverAtViewZone(n){return this._ghostTextWidgets.get()[0]?.ownsViewZone(n)??!1}};af=hM([uM(3,O)],af);function gM(u,n){let h=u.getSingleTextEdit(),g=n.getModel();if(!g)return 0;let p=g.getEOL();if(h.range.isEmpty()&&h.text.startsWith(p)){let f=n.getLineHeightForPosition(h.range.getStartPosition());return pM(h.text,p)*f}return 0}function pM(u,n){if(!n.length)return 0;let h=0,g=0;while(u.startsWith(n,g))h++,g+=n.length;return h}var mM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},fa=function(u,n){return function(h,g){n(h,g,u)}},hr;wE((u)=>mi.get(u));var mi=class u extends i{static{hr=this}static{this._instances=new Set}static{this.hot=Gv(this)}static{this.ID="editor.contrib.inlineCompletionsController"}static getInFocusedEditorOrParent(n){let h=pg(n);if(!h)return null;return hr.get(h)}static get(n){return IE(n.getContribution(hr.ID))}constructor(n,h,g,p,f,b,S,w,x){super();this.editor=n,this._instantiationService=h,this._contextKeyService=g,this._configurationService=p,this._commandService=f,this._debounceService=b,this._languageFeaturesService=S,this._accessibilitySignalService=w,this._keybindingService=x,this._focusIsInMenu=j(this,!1),this._focusIsInEditorOrMenu=m(this,(J)=>{let Q=this._editorObs.isFocused.read(J),te=this._focusIsInMenu.read(J);return Q||te}),this._cursorIsInIndentation=m(this,(J)=>{let Q=this._editorObs.cursorPosition.read(J);if(Q===null)return!1;let te=this._editorObs.model.read(J);if(!te)return!1;this._editorObs.versionId.read(J);let re=te.getLineIndentColumn(Q.lineNumber);return Q.column<=re}),this.model=po(this,(J)=>{if(this._editorObs.isReadonly.read(J))return;let Q=this._editorObs.model.read(J);if(!Q)return;return this._instantiationService.createInstance(Lm,Q,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabledInConfig,()=>this._isEditorDictationInProgress(),this.editor)}),this._playAccessibilitySignal=ar(this),this._view=m((J)=>J.store.add(this._instantiationService.createInstance(af.hot.read(J),this.editor,this.model,this._focusIsInMenu))),this._editorObs=ct(this.editor),this._positions=m(this,(J)=>this._editorObs.selections.read(J)?.map((Q)=>Q.getEndPosition())??[new s(1,1)]),this._suggestWidgetAdapter=this._register(new pw(this._editorObs,(J)=>this.model.get()?.handleSuggestAccepted(J),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=je(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._register(this._contextKeyService.onDidChangeContext((J)=>{if(J.affectsSome(new Set(["editorDictation.inProgress"]))&&this._isEditorDictationInProgress())this.model.get()?.stop()})),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this.model.recomputeInitiallyAndOnChange(this._store),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map((J)=>!0),this._view.recomputeInitiallyAndOnChange(this._store),hr._instances.add(this),this._register(D(()=>hr._instances.delete(this))),this._register(W((J)=>{let Q=this.model.read(J);if(!Q)return;let te=Q.state.read(J);if(!te)return;if(!this._focusIsInEditorOrMenu.read(void 0))return;let re=te.kind==="inlineEdit"?te.nextEditUri:void 0;for(let le of hr._instances)if(le===this)continue;else if(re&&vs(re,le.editor.getModel()?.uri))le.model.read(void 0)?.trigger();else le.reject()})),this._register(W((J)=>{let Q=this.model.read(J),te=this.editor.getModel()?.uri;if(!Q||!te)return;J.store.add(Q.onDidAccept(()=>{for(let re of hr._instances){if(re===this)continue;let le=re.model.read(void 0)?.state.read(void 0);if(le?.kind==="inlineEdit"&&vs(le.nextEditUri,te))re.model.read(void 0)?.stop("automatic")}}))})),this._register(Mo(this._editorObs.onDidType,(J,Q)=>{if(this._enabledInConfig.get()&&!this._isEditorDictationInProgress())this.model.get()?.trigger()})),this._register(Mo(this._editorObs.onDidPaste,(J,Q)=>{if(this._enabledInConfig.get()&&!this._isEditorDictationInProgress())this.model.get()?.trigger()}));let I=new Set([Yf.Tab.id,Yf.DeleteLeft.id,Yf.DeleteRight.id,fn,"acceptSelectedSuggestion",cc.ID,lc.ID,bt.NextMatchFindAction,Er.ID,Ma.ID,Zc.ID,Xc.ID,...Ng.getRegisteredCommands()]);this._register(this._commandService.onDidExecuteCommand((J)=>{if(I.has(J.commandId)&&n.hasTextFocus()&&this._enabledInConfig.get()&&!this._isEditorDictationInProgress()){let Q=!1;if(J.commandId===fn)Q=!0;this._editorObs.forceUpdate((te)=>{this.model.get()?.trigger(te,{noDelay:Q})})}})),this._register(Mo(this._editorObs.selections,(J,Q,te)=>{if(te.some((re)=>re.reason===3||re.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;let re=this.model.get();if(!re)return;if(re.state.get()?.kind==="ghostText")this.model.get()?.stop()}})),this._register(W((J)=>{let Q=this._focusIsInEditorOrMenu.read(J),te=this.model.read(void 0);if(Q){let re=te?.state.read(void 0);if(!re||re.kind!=="inlineEdit"||!re.nextEditUri)Ye((le)=>{for(let pe of hr._instances)if(pe!==this)pe.model.read(void 0)?.stop("automatic",le)});return}if(this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||n.getOption(71).keepOnBlur||zr.dropDownVisible)return;if(!te)return;if(te.state.read(void 0)?.inlineSuggestion?.isFromExplicitRequest&&te.inlineEditAvailable.read(void 0))return;Ye((re)=>{te.stop("automatic",re)})})),this._register(W((J)=>{let Q=this.model.read(J)?.inlineCompletionState.read(J);if(Q?.suggestItem){if(Q.primaryGhostText.lineCount>=2)this._suggestWidgetAdapter.forceRenderingAbove()}else this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(D(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));let E=fo(this,(J,Q)=>{let re=this.model.read(J)?.state.read(J);if(this._suggestWidgetAdapter.selectedItem.get())return Q;return re?.inlineSuggestion?.semanticId});this._register(qI(m((J)=>(this._playAccessibilitySignal.read(J),E.read(J),{})),async(J,Q,te,re)=>{let le=this.model.get(),pe=le?.state.get();if(!pe||!le)return;if(await Oo(50,J_(re)),await eE(this._suggestWidgetAdapter.selectedItem,sr,()=>!1,J_(re)),le=this.model.get(),pe=le?.state.get(),!pe||!le)return;let Se=pe.kind==="ghostText"?le.textModel.getLineContent(pe.primaryGhostText.lineNumber):"";if(this._accessibilitySignalService.playSignal(pe.kind==="ghostText"?nt.inlineSuggestion:nt.nextEditSuggestion),this.editor.getOption(12))if(pe.kind==="ghostText")this._provideScreenReaderUpdate(pe.primaryGhostText.renderForScreenReader(Se));else{let we=pe.inlineSuggestion.targetRange.startLineNumber,ae=le.tabShouldAcceptInlineEdit.get(),me=le.tabShouldJumpToInlineEdit.get(),De;if(ae){let Oe=this._keybindingService.lookupKeybinding(fn)?.getAriaLabel();De=Oe?e(1262,"Next edit suggestion available on line {0}, press {1} to accept",we,Oe):e(1263,"Next edit suggestion available on line {0}, accept it to apply",we)}else if(me){let Oe=this._keybindingService.lookupKeybinding(dl)?.getAriaLabel();De=Oe?e(1264,"Next edit suggestion available on line {0}, press {1} to jump",we,Oe):e(1265,"Next edit suggestion available on line {0}",we)}else De=e(1266,"Next edit suggestion available on line {0}",we);this._provideScreenReaderUpdate(De)}})),this._register(this._configurationService.onDidChangeConfiguration((J)=>{if(J.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 Z=new KS(this._contextKeyService);this._register(Z.bind(dt.cursorInIndentation,this._cursorIsInIndentation)),this._register(Z.bind(dt.hasSelection,(J)=>!this._editorObs.cursorSelection.read(J)?.isEmpty())),this._register(Z.bind(dt.cursorAtInlineEdit,this.model.map((J,Q)=>J?.inlineEditState?.read(Q)?.cursorAtInlineEdit.read(Q)))),this._register(Z.bind(dt.tabShouldAcceptInlineEdit,this.model.map((J,Q)=>!!J?.tabShouldAcceptInlineEdit.read(Q)))),this._register(Z.bind(dt.tabShouldJumpToInlineEdit,this.model.map((J,Q)=>!!J?.tabShouldJumpToInlineEdit.read(Q)))),this._register(Z.bind(dt.inlineEditVisible,(J)=>this.model.read(J)?.inlineEditState.read(J)!==void 0)),this._register(Z.bind(dt.inlineSuggestionHasIndentation,(J)=>this.model.read(J)?.getIndentationInfo(J)?.startsWithIndentation)),this._register(Z.bind(dt.inlineSuggestionHasIndentationLessThanTabSize,(J)=>this.model.read(J)?.getIndentationInfo(J)?.startsWithIndentationLessThanTabSize)),this._register(Z.bind(dt.suppressSuggestions,(J)=>{let te=this.model.read(J)?.inlineCompletionState.read(J);return te?.primaryGhostText&&te?.inlineSuggestion?te.inlineSuggestion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(Z.bind(dt.inlineSuggestionAlternativeActionVisible,(J)=>{let re=this.model.read(J)?.inlineEditState.read(J)?.inlineSuggestion.action;return re&&re.kind==="edit"&&re.alternativeAction!==void 0})),this._register(Z.bind(dt.inlineSuggestionVisible,(J)=>{let te=this.model.read(J)?.inlineCompletionState.read(J);return!!te?.inlineSuggestion&&te?.primaryGhostText!==void 0&&!te?.primaryGhostText.isEmpty()}));let X=m(this,(J)=>{let re=this.model.read(J)?.inlineCompletionState.read(J)?.primaryGhostText;if(!re||re.isEmpty())return;return new s(re.lineNumber,re.parts[0].column)});this._register(Z.bind(dt.cursorBeforeGhostText,(J)=>{let Q=X.read(J);if(!Q)return!1;let te=this._editorObs.cursorPosition.read(J);if(!te)return!1;return Q.equals(te)})),this._register(this._instantiationService.createInstance(hm,this.editor))}_isEditorDictationInProgress(){return this._contextKeyService.getContext(this.editor.getDomNode())?.getValue("editorDictation.inProgress")===!0}playAccessibilitySignal(n){this._playAccessibilitySignal.trigger(n)}_provideScreenReaderUpdate(n){let h=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),g=this._keybindingService.lookupKeybinding("editor.action.accessibleView"),p;if(!h&&g&&this.editor.getOption(170))p=e(1267,"Inspect this in the accessible view ({0})",g.getAriaLabel());zn(p?n+", "+p:n)}shouldShowHoverAt(n){let h=this.model.get()?.primaryGhostText.get();if(!h)return!1;return h.parts.some((g)=>n.containsPosition(new s(h.lineNumber,g.column)))}shouldShowHoverAtViewZone(n){return this._view.get().shouldShowHoverAtViewZone(n)}reject(){Ye((n)=>{let h=this.model.get();if(h){if(h.stop("explicitCancel",n),this._focusIsInEditorOrMenu.get()){for(let g of hr._instances)if(g!==this&&!g._focusIsInEditorOrMenu.get())g.model.get()?.stop("automatic",n)}}})}jump(){let n=this.model.get();if(n)n.jump()}};mi=hr=mM([fa(1,O),fa(2,K),fa(3,oe),fa(4,Ue),fa(5,ur),fa(6,V),fa(7,Cs),fa(8,ge)],mi);class df extends U{static{this.ID=Lp}constructor(){super({id:df.ID,label:y(1239,"Show Next Inline Suggestion"),precondition:L.and(o.writable,dt.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(u,n){mi.get(n)?.model.get()?.next()}}class lf extends U{static{this.ID=Ip}constructor(){super({id:lf.ID,label:y(1240,"Show Previous Inline Suggestion"),precondition:L.and(o.writable,dt.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(u,n){mi.get(n)?.model.get()?.previous()}}var fM="vscode://schemas/inlineCompletionProviderIdArgs";function _M(u){let n=[];if(u.providerId)n.push(u.providerId.toStringWithoutVersion()),n.push(u.providerId.extensionId+":*");return n}var gD=ME(NE({showNoResultNotification:Rh(WS()),providerId:Rh(AE(fM,EE())),explicit:Rh(WS()),changeHintData:Rh(RE())}),kE());class jw extends U{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:y(1241,"Trigger Inline Suggestion"),precondition:o.writable,metadata:{description:e(1228,"Triggers an inline suggestion in the editor."),args:[{name:"args",description:e(1229,"Options for triggering inline suggestions."),isOptional:!0,schema:gD.getJSONSchema()}]}})}async run(u,n,h){let g=u.get(wt),p=u.get(V),f=mi.get(n),b=gD.validateOrThrow(h),S=b?.providerId?p.inlineCompletionsProvider.all(n.getModel()).find((w)=>_M(w).some((x)=>x===b.providerId)):void 0;if(await c2(async(w)=>{await f?.model.get()?.trigger(w,{provider:S,explicit:b?.explicit??!0,changeHint:b?.changeHintData?{data:b.changeHintData}:void 0}),f?.playAccessibilitySignal(w)}),b?.showNoResultNotification){if(!f?.model.get()?.state.get())g.notify({severity:Tc.Info,message:e(1230,"No inline suggestion is available.")})}}}class Gw extends U{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:y(1242,"Accept Next Word Of Inline Suggestion"),precondition:L.and(o.writable,dt.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:L.and(o.writable,dt.inlineSuggestionVisible,dt.cursorBeforeGhostText,ep.negate())},menuOpts:[{menuId:l.InlineSuggestionToolbar,title:e(1231,"Accept Word"),group:"primary",order:2}]})}async run(u,n){await mi.get(n)?.model.get()?.acceptNextWord()}}class qw extends U{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:y(1243,"Accept Next Line Of Inline Suggestion"),precondition:L.and(o.writable,dt.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:l.InlineSuggestionToolbar,title:e(1232,"Accept Line"),group:"secondary",order:2}]})}async run(u,n){await mi.get(n)?.model.get()?.acceptNextLine()}}class Zw extends U{constructor(){super({id:fn,label:y(1244,"Accept Inline Suggestion"),precondition:L.or(dt.inlineSuggestionVisible,dt.inlineEditVisible),menuOpts:[{menuId:l.InlineSuggestionToolbar,title:e(1233,"Accept"),group:"primary",order:2},{menuId:l.InlineEditsActions,title:e(1234,"Accept"),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:L.or(L.and(dt.inlineSuggestionVisible,o.tabMovesFocus.toNegated(),Fe.Visible.toNegated(),o.hoverFocused.toNegated(),dt.hasSelection.toNegated(),dt.inlineSuggestionHasIndentationLessThanTabSize),L.and(dt.inlineEditVisible,o.tabMovesFocus.toNegated(),Fe.Visible.toNegated(),o.hoverFocused.toNegated(),dt.tabShouldAcceptInlineEdit))}]})}async run(u,n){let h=mi.getInFocusedEditorOrParent(u);if(h)h.model.get()?.accept(h.editor),h.editor.focus()}}Dn.registerKeybindingRule({id:fn,weight:202,primary:2,when:L.and(dt.inInlineEditsPreviewEditor)});class Xw extends U{constructor(){super({id:Ya,label:y(1245,"Accept Inline Suggestion Alternative Action"),precondition:L.and(dt.inlineSuggestionAlternativeActionVisible,dt.inlineEditVisible),menuOpts:[],kbOpts:[{primary:1026,weight:203}]})}async run(u,n){let h=mi.getInFocusedEditorOrParent(u);if(h)h.model.get()?.accept(h.editor,!0),h.editor.focus()}}Dn.registerKeybindingRule({id:Ya,weight:203,primary:1026,when:L.and(dt.inInlineEditsPreviewEditor)});class Yw extends U{constructor(){super({id:dl,label:y(1246,"Jump to next inline edit"),precondition:dt.inlineEditVisible,menuOpts:[{menuId:l.InlineEditsActions,title:e(1235,"Jump"),group:"primary",order:1,when:dt.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:L.and(dt.inlineEditVisible,o.tabMovesFocus.toNegated(),Fe.Visible.toNegated(),o.hoverFocused.toNegated(),dt.tabShouldJumpToInlineEdit)}})}async run(u,n){let h=mi.get(n);if(h)h.jump()}}class yu extends U{static{this.ID=Ep}constructor(){super({id:yu.ID,label:y(1247,"Hide Inline Suggestion"),precondition:L.or(dt.inlineSuggestionVisible,dt.inlineEditVisible),kbOpts:{kbExpr:o.editorTextFocus,weight:190,primary:9},menuOpts:[{menuId:l.InlineEditsActions,title:e(1236,"Reject"),group:"primary",order:3}]})}async run(u,n){let h=mi.getInFocusedEditorOrParent(u);Ye((g)=>{h?.model.get()?.stop("explicitCancel",g)}),h?.editor.focus()}}class cf extends U{static{this.ID=hh}constructor(){super({id:cf.ID,label:y(1248,"Toggle Inline Suggestions Show Collapsed"),precondition:L.true()})}async run(u,n){let h=u.get(oe),g=h.getValue("editor.inlineSuggest.edits.showCollapsed");h.updateValue("editor.inlineSuggest.edits.showCollapsed",!g)}}Dn.registerKeybindingRule({id:yu.ID,weight:-1,primary:9,secondary:[1033],when:L.and(dt.inInlineEditsPreviewEditor)});class hf extends Cn{static{this.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar"}constructor(){super({id:hf.ID,title:e(1237,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:l.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:L.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(u){let n=u.get(oe),g=n.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";n.updateValue("editor.inlineSuggest.showToolbar",g)}}class Jw extends U{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:e(1238,"Developer: Extract Inline Suggest State"),alias:"Developer: Inline Suggest Extract Repro",precondition:L.or(dt.inlineEditVisible,dt.inlineSuggestionVisible)})}async run(u,n){let h=u.get(xi),p=mi.get(n)?.model.get();if(!p)return;let f=p.extractReproSample(),S=Ci(JSON.stringify({inlineCompletion:f.inlineCompletion},null,4)).map((x)=>"// "+x).join(`
|
|
55
|
+
`),w=`${f.documentValue}
|
|
56
|
+
|
|
57
|
+
// <json>
|
|
58
|
+
${S}
|
|
59
|
+
// </json>
|
|
60
|
+
`;return await h.writeText(w),{reproCase:w}}}var bM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},uf=function(u,n){return function(h,g){n(h,g,u)}};class pD{constructor(u,n,h){this.owner=u,this.range=n,this.controller=h}isValidForHoverAnchor(u){return u.type===1&&this.range.startColumn<=u.range.startColumn&&this.range.endColumn>=u.range.endColumn}}var gf=class u{constructor(n,h,g,p,f){this._editor=n,this.accessibilityService=h,this._instantiationService=g,this._telemetryService=p,this._markdownRendererService=f,this.hoverOrdinal=4,this.hideCopyButton=!0}suggestHoverAnchor(n){let h=mi.get(this._editor);if(!h)return null;let g=n.target;if(g.type===8){let p=g.detail;if(h.shouldShowHoverAtViewZone(p.viewZoneId))return new Gs(1000,this,t.fromPositions(this._editor.getModel().validatePosition(p.positionBefore||p.position)),n.event.posx,n.event.posy,!1)}if(g.type===7){if(h.shouldShowHoverAt(g.range))return new Gs(1000,this,g.range,n.event.posx,n.event.posy,!1)}if(g.type===6){if(g.detail.mightBeForeignElement&&h.shouldShowHoverAt(g.range))return new Gs(1000,this,g.range,n.event.posx,n.event.posy,!1)}if(g.type===9&&g.element){let p=ia.getWarningWidgetContext(g.element);if(p&&h.shouldShowHoverAt(p.range))return new Gs(1000,this,p.range,n.event.posx,n.event.posy,!1)}return null}computeSync(n,h){if(this._editor.getOption(71).showToolbar!=="onHover")return[];let g=mi.get(this._editor);if(g&&g.shouldShowHoverAt(n.range))return[new pD(this,n.range,g)];return[]}renderHoverParts(n,h){let g=new d,p=h[0];if(this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12))g.add(this.renderScreenReaderText(n,p));let f=p.controller.model.get(),b=document.createElement("div");return n.fragment.appendChild(b),g.add(oi((w,x)=>{let I=x.add(this._instantiationService.createInstance(zr.hot.read(w),this._editor,!1,Ne(null),f.selectedInlineCompletionIndex,f.inlineCompletionsCount,f.activeCommands,f.warning,()=>{n.onContentsChanged()}));b.replaceChildren(I.getDomNode())})),f.triggerExplicitly(),new xo([{hoverPart:p,hoverElement:b,dispose(){g.dispose()}}])}getAccessibleContent(n){return e(1268,"There are inline completions here")}renderScreenReaderText(n,h){let g=new d,p=_,f=p("div.hover-row.markdown-hover"),b=k(f,p("div.hover-contents",{["aria-live"]:"assertive"})),S=(w)=>{let x=e(1269,"Suggestion:"),I=g.add(this._markdownRendererService.render(new Pn().appendText(x).appendCodeblock("text",w),{context:this._editor,asyncRenderCallback:()=>{b.className="hover-contents code-hover-contents",n.onContentsChanged()}}));b.replaceChildren(I.element)};return g.add(W((w)=>{let x=h.controller.model.read(w)?.primaryGhostText.read(w);if(x){let I=this._editor.getModel().getLineContent(x.lineNumber);S(x.renderForScreenReader(I))}else gn(b)})),n.fragment.appendChild(f),g}};gf=bM([uf(1,on),uf(2,O),uf(3,Wn),uf(4,Wr)],gf);class Qw{}fe(mi.ID,LE(mi.hot),3);A(jw);A(df);A(lf);A(Gw);A(qw);A(Zw);A(Xw);A(cf);A(yu);A(Yw);lt(hf);A(Jw);lt(Ok);lt(Ak);El.register(gf);pl.register(new Qw);var vM=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Nd=function(u,n){return function(h,g){n(h,g,u)}},eC,Iu=class u{static{eC=this}static{this.ID="editor.contrib.contextmenu"}static get(n){return n.getContribution(eC.ID)}constructor(n,h,g,p,f,b,S,w){this._contextMenuService=h,this._contextViewService=g,this._contextKeyService=p,this._keybindingService=f,this._menuService=b,this._configurationService=S,this._workspaceContextService=w,this._toDispose=new d,this._contextMenuIsBeingShownCount=0,this._editor=n,this._toDispose.add(this._editor.onContextMenu((x)=>this._onContextMenu(x))),this._toDispose.add(this._editor.onMouseWheel((x)=>{if(this._contextMenuIsBeingShownCount>0){let I=this._contextViewService.getContextViewElement(),E=x.srcElement;if(!(E.shadowRoot&&Dl(I)===E.shadowRoot))this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown((x)=>{if(!this._editor.getOption(30))return;if(x.keyCode===58)x.preventDefault(),x.stopPropagation(),this.showContextMenu()}))}_onContextMenu(n){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){if(this._editor.focus(),n.target.position&&!this._editor.getSelection().containsPosition(n.target.position))this._editor.setPosition(n.target.position);return}if(n.target.type===12)return;if(n.target.type===6&&n.target.detail.injectedText)return;if(n.event.preventDefault(),n.event.stopPropagation(),n.target.type===11)return this._showScrollbarContextMenu(n.event);if(n.target.type!==6&&n.target.type!==7&&n.target.type!==1)return;if(this._editor.focus(),n.target.position){let g=!1;for(let p of this._editor.getSelections())if(p.containsPosition(n.target.position)){g=!0;break}if(!g)this._editor.setPosition(n.target.position)}let h=null;if(n.target.type!==1)h=n.event;this.showContextMenu(h)}showContextMenu(n){if(!this._editor.getOption(30))return;if(!this._editor.hasModel())return;let h=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);if(h.length>0)this._doShowContextMenu(h,n)}_getMenuActions(n,h){let g=[],p=this._menuService.getMenuActions(h,this._contextKeyService,{arg:n.uri});for(let f of p){let[,b]=f,S=0;for(let w of b)if(w instanceof xc){let x=this._getMenuActions(n,w.item.submenu);if(x.length>0)g.push(new ys(w.id,w.label,x)),S++}else g.push(w),S++;if(S)g.push(new ut)}if(g.length)g.pop();return g}_doShowContextMenu(n,h=null){if(!this._editor.hasModel())return;let g=h;if(!g){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();let f=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),b=kt(this._editor.getDomNode()),S=b.left+f.left,w=b.top+f.top+f.height;g={x:S,y:w}}let p=this._editor.getOption(144)&&!Dr;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:p?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,useWindowContainerForShadowRoot:p&&this._editor.getOption(51),getAnchor:()=>g,getActions:()=>n,getActionViewItem:(f)=>{let b=this._keybindingFor(f);if(b)return new Rc(f,f,{label:!0,keybinding:b.getLabel(),isMenu:!0});let S=f;if(typeof S.getActionViewItem==="function")return S.getActionViewItem();return new Rc(f,f,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:(f)=>this._keybindingFor(f),onHide:(f)=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(n){if(!this._editor.hasModel())return;if(K2(this._workspaceContextService.getWorkspace()))return;let h=this._editor.getOption(81),g=0,p=(x)=>({id:`menu-action-${++g}`,label:x.label,tooltip:"",class:void 0,enabled:typeof x.enabled>"u"?!0:x.enabled,checked:x.checked,run:x.run}),f=(x,I)=>new ys(`menu-action-${++g}`,x,I,void 0),b=(x,I,E,Z,X)=>{if(!I)return p({label:x,enabled:I,run:()=>{}});let J=(te)=>()=>{this._configurationService.updateValue(E,te)},Q=[];for(let te of X)Q.push(p({label:te.label,checked:Z===te.value,run:J(te.value)}));return f(x,Q)},S=[];S.push(p({label:e(952,"Minimap"),checked:h.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!h.enabled)}})),S.push(new ut),S.push(p({label:e(953,"Render Characters"),enabled:h.enabled,checked:h.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!h.renderCharacters)}})),S.push(b(e(954,"Vertical size"),h.enabled,"editor.minimap.size",h.size,[{label:e(955,"Proportional"),value:"proportional"},{label:e(956,"Fill"),value:"fill"},{label:e(957,"Fit"),value:"fit"}])),S.push(b(e(958,"Slider"),h.enabled,"editor.minimap.showSlider",h.showSlider,[{label:e(959,"Mouse Over"),value:"mouseover"},{label:e(960,"Always"),value:"always"}])),S.push(b(e(961,"Side"),h.enabled,"editor.minimap.side",h.side,[{label:e(962,"Right"),value:"right"},{label:e(963,"Left"),value:"left"}]));let w=this._editor.getOption(144)&&!Dr;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:w?this._editor.getDomNode():void 0,useWindowContainerForShadowRoot:w&&this._editor.getOption(51),getAnchor:()=>n,getActions:()=>S,onHide:(x)=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(n){return this._keybindingService.lookupKeybinding(n.id)}dispose(){if(this._contextMenuIsBeingShownCount>0)this._contextViewService.hideContextView();this._toDispose.dispose()}};Iu=eC=vM([Nd(1,Qn),Nd(2,Ss),Nd(3,K),Nd(4,ge),Nd(5,Ai),Nd(6,oe),Nd(7,Sa)],Iu);class mD extends U{constructor(){super({id:"editor.action.showContextMenu",label:y(964,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:o.textInputFocus,primary:1092,weight:100}})}run(u,n){Iu.get(n)?.showContextMenu()}}fe(Iu.ID,Iu,2);A(mD);class tC extends i{static{this.ID="editor.contrib.readOnlyMessageController"}constructor(u){super();this.editor=u,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){let u=ti.get(this.editor);if(u&&this.editor.hasModel()){let n=this.editor.getOptions().get(105);if(!n)if(this.editor.isSimpleWidget)n=new Pn(e(1447,"Cannot edit in read-only input"));else n=new Pn(e(1448,"Cannot edit in read-only editor"));u.showMessage(n,this.editor.getPosition())}}}fe(tC.ID,tC,2);class iC extends Cn{static{this.ID="editor.action.toggleTabFocusMode"}constructor(){super({id:iC.ID,title:y(1604,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:y(1605,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){let n=!Qh.getTabFocusMode();if(Qh.setTabFocusMode(n),n)zn(e(1602,"Pressing Tab will now move focus to the next focusable element"));else zn(e(1603,"Pressing Tab will now insert the tab character"))}}lt(iC);var fD=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},oC=function(u,n){return function(h,g){n(h,g,u)}},SM=26,pf=class u extends i{constructor(n,h){super();this._editor=n,this.instantiationService=h,this.banner=this._register(this.instantiationService.createInstance(nC))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(n){this.banner.show({...n,onClose:()=>{this.hide(),n.onClose?.()}}),this._editor.setBanner(this.banner.element,SM)}};pf=fD([oC(1,O)],pf);var nC=class u extends i{constructor(n,h){super();this.instantiationService=n,this.markdownRendererService=h,this.element=_("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(n){if(n.ariaLabel)return n.ariaLabel;if(typeof n.message==="string")return n.message;return}getBannerMessage(n){if(typeof n==="string"){let h=_("span");return h.innerText=n,h}return this.markdownRendererService.render(n).element}clear(){mn(this.element)}show(n){mn(this.element);let h=this.getAriaLabel(n);if(h)this.element.setAttribute("aria-label",h);let g=k(this.element,_("div.icon-container"));if(g.setAttribute("aria-hidden","true"),n.icon)g.appendChild(_(`div${Y.asCSSSelector(n.icon)}`));let p=k(this.element,_("div.message-container"));if(p.setAttribute("aria-hidden","true"),p.appendChild(this.getBannerMessage(n.message)),this.messageActionsContainer=k(this.element,_("div.message-actions-container")),n.actions)for(let b of n.actions)this._register(this.instantiationService.createInstance(Pd,this.messageActionsContainer,{...b,tabIndex:-1},{}));let f=k(this.element,_("div.action-container"));this.actionBar=this._register(new er(f)),this.actionBar.push(this._register(new _r("banner.close",e(1607,"Close Banner"),Y.asClassName(Qk),!0,()=>{if(typeof n.onClose==="function")n.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};nC=fD([oC(0,O),oC(1,Wr)],nC);var lC=function(u,n,h,g){var p=arguments.length,f=p<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,h):g,b;if(typeof Reflect==="object"&&typeof Reflect.decorate==="function")f=Reflect.decorate(u,n,h,g);else for(var S=u.length-1;S>=0;S--)if(b=u[S])f=(p<3?b(f):p>3?b(n,h,f):b(n,h))||f;return p>3&&f&&Object.defineProperty(n,h,f),f},Lu=function(u,n){return function(h,g){n(h,g,u)}},wM=Mt("extensions-warning-message",C.warning,e(1608,"Icon shown with a warning message in the extensions editor.")),Du=class u extends i{static{this.ID="editor.contrib.unicodeHighlighter"}constructor(n,h,g,p){super();this._editor=n,this._editorWorkerService=h,this._workspaceTrustService=g,this._highlighter=null,this._bannerClosed=!1,this._updateState=(f)=>{if(f&&f.hasMore){if(this._bannerClosed)return;let b=Math.max(f.ambiguousCharacterCount,f.nonBasicAsciiCharacterCount,f.invisibleCharacterCount),S;if(f.nonBasicAsciiCharacterCount>=b)S={message:e(1609,"This document contains many non-basic ASCII unicode characters"),command:new Tu};else if(f.ambiguousCharacterCount>=b)S={message:e(1610,"This document contains many ambiguous unicode characters"),command:new Od};else if(f.invisibleCharacterCount>=b)S={message:e(1611,"This document contains many invisible unicode characters"),command:new Ru};else throw Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:S.message,icon:wM,actions:[{label:S.command.shortLabel,href:`command:${S.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(p.createInstance(pf,n)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=n.getOption(142),this._register(g.onDidChangeTrust((f)=>{this._updateHighlighter()})),this._register(n.onDidChangeConfiguration((f)=>{if(f.hasChanged(142))this._options=n.getOption(142),this._updateHighlighter()})),this._updateHighlighter()}dispose(){if(this._highlighter)this._highlighter.dispose(),this._highlighter=null;super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter)this._highlighter.dispose(),this._highlighter=null;if(!this._editor.hasModel())return;let n=CM(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([n.nonBasicASCII,n.ambiguousCharacters,n.invisibleCharacters].every((g)=>g===!1))return;let h={nonBasicASCII:n.nonBasicASCII,ambiguousCharacters:n.ambiguousCharacters,invisibleCharacters:n.invisibleCharacters,includeComments:n.includeComments,includeStrings:n.includeStrings,allowedCodePoints:Object.keys(n.allowedCharacters).map((g)=>g.codePointAt(0)),allowedLocales:Object.keys(n.allowedLocales).map((g)=>{if(g==="_os")return _c.NumberFormat().value.resolvedOptions().locale;else if(g==="_vscode")return QM;return g})};if(this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri))this._highlighter=new sC(this._editor,h,this._updateState,this._editorWorkerService);else this._highlighter=new _D(this._editor,h,this._updateState)}getDecorationInfo(n){if(this._highlighter)return this._highlighter.getDecorationInfo(n);return null}};Du=lC([Lu(1,Mi),Lu(2,Jk),Lu(3,O)],Du);function CM(u,n){return{nonBasicASCII:n.nonBasicASCII===pa?!u:n.nonBasicASCII,ambiguousCharacters:n.ambiguousCharacters,invisibleCharacters:n.invisibleCharacters,includeComments:n.includeComments===pa?!u:n.includeComments,includeStrings:n.includeStrings===pa?!u:n.includeStrings,allowedCharacters:n.allowedCharacters,allowedLocales:n.allowedLocales}}var sC=class u extends i{constructor(n,h,g,p){super();this._editor=n,this._options=h,this._updateState=g,this._editorWorkerService=p,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ke(()=>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 n=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then((h)=>{if(this._model.isDisposed())return;if(this._model.getVersionId()!==n)return;this._updateState(h);let g=[];if(!h.hasMore)for(let p of h.ranges)g.push({range:p,options:mf.instance.getDecorationFromOptions(this._options)});this._decorations.set(g)})}getDecorationInfo(n){if(!this._decorations.has(n))return null;let h=this._editor.getModel();if(!g0(h,n))return null;let g=h.getValueInRange(n.range);return{reason:vD(g,this._options),inComment:kk(h,n),inString:Ek(h,n)}}};sC=lC([Lu(3,Mi)],sC);class _D extends i{constructor(u,n,h){super();this._editor=u,this._options=n,this._updateState=h,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new ke(()=>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 u=this._editor.getVisibleRanges(),n=[],h={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(let g of u){let p=Ev.computeUnicodeHighlights(this._model,this._options,g);for(let f of p.ranges)h.ranges.push(f);h.ambiguousCharacterCount+=h.ambiguousCharacterCount,h.invisibleCharacterCount+=h.invisibleCharacterCount,h.nonBasicAsciiCharacterCount+=h.nonBasicAsciiCharacterCount,h.hasMore=h.hasMore||p.hasMore}if(!h.hasMore)for(let g of h.ranges)n.push({range:g,options:mf.instance.getDecorationFromOptions(this._options)});this._updateState(h),this._decorations.set(n)}getDecorationInfo(u){if(!this._decorations.has(u))return null;let n=this._editor.getModel(),h=n.getValueInRange(u.range);if(!g0(n,u))return null;return{reason:vD(h,this._options),inComment:kk(n,u),inString:Ek(n,u)}}}var bD=e(1612,"Configure Unicode Highlight Options"),aC=class u{constructor(n,h){this._editor=n,this._markdownRendererService=h,this.hoverOrdinal=5}computeSync(n,h){if(!this._editor.hasModel()||n.type!==1)return[];let g=this._editor.getModel(),p=this._editor.getContribution(Du.ID);if(!p)return[];let f=[],b=new Set,S=300;for(let w of h){let x=p.getDecorationInfo(w);if(!x)continue;let E=g.getValueInRange(w.range).codePointAt(0),Z=rC(E),X;switch(x.reason.kind){case 0:{if(uu(x.reason.confusableWith))X=e(1613,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",Z,rC(x.reason.confusableWith.codePointAt(0)));else X=e(1614,"The character {0} could be confused with the character {1}, which is more common in source code.",Z,rC(x.reason.confusableWith.codePointAt(0)));break}case 1:X=e(1615,"The character {0} is invisible.",Z);break;case 2:X=e(1616,"The character {0} is not a basic ASCII character.",Z);break}if(b.has(X))continue;b.add(X);let J={codePoint:E,reason:x.reason,inComment:x.inComment,inString:x.inString},Q=e(1617,"Adjust settings"),te=Dk(ff.ID,J),re=new Pn("",!0).appendMarkdown(X).appendText(" ").appendLink(te,Q,bD);f.push(new eo(this,w.range,[re],!1,S++))}return f}renderHoverParts(n,h){return KL(n,h,this._editor,this._markdownRendererService)}getAccessibleContent(n){return n.contents.map((h)=>h.value).join(`
|
|
61
|
+
`)}};aC=lC([Lu(1,Wr)],aC);function dC(u){return`U+${u.toString(16).padStart(4,"0")}`}function rC(u){let n=`\`${dC(u)}\``;if(!fd.isInvisibleCharacter(u))n+=` "${`${yM(u)}`}"`;return n}function yM(u){if(u===96)return"`` ` ``";return"`"+String.fromCodePoint(u)+"`"}function vD(u,n){return Ev.computeUnicodeHighlightReason(u,n)}class mf{constructor(){this.map=new Map}static{this.instance=new mf}getDecorationFromOptions(u){return this.getDecoration(!u.includeComments,!u.includeStrings)}getDecoration(u,n){let h=`${u}${n}`,g=this.map.get(h);if(!g)g=ue.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:u,hideInStringTokens:n}),this.map.set(h,g);return g}}class SD extends U{constructor(){super({id:Od.ID,label:y(1626,"Disable highlighting of characters in comments"),precondition:void 0});this.shortLabel=e(1618,"Disable Highlight In Comments")}async run(u,n){let h=u.get(oe);if(h)this.runAction(h)}async runAction(u){await u.updateValue(ms.includeComments,!1,2)}}class wD extends U{constructor(){super({id:Od.ID,label:y(1627,"Disable highlighting of characters in strings"),precondition:void 0});this.shortLabel=e(1619,"Disable Highlight In Strings")}async run(u,n){let h=u.get(oe);if(h)this.runAction(h)}async runAction(u){await u.updateValue(ms.includeStrings,!1,2)}}class Od extends Cn{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters"}constructor(){super({id:Od.ID,title:y(1628,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1});this.shortLabel=e(1620,"Disable Ambiguous Highlight")}async run(u,n){let h=u.get(oe);if(h)this.runAction(h)}async runAction(u){await u.updateValue(ms.ambiguousCharacters,!1,2)}}class Ru extends Cn{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters"}constructor(){super({id:Ru.ID,title:y(1629,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1});this.shortLabel=e(1621,"Disable Invisible Highlight")}async run(u,n){let h=u.get(oe);if(h)this.runAction(h)}async runAction(u){await u.updateValue(ms.invisibleCharacters,!1,2)}}class Tu extends Cn{static{this.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters"}constructor(){super({id:Tu.ID,title:y(1630,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1});this.shortLabel=e(1622,"Disable Non ASCII Highlight")}async run(u,n){let h=u.get(oe);if(h)this.runAction(h)}async runAction(u){await u.updateValue(ms.nonBasicASCII,!1,2)}}class ff extends Cn{static{this.ID="editor.action.unicodeHighlight.showExcludeOptions"}constructor(){super({id:ff.ID,title:y(1631,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(u,n){let{codePoint:h,reason:g,inString:p,inComment:f}=n,b=String.fromCodePoint(h),S=u.get(En),w=u.get(oe);function x(X){if(fd.isInvisibleCharacter(X))return e(1623,"Exclude {0} (invisible character) from being highlighted",dC(X));return e(1624,"Exclude {0} from being highlighted",`${dC(X)} "${b}"`)}let I=[];if(g.kind===0)for(let X of g.notAmbiguousInLocales)I.push({label:e(1625,'Allow unicode characters that are more common in the language "{0}".',X),run:async()=>{IM(w,[X])}});if(I.push({label:x(h),run:()=>xM(w,[h])}),f){let X=new SD;I.push({label:X.label,run:async()=>X.runAction(w)})}else if(p){let X=new wD;I.push({label:X.label,run:async()=>X.runAction(w)})}function E(X){return typeof X.desc.title==="string"?X.desc.title:X.desc.title.value}if(g.kind===0){let X=new Od;I.push({label:E(X),run:async()=>X.runAction(w)})}else if(g.kind===1){let X=new Ru;I.push({label:E(X),run:async()=>X.runAction(w)})}else if(g.kind===2){let X=new Tu;I.push({label:E(X),run:async()=>X.runAction(w)})}else LM(g);let Z=await S.pick(I,{title:bD});if(Z)await Z.run()}}async function xM(u,n){let h=u.getValue(ms.allowedCharacters),g;if(typeof h==="object"&&h)g=h;else g={};for(let p of n)g[String.fromCodePoint(p)]=!0;await u.updateValue(ms.allowedCharacters,g,2)}async function IM(u,n){let h=u.inspect(ms.allowedLocales).user?.value,g;if(typeof h==="object"&&h)g=Object.assign({},h);else g={};for(let p of n)g[p]=!0;await u.updateValue(ms.allowedLocales,g,2)}function LM(u){throw Error(`Unexpected value: ${u}`)}lt(Od);lt(Ru);lt(Tu);lt(ff);fe(Du.ID,Du,1);El.register(aC);class cC{constructor(u,n,h,g,p){this._onDidChange=new sm,this._onDidExtraLibsChange=new sm,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(u),this.setDiagnosticsOptions(n),this.setWorkerOptions(h),this.setInlayHintsOptions(g),this.setModeConfiguration(p),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(u,n){let h;if(typeof n>"u")h=`ts:extralib-${Math.random().toString(36).substring(2,15)}`;else h=n;if(this._extraLibs[h]&&this._extraLibs[h].content===u)return{dispose:()=>{}};let g=1;if(this._removedExtraLibs[h])g=this._removedExtraLibs[h]+1;if(this._extraLibs[h])g=this._extraLibs[h].version+1;return this._extraLibs[h]={content:u,version:g},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let p=this._extraLibs[h];if(!p)return;if(p.version!==g)return;delete this._extraLibs[h],this._removedExtraLibs[h]=g,this._fireOnDidExtraLibsChangeSoon()}}}setExtraLibs(u){for(let n in this._extraLibs)this._removedExtraLibs[n]=this._extraLibs[n].version;if(this._extraLibs=Object.create(null),u&&u.length>0)for(let n of u){let h=n.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,g=n.content,p=1;if(this._removedExtraLibs[h])p=this._removedExtraLibs[h]+1;this._extraLibs[h]={content:g,version:p}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){if(this._onDidExtraLibsChangeTimeout!==-1)return;this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0)}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(u){this._compilerOptions=u||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(u){this._diagnosticsOptions=u||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(u){this._workerOptions=u||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(u){this._inlayHintsOptions=u||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(u){}setEagerModelSync(u){this._eagerModelSync=u}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(u){this._modeConfiguration=u||Object.create(null),this._onDidChange.fire(void 0)}}var CD={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},DI=new cC({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},CD),EM=new cC({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},CD);function yD(){return ce("7gngmamr"),import("./tsMode-7gngmamr.js")}ve.onLanguage("typescript",()=>yD().then((u)=>u.setupTypeScript(DI)));ve.onLanguage("javascript",()=>yD().then((u)=>u.setupJavaScript(EM)));export{Ht,sv,Bh,V1,W1,z1,av,lv,$I,U1,hd,pd,KM,W_,Vh,El,cv,xg,q1,J1,LI,RI,K1,II,Wh,z_,G1,Y1,_g,dv,Sg,uv,Z1,Nr,hv,NI,zh,As,DI};
|
|
62
|
+
|
|
63
|
+
//# debugId=301B20F2D870C62464756E2164756E21
|
|
64
|
+
//# sourceMappingURL=studio-nsec0hxm.js.map
|